r65407 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65406‎ | r65407 | r65408 >
Date:18:22, 21 April 2010
Author:kipcool
Status:deferred
Tags:
Comment:
Using wgArticlePath instead of wgScript. Also using urlencode to improve handling of special characters.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/type.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/type.php
@@ -24,16 +24,20 @@
2525 }
2626
2727 function pageAsURL( $nameSpace, $title, $usedc = true ) {
28 - global
29 - $wgScript;
3028
31 - $url = $wgScript . '?title=' . $nameSpace . ':' . htmlspecialchars( $title );
 29+ global $wgArticlePath;
 30+
 31+ $url = str_replace( "$1", urlencode( $nameSpace . ':' . $title ), $wgArticlePath );
 32+
3233 if ( $usedc ) {
3334 $dc = wdGetDataSetContext();
34 - $url .= "&dataset=$dc";
 35+ if ( strpos($url , "?") ) {
 36+ $url .= "&dataset=$dc";
 37+ } else {
 38+ $url .= "?dataset=$dc";
 39+ }
3540 }
3641 return $url;
37 -
3842 }
3943
4044 function spellingAsURL( $spelling ) {

Status & tagging log