Use FrontEndFileHandler as a singleton

This commit is contained in:
Kijin Sung 2025-03-27 10:46:09 +09:00
parent df1c365872
commit 5ccd4f68d9
2 changed files with 21 additions and 2 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

@ -59,13 +59,32 @@ class FrontEndFileHandler extends Handler
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;
}