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


PHP Themes::get_all方法代码示例

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


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

示例1: action_init

 function action_init()
 {
     if (!empty($_GET['theme_dir']) || !empty($_POST['theme_dir'])) {
         $new_theme_dir = empty($_GET['theme_dir']) ? $_POST['theme_dir'] : $_GET['theme_dir'];
         $all_themes = Themes::get_all();
         if (array_key_exists($new_theme_dir, $all_themes)) {
             if (!isset($_COOKIE['theme_dir']) || isset($_COOKIE['theme_dir']) && $_COOKIE['theme_dir'] != $new_theme_dir) {
                 $_COOKIE['theme_dir'] = $new_theme_dir;
                 // Without this, the cookie isn't get in time to change the theme NOW.
                 setcookie('theme_dir', $new_theme_dir);
             }
         }
     }
     $this->add_template('switcher', dirname(__FILE__) . '/themeswitcher.php');
 }
开发者ID:habari-extras,项目名称:themeswitcher,代码行数:15,代码来源:themeswitcher.plugin.php

示例2: get_active_theme_dir

 /**
  * Returns the active theme's full directory path.
  * @params boolean $nopreview If true, return the real active theme, not the preview
  * @return string The full path to the active theme directory
  */
 private static function get_active_theme_dir($nopreview = false)
 {
     $theme_dir = self::get_theme_dir($nopreview);
     $themes = Themes::get_all();
     if (!isset($themes[$theme_dir])) {
         $theme_exists = false;
         foreach ($themes as $themedir) {
             if (file_exists(Utils::end_in_slash($themedir) . 'theme.xml')) {
                 $theme_dir = basename($themedir);
                 Options::set('theme_dir', basename($themedir));
                 $theme_exists = true;
                 break;
             }
         }
         if (!$theme_exists) {
             die(_t('There is no valid theme currently installed.'));
         }
     }
     return $themes[$theme_dir];
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:25,代码来源:themes.php

示例3: is_theme_option

 /**
  * Determines if an option is for a theme
  *
  * @param  $option Name of the option being checked
  * @return mixed Returns the theme name on success, or FALSE if not found
  */
 public function is_theme_option($option)
 {
     if ($all_themes = Themes::get_all()) {
         foreach ($all_themes as $theme_name => $theme_file) {
             if (0 === strpos($option, strtolower($theme_name) . '_')) {
                 return $theme_name;
             }
         }
     }
     return FALSE;
 }
开发者ID:habari-extras,项目名称:optionsmanager,代码行数:17,代码来源:optionsmanager.plugin.php

示例4: get_active_theme_dir

	/**
	 * Returns the active theme's full directory path.
	 * @params boolean $nopreview If true, return the real active theme, not the preview
	 * @return string The full path to the active theme directory
	 */
	private static function get_active_theme_dir( $nopreview = false )
	{
		$theme_dir = self::get_theme_dir( $nopreview );
		$themes = Themes::get_all();

		// If our active theme directory has gone missing, iterate through the others until we find one we can use and activate it.
		if ( !isset( $themes[$theme_dir] ) ) {
			$theme_exists = false;
			foreach ( $themes as $themedir ) {
				if ( file_exists( Utils::end_in_slash( $themedir ) . 'theme.xml' ) ) {
					$theme_dir = basename( $themedir );
					EventLog::log( _t( "Active theme directory no longer available.  Falling back to '{$theme_dir}'" ), 'err', 'theme', 'habari' );
					Options::set( 'theme_dir', basename( $themedir ) );
					$fallback_theme = Themes::create();
					Plugins::act_id( 'theme_activated', $fallback_theme->plugin_id(), $theme_dir, $fallback_theme );
					$theme_exists = true;
					// Refresh to the newly "activated" theme to ensure it takes the options that have just been set above and doesn't produce any errors.
					Utils::redirect();
					break;
				}
			}
			if ( !$theme_exists ) {
				die( _t( 'There is no valid theme currently installed.' ) );
			}
		}
		return $themes[$theme_dir];
	}
开发者ID:rynodivino,项目名称:system,代码行数:32,代码来源:themes.php


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