public static function get_instance()
 {
     if (null == self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
예제 #2
0
 function Framework()
 {
     global $Page, $argData, $viewClass, $viewConfig, $db, $Auth, $hostConfig;
     self::$instance = $this;
     // Pseudo-singleton instancing
     $this->debugInit();
     // Init Debug Logging
     // Site Configuration - Autodetect Settings based on Hostname
     $hasConfig = !$this->detectHost(trim(`hostname -s`)) ? $this->detectHost(trim(`hostname`)) : -3;
     if (!$hasConfig) {
         $this->debug(DEBUG_FATAL, "Failed to detect server name [" . trim(`hostname -s`) . "]\nOK1={$ok1}, OK2={$ok2}\nROK={$rok}\n");
     }
     // Instance Authentication Daemon, if one is configured or loaded
     if (!class_exists("AuthSession")) {
         $this->debug(DEBUG_FATAL, "No AuthSession class seems to be loaded");
     }
     $Auth = new AuthSession();
     // Load View Handlers
     $this->views = $this->findHandlers("Views/");
     // Parse URL for argument data
     $argData = isset($_SERVER['PATH_INFO']) && strlen($_SERVER['PATH_INFO']) > 2 ? explode("/", $_SERVER['PATH_INFO']) : array();
     array_shift($argData);
     // If a view was specified, load the handler
     if (isset($argData[0])) {
         $viewConfig = $this->initHandler($argData[0]);
         $viewClass = new $viewConfig['class'](true);
         array_shift($argData);
     } else {
         $viewClass = $viewConfig = "";
     }
     return;
 }
예제 #3
0
 /**
  * Retrieves the body classes
  *
  * @param string|array $classes Additional body classes
  *
  * @return string
  */
 public function bodyClass($classes = [])
 {
     $classes = !is_array($classes) ? explode(' ', $classes) : $classes;
     $classes = get_body_class($classes);
     if (Framework::instance()->getThemeOption('navbar_location') === 'fixed') {
         $classes[] = 'fixed-nav';
     }
     $classes = apply_filters('novusopress_view_body_classes', $classes);
     $output = sprintf('class="%s"', implode(' ', $classes));
     return apply_filters('novusopress_view_body_class_output', $output);
 }