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

@ -2100,7 +2100,7 @@ class Context
*/
public static function normalizeFilePath($file)
{
if($file{0} != '/' && $file{0} != '.' && strpos($file, '://') === FALSE)
if($file[0] != '/' && $file[0] != '.' && strpos($file, '://') === FALSE)
{
$file = './' . $file;
}

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;
}

View file

@ -484,7 +484,7 @@ class TemplateHandler
// find closing tag
$close_php = '<?php ' . str_repeat('}', $closing) . ' ?>';
// self closing tag
if($node{1} == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag]))
if($node[1] == '!' || substr($node, -2, 1) == '/' || isset($self_closing[$tag]))
{
$nodes[$idx + 1] = $close_php . $nodes[$idx + 1];
}
@ -545,7 +545,7 @@ class TemplateHandler
return $m[0];
}
if($m[1]{0} == '@')
if($m[1][0] == '@')
{
$m[1] = self::_replaceVar(substr($m[1], 1));
return "<?php {$m[1]} ?>";
@ -866,7 +866,7 @@ class TemplateHandler
}
if($mm[1])
{
if($mm[1]{0} == 'e')
if($mm[1][0] == 'e')
{
return '<?php } ?>' . $m[9];
}
@ -931,7 +931,7 @@ class TemplateHandler
$_path = $path;
$fileDir = strtr(realpath($this->path), '\\', '/');
if($path{0} != '/')
if($path[0] != '/')
{
$path = strtr(realpath($fileDir . '/' . $path), '\\', '/');
}

View file

@ -279,7 +279,7 @@ class Validator
foreach($this->_filters as $key => $filter)
{
$names = array();
if($key{0} == '^')
if($key[0] == '^')
{
$names = preg_grep('/^' . preg_quote(substr($key, 1)) . '/', $field_names);
}