Difference between revisions of "Extension:SuperGallery"
(Template code) |
(Extension works!) |
||
Line 13: | Line 13: | ||
'name' => 'Special:SuperGallery', | 'name' => 'Special:SuperGallery', | ||
'author' => '[http://www.organicdesign.co.nz/jack User:Jack]', | 'author' => '[http://www.organicdesign.co.nz/jack User:Jack]', | ||
− | 'description' => 'An | + | 'description' => 'An special page for creating a supergallery of galleries, made with [http://www.organicdesign.co.nz/Template:SpecialPage Template:SpecialPage].', |
'url' => 'http://www.organicdesign.co.nz/Extension:SuperGallery', | 'url' => 'http://www.organicdesign.co.nz/Extension:SuperGallery', | ||
'version' => SUPERGALLERY_VERSION | 'version' => SUPERGALLERY_VERSION | ||
Line 36: | Line 36: | ||
# Override SpecialPage::execute() | # Override SpecialPage::execute() | ||
− | # - $param is from the URL, eg Special: | + | # - $param is from the URL, eg Special:{{{name}}}/param |
function execute($param) { | function execute($param) { | ||
− | global $wgOut; | + | global $wgOut, $wgRequest; |
$this->setHeaders(); | $this->setHeaders(); | ||
$title = Title::makeTitle(NS_SPECIAL,'SuperGallery'); | $title = Title::makeTitle(NS_SPECIAL,'SuperGallery'); | ||
− | $wgOut->addWikiText(wfMsg(' | + | |
+ | # The $param is the number of text inputs to be replicated in the form | ||
+ | if (isset($param)) $par = $param; | ||
+ | |||
+ | # If posted, we want to keep $par from the previous execution so we extract data from the hidden field | ||
+ | else if ($wgRequest->getText('wpParam', "")) $par = $wgRequest->getText('wpParam', ""); | ||
+ | |||
+ | # A low default to encourage users to use the switch | ||
+ | else $par = 4; | ||
+ | |||
+ | # Extract any posted data | ||
+ | $posted = $wgRequest->getText('wpSubmit', false); | ||
+ | |||
+ | # Extract any contents of fields | ||
+ | $width = $wgRequest->getText('wpWidth', ""); | ||
+ | $height = $wgRequest->getText('wpHeight', ""); | ||
+ | $column = $wgRequest->getText('wpColumn', ""); | ||
+ | $border = $wgRequest->getText('wpBorder', ""); | ||
+ | $tablemargin = $wgRequest->getText('wpTableMargin', ""); | ||
+ | $bordercolor = $wgRequest->getText('wpBorderColor', ""); | ||
+ | $backgroundcolor = $wgRequest->getText('wpBackgroundColor', ""); | ||
+ | $cellpadding = $wgRequest->getText('wpCellPadding', ""); | ||
+ | |||
+ | # Render the form | ||
+ | $wgOut->addWikiText(wfMsg('supergalleryMessage', 'supergalleryParameter')); | ||
$wgOut->addHTML( | $wgOut->addHTML( | ||
− | + | wfElement('form', array('action' => $title->getLocalURL('action=submit'), 'method' => 'post'), null) | |
− | + | . "<br /><p><b>Usage</b></p> | |
− | . wfElement('input',array('type' => 'submit')) | + | <p>Fill out the form below for each gallery you want to include.</p> |
− | . '</ | + | <p>This extension defaults to four pairs of gallery inputs, unless the number of galleries in your intended supergallery is passed as this page's parameter, for example for five galleries: |
+ | <pre>http://localhost/wiki/index.php/Special:SuperGallery/5</pre></p> | ||
+ | <p>The galleries you link to can be made normally using the gallery tag.</p> | ||
+ | <p>Here is the expected form of the picture url and the article link: | ||
+ | <pre>http://localhost/wiki/images/d/de/Boat.jpg | ||
+ | |||
+ | [[Pictures_of_Auckland|Pictures of Auckland]]</pre></p> | ||
+ | <p>Press the Submit Query button, then copy and paste the result below into the edit box of a new supergallery page.</p> | ||
+ | <br/ > | ||
+ | <p><b>Page Setup</b></p> | ||
+ | <p>How many columns do you want the supergallery to have (up to 3)? If you leave the field empty it is 2.</p> | ||
+ | <input name='wpColumn' size = '10' /> | ||
+ | <p>How wide do you want each thumbnail to be? Empty field is 150.</p> | ||
+ | <input name='wpWidth' size = '10' /> | ||
+ | <p>How high do you want each thumbnail's box to be? Empty field is 250.</p> | ||
+ | <input name='wpHeight' size = '10' /> | ||
+ | <p>How wide do you want the supergallery's border to be? Empty field is 1. No border is 0.</p> | ||
+ | <input name='wpBorder' size = '10' /> | ||
+ | <p>What color do you want the supergallery's border to be? Empty field is #cccccc.</p> | ||
+ | <input name='wpBorderColor' size = '10' /> | ||
+ | <p>What do you want the supergallery's margin to be? Empty field is 2.</p> | ||
+ | <input name='wpTableMargin' size = '10' /> | ||
+ | <p>How much cellpadding to you want? Empty field is 20.</p> | ||
+ | <input name='wpCellPadding' size = '10' /> | ||
+ | <p>What color do you want the supergallery's background to be? Empty field is #ffffff.</p> | ||
+ | <input name='wpBackgroundColor' size = '10' /> | ||
+ | <input type='hidden' name='wpParam' value=$par><br /><br />" | ||
+ | ); | ||
+ | |||
+ | # Render multiple inputs using the /$par from the url | ||
+ | for ($ctr = 1; $ctr <= $par; $ctr++) { | ||
+ | $wgOut->addHTML( | ||
+ | "<p><b>Gallery " . $ctr ."</b></p> | ||
+ | <p>The full URL of the image you want for the thumbnail.</p> | ||
+ | <input name='wpUrl" . $ctr . "' size = '50' /> | ||
+ | <p>The caption for this gallery, which is also its link.</p> | ||
+ | <input name='wpCaption" . $ctr . "' size = '50' />" | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | # Post | ||
+ | $wgOut->addHTML( | ||
+ | "<br /><br />" | ||
+ | . wfElement('input', array('name' => 'wpSubmit', 'type' => 'submit')) | ||
+ | . "</form><br /><p>After submitting, copy and paste all the generated code below into the edit box of your new supergallery page.</p>" | ||
+ | ); | ||
+ | |||
+ | # Process results if data posted | ||
+ | if ($posted) { | ||
+ | # Defaults for posted style elements | ||
+ | if ($width == "") $width = 150; | ||
+ | if ($height == "") $height = 250; | ||
+ | if ($column == "") $column = 2; | ||
+ | if ($border == "") $border = 1; | ||
+ | if ($tablemargin == "") $tablemargin = 2; | ||
+ | if ($bordercolor == "") $bordercolor = "#cccccc"; | ||
+ | if ($backgroundcolor == "") $backgroundcolor = "#ffffff"; | ||
+ | if ($cellpadding == "") $cellpadding = 10; | ||
+ | |||
+ | # Table css | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><html> | ||
+ | <style type='text/css'> | ||
+ | table.supergallery { | ||
+ | border: " . $border . "px solid " . $bordercolor . "; | ||
+ | margin: " . $tablemargin . "px; | ||
+ | padding: " . $tablemargin . "px; | ||
+ | background-color: " . $backgroundcolor ."; | ||
+ | } | ||
+ | </style></html></pre>" | ||
+ | ); | ||
+ | |||
+ | # Some arrays to populate with loops | ||
+ | $url[] = array(); | ||
+ | $image[] = array(); | ||
+ | $bkpre[] = array(); | ||
+ | |||
+ | # Make some URL variables out of the posted fields | ||
+ | for ($n = 1; $n <= $par; $n++) { | ||
+ | $url[$n] = $wgRequest->getText('wpUrl' . $n, ""); | ||
+ | } | ||
+ | for ($w = 1; $w <= $par; $w++) { | ||
+ | |||
+ | $image[$w] = preg_replace ('%(.*/images/)(.*/)(.*)(\.)(.*)%','\3\4\5',trim($url[$w])); | ||
+ | $bkpre[$w] = preg_replace ('%(.*/images/)(.*/)(.*)(\.)(.*)%','\1thumb/\2\3\4\5/',trim($url[$w])); | ||
+ | |||
+ | # No point in setting up css for empty fields | ||
+ | if ($url[$w] != "") { | ||
+ | |||
+ | # Set up rightsized thumbs silently by using the wiki thumbnail renderer. | ||
+ | # These are used as backgrounds for the gallery cells. | ||
+ | $wgOut->addWikiText( | ||
+ | "<div style='display:none'>[[Image:" . $image[$w] . "|" . $width . "px]]</div>" | ||
+ | ); | ||
+ | |||
+ | # Set up css for the backgrounds | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><html><style type='text/css'>.sgclass" | ||
+ | . $w . "{ | ||
+ | background:url(" . $bkpre[$w] . $width . "px-" . $image[$w] . ") | ||
+ | center center no-repeat} | ||
+ | </style> | ||
+ | </html></pre>" | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | # Render table code for copying | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><table cellpadding='" . $cellpadding . "' class ='supergallery'></pre>" | ||
+ | ); | ||
+ | if ($column == 1) { | ||
+ | for ($j = 1; $j <= $par; $j++) { | ||
+ | $captionname = "wpCaption" . $j; | ||
+ | $caption = $wgRequest->getText($captionname, ""); | ||
+ | if ($caption != "") { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><tr valign = 'center'> | ||
+ | <td class = 'sgclass" . $j . "' height = '" . $height . "' width = '" . $width . "'> | ||
+ | </td></tr> | ||
+ | <tr valign = 'center'> | ||
+ | <td><center>$caption</center> | ||
+ | </td></tr> | ||
+ | </pre>" | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | else if ($column == 2) { | ||
+ | $k = 1; | ||
+ | while ($k <= $par) { | ||
+ | $m = $k; | ||
+ | $captionname = "wpCaption" . $m; | ||
+ | $caption = $wgRequest->getText($captionname, ""); | ||
+ | if ($caption != "") { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><tr valign = 'center'> | ||
+ | <td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $k++; | ||
+ | if ($k <= $par) { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $k++; | ||
+ | } | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre></tr></pre>" | ||
+ | ); | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><tr valign = 'center'> | ||
+ | <td><center>$caption</center> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $m++; | ||
+ | } | ||
+ | if ($m <= $par) { | ||
+ | $captionname = "wpCaption" . $m; | ||
+ | $caption = $wgRequest->getText($captionname, ""); | ||
+ | if ($caption != "") { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre> | ||
+ | <td><center>$caption</center> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | $m++; | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre></tr> | ||
+ | </pre>" | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | else { | ||
+ | $k = 1; | ||
+ | while ($k <= $par) { | ||
+ | $m = $k; | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><tr valign = 'center'> | ||
+ | <td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $k++; | ||
+ | |||
+ | if ($k <= $par) { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $k++; | ||
+ | } | ||
+ | if ($k <= $par) { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $k++; | ||
+ | } | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre></tr></pre>" | ||
+ | ); | ||
+ | $captionname = "wpCaption" . $m; | ||
+ | $caption = $wgRequest->getText($captionname, ""); | ||
+ | if ($caption != "") { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre><tr valign = 'center'> | ||
+ | <td><center>$caption</center> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | $m++; | ||
+ | } | ||
+ | if ($m <= $par) { | ||
+ | $captionname = "wpCaption" . $m; | ||
+ | $caption = $wgRequest->getText($captionname, ""); | ||
+ | if ($caption != "") { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre> | ||
+ | <td><center>$caption</center> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | $m++; | ||
+ | if ($m <= $par) { | ||
+ | $captionname = "wpCaption" . $m; | ||
+ | $caption = $wgRequest->getText($captionname, ""); | ||
+ | if ($caption != "") { | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre> | ||
+ | <td><center>$caption</center> | ||
+ | </td></pre>" | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | } | ||
+ | $m++; | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre></tr> | ||
+ | </pre>" | ||
+ | ); | ||
+ | } | ||
+ | } | ||
+ | $wgOut->addWikiText( | ||
+ | "<pre></table></pre>" | ||
); | ); | ||
} | } | ||
− | |||
} | } | ||
+ | } | ||
# Called from $wgExtensionFunctions array when initialising extensions | # Called from $wgExtensionFunctions array when initialising extensions | ||
Line 59: | Line 330: | ||
if ($wgLanguageCode == 'en') { | if ($wgLanguageCode == 'en') { | ||
$wgMessageCache->addMessages(array( | $wgMessageCache->addMessages(array( | ||
− | + | 'supergallery' => 'SuperGallery Specialpage', # The friendly page title | |
− | + | 'supergalleryMessage' => "SuperGallery: <tt>Use this page to create a supergallery of galleries</tt>",) | |
− | + | ); | |
− | + | } | |
# Add the specialpage to the environment | # Add the specialpage to the environment | ||
SpecialPage::addPage(new SpecialSuperGallery()); | SpecialPage::addPage(new SpecialSuperGallery()); | ||
− | + | } |
Revision as of 21:38, 2 December 2008
<?php
- Extension:SuperGallery
Template:PhpCategory:Extensions created with Template:SpecialPage
- - Licenced under LGPL (http://www.gnu.org/copyleft/lesser.html)
- - Author: User:Jack
if (!defined('MEDIAWIKI')) die('Not an entry point.');
define('SUPERGALLERY_VERSION','1.0.0, 2008-11-28');
$wgExtensionFunctions[] = 'wfSetupSuperGallery';
$wgExtensionCredits['specialpage'][] = array( 'name' => 'Special:SuperGallery', 'author' => 'User:Jack', 'description' => 'An special page for creating a supergallery of galleries, made with Template:SpecialPage.', 'url' => 'http://www.organicdesign.co.nz/Extension:SuperGallery', 'version' => SUPERGALLERY_VERSION );
require_once "$IP/includes/SpecialPage.php";
- Define a new class based on the SpecialPage class
class SpecialSuperGallery extends SpecialPage {
# Constructor function __construct() { SpecialPage::SpecialPage( 'SuperGallery', # name as seen in links etc 'sysop', # user rights required true, # listed in special:specialpages false, # function called by execute() - defaults to wfSpecial{$name} false, # file included by execute() - defaults to Special{$name}.php, only used if no function false # includable ); }
# Override SpecialPage::execute() # - $param is from the URL, eg Special:{{{name}}}/param function execute($param) { global $wgOut, $wgRequest; $this->setHeaders(); $title = Title::makeTitle(NS_SPECIAL,'SuperGallery');
# The $param is the number of text inputs to be replicated in the form if (isset($param)) $par = $param;
# If posted, we want to keep $par from the previous execution so we extract data from the hidden field else if ($wgRequest->getText('wpParam', "")) $par = $wgRequest->getText('wpParam', "");
# A low default to encourage users to use the switch else $par = 4;
# Extract any posted data $posted = $wgRequest->getText('wpSubmit', false);
# Extract any contents of fields $width = $wgRequest->getText('wpWidth', ""); $height = $wgRequest->getText('wpHeight', ""); $column = $wgRequest->getText('wpColumn', ""); $border = $wgRequest->getText('wpBorder', ""); $tablemargin = $wgRequest->getText('wpTableMargin', ""); $bordercolor = $wgRequest->getText('wpBorderColor', ""); $backgroundcolor = $wgRequest->getText('wpBackgroundColor', ""); $cellpadding = $wgRequest->getText('wpCellPadding', "");
# Render the form $wgOut->addWikiText(wfMsg('supergalleryMessage', 'supergalleryParameter')); $wgOut->addHTML( wfElement('form', array('action' => $title->getLocalURL('action=submit'), 'method' => 'post'), null)
. "
Usage
Fill out the form below for each gallery you want to include.
This extension defaults to four pairs of gallery inputs, unless the number of galleries in your intended supergallery is passed as this page's parameter, for example for five galleries:
http://localhost/wiki/index.php/Special:SuperGallery/5
The galleries you link to can be made normally using the gallery tag.
Here is the expected form of the picture url and the article link:
http://localhost/wiki/images/d/de/Boat.jpg [[Pictures_of_Auckland|Pictures of Auckland]]
Press the Submit Query button, then copy and paste the result below into the edit box of a new supergallery page.
Page Setup
How many columns do you want the supergallery to have (up to 3)? If you leave the field empty it is 2.
<input name='wpColumn' size = '10' />
How wide do you want each thumbnail to be? Empty field is 150.
<input name='wpWidth' size = '10' />
How high do you want each thumbnail's box to be? Empty field is 250.
<input name='wpHeight' size = '10' />
How wide do you want the supergallery's border to be? Empty field is 1. No border is 0.
<input name='wpBorder' size = '10' />
What color do you want the supergallery's border to be? Empty field is #cccccc.
<input name='wpBorderColor' size = '10' />
What do you want the supergallery's margin to be? Empty field is 2.
<input name='wpTableMargin' size = '10' />
How much cellpadding to you want? Empty field is 20.
<input name='wpCellPadding' size = '10' />
What color do you want the supergallery's background to be? Empty field is #ffffff.
<input name='wpBackgroundColor' size = '10' />
<input type='hidden' name='wpParam' value=$par>
"
);
# Render multiple inputs using the /$par from the url for ($ctr = 1; $ctr <= $par; $ctr++) { $wgOut->addHTML(
"
Gallery " . $ctr ."
The full URL of the image you want for the thumbnail.
<input name='wpUrl" . $ctr . "' size = '50' />
The caption for this gallery, which is also its link.
<input name='wpCaption" . $ctr . "' size = '50' />" ); }
# Post
$wgOut->addHTML(
"
"
. wfElement('input', array('name' => 'wpSubmit', 'type' => 'submit'))
. "</form>
After submitting, copy and paste all the generated code below into the edit box of your new supergallery page.
"
);
# Process results if data posted if ($posted) { # Defaults for posted style elements if ($width == "") $width = 150; if ($height == "") $height = 250; if ($column == "") $column = 2; if ($border == "") $border = 1; if ($tablemargin == "") $tablemargin = 2; if ($bordercolor == "") $bordercolor = "#cccccc"; if ($backgroundcolor == "") $backgroundcolor = "#ffffff"; if ($cellpadding == "") $cellpadding = 10;
# Table css $wgOut->addWikiText(
"
<html> <style type='text/css'> table.supergallery { border: " . $border . "px solid " . $bordercolor . "; margin: " . $tablemargin . "px; padding: " . $tablemargin . "px; background-color: " . $backgroundcolor ."; } </style></html>
"
);
# Some arrays to populate with loops $url[] = array(); $image[] = array(); $bkpre[] = array();
# Make some URL variables out of the posted fields for ($n = 1; $n <= $par; $n++) { $url[$n] = $wgRequest->getText('wpUrl' . $n, ""); } for ($w = 1; $w <= $par; $w++) {
$image[$w] = preg_replace ('%(.*/images/)(.*/)(.*)(\.)(.*)%','\3\4\5',trim($url[$w])); $bkpre[$w] = preg_replace ('%(.*/images/)(.*/)(.*)(\.)(.*)%','\1thumb/\2\3\4\5/',trim($url[$w]));
# No point in setting up css for empty fields if ($url[$w] != "") {
# Set up rightsized thumbs silently by using the wiki thumbnail renderer. # These are used as backgrounds for the gallery cells. $wgOut->addWikiText(
"
"
);
# Set up css for the backgrounds $wgOut->addWikiText(
"
<html><style type='text/css'>.sgclass" . $w . "{ background:url(" . $bkpre[$w] . $width . "px-" . $image[$w] . ") center center no-repeat} </style> </html>
"
); } }
# Render table code for copying $wgOut->addWikiText(
"
<table cellpadding='" . $cellpadding . "' class ='supergallery'>
"
); if ($column == 1) { for ($j = 1; $j <= $par; $j++) { $captionname = "wpCaption" . $j; $caption = $wgRequest->getText($captionname, ""); if ($caption != "") { $wgOut->addWikiText(
"
<tr valign = 'center'> <td class = 'sgclass" . $j . "' height = '" . $height . "' width = '" . $width . "'> </td></tr> <tr valign = 'center'> <td><center>$caption</center> </td></tr>
"
); } } } else if ($column == 2) { $k = 1; while ($k <= $par) { $m = $k; $captionname = "wpCaption" . $m; $caption = $wgRequest->getText($captionname, ""); if ($caption != "") { $wgOut->addWikiText(
"
<tr valign = 'center'> <td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> </td>
"
); $k++; if ($k <= $par) { $wgOut->addWikiText(
"
<td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> </td>
"
); $k++; } $wgOut->addWikiText(
"
</tr>
"
); $wgOut->addWikiText(
"
<tr valign = 'center'> <td><center>$caption</center> </td>
"
); $m++; } if ($m <= $par) { $captionname = "wpCaption" . $m; $caption = $wgRequest->getText($captionname, ""); if ($caption != "") { $wgOut->addWikiText(
"
<td><center>$caption</center> </td>
"
); } } $m++; $wgOut->addWikiText(
"
</tr>
"
); } } else { $k = 1; while ($k <= $par) { $m = $k; $wgOut->addWikiText(
"
<tr valign = 'center'> <td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> </td>
"
); $k++;
if ($k <= $par) { $wgOut->addWikiText(
"
<td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> </td>
"
); $k++; } if ($k <= $par) { $wgOut->addWikiText(
"
<td class = 'sgclass" . $k . "' height = '" . $height . "' width = '" . $width . "'> </td>
"
); $k++; } $wgOut->addWikiText(
"
</tr>
"
); $captionname = "wpCaption" . $m; $caption = $wgRequest->getText($captionname, ""); if ($caption != "") { $wgOut->addWikiText(
"
<tr valign = 'center'> <td><center>$caption</center> </td>
"
); $m++; } if ($m <= $par) { $captionname = "wpCaption" . $m; $caption = $wgRequest->getText($captionname, ""); if ($caption != "") { $wgOut->addWikiText(
"
<td><center>$caption</center> </td>
"
); }
} $m++; if ($m <= $par) { $captionname = "wpCaption" . $m; $caption = $wgRequest->getText($captionname, ""); if ($caption != "") { $wgOut->addWikiText(
"
<td><center>$caption</center> </td>
"
); }
} $m++; $wgOut->addWikiText(
"
</tr>
"
); } } $wgOut->addWikiText(
"
</table>
"
); } } }
- Called from $wgExtensionFunctions array when initialising extensions
function wfSetupSuperGallery() { global $wgLanguageCode,$wgMessageCache;
# Add the messages used by the specialpage if ($wgLanguageCode == 'en') { $wgMessageCache->addMessages(array( 'supergallery' => 'SuperGallery Specialpage', # The friendly page title 'supergalleryMessage' => "SuperGallery: Use this page to create a supergallery of galleries",) ); }
# Add the specialpage to the environment SpecialPage::addPage(new SpecialSuperGallery()); }