当前位置: 首页>>代码示例>>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;未经允许,请勿转载。