Index: trunk/extensions/Contest/Contest.hooks.php |
— | — | @@ -162,9 +162,9 @@ |
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
166 | | - * Used when generating internal and interwiki links in Linker::link(), |
167 | | - * just before the function returns a value. |
168 | | - * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd |
| 166 | + * Used when generating internal and interwiki links in Linker::link(), |
| 167 | + * just before the function returns a value. |
| 168 | + * @see https://www.mediawiki.org/wiki/Manual:Hooks/LinkEnd |
169 | 169 | * |
170 | 170 | * @since 0.1 |
171 | 171 | * |
Index: trunk/extensions/Contest/includes/ContestUtils.php |
— | — | @@ -53,11 +53,6 @@ |
54 | 54 | |
55 | 55 | $article = new Article( $title, 0 ); |
56 | 56 | |
57 | | - // Looks like the LinkEnd hook can be used here instead of replaceRelativeLinks. |
58 | | - // The hook could just turn relative urls into absolute ones in a nice way, |
59 | | - // but would require setting some global such as $isContestEmailParse to true |
60 | | - // before the parse call and to false afterwards, which also is not very nice. |
61 | | - |
62 | 57 | global $wgParser, $wgContestEmailParse; |
63 | 58 | |
64 | 59 | $wgContestEmailParse = true; |
— | — | @@ -72,36 +67,4 @@ |
73 | 68 | |
74 | 69 | return $text; |
75 | 70 | } |
76 | | - |
77 | | - /** |
78 | | - * Returns the provided wikitext with internal (relative) links replaced by their external equivalents. |
79 | | - * ie turns [[Foo]] into [someurl/Foo Foo] |
80 | | - * |
81 | | - * This replacing is quite evil; if the parser can just do this, |
82 | | - * we should make use of that instead of doing it here. |
83 | | - * |
84 | | - * @since 0.1 |
85 | | - * |
86 | | - * @param string $wikiText |
87 | | - * |
88 | | - * @return string |
89 | | - */ |
90 | | - public static function replaceRelativeLinks( $wikiText ) { |
91 | | - $url = substr( Title::newFromText( 'a' )->getFullUrl(), 0, -1 ); |
92 | | - |
93 | | - $wikiText = preg_replace( |
94 | | - '/\[\[(?!(Category|Image|File|[^\s]{2,5}:))([^\|\]]*)\|([^\]]*)\]\]/e', |
95 | | - "'[" . $url . "'.str_replace(' ', '_', '\\2').' \\3]'", |
96 | | - $wikiText |
97 | | - ); |
98 | | - |
99 | | - $wikiText = preg_replace( |
100 | | - '/\[\[((?!(Category|Image|File|[^\s]{2,5}:))[^\]]*)\]\]/e', |
101 | | - "'[" . $url . "'.str_replace(' ', '_', '\\1').' \\1]'", |
102 | | - $wikiText |
103 | | - ); |
104 | | - |
105 | | - return $wikiText; |
106 | | - } |
107 | | - |
108 | 71 | } |