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


PHP Translatable::current_lang方法代碼示例

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


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

示例1: MetaTags

 /**
  * Return the title, description, keywords and language metatags.
  * @param boolean|string $includeTitle Show default <title>-tag, set to false for custom templating
  *
  * @param boolean $includeTitle Show default <title>-tag, set to false for
  *                              custom templating
  * @return string The XHTML metatags
  */
 public function MetaTags($includeTitle = true)
 {
     $tags = "";
     if ($includeTitle === true || $includeTitle == 'true') {
         $tags .= "<title>" . Convert::raw2xml($this->MetaTitle ? $this->MetaTitle : $this->Title) . "</title>\n";
     }
     $tags .= "<meta name=\"generator\" http-equiv=\"generator\" content=\"SilverStripe 2.0 - http://www.silverstripe.com\" />\n";
     $charset = ContentNegotiator::get_encoding();
     $tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset={$charset}\" />\n";
     if ($this->MetaKeywords) {
         $tags .= "<meta name=\"keywords\" http-equiv=\"keywords\" content=\"" . Convert::raw2att($this->MetaKeywords) . "\" />\n";
     }
     if ($this->MetaDescription) {
         $tags .= "<meta name=\"description\" http-equiv=\"description\" content=\"" . Convert::raw2att($this->MetaDescription) . "\" />\n";
     }
     if ($this->ExtraMeta) {
         $tags .= $this->ExtraMeta . "\n";
     }
     $tags .= "<meta http-equiv=\"Content-Language\" content=\"" . Translatable::current_lang() . "\"/>\n";
     return $tags;
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:29,代碼來源:SiteTree.php

示例2: LangAttributes

	/**
	 * Returns the xml:lang and lang attributes
	 */
	function LangAttributes() {
		$lang = Translatable::current_lang();
		return "xml:lang=\"$lang\" lang=\"$lang\"";	
	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:7,代碼來源:ContentController.php

示例3: EditingLang

 /**
  * Get the name of the language that we are translating in
  */
 function EditingLang()
 {
     if (!Translatable::is_default_lang()) {
         return i18n::get_language_name(Translatable::current_lang());
     } else {
         return false;
     }
 }
開發者ID:ramziammar,項目名稱:websites,代碼行數:11,代碼來源:CMSMain.php

示例4: MetaTags

	/**
	 * Return the title, description, keywords and language metatags.
	 * 
	 * @todo Move <title> tag in separate getter for easier customization and more obvious usage
	 * 
	 * @param boolean|string $includeTitle Show default <title>-tag, set to false for custom templating
	 * @param boolean $includeTitle Show default <title>-tag, set to false for
	 *                              custom templating
	 * @return string The XHTML metatags
	 */
	public function MetaTags($includeTitle = true) {
		$tags = "";
		if($includeTitle === true || $includeTitle == 'true') {
			$tags .= "<title>" . Convert::raw2xml(($this->MetaTitle)
				? $this->MetaTitle
				: $this->Title) . "</title>\n";
		}
		$version = new SapphireInfo();

		$tags .= "<meta name=\"generator\" http-equiv=\"generator\" content=\"SilverStripe ". $version->Version() ." - http://www.silverstripe.com\" />\n";

		$charset = ContentNegotiator::get_encoding();
		$tags .= "<meta http-equiv=\"Content-type\" content=\"text/html; charset=$charset\" />\n";
		if($this->MetaKeywords) {
			$tags .= "<meta name=\"keywords\" http-equiv=\"keywords\" content=\"" .
				Convert::raw2att($this->MetaKeywords) . "\" />\n";
		}
		if($this->MetaDescription) {
			$tags .= "<meta name=\"description\" http-equiv=\"description\" content=\"" .
				Convert::raw2att($this->MetaDescription) . "\" />\n";
		}
		if($this->ExtraMeta) { 
			$tags .= $this->ExtraMeta . "\n";
		} 
		$tags .= "<meta http-equiv=\"Content-Language\" content=\"". Translatable::current_lang() ."\"/>\n";
		
		// DEPRECATED 2.3: Use MetaTags
		$this->extend('updateMetaTags', $tags);
		
		$this->extend('MetaTags', $tags);

		return $tags;
	}
開發者ID:neopba,項目名稱:silverstripe-book,代碼行數:43,代碼來源:SiteTree.php


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