当前位置: 首页>>代码示例>>PHP>>正文


PHP site_status::error方法代码示例

本文整理汇总了PHP中site_status::error方法的典型用法代码示例。如果您正苦于以下问题:PHP site_status::error方法的具体用法?PHP site_status::error怎么用?PHP site_status::error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在site_status的用法示例。


在下文中一共展示了site_status::error方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load_themes

 /**
  * Load the active theme.  This is called at bootstrap time.  We will only ever have one theme
  * active for any given request.
  */
 static function load_themes()
 {
     $input = Input::instance();
     $path = $input->server("PATH_INFO");
     if (empty($path)) {
         $path = "/" . $input->get("kohana_uri");
     }
     $config = Kohana_Config::instance();
     $modules = $config->get("core.modules");
     // Normally Router::find_uri() strips off the url suffix for us, but we're working off of the
     // PATH_INFO here so we need to strip it off manually
     if ($suffix = Kohana::config("core.url_suffix")) {
         $path = preg_replace("#" . preg_quote($suffix) . "\$#u", "", $path);
     }
     self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7);
     self::$site_theme_name = module::get_var("gallery", "active_site_theme");
     // If the site theme doesn't exist, fall back to wind.
     if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) {
         site_status::error(t("Theme '%name' is missing.  Falling back to the Wind theme.", array("name" => self::$site_theme_name)), "missing_site_theme");
         module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind");
     }
     if (self::$is_admin) {
         // Load the admin theme
         self::$admin_theme_name = module::get_var("gallery", "active_admin_theme");
         // If the admin theme doesn't exist, fall back to admin_wind.
         if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) {
             site_status::error(t("Admin theme '%name' is missing!  Falling back to the Wind theme.", array("name" => self::$admin_theme_name)), "missing_admin_theme");
             module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind");
         }
         array_unshift($modules, THEMEPATH . self::$admin_theme_name);
         // If the site theme has an admin subdir, load that as a module so that
         // themes can provide their own code.
         if (file_exists(THEMEPATH . self::$site_theme_name . "/admin")) {
             array_unshift($modules, THEMEPATH . self::$site_theme_name . "/admin");
         }
         // Admins can override the site theme, temporarily.  This lets us preview themes.
         if (identity::active_user()->admin && ($override = $input->get("theme"))) {
             if (file_exists(THEMEPATH . $override)) {
                 self::$admin_theme_name = $override;
                 array_unshift($modules, THEMEPATH . self::$admin_theme_name);
             } else {
                 Kohana_Log::add("error", "Missing override admin theme: '{$override}'");
             }
         }
     } else {
         // Admins can override the site theme, temporarily.  This lets us preview themes.
         if (identity::active_user()->admin && ($override = $input->get("theme"))) {
             if (file_exists(THEMEPATH . $override)) {
                 self::$site_theme_name = $override;
             } else {
                 Kohana_Log::add("error", "Missing override site theme: '{$override}'");
             }
         }
         array_unshift($modules, THEMEPATH . self::$site_theme_name);
     }
     $config->set("core.modules", $modules);
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:61,代码来源:theme.php


注:本文中的site_status::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。