Exemplo n.º 1
0
 /**
  * Returns a reference to the global JWeb object, only creating it if it doesn't already exist.
  *
  * This method must be invoked as: $web = JWeb::getInstance();
  *
  * @param   string  $name  The name (optional) of the JWeb class to instantiate.
  *
  * @return  JWeb
  *
  * @since   11.3
  */
 public static function getInstance($name = null)
 {
     // Only create the object if it doesn't exist.
     if (empty(self::$instance)) {
         if (class_exists($name) && is_subclass_of($name, 'JWeb')) {
             self::$instance = new $name();
         } else {
             self::$instance = new JWeb();
         }
     }
     return self::$instance;
 }