static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     $languageLinks = $out->getLanguageLinks();
     if (empty($languageLinks)) {
         return true;
     }
     // this is partly a ripoff from SkinTemplate::getLanguages()
     foreach ($languageLinks as $langLink) {
         $languageLinkTitle = Title::newFromText($langLink);
         $interwikiCode = $languageLinkTitle->getInterwiki();
         $out->addLink(array('rel' => 'alternate', 'hreflang' => wfBCP47($interwikiCode), 'href' => wfExpandIRI($languageLinkTitle->getFullURL())));
     }
     // We also must add the current language
     $currentPageLangCode = $out->getLanguage()->getCode();
     $currentPageTitle = $out->getTitle();
     $out->addLink(array('rel' => 'alternate', 'hreflang' => wfBCP47($currentPageLangCode), 'href' => wfExpandIRI($currentPageTitle->getFullURL())));
     return true;
 }
Пример #2
0
 /**
  * @covers ::wfExpandIRI
  */
 public function testExpandIRI()
 {
     $this->assertEquals("https://te.wikibooks.org/wiki/ఉబుంటు_వాడుకరి_మార్గదర్శని", wfExpandIRI("https://te.wikibooks.org/wiki/" . "%E0%B0%89%E0%B0%AC%E0%B1%81%E0%B0%82%E0%B0%9F%E0%B1%81_" . "%E0%B0%B5%E0%B0%BE%E0%B0%A1%E0%B1%81%E0%B0%95%E0%B0%B0%E0%B0%BF_" . "%E0%B0%AE%E0%B0%BE%E0%B0%B0%E0%B1%8D%E0%B0%97%E0%B0%A6%E0%B0%B0" . "%E0%B1%8D%E0%B0%B6%E0%B0%A8%E0%B0%BF"));
 }
Пример #3
0
 /**
  * Text with the permalink to the source page,
  * usually shown on the footer of a printed page
  *
  * @return string HTML text with an URL
  */
 function printSource()
 {
     $oldid = $this->getRevisionId();
     if ($oldid) {
         $url = htmlspecialchars(wfExpandIRI($this->getTitle()->getCanonicalURL('oldid=' . $oldid)));
     } else {
         // oldid not available for non existing pages
         $url = htmlspecialchars(wfExpandIRI($this->getTitle()->getCanonicalURL()));
     }
     return $this->msg('retrievedfrom', '<a href="' . $url . '">' . $url . '</a>')->text();
 }
Пример #4
0
 /**
  * Text with the permalink to the source page,
  * usually shown on the footer of a printed page
  *
  * @return string HTML text with an URL
  */
 function printSource()
 {
     $oldid = $this->getRevisionId();
     if ($oldid) {
         $canonicalUrl = $this->getTitle()->getCanonicalURL('oldid=' . $oldid);
         $url = htmlspecialchars(wfExpandIRI($canonicalUrl));
     } else {
         // oldid not available for non existing pages
         $url = htmlspecialchars(wfExpandIRI($this->getTitle()->getCanonicalURL()));
     }
     return $this->msg('retrievedfrom')->rawParams('<a dir="ltr" href="' . $url . '">' . $url . '</a>')->parse();
 }