r85203 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85202‎ | r85203 | r85204 >
Date:18:38, 2 April 2011
Author:ialex
Status:ok (Comments)
Tags:
Comment:
* Moved all <link> definitions in OutputPage::getHeadLinks() instead of having them in a *lot* of different functions
* Also moved there generic <meta> and removed OutputPage::addDefaultMeta() with its $called static local variable which was breaking the output when generating multiple pages on the same request (rebuildFileCache.php, dumpHTML.php) since that function could only be executed completely once for all instances, and not once per instance
* Moved default module from OutputPage::output() to its own function and don't call it when executing a body only request, since it's useless in that case
* Call Skin::setMembers() from Skin::initPage() instead of Skin::outputPage()
Modified paths:
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/includes/Skin.php (modified) (history)
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/OutputPage.php
@@ -286,11 +286,24 @@
287287 * "rel" attribute will be automatically added
288288 */
289289 function addMetadataLink( $linkarr ) {
 290+ $linkarr['rel'] = $this->getMetadataAttribute();
 291+ $this->addLink( $linkarr );
 292+ }
 293+
 294+ /**
 295+ * Get the value of the "rel" attribute for metadata links
 296+ *
 297+ * @return String
 298+ */
 299+ private function getMetadataAttribute() {
290300 # note: buggy CC software only reads first "meta" link
291301 static $haveMeta = false;
292 - $linkarr['rel'] = $haveMeta ? 'alternate meta' : 'meta';
293 - $this->addLink( $linkarr );
294 - $haveMeta = true;
 302+ if ( $haveMeta ) {
 303+ return 'alternate meta';
 304+ } else {
 305+ $haveMeta = true;
 306+ return 'meta';
 307+ }
295308 }
296309
297310 /**
@@ -1757,105 +1770,62 @@
17581771 public function output() {
17591772 global $wgUser, $wgOutputEncoding, $wgRequest;
17601773 global $wgLanguageCode, $wgDebugRedirects, $wgMimeType;
1761 - global $wgUseAjax, $wgAjaxWatch;
1762 - global $wgEnableMWSuggest, $wgUniversalEditButton;
17631774
17641775 if( $this->mDoNothing ) {
17651776 return;
17661777 }
 1778+
17671779 wfProfileIn( __METHOD__ );
 1780+
 1781+ $response = $wgRequest->response();
 1782+
17681783 if ( $this->mRedirect != '' ) {
17691784 # Standards require redirect URLs to be absolute
17701785 $this->mRedirect = wfExpandUrl( $this->mRedirect );
17711786 if( $this->mRedirectCode == '301' || $this->mRedirectCode == '303' ) {
17721787 if( !$wgDebugRedirects ) {
17731788 $message = self::getStatusMessage( $this->mRedirectCode );
1774 - $wgRequest->response()->header( "HTTP/1.1 {$this->mRedirectCode} $message" );
 1789+ $response->header( "HTTP/1.1 {$this->mRedirectCode} $message" );
17751790 }
17761791 $this->mLastModified = wfTimestamp( TS_RFC2822 );
17771792 }
17781793 $this->sendCacheControl();
17791794
1780 - $wgRequest->response()->header( "Content-Type: text/html; charset=utf-8" );
 1795+ $response->header( "Content-Type: text/html; charset=utf-8" );
17811796 if( $wgDebugRedirects ) {
17821797 $url = htmlspecialchars( $this->mRedirect );
17831798 print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n";
17841799 print "<p>Location: <a href=\"$url\">$url</a></p>\n";
17851800 print "</body>\n</html>\n";
17861801 } else {
1787 - $wgRequest->response()->header( 'Location: ' . $this->mRedirect );
 1802+ $response->header( 'Location: ' . $this->mRedirect );
17881803 }
17891804 wfProfileOut( __METHOD__ );
17901805 return;
17911806 } elseif ( $this->mStatusCode ) {
17921807 $message = self::getStatusMessage( $this->mStatusCode );
17931808 if ( $message ) {
1794 - $wgRequest->response()->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
 1809+ $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message );
17951810 }
17961811 }
17971812
1798 - // Add base resources
1799 - $this->addModules( 'mediawiki.util' );
1800 - global $wgIncludeLegacyJavaScript;
1801 - if( $wgIncludeLegacyJavaScript ){
1802 - $this->addModules( 'mediawiki.legacy.wikibits' );
1803 - }
1804 -
1805 - // Add various resources if required
1806 - if ( $wgUseAjax ) {
1807 - $this->addModules( 'mediawiki.legacy.ajax' );
1808 -
1809 - wfRunHooks( 'AjaxAddScript', array( &$this ) );
1810 -
1811 - if( $wgAjaxWatch && $wgUser->isLoggedIn() ) {
1812 - $this->addModules( 'mediawiki.action.watch.ajax' );
1813 - }
1814 -
1815 - if ( $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {
1816 - $this->addModules( 'mediawiki.legacy.mwsuggest' );
1817 - }
1818 - }
1819 -
1820 - if( $wgUser->getBoolOption( 'editsectiononrightclick' ) ) {
1821 - $this->addModules( 'mediawiki.action.view.rightClickEdit' );
1822 - }
1823 -
1824 - if( $wgUniversalEditButton ) {
1825 - if( $this->isArticleRelated() && $this->getTitle() && $this->getTitle()->quickUserCan( 'edit' )
1826 - && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create' ) ) ) {
1827 - // Original UniversalEditButton
1828 - $msg = wfMsg( 'edit' );
1829 - $this->addLink( array(
1830 - 'rel' => 'alternate',
1831 - 'type' => 'application/x-wiki',
1832 - 'title' => $msg,
1833 - 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
1834 - ) );
1835 - // Alternate edit link
1836 - $this->addLink( array(
1837 - 'rel' => 'edit',
1838 - 'title' => $msg,
1839 - 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
1840 - ) );
1841 - }
1842 - }
1843 -
1844 -
18451813 # Buffer output; final headers may depend on later processing
18461814 ob_start();
18471815
1848 - $wgRequest->response()->header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" );
1849 - $wgRequest->response()->header( 'Content-language: ' . $wgLanguageCode );
 1816+ $response->header( "Content-type: $wgMimeType; charset={$wgOutputEncoding}" );
 1817+ $response->header( 'Content-language: ' . $wgLanguageCode );
18501818
18511819 // Prevent framing, if requested
18521820 $frameOptions = $this->getFrameOptions();
18531821 if ( $frameOptions ) {
1854 - $wgRequest->response()->header( "X-Frame-Options: $frameOptions" );
 1822+ $response->header( "X-Frame-Options: $frameOptions" );
18551823 }
18561824
18571825 if ( $this->mArticleBodyOnly ) {
18581826 $this->out( $this->mBodytext );
18591827 } else {
 1828+ $this->addDefaultModules();
 1829+
18601830 $sk = $wgUser->getSkin( $this->getTitle() );
18611831
18621832 // Hook that allows last minute changes to the output page, e.g.
@@ -2315,18 +2285,10 @@
23162286 $ret .= "$openHead\n";
23172287 }
23182288
2319 - if ( $wgHtml5 ) {
2320 - # More succinct than <meta http-equiv=Content-Type>, has the
2321 - # same effect
2322 - $ret .= Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) ) . "\n";
2323 - } else {
2324 - $this->addMeta( 'http:Content-Type', "$wgMimeType; charset=$wgOutputEncoding" );
2325 - }
2326 -
23272289 $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n";
23282290
23292291 $ret .= implode( "\n", array(
2330 - $this->getHeadLinks( $sk ),
 2292+ $this->getHeadLinks( $sk, true ),
23312293 $this->buildCssLinks( $sk ),
23322294 $this->getHeadItems()
23332295 ) );
@@ -2374,6 +2336,39 @@
23752337 }
23762338
23772339 /**
 2340+ * Add the default ResourceLoader modules to this object
 2341+ */
 2342+ private function addDefaultModules() {
 2343+ global $wgUser, $wgIncludeLegacyJavaScript,
 2344+ $wgUseAjax, $wgAjaxWatch, $wgEnableMWSuggest;
 2345+
 2346+ // Add base resources
 2347+ $this->addModules( 'mediawiki.util' );
 2348+ if( $wgIncludeLegacyJavaScript ){
 2349+ $this->addModules( 'mediawiki.legacy.wikibits' );
 2350+ }
 2351+
 2352+ // Add various resources if required
 2353+ if ( $wgUseAjax ) {
 2354+ $this->addModules( 'mediawiki.legacy.ajax' );
 2355+
 2356+ wfRunHooks( 'AjaxAddScript', array( &$this ) );
 2357+
 2358+ if( $wgAjaxWatch && $wgUser->isLoggedIn() ) {
 2359+ $this->addModules( 'mediawiki.action.watch.ajax' );
 2360+ }
 2361+
 2362+ if ( $wgEnableMWSuggest && !$wgUser->getOption( 'disablesuggest', false ) ) {
 2363+ $this->addModules( 'mediawiki.legacy.mwsuggest' );
 2364+ }
 2365+ }
 2366+
 2367+ if( $wgUser->getBoolOption( 'editsectiononrightclick' ) ) {
 2368+ $this->addModules( 'mediawiki.action.view.rightClickEdit' );
 2369+ }
 2370+ }
 2371+
 2372+ /**
23782373 * Get a ResourceLoader object associated with this OutputPage
23792374 *
23802375 * @return ResourceLoader
@@ -2651,28 +2646,48 @@
26522647 }
26532648
26542649 /**
2655 - * Add default \<meta\> tags
 2650+ * @return string HTML tag links to be put in the header.
26562651 */
2657 - protected function addDefaultMeta() {
2658 - global $wgVersion, $wgHtml5;
 2652+ public function getHeadLinks( Skin $sk, $addContentType = false ) {
 2653+ global $wgUniversalEditButton, $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI,
 2654+ $wgSitename, $wgVersion, $wgHtml5, $wgMimeType, $wgOutputEncoding,
 2655+ $wgFeed, $wgOverrideSiteFeed, $wgAdvertisedFeedTypes,
 2656+ $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf,
 2657+ $wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang,
 2658+ $wgRightsPage, $wgRightsUrl;
26592659
2660 - static $called = false;
2661 - if ( $called ) {
2662 - # Don't run this twice
2663 - return;
2664 - }
2665 - $called = true;
 2660+ $tags = array();
26662661
2667 - if ( !$wgHtml5 ) {
2668 - $this->addMeta( 'http:Content-Style-Type', 'text/css' ); // bug 15835
 2662+ if ( $addContentType ) {
 2663+ if ( $wgHtml5 ) {
 2664+ # More succinct than <meta http-equiv=Content-Type>, has the
 2665+ # same effect
 2666+ $tags[] = Html::element( 'meta', array( 'charset' => $wgOutputEncoding ) );
 2667+ } else {
 2668+ $tags[] = Html::element( 'meta', array(
 2669+ 'http-equiv' => 'Content-Type',
 2670+ 'content' => "$wgMimeType; charset=$wgOutputEncoding"
 2671+ ) );
 2672+ $tags[] = Html::element( 'meta', array( // bug 15835
 2673+ 'http-equiv' => 'Content-Style-Type',
 2674+ 'content' => 'text/css'
 2675+ ) );
 2676+ }
26692677 }
2670 - $this->addMeta( 'generator', "MediaWiki $wgVersion" );
26712678
 2679+ $tags[] = Html::element( 'meta', array(
 2680+ 'name' => 'generator',
 2681+ 'content' => "MediaWiki $wgVersion",
 2682+ ) );
 2683+
26722684 $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}";
26732685 if( $p !== 'index,follow' ) {
26742686 // http://www.robotstxt.org/wc/meta-user.html
26752687 // Only show if it's different from the default robots policy
2676 - $this->addMeta( 'robots', $p );
 2688+ $tags[] = Html::element( 'meta', array(
 2689+ 'name' => 'robots',
 2690+ 'content' => $p,
 2691+ ) );
26772692 }
26782693
26792694 if ( count( $this->mKeywords ) > 0 ) {
@@ -2680,28 +2695,16 @@
26812696 "/<.*?" . ">/" => '',
26822697 "/_/" => ' '
26832698 );
2684 - $this->addMeta(
2685 - 'keywords',
2686 - preg_replace(
 2699+ $tags[] = Html::element( 'meta', array(
 2700+ 'name' => 'keywords',
 2701+ 'content' => preg_replace(
26872702 array_keys( $strip ),
26882703 array_values( $strip ),
26892704 implode( ',', $this->mKeywords )
26902705 )
2691 - );
 2706+ ) );
26922707 }
2693 - }
26942708
2695 - /**
2696 - * @return string HTML tag links to be put in the header.
2697 - */
2698 - public function getHeadLinks( Skin $sk ) {
2699 - global $wgFeed;
2700 -
2701 - // Ideally this should happen earlier, somewhere. :P
2702 - $this->addDefaultMeta();
2703 -
2704 - $tags = array();
2705 -
27062709 foreach ( $this->mMetatags as $tag ) {
27072710 if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) {
27082711 $a = 'http-equiv';
@@ -2716,11 +2719,137 @@
27172720 )
27182721 );
27192722 }
 2723+
27202724 foreach ( $this->mLinktags as $tag ) {
27212725 $tags[] = Html::element( 'link', $tag );
27222726 }
27232727
2724 - if( $wgFeed ) {
 2728+ # Universal edit button
 2729+ if ( $wgUniversalEditButton ) {
 2730+ if ( $this->isArticleRelated() && $this->getTitle() && $this->getTitle()->quickUserCan( 'edit' )
 2731+ && ( $this->getTitle()->exists() || $this->getTitle()->quickUserCan( 'create' ) ) ) {
 2732+ // Original UniversalEditButton
 2733+ $msg = wfMsg( 'edit' );
 2734+ $tags[] = Html::element( 'link', array(
 2735+ 'rel' => 'alternate',
 2736+ 'type' => 'application/x-wiki',
 2737+ 'title' => $msg,
 2738+ 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
 2739+ ) );
 2740+ // Alternate edit link
 2741+ $tags[] = Html::element( 'link', array(
 2742+ 'rel' => 'edit',
 2743+ 'title' => $msg,
 2744+ 'href' => $this->getTitle()->getLocalURL( 'action=edit' )
 2745+ ) );
 2746+ }
 2747+ }
 2748+
 2749+ # Generally the order of the favicon and apple-touch-icon links
 2750+ # should not matter, but Konqueror (3.5.9 at least) incorrectly
 2751+ # uses whichever one appears later in the HTML source. Make sure
 2752+ # apple-touch-icon is specified first to avoid this.
 2753+ if ( $wgAppleTouchIcon !== false ) {
 2754+ $tags[] = Html::element( 'link', array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
 2755+ }
 2756+
 2757+ if ( $wgFavicon !== false ) {
 2758+ $tags[] = Html::element( 'link', array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
 2759+ }
 2760+
 2761+ # OpenSearch description link
 2762+ $tags[] = Html::element( 'link', array(
 2763+ 'rel' => 'search',
 2764+ 'type' => 'application/opensearchdescription+xml',
 2765+ 'href' => wfScript( 'opensearch_desc' ),
 2766+ 'title' => wfMsgForContent( 'opensearch-desc' ),
 2767+ ) );
 2768+
 2769+ if ( $wgEnableAPI ) {
 2770+ # Real Simple Discovery link, provides auto-discovery information
 2771+ # for the MediaWiki API (and potentially additional custom API
 2772+ # support such as WordPress or Twitter-compatible APIs for a
 2773+ # blogging extension, etc)
 2774+ $tags[] = Html::element( 'link', array(
 2775+ 'rel' => 'EditURI',
 2776+ 'type' => 'application/rsd+xml',
 2777+ 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ) ),
 2778+ ) );
 2779+ }
 2780+
 2781+ # Metadata links
 2782+ # - Creative Commons
 2783+ # See http://wiki.creativecommons.org/Extend_Metadata.
 2784+ # - Dublin Core
 2785+ # Use hreflang to specify canonical and alternate links
 2786+ # See http://www.google.com/support/webmasters/bin/answer.py?answer=189077
 2787+ if ( $this->isArticleRelated() ) {
 2788+ # note: buggy CC software only reads first "meta" link
 2789+ if ( $wgEnableCreativeCommonsRdf ) {
 2790+ $tags[] = Html::element( 'link', array(
 2791+ 'rel' => $this->getMetadataAttribute(),
 2792+ 'title' => 'Creative Commons',
 2793+ 'type' => 'application/rdf+xml',
 2794+ 'href' => $this->getTitle()->getLocalURL( 'action=creativecommons' ) )
 2795+ );
 2796+ }
 2797+
 2798+ if ( $wgEnableDublinCoreRdf ) {
 2799+ $tags[] = Html::element( 'link', array(
 2800+ 'rel' => $this->getMetadataAttribute(),
 2801+ 'title' => 'Dublin Core',
 2802+ 'type' => 'application/rdf+xml',
 2803+ 'href' => $this->getTitle()->getLocalURL( 'action=dublincore' ) )
 2804+ );
 2805+ }
 2806+ }
 2807+
 2808+ # Language variants
 2809+ if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks
 2810+ && $wgContLang->hasVariants() ) {
 2811+
 2812+ $urlvar = $wgContLang->getURLVariant();
 2813+
 2814+ if ( !$urlvar ) {
 2815+ $variants = $wgContLang->getVariants();
 2816+ foreach ( $variants as $_v ) {
 2817+ $tags[] = Html::element( 'link', array(
 2818+ 'rel' => 'alternate',
 2819+ 'hreflang' => $_v,
 2820+ 'href' => $this->getTitle()->getLocalURL( '', $_v ) )
 2821+ );
 2822+ }
 2823+ } else {
 2824+ $tags[] = Html::element( 'link', array(
 2825+ 'rel' => 'canonical',
 2826+ 'href' => $this->getTitle()->getFullURL() )
 2827+ );
 2828+ }
 2829+ }
 2830+
 2831+ # Copyright
 2832+ $copyright = '';
 2833+ if ( $wgRightsPage ) {
 2834+ $copy = Title::newFromText( $wgRightsPage );
 2835+
 2836+ if ( $copy ) {
 2837+ $copyright = $copy->getLocalURL();
 2838+ }
 2839+ }
 2840+
 2841+ if ( !$copyright && $wgRightsUrl ) {
 2842+ $copyright = $wgRightsUrl;
 2843+ }
 2844+
 2845+ if ( $copyright ) {
 2846+ $tags[] = Html::element( 'link', array(
 2847+ 'rel' => 'copyright',
 2848+ 'href' => $copyright )
 2849+ );
 2850+ }
 2851+
 2852+ # Feeds
 2853+ if ( $wgFeed ) {
27252854 foreach( $this->getSyndicationLinks() as $format => $link ) {
27262855 # Use the page name for the title (accessed through $wgTitle since
27272856 # there's no other way). In principle, this could lead to issues
@@ -2743,7 +2872,6 @@
27442873 # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined.
27452874 # If so, use it instead.
27462875
2747 - global $wgOverrideSiteFeed, $wgSitename, $wgAdvertisedFeedTypes;
27482876 $rctitle = SpecialPage::getTitleFor( 'Recentchanges' );
27492877
27502878 if ( $wgOverrideSiteFeed ) {
Index: trunk/phase3/includes/SkinTemplate.php
@@ -154,7 +154,6 @@
155155 wfProfileIn( __METHOD__ . '-init' );
156156 $this->initPage( $out );
157157
158 - $this->setMembers();
159158 $tpl = $this->setupTemplate( $this->template, 'skins' );
160159 wfProfileOut( __METHOD__ . '-init' );
161160
Index: trunk/phase3/includes/Skin.php
@@ -183,47 +183,11 @@
184184 }
185185
186186 function initPage( OutputPage $out ) {
187 - global $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI;
188 -
189187 wfProfileIn( __METHOD__ );
190188
191 - # Generally the order of the favicon and apple-touch-icon links
192 - # should not matter, but Konqueror (3.5.9 at least) incorrectly
193 - # uses whichever one appears later in the HTML source. Make sure
194 - # apple-touch-icon is specified first to avoid this.
195 - if ( false !== $wgAppleTouchIcon ) {
196 - $out->addLink( array( 'rel' => 'apple-touch-icon', 'href' => $wgAppleTouchIcon ) );
197 - }
198 -
199 - if ( false !== $wgFavicon ) {
200 - $out->addLink( array( 'rel' => 'shortcut icon', 'href' => $wgFavicon ) );
201 - }
202 -
203 - # OpenSearch description link
204 - $out->addLink( array(
205 - 'rel' => 'search',
206 - 'type' => 'application/opensearchdescription+xml',
207 - 'href' => wfScript( 'opensearch_desc' ),
208 - 'title' => wfMsgForContent( 'opensearch-desc' ),
209 - ) );
210 -
211 - if ( $wgEnableAPI ) {
212 - # Real Simple Discovery link, provides auto-discovery information
213 - # for the MediaWiki API (and potentially additional custom API
214 - # support such as WordPress or Twitter-compatible APIs for a
215 - # blogging extension, etc)
216 - $out->addLink( array(
217 - 'rel' => 'EditURI',
218 - 'type' => 'application/rsd+xml',
219 - 'href' => wfExpandUrl( wfAppendQuery( wfScript( 'api' ), array( 'action' => 'rsd' ) ) ),
220 - ) );
221 - }
222 -
223 - $this->addMetadataLinks( $out );
224 -
225189 $this->mRevisionId = $out->mRevisionId;
226 -
227190 $this->preloadExistence();
 191+ $this->setMembers();
228192
229193 wfProfileOut( __METHOD__ );
230194 }
@@ -252,88 +216,6 @@
253217 }
254218
255219 /**
256 - * Adds metadata links below to the HTML output.
257 - * <ol>
258 - * <li>Creative Commons
259 - * <br />See http://wiki.creativecommons.org/Extend_Metadata.
260 - * </li>
261 - * <li>Dublin Core</li>
262 - * <li>Use hreflang to specify canonical and alternate links
263 - * <br />See http://www.google.com/support/webmasters/bin/answer.py?answer=189077
264 - * </li>
265 - * <li>Copyright</li>
266 - * <ol>
267 - *
268 - * @param $out Object: instance of OutputPage
269 - */
270 - function addMetadataLinks( OutputPage $out ) {
271 - global $wgEnableDublinCoreRdf, $wgEnableCreativeCommonsRdf;
272 - global $wgDisableLangConversion, $wgCanonicalLanguageLinks, $wgContLang;
273 - global $wgRightsPage, $wgRightsUrl;
274 -
275 - if ( $out->isArticleRelated() ) {
276 - # note: buggy CC software only reads first "meta" link
277 - if ( $wgEnableCreativeCommonsRdf ) {
278 - $out->addMetadataLink( array(
279 - 'title' => 'Creative Commons',
280 - 'type' => 'application/rdf+xml',
281 - 'href' => $this->mTitle->getLocalURL( 'action=creativecommons' ) )
282 - );
283 - }
284 -
285 - if ( $wgEnableDublinCoreRdf ) {
286 - $out->addMetadataLink( array(
287 - 'title' => 'Dublin Core',
288 - 'type' => 'application/rdf+xml',
289 - 'href' => $this->mTitle->getLocalURL( 'action=dublincore' ) )
290 - );
291 - }
292 - }
293 -
294 - if ( !$wgDisableLangConversion && $wgCanonicalLanguageLinks
295 - && $wgContLang->hasVariants() ) {
296 -
297 - $urlvar = $wgContLang->getURLVariant();
298 -
299 - if ( !$urlvar ) {
300 - $variants = $wgContLang->getVariants();
301 - foreach ( $variants as $_v ) {
302 - $out->addLink( array(
303 - 'rel' => 'alternate',
304 - 'hreflang' => $_v,
305 - 'href' => $this->mTitle->getLocalURL( '', $_v ) )
306 - );
307 - }
308 - } else {
309 - $out->addLink( array(
310 - 'rel' => 'canonical',
311 - 'href' => $this->mTitle->getFullURL() )
312 - );
313 - }
314 - }
315 -
316 - $copyright = '';
317 - if ( $wgRightsPage ) {
318 - $copy = Title::newFromText( $wgRightsPage );
319 -
320 - if ( $copy ) {
321 - $copyright = $copy->getLocalURL();
322 - }
323 - }
324 -
325 - if ( !$copyright && $wgRightsUrl ) {
326 - $copyright = $wgRightsUrl;
327 - }
328 -
329 - if ( $copyright ) {
330 - $out->addLink( array(
331 - 'rel' => 'copyright',
332 - 'href' => $copyright )
333 - );
334 - }
335 - }
336 -
337 - /**
338220 * Set some local variables
339221 */
340222 protected function setMembers() {
@@ -437,7 +319,6 @@
438320 global $wgDebugComments;
439321 wfProfileIn( __METHOD__ );
440322
441 - $this->setMembers();
442323 $this->initPage( $out );
443324
444325 // See self::afterContentHook() for documentation

Sign-offs

UserFlagDate
Aaron Schulzinspected20:15, 30 June 2011
Hasharinspected20:16, 4 July 2011
Werdnainspected17:49, 15 July 2011

Comments

#Comment by Catrope (talk | contribs)   10:07, 11 August 2011

Inspected by me and three other core coders, and has been in trunk for 5 months without breaking anything. Marking OK.

Status & tagging log