From 78d5512e7bda0a3771d0fe738b901404fe5426ee Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 23 Nov 2011 13:41:39 +0000 Subject: [PATCH] Followup r102951: per CR, remove duplicated empty string from API extlinks modules' protocol params, and remove // from the list of protocols on Special:LinkSearch --- includes/api/ApiQueryExtLinksUsage.php | 4 +++- includes/specials/SpecialLinkSearch.php | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index a9db9d982e..8205378ad4 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -177,7 +177,9 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { global $wgUrlProtocols; $protocols = array( '' ); foreach ( $wgUrlProtocols as $p ) { - $protocols[] = substr( $p, 0, strpos( $p, ':' ) ); + if ( $p !== '//' ) { + $protocols[] = substr( $p, 0, strpos( $p, ':' ) ); + } } return $protocols; } diff --git a/includes/specials/SpecialLinkSearch.php b/includes/specials/SpecialLinkSearch.php index eb42206b9a..6ef38073d9 100644 --- a/includes/specials/SpecialLinkSearch.php +++ b/includes/specials/SpecialLinkSearch.php @@ -55,9 +55,10 @@ class LinkSearchPage extends QueryPage { $target = $request->getVal( 'target', $par ); $namespace = $request->getIntorNull( 'namespace', null ); - $protocols_list[] = ''; foreach( $wgUrlProtocols as $prot ) { - $protocols_list[] = $prot; + if ( $prot !== '//' ) { + $protocols_list[] = $prot; + } } $target2 = $target; @@ -76,13 +77,13 @@ class LinkSearchPage extends QueryPage { // default $protocol = 'http://'; } - if ( !in_array( $protocol, $protocols_list ) ) { + if ( $protocol != '' && !in_array( $protocol, $protocols_list ) ) { // unsupported protocol, show original search request $target2 = $target; $protocol = ''; } - $out->addWikiMsg( 'linksearch-text', '' . $this->getLanguage()->commaList( $wgUrlProtocols ) . '' ); + $out->addWikiMsg( 'linksearch-text', '' . $this->getLanguage()->commaList( $protocols_list ) . '' ); $s = Xml::openElement( 'form', array( 'id' => 'mw-linksearch-form', 'method' => 'get', 'action' => $GLOBALS['wgScript'] ) ) . Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) . '
' . -- 2.20.1