$pager = new ProtectedPagesPager(
$this,
- array(),
+ [],
$type,
$level,
$ns,
) {
$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" .
* @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',
- )
+ ]
)
);
}
$max
) .
' ' .
- Xml::input( 'size', 9, $size, array( 'id' => 'wpsize' ) ) .
+ Xml::input( 'size', 9, $size, [ 'id' => 'wpsize' ] ) .
' ' .
Xml::label( $this->msg( 'pagesize' )->text(), 'wpsize' ) . "</span>\n";
}
* @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 ) {
return '<span class="mw-input-with-label">' .
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 ) ) . "</span>";
}
*/
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 ) {
return '<span class="mw-input-with-label">' .
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 ) ) . "</span>";
}
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;
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 );
// 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 ) {
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();
}
if ( $value === null ) {
$formatted = Html::rawElement(
'span',
- array( 'class' => 'mw-protectedpages-unknown' ),
+ [ 'class' => 'mw-protectedpages-unknown' ],
$this->msg( 'protectedpages-unknown-timestamp' )->escaped()
);
} else {
if ( !$title ) {
$formatted = Html::element(
'span',
- array( 'class' => 'mw-invalidtitle' ),
+ [ 'class' => 'mw-invalidtitle' ],
Linker::getInvalidTitleDescription(
$this->getContext(),
$row->page_namespace,
$formatted .= $this->getLanguage()->getDirMark() .
' ' . Html::rawElement(
'span',
- array( 'class' => 'mw-protectedpages-length' ),
+ [ 'class' => 'mw-protectedpages-length' ],
Linker::formatRevisionSize( $row->page_len )
);
}
$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()
);
}
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 {
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 ) {
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 {
$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',
'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() {