mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 13:02:15 +09:00
More fixes to improve PHP 8.0 compatibility
This commit is contained in:
parent
8c161bc28d
commit
417e4d15b0
9 changed files with 41 additions and 30 deletions
|
|
@ -141,7 +141,7 @@ class DisplayHandler extends Handler
|
||||||
ModuleHandler::triggerCall('display', 'after', $output);
|
ModuleHandler::triggerCall('display', 'after', $output);
|
||||||
|
|
||||||
// Output the page content and debug data.
|
// Output the page content and debug data.
|
||||||
$debug = $this->getDebugInfo($output);
|
$debug = self::getDebugInfo($output);
|
||||||
print $output;
|
print $output;
|
||||||
print $debug;
|
print $debug;
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +151,7 @@ class DisplayHandler extends Handler
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDebugInfo(&$output = null)
|
public static function getDebugInfo(&$output = null)
|
||||||
{
|
{
|
||||||
// Check if debugging information has already been printed.
|
// Check if debugging information has already been printed.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -333,6 +333,10 @@ class FileHandler
|
||||||
$start_time = microtime(true);
|
$start_time = microtime(true);
|
||||||
$response = Requests::request($url, $request_headers, $body ?: $post_data, $method, $request_options);
|
$response = Requests::request($url, $request_headers, $body ?: $post_data, $method, $request_options);
|
||||||
$elapsed_time = microtime(true) - $start_time;
|
$elapsed_time = microtime(true) - $start_time;
|
||||||
|
if (!isset($GLOBALS['__remote_request_elapsed__']))
|
||||||
|
{
|
||||||
|
$GLOBALS['__remote_request_elapsed__'] = 0;
|
||||||
|
}
|
||||||
$GLOBALS['__remote_request_elapsed__'] += $elapsed_time;
|
$GLOBALS['__remote_request_elapsed__'] += $elapsed_time;
|
||||||
|
|
||||||
$log = array();
|
$log = array();
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ class FrontEndFileHandler extends Handler
|
||||||
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
|
$isCommon = preg_match(HTMLDisplayHandler::$reservedCSS, $args[0]) || preg_match(HTMLDisplayHandler::$reservedJS, $args[0]);
|
||||||
|
|
||||||
// Prevent overwriting common scripts.
|
// Prevent overwriting common scripts.
|
||||||
if(intval($args[3]) > -1500000000)
|
if(isset($args[3]) && intval($args[3]) > -1500000000)
|
||||||
{
|
{
|
||||||
if($isCommon)
|
if($isCommon)
|
||||||
{
|
{
|
||||||
|
|
@ -114,8 +114,8 @@ class FrontEndFileHandler extends Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = $this->getFileInfo($args[0], $args[2], $args[1], $args[4], $isCommon);
|
$file = $this->getFileInfo($args[0], $args[2] ?? '', $args[1] ?? 'all', $args[4] ?? [], $isCommon);
|
||||||
$file->index = (int)$args[3];
|
$file->index = (int)($args[3] ?? 0);
|
||||||
|
|
||||||
$availableExtension = array('css' => 1, 'js' => 1, 'less' => 1, 'scss' => 1);
|
$availableExtension = array('css' => 1, 'js' => 1, 'less' => 1, 'scss' => 1);
|
||||||
if(!isset($availableExtension[$file->fileExtension]))
|
if(!isset($availableExtension[$file->fileExtension]))
|
||||||
|
|
@ -132,7 +132,7 @@ class FrontEndFileHandler extends Handler
|
||||||
}
|
}
|
||||||
else if($file->fileExtension == 'js')
|
else if($file->fileExtension == 'js')
|
||||||
{
|
{
|
||||||
if($args[1] == 'body')
|
if(isset($args[1]) && $args[1] == 'body')
|
||||||
{
|
{
|
||||||
$map = &$this->jsBodyMap;
|
$map = &$this->jsBodyMap;
|
||||||
$mapIndex = &$this->jsBodyMapIndex;
|
$mapIndex = &$this->jsBodyMapIndex;
|
||||||
|
|
@ -164,12 +164,6 @@ class FrontEndFileHandler extends Handler
|
||||||
*/
|
*/
|
||||||
protected function getFileInfo($fileName, $targetIe = '', $media = 'all', $vars = array(), $isCommon = false)
|
protected function getFileInfo($fileName, $targetIe = '', $media = 'all', $vars = array(), $isCommon = false)
|
||||||
{
|
{
|
||||||
static $existsInfo = array();
|
|
||||||
if(isset($existsInfo[$existsKey]))
|
|
||||||
{
|
|
||||||
return $existsInfo[$existsKey];
|
|
||||||
}
|
|
||||||
|
|
||||||
$pathInfo = pathinfo($fileName);
|
$pathInfo = pathinfo($fileName);
|
||||||
|
|
||||||
$file = new stdClass();
|
$file = new stdClass();
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ class ModuleHandler extends Handler
|
||||||
var $act = null;
|
var $act = null;
|
||||||
var $mid = null;
|
var $mid = null;
|
||||||
var $document_srl = null;
|
var $document_srl = null;
|
||||||
|
var $entry = null;
|
||||||
var $route = null;
|
var $route = null;
|
||||||
var $error = null;
|
var $error = null;
|
||||||
var $is_mobile = false;
|
var $is_mobile = false;
|
||||||
|
|
|
||||||
|
|
@ -167,6 +167,10 @@ class TemplateHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
// store the ending time for debug information
|
// store the ending time for debug information
|
||||||
|
if (!isset($GLOBALS['__template_elapsed__']))
|
||||||
|
{
|
||||||
|
$GLOBALS['__template_elapsed__'] = 0;
|
||||||
|
}
|
||||||
$GLOBALS['__template_elapsed__'] += microtime(true) - $start;
|
$GLOBALS['__template_elapsed__'] += microtime(true) - $start;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,10 @@ class XeXmlParser
|
||||||
|
|
||||||
$output = array_shift($this->output);
|
$output = array_shift($this->output);
|
||||||
// Save compile starting time for debugging
|
// Save compile starting time for debugging
|
||||||
|
if (!isset($GLOBALS['__xmlparse_elapsed__']))
|
||||||
|
{
|
||||||
|
$GLOBALS['__xmlparse_elapsed__'] = 0;
|
||||||
|
}
|
||||||
$GLOBALS['__xmlparse_elapsed__'] += microtime(true) - $start;
|
$GLOBALS['__xmlparse_elapsed__'] += microtime(true) - $start;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
||||||
|
|
@ -768,7 +768,7 @@ class Debug
|
||||||
'url' => getCurrentPageUrl(),
|
'url' => getCurrentPageUrl(),
|
||||||
'request' => (object)array(
|
'request' => (object)array(
|
||||||
'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''),
|
'method' => $_SERVER['REQUEST_METHOD'] . ($_SERVER['REQUEST_METHOD'] !== \Context::getRequestMethod() ? (' (' . \Context::getRequestMethod() . ')') : ''),
|
||||||
'size' => intval($_SERVER['CONTENT_LENGTH']),
|
'size' => intval($_SERVER['CONTENT_LENGTH'] ?? 0),
|
||||||
),
|
),
|
||||||
'response' => (object)array(
|
'response' => (object)array(
|
||||||
'method' => \Context::getResponseMethod(),
|
'method' => \Context::getResponseMethod(),
|
||||||
|
|
@ -776,15 +776,15 @@ class Debug
|
||||||
),
|
),
|
||||||
'timing' => (object)array(
|
'timing' => (object)array(
|
||||||
'total' => sprintf('%0.4f sec', microtime(true) - \RX_MICROTIME),
|
'total' => sprintf('%0.4f sec', microtime(true) - \RX_MICROTIME),
|
||||||
'template' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']),
|
'template' => sprintf('%0.4f sec (count: %d)', $GLOBALS['__template_elapsed__'] ?? 0, $GLOBALS['__TemplateHandlerCalled__'] ?? 0),
|
||||||
'xmlparse' => sprintf('%0.4f sec', $GLOBALS['__xmlparse_elapsed__']),
|
'xmlparse' => sprintf('%0.4f sec', $GLOBALS['__xmlparse_elapsed__'] ?? 0),
|
||||||
'db_query' => sprintf('%0.4f sec (count: %d)', self::$_query_time, count(self::$_queries)),
|
'db_query' => sprintf('%0.4f sec (count: %d)', self::$_query_time, count(self::$_queries)),
|
||||||
'db_class' => sprintf('%0.4f sec', max(0, $db->getTotalElapsedTime() - self::$_query_time)),
|
'db_class' => sprintf('%0.4f sec', max(0, $db->getTotalElapsedTime() - self::$_query_time)),
|
||||||
'session' => sprintf('%0.4f sec', self::$_session_time),
|
'session' => sprintf('%0.4f sec', self::$_session_time),
|
||||||
'layout' => sprintf('%0.4f sec', $GLOBALS['__layout_compile_elapsed__']),
|
'layout' => sprintf('%0.4f sec', $GLOBALS['__layout_compile_elapsed__'] ?? 0),
|
||||||
'widget' => sprintf('%0.4f sec', $GLOBALS['__widget_excute_elapsed__']),
|
'widget' => sprintf('%0.4f sec', $GLOBALS['__widget_excute_elapsed__'] ?? 0),
|
||||||
'remote' => sprintf('%0.4f sec', $GLOBALS['__remote_request_elapsed__']),
|
'remote' => sprintf('%0.4f sec', $GLOBALS['__remote_request_elapsed__'] ?? 0),
|
||||||
'trans' => sprintf('%0.4f sec', $GLOBALS['__trans_content_elapsed__']),
|
'trans' => sprintf('%0.4f sec', $GLOBALS['__trans_content_elapsed__'] ?? 0),
|
||||||
),
|
),
|
||||||
'entries' => self::$_entries,
|
'entries' => self::$_entries,
|
||||||
'errors' => self::$_errors,
|
'errors' => self::$_errors,
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,8 @@ class DBQueryParser extends BaseParser
|
||||||
|
|
||||||
// Load attributes that only apply to subqueries in the <conditions> block.
|
// Load attributes that only apply to subqueries in the <conditions> block.
|
||||||
$query->operation = $attribs['operation'] ?? null;
|
$query->operation = $attribs['operation'] ?? null;
|
||||||
$query->column = preg_replace('/[^a-z0-9_\.]/i', '', $attribs['column']) ?: null;
|
$query->column = preg_replace('/[^a-z0-9_\.]/i', '', $attribs['column'] ?? null) ?: null;
|
||||||
$query->pipe = strtoupper($attribs['pipe']) ?: 'AND';
|
$query->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND';
|
||||||
|
|
||||||
// Load tables.
|
// Load tables.
|
||||||
foreach ($xml->tables ? $xml->tables->children() : [] as $tag)
|
foreach ($xml->tables ? $xml->tables->children() : [] as $tag)
|
||||||
|
|
@ -108,13 +108,13 @@ class DBQueryParser extends BaseParser
|
||||||
$attribs = self::_getAttributes($tag);
|
$attribs = self::_getAttributes($tag);
|
||||||
$column = new DBQuery\ColumnWrite;
|
$column = new DBQuery\ColumnWrite;
|
||||||
$column->name = $attribs['name'];
|
$column->name = $attribs['name'];
|
||||||
$column->operation = $attribs['operation'] ?: 'equal';
|
$column->operation = ($attribs['operation'] ?? null) ?: 'equal';
|
||||||
$column->var = $attribs['var'] ?? null;
|
$column->var = $attribs['var'] ?? null;
|
||||||
$column->default = $attribs['default'] ?? null;
|
$column->default = $attribs['default'] ?? null;
|
||||||
$column->not_null = $attribs['notnull'] ? true : false;
|
$column->not_null = ($attribs['notnull'] ?? false) ? true : false;
|
||||||
$column->filter = $attribs['filter'] ?? null;
|
$column->filter = $attribs['filter'] ?? null;
|
||||||
$column->minlength = intval($attribs['minlength'], 10);
|
$column->minlength = intval($attribs['minlength'] ?? 0, 10);
|
||||||
$column->maxlength = intval($attribs['maxlength'], 10);
|
$column->maxlength = intval($attribs['maxlength'] ?? 0, 10);
|
||||||
$query->columns[] = $column;
|
$query->columns[] = $column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -225,18 +225,18 @@ class DBQueryParser extends BaseParser
|
||||||
$cond->var = $attribs['var'] ?? null;
|
$cond->var = $attribs['var'] ?? null;
|
||||||
$cond->default = $attribs['default'] ?? null;
|
$cond->default = $attribs['default'] ?? null;
|
||||||
}
|
}
|
||||||
$cond->not_null = $attribs['notnull'] ? true : false;
|
$cond->not_null = ($attribs['notnull'] ?? false) ? true : false;
|
||||||
$cond->filter = $attribs['filter'] ?? null;
|
$cond->filter = $attribs['filter'] ?? null;
|
||||||
$cond->minlength = intval($attribs['minlength'], 10);
|
$cond->minlength = intval($attribs['minlength'] ?? 0, 10);
|
||||||
$cond->maxlength = intval($attribs['maxlength'], 10);
|
$cond->maxlength = intval($attribs['maxlength'] ?? 0, 10);
|
||||||
$cond->pipe = strtoupper($attribs['pipe']) ?: 'AND';
|
$cond->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND';
|
||||||
$result[] = $cond;
|
$result[] = $cond;
|
||||||
}
|
}
|
||||||
elseif ($name === 'group')
|
elseif ($name === 'group')
|
||||||
{
|
{
|
||||||
$group = new DBQuery\ConditionGroup;
|
$group = new DBQuery\ConditionGroup;
|
||||||
$group->conditions = self::_parseConditions($tag);
|
$group->conditions = self::_parseConditions($tag);
|
||||||
$group->pipe = strtoupper($attribs['pipe']) ?: 'AND';
|
$group->pipe = strtoupper($attribs['pipe'] ?? null) ?: 'AND';
|
||||||
$result[] = $group;
|
$result[] = $group;
|
||||||
}
|
}
|
||||||
elseif ($name === 'query')
|
elseif ($name === 'query')
|
||||||
|
|
|
||||||
|
|
@ -647,6 +647,10 @@ class widgetController extends widget
|
||||||
|
|
||||||
// Debug widget creation time information added to the results
|
// Debug widget creation time information added to the results
|
||||||
$elapsed_time = microtime(true) - $start;
|
$elapsed_time = microtime(true) - $start;
|
||||||
|
if (!isset($GLOBALS['__widget_excute_elapsed__']))
|
||||||
|
{
|
||||||
|
$GLOBALS['__widget_excute_elapsed__'] = 0;
|
||||||
|
}
|
||||||
$GLOBALS['__widget_excute_elapsed__'] += $elapsed_time;
|
$GLOBALS['__widget_excute_elapsed__'] += $elapsed_time;
|
||||||
Rhymix\Framework\Debug::addWidget(array(
|
Rhymix\Framework\Debug::addWidget(array(
|
||||||
'name' => $widget,
|
'name' => $widget,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue