+ # Universal edit button
+ if ( $wgUniversalEditButton && $this->isArticleRelated() ) {
+ $user = $this->getUser();
+ if ( $this->getTitle()->quickUserCan( 'edit', $user )
+ && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create', $user ) ) ) {
+ // Original UniversalEditButton
+ $msg = $this->msg( 'edit' )->text();
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'alternate',
+ 'type' => 'application/x-wiki',
+ 'title' => $msg,
+ 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
+ ) );
+ // Alternate edit link
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'edit',
+ 'title' => $msg,
+ 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
+ ) );
+ }
+ }
+
+ # Generally the order of the favicon and apple-touch-icon links
+ # should not matter, but Konqueror (3.5.9 at least) incorrectly
+ # uses whichever one appears later in the HTML source. Make sure
+ # apple-touch-icon is specified first to avoid this.
+ if ( $wgAppleTouchIcon !== false ) {
+ $tags[] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
+ }
+
+ if ( $wgFavicon !== false ) {
+ $tags[] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
+ }
+
+ # OpenSearch description link
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'search',
+ 'type' => 'application/opensearchdescription+xml',
+ 'href' => wfScript( 'opensearch_desc' ),
+ 'title' => $this->msg( 'opensearch-desc' )->inContentLanguage()->text(),
+ ) );
+
+ if ( $wgEnableAPI ) {
+ # Real Simple Discovery link, provides auto-discovery information
+ # for the MediaWiki API (and potentially additional custom API
+ # support such as WordPress or Twitter-compatible APIs for a
+ # blogging extension, etc)
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'EditURI',
+ 'type' => 'application/rsd+xml',
+ // Output a protocol-relative URL here if $wgServer is protocol-relative
+ // Whether RSD accepts relative or protocol-relative URLs is completely undocumented, though
+ 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ), PROTO_RELATIVE ),
+ ) );
+ }
+
+
+ # Language variants
+ if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks ) {
+ $lang = $this->getTitle()->getPageLanguage();
+ if ( $lang->hasVariants() ) {
+
+ $urlvar = $lang->getURLVariant();
+
+ if ( !$urlvar ) {
+ $variants = $lang->getVariants();
+ foreach ( $variants as $_v ) {
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'alternate',
+ 'hreflang' => $_v,
+ 'href' => $this->getTitle()->getLocalURL( '', $_v ) )
+ );
+ }
+ } else {
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'canonical',
+ 'href' => $this->getTitle()->getCanonicalUrl()
+ ) );
+ }
+ }
+ }
+
+ # Copyright
+ $copyright = '';
+ if ( $wgRightsPage ) {
+ $copy = Title::newFromText( $wgRightsPage );
+
+ if ( $copy ) {
+ $copyright = $copy->getLocalURL();
+ }
+ }
+
+ if ( !$copyright && $wgRightsUrl ) {
+ $copyright = $wgRightsUrl;
+ }
+
+ if ( $copyright ) {
+ $tags[] = Html::element( 'link', array(
+ 'rel' => 'copyright',
+ 'href' => $copyright )
+ );
+ }
+
+ # Feeds
+ if ( $wgFeed ) {