/** * 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; }
/** * Returns the xml:lang and lang attributes */ function LangAttributes() { $lang = Translatable::current_lang(); return "xml:lang=\"$lang\" lang=\"$lang\""; }
/** * 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; } }
/** * 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; }