X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialProtectedpages.php;h=8e9636ea779108fd0468c7711c284ec9ac994fe5;hb=6e9b4f0e9ce4ccd6089c18b205065ef7fa077484;hp=7a82cd8a8892e5a5b4bfed551cc2063ad4f01850;hpb=2fd379fa95f223c6b3f3c8eff6de068eca9e1a1a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialProtectedpages.php b/includes/specials/SpecialProtectedpages.php index 7a82cd8a88..8e9636ea77 100644 --- a/includes/specials/SpecialProtectedpages.php +++ b/includes/specials/SpecialProtectedpages.php @@ -51,7 +51,7 @@ class SpecialProtectedpages extends SpecialPage { $pager = new ProtectedPagesPager( $this, - array(), + [], $type, $level, $ns, @@ -96,9 +96,9 @@ class SpecialProtectedpages extends SpecialPage { ) { $title = $this->getPageTitle(); - return Xml::openElement( 'form', array( 'method' => 'get', 'action' => wfScript() ) ) . + return Xml::openElement( 'form', [ 'method' => 'get', 'action' => wfScript() ] ) . Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', array(), $this->msg( 'protectedpages' )->text() ) . + Xml::element( 'legend', [], $this->msg( 'protectedpages' )->text() ) . Html::hidden( 'title', $title->getPrefixedDBkey() ) . "\n" . $this->getNamespaceMenu( $namespace ) . "\n" . $this->getTypeMenu( $type ) . "\n" . @@ -122,17 +122,17 @@ class SpecialProtectedpages extends SpecialPage { * @return string */ protected function getNamespaceMenu( $namespace = null ) { - return Html::rawElement( 'span', array( 'class' => 'mw-input-with-label' ), + return Html::rawElement( 'span', [ 'class' => 'mw-input-with-label' ], Html::namespaceSelector( - array( + [ 'selected' => $namespace, 'all' => '', 'label' => $this->msg( 'namespace' )->text() - ), array( + ], [ 'name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector', - ) + ] ) ); } @@ -200,7 +200,7 @@ class SpecialProtectedpages extends SpecialPage { $max ) . ' ' . - Xml::input( 'size', 9, $size, array( 'id' => 'wpsize' ) ) . + Xml::input( 'size', 9, $size, [ 'id' => 'wpsize' ] ) . ' ' . Xml::label( $this->msg( 'pagesize' )->text(), 'wpsize' ) . "\n"; } @@ -211,8 +211,8 @@ class SpecialProtectedpages extends SpecialPage { * @return string Formatted HTML */ protected function getTypeMenu( $pr_type ) { - $m = array(); // Temporary array - $options = array(); + $m = []; // Temporary array + $options = []; // First pass to load the log names foreach ( Title::getFilteredRestrictionTypes( true ) as $type ) { @@ -230,7 +230,7 @@ class SpecialProtectedpages extends SpecialPage { return '' . Xml::label( $this->msg( 'restriction-type' )->text(), $this->IdType ) . ' ' . Xml::tags( 'select', - array( 'id' => $this->IdType, 'name' => $this->IdType ), + [ 'id' => $this->IdType, 'name' => $this->IdType ], implode( "\n", $options ) ) . ""; } @@ -241,8 +241,8 @@ class SpecialProtectedpages extends SpecialPage { */ protected function getLevelMenu( $pr_level ) { // Temporary array - $m = array( $this->msg( 'restriction-level-all' )->text() => 0 ); - $options = array(); + $m = [ $this->msg( 'restriction-level-all' )->text() => 0 ]; + $options = []; // First pass to load the log names foreach ( $this->getConfig()->get( 'RestrictionLevels' ) as $type ) { @@ -262,7 +262,7 @@ class SpecialProtectedpages extends SpecialPage { return '' . Xml::label( $this->msg( 'restriction-level' )->text(), $this->IdLevel ) . ' ' . Xml::tags( 'select', - array( 'id' => $this->IdLevel, 'name' => $this->IdLevel ), + [ 'id' => $this->IdLevel, 'name' => $this->IdLevel ], implode( "\n", $options ) ) . ""; } @@ -279,7 +279,7 @@ class ProtectedPagesPager extends TablePager { public $mForm, $mConds; private $type, $level, $namespace, $sizetype, $size, $indefonly, $cascadeonly, $noredirect; - function __construct( $form, $conds = array(), $type, $level, $namespace, + function __construct( $form, $conds = [], $type, $level, $namespace, $sizetype = '', $size = 0, $indefonly = false, $cascadeonly = false, $noredirect = false ) { $this->mForm = $form; @@ -298,7 +298,7 @@ class ProtectedPagesPager extends TablePager { function preprocessResults( $result ) { # Do a link batch query $lb = new LinkBatch; - $userids = array(); + $userids = []; foreach ( $result as $row ) { $lb->add( $row->page_namespace, $row->page_title ); @@ -311,7 +311,7 @@ class ProtectedPagesPager extends TablePager { // fill LinkBatch with user page and user talk if ( count( $userids ) ) { $userCache = UserCache::singleton(); - $userCache->doQuery( $userids, array(), __METHOD__ ); + $userCache->doQuery( $userids, [], __METHOD__ ); foreach ( $userids as $userid ) { $name = $userCache->getProp( $userid, 'name' ); if ( $name !== false ) { @@ -327,15 +327,15 @@ class ProtectedPagesPager extends TablePager { function getFieldNames() { static $headers = null; - if ( $headers == array() ) { - $headers = array( + if ( $headers == [] ) { + $headers = [ 'log_timestamp' => 'protectedpages-timestamp', 'pr_page' => 'protectedpages-page', 'pr_expiry' => 'protectedpages-expiry', 'log_user' => 'protectedpages-performer', 'pr_params' => 'protectedpages-params', 'log_comment' => 'protectedpages-reason', - ); + ]; foreach ( $headers as $key => $val ) { $headers[$key] = $this->msg( $val )->text(); } @@ -362,7 +362,7 @@ class ProtectedPagesPager extends TablePager { if ( $value === null ) { $formatted = Html::rawElement( 'span', - array( 'class' => 'mw-protectedpages-unknown' ), + [ 'class' => 'mw-protectedpages-unknown' ], $this->msg( 'protectedpages-unknown-timestamp' )->escaped() ); } else { @@ -376,7 +376,7 @@ class ProtectedPagesPager extends TablePager { if ( !$title ) { $formatted = Html::element( 'span', - array( 'class' => 'mw-invalidtitle' ), + [ 'class' => 'mw-invalidtitle' ], Linker::getInvalidTitleDescription( $this->getContext(), $row->page_namespace, @@ -390,7 +390,7 @@ class ProtectedPagesPager extends TablePager { $formatted .= $this->getLanguage()->getDirMark() . ' ' . Html::rawElement( 'span', - array( 'class' => 'mw-protectedpages-length' ), + [ 'class' => 'mw-protectedpages-length' ], Linker::formatRevisionSize( $row->page_len ) ); } @@ -404,12 +404,12 @@ class ProtectedPagesPager extends TablePager { $changeProtection = Linker::linkKnown( $title, $this->msg( 'protect_change' )->escaped(), - array(), - array( 'action' => 'unprotect' ) + [], + [ 'action' => 'unprotect' ] ); $formatted .= ' ' . Html::rawElement( 'span', - array( 'class' => 'mw-protectedpages-actions' ), + [ 'class' => 'mw-protectedpages-actions' ], $this->msg( 'parentheses' )->rawParams( $changeProtection )->escaped() ); } @@ -420,7 +420,7 @@ class ProtectedPagesPager extends TablePager { if ( $row->log_timestamp === null ) { $formatted = Html::rawElement( 'span', - array( 'class' => 'mw-protectedpages-unknown' ), + [ 'class' => 'mw-protectedpages-unknown' ], $this->msg( 'protectedpages-unknown-performer' )->escaped() ); } else { @@ -446,7 +446,7 @@ class ProtectedPagesPager extends TablePager { break; case 'pr_params': - $params = array(); + $params = []; // Messages: restriction-level-sysop, restriction-level-autoconfirmed $params[] = $this->msg( 'restriction-level-' . $row->pr_level )->escaped(); if ( $row->pr_cascade ) { @@ -460,7 +460,7 @@ class ProtectedPagesPager extends TablePager { if ( $row->log_timestamp === null ) { $formatted = Html::rawElement( 'span', - array( 'class' => 'mw-protectedpages-unknown' ), + [ 'class' => 'mw-protectedpages-unknown' ], $this->msg( 'protectedpages-unknown-reason' )->escaped() ); } else { @@ -517,9 +517,9 @@ class ProtectedPagesPager extends TablePager { $conds[] = 'page_namespace=' . $this->mDb->addQuotes( $this->namespace ); } - return array( - 'tables' => array( 'page', 'page_restrictions', 'log_search', 'logging' ), - 'fields' => array( + return [ + 'tables' => [ 'page', 'page_restrictions', 'log_search', 'logging' ], + 'fields' => [ 'pr_id', 'page_namespace', 'page_title', @@ -532,21 +532,21 @@ class ProtectedPagesPager extends TablePager { 'log_user', 'log_comment', 'log_deleted', - ), + ], 'conds' => $conds, - 'join_conds' => array( - 'log_search' => array( - 'LEFT JOIN', array( + 'join_conds' => [ + 'log_search' => [ + 'LEFT JOIN', [ 'ls_field' => 'pr_id', 'ls_value = pr_id' - ) - ), - 'logging' => array( - 'LEFT JOIN', array( + ] + ], + 'logging' => [ + 'LEFT JOIN', [ 'ls_log_id = log_id' - ) - ) - ) - ); + ] + ] + ] + ]; } public function getTableClass() {