Ejemplo n.º 1
0
 /**
  * Gets the object named as in the arguments.<br />
  * The name of the object is stranslated to start with SH_PREFIX.
  * @param string $objectName The name of the object, starting with SH_PREFIX or not
  * @return object|boolean
  * <ul><li>The object that was asked for.</li>
  * <li>False if none was found.</li></ul>
  */
 public function __get($objectName)
 {
     $objectName = $this->cleanObjectName($objectName);
     if (isset($this->{$objectName}) && is_object($this->{$objectName})) {
         return $this->{$objectName};
     }
     if (method_exists($objectName, 'getInstance')) {
         $object = $objectName::getInstance($objectName);
         $this->{$objectName} = $object;
         $object->construct();
         $this->objects[$objectName] = $object;
         return $object;
     }
     echo __CLASS__ . '::' . __LINE__ . ' : The class ' . $objectName . ' does not exist or doesn\'t have a getInstance() static method.<br />';
     if ($this->admin->isAdmin(true)) {
         $debugger = new sh_debugger();
         $debugger->xdebug(__FILE__ . ' : ' . __LINE__);
     }
     return null;
 }
Ejemplo n.º 2
0
 /**
  * Sends some text to the debugger.
  * @param str $text The text to write in the debug
  * @param int $level The debug level (from 0 to 3, 0 being the most important).
  * Defaults to sh_debugger::LEVEL .
  * @param int $line The line number that should be written at the beginning of
  * the lines in the debug.
  * Defaults to sh_debugger::LINE .
  * @param bool $showClassName
  * True to show the class name before the line number.
  * False not to show it.
  * Defaults to sh_debugger::SHOWCLASS
  * @return bool
  * True if the text was added to the debug,
  * False if not.
  */
 protected function debug($text, $level = sh_debugger::LEVEL, $line = sh_debugger::LINE, $showClassName = sh_debugger::SHOWCLASS)
 {
     return $this->debugger->debug($text, $level, $line, $showClassName, $this->className);
 }