Beispiel #1
0
 /**
  * For internal use only.
  */
 public function construct()
 {
     $this->set_inline_display();
     if (!isset(self::$theme)) {
         self::$theme = Base_ThemeCommon::get_default_template();
     }
     $this->smarty = Base_ThemeCommon::init_smarty();
 }
Beispiel #2
0
 /**
  * Regeneramos la cache.
  * @param string $actual Tema para setear como actual. Si no se deja utiliza
  * el actual o el primero que exista.
  * @return array
  */
 private static function generar_cache($actual = NULL)
 {
     // Busco plugins.
     $themes = array();
     $dir = scandir(APP_BASE . DS . VIEW_PATH);
     foreach ($dir as $d) {
         if ($d == '.' || $d == '..') {
             continue;
         }
         if (is_dir(APP_BASE . DS . VIEW_PATH . $d) && file_exists(APP_BASE . DS . VIEW_PATH . $d . DS . 'theme.php')) {
             $themes[] = trim($d);
         }
     }
     if ($actual === NULL) {
         if (file_exists(APP_BASE . DS . VIEW_PATH . 'theme.php')) {
             $actual = self::actual(TRUE);
         } else {
             $actual = trim($themes[0]);
         }
     }
     self::$theme = $actual;
     file_put_contents(APP_BASE . DS . VIEW_PATH . 'theme.php', $actual . PHP_EOL . implode(PHP_EOL, $themes));
     return $themes;
 }