r14202 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14201‎ | r14202 | r14203 >
Date:19:29, 13 May 2006
Author:hashar
Status:old
Tags:
Comment:
Fix #5918: links autonumbering now work for all defined protocols.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/Parser.php (modified) (history)
  • /trunk/phase3/maintenance/parserTests.txt (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/parserTests.txt
@@ -1045,7 +1045,7 @@
10461046 !! result
10471047 <table>
10481048 <tr>
1049 -<td><a href="ftp://|x||" class='external free' title="ftp://|x||" rel="nofollow">ftp://|x</td><td></a>" onmouseover="alert(document.cookie)">test
 1049+<td><a href="ftp://|x||" class='external autonumber' title="ftp://|x||" rel="nofollow">[1]</td><td></a>" onmouseover="alert(document.cookie)">test
10501050 </td>
10511051 </tr>
10521052 </table>
@@ -3949,6 +3949,27 @@
39503950
39513951 !! end
39523952
 3953+!!test
 3954+bug 5918: autonumbering
 3955+!! input
 3956+[http://first/] [http://second] [ftp://ftp]
 3957+
 3958+ftp://inlineftp
 3959+
 3960+[mailto:enclosed@mail.tld With target]
 3961+
 3962+[mailto:enclosed@mail.tld]
 3963+
 3964+mailto:inline@mail.tld
 3965+!! result
 3966+<p><a href="http://first/" class='external autonumber' title="http://first/" rel="nofollow">[1]</a> <a href="http://second" class='external autonumber' title="http://second" rel="nofollow">[2]</a> <a href="ftp://ftp" class='external autonumber' title="ftp://ftp" rel="nofollow">[3]</a>
 3967+</p><p><a href="ftp://inlineftp" class='external free' title="ftp://inlineftp" rel="nofollow">ftp://inlineftp</a>
 3968+</p><p><a href="mailto:enclosed@mail.tld" class='external text' title="mailto:enclosed@mail.tld" rel="nofollow">With target</a>
 3969+</p><p><a href="mailto:enclosed@mail.tld" class='external autonumber' title="mailto:enclosed@mail.tld" rel="nofollow">[4]</a>
 3970+</p><p><a href="mailto:inline@mail.tld" class='external free' title="mailto:inline@mail.tld" rel="nofollow">mailto:inline@mail.tld</a>
 3971+</p>
 3972+!! end
 3973+
39533974 #
39543975 #
39553976 #
Index: trunk/phase3/includes/Parser.php
@@ -1161,8 +1161,8 @@
11621162
11631163 # No link text, e.g. [http://domain.tld/some.link]
11641164 if ( $text == '' ) {
1165 - # Autonumber if allowed
1166 - if ( strpos( HTTP_PROTOCOLS, str_replace('/','\/', $protocol) ) !== false ) {
 1165+ # Autonumber if allowed. See bug #5918
 1166+ if ( strpos( wfUrlProtocols(), substr($protocol, 0, strpos($protocol, ':')) ) !== false ) {
11671167 $text = '[' . ++$this->mAutonumber . ']';
11681168 $linktype = 'autonumber';
11691169 } else {
Index: trunk/phase3/RELEASE-NOTES
@@ -257,6 +257,7 @@
258258 * (bug 5833) Introduce CURRENTVERSION magic word
259259 * (bug 5370) Allow throttling of password reminder requests with the rate limiter
260260 * (bug 5683) Respect parser output marked as uncacheable when saving
 261+* (bug 5918) Links autonumbering now work for all defined protocols
261262
262263 == Compatibility ==
263264

Follow-up revisions

RevisionCommit summaryAuthorDate
r14308Fix #5968: note about autonumbering change (introduced in r14202).hashar08:20, 20 May 2006
r92005Fix r14202 (!!): this validates the protocol against the regex for the second...catrope20:55, 12 July 2011

Status & tagging log