Merge branch 'rhymix:master' into master

This commit is contained in:
Lastorder 2025-05-02 17:07:35 +09:00 committed by GitHub
commit d327bb1926
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 588 additions and 221 deletions

View file

@ -163,7 +163,7 @@ class Context
{
// Create a singleton instance and initialize static properties.
self::$_instance = new Context();
self::$_oFrontEndFileHandler = self::$_instance->oFrontEndFileHandler = new FrontEndFileHandler();
self::$_oFrontEndFileHandler = self::$_instance->oFrontEndFileHandler = FrontEndFileHandler::getInstance();
self::$_user_vars = self::$_user_vars ?: new stdClass;
}
return self::$_instance;

View file

@ -9,7 +9,6 @@ class DisplayHandler extends Handler
{
public static $response_size = 0;
public static $debug_printed = 0;
public $content_size = 0;
public $handler = NULL;
/**
@ -140,12 +139,15 @@ class DisplayHandler extends Handler
$buff = ltrim($buff, "\n\r\t\v\x00\x20\u{FEFF}");
// call a trigger after display
self::$response_size = $this->content_size = strlen($output);
ModuleHandler::triggerCall('display', 'after', $output);
// Measure the response size.
self::$response_size = strlen((string)$output);
// Output buffered content only if the current page is HTML.
if ($handler instanceof HTMLDisplayHandler)
{
self::$response_size += strlen($buff);
echo $buff;
}

View file

@ -53,13 +53,38 @@ class FrontEndFileHandler extends Handler
*/
public $jsBodyMapIndex = array();
/**
* Logging
*/
protected $_log_enabled = false;
protected $_log_entries = [];
/**
* Singleton
*/
protected static $_instance = null;
/**
* Get singleton instance
*
* @return self
*/
public static function getInstance(): self
{
if (self::$_instance === null)
{
self::$_instance = new self();
}
return self::$_instance;
}
/**
* Check SSL
*
* @return bool If using ssl returns true, otherwise returns false.
* @deprecated
*/
public function isSsl()
public static function isSsl()
{
return \RX_SSL;
}
@ -92,6 +117,10 @@ class FrontEndFileHandler extends Handler
{
$args = array($args);
}
if ($this->_log_enabled)
{
$this->_log_entries[] = $args;
}
// Replace obsolete paths with current paths.
$args[0] = preg_replace(array_keys(HTMLDisplayHandler::$replacements), array_values(HTMLDisplayHandler::$replacements), $args[0]);
@ -252,6 +281,26 @@ class FrontEndFileHandler extends Handler
return $file;
}
/**
* Start logging.
*/
public function startLog()
{
$this->_log_enabled = true;
$this->_log_entries = [];
}
/**
* End logging and return the log entries.
*
* @return array
*/
public function endLog(): array
{
$this->_log_enabled = false;
return $this->_log_entries;
}
/**
* Process CSS and JS file
*

View file

@ -848,15 +848,10 @@ class ModuleHandler extends Handler
$seo_title = config('seo.subpage_title') ?: '$SITE_TITLE - $SUBPAGE_TITLE';
}
$seo_title = Context::replaceUserLang($seo_title);
$subpage_title = $module_info->browser_title;
if (in_array($module_info->module, ['member']))
{
$subpage_title = '';
}
Context::setBrowserTitle($seo_title, array(
'site_title' => Context::getSiteTitle(),
'site_subtitle' => Context::getSiteSubtitle(),
'subpage_title' => $subpage_title,
'subpage_title' => $module_info->browser_title,
'page' => Context::get('page') ?: 1,
));