diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 013b33eee..f29ad60ed 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -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; } diff --git a/classes/frontendfile/FrontEndFileHandler.class.php b/classes/frontendfile/FrontEndFileHandler.class.php index e21fb76c7..15f8b87b4 100644 --- a/classes/frontendfile/FrontEndFileHandler.class.php +++ b/classes/frontendfile/FrontEndFileHandler.class.php @@ -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; } diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index ed05eeeec..0ca8531e5 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -484,7 +484,7 @@ class TemplateHandler // find closing tag $close_php = ''; // 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 ""; @@ -866,7 +866,7 @@ class TemplateHandler } if($mm[1]) { - if($mm[1]{0} == 'e') + if($mm[1][0] == 'e') { return '' . $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), '\\', '/'); } diff --git a/classes/validator/Validator.class.php b/classes/validator/Validator.class.php index aded04a4e..9b6a3768a 100644 --- a/classes/validator/Validator.class.php +++ b/classes/validator/Validator.class.php @@ -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); }