當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Themes::cancel_preview方法代碼示例

本文整理匯總了PHP中Themes::cancel_preview方法的典型用法代碼示例。如果您正苦於以下問題:PHP Themes::cancel_preview方法的具體用法?PHP Themes::cancel_preview怎麽用?PHP Themes::cancel_preview使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Themes的用法示例。


在下文中一共展示了Themes::cancel_preview方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_preview_theme

 /**
  * Configures a theme to be active for the current user's session.
  */
 public function get_preview_theme()
 {
     $theme_name = $this->handler_vars['theme_name'];
     $theme_dir = $this->handler_vars['theme_dir'];
     if (isset($theme_name) && isset($theme_dir)) {
         if (Themes::get_theme_dir() == $theme_dir) {
             Themes::cancel_preview();
             Session::notice(_t("Ended the preview of the theme '%s'", array($theme_name)));
         } else {
             if (Themes::preview_theme($theme_name, $theme_dir)) {
                 Session::notice(_t("Previewing theme '%s'", array($theme_name)));
             }
         }
     }
     Utils::redirect(URL::get('admin', 'page=themes'));
 }
開發者ID:wwxgitcat,項目名稱:habari,代碼行數:19,代碼來源:adminthemeshandler.php

示例2: activate_theme

 /**
  * function activate_theme
  * Updates the database with the name of the new theme to use
  * @param string the name of the theme
  **/
 public static function activate_theme($theme_name, $theme_dir)
 {
     $ok = Themes::validate_theme($theme_dir);
     $ok = Plugins::filter('activate_theme', $ok, $theme_name);
     // Allow plugins to reject activation
     if ($ok) {
         Themes::cancel_preview();
         $old_active_theme = Themes::create();
         Plugins::act_id('theme_deactivated', $old_active_theme->plugin_id(), $old_active_theme->name, $old_active_theme);
         // For the theme itself to react to its deactivation
         Plugins::act('theme_deactivated_any', $old_active_theme->name, $old_active_theme);
         // For any plugin to react to its deactivation
         Options::set('theme_name', $theme_name);
         Options::set('theme_dir', $theme_dir);
         $new_active_theme = Themes::create($theme_name);
         // Set version of theme if it wasn't installed before
         $versions = Options::get('pluggable_versions');
         if (!isset($versions[get_class($new_active_theme)])) {
             $versions[get_class($new_active_theme)] = $new_active_theme->get_version();
             Options::set('pluggable_versions', $versions);
         }
         // Run activation hooks for theme activation
         Plugins::act_id('theme_activated', $new_active_theme->plugin_id(), $theme_name, $new_active_theme);
         // For the theme itself to react to its activation
         Plugins::act('theme_activated_any', $theme_name, $new_active_theme);
         // For any plugin to react to its activation
         EventLog::log(_t('Activated Theme: %s', array($theme_name)), 'notice', 'theme', 'habari');
     }
     return $ok;
 }
開發者ID:habari,項目名稱:system,代碼行數:35,代碼來源:themes.php


注:本文中的Themes::cancel_preview方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。