f6d49d07 by root

Merge branch 'deployment/production'

Conflicts:
	.gitignore
2 parents a5611969 e5290566
Showing 34 changed files with 2804 additions and 7 deletions
.DS_Store
administrator/cache/*
administrator/logs/*
cache
app/administrator/cache/*
app/administrator/logs/*
/administrator/cache/*
/administrator/logs/*
/cache
files
images
php5.6-back
......
<?php
/**
* @package Joomla.Administrator
* @subpackage com_cache
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
JHtml::_('formbehavior.chosen', 'select');
JHtml::_('bootstrap.tooltip');
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo JRoute::_('index.php?option=com_cache'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty($this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif; ?>
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
<?php if ($this->total > 0) : ?>
<table class="table table-striped">
<thead>
<tr>
<th width="1%" class="nowrap center">
<?php echo JHtml::_('grid.checkall'); ?>
</th>
<th class="title nowrap">
<?php echo JHtml::_('searchtools.sort', 'COM_CACHE_GROUP', 'group', $listDirn, $listOrder); ?>
</th>
<th width="5%" class="nowrap">
<?php echo JHtml::_('searchtools.sort', 'COM_CACHE_NUMBER_OF_FILES', 'count', $listDirn, $listOrder); ?>
</th>
<th width="10%" class="nowrap">
<?php echo JHtml::_('searchtools.sort', 'COM_CACHE_SIZE', 'size', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4">
<?php echo $this->pagination->getListFooter(); ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
$i = 0;
foreach ($this->data as $folder => $item) : ?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<input type="checkbox" id="cb<?php echo $i; ?>" name="cid[]" value="<?php echo $this->escape($item->group); ?>" onclick="Joomla.isChecked(this.checked);" />
</td>
<td>
<label for="cb<?php echo $i; ?>">
<strong><?php echo $this->escape($item->group); ?></strong>
</label>
</td>
<td>
<?php echo $item->count; ?>
</td>
<td>
<?php echo JHtml::_('number.bytes', $item->size); ?>
</td>
</tr>
<?php $i++; endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
<?xml version="1.0" encoding="utf-8"?>
<metadata>
<layout title="COM_CACHE_CACHE_VIEW_DEFAULT_TITLE">
<message>
<![CDATA[COM_CACHE_CACHE_VIEW_DEFAULT_DESC]]>
</message>
</layout>
</metadata>
<?php
/**
* @package Joomla.Administrator
* @subpackage com_cache
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* HTML View class for the Cache component
*
* @since 1.6
*/
class CacheViewCache extends JViewLegacy
{
/**
* @var object client object.
* @deprecated 4.0
*/
protected $client;
protected $data;
protected $pagination;
protected $state;
/**
* Display a view.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise an Error object.
*/
public function display($tpl = null)
{
$this->data = $this->get('Data');
$this->pagination = $this->get('Pagination');
$this->total = $this->get('Total');
$this->state = $this->get('State');
$this->filterForm = $this->get('FilterForm');
$this->activeFilters = $this->get('ActiveFilters');
// Check for errors.
if (count($errors = $this->get('Errors')))
{
throw new Exception(implode("\n", $errors), 500);
}
$this->addToolbar();
$this->sidebar = JHtmlSidebar::render();
parent::display($tpl);
}
/**
* Add the page title and toolbar.
*
* @return void
*
* @since 1.6
*/
protected function addToolbar()
{
$state = $this->get('State');
if ($state->get('client_id') == 1)
{
JToolbarHelper::title(JText::_('COM_CACHE_CLEAR_CACHE_ADMIN_TITLE'), 'lightning clear');
}
else
{
JToolbarHelper::title(JText::_('COM_CACHE_CLEAR_CACHE_SITE_TITLE'), 'lightning clear');
}
JToolbarHelper::custom('delete', 'delete.png', 'delete_f2.png', 'JTOOLBAR_DELETE', true);
JToolbarHelper::custom('deleteAll', 'remove.png', 'delete_f2.png', 'JTOOLBAR_DELETE_ALL', false);
JToolbarHelper::divider();
if (JFactory::getUser()->authorise('core.admin', 'com_cache'))
{
JToolbarHelper::preferences('com_cache');
}
JToolbarHelper::divider();
JToolbarHelper::help('JHELP_SITE_MAINTENANCE_CLEAR_CACHE');
JHtmlSidebar::setAction('index.php?option=com_cache');
}
}
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
<?php
/**
* @package Joomla.Administrator
* @subpackage Template.hathor
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
$listOrder = $this->escape($this->state->get('list.ordering'));
$listDirn = $this->escape($this->state->get('list.direction'));
?>
<form action="<?php echo JRoute::_('index.php?option=com_cache'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (!empty( $this->sidebar)) : ?>
<div id="j-sidebar-container" class="span2">
<?php echo $this->sidebar; ?>
</div>
<div id="j-main-container" class="span10">
<?php else : ?>
<div id="j-main-container">
<?php endif;?>
<fieldset id="filter-bar">
<legend class="element-invisible"><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?></legend>
<div class="filter-select fltrt">
<label class="selectlabel" for="client_id">
<?php echo JText::_('COM_CACHE_SELECT_CLIENT'); ?>
</label>
<select name="client_id" id="client_id">
<?php echo JHtml::_('select.options', CacheHelper::getClientOptions(), 'value', 'text', $this->state->get('client_id'));?>
</select>
<button type="submit" id="filter-go">
<?php echo JText::_('JSUBMIT'); ?></button>
</div>
</fieldset>
<div class="clr"> </div>
<table class="adminlist">
<thead>
<tr>
<th class="checkmark-col">
<input type="checkbox" name="checkall-toggle" value="" title="<?php echo JText::_('JGLOBAL_CHECK_ALL'); ?>" onclick="Joomla.checkAll(this)" />
</th>
<th class="title nowrap">
<?php echo JHtml::_('grid.sort', 'COM_CACHE_GROUP', 'group', $listDirn, $listOrder); ?>
</th>
<th class="width-5 center nowrap">
<?php echo JHtml::_('grid.sort', 'COM_CACHE_NUMBER_OF_FILES', 'count', $listDirn, $listOrder); ?>
</th>
<th class="width-10 center">
<?php echo JHtml::_('grid.sort', 'COM_CACHE_SIZE', 'size', $listDirn, $listOrder); ?>
</th>
</tr>
</thead>
<tbody>
<?php
$i = 0;
foreach ($this->data as $folder => $item) : ?>
<tr class="row<?php echo $i % 2; ?>">
<td>
<input type="checkbox" id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $item->group; ?>" onclick="Joomla.isChecked(this.checked);" />
</td>
<td>
<span class="bold">
<?php echo $item->group; ?>
</span>
</td>
<td class="center">
<?php echo $item->count; ?>
</td>
<td class="center">
<?php echo JHtml::_('number.bytes', $item->size*1024); ?>
</td>
</tr>
<?php $i++; endforeach; ?>
</tbody>
</table>
<?php echo $this->pagination->getListFooter(); ?>
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />
<input type="hidden" name="client" value="<?php echo $this->client->id;?>" />
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
<?php echo JHtml::_('form.token'); ?>
</div>
</form>
<?php
/**
* @package FrameworkOnFramework
* @subpackage utils
* @copyright Copyright (C) 2010-2016 Nicholas K. Dionysopoulos / Akeeba Ltd. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('FOF_INCLUDED') or die;
/**
* A utility class to help you quickly clean the Joomla! cache
*/
class FOFUtilsCacheCleaner
{
/**
* Clears the com_modules and com_plugins cache. You need to call this whenever you alter the publish state or
* parameters of a module or plugin from your code.
*
* @return void
*/
public static function clearPluginsAndModulesCache()
{
self::clearPluginsCache();
self::clearModulesCache();
}
/**
* Clears the com_plugins cache. You need to call this whenever you alter the publish state or parameters of a
* plugin from your code.
*
* @return void
*/
public static function clearPluginsCache()
{
self::clearCacheGroups(array('com_plugins'), array(0,1));
}
/**
* Clears the com_modules cache. You need to call this whenever you alter the publish state or parameters of a
* module from your code.
*
* @return void
*/
public static function clearModulesCache()
{
self::clearCacheGroups(array('com_modules'), array(0,1));
}
/**
* Clears the specified cache groups.
*
* @param array $clearGroups Which cache groups to clear. Usually this is com_yourcomponent to clear your
* component's cache.
* @param array $cacheClients Which cache clients to clear. 0 is the back-end, 1 is the front-end. If you do not
* specify anything, both cache clients will be cleared.
*
* @return void
*/
public static function clearCacheGroups(array $clearGroups, array $cacheClients = array(0, 1))
{
$conf = JFactory::getConfig();
foreach ($clearGroups as $group)
{
foreach ($cacheClients as $client_id)
{
try
{
$options = array(
'defaultgroup' => $group,
'cachebase' => ($client_id) ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache')
);
$cache = JCache::getInstance('callback', $options);
$cache->clean();
}
catch (Exception $e)
{
// suck it up
}
}
}
}
}
\ No newline at end of file
<?php
N2Loader::importAll('libraries.cache.storage');
class N2Cache {
protected $group = '';
protected $isAccessible = false;
/** @var N2CacheStorage */
public $storage;
protected $_storageEngine = 'default';
/**
* @param string $engine
*
* @return N2CacheStorage
*/
public static function getStorage($engine = "default") {
static $storage = null;
if ($storage === null) {
$storage = array(
'filesystem' => new N2CacheStorageFilesystem(),
'database' => new N2CacheStorageDatabase()
);
}
if ($engine == 'default') {
if (defined('NEXTEND_CACHE_STORAGE')) {
return $storage[NEXTEND_CACHE_STORAGE];
}
return $storage['filesystem'];
}
return $storage[$engine];
}
public static function clearGroup($group) {
$storage = self::getStorage();
$storage->clear($group);
$storage->clear($group, 'web');
}
public function __construct($group, $isAccessible = false) {
$this->group = $group;
$this->isAccessible = $isAccessible;
$this->storage = self::getStorage($this->_storageEngine);
}
protected function clearCurrentGroup() {
$this->storage->clear($this->group, $this->getScope());
}
protected function getScope() {
if ($this->isAccessible) {
return 'web';
}
return 'notweb';
}
protected function exists($key) {
return $this->storage->exists($this->group, $key, $this->getScope());
}
protected function get($key) {
return $this->storage->get($this->group, $key, $this->getScope());
}
protected function set($key, $value) {
$this->storage->set($this->group, $key, $value, $this->getScope());
}
protected function getPath($key) {
return $this->storage->getPath($this->group, $key, $this->getScope());
}
protected function remove($key) {
return $this->storage->remove($this->group, $key, $this->getScope());
}
}
<?php
N2Loader::import('libraries.cache.cache');
class N2CacheCombine extends N2Cache {
protected $files = array();
protected $inline = '';
protected $fileType = '';
protected $minify = false;
protected $options = array();
public function __construct($fileType, $minify = false, $options = array()) {
$this->fileType = $fileType;
$this->minify = $minify;
$this->options = $options;
$this->options['minify'] = $this->minify;
parent::__construct('combined', true);
}
public function add($file) {
if (!in_array($file, $this->files)) {
$this->files[] = $file;
}
}
public function addInline($text) {
$this->inline .= $text;
}
protected function getHash() {
$hash = '';
for ($i = 0; $i < count($this->files); $i++) {
$hash .= $this->files[$i] . filemtime($this->files[$i]);
}
if (!empty($this->inline)) {
$hash .= $this->inline;
}
return md5($hash . json_encode($this->options));
}
public function make() {
$hash = $this->getHash();
$fileName = $hash . '.' . $this->fileType;
if (!$this->exists($fileName)) {
$buffer = '';
for ($i = 0; $i < count($this->files); $i++) {
$buffer .= file_get_contents($this->files[$i]);
}
if ($this->minify !== false) {
$buffer = call_user_func($this->minify, $buffer);
}
$buffer .= $this->inline;
$this->set($fileName, $buffer);
}
return $this->getPath($fileName);
}
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.cache');
class N2CacheImage extends N2Cache {
protected $_storageEngine = 'filesystem';
protected function getScope() {
return 'image';
}
public function makeCache($fileExtension, $callable, $parameters = array(), $hash = false) {
if (!$hash) {
$hash = $this->generateHash($fileExtension, $callable, $parameters);
}
$keepFileName = pathinfo($parameters[1], PATHINFO_FILENAME);
$fileName = $hash . (!empty($keepFileName) ? '/' . $keepFileName : '') . '.' . $fileExtension;
if (!$this->exists($fileName)) {
$this->set($fileName, call_user_func_array($callable, $parameters));
}
return $this->getPath($fileName);
}
private function generateHash($fileExtension, $callable, $parameters) {
return md5(json_encode(array(
$fileExtension,
$callable,
$parameters
)));
}
}
class N2StoreImage extends N2Cache {
protected $_storageEngine = 'filesystem';
protected function getScope() {
return 'image';
}
public function makeCache($fileName, $content) {
if (!$this->isImage($fileName)) {
return false;
}
if (!$this->exists($fileName)) {
$this->set($fileName, $content);
}
return $this->getPath($fileName);
}
private function isImage($fileName) {
$supported_image = array(
'gif',
'jpg',
'jpeg',
'png',
'mp4',
'mp3'
);
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($ext, $supported_image)) {
return true;
}
return false;
}
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.cache');
class N2CacheManifest extends N2Cache {
private $isRaw = false;
private $manifestData;
public function __construct($group, $isAccessible = false, $isRaw = false) {
parent::__construct($group, $isAccessible);
$this->isRaw = $isRaw;
}
public function makeCache($fileName, $hash, $callable) {
if (!$this->isCached($fileName, $hash)) {
$return = call_user_func($callable, $this);
if ($return === false) {
return false;
}
return $this->createCacheFile($fileName, $hash, $return);
}
if ($this->isAccessible) {
return $this->getPath($fileName);
}
return json_decode($this->get($fileName), true);
}
private function isCached($fileName, $hash) {
$manifestKey = $this->getManifestKey($fileName);
if ($this->exists($manifestKey)) {
$this->manifestData = json_decode($this->get($manifestKey), true);
if (!$this->isCacheValid($this->manifestData) || $this->manifestData['hash'] != $hash) {
$this->clean($fileName);
return false;
}
return true;
}
return false;
}
protected function createCacheFile($fileName, $hash, $content) {
$this->manifestData = array();
$this->manifestData['hash'] = $hash;
$this->addManifestData($this->manifestData);
$this->set($this->getManifestKey($fileName), json_encode($this->manifestData));
$this->set($fileName, $this->isRaw ? $content : json_encode($content));
if ($this->isAccessible) {
return $this->getPath($fileName);
}
return $content;
}
protected function isCacheValid(&$manifestData) {
return true;
}
protected function addManifestData(&$manifestData) {
}
public function clean($fileName) {
$this->remove($this->getManifestKey($fileName));
$this->remove($fileName);
}
protected function getManifestKey($fileName) {
return $fileName . '.manifest';
}
public function getData($key, $default = 0) {
return isset($this->manifestData[$key]) ? $this->manifestData[$key] : $default;
}
}
\ No newline at end of file
<?php
/**
* N2MinifierJS.php - modified PHP implementation of Douglas Crockford's N2MinifierJS.
*
* <code>
* $minifiedJs = N2MinifierJS::minify($js);
* </code>
*
* This is a modified port of jsmin.c. Improvements:
*
* Does not choke on some regexp literals containing quote characters. E.g. /'/
*
* Spaces are preserved after some add/sub operators, so they are not mistakenly
* converted to post-inc/dec. E.g. a + ++b -> a+ ++b
*
* Preserves multi-line comments that begin with /*!
*
* PHP 5 or higher is required.
*
* Permission is hereby granted to use this version of the library under the
* same terms as jsmin.c, which has the following license:
*
* --
* Copyright (c) 2002 Douglas Crockford (www.crockford.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The Software shall be used for Good, not Evil.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* --
*
* @package N2MinifierJS
* @author Ryan Grove <ryan@wonko.com> (PHP port)
* @author Steve Clay <steve@mrclay.org> (modifications + cleanup)
* @author Andrea Giammarchi <http://www.3site.eu> (spaceBeforeRegExp)
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://code.google.com/p/jsmin-php/
*/
class N2MinifierJS {
const ORD_LF = 10;
const ORD_SPACE = 32;
const ACTION_KEEP_A = 1;
const ACTION_DELETE_A = 2;
const ACTION_DELETE_A_B = 3;
protected $a = "\n";
protected $b = '';
protected $input = '';
protected $inputIndex = 0;
protected $inputLength = 0;
protected $lookAhead = null;
protected $output = '';
protected $lastByteOut = '';
protected $keptComment = '';
/**
* Minify Javascript.
*
* @param string $js Javascript to be minified
*
* @return string
*/
public static function minify($js)
{
$jsmin = new N2MinifierJS($js);
return $jsmin->min();
}
/**
* @param string $input
*/
public function __construct($input)
{
$this->input = $input;
}
/**
* Perform minification, return result
*
* @return string
*/
public function min()
{
if ($this->output !== '') { // min already run
return $this->output;
}
$mbIntEnc = null;
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('8bit');
}
$this->input = str_replace("\r\n", "\n", $this->input);
$this->inputLength = strlen($this->input);
$this->action(self::ACTION_DELETE_A_B);
while ($this->a !== null) {
// determine next command
$command = self::ACTION_KEEP_A; // default
if ($this->a === ' ') {
if (($this->lastByteOut === '+' || $this->lastByteOut === '-')
&& ($this->b === $this->lastByteOut)) {
// Don't delete this space. If we do, the addition/subtraction
// could be parsed as a post-increment
} elseif (! $this->isAlphaNum($this->b)) {
$command = self::ACTION_DELETE_A;
}
} elseif ($this->a === "\n") {
if ($this->b === ' ') {
$command = self::ACTION_DELETE_A_B;
// in case of mbstring.func_overload & 2, must check for null b,
// otherwise mb_strpos will give WARNING
} elseif ($this->b === null
|| (false === strpos('{[(+-!~', $this->b)
&& ! $this->isAlphaNum($this->b))) {
$command = self::ACTION_DELETE_A;
}
} elseif (! $this->isAlphaNum($this->a)) {
if ($this->b === ' '
|| ($this->b === "\n"
&& (false === strpos('}])+-"\'', $this->a)))) {
$command = self::ACTION_DELETE_A_B;
}
}
$this->action($command);
}
$this->output = trim($this->output);
if ($mbIntEnc !== null) {
mb_internal_encoding($mbIntEnc);
}
return $this->output;
}
/**
* ACTION_KEEP_A = Output A. Copy B to A. Get the next B.
* ACTION_DELETE_A = Copy B to A. Get the next B.
* ACTION_DELETE_A_B = Get the next B.
*
* @param int $command
*
*@throws N2JSMin_UnterminatedRegExpException|N2JSMin_UnterminatedStringException
*/
protected function action($command)
{
// make sure we don't compress "a + ++b" to "a+++b", etc.
if ($command === self::ACTION_DELETE_A_B
&& $this->b === ' '
&& ($this->a === '+' || $this->a === '-')) {
// Note: we're at an addition/substraction operator; the inputIndex
// will certainly be a valid index
if ($this->input[$this->inputIndex] === $this->a) {
// This is "+ +" or "- -". Don't delete the space.
$command = self::ACTION_KEEP_A;
}
}
switch ($command) {
case self::ACTION_KEEP_A: // 1
$this->output .= $this->a;
if ($this->keptComment) {
$this->output = rtrim($this->output, "\n");
$this->output .= $this->keptComment;
$this->keptComment = '';
}
$this->lastByteOut = $this->a;
// fallthrough intentional
case self::ACTION_DELETE_A: // 2
$this->a = $this->b;
if ($this->a === "'" || $this->a === '"') { // string literal
$str = $this->a; // in case needed for exception
for(;;) {
$this->output .= $this->a;
$this->lastByteOut = $this->a;
$this->a = $this->get();
if ($this->a === $this->b) { // end quote
break;
}
if ($this->isEOF($this->a)) {
throw new N2JSMin_UnterminatedStringException(
"N2MinifierJS: Unterminated String at byte {$this->inputIndex}: {$str}");
}
$str .= $this->a;
if ($this->a === '\\') {
$this->output .= $this->a;
$this->lastByteOut = $this->a;
$this->a = $this->get();
$str .= $this->a;
}
}
}
// fallthrough intentional
case self::ACTION_DELETE_A_B: // 3
$this->b = $this->next();
if ($this->b === '/' && $this->isRegexpLiteral()) {
$this->output .= $this->a . $this->b;
$pattern = '/'; // keep entire pattern in case we need to report it in the exception
for(;;) {
$this->a = $this->get();
$pattern .= $this->a;
if ($this->a === '[') {
for(;;) {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
if ($this->a === ']') {
break;
}
if ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
}
if ($this->isEOF($this->a)) {
throw new N2JSMin_UnterminatedRegExpException(
"N2MinifierJS: Unterminated set in RegExp at byte "
. $this->inputIndex .": {$pattern}");
}
}
}
if ($this->a === '/') { // end pattern
break; // while (true)
} elseif ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
} elseif ($this->isEOF($this->a)) {
throw new N2JSMin_UnterminatedRegExpException(
"N2MinifierJS: Unterminated RegExp at byte {$this->inputIndex}: {$pattern}");
}
$this->output .= $this->a;
$this->lastByteOut = $this->a;
}
$this->b = $this->next();
}
// end case ACTION_DELETE_A_B
}
}
/**
* @return bool
*/
protected function isRegexpLiteral()
{
if (false !== strpos("(,=:[!&|?+-~*{;", $this->a)) {
// we obviously aren't dividing
return true;
}
if ($this->a === ' ' || $this->a === "\n") {
$length = strlen($this->output);
if ($length < 2) { // weird edge case
return true;
}
// you can't divide a keyword
if (preg_match('/(?:case|else|in|return|typeof)$/', $this->output, $m)) {
if ($this->output === $m[0]) { // odd but could happen
return true;
}
// make sure it's a keyword, not end of an identifier
$charBeforeKeyword = substr($this->output, $length - strlen($m[0]) - 1, 1);
if (! $this->isAlphaNum($charBeforeKeyword)) {
return true;
}
}
}
return false;
}
/**
* Return the next character from stdin. Watch out for lookahead. If the character is a control character,
* translate it to a space or linefeed.
*
* @return string
*/
protected function get()
{
$c = $this->lookAhead;
$this->lookAhead = null;
if ($c === null) {
// getc(stdin)
if ($this->inputIndex < $this->inputLength) {
$c = $this->input[$this->inputIndex];
$this->inputIndex += 1;
} else {
$c = null;
}
}
if (ord($c) >= self::ORD_SPACE || $c === "\n" || $c === null) {
return $c;
}
if ($c === "\r") {
return "\n";
}
return ' ';
}
/**
* Does $a indicate end of input?
*
* @param string $a
* @return bool
*/
protected function isEOF($a)
{
return ord($a) <= self::ORD_LF;
}
/**
* Get next char (without getting it). If is ctrl character, translate to a space or newline.
*
* @return string
*/
protected function peek()
{
$this->lookAhead = $this->get();
return $this->lookAhead;
}
/**
* Return true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character.
*
* @param string $c
*
* @return bool
*/
protected function isAlphaNum($c)
{
return (preg_match('/^[a-z0-9A-Z_\\$\\\\]$/', $c) || ord($c) > 126);
}
/**
* Consume a single line comment from input (possibly retaining it)
*/
protected function consumeSingleLineComment()
{
$comment = '';
while (true) {
$get = $this->get();
$comment .= $get;
if (ord($get) <= self::ORD_LF) { // end of line reached
// if IE conditional comment
if (preg_match('/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
$this->keptComment .= "/{$comment}";
}
return;
}
}
}
/**
* Consume a multiple line comment from input (possibly retaining it)
*
* @throws N2JSMin_UnterminatedCommentException
*/
protected function consumeMultipleLineComment()
{
$this->get();
$comment = '';
for(;;) {
$get = $this->get();
if ($get === '*') {
if ($this->peek() === '/') { // end of comment reached
$this->get();
if (0 === strpos($comment, '!')) {
// preserved by YUI Compressor
if (!$this->keptComment) {
// don't prepend a newline if two comments right after one another
$this->keptComment = "\n";
}
$this->keptComment .= "/*!" . substr($comment, 1) . "*/\n";
} else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
// IE conditional
$this->keptComment .= "/*{$comment}*/";
}
return;
}
} elseif ($get === null) {
throw new N2JSMin_UnterminatedCommentException(
"N2MinifierJS: Unterminated comment at byte {$this->inputIndex}: /*{$comment}");
}
$comment .= $get;
}
}
/**
* Get the next character, skipping over comments. Some comments may be preserved.
*
* @return string
*/
protected function next()
{
$get = $this->get();
if ($get === '/') {
switch ($this->peek()) {
case '/':
$this->consumeSingleLineComment();
$get = "\n";
break;
case '*':
$this->consumeMultipleLineComment();
$get = ' ';
break;
}
}
return $get;
}
}
class N2JSMin_UnterminatedStringException extends Exception {}
class N2JSMin_UnterminatedCommentException extends Exception {}
class N2JSMin_UnterminatedRegExpException extends Exception {}
<?php
abstract class N2CacheStorage {
protected $paths = array();
public function __construct() {
$this->paths['web'] = 'web';
$this->paths['notweb'] = 'notweb';
$this->paths['image'] = 'image';
}
public function isFilesystem() {
return false;
}
public abstract function clear($group, $scope = 'notweb');
public abstract function exists($group, $key, $scope = 'notweb');
public abstract function set($group, $key, $value, $scope = 'notweb');
public abstract function get($group, $key, $scope = 'notweb');
public abstract function remove($group, $key, $scope = 'notweb');
public abstract function getPath($group, $key, $scope = 'notweb');
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.storage.cachestorage');
class N2CacheStorageDatabase extends N2CacheStorage {
protected $db;
public function __construct() {
parent::__construct();
$this->db = new N2StorageSection('cache');
}
public function clear($group, $scope = 'notweb') {
$this->db->delete($scope . '/' . $group);
}
public function exists($group, $key, $scope = 'notweb') {
if ($this->db->get($scope . '/' . $group, $key)) {
return true;
}
return false;
}
public function set($group, $key, $value, $scope = 'notweb') {
$this->db->set($scope . '/' . $group, $key, $value);
}
public function get($group, $key, $scope = 'notweb') {
return $this->db->get($scope . '/' . $group, $key);
}
public function remove($group, $key, $scope = 'notweb') {
$this->db->delete($scope . '/' . $group, $key);
}
public function getPath($group, $key, $scope = 'notweb') {
return N2Platform::getSiteUrl() . '?nextendcache=1&g=' . urlencode($group) . '&k=' . urlencode($key);
}
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.storage.cachestorage');
class N2CacheStorageFilesystem extends N2CacheStorage {
public function __construct() {
$this->paths['web'] = N2Filesystem::getWebCachePath();
$this->paths['notweb'] = N2Filesystem::getNotWebCachePath();
$this->paths['image'] = N2Filesystem::getImagesFolder();
}
public function isFilesystem() {
return true;
}
public function clear($group, $scope = 'notweb') {
if (N2Filesystem::existsFolder($this->paths[$scope] . NDS . $group)) {
N2Filesystem::deleteFolder($this->paths[$scope] . NDS . $group);
}
}
public function exists($group, $key, $scope = 'notweb') {
if (N2Filesystem::existsFile($this->paths[$scope] . NDS . $group . NDS . $key)) {
return true;
}
return false;
}
public function set($group, $key, $value, $scope = 'notweb') {
$path = $this->paths[$scope] . NDS . $group . NDS . $key;
$dir = dirname($path);
if (!N2Filesystem::existsFolder($dir)) {
N2Filesystem::createFolder($dir);
}
N2Filesystem::createFile($path, $value);
}
public function get($group, $key, $scope = 'notweb') {
return N2Filesystem::readFile($this->paths[$scope] . NDS . $group . NDS . $key);
}
public function remove($group, $key, $scope = 'notweb') {
if ($this->exists($group, $key, $scope)) {
@unlink($this->paths[$scope] . NDS . $group . NDS . $key);
}
}
public function getPath($group, $key, $scope = 'notweb') {
return $this->paths[$scope] . NDS . $group . NDS . $key;
}
}
\ No newline at end of file
<?php
class N2CacheManifestGenerator extends N2CacheManifest
{
/**
* @var N2SmartSliderAbstract
*/
private $slider;
private $generator;
/**
* @param N2SmartSliderAbstract $slider
* @param N2SmartSliderSlidesGenerator $generator
*/
public function __construct($slider, $generator) {
parent::__construct($slider->cacheId, false);
$this->slider = $slider;
$this->generator = $generator;
}
protected function isCacheValid(&$manifestData) {
$nextRefresh = $manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60;
if ($manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60 < N2Platform::getTime()) {
return false;
}
$this->generator->setNextCacheRefresh($nextRefresh);
return true;
}
protected function addManifestData(&$manifestData) {
$manifestData['cacheTime'] = N2Platform::getTime();
$this->generator->setNextCacheRefresh($manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60);
}
}
<?php
class N2CacheManifestSlider extends N2CacheManifest {
private $parameters = array();
private $isExtended = false;
public function __construct($cacheId, $parameters = array()) {
parent::__construct($cacheId, false);
$this->parameters = $parameters;
}
public function makeCache($fileName, $hash, $callable) {
$variations = 1;
if ($this->exists($this->getManifestKey('variations'))) {
$variations = intval($this->get($this->getManifestKey('variations')));
}
$fileName = $fileName . mt_rand(1, $variations);
if (N2SmartSliderSettings::get('serversidemobiledetect', '0') == '1') {
N2Loader::import('libraries.mobiledetect');
if (N2MobileDetect::$current['isMobile']) {
$fileName .= '-mobile';
} else if (N2MobileDetect::$current['isTablet']) {
$fileName .= '-tablet';
} else {
$fileName .= '-desktop';
}
}
if ($this->exists($this->getManifestKey('data'))) {
$data = json_decode($this->get($this->getManifestKey('data')), true);
$fileName = $this->extendFileName($fileName, $data);
} else {
$this->clearCurrentGroup();
}
$output = parent::makeCache($fileName, $hash, $callable);
return $output;
}
protected function createCacheFile($fileName, $hash, $content) {
$this->set($this->getManifestKey('data'), json_encode($this->parameters['slider']->manifestData));
$fileName = $this->extendFileName($fileName, $this->parameters['slider']->manifestData);
return parent::createCacheFile($fileName, $hash, $content);
}
private function extendFileName($fileName, $manifestData) {
if ($this->isExtended) {
return $fileName;
}
$this->isExtended = true;
$generators = $manifestData['generator'];
if (count($generators)) {
N2Loader::import("models.generator", "smartslider");
$generatorModel = new N2SmartsliderGeneratorModel();
foreach ($generators AS $generator) {
list($group, $type, $params) = $generator;
$info = $generatorModel->getGeneratorInfo($group, $type);
require_once($info->path . '/generator.php');
$class = 'N2Generator' . $group . $type;
$fileName .= call_user_func_array(array(
$class,
'cacheKey'
), $params);
}
}
return $fileName;
}
protected function isCacheValid(&$manifestData) {
if (!isset($manifestData['version']) || $manifestData['version'] != N2SS3::$version) {
return false;
}
if (N2SmartSliderHelper::getInstance()
->isSliderChanged($this->parameters['slider']->sliderId, 1)
) {
$this->clearCurrentGroup();
N2SmartSliderHelper::getInstance()
->setSliderChanged($this->parameters['slider']->sliderId, 0);
return false;
}
$time = N2Platform::getTime();
if ($manifestData['nextCacheRefresh'] < $time) {
return false;
}
if (!isset($manifestData['currentPath']) || $manifestData['currentPath'] != md5(__FILE__)) {
return false;
}
return true;
}
protected function addManifestData(&$manifestData) {
$manifestData['nextCacheRefresh'] = N2Pluggable::applyFilters('SSNextCacheRefresh', $this->parameters['slider']->getNextCacheRefresh(), array($this->parameters['slider']));
$manifestData['currentPath'] = md5(__FILE__);
$manifestData['version'] = N2SS3::$version;
$variations = 1;
$params = $this->parameters['slider']->params;
if (!$params->get('randomize-cache', 0) && ($params->get('randomize', 0) || $params->get('randomizeFirst', 0))) {
$variations = intval($params->get('variations', 5));
if ($variations < 1) {
$variations = 1;
}
}
$this->set($this->getManifestKey('variations'), $variations);
}
}
\ No newline at end of file
<?php
/**
* @package Joomla.Plugin
* @subpackage System.cache
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Joomla! Page Cache Plugin.
*
* @since 1.5
*/
class PlgSystemCache extends JPlugin
{
/**
* Cache instance.
*
* @var JCache
* @since 1.5
*/
public $_cache;
/**
* Cache key
*
* @var string
* @since 3.0
*/
public $_cache_key;
/**
* Application object.
*
* @var JApplicationCms
* @since 3.8.0
*/
protected $app;
/**
* Constructor.
*
* @param object &$subject The object to observe.
* @param array $config An optional associative array of configuration settings.
*
* @since 1.5
*/
public function __construct(& $subject, $config)
{
parent::__construct($subject, $config);
// Get the application if not done by JPlugin.
if (!isset($this->app))
{
$this->app = JFactory::getApplication();
}
// Set the cache options.
$options = array(
'defaultgroup' => 'page',
'browsercache' => $this->params->get('browsercache', 0),
'caching' => false,
);
// Instantiate cache with previous options and create the cache key identifier.
$this->_cache = JCache::getInstance('page', $options);
$this->_cache_key = JUri::getInstance()->toString();
}
/**
* Get a cache key for the current page based on the url and possible other factors.
*
* @return string
*
* @since 3.7
*/
protected function getCacheKey()
{
static $key;
if (!$key)
{
JPluginHelper::importPlugin('pagecache');
$parts = JEventDispatcher::getInstance()->trigger('onPageCacheGetKey');
$parts[] = JUri::getInstance()->toString();
$key = md5(serialize($parts));
}
return $key;
}
/**
* After Initialise Event.
* Checks if URL exists in cache, if so dumps it directly and closes.
*
* @return void
*
* @since 1.5
*/
public function onAfterInitialise()
{
if ($this->app->isClient('administrator') || $this->app->get('offline', '0') || $this->app->getMessageQueue())
{
return;
}
// If any pagecache plugins return false for onPageCacheSetCaching, do not use the cache.
JPluginHelper::importPlugin('pagecache');
$results = JEventDispatcher::getInstance()->trigger('onPageCacheSetCaching');
$caching = !in_array(false, $results, true);
if ($caching && JFactory::getUser()->guest && $this->app->input->getMethod() === 'GET')
{
$this->_cache->setCaching(true);
}
$data = $this->_cache->get($this->getCacheKey());
// If page exist in cache, show cached page.
if ($data !== false)
{
// Set HTML page from cache.
$this->app->setBody($data);
// Dumps HTML page.
echo $this->app->toString((bool) $this->app->get('gzip'));
// Mark afterCache in debug and run debug onAfterRespond events.
// e.g., show Joomla Debug Console if debug is active.
if (JDEBUG)
{
JProfiler::getInstance('Application')->mark('afterCache');
JEventDispatcher::getInstance()->trigger('onAfterRespond');
}
// Closes the application.
$this->app->close();
}
}
/**
* After Render Event.
* Verify if current page is not excluded from cache.
*
* @return void
*
* @since 3.9.12
*/
public function onAfterRender()
{
if ($this->_cache->getCaching() === false)
{
return;
}
// We need to check if user is guest again here, because auto-login plugins have not been fired before the first aid check.
// Page is excluded if excluded in plugin settings.
if (!JFactory::getUser()->guest || $this->app->getMessageQueue() || $this->isExcluded() === true)
{
$this->_cache->setCaching(false);
return;
}
// Disable compression before caching the page.
$this->app->set('gzip', false);
}
/**
* After Respond Event.
* Stores page in cache.
*
* @return void
*
* @since 1.5
*/
public function onAfterRespond()
{
if ($this->_cache->getCaching() === false)
{
return;
}
// Saves current page in cache.
$this->_cache->store($this->app->getBody(), $this->getCacheKey());
}
/**
* Check if the page is excluded from the cache or not.
*
* @return boolean True if the page is excluded else false
*
* @since 3.5
*/
protected function isExcluded()
{
// Check if menu items have been excluded.
if ($exclusions = $this->params->get('exclude_menu_items', array()))
{
// Get the current menu item.
$active = $this->app->getMenu()->getActive();
if ($active && $active->id && in_array((int) $active->id, (array) $exclusions))
{
return true;
}
}
// Check if regular expressions are being used.
if ($exclusions = $this->params->get('exclude', ''))
{
// Normalize line endings.
$exclusions = str_replace(array("\r\n", "\r"), "\n", $exclusions);
// Split them.
$exclusions = explode("\n", $exclusions);
// Gets internal URI.
$internal_uri = '/index.php?' . JUri::getInstance()->buildQuery($this->app->getRouter()->getVars());
// Loop through each pattern.
if ($exclusions)
{
foreach ($exclusions as $exclusion)
{
// Make sure the exclusion has some content
if ($exclusion !== '')
{
// Test both external and internal URI
if (preg_match('#' . $exclusion . '#i', $this->_cache_key . ' ' . $internal_uri, $match))
{
return true;
}
}
}
}
}
// If any pagecache plugins return true for onPageCacheIsExcluded, exclude.
JPluginHelper::importPlugin('pagecache');
$results = JEventDispatcher::getInstance()->trigger('onPageCacheIsExcluded');
return in_array(true, $results, true);
}
}
<?xml version="1.0" encoding="utf-8"?>
<extension version="3.1" type="plugin" group="system" method="upgrade">
<name>plg_system_cache</name>
<author>Joomla! Project</author>
<creationDate>February 2007</creationDate>
<copyright>Copyright (C) 2005 - 2019 Open Source Matters. All rights reserved.</copyright>
<license>GNU General Public License version 2 or later; see LICENSE.txt</license>
<authorEmail>admin@joomla.org</authorEmail>
<authorUrl>www.joomla.org</authorUrl>
<version>3.0.0</version>
<description>PLG_CACHE_XML_DESCRIPTION</description>
<files>
<filename plugin="cache">cache.php</filename>
</files>
<languages>
<language tag="en-GB">en-GB.plg_system_cache.ini</language>
<language tag="en-GB">en-GB.plg_system_cache.sys.ini</language>
</languages>
<config>
<fields name="params">
<fieldset name="basic">
<field
name="browsercache"
type="radio"
label="PLG_CACHE_FIELD_BROWSERCACHE_LABEL"
description="PLG_CACHE_FIELD_BROWSERCACHE_DESC"
class="btn-group btn-group-yesno"
default="0"
filter="integer"
>
<option value="1">JYES</option>
<option value="0">JNO</option>
</field>
<field
name="exclude_menu_items"
type="menuitem"
label="PLG_CACHE_FIELD_EXCLUDE_MENU_ITEMS_LABEL"
description="PLG_CACHE_FIELD_EXCLUDE_MENU_ITEMS_DESC"
multiple="multiple"
filter="int_array"
/>
</fieldset>
<fieldset name="advanced">
<field
name="exclude"
type="textarea"
label="PLG_CACHE_FIELD_EXCLUDE_LABEL"
description="PLG_CACHE_FIELD_EXCLUDE_DESC"
class="input-xxlarge"
rows="15"
filter="raw"
/>
</fieldset>
</fields>
</config>
</extension>
......@@ -414,10 +414,12 @@ main,
.btn_infoall a:active,
.btn_infoall a:hover,
.btn_infoall a:visited {
display: inline-block;
color: #fff !important;
background-color: #009fa8;
color: #fff;
padding: 5px 15px 5px;
margin: 0 0 8px 8px;
padding: 1.5px 15px 1.5px;
font-size: 85%;
border-radius: 5px;
}
......@@ -456,6 +458,9 @@ main,
#media .btn_infoall a:visited {
background-color: #fba09b;
}
#all > div.btn_infoall > a.newsarea-feed {
background-color: #ee802f;
}
@media (max-width: 1150px) {
#panels ul li .day {
......
......@@ -45,7 +45,7 @@ JHtml::_('script', 'template.js', array('version' => 'auto', 'relative' => true)
JHtml::_('script', 'jui/html5.js', array('version' => 'auto', 'relative' => true, 'conditional' => 'lt IE 9'));
// Add Stylesheets
JHtml::_('stylesheet', 'template.css', array('version' => '20200625001', 'relative' => true));
JHtml::_('stylesheet', 'template.css', array('version' => '20200702001', 'relative' => true));
// Use of Google Font
......@@ -648,6 +648,7 @@ if ($this->params->get('logoFile')) {
<li><a href="/entrance/open-campus/sessions.html">体験授業</a></li>
<li><a href="/entrance/open-campus/process.html">学外進学説明会のご案内</a></li>
<li><a href="/entrance/open-campus/visitor.html">施設見学のご案内</a></li>
<li><a href="/entrance/open-campus/web.html">Webオープンキャンパス</a></li>
</ul>
<div class="title"><a href="/campus-life/statatrra.html">学内業務補助</a></div>
<ul>
......@@ -768,6 +769,7 @@ if ($this->params->get('logoFile')) {
<li><a href="/faculties/masters/classes.html" title="授業科目">授業科目</a></li>
<li><a href="/faculties/masters/licenses.html" title="取得可能な免許・資格">取得可能な免許・資格</a></li>
<li><a href="/faculties/masters/documents.html" title="各種提出様式">各種提出様式</a></li>
<li><a href="/faculties/masters/thesis.html" title="修士課程の学位論文について">修士課程の学位論文について</a></li>
</ul>
<div class="title"><a href="/faculties/3.html">筑波大学との共同専攻:大学院体育学研究科大学体育スポーツ高度化共同専攻 (後期3年の課程のみの博士課程)</a></div>
<ul>
......@@ -792,13 +794,14 @@ if ($this->params->get('logoFile')) {
<li><a href="/faculties/doctors/horizons.html" title="担当教員研究領域">担当教員研究領域</a></li>
<li><a href="/faculties/doctors/classes.html" title="授業科目">授業科目</a></li>
<li><a href="/faculties/doctors/documents.html" title="各種提出様式">各種提出様式</a></li>
<li><a href="/faculties/doctors/thesis.html" title="課程博士の学位論文について">課程博士の学位論文について</a></li>
</ul>
<div class="title"><a href="/faculties/thesis.html">論文博士</a></div>
<ul>
<li><a href="/faculties/thesis/thesis.html" title="論文博士の概要">論文博士の概要</a></li>
<li><a href="/entrance/schooler/programkenkyusei.html" title="論文博士取得支援プログラムについて(研究生対象)">論文博士取得支援プログラムについて(研究生対象)</a></li>
<li><a href="/faculties/thesis/exam.html" title="論文博士の論文提出に係る外国語試験の実施について">論文博士の論文提出に係る外国語試験の実施について</a></li>
<li><a href="/faculties/thesis/degrees.html" title="博士の学位授与について">博士の学位授与について</a></li>
<li><a href="/faculties/thesis/degrees.html" title="論文博士の学位論文について">論文博士の学位論文について</a></li>
</ul>
</div>
<!-- ▲4列目 -->
......
<?php
N2Loader::importAll('libraries.cache.storage');
class N2Cache {
protected $group = '';
protected $isAccessible = false;
/** @var N2CacheStorage */
public $storage;
protected $_storageEngine = 'default';
/**
* @param string $engine
*
* @return N2CacheStorage
*/
public static function getStorage($engine = "default") {
static $storage = null;
if ($storage === null) {
$storage = array(
'filesystem' => new N2CacheStorageFilesystem(),
'database' => new N2CacheStorageDatabase()
);
}
if ($engine == 'default') {
if (defined('NEXTEND_CACHE_STORAGE')) {
return $storage[NEXTEND_CACHE_STORAGE];
}
return $storage['filesystem'];
}
return $storage[$engine];
}
public static function clearGroup($group) {
$storage = self::getStorage();
$storage->clear($group);
$storage->clear($group, 'web');
}
public function __construct($group, $isAccessible = false) {
$this->group = $group;
$this->isAccessible = $isAccessible;
$this->storage = self::getStorage($this->_storageEngine);
}
protected function clearCurrentGroup() {
$this->storage->clear($this->group, $this->getScope());
}
protected function getScope() {
if ($this->isAccessible) {
return 'web';
}
return 'notweb';
}
protected function exists($key) {
return $this->storage->exists($this->group, $key, $this->getScope());
}
protected function get($key) {
return $this->storage->get($this->group, $key, $this->getScope());
}
protected function set($key, $value) {
$this->storage->set($this->group, $key, $value, $this->getScope());
}
protected function getPath($key) {
return $this->storage->getPath($this->group, $key, $this->getScope());
}
protected function remove($key) {
return $this->storage->remove($this->group, $key, $this->getScope());
}
}
<?php
N2Loader::import('libraries.cache.cache');
class N2CacheCombine extends N2Cache {
protected $files = array();
protected $inline = '';
protected $fileType = '';
protected $minify = false;
protected $options = array();
public function __construct($fileType, $minify = false, $options = array()) {
$this->fileType = $fileType;
$this->minify = $minify;
$this->options = $options;
$this->options['minify'] = $this->minify;
parent::__construct('combined', true);
}
public function add($file) {
if (!in_array($file, $this->files)) {
$this->files[] = $file;
}
}
public function addInline($text) {
$this->inline .= $text;
}
protected function getHash() {
$hash = '';
for ($i = 0; $i < count($this->files); $i++) {
$hash .= $this->files[$i] . filemtime($this->files[$i]);
}
if (!empty($this->inline)) {
$hash .= $this->inline;
}
return md5($hash . json_encode($this->options));
}
public function make() {
$hash = $this->getHash();
$fileName = $hash . '.' . $this->fileType;
if (!$this->exists($fileName)) {
$buffer = '';
for ($i = 0; $i < count($this->files); $i++) {
$buffer .= file_get_contents($this->files[$i]);
}
if ($this->minify !== false) {
$buffer = call_user_func($this->minify, $buffer);
}
$buffer .= $this->inline;
$this->set($fileName, $buffer);
}
return $this->getPath($fileName);
}
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.cache');
class N2CacheImage extends N2Cache {
protected $_storageEngine = 'filesystem';
protected function getScope() {
return 'image';
}
public function makeCache($fileExtension, $callable, $parameters = array(), $hash = false) {
if (!$hash) {
$hash = $this->generateHash($fileExtension, $callable, $parameters);
}
$keepFileName = pathinfo($parameters[1], PATHINFO_FILENAME);
$fileName = $hash . (!empty($keepFileName) ? '/' . $keepFileName : '') . '.' . $fileExtension;
if (!$this->exists($fileName)) {
$this->set($fileName, call_user_func_array($callable, $parameters));
}
return $this->getPath($fileName);
}
private function generateHash($fileExtension, $callable, $parameters) {
return md5(json_encode(array(
$fileExtension,
$callable,
$parameters
)));
}
}
class N2StoreImage extends N2Cache {
protected $_storageEngine = 'filesystem';
protected function getScope() {
return 'image';
}
public function makeCache($fileName, $content) {
if (!$this->isImage($fileName)) {
return false;
}
if (!$this->exists($fileName)) {
$this->set($fileName, $content);
}
return $this->getPath($fileName);
}
private function isImage($fileName) {
$supported_image = array(
'gif',
'jpg',
'jpeg',
'png',
'mp4',
'mp3'
);
$ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
if (in_array($ext, $supported_image)) {
return true;
}
return false;
}
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.cache');
class N2CacheManifest extends N2Cache {
private $isRaw = false;
private $manifestData;
public function __construct($group, $isAccessible = false, $isRaw = false) {
parent::__construct($group, $isAccessible);
$this->isRaw = $isRaw;
}
public function makeCache($fileName, $hash, $callable) {
if (!$this->isCached($fileName, $hash)) {
$return = call_user_func($callable, $this);
if ($return === false) {
return false;
}
return $this->createCacheFile($fileName, $hash, $return);
}
if ($this->isAccessible) {
return $this->getPath($fileName);
}
return json_decode($this->get($fileName), true);
}
private function isCached($fileName, $hash) {
$manifestKey = $this->getManifestKey($fileName);
if ($this->exists($manifestKey)) {
$this->manifestData = json_decode($this->get($manifestKey), true);
if (!$this->isCacheValid($this->manifestData) || $this->manifestData['hash'] != $hash) {
$this->clean($fileName);
return false;
}
return true;
}
return false;
}
protected function createCacheFile($fileName, $hash, $content) {
$this->manifestData = array();
$this->manifestData['hash'] = $hash;
$this->addManifestData($this->manifestData);
$this->set($this->getManifestKey($fileName), json_encode($this->manifestData));
$this->set($fileName, $this->isRaw ? $content : json_encode($content));
if ($this->isAccessible) {
return $this->getPath($fileName);
}
return $content;
}
protected function isCacheValid(&$manifestData) {
return true;
}
protected function addManifestData(&$manifestData) {
}
public function clean($fileName) {
$this->remove($this->getManifestKey($fileName));
$this->remove($fileName);
}
protected function getManifestKey($fileName) {
return $fileName . '.manifest';
}
public function getData($key, $default = 0) {
return isset($this->manifestData[$key]) ? $this->manifestData[$key] : $default;
}
}
\ No newline at end of file
<?php
/**
* N2MinifierJS.php - modified PHP implementation of Douglas Crockford's N2MinifierJS.
*
* <code>
* $minifiedJs = N2MinifierJS::minify($js);
* </code>
*
* This is a modified port of jsmin.c. Improvements:
*
* Does not choke on some regexp literals containing quote characters. E.g. /'/
*
* Spaces are preserved after some add/sub operators, so they are not mistakenly
* converted to post-inc/dec. E.g. a + ++b -> a+ ++b
*
* Preserves multi-line comments that begin with /*!
*
* PHP 5 or higher is required.
*
* Permission is hereby granted to use this version of the library under the
* same terms as jsmin.c, which has the following license:
*
* --
* Copyright (c) 2002 Douglas Crockford (www.crockford.com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* The Software shall be used for Good, not Evil.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* --
*
* @package N2MinifierJS
* @author Ryan Grove <ryan@wonko.com> (PHP port)
* @author Steve Clay <steve@mrclay.org> (modifications + cleanup)
* @author Andrea Giammarchi <http://www.3site.eu> (spaceBeforeRegExp)
* @copyright 2002 Douglas Crockford <douglas@crockford.com> (jsmin.c)
* @copyright 2008 Ryan Grove <ryan@wonko.com> (PHP port)
* @license http://opensource.org/licenses/mit-license.php MIT License
* @link http://code.google.com/p/jsmin-php/
*/
class N2MinifierJS {
const ORD_LF = 10;
const ORD_SPACE = 32;
const ACTION_KEEP_A = 1;
const ACTION_DELETE_A = 2;
const ACTION_DELETE_A_B = 3;
protected $a = "\n";
protected $b = '';
protected $input = '';
protected $inputIndex = 0;
protected $inputLength = 0;
protected $lookAhead = null;
protected $output = '';
protected $lastByteOut = '';
protected $keptComment = '';
/**
* Minify Javascript.
*
* @param string $js Javascript to be minified
*
* @return string
*/
public static function minify($js)
{
$jsmin = new N2MinifierJS($js);
return $jsmin->min();
}
/**
* @param string $input
*/
public function __construct($input)
{
$this->input = $input;
}
/**
* Perform minification, return result
*
* @return string
*/
public function min()
{
if ($this->output !== '') { // min already run
return $this->output;
}
$mbIntEnc = null;
if (function_exists('mb_strlen') && ((int)ini_get('mbstring.func_overload') & 2)) {
$mbIntEnc = mb_internal_encoding();
mb_internal_encoding('8bit');
}
$this->input = str_replace("\r\n", "\n", $this->input);
$this->inputLength = strlen($this->input);
$this->action(self::ACTION_DELETE_A_B);
while ($this->a !== null) {
// determine next command
$command = self::ACTION_KEEP_A; // default
if ($this->a === ' ') {
if (($this->lastByteOut === '+' || $this->lastByteOut === '-')
&& ($this->b === $this->lastByteOut)) {
// Don't delete this space. If we do, the addition/subtraction
// could be parsed as a post-increment
} elseif (! $this->isAlphaNum($this->b)) {
$command = self::ACTION_DELETE_A;
}
} elseif ($this->a === "\n") {
if ($this->b === ' ') {
$command = self::ACTION_DELETE_A_B;
// in case of mbstring.func_overload & 2, must check for null b,
// otherwise mb_strpos will give WARNING
} elseif ($this->b === null
|| (false === strpos('{[(+-!~', $this->b)
&& ! $this->isAlphaNum($this->b))) {
$command = self::ACTION_DELETE_A;
}
} elseif (! $this->isAlphaNum($this->a)) {
if ($this->b === ' '
|| ($this->b === "\n"
&& (false === strpos('}])+-"\'', $this->a)))) {
$command = self::ACTION_DELETE_A_B;
}
}
$this->action($command);
}
$this->output = trim($this->output);
if ($mbIntEnc !== null) {
mb_internal_encoding($mbIntEnc);
}
return $this->output;
}
/**
* ACTION_KEEP_A = Output A. Copy B to A. Get the next B.
* ACTION_DELETE_A = Copy B to A. Get the next B.
* ACTION_DELETE_A_B = Get the next B.
*
* @param int $command
*
*@throws N2JSMin_UnterminatedRegExpException|N2JSMin_UnterminatedStringException
*/
protected function action($command)
{
// make sure we don't compress "a + ++b" to "a+++b", etc.
if ($command === self::ACTION_DELETE_A_B
&& $this->b === ' '
&& ($this->a === '+' || $this->a === '-')) {
// Note: we're at an addition/substraction operator; the inputIndex
// will certainly be a valid index
if ($this->input[$this->inputIndex] === $this->a) {
// This is "+ +" or "- -". Don't delete the space.
$command = self::ACTION_KEEP_A;
}
}
switch ($command) {
case self::ACTION_KEEP_A: // 1
$this->output .= $this->a;
if ($this->keptComment) {
$this->output = rtrim($this->output, "\n");
$this->output .= $this->keptComment;
$this->keptComment = '';
}
$this->lastByteOut = $this->a;
// fallthrough intentional
case self::ACTION_DELETE_A: // 2
$this->a = $this->b;
if ($this->a === "'" || $this->a === '"') { // string literal
$str = $this->a; // in case needed for exception
for(;;) {
$this->output .= $this->a;
$this->lastByteOut = $this->a;
$this->a = $this->get();
if ($this->a === $this->b) { // end quote
break;
}
if ($this->isEOF($this->a)) {
throw new N2JSMin_UnterminatedStringException(
"N2MinifierJS: Unterminated String at byte {$this->inputIndex}: {$str}");
}
$str .= $this->a;
if ($this->a === '\\') {
$this->output .= $this->a;
$this->lastByteOut = $this->a;
$this->a = $this->get();
$str .= $this->a;
}
}
}
// fallthrough intentional
case self::ACTION_DELETE_A_B: // 3
$this->b = $this->next();
if ($this->b === '/' && $this->isRegexpLiteral()) {
$this->output .= $this->a . $this->b;
$pattern = '/'; // keep entire pattern in case we need to report it in the exception
for(;;) {
$this->a = $this->get();
$pattern .= $this->a;
if ($this->a === '[') {
for(;;) {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
if ($this->a === ']') {
break;
}
if ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
}
if ($this->isEOF($this->a)) {
throw new N2JSMin_UnterminatedRegExpException(
"N2MinifierJS: Unterminated set in RegExp at byte "
. $this->inputIndex .": {$pattern}");
}
}
}
if ($this->a === '/') { // end pattern
break; // while (true)
} elseif ($this->a === '\\') {
$this->output .= $this->a;
$this->a = $this->get();
$pattern .= $this->a;
} elseif ($this->isEOF($this->a)) {
throw new N2JSMin_UnterminatedRegExpException(
"N2MinifierJS: Unterminated RegExp at byte {$this->inputIndex}: {$pattern}");
}
$this->output .= $this->a;
$this->lastByteOut = $this->a;
}
$this->b = $this->next();
}
// end case ACTION_DELETE_A_B
}
}
/**
* @return bool
*/
protected function isRegexpLiteral()
{
if (false !== strpos("(,=:[!&|?+-~*{;", $this->a)) {
// we obviously aren't dividing
return true;
}
if ($this->a === ' ' || $this->a === "\n") {
$length = strlen($this->output);
if ($length < 2) { // weird edge case
return true;
}
// you can't divide a keyword
if (preg_match('/(?:case|else|in|return|typeof)$/', $this->output, $m)) {
if ($this->output === $m[0]) { // odd but could happen
return true;
}
// make sure it's a keyword, not end of an identifier
$charBeforeKeyword = substr($this->output, $length - strlen($m[0]) - 1, 1);
if (! $this->isAlphaNum($charBeforeKeyword)) {
return true;
}
}
}
return false;
}
/**
* Return the next character from stdin. Watch out for lookahead. If the character is a control character,
* translate it to a space or linefeed.
*
* @return string
*/
protected function get()
{
$c = $this->lookAhead;
$this->lookAhead = null;
if ($c === null) {
// getc(stdin)
if ($this->inputIndex < $this->inputLength) {
$c = $this->input[$this->inputIndex];
$this->inputIndex += 1;
} else {
$c = null;
}
}
if (ord($c) >= self::ORD_SPACE || $c === "\n" || $c === null) {
return $c;
}
if ($c === "\r") {
return "\n";
}
return ' ';
}
/**
* Does $a indicate end of input?
*
* @param string $a
* @return bool
*/
protected function isEOF($a)
{
return ord($a) <= self::ORD_LF;
}
/**
* Get next char (without getting it). If is ctrl character, translate to a space or newline.
*
* @return string
*/
protected function peek()
{
$this->lookAhead = $this->get();
return $this->lookAhead;
}
/**
* Return true if the character is a letter, digit, underscore, dollar sign, or non-ASCII character.
*
* @param string $c
*
* @return bool
*/
protected function isAlphaNum($c)
{
return (preg_match('/^[a-z0-9A-Z_\\$\\\\]$/', $c) || ord($c) > 126);
}
/**
* Consume a single line comment from input (possibly retaining it)
*/
protected function consumeSingleLineComment()
{
$comment = '';
while (true) {
$get = $this->get();
$comment .= $get;
if (ord($get) <= self::ORD_LF) { // end of line reached
// if IE conditional comment
if (preg_match('/^\\/@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
$this->keptComment .= "/{$comment}";
}
return;
}
}
}
/**
* Consume a multiple line comment from input (possibly retaining it)
*
* @throws N2JSMin_UnterminatedCommentException
*/
protected function consumeMultipleLineComment()
{
$this->get();
$comment = '';
for(;;) {
$get = $this->get();
if ($get === '*') {
if ($this->peek() === '/') { // end of comment reached
$this->get();
if (0 === strpos($comment, '!')) {
// preserved by YUI Compressor
if (!$this->keptComment) {
// don't prepend a newline if two comments right after one another
$this->keptComment = "\n";
}
$this->keptComment .= "/*!" . substr($comment, 1) . "*/\n";
} else if (preg_match('/^@(?:cc_on|if|elif|else|end)\\b/', $comment)) {
// IE conditional
$this->keptComment .= "/*{$comment}*/";
}
return;
}
} elseif ($get === null) {
throw new N2JSMin_UnterminatedCommentException(
"N2MinifierJS: Unterminated comment at byte {$this->inputIndex}: /*{$comment}");
}
$comment .= $get;
}
}
/**
* Get the next character, skipping over comments. Some comments may be preserved.
*
* @return string
*/
protected function next()
{
$get = $this->get();
if ($get === '/') {
switch ($this->peek()) {
case '/':
$this->consumeSingleLineComment();
$get = "\n";
break;
case '*':
$this->consumeMultipleLineComment();
$get = ' ';
break;
}
}
return $get;
}
}
class N2JSMin_UnterminatedStringException extends Exception {}
class N2JSMin_UnterminatedCommentException extends Exception {}
class N2JSMin_UnterminatedRegExpException extends Exception {}
<?php
abstract class N2CacheStorage {
protected $paths = array();
public function __construct() {
$this->paths['web'] = 'web';
$this->paths['notweb'] = 'notweb';
$this->paths['image'] = 'image';
}
public function isFilesystem() {
return false;
}
public abstract function clear($group, $scope = 'notweb');
public abstract function exists($group, $key, $scope = 'notweb');
public abstract function set($group, $key, $value, $scope = 'notweb');
public abstract function get($group, $key, $scope = 'notweb');
public abstract function remove($group, $key, $scope = 'notweb');
public abstract function getPath($group, $key, $scope = 'notweb');
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.storage.cachestorage');
class N2CacheStorageDatabase extends N2CacheStorage {
protected $db;
public function __construct() {
parent::__construct();
$this->db = new N2StorageSection('cache');
}
public function clear($group, $scope = 'notweb') {
$this->db->delete($scope . '/' . $group);
}
public function exists($group, $key, $scope = 'notweb') {
if ($this->db->get($scope . '/' . $group, $key)) {
return true;
}
return false;
}
public function set($group, $key, $value, $scope = 'notweb') {
$this->db->set($scope . '/' . $group, $key, $value);
}
public function get($group, $key, $scope = 'notweb') {
return $this->db->get($scope . '/' . $group, $key);
}
public function remove($group, $key, $scope = 'notweb') {
$this->db->delete($scope . '/' . $group, $key);
}
public function getPath($group, $key, $scope = 'notweb') {
return N2Platform::getSiteUrl() . '?nextendcache=1&g=' . urlencode($group) . '&k=' . urlencode($key);
}
}
\ No newline at end of file
<?php
N2Loader::import('libraries.cache.storage.cachestorage');
class N2CacheStorageFilesystem extends N2CacheStorage {
public function __construct() {
$this->paths['web'] = N2Filesystem::getWebCachePath();
$this->paths['notweb'] = N2Filesystem::getNotWebCachePath();
$this->paths['image'] = N2Filesystem::getImagesFolder();
}
public function isFilesystem() {
return true;
}
public function clear($group, $scope = 'notweb') {
if (N2Filesystem::existsFolder($this->paths[$scope] . NDS . $group)) {
N2Filesystem::deleteFolder($this->paths[$scope] . NDS . $group);
}
}
public function exists($group, $key, $scope = 'notweb') {
if (N2Filesystem::existsFile($this->paths[$scope] . NDS . $group . NDS . $key)) {
return true;
}
return false;
}
public function set($group, $key, $value, $scope = 'notweb') {
$path = $this->paths[$scope] . NDS . $group . NDS . $key;
$dir = dirname($path);
if (!N2Filesystem::existsFolder($dir)) {
N2Filesystem::createFolder($dir);
}
N2Filesystem::createFile($path, $value);
}
public function get($group, $key, $scope = 'notweb') {
return N2Filesystem::readFile($this->paths[$scope] . NDS . $group . NDS . $key);
}
public function remove($group, $key, $scope = 'notweb') {
if ($this->exists($group, $key, $scope)) {
@unlink($this->paths[$scope] . NDS . $group . NDS . $key);
}
}
public function getPath($group, $key, $scope = 'notweb') {
return $this->paths[$scope] . NDS . $group . NDS . $key;
}
}
\ No newline at end of file
<?php
class N2CacheManifestGenerator extends N2CacheManifest
{
/**
* @var N2SmartSliderAbstract
*/
private $slider;
private $generator;
/**
* @param N2SmartSliderAbstract $slider
* @param N2SmartSliderSlidesGenerator $generator
*/
public function __construct($slider, $generator) {
parent::__construct($slider->cacheId, false);
$this->slider = $slider;
$this->generator = $generator;
}
protected function isCacheValid(&$manifestData) {
$nextRefresh = $manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60;
if ($manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60 < N2Platform::getTime()) {
return false;
}
$this->generator->setNextCacheRefresh($nextRefresh);
return true;
}
protected function addManifestData(&$manifestData) {
$manifestData['cacheTime'] = N2Platform::getTime();
$this->generator->setNextCacheRefresh($manifestData['cacheTime'] + max(0, $this->generator->currentGenerator['params']->get('cache-expiration', 1)) * 60 * 60);
}
}
<?php
class N2CacheManifestSlider extends N2CacheManifest {
private $parameters = array();
private $isExtended = false;
public function __construct($cacheId, $parameters = array()) {
parent::__construct($cacheId, false);
$this->parameters = $parameters;
}
public function makeCache($fileName, $hash, $callable) {
$variations = 1;
if ($this->exists($this->getManifestKey('variations'))) {
$variations = intval($this->get($this->getManifestKey('variations')));
}
$fileName = $fileName . mt_rand(1, $variations);
if (N2SmartSliderSettings::get('serversidemobiledetect', '0') == '1') {
N2Loader::import('libraries.mobiledetect');
if (N2MobileDetect::$current['isMobile']) {
$fileName .= '-mobile';
} else if (N2MobileDetect::$current['isTablet']) {
$fileName .= '-tablet';
} else {
$fileName .= '-desktop';
}
}
if ($this->exists($this->getManifestKey('data'))) {
$data = json_decode($this->get($this->getManifestKey('data')), true);
$fileName = $this->extendFileName($fileName, $data);
} else {
$this->clearCurrentGroup();
}
$output = parent::makeCache($fileName, $hash, $callable);
return $output;
}
protected function createCacheFile($fileName, $hash, $content) {
$this->set($this->getManifestKey('data'), json_encode($this->parameters['slider']->manifestData));
$fileName = $this->extendFileName($fileName, $this->parameters['slider']->manifestData);
return parent::createCacheFile($fileName, $hash, $content);
}
private function extendFileName($fileName, $manifestData) {
if ($this->isExtended) {
return $fileName;
}
$this->isExtended = true;
$generators = $manifestData['generator'];
if (count($generators)) {
N2Loader::import("models.generator", "smartslider");
$generatorModel = new N2SmartsliderGeneratorModel();
foreach ($generators AS $generator) {
list($group, $type, $params) = $generator;
$info = $generatorModel->getGeneratorInfo($group, $type);
require_once($info->path . '/generator.php');
$class = 'N2Generator' . $group . $type;
$fileName .= call_user_func_array(array(
$class,
'cacheKey'
), $params);
}
}
return $fileName;
}
protected function isCacheValid(&$manifestData) {
if (!isset($manifestData['version']) || $manifestData['version'] != N2SS3::$version) {
return false;
}
if (N2SmartSliderHelper::getInstance()
->isSliderChanged($this->parameters['slider']->sliderId, 1)
) {
$this->clearCurrentGroup();
N2SmartSliderHelper::getInstance()
->setSliderChanged($this->parameters['slider']->sliderId, 0);
return false;
}
$time = N2Platform::getTime();
if ($manifestData['nextCacheRefresh'] < $time) {
return false;
}
if (!isset($manifestData['currentPath']) || $manifestData['currentPath'] != md5(__FILE__)) {
return false;
}
return true;
}
protected function addManifestData(&$manifestData) {
$manifestData['nextCacheRefresh'] = N2Pluggable::applyFilters('SSNextCacheRefresh', $this->parameters['slider']->getNextCacheRefresh(), array($this->parameters['slider']));
$manifestData['currentPath'] = md5(__FILE__);
$manifestData['version'] = N2SS3::$version;
$variations = 1;
$params = $this->parameters['slider']->params;
if (!$params->get('randomize-cache', 0) && ($params->get('randomize', 0) || $params->get('randomizeFirst', 0))) {
$variations = intval($params->get('variations', 5));
if ($variations < 1) {
$variations = 1;
}
}
$this->set($this->getManifestKey('variations'), $variations);
}
}
\ No newline at end of file
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!