X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialPrefixindex.php;h=7bd98966d6e0835ad2d0ace7f5c030d9f948152f;hb=10de9847fbed73593641393c29868e0e7a68d309;hp=4548b634cde98494eac79d2435afefd55bf1e954;hpb=b51729f77074984d4db7ff12e6d864c358292ec3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialPrefixindex.php b/includes/specials/SpecialPrefixindex.php index 4548b634cd..7bd98966d6 100644 --- a/includes/specials/SpecialPrefixindex.php +++ b/includes/specials/SpecialPrefixindex.php @@ -36,6 +36,9 @@ class SpecialPrefixindex extends SpecialAllpages { protected $hideRedirects = false; + // number of columns in output table + protected $columns = 3; + // Inherit $maxPerPage function __construct() { @@ -44,7 +47,7 @@ class SpecialPrefixindex extends SpecialAllpages { /** * Entry point : initialise variables and call subfunctions. - * @param string $par becomes "FOO" when called like Special:Prefixindex/FOO (default null) + * @param string $par Becomes "FOO" when called like Special:Prefixindex/FOO (default null) */ function execute( $par ) { global $wgContLang; @@ -63,10 +66,11 @@ class SpecialPrefixindex extends SpecialAllpages { $namespace = (int)$ns; // if no namespace given, use 0 (NS_MAIN). $this->hideRedirects = $request->getBool( 'hideredirects', $this->hideRedirects ); $this->stripPrefix = $request->getBool( 'stripprefix', $this->stripPrefix ); + $this->columns = $request->getInt( 'columns', $this->columns ); $namespaces = $wgContLang->getNamespaces(); $out->setPageTitle( - ( $namespace > 0 && in_array( $namespace, array_keys( $namespaces ) ) ) + ( $namespace > 0 && array_key_exists( $namespace, $namespaces ) ) ? $this->msg( 'prefixindex-namespace', str_replace( '_', ' ', $namespaces[$namespace] ) ) : $this->msg( 'prefixindex' ) ); @@ -92,8 +96,8 @@ class SpecialPrefixindex extends SpecialAllpages { /** * HTML for the top form - * @param $namespace Integer: a namespace constant (default NS_MAIN). - * @param string $from dbKey we are starting listing at. + * @param int $namespace A namespace constant (default NS_MAIN). + * @param string $from DbKey we are starting listing at. * @return string */ protected function namespacePrefixForm( $namespace = NS_MAIN, $from = '' ) { @@ -149,9 +153,9 @@ class SpecialPrefixindex extends SpecialAllpages { } /** - * @param $namespace Integer, default NS_MAIN - * @param $prefix String - * @param string $from list all pages from this name (default FALSE) + * @param int $namespace Default NS_MAIN + * @param string $prefix + * @param string $from List all pages from this name (default FALSE) */ protected function showPrefixChunk( $namespace = NS_MAIN, $prefix, $from = null ) { global $wgContLang; @@ -166,7 +170,7 @@ class SpecialPrefixindex extends SpecialAllpages { if ( !$prefixList || !$fromList ) { $out = $this->msg( 'allpagesbadtitle' )->parseAsBlock(); - } elseif ( !in_array( $namespace, array_keys( $namespaces ) ) ) { + } elseif ( !array_key_exists( $namespace, $namespaces ) ) { // Show errormessage and reset to NS_MAIN $out = $this->msg( 'allpages-bad-ns', $namespace )->parse(); $namespace = NS_MAIN; @@ -203,7 +207,7 @@ class SpecialPrefixindex extends SpecialAllpages { $n = 0; if ( $res->numRows() > 0 ) { - $out = Xml::openElement( 'table', array( 'id' => 'mw-prefixindex-list-table' ) ); + $out = Xml::openElement( 'table', array( 'class' => 'mw-prefixindex-list-table' ) ); $prefixLength = strlen( $prefix ); while ( ( $n < $this->maxPerPage ) && ( $s = $res->fetchObject() ) ) { @@ -224,17 +228,17 @@ class SpecialPrefixindex extends SpecialAllpages { } else { $link = '[[' . htmlspecialchars( $s->page_title ) . ']]'; } - if ( $n % 3 == 0 ) { + if ( $n % $this->columns == 0 ) { $out .= ''; } $out .= "$link"; $n++; - if ( $n % 3 == 0 ) { + if ( $n % $this->columns == 0 ) { $out .= ''; } } - if ( $n % 3 != 0 ) { + if ( $n % $this->columns != 0 ) { $out .= ''; } @@ -265,6 +269,7 @@ class SpecialPrefixindex extends SpecialAllpages { 'prefix' => $prefix, 'hideredirects' => $this->hideRedirects, 'stripprefix' => $this->stripPrefix, + 'columns' => $this->columns, ); if ( $namespace || $prefix == '' ) {