Index: trunk/extensions/SmoothGallery/SmoothGalleryClass.php |
— | — | @@ -21,24 +21,24 @@ |
22 | 22 | |
23 | 23 | function checkForErrors() { |
24 | 24 | foreach ( $this->galleriesArray["galleries"] as $galleryArray ) { |
25 | | - //We are being harsh for gallery sets. |
26 | | - //If even one gallery is missing all images, we |
27 | | - //are going to return an error to the user. |
| 25 | + // We are being harsh for gallery sets. |
| 26 | + // If even one gallery is missing all images, we |
| 27 | + // are going to return an error to the user. |
28 | 28 | if ( !isset( $galleryArray["images"] ) ) { |
29 | 29 | wfLoadExtensionMessages( 'SmoothGallery' ); |
30 | 30 | $error = wfMsg( "smoothgallery-error" ); |
31 | | - |
| 31 | + |
32 | 32 | if ( isset( $galleryArray["missing_images"] ) && isset( $galleryArray["invalid_images"] ) ) { |
33 | | - $error .= wfMsg( "smoothgallery-no-images", implode( ", " , $galleryArray["missing_images"] , count($galleryArray["missing_images"]) , count($galleryArray["missing_images"]) + count($galleryArray["invalid_images"]) ) ); // FIXME: 3rd (last) parameter should have the number of good images added. |
34 | | - $error .= wfMsg( "smoothgallery-invalid-images", implode( ", " , $galleryArray["invalid_images"] , count($galleryArray["invalid_images"]) ) ); |
| 33 | + $error .= wfMsg( "smoothgallery-no-images", implode( ", " , $galleryArray["missing_images"] , count( $galleryArray["missing_images"] ) , count( $galleryArray["missing_images"] ) + count( $galleryArray["invalid_images"] ) ) ); // FIXME: 3rd (last) parameter should have the number of good images added. |
| 34 | + $error .= wfMsg( "smoothgallery-invalid-images", implode( ", " , $galleryArray["invalid_images"] , count( $galleryArray["invalid_images"] ) ) ); |
35 | 35 | } else if ( isset( $galleryArray["invalid_images"] ) ) { |
36 | | - $error .= wfMsg( "smoothgallery-invalid-images", implode( ", " , $galleryArray["invalid_images"] , count($galleryArray["invalid_images"]) ) ); |
| 36 | + $error .= wfMsg( "smoothgallery-invalid-images", implode( ", " , $galleryArray["invalid_images"] , count( $galleryArray["invalid_images"] ) ) ); |
37 | 37 | } else if ( isset( $galleryArray["missing_images"] ) ) { |
38 | | - $error .= wfMsg( "smoothgallery-no-images", implode( ", " , $galleryArray["missing_images"] , count($galleryArray["missing_images"]) , count($galleryArray["missing_images"]) ) ); // FIXME: 3rd (last) parameter should have the number of good images added. |
| 38 | + $error .= wfMsg( "smoothgallery-no-images", implode( ", " , $galleryArray["missing_images"] , count( $galleryArray["missing_images"] ) , count( $galleryArray["missing_images"] ) ) ); // FIXME: 3rd (last) parameter should have the number of good images added. |
39 | 39 | } else { |
40 | 40 | $error .= wfMsg( "smoothgallery-not-found" ); |
41 | 41 | } |
42 | | - |
| 42 | + |
43 | 43 | if ( $this->errors == '' ) { |
44 | 44 | $this->errors = $error; |
45 | 45 | } else { |
— | — | @@ -46,7 +46,6 @@ |
47 | 47 | } |
48 | 48 | } |
49 | 49 | } |
50 | | - |
51 | 50 | } |
52 | 51 | |
53 | 52 | function setArguments( $argumentArray ) { |
— | — | @@ -68,20 +67,20 @@ |
69 | 68 | function toHTML () { |
70 | 69 | $output = ''; |
71 | 70 | $fallbackOutput = ''; |
72 | | - |
| 71 | + |
73 | 72 | if ( $this->set ) { |
74 | | - //Open the div, and initialize any needed variables |
| 73 | + // Open the div, and initialize any needed variables |
75 | 74 | $output = '<div id="' . $this->galleriesArray["gallery_set_name"] . '" style="width: ' . $this->argumentArray["width"] . ';height: ' . $this->argumentArray["height"] . '; display: none;" >'; |
76 | | - |
77 | | - //iterate through galleries, call renderGallery on each, and |
78 | | - //collect the fallback output |
| 75 | + |
| 76 | + // iterate through galleries, call renderGallery on each, and |
| 77 | + // collect the fallback output |
79 | 78 | $i = 1; |
80 | 79 | foreach ( $this->galleriesArray["galleries"] as $galleryArray ) { |
81 | 80 | $output .= $this->renderGallery( $galleryArray ); |
82 | 81 | $fallbackOutput .= $this->renderFallback( $galleryArray ); |
83 | 82 | $i++; |
84 | 83 | } |
85 | | - |
| 84 | + |
86 | 85 | $output .= '</div>'; |
87 | 86 | $output .= '<div id="' . $this->galleriesArray["gallery_set_name"] . '-fallback">' . $fallbackOutput . '</div>'; |
88 | 87 | $output .= $this->renderJavascript( $this->galleriesArray["gallery_set_name"] ); |
— | — | @@ -90,30 +89,30 @@ |
91 | 90 | $output .= $this->renderFallback( $this->galleriesArray["galleries"][0] ); |
92 | 91 | $output .= $this->renderJavascript( $this->galleriesArray["galleries"][0]["gallery_name"] ); |
93 | 92 | } |
94 | | - |
| 93 | + |
95 | 94 | # flags for use by smoothGalleryParserOutput |
96 | 95 | $this->parser->mOutput->mSmoothGalleryTag = true; |
97 | 96 | if ( $this->set ) { |
98 | 97 | $this->parser->mOutput->mSmoothGallerySetTag = true; |
99 | 98 | } |
100 | | - |
101 | | - //Finished, let's send it out |
| 99 | + |
| 100 | + // Finished, let's send it out |
102 | 101 | return $output; |
103 | 102 | } |
104 | | - |
| 103 | + |
105 | 104 | function renderGallery ( $galleryArray ) { |
106 | 105 | global $wgSmoothGalleryDelimiter; |
107 | 106 | global $wgSmoothGalleryThumbHeight, $wgSmoothGalleryThumbWidth; |
108 | | - |
109 | | - //Open the outer div of the gallery |
| 107 | + |
| 108 | + // Open the outer div of the gallery |
110 | 109 | if ( $this->set ) { |
111 | 110 | $output = '<div id="' . $galleryArray["gallery_name"] . '" class="galleryElement">'; |
112 | 111 | $output .= '<h2>' . $galleryArray["gallery_name"] . '<h2>'; |
113 | 112 | } else { |
114 | 113 | $output = '<div id="' . $galleryArray["gallery_name"] . '" style="width: ' . $this->argumentArray["width"] . ';height: ' . $this->argumentArray["height"] . '; display:none;">'; |
115 | 114 | } |
116 | | - |
117 | | - //TODO iterate over the images and output each |
| 115 | + |
| 116 | + // TODO iterate over the images and output each |
118 | 117 | foreach ( $galleryArray["images"] as $imageArray ) { |
119 | 118 | if ( isset( $imageArray["external"] ) && $imageArray["external"] ) { |
120 | 119 | $thumbsizes = 'height="' . $wgSmoothGalleryThumbHeight . '" width="' . $wgSmoothGalleryThumbWidth . '" '; |
— | — | @@ -122,35 +121,34 @@ |
123 | 122 | $thumbsizes = ''; |
124 | 123 | $fullsizes = ''; |
125 | 124 | } |
126 | | - //Add the html for the image |
| 125 | + // Add the html for the image |
127 | 126 | $output .= '<div class="imageElement">'; |
128 | 127 | $output .= '<h3>' . $imageArray["heading"] . '</h3>'; |
129 | 128 | $output .= '<p>' . $imageArray["description"] . '</p>'; |
130 | 129 | $output .= '<a href="' . $imageArray["full_url"] . '" title="open image" class="open"></a>'; |
131 | 130 | $output .= '<a href="' . $imageArray["view_url"] . '" title="open image" class="open"></a>'; |
132 | 131 | $output .= '<img src="' . $imageArray["full_thumb_url"] . '" class="full" alt="' . $imageArray["description"] . '" ' . $fullsizes . '/>'; |
133 | | - |
| 132 | + |
134 | 133 | if ( $this->argumentArray["carousel"] ) { |
135 | 134 | $output .= '<img src="' . $imageArray["icon_thumb_url"] . '" class="thumbnail" alt="' . $imageArray["description"] . '" ' . $thumbsizes . '/>'; |
136 | 135 | } |
137 | | - |
| 136 | + |
138 | 137 | $output .= '</div>'; |
139 | 138 | } |
140 | | - |
141 | | - |
142 | | - //Close the outer div of the gallery |
| 139 | + |
| 140 | + // Close the outer div of the gallery |
143 | 141 | $output .= '</div>'; |
144 | | - |
| 142 | + |
145 | 143 | return $output; |
146 | 144 | } |
147 | | - |
| 145 | + |
148 | 146 | function renderFallback ( $galleryArray ) { |
149 | 147 | $output = ''; |
150 | | - |
| 148 | + |
151 | 149 | if ( !isset( $galleryArray["images"] ) ) { |
152 | 150 | return $output; |
153 | 151 | } |
154 | | - |
| 152 | + |
155 | 153 | if ( $this->argumentArray["fallback"] == "image" ) { |
156 | 154 | if ( !isset( $galleryArray["images"][0] ) ) { |
157 | 155 | return ''; |
— | — | @@ -167,7 +165,7 @@ |
168 | 166 | $output .= '<div id="' . $galleryArray['gallery_name'] . '-fallback" class="MediaWikiSGalleryWarning" style="width: ' . $this->argumentArray["width"] . ';height: ' . $this->argumentArray["height"] . ';" alt="' . $galleryArray["images"][0]["description"] . '">'; |
169 | 167 | |
170 | 168 | wfLoadExtensionMessages( 'SmoothGallery' ); |
171 | | - $output .= wfMsg("smoothgallery-javascript-disabled"); |
| 169 | + $output .= wfMsg( "smoothgallery-javascript-disabled" ); |
172 | 170 | |
173 | 171 | $output .= '<div class="MediaWikiSGallerySingleImage">'; |
174 | 172 | $output .= '<img src="' . $galleryArray["images"][0]["full_thumb_url"] . '" class="full" alt="' . $galleryArray["images"][0]["description"] . '" />'; |
— | — | @@ -175,32 +173,32 @@ |
176 | 174 | } else { |
177 | 175 | $output .= $this->renderPlainGallery ( $galleryArray ); |
178 | 176 | } |
179 | | - |
| 177 | + |
180 | 178 | return $output; |
181 | 179 | } |
182 | | - |
| 180 | + |
183 | 181 | function renderPlainGallery ( $galleryArray ) { |
184 | 182 | global $wgVersion; |
185 | | - |
| 183 | + |
186 | 184 | if ( !isset( $galleryArray["images"] ) ) { |
187 | 185 | return ''; |
188 | 186 | } |
189 | | - |
190 | | - //Wrapper div for plain old gallery, to be shown per default, if JS is off. |
| 187 | + |
| 188 | + // Wrapper div for plain old gallery, to be shown per default, if JS is off. |
191 | 189 | $output = '<div id="' . $galleryArray["gallery_name"] . '-fallback">'; |
192 | | - |
| 190 | + |
193 | 191 | $plain_gallery = new ImageGallery(); |
194 | 192 | |
195 | | - $i = 0; |
| 193 | + $i = 0; |
196 | 194 | foreach ( $galleryArray["images"] as $image ) { |
197 | 195 | if ( isset( $image["external"] ) && $image["external"] ) { |
198 | 196 | continue; |
199 | 197 | } |
200 | 198 | |
201 | 199 | if ( version_compare( $wgVersion, "1.11", '<' ) ) { |
202 | | - $plain_gallery->add( $image["image_object"], $image["description"] ); //TODO: use text |
| 200 | + $plain_gallery->add( $image["image_object"], $image["description"] ); // TODO: use text |
203 | 201 | } else { |
204 | | - $plain_gallery->add( $image["image_object"]->getTitle(), $image["description"] ); //TODO: use text |
| 202 | + $plain_gallery->add( $image["image_object"]->getTitle(), $image["description"] ); // TODO: use text |
205 | 203 | } |
206 | 204 | $i++; |
207 | 205 | } |
— | — | @@ -212,124 +210,124 @@ |
213 | 211 | } |
214 | 212 | |
215 | 213 | $output .= $plain_gallery->toHTML(); |
216 | | - |
217 | | - //Close the wrapper div for the plain old gallery |
| 214 | + |
| 215 | + // Close the wrapper div for the plain old gallery |
218 | 216 | $output .= '</div>'; |
219 | | - |
| 217 | + |
220 | 218 | return $output; |
221 | 219 | } |
222 | | - |
| 220 | + |
223 | 221 | function renderJavascript ( $name ) { |
224 | | - //Output the javascript needed for the gallery with any |
225 | | - //options the user requested |
| 222 | + // Output the javascript needed for the gallery with any |
| 223 | + // options the user requested |
226 | 224 | $output = '<script type="text/javascript">'; |
227 | | - |
228 | | - $output .= 'document.getElementById("' . $name . '-fallback").style.display = "none";'; //hide plain gallery |
229 | | - $output .= 'document.getElementById("' . $name . '").style.display = "block";'; //show smooth gallery |
230 | | - |
| 225 | + |
| 226 | + $output .= 'document.getElementById("' . $name . '-fallback").style.display = "none";'; // hide plain gallery |
| 227 | + $output .= 'document.getElementById("' . $name . '").style.display = "block";'; // show smooth gallery |
| 228 | + |
231 | 229 | $output .= 'function startGallery_' . $name . '() {'; |
232 | 230 | if ( $this->set ) { |
233 | 231 | $output .= "var MediaWikiSGallerySet = new gallerySet($('" . $name . "'), {"; |
234 | 232 | } else { |
235 | 233 | $output .= "var MediaWikiSGallery = new gallery($('" . $name . "'), {"; |
236 | 234 | } |
237 | | - |
238 | | - $output .= 'thumbWidth: 100, thumbHeight: 75'; //would be nice if we could change this to 120x120 to re-use thumbnails... |
239 | | - |
240 | | - //Add user provided options |
| 235 | + |
| 236 | + $output .= 'thumbWidth: 100, thumbHeight: 75'; // would be nice if we could change this to 120x120 to re-use thumbnails... |
| 237 | + |
| 238 | + // Add user provided options |
241 | 239 | if ( $this->argumentArray["timed"] ) { |
242 | 240 | $output .= ', timed: true'; |
243 | 241 | $output .= ', delay: ' . $this->argumentArray["delay"]; |
244 | 242 | } |
245 | | - |
| 243 | + |
246 | 244 | if ( !$this->argumentArray["carousel"] ) { |
247 | 245 | $output .= ', showCarousel: false'; |
248 | 246 | } |
249 | | - |
| 247 | + |
250 | 248 | if ( !$this->argumentArray["showarrows"] ) { |
251 | 249 | $output .= ', showArrows: false'; |
252 | 250 | } |
253 | | - |
| 251 | + |
254 | 252 | if ( !$this->argumentArray["showinfopane"] ) { |
255 | 253 | $output .= ', showInfopane: false'; |
256 | 254 | } |
257 | | - |
| 255 | + |
258 | 256 | if ( !$this->argumentArray["slideinfozoneslide"] ) { |
259 | 257 | $output .= ', slideInfoZoneSlide: false'; |
260 | 258 | } |
261 | | - |
| 259 | + |
262 | 260 | if ( $this->argumentArray["slideinfozoneopacity"] ) { |
263 | 261 | $output .= ', slideInfoZoneOpacity: ' . $this->argumentArray["slideinfozoneopacity"]; |
264 | 262 | } |
265 | | - |
266 | | - #$output .= ', useHistoryManager: true'; |
267 | | - #$output .= ', preloader: true'; |
268 | | - #$output .= ', preloaderImage: true'; |
269 | | - #$output .= ', preloaderErrorImage: true'; |
270 | | - #$output .= ', carouselPreloader: true'; |
271 | | - #$output .= ", textPreloadingCarousel: '" . wfMsg("smoothgallery-loading") . "'"; |
272 | | - |
| 263 | + |
| 264 | + # $output .= ', useHistoryManager: true'; |
| 265 | + # $output .= ', preloader: true'; |
| 266 | + # $output .= ', preloaderImage: true'; |
| 267 | + # $output .= ', preloaderErrorImage: true'; |
| 268 | + # $output .= ', carouselPreloader: true'; |
| 269 | + # $output .= ", textPreloadingCarousel: '" . wfMsg("smoothgallery-loading") . "'"; |
| 270 | + |
273 | 271 | $output .= '});'; |
274 | | - #$output .= 'HistoryManager.start();'; |
| 272 | + # $output .= 'HistoryManager.start();'; |
275 | 273 | $output .= '}'; |
276 | 274 | $output .= "window.addEvent('domready', startGallery_$name);"; |
277 | | - #$output .= 'addOnloadHook(startGallery_' . $name . ');'; |
| 275 | + # $output .= 'addOnloadHook(startGallery_' . $name . ');'; |
278 | 276 | $output .= '</script>'; |
279 | | - |
| 277 | + |
280 | 278 | return $output; |
281 | 279 | } |
282 | | - |
283 | | - static function setGalleryHeaders( &$outputPage ) { |
284 | | - global $wgSmoothGalleryExtensionPath; |
285 | 280 | |
286 | | - $extensionpath = $wgSmoothGalleryExtensionPath; |
| 281 | + static function setGalleryHeaders( &$outputPage ) { |
| 282 | + global $wgSmoothGalleryExtensionPath; |
287 | 283 | |
288 | | - //Add mootools (required by SmoothGallery) |
289 | | - //You can use the compressed js if you want, but I |
290 | | - //generally don't trust them unless I wrote them myself |
291 | | - $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/mootools.uncompressed.js" type="text/javascript"></script>' ); |
| 284 | + $extensionpath = $wgSmoothGalleryExtensionPath; |
292 | 285 | |
293 | | - //Add SmoothGallery javascript |
294 | | - $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/jd.gallery.js" type="text/javascript"></script>' ); |
295 | | - $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/HistoryManager.js" type="text/javascript"></script>' ); |
| 286 | + // Add mootools (required by SmoothGallery) |
| 287 | + // You can use the compressed js if you want, but I |
| 288 | + // generally don't trust them unless I wrote them myself |
| 289 | + $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/mootools.uncompressed.js" type="text/javascript"></script>' ); |
296 | 290 | |
297 | | - //Add SmoothGallery css |
298 | | - $outputPage->addLink( |
299 | | - array( |
300 | | - 'rel' => 'stylesheet', |
301 | | - 'type' => 'text/css', |
302 | | - 'href' => $extensionpath . '/css/jd.gallery.css' |
303 | | - ) |
304 | | - ); |
| 291 | + // Add SmoothGallery javascript |
| 292 | + $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/jd.gallery.js" type="text/javascript"></script>' ); |
| 293 | + $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/HistoryManager.js" type="text/javascript"></script>' ); |
305 | 294 | |
306 | | - #$outputPage->addScript( '<link rel="stylesheet" href="' . $extensionpath . '/css/jd.gallery.css" type="text/css" media="screen" charset="utf-8" />' ); |
| 295 | + // Add SmoothGallery css |
| 296 | + $outputPage->addLink( |
| 297 | + array( |
| 298 | + 'rel' => 'stylesheet', |
| 299 | + 'type' => 'text/css', |
| 300 | + 'href' => $extensionpath . '/css/jd.gallery.css' |
| 301 | + ) |
| 302 | + ); |
307 | 303 | |
308 | | - $outputPage->addScript( '<style type="text/css">.jdGallery .slideInfoZone { overflow:auto ! important; }</style>' ); |
| 304 | + # $outputPage->addScript( '<link rel="stylesheet" href="' . $extensionpath . '/css/jd.gallery.css" type="text/css" media="screen" charset="utf-8" />' ); |
309 | 305 | |
310 | | - return true; |
311 | | - } |
| 306 | + $outputPage->addScript( '<style type="text/css">.jdGallery .slideInfoZone { overflow:auto ! important; }</style>' ); |
312 | 307 | |
313 | | - static function setGallerySetHeaders( &$outputPage ) { |
314 | | - global $wgSmoothGalleryExtensionPath; |
| 308 | + return true; |
| 309 | + } |
315 | 310 | |
316 | | - $extensionpath = $wgSmoothGalleryExtensionPath; |
317 | | - $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/jd.gallery.set.js" type="text/javascript"></script>' ); |
| 311 | + static function setGallerySetHeaders( &$outputPage ) { |
| 312 | + global $wgSmoothGalleryExtensionPath; |
318 | 313 | |
| 314 | + $extensionpath = $wgSmoothGalleryExtensionPath; |
| 315 | + $outputPage->addScript( '<script src="' . $extensionpath . '/scripts/jd.gallery.set.js" type="text/javascript"></script>' ); |
| 316 | + |
319 | 317 | return true; |
320 | 318 | } |
321 | 319 | |
322 | 320 | static function debug( $debugText, $debugArr = null ) { |
323 | | - global $wgSmoothGalleryDebug; |
| 321 | + global $wgSmoothGalleryDebug; |
324 | 322 | |
325 | | - if ( isset( $debugArr ) ) { |
326 | | - if ( $wgSmoothGalleryDebug > 0 ) { |
327 | | - $text = $debugText . " " . implode( "::", $debugArr ); |
328 | | - wfDebugLog( 'sgallery', $text, false ); |
329 | | - } |
330 | | - } else { |
331 | | - if ( $wgSmoothGalleryDebug > 0 ) { |
332 | | - wfDebugLog( 'sgallery', $debugText, false ); |
333 | | - } |
334 | | - } |
| 323 | + if ( isset( $debugArr ) ) { |
| 324 | + if ( $wgSmoothGalleryDebug > 0 ) { |
| 325 | + $text = $debugText . " " . implode( "::", $debugArr ); |
| 326 | + wfDebugLog( 'sgallery', $text, false ); |
| 327 | + } |
| 328 | + } else { |
| 329 | + if ( $wgSmoothGalleryDebug > 0 ) { |
| 330 | + wfDebugLog( 'sgallery', $debugText, false ); |
| 331 | + } |
| 332 | + } |
335 | 333 | } |
336 | 334 | } |
Index: trunk/extensions/SmoothGallery/SmoothGalleryParser.php |
— | — | @@ -6,7 +6,7 @@ |
7 | 7 | var $argumentArray; |
8 | 8 | var $galleriesArray; |
9 | 9 | |
10 | | - function SmoothGalleryParser( $input, $argv, &$parser, $calledAsSet=false ) { |
| 10 | + function SmoothGalleryParser( $input, $argv, &$parser, $calledAsSet = false ) { |
11 | 11 | $this->set = $calledAsSet; |
12 | 12 | $this->parseArguments( $argv ); |
13 | 13 | $this->parseGalleries( $input, $parser ); |
— | — | @@ -21,43 +21,43 @@ |
22 | 22 | } |
23 | 23 | |
24 | 24 | function parseArguments( $argv ) { |
25 | | - //Parse arguments, set defaults, and do sanity checks |
| 25 | + // Parse arguments, set defaults, and do sanity checks |
26 | 26 | if ( isset( $argv["height"] ) && is_numeric( $argv["height"] ) ) { |
27 | 27 | $this->argumentArray["height"] = $argv["height"] . "px"; |
28 | 28 | } else { |
29 | 29 | $this->argumentArray["height"] = "300px"; |
30 | 30 | } |
31 | | - |
| 31 | + |
32 | 32 | if ( isset( $argv["width"] ) && is_numeric( $argv["width"] ) ) { |
33 | 33 | $this->argumentArray["width"] = $argv["width"] . "px"; |
34 | 34 | } else { |
35 | 35 | $this->argumentArray["width"] = "400px"; |
36 | 36 | } |
37 | | - |
| 37 | + |
38 | 38 | if ( isset( $argv["showcarousel"] ) && $argv["showcarousel"] == "false" ) { |
39 | 39 | $this->argumentArray["carousel"] = false; |
40 | 40 | } else { |
41 | 41 | $this->argumentArray["carousel"] = true; |
42 | 42 | } |
43 | | - |
| 43 | + |
44 | 44 | if ( isset( $argv["timed"] ) && $argv["timed"] == "true" ) { |
45 | 45 | $this->argumentArray["timed"] = true; |
46 | 46 | } else { |
47 | 47 | $this->argumentArray["timed"] = false; |
48 | 48 | } |
49 | | - |
50 | | - if ( isset( $argv["delay"] ) && is_numeric($argv["delay"]) ) { |
| 49 | + |
| 50 | + if ( isset( $argv["delay"] ) && is_numeric( $argv["delay"] ) ) { |
51 | 51 | $this->argumentArray["delay"] = $argv["delay"]; |
52 | 52 | } else { |
53 | 53 | $this->argumentArray["delay"] = "9000"; |
54 | 54 | } |
55 | | - |
| 55 | + |
56 | 56 | if ( isset( $argv["showarrows"] ) && $argv["showarrows"] == "false" ) { |
57 | 57 | $this->argumentArray["showarrows"] = false; |
58 | 58 | } else { |
59 | 59 | $this->argumentArray["showarrows"] = true; |
60 | 60 | } |
61 | | - |
| 61 | + |
62 | 62 | if ( isset( $argv["showinfopane"] ) && $argv["showinfopane"] == "false" ) { |
63 | 63 | $this->argumentArray["showinfopane"] = false; |
64 | 64 | } else { |
— | — | @@ -70,7 +70,7 @@ |
71 | 71 | $this->argumentArray["slideinfozoneslide"] = true; |
72 | 72 | } |
73 | 73 | |
74 | | - if ( isset( $argv["slideinfozoneopacity"] ) && is_numeric($argv["slideinfozoneopacity"]) ) { |
| 74 | + if ( isset( $argv["slideinfozoneopacity"] ) && is_numeric( $argv["slideinfozoneopacity"] ) ) { |
75 | 75 | $this->argumentArray["slideinfozoneopacity"] = $argv["slideinfozoneopacity"]; |
76 | 76 | } else { |
77 | 77 | $this->argumentArray["slideinfozoneopacity"] = "0.7"; |
— | — | @@ -81,64 +81,64 @@ |
82 | 82 | } else { |
83 | 83 | $this->argumentArray["fallback"] = "gallery"; |
84 | 84 | } |
85 | | - |
| 85 | + |
86 | 86 | if ( isset( $argv["nolink"] ) && $argv["nolink"] == "true" ) { |
87 | 87 | $this->argumentArray["nolink"] = true; |
88 | 88 | } else { |
89 | 89 | $this->argumentArray["nolink"] = false; |
90 | 90 | } |
91 | 91 | } |
92 | | - |
| 92 | + |
93 | 93 | function parseGalleries( $input, $parser ) { |
94 | 94 | $this->galleriesArray = Array(); |
95 | | - |
| 95 | + |
96 | 96 | if ( $this->set ) { |
97 | | - //This isn't currently working right, I need to enter |
98 | | - //a bug report with smooth gallery, so we'll leave |
99 | | - //the name alone for now. |
100 | | - #$this->galleriesArray["gallery_set_name"] = "MediaWikiSGallerySet" . mt_rand(); |
| 97 | + // This isn't currently working right, I need to enter |
| 98 | + // a bug report with smooth gallery, so we'll leave |
| 99 | + // the name alone for now. |
| 100 | + # $this->galleriesArray["gallery_set_name"] = "MediaWikiSGallerySet" . mt_rand(); |
101 | 101 | $this->galleriesArray["gallery_set_name"] = "MediaWikiSGallerySet"; |
102 | | - |
103 | | - //parse set into separate galleries |
| 102 | + |
| 103 | + // parse set into separate galleries |
104 | 104 | preg_match_all( "/<sgallery([\w]+)?[^>]*>(.*)<\/sgallery>/smU", $input, $galleries, PREG_SET_ORDER ); |
105 | | - |
106 | | - //iterate through galleries, call renderGallery on each, and |
107 | | - //collect the fallback output |
| 105 | + |
| 106 | + // iterate through galleries, call renderGallery on each, and |
| 107 | + // collect the fallback output |
108 | 108 | $i = 0; |
109 | 109 | foreach ( $galleries as $galleryInput ) { |
110 | | - //TOFIX: |
111 | | - //This couldn't possibly be right... If these are different |
112 | | - //galleries in a gallery set, shouldn't they have unique names? |
| 110 | + // TOFIX: |
| 111 | + // This couldn't possibly be right... If these are different |
| 112 | + // galleries in a gallery set, shouldn't they have unique names? |
113 | 113 | $name = "MediaWikiSGallery" . $i; |
114 | | - |
| 114 | + |
115 | 115 | $this->galleriesArray["galleries"][$i] = $this->parseGallery( $galleryInput[2], $parser ); |
116 | 116 | $this->galleriesArray["galleries"][$i]["gallery_name"] = $name; |
117 | | - |
| 117 | + |
118 | 118 | $i++; |
119 | 119 | } |
120 | 120 | } else { |
121 | 121 | $name = "MediaWikiSGallery" . mt_rand(); |
122 | | - |
123 | | - $this->galleriesArray["galleries"][0] = $this->parseGallery( $input, $parser); |
| 122 | + |
| 123 | + $this->galleriesArray["galleries"][0] = $this->parseGallery( $input, $parser ); |
124 | 124 | $this->galleriesArray["galleries"][0]["gallery_name"] = $name; |
125 | 125 | } |
126 | | - |
| 126 | + |
127 | 127 | return $this->galleriesArray; |
128 | 128 | } |
129 | | - |
| 129 | + |
130 | 130 | function parseGallery( $input, $parser ) { |
131 | 131 | global $wgTitle; |
132 | 132 | global $wgSmoothGalleryDelimiter; |
133 | 133 | global $wgSmoothGalleryAllowExternal; |
134 | | - |
| 134 | + |
135 | 135 | $galleryArray = Array(); |
136 | | - |
137 | | - //Expand templates in the input |
| 136 | + |
| 137 | + // Expand templates in the input |
138 | 138 | $input = $parser->recursiveTagParse( $input ); |
139 | | - |
140 | | - //The image array is a delimited list of images (strings) |
| 139 | + |
| 140 | + // The image array is a delimited list of images (strings) |
141 | 141 | $line_arr = preg_split( "/$wgSmoothGalleryDelimiter/", $input, -1, PREG_SPLIT_NO_EMPTY ); |
142 | | - |
| 142 | + |
143 | 143 | foreach ( $line_arr as $line ) { |
144 | 144 | $img_arr = explode( "|", $line, 2 ); |
145 | 145 | $img = $img_arr[0]; |
— | — | @@ -153,7 +153,7 @@ |
154 | 154 | ( strlen( $img ) >= 7 && substr( $img, 0, 8 ) == "https://" ) ) |
155 | 155 | ) { |
156 | 156 | $imageArray["title"] = null; |
157 | | - //TODO: internationalize |
| 157 | + // TODO: internationalize |
158 | 158 | $imageArray["heading"] = "External Image"; |
159 | 159 | $imageArray["description"] = $img_desc; |
160 | 160 | $imageArray["full_url"] = $img; |
— | — | @@ -167,16 +167,16 @@ |
168 | 168 | |
169 | 169 | continue; |
170 | 170 | } |
171 | | - |
| 171 | + |
172 | 172 | $title = Title::newFromText( $img, NS_IMAGE ); |
173 | | - |
174 | | - if ( is_null($title) ) { |
| 173 | + |
| 174 | + if ( is_null( $title ) ) { |
175 | 175 | $galleryArray["missing_images"][] = $title; |
176 | 176 | continue; |
177 | 177 | } |
178 | | - |
| 178 | + |
179 | 179 | $ns = $title->getNamespace(); |
180 | | - |
| 180 | + |
181 | 181 | if ( $ns == NS_IMAGE ) { |
182 | 182 | if ( $img_desc != '' ) { |
183 | 183 | $galleryArray = $this->parseImage( $title, $parser, $galleryArray, true ); |
— | — | @@ -187,7 +187,7 @@ |
188 | 188 | $galleryArray = $this->parseImage( $title, $parser, $galleryArray ); |
189 | 189 | } |
190 | 190 | } else if ( $ns == NS_CATEGORY ) { |
191 | | - //list images in category |
| 191 | + // list images in category |
192 | 192 | $cat_images = $this->smoothGalleryImagesByCat( $title ); |
193 | 193 | if ( $cat_images ) { |
194 | 194 | foreach ( $cat_images as $title ) { |
— | — | @@ -196,134 +196,134 @@ |
197 | 197 | } |
198 | 198 | } |
199 | 199 | } |
200 | | - |
| 200 | + |
201 | 201 | return $galleryArray; |
202 | 202 | } |
203 | | - |
204 | | - function parseImage( $title, $parser, $galleryArray, $getDescription=false ) { |
| 203 | + |
| 204 | + function parseImage( $title, $parser, $galleryArray, $getDescription = false ) { |
205 | 205 | global $wgUser; |
206 | 206 | global $wgSmoothGalleryThumbHeight, $wgSmoothGalleryThumbWidth; |
207 | | - |
| 207 | + |
208 | 208 | $imageArray = Array(); |
209 | | - |
210 | | - //Get the image object from the database |
| 209 | + |
| 210 | + // Get the image object from the database |
211 | 211 | $img_obj = wfFindFile( $title ); |
212 | | - |
| 212 | + |
213 | 213 | if ( !$img_obj ) { |
214 | | - //The user asked for an image that doesn't exist, let's |
215 | | - //add this to the list of missing objects |
| 214 | + // The user asked for an image that doesn't exist, let's |
| 215 | + // add this to the list of missing objects |
216 | 216 | $galleryArray["missing_images"][] = htmlspecialchars( $title->getDBkey() ); |
217 | | - |
| 217 | + |
218 | 218 | return $galleryArray; |
219 | 219 | } |
220 | | - |
221 | | - //check media type. Only images are supported |
| 220 | + |
| 221 | + // check media type. Only images are supported |
222 | 222 | $mtype = $img_obj->getMediaType(); |
223 | 223 | if ( $mtype != MEDIATYPE_DRAWING && $mtype != MEDIATYPE_BITMAP ) { |
224 | 224 | $galleryArray["invalid_images"][] = htmlspecialchars( $title->getDBkey() ); |
225 | | - |
| 225 | + |
226 | 226 | return $galleryArray; |
227 | 227 | } |
228 | | - |
229 | | - //Create a thumbnail the same size as our gallery so that |
230 | | - //full images fit correctly |
| 228 | + |
| 229 | + // Create a thumbnail the same size as our gallery so that |
| 230 | + // full images fit correctly |
231 | 231 | $full_thumb_obj = $img_obj->getThumbnail( $this->argumentArray["width"], $this->argumentArray["height"] ); |
232 | | - if ( !is_null($full_thumb_obj) ) { |
| 232 | + if ( !is_null( $full_thumb_obj ) ) { |
233 | 233 | $full_thumb = $full_thumb_obj->getUrl(); |
234 | 234 | } else { |
235 | 235 | $galleryArray["missing_images"][] = htmlspecialchars( $title->getDBkey() ); |
236 | | - |
| 236 | + |
237 | 237 | return $galleryArray; |
238 | 238 | } |
239 | | - |
| 239 | + |
240 | 240 | if ( $full_thumb == '' ) { |
241 | | - //The thumbnail we requested was larger than the image; |
242 | | - //we need to just provide the image |
| 241 | + // The thumbnail we requested was larger than the image; |
| 242 | + // we need to just provide the image |
243 | 243 | $full_thumb = $img_obj->getUrl(); |
244 | 244 | } |
245 | 245 | |
246 | 246 | $icon_thumb = ''; |
247 | 247 | if ( $this->argumentArray["carousel"] ) { |
248 | | - //We are going to show a carousel to the user; we need |
249 | | - //to make icon thumbnails |
250 | | - //$thumb_obj = $img_obj->getThumbnail( 120, 120 ); //would be nice to reuse images already loaded... |
| 248 | + // We are going to show a carousel to the user; we need |
| 249 | + // to make icon thumbnails |
| 250 | + // $thumb_obj = $img_obj->getThumbnail( 120, 120 ); //would be nice to reuse images already loaded... |
251 | 251 | $thumb_obj = $img_obj->getThumbnail( $wgSmoothGalleryThumbWidth, $wgSmoothGalleryThumbHeight ); |
252 | 252 | if ( $thumb_obj ) { |
253 | 253 | $icon_thumb = $thumb_obj->getUrl(); |
254 | 254 | } |
255 | 255 | else { |
256 | | - //The thumbnail we requested was larger than the image; |
257 | | - //we need to just provide the image |
| 256 | + // The thumbnail we requested was larger than the image; |
| 257 | + // we need to just provide the image |
258 | 258 | $icon_thumb = $img_obj->getUrl(); |
259 | 259 | } |
260 | 260 | } |
261 | | - |
| 261 | + |
262 | 262 | $fulldesc = ''; |
263 | | - |
| 263 | + |
264 | 264 | if ( $this->argumentArray["showinfopane"] ) { |
265 | 265 | if ( $getDescription ) { |
266 | | - //Load the image page from the database with the provided title from |
267 | | - //the image object |
| 266 | + // Load the image page from the database with the provided title from |
| 267 | + // the image object |
268 | 268 | $db = wfGetDB( DB_SLAVE ); |
269 | 269 | $img_rev = Revision::loadFromTitle( $db, $title ); |
270 | | - |
271 | | - //Get the text from the image page's description |
| 270 | + |
| 271 | + // Get the text from the image page's description |
272 | 272 | $fulldesc = $img_rev->getText(); |
273 | 273 | } |
274 | 274 | |
275 | | - //convert wikitext to HTML |
276 | | - //TODO: find out why this doesn't work with special pages |
| 275 | + // convert wikitext to HTML |
| 276 | + // TODO: find out why this doesn't work with special pages |
277 | 277 | if ( $parser ) { |
278 | 278 | $pout = $parser->recursiveTagParse( $fulldesc, $title, $parser->mOptions, true ); |
279 | 279 | $fulldesc = strip_tags( $pout ); |
280 | | - #$fulldesc = strip_tags( $pout->getText() ); |
281 | | - } else { //fall back to HTML-escaping |
| 280 | + # $fulldesc = strip_tags( $pout->getText() ); |
| 281 | + } else { // fall back to HTML-escaping |
282 | 282 | $fulldesc = htmlspecialchars( $fulldesc ); |
283 | 283 | } |
284 | 284 | } |
285 | | - |
| 285 | + |
286 | 286 | $skin = $wgUser->getSkin(); |
287 | | - |
288 | | - //Everything is checked, and converted; add to the array and return |
| 287 | + |
| 288 | + // Everything is checked, and converted; add to the array and return |
289 | 289 | $imageArray["title"] = $title; |
290 | | - |
| 290 | + |
291 | 291 | # We need the following for the image's div |
292 | | - $imageArray["heading"] = $skin->makeKnownLinkObj($img_obj->getTitle(), $img_obj->getName()); |
| 292 | + $imageArray["heading"] = $skin->makeKnownLinkObj( $img_obj->getTitle(), $img_obj->getName() ); |
293 | 293 | $imageArray["description"] = $fulldesc; |
294 | 294 | $imageArray["full_url"] = $title->getFullURL(); |
295 | 295 | $imageArray["view_url"] = $img_obj->getViewURL(); |
296 | 296 | $imageArray["full_thumb_url"] = $full_thumb; |
297 | 297 | $imageArray["icon_thumb_url"] = $icon_thumb; |
298 | | - |
| 298 | + |
299 | 299 | # We need the image object for plain galleries |
300 | 300 | $imageArray["image_object"] = $img_obj; |
301 | | - |
| 301 | + |
302 | 302 | $galleryArray["images"][] = $imageArray; |
303 | | - |
| 303 | + |
304 | 304 | return $galleryArray; |
305 | 305 | } |
306 | 306 | |
307 | 307 | function smoothGalleryImagesByCat( $title ) { |
308 | 308 | $name = $title->getDBkey(); |
309 | | - |
| 309 | + |
310 | 310 | $dbr = wfGetDB( DB_SLAVE ); |
311 | | - |
| 311 | + |
312 | 312 | list( $page, $categorylinks ) = $dbr->tableNamesN( 'page', 'categorylinks' ); |
313 | 313 | $sql = "SELECT page_namespace, page_title FROM $page " . |
314 | 314 | "JOIN $categorylinks ON cl_from = page_id " . |
315 | 315 | "WHERE cl_to = " . $dbr->addQuotes( $name ) . " " . |
316 | 316 | "AND page_namespace = " . NS_IMAGE . " " . |
317 | 317 | "ORDER BY cl_sortkey"; |
318 | | - |
| 318 | + |
319 | 319 | $images = array(); |
320 | 320 | $res = $dbr->query( $sql, 'smoothGalleryImagesByCat' ); |
321 | 321 | while ( $row = $dbr->fetchObject( $res ) ) { |
322 | 322 | $img = Title::makeTitle( $row->page_namespace, $row->page_title ); |
323 | | - |
| 323 | + |
324 | 324 | $images[] = $img; |
325 | 325 | } |
326 | | - $dbr->freeResult($res); |
327 | | - |
| 326 | + $dbr->freeResult( $res ); |
| 327 | + |
328 | 328 | return $images; |
329 | 329 | } |
330 | 330 | |
Index: trunk/extensions/SmoothGallery/README |
— | — | @@ -1,5 +1,11 @@ |
2 | | -This is an extension that integrates JonDesign's SmoothGallery, which is a set of Javascript and CSS that lets you make picture galleries. A number of features are available from SmoothGallery, and this extension aims to be an easy to use, and full featured integration with MediaWiki. JonDesign's SmoothGallery is released under the GPL. |
| 2 | +This is an extension that integrates JonDesign's SmoothGallery, which is a set |
| 3 | +of Javascript and CSS that lets you make picture galleries. A number of |
| 4 | +features are available from SmoothGallery, and this extension aims to be an |
| 5 | +easy to use, and full featured integration with MediaWiki. JonDesign's |
| 6 | +SmoothGallery is released under the GPL. |
3 | 7 | |
4 | | -For more information on the SmoothGallery javascript gallery, see: http://smoothgallery.jondesign.net/what |
| 8 | +For more information on the SmoothGallery javascript gallery, |
| 9 | +see: http://smoothgallery.jondesign.net/what |
5 | 10 | |
6 | | -For more information on the SmoothGallery extension, see: http://www.mediawiki.org/wiki/Extension:SmoothGallery |
| 11 | +For more information on the SmoothGallery extension, |
| 12 | +see: http://www.mediawiki.org/wiki/Extension:SmoothGallery |
Property changes on: trunk/extensions/SmoothGallery/README |
___________________________________________________________________ |
Added: svn:eol-style |
7 | 13 | + native |
Index: trunk/extensions/SmoothGallery/SmoothGallery.i18n.php |
— | — | @@ -395,14 +395,14 @@ |
396 | 396 | */ |
397 | 397 | $messages['km'] = array( |
398 | 398 | 'smoothgallery' => 'វិចិត្រសាលរាបស្មើ', |
399 | | - 'smoothgallery-desc' => 'អនុញ្ញាតឱ្យបង្កើតវិចិត្រសាលជាមួយរូបភាពដែលបានផ្ទុកឡើង។ |
| 399 | + 'smoothgallery-desc' => 'អនុញ្ញាតឱ្យបង្កើតវិចិត្រសាលជាមួយរូបភាពដែលបានផ្ទុកឡើង។ |
400 | 400 | |
401 | 401 | អនុញ្ញាតជម្រើសភាគច្រើននៃវិចិត្រសាលរាបស្មើ', |
402 | 402 | 'smoothgallery-title' => 'វិចិត្រសាលរាបស្មើ', |
403 | 403 | 'smoothgallery-smoothgallerytitle' => 'វិចិត្រសាលរាបស្មើ៖ $1', |
404 | 404 | 'smoothgallery-error' => 'កំហុសវិចិត្រសាលរាបស្មើ៖', |
405 | 405 | 'smoothgallery-gallery-not-found' => 'មិនមានវិចិត្រសាលដែលត្រូវបានស្នើ។', |
406 | | - 'smoothgallery-not-found' => 'មិនមានរូបភាពត្រូវបានបន្ថែមទៅក្នុងវិចិត្រសាលទេ។ |
| 406 | + 'smoothgallery-not-found' => 'មិនមានរូបភាពត្រូវបានបន្ថែមទៅក្នុងវិចិត្រសាលទេ។ |
407 | 407 | |
408 | 408 | សូមបន្ថែមរូបភាពយ៉ាងហោចមួយ។', |
409 | 409 | 'smoothgallery-javascript-disabled' => 'តម្រូវឱ្យមាន Javascript ដើម្បីមើលបានល្អវិចិត្រសាលនេះ។', |
— | — | @@ -451,7 +451,7 @@ |
452 | 452 | */ |
453 | 453 | $messages['mr'] = array( |
454 | 454 | 'smoothgallery' => 'मुलायमप्रेक्षा', |
455 | | - 'smoothgallery-desc' => 'उपयोगकर्त्यांना चढवलेल्या चित्रणांपासून दीर्घा(प्रेक्षा)बनवण्याकरिता अनुमति देते. |
| 455 | + 'smoothgallery-desc' => 'उपयोगकर्त्यांना चढवलेल्या चित्रणांपासून दीर्घा(प्रेक्षा)बनवण्याकरिता अनुमति देते. |
456 | 456 | मुलायमदिर्घा(प्रेक्षा) बनविण्याकरिता सर्वाधिक पर्याय उपलब्ध करून देते.', |
457 | 457 | 'smoothgallery-title' => 'मुलायमप्रेक्षा', |
458 | 458 | 'smoothgallery-smoothgallerytitle' => 'मुलायमप्रेक्षा $1', |
— | — | @@ -495,13 +495,13 @@ |
496 | 496 | */ |
497 | 497 | $messages['nn'] = array( |
498 | 498 | 'smoothgallery' => 'Jamnt galleri', |
499 | | - 'smoothgallery-desc' => 'Lèt brukarar oppretta galleri med bilete som er blitt lasta opp. |
| 499 | + 'smoothgallery-desc' => 'Lèt brukarar oppretta galleri med bilete som er blitt lasta opp. |
500 | 500 | Inneheld dei fleste av SmoothGallery sine valalternativ.', |
501 | 501 | 'smoothgallery-title' => 'Jamnt galleri', |
502 | 502 | 'smoothgallery-smoothgallerytitle' => 'Jamnt galleri: $1', |
503 | 503 | 'smoothgallery-error' => '<b>Feil med jamnt galleri:</b>', |
504 | 504 | 'smoothgallery-gallery-not-found' => 'Det etterspurde galleriet finst ikkje.', |
505 | | - 'smoothgallery-not-found' => 'Ingen bilete blei lagt til i galleriet. |
| 505 | + 'smoothgallery-not-found' => 'Ingen bilete blei lagt til i galleriet. |
506 | 506 | Legg til minst eitt bilete.', |
507 | 507 | 'smoothgallery-no-images' => 'Ingen bilete blei funne i dette galleriet. |
508 | 508 | Forsikra deg om at {{PLURAL:$3|biletet|bileta}} finst. |
— | — | @@ -555,7 +555,7 @@ |
556 | 556 | */ |
557 | 557 | $messages['pl'] = array( |
558 | 558 | 'smoothgallery' => 'Płynna galeria', |
559 | | - 'smoothgallery-desc' => 'Pozwala użytkownikom na tworzenie galerii przesłanych zdjęć. |
| 559 | + 'smoothgallery-desc' => 'Pozwala użytkownikom na tworzenie galerii przesłanych zdjęć. |
560 | 560 | Udostępnia większości opcji SmoothGallery', |
561 | 561 | 'smoothgallery-title' => 'Płynna galeria', |
562 | 562 | 'smoothgallery-smoothgallerytitle' => 'Płynna galeria: $1', |
Index: trunk/extensions/SmoothGallery/SmoothGallery.php |
— | — | @@ -26,20 +26,20 @@ |
27 | 27 | # sgallery Parser Function changes contributed by David Claughton <dave@eclecticdave.com> |
28 | 28 | # infopane sliding and opacity patch provided by David Claughton <dave@eclecticdave.com> |
29 | 29 | |
30 | | -if( !defined( 'MEDIAWIKI' ) ) |
| 30 | +if ( !defined( 'MEDIAWIKI' ) ) |
31 | 31 | die( -1 ); |
32 | 32 | |
33 | 33 | /** |
34 | 34 | * Add extension information to Special:Version |
35 | 35 | */ |
36 | 36 | $wgExtensionCredits['other'][] = array( |
37 | | - 'path' => __FILE__, |
38 | | - 'name' => 'SmoothGallery parser extension', |
39 | | - 'version' => '1.1d', |
40 | | - 'author' => 'Ryan Lane', |
41 | | - 'description' => 'Allows users to create galleries with images that have been uploaded. Allows most options of SmoothGallery', |
| 37 | + 'path' => __FILE__, |
| 38 | + 'name' => 'SmoothGallery parser extension', |
| 39 | + 'version' => '1.1d', |
| 40 | + 'author' => 'Ryan Lane', |
| 41 | + 'description' => 'Allows users to create galleries with images that have been uploaded. Allows most options of SmoothGallery', |
42 | 42 | 'descriptionmsg' => 'smoothgallery-desc', |
43 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:SmoothGallery', |
| 43 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:SmoothGallery', |
44 | 44 | ); |
45 | 45 | |
46 | 46 | $wgExtensionFunctions[] = "efSmoothGallery"; |
— | — | @@ -47,12 +47,12 @@ |
48 | 48 | $wgHooks['OutputPageParserOutput'][] = 'smoothGalleryParserOutput'; |
49 | 49 | $wgHooks['LanguageGetMagic'][] = 'smoothGalleryLanguageGetMagic'; |
50 | 50 | |
51 | | -$dir = dirname(__FILE__) . '/'; |
| 51 | +$dir = dirname( __FILE__ ) . '/'; |
52 | 52 | $wgExtensionMessagesFiles['SmoothGallery'] = $dir . 'SmoothGallery.i18n.php'; |
53 | 53 | $wgAutoloadClasses['SmoothGallery'] = $dir . 'SmoothGalleryClass.php'; |
54 | 54 | $wgAutoloadClasses['SmoothGalleryParser'] = $dir . 'SmoothGalleryParser.php'; |
55 | 55 | |
56 | | -//sane defaults. always initialize to avoid register_globals vulnerabilities |
| 56 | +// sane defaults. always initialize to avoid register_globals vulnerabilities |
57 | 57 | $wgSmoothGalleryDelimiter = "\n"; |
58 | 58 | $wgSmoothGalleryExtensionPath = $wgScriptPath . '/extensions/SmoothGallery'; |
59 | 59 | $wgSmoothGalleryAllowExternal = false; |
— | — | @@ -68,9 +68,10 @@ |
69 | 69 | $wgParser->setFunctionHook( 'sgallery', 'initSmoothGalleryPF' ); |
70 | 70 | } |
71 | 71 | |
| 72 | +// FIXME: split off to a hook file and use $wgHooks['ParserFirstCallInit'] to init tags |
72 | 73 | function initSmoothGalleryPF( &$parser ) { |
73 | 74 | global $wgSmoothGalleryDelimiter; |
74 | | - |
| 75 | + |
75 | 76 | $numargs = func_num_args(); |
76 | 77 | if ( $numargs < 2 ) { |
77 | 78 | $input = "#SmoothGallery: no arguments specified"; |
— | — | @@ -96,23 +97,23 @@ |
97 | 98 | $sKey = trim( $aParam[0] ); |
98 | 99 | $sVal = trim( $aParam[1] ); |
99 | 100 | |
100 | | - if ( $sKey != '' ){ |
| 101 | + if ( $sKey != '' ) { |
101 | 102 | $argv[$sKey] = $sVal; |
102 | 103 | } |
103 | 104 | } |
104 | 105 | |
105 | 106 | $output = initSmoothGallery( $input, $argv, $parser ); |
106 | | - return array( $output, 'noparse' => true, 'isHTML' => true); |
| 107 | + return array( $output, 'noparse' => true, 'isHTML' => true ); |
107 | 108 | } |
108 | 109 | |
109 | | -function initSmoothGallery( $input, $argv, &$parser, $calledAsSet=false ) { |
| 110 | +function initSmoothGallery( $input, $argv, &$parser, $calledAsSet = false ) { |
110 | 111 | $sgParser = new SmoothGalleryParser( $input, $argv, $parser, $calledAsSet ); |
111 | 112 | $sgGallery = new SmoothGallery(); |
112 | 113 | |
113 | 114 | $sgGallery->setParser( $parser ); |
114 | 115 | $sgGallery->setSet( $calledAsSet ); |
115 | 116 | $sgGallery->setArguments( $sgParser->getArguments() ); |
116 | | - $sgGallery->setGalleries( $sgParser->getGalleries() ); |
| 117 | + $sgGallery->setGalleries( $sgParser->getGalleries() ); |
117 | 118 | |
118 | 119 | $sgGallery->checkForErrors(); |
119 | 120 | if ( $sgGallery->hasErrors() ) { |
— | — | @@ -147,6 +148,6 @@ |
148 | 149 | * we are not using this feature |
149 | 150 | */ |
150 | 151 | function smoothGalleryLanguageGetMagic( &$magicWords, $langCode ) { |
151 | | - $magicWords['sgallery'] = array(0, 'sgallery'); |
| 152 | + $magicWords['sgallery'] = array( 0, 'sgallery' ); |
152 | 153 | return true; |
153 | 154 | } |