mirror of
https://github.com/flextype/flextype.git
synced 2025-08-09 06:36:52 +02:00
Fixed Singleton classes and methods visibility changed from protected to private
This commit is contained in:
@@ -21,8 +21,9 @@ class Cache
|
||||
* An instance of the Cache class
|
||||
*
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
protected static $instance = null;
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Unique cache key
|
||||
@@ -53,21 +54,25 @@ class Cache
|
||||
protected static $driver;
|
||||
|
||||
/**
|
||||
* Protected clone method to enforce singleton behavior.
|
||||
* Private clone method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __clone()
|
||||
{
|
||||
// Nothing here.
|
||||
}
|
||||
private function __clone() { }
|
||||
|
||||
/**
|
||||
* Protected constructor since this is a static class.
|
||||
* Private wakeup method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __construct()
|
||||
private function __wakeup() { }
|
||||
|
||||
/**
|
||||
* Private construct method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
Cache::init();
|
||||
}
|
||||
@@ -296,14 +301,17 @@ class Cache
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Cache instance.
|
||||
* Create it if it's not already created.
|
||||
* Get the Cache instance.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return !isset(self::$instance) and self::$instance = new Cache();
|
||||
}
|
||||
public static function getInstance()
|
||||
{
|
||||
if (is_null(Cache::$instance)) {
|
||||
Cache::$instance = new self;
|
||||
}
|
||||
|
||||
return Cache::$instance;
|
||||
}
|
||||
}
|
||||
|
@@ -23,9 +23,9 @@ class Content
|
||||
* An instance of the Content class
|
||||
*
|
||||
* @var object
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected static $instance = null;
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Shortcode object
|
||||
@@ -39,16 +39,30 @@ class Content
|
||||
* Current page data array
|
||||
*
|
||||
* @var array
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
private static $page = [];
|
||||
|
||||
/**
|
||||
* Protected constructor since this is a static class.
|
||||
* Private clone method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __construct()
|
||||
private function __clone() { }
|
||||
|
||||
/**
|
||||
* Private wakeup method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __wakeup() { }
|
||||
|
||||
/**
|
||||
* Private construct method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
Content::init();
|
||||
}
|
||||
@@ -56,10 +70,10 @@ class Content
|
||||
/**
|
||||
* Init Content
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function init() : void
|
||||
private static function init() : void
|
||||
{
|
||||
Content::processCurrentPage();
|
||||
}
|
||||
@@ -67,10 +81,10 @@ class Content
|
||||
/**
|
||||
* Process Current Page
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function processCurrentPage() : void
|
||||
private static function processCurrentPage() : void
|
||||
{
|
||||
// Event: The page is not processed and not sent to the display.
|
||||
Event::dispatch('onCurrentPageBeforeProcessed');
|
||||
@@ -382,10 +396,10 @@ class Content
|
||||
/**
|
||||
* Init Parsers
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function initParsers() : void
|
||||
private static function initParsers() : void
|
||||
{
|
||||
// Init Shortcodes
|
||||
Content::initShortcodes();
|
||||
@@ -394,10 +408,10 @@ class Content
|
||||
/**
|
||||
* Init Shortcodes
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function initShortcodes() : void
|
||||
private static function initShortcodes() : void
|
||||
{
|
||||
// Create Shortcode Parser object
|
||||
Content::$shortcode = new ShortcodeFacade();
|
||||
@@ -409,10 +423,10 @@ class Content
|
||||
/**
|
||||
* Display current page
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function displayCurrentPage() : void
|
||||
private static function displayCurrentPage() : void
|
||||
{
|
||||
Http::setRequestHeaders('Content-Type: text/html; charset='.Registry::get('site.charset'));
|
||||
Themes::view(empty(Content::$page['template']) ? 'templates/default' : 'templates/' . Content::$page['template'])
|
||||
@@ -421,14 +435,17 @@ class Content
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Content instance.
|
||||
* Create it if it's not already created.
|
||||
* Get the Content instance.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return !isset(self::$instance) and self::$instance = new Content();
|
||||
}
|
||||
public static function getInstance()
|
||||
{
|
||||
if (is_null(Content::$instance)) {
|
||||
Content::$instance = new self;
|
||||
}
|
||||
|
||||
return Content::$instance;
|
||||
}
|
||||
}
|
||||
|
@@ -28,36 +28,40 @@ class Flextype
|
||||
* An instance of the Flextype class
|
||||
*
|
||||
* @var object
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected static $instance = null;
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Protected clone method to enforce singleton behavior.
|
||||
* Private clone method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __clone()
|
||||
{
|
||||
// Nothing here.
|
||||
}
|
||||
private function __clone() { }
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
* Private wakeup method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __construct()
|
||||
private function __wakeup() { }
|
||||
|
||||
/**
|
||||
* Private construct method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
Flextype::init();
|
||||
}
|
||||
|
||||
/**
|
||||
* Init Application
|
||||
* Init Flextype Application
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected static function init() : void
|
||||
private static function init() : void
|
||||
{
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
@@ -78,17 +82,17 @@ class Flextype
|
||||
// Start the session
|
||||
Session::start();
|
||||
|
||||
// Create Cache Instance
|
||||
Cache::instance();
|
||||
// Get Cache Instance
|
||||
Cache::getInstance();
|
||||
|
||||
// Create Themes Instance
|
||||
Themes::instance();
|
||||
// Get Themes Instance
|
||||
Themes::getInstance();
|
||||
|
||||
// Create Plugins Instance
|
||||
Plugins::instance();
|
||||
// Get Plugins Instance
|
||||
Plugins::getInstance();
|
||||
|
||||
// Create Content Instance
|
||||
Content::instance();
|
||||
// Get Content Instance
|
||||
Content::getInstance();
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
@@ -97,9 +101,9 @@ class Flextype
|
||||
/**
|
||||
* Set error handler
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected static function setErrorHandler() : void
|
||||
private static function setErrorHandler() : void
|
||||
{
|
||||
// Display Errors
|
||||
if (Registry::get('site.errors.display')) {
|
||||
@@ -122,9 +126,9 @@ class Flextype
|
||||
/**
|
||||
* Set site config
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected static function setSiteConfig() : void
|
||||
private static function setSiteConfig() : void
|
||||
{
|
||||
// Set empty site item
|
||||
Registry::set('site', []);
|
||||
@@ -138,14 +142,17 @@ class Flextype
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Flextype instance.
|
||||
* Create it if it's not already created.
|
||||
* Get the Flextype instance.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function instance()
|
||||
public static function getInstance()
|
||||
{
|
||||
return !isset(self::$instance) and self::$instance = new Flextype();
|
||||
if (is_null(Flextype::$instance)) {
|
||||
Flextype::$instance = new self;
|
||||
}
|
||||
|
||||
return Flextype::$instance;
|
||||
}
|
||||
}
|
||||
|
@@ -21,8 +21,9 @@ class Plugins
|
||||
* An instance of the Cache class
|
||||
*
|
||||
* @var object
|
||||
* @access private
|
||||
*/
|
||||
protected static $instance = null;
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Locales array
|
||||
@@ -65,11 +66,25 @@ class Plugins
|
||||
];
|
||||
|
||||
/**
|
||||
* Protected constructor since this is a static class.
|
||||
* Private clone method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __construct()
|
||||
private function __clone() { }
|
||||
|
||||
/**
|
||||
* Private wakeup method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __wakeup() { }
|
||||
|
||||
/**
|
||||
* Private construct method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
Plugins::init();
|
||||
}
|
||||
@@ -77,10 +92,10 @@ class Plugins
|
||||
/**
|
||||
* Init Plugins
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function init() : void
|
||||
private static function init() : void
|
||||
{
|
||||
// Plugin manifest
|
||||
$plugin_manifest = [];
|
||||
@@ -158,14 +173,17 @@ class Plugins
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Plugins instance.
|
||||
* Create it if it's not already created.
|
||||
* Get the Plugins instance.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return !isset(self::$instance) and self::$instance = new Plugins();
|
||||
}
|
||||
public static function getInstance()
|
||||
{
|
||||
if (is_null(Plugins::$instance)) {
|
||||
Plugins::$instance = new self;
|
||||
}
|
||||
|
||||
return Plugins::$instance;
|
||||
}
|
||||
}
|
||||
|
@@ -22,14 +22,28 @@ class Themes
|
||||
*
|
||||
* @var object
|
||||
*/
|
||||
protected static $instance = null;
|
||||
private static $instance = null;
|
||||
|
||||
/**
|
||||
* Protected constructor since this is a static class.
|
||||
* Private clone method to enforce singleton behavior.
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
*/
|
||||
protected function __construct()
|
||||
private function __clone() { }
|
||||
|
||||
/**
|
||||
* Private wakeup method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __wakeup() { }
|
||||
|
||||
/**
|
||||
* Private construct method to enforce singleton behavior.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
Themes::init();
|
||||
}
|
||||
@@ -37,10 +51,10 @@ class Themes
|
||||
/**
|
||||
* Init Themes
|
||||
*
|
||||
* @access protected
|
||||
* @access private
|
||||
* @return void
|
||||
*/
|
||||
protected static function init() : void
|
||||
private static function init() : void
|
||||
{
|
||||
// Theme Manifest
|
||||
$theme_manifest = [];
|
||||
@@ -92,14 +106,17 @@ class Themes
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Themes instance.
|
||||
* Create it if it's not already created.
|
||||
* Get the Themes instance.
|
||||
*
|
||||
* @access public
|
||||
* @return object
|
||||
*/
|
||||
public static function instance()
|
||||
{
|
||||
return !isset(self::$instance) and self::$instance = new Themes();
|
||||
}
|
||||
public static function getInstance()
|
||||
{
|
||||
if (is_null(Themes::$instance)) {
|
||||
Themes::$instance = new self;
|
||||
}
|
||||
|
||||
return Themes::$instance;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user