當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。