Index: trunk/extensions/SmoothGallery/SmoothGallery.php |
— | — | @@ -65,14 +65,14 @@ |
66 | 66 | function efSmoothGallery() { |
67 | 67 | global $wgParser; |
68 | 68 | |
69 | | - $wgParser->setHook( 'sgallery', 'initSmoothGallery' ); |
70 | | - $wgParser->setHook( 'sgalleryset', 'initSmoothGallerySet' ); |
| 69 | + $wgParser->setHook( 'sgallery', 'initSmoothGalleryTag' ); |
| 70 | + $wgParser->setHook( 'sgalleryset', 'initSmoothGalleryTagSet' ); |
71 | 71 | |
72 | 72 | $wgParser->setFunctionHook( 'sgallery', 'initSmoothGalleryPF' ); |
73 | 73 | } |
74 | 74 | |
75 | 75 | // FIXME: split off to a hook file and use $wgHooks['ParserFirstCallInit'] to init tags |
76 | | -function initSmoothGalleryPF( &$parser ) { |
| 76 | +function initSmoothGalleryPF( $parser ) { |
77 | 77 | global $wgSmoothGalleryDelimiter; |
78 | 78 | |
79 | 79 | $numargs = func_num_args(); |
— | — | @@ -109,7 +109,13 @@ |
110 | 110 | return array( $output, 'noparse' => true, 'isHTML' => true ); |
111 | 111 | } |
112 | 112 | |
113 | | -function initSmoothGallery( $input, $argv, &$parser, $calledAsSet = false ) { |
| 113 | +function initSmoothGalleryTag( $input, $argv, $parser ) { |
| 114 | + $output = initSmoothGallery( $input, $args, $parser ); |
| 115 | + |
| 116 | + return $output; |
| 117 | +} |
| 118 | + |
| 119 | +function initSmoothGallery( $input, $argv, $parser, $calledAsSet = false ) { |
114 | 120 | $sgParser = new SmoothGalleryParser( $input, $argv, $parser, $calledAsSet ); |
115 | 121 | $sgGallery = new SmoothGallery(); |
116 | 122 | |
— | — | @@ -126,7 +132,7 @@ |
127 | 133 | } |
128 | 134 | } |
129 | 135 | |
130 | | -function initSmoothGallerySet( $input, $args, &$parser ) { |
| 136 | +function initSmoothGalleryTagSet( $input, $args, $parser ) { |
131 | 137 | $output = initSmoothGallery( $input, $args, $parser, true ); |
132 | 138 | |
133 | 139 | return $output; |
— | — | @@ -136,7 +142,7 @@ |
137 | 143 | * Hook callback that injects messages and things into the <head> tag |
138 | 144 | * Does nothing if $parserOutput->mSmoothGalleryTag is not set |
139 | 145 | */ |
140 | | -function smoothGalleryParserOutput( &$outputPage, &$parserOutput ) { |
| 146 | +function smoothGalleryParserOutput( $outputPage, $parserOutput ) { |
141 | 147 | if ( !empty( $parserOutput->mSmoothGalleryTag ) ) { |
142 | 148 | SmoothGallery::setGalleryHeaders( $outputPage ); |
143 | 149 | } |
— | — | @@ -150,7 +156,7 @@ |
151 | 157 | * We ignore langCode - parser function names can be translated but |
152 | 158 | * we are not using this feature |
153 | 159 | */ |
154 | | -function smoothGalleryLanguageGetMagic( &$magicWords, $langCode ) { |
| 160 | +function smoothGalleryLanguageGetMagic( $magicWords, $langCode ) { |
155 | 161 | $magicWords['sgallery'] = array( 0, 'sgallery' ); |
156 | 162 | return true; |
157 | 163 | } |
Index: trunk/extensions/SmoothGallery/SmoothGalleryClass.php |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | $this->galleriesArray = $galleriesArray; |
58 | 58 | } |
59 | 59 | |
60 | | - function setParser( &$parser ) { |
| 60 | + function setParser( $parser ) { |
61 | 61 | $this->parser = $parser; |
62 | 62 | } |
63 | 63 | |
— | — | @@ -274,7 +274,7 @@ |
275 | 275 | return $output; |
276 | 276 | } |
277 | 277 | |
278 | | - static function setGalleryHeaders( &$outputPage ) { |
| 278 | + static function setGalleryHeaders( $outputPage ) { |
279 | 279 | global $wgSmoothGalleryExtensionPath; |
280 | 280 | |
281 | 281 | $extensionpath = $wgSmoothGalleryExtensionPath; |
— | — | @@ -304,7 +304,7 @@ |
305 | 305 | return true; |
306 | 306 | } |
307 | 307 | |
308 | | - static function setGallerySetHeaders( &$outputPage ) { |
| 308 | + static function setGallerySetHeaders( $outputPage ) { |
309 | 309 | global $wgSmoothGalleryExtensionPath; |
310 | 310 | |
311 | 311 | $extensionpath = $wgSmoothGalleryExtensionPath; |
Index: trunk/extensions/SmoothGallery/SmoothGalleryParser.php |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | // collect the fallback output |
91 | 91 | $i = 0; |
92 | 92 | foreach ( $galleries as $galleryInput ) { |
93 | | - // TOFIX: |
| 93 | + // FIXME: |
94 | 94 | // This couldn't possibly be right... If these are different |
95 | 95 | // galleries in a gallery set, shouldn't they have unique names? |
96 | 96 | $name = "MediaWikiSGallery" . $i; |
— | — | @@ -241,16 +241,6 @@ |
242 | 242 | // Get the text from the image page's description, if it exists |
243 | 243 | $description = $img_obj->getDescriptionText(); |
244 | 244 | } |
245 | | - |
246 | | - // convert wikitext to HTML |
247 | | - // TODO: find out why this doesn't work with special pages |
248 | | - if ( $parser ) { |
249 | | - $pout = $parser->recursiveTagParse( $description, $title, $parser->mOptions, true ); |
250 | | - $description = strip_tags( $pout ); |
251 | | - # $fulldesc = strip_tags( $pout->getText() ); |
252 | | - } else { // fall back to HTML-escaping |
253 | | - $description = htmlspecialchars( $description ); |
254 | | - } |
255 | 245 | } |
256 | 246 | |
257 | 247 | $skin = $wgUser->getSkin(); |
— | — | @@ -258,7 +248,7 @@ |
259 | 249 | // Everything is checked, and converted; add to the array and return |
260 | 250 | $imageArray["title"] = $title; |
261 | 251 | |
262 | | - # We need the following for the image's div |
| 252 | + // We need the following for the image's div |
263 | 253 | $imageArray["heading"] = $skin->makeKnownLinkObj( $img_obj->getTitle(), $img_obj->getName() ); |
264 | 254 | $imageArray["description"] = $description; |
265 | 255 | $imageArray["full_url"] = $title->getFullURL(); |
— | — | @@ -266,7 +256,7 @@ |
267 | 257 | $imageArray["full_thumb_url"] = $full_thumb; |
268 | 258 | $imageArray["icon_thumb_url"] = $icon_thumb; |
269 | 259 | |
270 | | - # We need the image object for plain galleries |
| 260 | + // We need the image object for plain galleries |
271 | 261 | $imageArray["image_object"] = $img_obj; |
272 | 262 | |
273 | 263 | $galleryArray["images"][] = $imageArray; |