Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -286,11 +286,24 @@ |
287 | 287 | * "rel" attribute will be automatically added |
288 | 288 | */ |
289 | 289 | 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() { |
290 | 300 | # note: buggy CC software only reads first "meta" link |
291 | 301 | 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 | + } |
295 | 308 | } |
296 | 309 | |
297 | 310 | /** |
— | — | @@ -1757,105 +1770,62 @@ |
1758 | 1771 | public function output() { |
1759 | 1772 | global $wgUser, $wgOutputEncoding, $wgRequest; |
1760 | 1773 | global $wgLanguageCode, $wgDebugRedirects, $wgMimeType; |
1761 | | - global $wgUseAjax, $wgAjaxWatch; |
1762 | | - global $wgEnableMWSuggest, $wgUniversalEditButton; |
1763 | 1774 | |
1764 | 1775 | if( $this->mDoNothing ) { |
1765 | 1776 | return; |
1766 | 1777 | } |
| 1778 | + |
1767 | 1779 | wfProfileIn( __METHOD__ ); |
| 1780 | + |
| 1781 | + $response = $wgRequest->response(); |
| 1782 | + |
1768 | 1783 | if ( $this->mRedirect != '' ) { |
1769 | 1784 | # Standards require redirect URLs to be absolute |
1770 | 1785 | $this->mRedirect = wfExpandUrl( $this->mRedirect ); |
1771 | 1786 | if( $this->mRedirectCode == '301' || $this->mRedirectCode == '303' ) { |
1772 | 1787 | if( !$wgDebugRedirects ) { |
1773 | 1788 | $message = self::getStatusMessage( $this->mRedirectCode ); |
1774 | | - $wgRequest->response()->header( "HTTP/1.1 {$this->mRedirectCode} $message" ); |
| 1789 | + $response->header( "HTTP/1.1 {$this->mRedirectCode} $message" ); |
1775 | 1790 | } |
1776 | 1791 | $this->mLastModified = wfTimestamp( TS_RFC2822 ); |
1777 | 1792 | } |
1778 | 1793 | $this->sendCacheControl(); |
1779 | 1794 | |
1780 | | - $wgRequest->response()->header( "Content-Type: text/html; charset=utf-8" ); |
| 1795 | + $response->header( "Content-Type: text/html; charset=utf-8" ); |
1781 | 1796 | if( $wgDebugRedirects ) { |
1782 | 1797 | $url = htmlspecialchars( $this->mRedirect ); |
1783 | 1798 | print "<html>\n<head>\n<title>Redirect</title>\n</head>\n<body>\n"; |
1784 | 1799 | print "<p>Location: <a href=\"$url\">$url</a></p>\n"; |
1785 | 1800 | print "</body>\n</html>\n"; |
1786 | 1801 | } else { |
1787 | | - $wgRequest->response()->header( 'Location: ' . $this->mRedirect ); |
| 1802 | + $response->header( 'Location: ' . $this->mRedirect ); |
1788 | 1803 | } |
1789 | 1804 | wfProfileOut( __METHOD__ ); |
1790 | 1805 | return; |
1791 | 1806 | } elseif ( $this->mStatusCode ) { |
1792 | 1807 | $message = self::getStatusMessage( $this->mStatusCode ); |
1793 | 1808 | if ( $message ) { |
1794 | | - $wgRequest->response()->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message ); |
| 1809 | + $response->header( 'HTTP/1.1 ' . $this->mStatusCode . ' ' . $message ); |
1795 | 1810 | } |
1796 | 1811 | } |
1797 | 1812 | |
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 | | - |
1845 | 1813 | # Buffer output; final headers may depend on later processing |
1846 | 1814 | ob_start(); |
1847 | 1815 | |
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 ); |
1850 | 1818 | |
1851 | 1819 | // Prevent framing, if requested |
1852 | 1820 | $frameOptions = $this->getFrameOptions(); |
1853 | 1821 | if ( $frameOptions ) { |
1854 | | - $wgRequest->response()->header( "X-Frame-Options: $frameOptions" ); |
| 1822 | + $response->header( "X-Frame-Options: $frameOptions" ); |
1855 | 1823 | } |
1856 | 1824 | |
1857 | 1825 | if ( $this->mArticleBodyOnly ) { |
1858 | 1826 | $this->out( $this->mBodytext ); |
1859 | 1827 | } else { |
| 1828 | + $this->addDefaultModules(); |
| 1829 | + |
1860 | 1830 | $sk = $wgUser->getSkin( $this->getTitle() ); |
1861 | 1831 | |
1862 | 1832 | // Hook that allows last minute changes to the output page, e.g. |
— | — | @@ -2315,18 +2285,10 @@ |
2316 | 2286 | $ret .= "$openHead\n"; |
2317 | 2287 | } |
2318 | 2288 | |
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 | | - |
2327 | 2289 | $ret .= Html::element( 'title', null, $this->getHTMLTitle() ) . "\n"; |
2328 | 2290 | |
2329 | 2291 | $ret .= implode( "\n", array( |
2330 | | - $this->getHeadLinks( $sk ), |
| 2292 | + $this->getHeadLinks( $sk, true ), |
2331 | 2293 | $this->buildCssLinks( $sk ), |
2332 | 2294 | $this->getHeadItems() |
2333 | 2295 | ) ); |
— | — | @@ -2374,6 +2336,39 @@ |
2375 | 2337 | } |
2376 | 2338 | |
2377 | 2339 | /** |
| 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 | + /** |
2378 | 2373 | * Get a ResourceLoader object associated with this OutputPage |
2379 | 2374 | * |
2380 | 2375 | * @return ResourceLoader |
— | — | @@ -2651,28 +2646,48 @@ |
2652 | 2647 | } |
2653 | 2648 | |
2654 | 2649 | /** |
2655 | | - * Add default \<meta\> tags |
| 2650 | + * @return string HTML tag links to be put in the header. |
2656 | 2651 | */ |
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; |
2659 | 2659 | |
2660 | | - static $called = false; |
2661 | | - if ( $called ) { |
2662 | | - # Don't run this twice |
2663 | | - return; |
2664 | | - } |
2665 | | - $called = true; |
| 2660 | + $tags = array(); |
2666 | 2661 | |
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 | + } |
2669 | 2677 | } |
2670 | | - $this->addMeta( 'generator', "MediaWiki $wgVersion" ); |
2671 | 2678 | |
| 2679 | + $tags[] = Html::element( 'meta', array( |
| 2680 | + 'name' => 'generator', |
| 2681 | + 'content' => "MediaWiki $wgVersion", |
| 2682 | + ) ); |
| 2683 | + |
2672 | 2684 | $p = "{$this->mIndexPolicy},{$this->mFollowPolicy}"; |
2673 | 2685 | if( $p !== 'index,follow' ) { |
2674 | 2686 | // http://www.robotstxt.org/wc/meta-user.html |
2675 | 2687 | // 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 | + ) ); |
2677 | 2692 | } |
2678 | 2693 | |
2679 | 2694 | if ( count( $this->mKeywords ) > 0 ) { |
— | — | @@ -2680,28 +2695,16 @@ |
2681 | 2696 | "/<.*?" . ">/" => '', |
2682 | 2697 | "/_/" => ' ' |
2683 | 2698 | ); |
2684 | | - $this->addMeta( |
2685 | | - 'keywords', |
2686 | | - preg_replace( |
| 2699 | + $tags[] = Html::element( 'meta', array( |
| 2700 | + 'name' => 'keywords', |
| 2701 | + 'content' => preg_replace( |
2687 | 2702 | array_keys( $strip ), |
2688 | 2703 | array_values( $strip ), |
2689 | 2704 | implode( ',', $this->mKeywords ) |
2690 | 2705 | ) |
2691 | | - ); |
| 2706 | + ) ); |
2692 | 2707 | } |
2693 | | - } |
2694 | 2708 | |
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 | | - |
2706 | 2709 | foreach ( $this->mMetatags as $tag ) { |
2707 | 2710 | if ( 0 == strcasecmp( 'http:', substr( $tag[0], 0, 5 ) ) ) { |
2708 | 2711 | $a = 'http-equiv'; |
— | — | @@ -2716,11 +2719,137 @@ |
2717 | 2720 | ) |
2718 | 2721 | ); |
2719 | 2722 | } |
| 2723 | + |
2720 | 2724 | foreach ( $this->mLinktags as $tag ) { |
2721 | 2725 | $tags[] = Html::element( 'link', $tag ); |
2722 | 2726 | } |
2723 | 2727 | |
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 ) { |
2725 | 2854 | foreach( $this->getSyndicationLinks() as $format => $link ) { |
2726 | 2855 | # Use the page name for the title (accessed through $wgTitle since |
2727 | 2856 | # there's no other way). In principle, this could lead to issues |
— | — | @@ -2743,7 +2872,6 @@ |
2744 | 2873 | # or "Breaking news" one). For this, we see if $wgOverrideSiteFeed is defined. |
2745 | 2874 | # If so, use it instead. |
2746 | 2875 | |
2747 | | - global $wgOverrideSiteFeed, $wgSitename, $wgAdvertisedFeedTypes; |
2748 | 2876 | $rctitle = SpecialPage::getTitleFor( 'Recentchanges' ); |
2749 | 2877 | |
2750 | 2878 | if ( $wgOverrideSiteFeed ) { |
Index: trunk/phase3/includes/SkinTemplate.php |
— | — | @@ -154,7 +154,6 @@ |
155 | 155 | wfProfileIn( __METHOD__ . '-init' ); |
156 | 156 | $this->initPage( $out ); |
157 | 157 | |
158 | | - $this->setMembers(); |
159 | 158 | $tpl = $this->setupTemplate( $this->template, 'skins' ); |
160 | 159 | wfProfileOut( __METHOD__ . '-init' ); |
161 | 160 | |
Index: trunk/phase3/includes/Skin.php |
— | — | @@ -183,47 +183,11 @@ |
184 | 184 | } |
185 | 185 | |
186 | 186 | function initPage( OutputPage $out ) { |
187 | | - global $wgFavicon, $wgAppleTouchIcon, $wgEnableAPI; |
188 | | - |
189 | 187 | wfProfileIn( __METHOD__ ); |
190 | 188 | |
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 | | - |
225 | 189 | $this->mRevisionId = $out->mRevisionId; |
226 | | - |
227 | 190 | $this->preloadExistence(); |
| 191 | + $this->setMembers(); |
228 | 192 | |
229 | 193 | wfProfileOut( __METHOD__ ); |
230 | 194 | } |
— | — | @@ -252,88 +216,6 @@ |
253 | 217 | } |
254 | 218 | |
255 | 219 | /** |
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 | | - /** |
338 | 220 | * Set some local variables |
339 | 221 | */ |
340 | 222 | protected function setMembers() { |
— | — | @@ -437,7 +319,6 @@ |
438 | 320 | global $wgDebugComments; |
439 | 321 | wfProfileIn( __METHOD__ ); |
440 | 322 | |
441 | | - $this->setMembers(); |
442 | 323 | $this->initPage( $out ); |
443 | 324 | |
444 | 325 | // See self::afterContentHook() for documentation |