public static function load_options() { if (self::$options == null) { $theme = Kohana::config('filebrowser.theme'); $options_file = Kohana::find_file('views/../../../config/themes/' . $theme . '/', 'options', false, 'yml'); if ($options_file) { $array = Spyc::YAMLLoad($options_file); self::$options = $array; if (isset($array['color_palette'])) { $colors_file = Kohana::find_file('views/../../../config/themes/' . $theme . '/colors/', $array['color_palette'], false, 'yml'); if ($colors_file) { $colors_array = Spyc::YAMLLoad($colors_file); self::$colors = $colors_array; } else { self::$colors = array(); } } } else { self::$options = array(); } } }
/** * Initialize view and set template & layout properties * @global object $db Instance of database object * @global object $config Site configuration settings * @param string $page [optional] Page whose information to load * @return void View is initialized */ static function InitView($page = null) { if (!empty(self::$vars)) { return true; } global $db, $config; self::$vars = new stdClass(); self::$vars->db = $db; self::$vars->config = $config; self::$options = new stdClass(); self::$options->layout = 'default'; self::$options->header = self::GetFallbackPath('layouts/' . self::$options->layout . '.header.tpl'); self::$options->footer = self::GetFallbackPath('layouts/' . self::$options->layout . '.footer.tpl'); self::$options->blocks = array(); // Load page's meta information into memory for use in templates if ($page) { self::$options->page = $page; self::$vars->meta = Language::GetMeta($page); if (empty(self::$vars->meta->title)) { self::$vars->meta->title = $config->sitename; } } Plugin::Trigger('view.init'); }