http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95000

Revision: 95000
Author:   catrope
Date:     2011-08-19 14:39:37 +0000 (Fri, 19 Aug 2011)
Log Message:
-----------
Use canonical URLs (introduced in r94995) in the OpenSearch discovery thingy

Modified Paths:
--------------
    trunk/extensions/OpenSearchXml/OpenSearchXml.php
    trunk/phase3/includes/search/SearchEngine.php
    trunk/phase3/opensearch_desc.php

Modified: trunk/extensions/OpenSearchXml/OpenSearchXml.php
===================================================================
--- trunk/extensions/OpenSearchXml/OpenSearchXml.php    2011-08-19 14:36:52 UTC 
(rev 94999)
+++ trunk/extensions/OpenSearchXml/OpenSearchXml.php    2011-08-19 14:39:37 UTC 
(rev 95000)
@@ -52,10 +52,10 @@
 }
 
 function efOpenSearchXmlTemplate() {
-       global $wgServer, $wgScriptPath;
+       global $wgCanonicalServer, $wgScriptPath;
        $ns = implode( '|', SearchEngine::defaultNamespaces() );
        if( !$ns ) {
                $ns = '0';
        }
-       return $wgServer . $wgScriptPath . 
'/api.php?action=opensearch&format=xml&search={searchTerms}&namespace=' . $ns;
+       return $wgCanonicalServer . $wgScriptPath . 
'/api.php?action=opensearch&format=xml&search={searchTerms}&namespace=' . $ns;
 }

Modified: trunk/phase3/includes/search/SearchEngine.php
===================================================================
--- trunk/phase3/includes/search/SearchEngine.php       2011-08-19 14:36:52 UTC 
(rev 94999)
+++ trunk/phase3/includes/search/SearchEngine.php       2011-08-19 14:39:37 UTC 
(rev 95000)
@@ -472,7 +472,7 @@
         * @return String
         */
        public static function getOpenSearchTemplate() {
-               global $wgOpenSearchTemplate, $wgServer;
+               global $wgOpenSearchTemplate, $wgCanonicalServer;
                if ( $wgOpenSearchTemplate ) {
                        return $wgOpenSearchTemplate;
                } else {
@@ -480,7 +480,7 @@
                        if ( !$ns ) {
                                $ns = "0";
                        }
-                       return $wgServer . wfScript( 'api' ) . 
'?action=opensearch&search={searchTerms}&namespace=' . $ns;
+                       return $wgCanonicalServer . wfScript( 'api' ) . 
'?action=opensearch&search={searchTerms}&namespace=' . $ns;
                }
        }
 

Modified: trunk/phase3/opensearch_desc.php
===================================================================
--- trunk/phase3/opensearch_desc.php    2011-08-19 14:36:52 UTC (rev 94999)
+++ trunk/phase3/opensearch_desc.php    2011-08-19 14:39:37 UTC (rev 95000)
@@ -51,7 +51,7 @@
                'height' => 16,
                'width' => 16,
                'type' => 'image/x-icon' ),
-       wfExpandUrl( $wgFavicon ) );
+       wfExpandUrl( $wgFavicon , PROTO_CURRENT ) );
 
 $urls = array();
 
@@ -62,7 +62,7 @@
 $urls[] = array(
        'type' => 'text/html',
        'method' => 'get',
-       'template' => $searchPage->getFullURL( 'search={searchTerms}' ) );
+       'template' => $searchPage->getCanonicalURL( 'search={searchTerms}' ) );
 
 if( $wgEnableAPI ) {
        // JSON interface for search suggestions.
@@ -86,6 +86,6 @@
 // sends you to the domain root if you hit "enter" with an empty
 // search box.
 print Xml::element( 'moz:SearchForm', null,
-       $searchPage->getFullUrl() );
+       $searchPage->getCanonicalURL() );
 
 print '</OpenSearchDescription>';


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to