r19546 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19545‎ | r19546 | r19547 >
Date:03:47, 21 January 2007
Author:hashar
Status:old
Tags:
Comment:
Remove any additional trailing slashes when subpaging is enabled
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -1922,9 +1922,9 @@
19231923 # Look at the first character
19241924 if( $target != '' && $target{0} == '/' ) {
19251925 # / at end means we don't want the slash to be shown
1926 - if( substr( $target, -1, 1 ) == '/' ) {
1927 - $target = substr( $target, 1, -1 );
1928 - $noslash = $target;
 1926+ $trailingSlashes = preg_match_all( '%(/+)$%', $target, $m );
 1927+ if( $trailingSlashes ) {
 1928+ $noslash = $target = substr( $target, 1, -strlen($m[0][0]) );
19291929 } else {
19301930 $noslash = substr( $target, 1 );
19311931 }