Fix incorrect use of curly braces in legacy classes

This commit is contained in:
Kijin Sung 2020-05-19 20:52:44 +09:00
parent 2cbfd4500c
commit 14ad62e869
4 changed files with 39 additions and 39 deletions

View file

@ -92,27 +92,27 @@ class FrontEndFileHandler extends Handler
if(!is_array($args))
{
$args = array($args);
}
// Replace obsolete paths with current paths.
$args[0] = preg_replace(array_keys(HTMLDisplayHandler::$replacements), array_values(HTMLDisplayHandler::$replacements), $args[0]);
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
// Prevent overwriting common scripts.
if(intval($args[3]) > -1500000000)
}
// Replace obsolete paths with current paths.
$args[0] = preg_replace(array_keys(HTMLDisplayHandler::$replacements), array_values(HTMLDisplayHandler::$replacements), $args[0]);
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
// Prevent overwriting common scripts.
if(intval($args[3]) > -1500000000)
{
if($isCommon)
{
return;
}
foreach(HTMLDisplayHandler::$blockedScripts as $regexp)
{
if(preg_match($regexp, $args[0]))
{
return;
}
}
}
}
foreach(HTMLDisplayHandler::$blockedScripts as $regexp)
{
if(preg_match($regexp, $args[0]))
{
return;
}
}
}
$file = $this->getFileInfo($args[0], $args[2], $args[1], $args[4], $isCommon);
$file->index = (int)$args[3];
@ -170,17 +170,17 @@ class FrontEndFileHandler extends Handler
return $existsInfo[$existsKey];
}
$pathInfo = pathinfo($fileName);
$pathInfo = pathinfo($fileName);
$file = new stdClass();
$file->fileName = $pathInfo['basename'];
$file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
$file->fileRealPath = FileHandler::getRealPath($pathInfo['dirname']);
$file->fileFullPath = $file->fileRealPath . '/' . $pathInfo['basename'];
$file->fileExtension = strtolower($pathInfo['extension']);
if (($pos = strpos($file->fileExtension, '?')) !== false)
{
$file->fileExtension = substr($file->fileExtension, 0, $pos);
$file->fileExtension = strtolower($pathInfo['extension']);
if (($pos = strpos($file->fileExtension, '?')) !== false)
{
$file->fileExtension = substr($file->fileExtension, 0, $pos);
}
if (preg_match('/^(.+)\.min$/', $pathInfo['filename'], $matches))
{
@ -192,10 +192,10 @@ class FrontEndFileHandler extends Handler
$file->fileNameNoExt = $pathInfo['filename'];
$file->isMinified = false;
}
$file->isExternalURL = preg_match('@^(https?:)?//@i', $file->filePath) ? true : false;
if ($file->isExternalURL && !$file->fileExtension)
{
$file->fileExtension = preg_match('/[\.\/](css|js)\b/', $fileName, $matches) ? $matches[1] : null;
$file->isExternalURL = preg_match('@^(https?:)?//@i', $file->filePath) ? true : false;
if ($file->isExternalURL && !$file->fileExtension)
{
$file->fileExtension = preg_match('/[\.\/](css|js)\b/', $fileName, $matches) ? $matches[1] : null;
}
$file->isCachedScript = !$file->isExternalURL && strpos($file->filePath, 'files/cache/') !== false;
$file->isCommon = $isCommon;
@ -213,7 +213,7 @@ class FrontEndFileHandler extends Handler
$file->fileFullPath = $file->fileRealPath . '/' . $file->fileNameNoExt . '.' . $file->fileExtension;
}
}
// Do not minify common JS plugins
if (strpos($file->filePath, 'common/js/plugins') !== false)
{
@ -288,12 +288,12 @@ class FrontEndFileHandler extends Handler
if (!file_exists($file->fileFullPath))
{
return;
}
}
$default_font_config = Context::get('default_font_config') ?: getController('editor')->default_font_config;
$file->vars['enable_xe_btn_styles'] = (defined('DISABLE_XE_BTN_STYLES') && DISABLE_XE_BTN_STYLES) ? 'false' : 'true';
$file->vars['enable_xe_msg_styles'] = (defined('DISABLE_XE_MSG_STYLES') && DISABLE_XE_MSG_STYLES) ? 'false' : 'true';
$file->vars = array_merge($file->vars, $default_font_config);
$default_font_config = Context::get('default_font_config') ?: getController('editor')->default_font_config;
$file->vars['enable_xe_btn_styles'] = (defined('DISABLE_XE_BTN_STYLES') && DISABLE_XE_BTN_STYLES) ? 'false' : 'true';
$file->vars['enable_xe_msg_styles'] = (defined('DISABLE_XE_MSG_STYLES') && DISABLE_XE_MSG_STYLES) ? 'false' : 'true';
$file->vars = array_merge($file->vars, $default_font_config);
if ($file->fileExtension === 'less')
{
$file->vars = array_map(function($str) {
@ -631,7 +631,7 @@ class FrontEndFileHandler extends Handler
*/
protected function _normalizeFilePath($path)
{
if(strpos($path, '://') === FALSE && $path{0} != '/' && $path{0} != '.')
if(strpos($path, '://') === FALSE && $path[0] != '/' && $path[0] != '.')
{
$path = './' . $path;
}