示例#1
0
 /**
  * Sets the needed static variables
  * 
  * @return  void
  */
 private static function _setStaticVars()
 {
     // Gets the instance of the WOOPS page getter
     self::$_pageGetter = Woops_Page_Getter::getInstance();
     // Gets the instance of the environment object
     self::$_env = Woops_Core_Env_Getter::getInstance();
     // Gets the instance of the configuration object
     self::$_conf = Woops_Core_Config_Getter::getInstance();
     // Gets the instance of the string utilities
     self::$_str = Woops_String_Utils::getInstance();
     // Static variables are set
     self::$_hasStatic = true;
 }
示例#2
0
 /**
  * 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_Getter   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;
 }
示例#3
0
 /**
  * 
  */
 public function getPageObject()
 {
     if (!is_object($this->_pageEngine)) {
         if (!is_object($this->_pageGetter)) {
             $this->_pageGetter = Woops_Page_Getter::getInstance();
         }
         $engineClass = $this->_pageGetter->getEngine();
         if (!isset($this->_pageEngines[$engineClass])) {
             throw new Woops_Page_Engine_Exception('The page engine \'' . $engineClass . '\' is not a registered WOOPS page engine', Woops_Page_Engine_Exception::EXCEPTION_ENGINE_NOT_REGISTERED);
         }
         if (!is_subclass_of($engineClass, 'Woops_Page_Engine_Base')) {
             throw new Woops_Page_Engine_Exception('The page engine \'' . $engineClass . '\' is not a valid WOOPS page engine, since it does extends the \'Woops_Page_Engine_Base\' abstract class', Woops_Page_Engine_Exception::EXCEPTION_ENGINE_NOT_VALID);
         }
         $this->_pageEngine = new $engineClass();
         $engineOptions = unserialize($this->_pageGetter->getEngineOptions());
         if (!is_object($engineOptions)) {
             $engineOptions = new stdClass();
         }
         $this->_pageEngine->loadEngine($engineOptions);
         // Dispatch the event to the listeners
         $this->dispatchEventObject(new Woops_Page_Engine_Event(Woops_Page_Engine_Event::EVENT_ENGINE_LOAD, $this->_pageEngine));
     }
     return $this->_pageEngine;
 }