Exemplo n.º 1
0
 /**
  * @param $sk Skin The given Skin
  * @param $includeStyle Boolean: unused
  * @return String: The doctype, opening <html>, and head element.
  */
 public function headElement(Skin $sk, $includeStyle = true)
 {
     global $wgContLang, $wgUseTrackbacks;
     $userdir = $this->getLang()->getDir();
     $sitedir = $wgContLang->getDir();
     if ($sk->commonPrintStylesheet()) {
         $this->addModuleStyles('mediawiki.legacy.wikiprintable');
     }
     $sk->setupUserCss($this);
     $ret = Html::htmlHeader(array('lang' => $this->getLang()->getCode(), 'dir' => $userdir, 'class' => 'client-nojs'));
     if ($this->getHTMLTitle() == '') {
         $this->setHTMLTitle(wfMsg('pagetitle', $this->getPageTitle()));
     }
     $openHead = Html::openElement('head');
     if ($openHead) {
         # Don't bother with the newline if $head == ''
         $ret .= "{$openHead}\n";
     }
     $ret .= Html::element('title', null, $this->getHTMLTitle()) . "\n";
     $ret .= implode("\n", array($this->getHeadLinks($sk, true), $this->buildCssLinks($sk), $this->getHeadScripts($sk), $this->getHeadItems()));
     if ($wgUseTrackbacks && $this->isArticleRelated()) {
         $ret .= $this->getTitle()->trackbackRDF();
     }
     $closeHead = Html::closeElement('head');
     if ($closeHead) {
         $ret .= "{$closeHead}\n";
     }
     $bodyAttrs = array();
     # Crazy edit-on-double-click stuff
     $action = $this->getRequest()->getVal('action', 'view');
     if ($this->getTitle()->getNamespace() != NS_SPECIAL && in_array($action, array('view', 'purge')) && $this->getUser()->getOption('editondblclick')) {
         $editUrl = $this->getTitle()->getLocalUrl($sk->editUrlOptions());
         $bodyAttrs['ondblclick'] = "document.location = '" . Xml::escapeJsString($editUrl) . "'";
     }
     # Classes for LTR/RTL directionality support
     $bodyAttrs['class'] = "mediawiki {$userdir} sitedir-{$sitedir}";
     if ($this->getContext()->getLang()->capitalizeAllNouns()) {
         # A <body> class is probably not the best way to do this . . .
         $bodyAttrs['class'] .= ' capitalize-all-nouns';
     }
     $bodyAttrs['class'] .= ' ' . $sk->getPageClasses($this->getTitle());
     $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass($sk->getSkinName());
     $sk->addToBodyAttributes($this, $bodyAttrs);
     // Allow skins to add body attributes they need
     wfRunHooks('OutputPageBodyAttributes', array($this, $sk, &$bodyAttrs));
     $ret .= Html::openElement('body', $bodyAttrs) . "\n";
     return $ret;
 }
Exemplo n.º 2
0
 /**
  * @param $sk Skin The given Skin
  * @param $includeStyle Unused (?)
  * @return String: The doctype, opening <html>, and head element.
  */
 public function headElement(Skin $sk, $includeStyle = true)
 {
     global $wgDocType, $wgDTD, $wgContLanguageCode, $wgOutputEncoding, $wgMimeType;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
     global $wgContLang, $wgUseTrackbacks, $wgStyleVersion, $wgHtml5, $wgWellFormedXml;
     global $wgUser, $wgRequest, $wgLang;
     $this->addMeta("http:Content-Type", "{$wgMimeType}; charset={$wgOutputEncoding}");
     if ($sk->commonPrintStylesheet()) {
         $this->addStyle('common/wikiprintable.css', 'print');
     }
     $sk->setupUserCss($this);
     $ret = '';
     if ($wgMimeType == 'text/xml' || $wgMimeType == 'application/xhtml+xml' || $wgMimeType == 'application/xml') {
         $ret .= "<?xml version=\"1.0\" encoding=\"{$wgOutputEncoding}\" ?" . ">\n";
     }
     if ($this->getHTMLTitle() == '') {
         $this->setHTMLTitle(wfMsg('pagetitle', $this->getPageTitle()));
     }
     $dir = $wgContLang->getDir();
     if ($wgHtml5) {
         if ($wgWellFormedXml) {
             # Unknown elements and attributes are okay in XML, but unknown
             # named entities are well-formedness errors and will break XML
             # parsers.  Thus we need a doctype that gives us appropriate
             # entity definitions.  The HTML5 spec permits four legacy
             # doctypes as obsolete but conforming, so let's pick one of
             # those, although it makes our pages look like XHTML1 Strict.
             # Isn't compatibility great?
             $ret .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
         } else {
             # Much saner.
             $ret .= "<!doctype html>\n";
         }
         $ret .= "<html lang=\"{$wgContLanguageCode}\" dir=\"{$dir}\"";
         if ($wgHtml5Version) {
             $ret .= " version=\"{$wgHtml5Version}\"";
         }
         $ret .= ">\n";
     } else {
         $ret .= "<!DOCTYPE html PUBLIC \"{$wgDocType}\" \"{$wgDTD}\">\n";
         $ret .= "<html xmlns=\"{$wgXhtmlDefaultNamespace}\" ";
         foreach ($wgXhtmlNamespaces as $tag => $ns) {
             $ret .= "xmlns:{$tag}=\"{$ns}\" ";
         }
         $ret .= "lang=\"{$wgContLanguageCode}\" dir=\"{$dir}\">\n";
     }
     $ret .= "<head>\n";
     $ret .= "<title>" . htmlspecialchars($this->getHTMLTitle()) . "</title>\n";
     $ret .= implode("\n", array($this->getHeadLinks(), $this->buildCssLinks(), $this->getHeadScripts($sk), $this->getHeadItems()));
     if ($sk->usercss) {
         $ret .= Html::inlineStyle($sk->usercss);
     }
     if ($wgUseTrackbacks && $this->isArticleRelated()) {
         $ret .= $this->getTitle()->trackbackRDF();
     }
     $ret .= "</head>\n";
     $bodyAttrs = array();
     # Crazy edit-on-double-click stuff
     $action = $wgRequest->getVal('action', 'view');
     if ($this->getTitle()->getNamespace() != NS_SPECIAL && !in_array($action, array('edit', 'submit')) && $wgUser->getOption('editondblclick')) {
         $bodyAttrs['ondblclick'] = "document.location = '" . Xml::escapeJsString($this->getTitle()->getEditURL()) . "'";
     }
     # Class bloat
     $bodyAttrs['class'] = "mediawiki {$dir}";
     if ($wgLang->capitalizeAllNouns()) {
         # A <body> class is probably not the best way to do this . . .
         $bodyAttrs['class'] .= ' capitalize-all-nouns';
     }
     $bodyAttrs['class'] .= ' ns-' . $this->getTitle()->getNamespace();
     if ($this->getTitle()->getNamespace() == NS_SPECIAL) {
         $bodyAttrs['class'] .= ' ns-special';
     } elseif ($this->getTitle()->isTalkPage()) {
         $bodyAttrs['class'] .= ' ns-talk';
     } else {
         $bodyAttrs['class'] .= ' ns-subject';
     }
     $bodyAttrs['class'] .= ' ' . Sanitizer::escapeClass('page-' . $this->getTitle()->getPrefixedText());
     $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass($wgUser->getSkin()->getSkinName());
     $ret .= Html::openElement('body', $bodyAttrs) . "\n";
     return $ret;
 }
Exemplo n.º 3
0
 /**
  * @param $sk Skin The given Skin
  * @param $includeStyle Boolean: unused
  * @return String: The doctype, opening "<html>", and head element.
  */
 public function headElement(Skin $sk, $includeStyle = true)
 {
     global $wgContLang, $wgMimeType;
     $userdir = $this->getLanguage()->getDir();
     $sitedir = $wgContLang->getDir();
     if ($sk->commonPrintStylesheet()) {
         $this->addModuleStyles('mediawiki.legacy.wikiprintable');
     }
     $ret = Html::htmlHeader(array('lang' => $this->getLanguage()->getHtmlCode(), 'dir' => $userdir, 'class' => 'client-nojs'));
     if ($this->getHTMLTitle() == '') {
         $this->setHTMLTitle($this->msg('pagetitle', $this->getPageTitle()));
     }
     $openHead = Html::openElement('head');
     if ($openHead) {
         # Don't bother with the newline if $head == ''
         $ret .= "{$openHead}\n";
     }
     if (!Html::isXmlMimeType($wgMimeType)) {
         // Add <meta charset="UTF-8">
         // This should be before <title> since it defines the charset used by
         // text including the text inside <title>.
         // The spec recommends defining XHTML5's charset using the XML declaration
         // instead of meta.
         // Our XML declaration is output by Html::htmlHeader.
         // http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#attr-meta-http-equiv-content-type
         // http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#charset
         $ret .= Html::element('meta', array('charset' => 'UTF-8'));
     }
     $ret .= Html::element('title', null, $this->getHTMLTitle()) . "\n";
     $ret .= implode("\n", array($this->getHeadLinks(), $this->buildCssLinks(), $this->getHeadScripts(), $this->getHeadItems()));
     $closeHead = Html::closeElement('head');
     if ($closeHead) {
         $ret .= "{$closeHead}\n";
     }
     $bodyClasses = array();
     $bodyClasses[] = 'mediawiki';
     # Classes for LTR/RTL directionality support
     $bodyClasses[] = $userdir;
     $bodyClasses[] = "sitedir-{$sitedir}";
     if ($this->getLanguage()->capitalizeAllNouns()) {
         # A <body> class is probably not the best way to do this . . .
         $bodyClasses[] = 'capitalize-all-nouns';
     }
     $bodyClasses[] = $sk->getPageClasses($this->getTitle());
     $bodyClasses[] = 'skin-' . Sanitizer::escapeClass($sk->getSkinName());
     $bodyClasses[] = 'action-' . Sanitizer::escapeClass(Action::getActionName($this->getContext()));
     $bodyAttrs = array();
     // While the implode() is not strictly needed, it's used for backwards compatibility
     // (this used to be built as a string and hooks likely still expect that).
     $bodyAttrs['class'] = implode(' ', $bodyClasses);
     // Allow skins and extensions to add body attributes they need
     $sk->addToBodyAttributes($this, $bodyAttrs);
     wfRunHooks('OutputPageBodyAttributes', array($this, $sk, &$bodyAttrs));
     $ret .= Html::openElement('body', $bodyAttrs) . "\n";
     return $ret;
 }
Exemplo n.º 4
0
 /**
  * @param $sk Skin The given Skin
  * @param $includeStyle Boolean: unused
  * @return String: The doctype, opening <html>, and head element.
  */
 public function headElement(Skin $sk, $includeStyle = true)
 {
     global $wgContLang;
     # start wikia change
     global $wgDevelEnvironment;
     if ($wgDevelEnvironment) {
         $this->addMeta('robots', 'noindex, nofollow');
     }
     # end wikia change
     $userdir = $this->getLanguage()->getDir();
     $sitedir = $wgContLang->getDir();
     if ($sk->commonPrintStylesheet()) {
         $this->addModuleStyles('mediawiki.legacy.wikiprintable');
     }
     $ret = Html::htmlHeader(array('lang' => $this->getLanguage()->getHtmlCode(), 'dir' => $userdir, 'class' => 'client-nojs'));
     if ($this->getHTMLTitle() == '') {
         # start wikia change
         wfProfileIn("parsePageTitle");
         $this->setHTMLTitle($this->getWikiaPageTitle($this->getPageTitle()));
         wfProfileOut("parsePageTitle");
         # end wikia change
         # $this->setHTMLTitle( $this->msg( 'pagetitle', $this->getPageTitle() ) );
     }
     $openHead = Html::openElement('head');
     if ($openHead) {
         # Don't bother with the newline if $head == ''
         $ret .= "{$openHead}\n";
     }
     $ret .= Html::element('title', null, $this->getHTMLTitle()) . "\n";
     $ret .= implode("\n", array($this->getHeadLinks(null, true), $this->buildCssLinks(), $this->getHeadScripts(), $this->getHeadItems()));
     $closeHead = Html::closeElement('head');
     if ($closeHead) {
         $ret .= "{$closeHead}\n";
     }
     $bodyAttrs = array();
     # Classes for LTR/RTL directionality support
     $bodyAttrs['class'] = "mediawiki {$userdir} sitedir-{$sitedir}";
     if ($this->getLanguage()->capitalizeAllNouns()) {
         # A <body> class is probably not the best way to do this . . .
         $bodyAttrs['class'] .= ' capitalize-all-nouns';
     }
     $bodyAttrs['class'] .= ' ' . $sk->getPageClasses($this->getTitle());
     $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass($sk->getSkinName());
     $bodyAttrs['class'] .= ' action-' . Sanitizer::escapeClass(Action::getActionName($this->getContext()));
     $sk->addToBodyAttributes($this, $bodyAttrs);
     // Allow skins to add body attributes they need
     wfRunHooks('OutputPageBodyAttributes', array($this, $sk, &$bodyAttrs));
     $ret .= Html::openElement('body', $bodyAttrs) . "\n";
     return $ret;
 }
Exemplo n.º 5
0
 /**
  * @param $sk Skin The given Skin
  * @param $includeStyle Boolean: unused
  * @return String: The doctype, opening <html>, and head element.
  */
 public function headElement(Skin $sk, $includeStyle = true)
 {
     global $wgOutputEncoding, $wgMimeType;
     global $wgUseTrackbacks, $wgHtml5;
     global $wgUser, $wgRequest, $wgLang;
     if ($sk->commonPrintStylesheet()) {
         $this->addModuleStyles('mediawiki.legacy.wikiprintable');
     }
     $sk->setupUserCss($this);
     $lang = wfUILang();
     $ret = Html::htmlHeader(array('lang' => $lang->getCode(), 'dir' => $lang->getDir()));
     if ($this->getHTMLTitle() == '') {
         $this->setHTMLTitle(wfMsg('pagetitle', $this->getPageTitle()));
     }
     $openHead = Html::openElement('head');
     if ($openHead) {
         # Don't bother with the newline if $head == ''
         $ret .= "{$openHead}\n";
     }
     if ($wgHtml5) {
         # More succinct than <meta http-equiv=Content-Type>, has the
         # same effect
         $ret .= Html::element('meta', array('charset' => $wgOutputEncoding)) . "\n";
     } else {
         $this->addMeta('http:Content-Type', "{$wgMimeType}; charset={$wgOutputEncoding}");
     }
     $ret .= Html::element('title', null, $this->getHTMLTitle()) . "\n";
     $ret .= implode("\n", array($this->getHeadLinks($sk), $this->buildCssLinks($sk), $this->getHeadItems()));
     if ($wgUseTrackbacks && $this->isArticleRelated()) {
         $ret .= $this->getTitle()->trackbackRDF();
     }
     $closeHead = Html::closeElement('head');
     if ($closeHead) {
         $ret .= "{$closeHead}\n";
     }
     $bodyAttrs = array();
     # Crazy edit-on-double-click stuff
     $action = $wgRequest->getVal('action', 'view');
     if ($this->getTitle()->getNamespace() != NS_SPECIAL && !in_array($action, array('edit', 'submit')) && $wgUser->getOption('editondblclick')) {
         $editUrl = $this->getTitle()->getLocalUrl($sk->editUrlOptions());
         $bodyAttrs['ondblclick'] = "document.location = '" . Xml::escapeJsString($editUrl) . "'";
     }
     # Class bloat
     $dir = wfUILang()->getDir();
     $bodyAttrs['class'] = "mediawiki {$dir}";
     if ($wgLang->capitalizeAllNouns()) {
         # A <body> class is probably not the best way to do this . . .
         $bodyAttrs['class'] .= ' capitalize-all-nouns';
     }
     $bodyAttrs['class'] .= ' ns-' . $this->getTitle()->getNamespace();
     if ($this->getTitle()->getNamespace() == NS_SPECIAL) {
         $bodyAttrs['class'] .= ' ns-special';
     } elseif ($this->getTitle()->isTalkPage()) {
         $bodyAttrs['class'] .= ' ns-talk';
     } else {
         $bodyAttrs['class'] .= ' ns-subject';
     }
     $bodyAttrs['class'] .= ' ' . Sanitizer::escapeClass('page-' . $this->getTitle()->getPrefixedText());
     $bodyAttrs['class'] .= ' skin-' . Sanitizer::escapeClass($wgUser->getSkin()->getSkinName());
     $sk->addToBodyAttributes($this, $bodyAttrs);
     // Allow skins to add body attributes they need
     wfRunHooks('OutputPageBodyAttributes', array($this, $sk, &$bodyAttrs));
     $ret .= Html::openElement('body', $bodyAttrs) . "\n";
     return $ret;
 }