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


PHP Director::get_site_mode方法代码示例

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


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

示例1: choose_site_locale

 /**
  * Choose the language the site is currently on.
  * If $_GET['locale'] is set, then it will use that language, and store it in the session.
  * Otherwise it checks the session for a possible stored language, either from namespace to the site_mode
  * ('site' or 'cms'), or for a 'global' language setting. 
  * The final option is the member preference.
  * 
  * @todo Re-implement cookie and member option
  * 
  * @uses Director::get_site_mode()
  * @param $langsAvailable array A numerical array of languages which are valid choices (optional)
  * @return string Selected language (also saved in $current_locale).
  */
 static function choose_site_locale($langsAvailable = array())
 {
     $siteMode = Director::get_site_mode();
     // either 'cms' or 'site'
     if (self::$current_locale) {
         return self::$current_locale;
     }
     if (isset($_GET['locale']) && !$langsAvailable || isset($_GET['locale']) && in_array($_GET['locale'], $langsAvailable)) {
         // get from GET parameter
         self::set_current_locale($_GET['locale']);
     } else {
         self::set_current_locale(self::default_locale());
     }
     return self::$current_locale;
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:28,代码来源:Translatable.php

示例2: set_reading_lang

	/**
	 * Set the reading language, either namespaced to 'site' (website content)
	 * or 'cms' (management backend).
	 * 
	 * @param string $lang New reading language.
	 */
	static function set_reading_lang($lang) {
		$key = (Director::get_site_mode()) ? 'lang.' . Director::get_site_mode() : 'lang.global';
		Session::set($key, $lang);
		self::$reading_lang = $lang;
	}	
开发者ID:neopba,项目名称:silverstripe-book,代码行数:11,代码来源:Translatable.php


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