/** * Gets the unique class instance * * This method is used to get the unique instance of the class * (singleton). If no instance is available, it will create it. * * @return Woops_Page_Engine The unique instance of the class * @see __construct */ public static function getInstance() { // Checks if the unique instance already exists if (!is_object(self::$_instance)) { // Creates the unique instance self::$_instance = new self(); } // Returns the unique instance return self::$_instance; }
/** * Sets the needed static variables * * @return void */ private static function _setStaticVars() { self::$_db = Woops_Database_Layer::getInstance()->getEngine(); self::$_page = Woops_Page_Engine::getInstance()->getPageObject()->getXhtmlPage(); // Static variables are set self::$_hasStatic = true; }
<?php ################################################################################ # # # WOOPS - Web Object Oriented Programming System # # # # COPYRIGHT NOTICE # # # # Copyright (C) 2009 Jean-David Gadina - www.xs-labs.com # # All rights reserved # ################################################################################ # $Id$ // Includes the initialization script require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'woops-src' . DIRECTORY_SEPARATOR . 'init.inc.php'; // Gets the environment object $ENV = Woops_Core_Env_Getter::getInstance(); // Checks if the WOOPS configuration file exists if (!$ENV->getPath('config/woops.ini.php')) { // Redirects to the WOOPS installer header('Location: ' . $ENV->getSourceWebPath('scripts/install/')); } // Gets the current page $PAGE = Woops_Page_Engine::getInstance()->getPageObject(); // Prints the current page print $PAGE->writePage(); // Cleanup unset($ENV, $PAGE);
<?php ################################################################################ # # # WOOPS - Web Object Oriented Programming System # # # # COPYRIGHT NOTICE # # # # Copyright (C) 2009 Jean-David Gadina - www.xs-labs.com # # All rights reserved # ################################################################################ # $Id$ Woops_Core_Module_Manager::getInstance()->registerBlockType('cms', 'Woops_Mod_Cms_Block'); Woops_Xhtml_Parser::registerProcessingInstructionHandler('woops-cms-block', 'Woops_Mod_Cms_Block_ProcessingInstruction_Handler'); Woops_Page_Engine::getInstance()->registerPageEngine('Woops_Mod_Cms_Page_Engine');