Extension:GalleryTable
From Linux Web Expert
<translate> This extension stores its source code on a wiki page.</translate> <translate> Please be aware that this code may be unreviewed or maliciously altered.</translate> <translate> They may contain security holes, outdated interfaces that are no longer compatible etc.</translate> <translate> Note:</translate> <translate> No [[<tvar name=localisation>Special:MyLanguage/Localisation#Translation resources</tvar>|localisation]] updates are provided for this extension by <tvar name=twn>translatewiki.net </tvar>.</translate> |
This extension is incompatible with MediaWiki 1.39 or any later release! You are advised against using this extension on a live site.
|
<translate> This extension is currently not actively maintained!</translate> <translate> Although it may still work, any bug reports or feature requests will more than likely be ignored.</translate> |
GalleryTable Release status: unmaintained |
|
---|---|
Implementation | Tag |
Description | Displays a table-gallery |
Author(s) | RUNA (Runa_cgtalk) |
Latest version | 0.1 (March 2010) |
MediaWiki | tested on 1.10.2, 1.15.1 |
License | GPL |
Download | See the section labeled code below |
Quarterly downloads | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Public wikis using | Lua error in Module:Extension at line 172: bad argument #1 to 'inNamespace' (unrecognized namespace name 'skin'). |
Displays a table, divided by the specified number of columns. Table Cells are separated by a newline. The contents of the cell - wikitext.
Installation
To install this extension
- Create file in your /extension directory: GalleryTable.php (see #Code section)
- Add the following to LocalSettings.php :
require_once("$IP/extensions/GalleryTable.php");
Syntax
<gal cols="column number (default = 3)"> gallery cell 1 gallery cell 2 gallery cell 3 ... gallery cell n </gal>
Code
<?php
//Avoid unstubbing $wgParser on setHook() too early on modern (1.12+) MW versions, as per r35980
if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) {
$wgHooks['ParserFirstCallInit'][] = 'wfGalleryTable';
} else { // Otherwise do things the old fashioned way
$wgExtensionFunctions[] = 'wfGalleryTable';
}
function wfGalleryTable() {
global $wgParser;
$wgParser->setHook( "gal", "GalleryTable" );
return true;
}
function GalleryTable( $input, $argv, $parser, $frame ) {
global $wgScriptPath;
$cols = 3;
if (isset($argv['cols'])) {$cols = $argv['cols'];}
$cwidth = floor(100/$cols);
$output = "<table>";
$tdcontent = explode(chr(10), $input);
$count = count($tdcontent);
for ($i=1; $i<$count-1; $i++) {
if ($i % $cols == 1) {$output .= chr(10)."<tr>";}
$content = $parser->recursiveTagParse($tdcontent[$i]);
$output .= "<td width=\"".$cwidth."%\">".$content."</td>";
if ($i % $cols == 0) {$output .= "</tr>";}
}
if (($count-2) % $cols > 0) {
$output .= "<td colspan=\"".($cols - (($count-2) % $cols))."\"> </td></tr>"; }
$output .= "</table>";
return $output;
}
?>
Categories:
- Pages with script errors
- Pages with broken file links
- Extensions which host their code in-wiki
- Extensions incompatible with 1.39
- Unmaintained extensions
- Extensions without an image
- Tag extensions
- Extensions without a compatibility policy
- Extensions with manual MediaWiki version
- Extensions with unknown license
- ParserFirstCallInit extensions
- All extensions
- Extensions not in ExtensionJson