Merge "Http::getProxy() method to get proxy configuration"
[lhc/web/wiklou.git] / includes / logging / LogEventsList.php
index dcd7a45..039161a 100644 (file)
@@ -75,7 +75,7 @@ class LogEventsList extends ContextSource {
         * @param array $filter
         * @param string $tagFilter Tag to select by default
         */
-       public function showOptions( $types = array(), $user = '', $page = '', $pattern = '', $year = 0,
+       public function showOptions( $types = [], $user = '', $page = '', $pattern = '', $year = 0,
                $month = 0, $filter = null, $tagFilter = ''
        ) {
                global $wgScript, $wgMiserMode;
@@ -83,7 +83,7 @@ class LogEventsList extends ContextSource {
                $title = SpecialPage::getTitleFor( 'Log' );
 
                // For B/C, we take strings, but make sure they are converted...
-               $types = ( $types === '' ) ? array() : (array)$types;
+               $types = ( $types === '' ) ? [] : (array)$types;
 
                $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
 
@@ -120,7 +120,7 @@ class LogEventsList extends ContextSource {
                $html = Xml::fieldset( $this->msg( 'log' )->text(), $html );
 
                // Form wrapping
-               $html = Xml::tags( 'form', array( 'action' => $wgScript, 'method' => 'get' ), $html );
+               $html = Xml::tags( 'form', [ 'action' => $wgScript, 'method' => 'get' ], $html );
 
                $this->getOutput()->addHTML( $html );
        }
@@ -131,9 +131,9 @@ class LogEventsList extends ContextSource {
         */
        private function getFilterLinks( $filter ) {
                // show/hide links
-               $messages = array( $this->msg( 'show' )->escaped(), $this->msg( 'hide' )->escaped() );
+               $messages = [ $this->msg( 'show' )->escaped(), $this->msg( 'hide' )->escaped() ];
                // Option value -> message mapping
-               $links = array();
+               $links = [];
                $hiddens = ''; // keep track for "go" button
                foreach ( $filter as $type => $val ) {
                        // Should the below assignment be outside the foreach?
@@ -147,7 +147,7 @@ class LogEventsList extends ContextSource {
                        $link = Linker::linkKnown(
                                $this->getTitle(),
                                $messages[$hideVal],
-                               array(),
+                               [],
                                $query
                        );
 
@@ -184,7 +184,7 @@ class LogEventsList extends ContextSource {
                $selector = $this->getTypeSelector();
                $selector->setDefault( $queryType );
 
-               return $selector->getHtml();
+               return $selector->getHTML();
        }
 
        /**
@@ -193,7 +193,7 @@ class LogEventsList extends ContextSource {
         * @since 1.19
         */
        public function getTypeSelector() {
-               $typesByName = array(); // Temporary array
+               $typesByName = []; // Temporary array
                // First pass to load the log names
                foreach ( LogPage::validTypes() as $type ) {
                        $page = new LogPage( $type );
@@ -209,7 +209,7 @@ class LogEventsList extends ContextSource {
                // Always put "All public logs" on top
                $public = $typesByName[''];
                unset( $typesByName[''] );
-               $typesByName = array( '' => $public ) + $typesByName;
+               $typesByName = [ '' => $public ] + $typesByName;
 
                $select = new XmlSelect( 'type' );
                foreach ( $typesByName as $type => $name ) {
@@ -230,7 +230,7 @@ class LogEventsList extends ContextSource {
                        'mw-log-user',
                        15,
                        $user,
-                       array( 'class' => 'mw-autocomplete-user' )
+                       [ 'class' => 'mw-autocomplete-user' ]
                );
 
                return '<span class="mw-input-with-label">' . $label . '</span>';
@@ -279,7 +279,7 @@ class LogEventsList extends ContextSource {
                        } else {
                                // Allow extensions to add their own extra inputs
                                $input = '';
-                               Hooks::run( 'LogEventsListGetExtraInputs', array( $types[0], $this, &$input ) );
+                               Hooks::run( 'LogEventsListGetExtraInputs', [ $types[0], $this, &$input ] );
                                return $input;
                        }
                }
@@ -331,13 +331,17 @@ class LogEventsList extends ContextSource {
                $del = $this->getShowHideLinks( $row );
 
                // Any tags...
-               list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow( $row->ts_tags, 'logevent' );
+               list( $tagDisplay, $newClasses ) = ChangeTags::formatSummaryRow(
+                       $row->ts_tags,
+                       'logevent',
+                       $this->getContext()
+               );
                $classes = array_merge(
-                       array( 'mw-logline-' . $entry->getType() ),
+                       [ 'mw-logline-' . $entry->getType() ],
                        $newClasses
                );
 
-               return Html::rawElement( 'li', array( 'class' => $classes ),
+               return Html::rawElement( 'li', [ 'class' => $classes ],
                        "$del $time $action $comment $revert $tagDisplay" ) . "\n";
        }
 
@@ -358,7 +362,7 @@ class LogEventsList extends ContextSource {
                        return Xml::check(
                                'showhiderevisions',
                                false,
-                               array( 'name' => 'ids[' . $row->log_id . ']' )
+                               [ 'name' => 'ids[' . $row->log_id . ']' ]
                        );
                }
 
@@ -380,12 +384,12 @@ class LogEventsList extends ContextSource {
                                if ( $canHide && $this->flags & self::USE_CHECKBOXES && !$canViewThisSuppressedEntry ) {
                                        // If event was hidden from sysops
                                        if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
-                                               $del = Xml::check( 'deleterevisions', false, array( 'disabled' => 'disabled' ) );
+                                               $del = Xml::check( 'deleterevisions', false, [ 'disabled' => 'disabled' ] );
                                        } else {
                                                $del = Xml::check(
                                                        'showhiderevisions',
                                                        false,
-                                                       array( 'name' => 'ids[' . $row->log_id . ']' )
+                                                       [ 'name' => 'ids[' . $row->log_id . ']' ]
                                                );
                                        }
                                } else {
@@ -393,11 +397,11 @@ class LogEventsList extends ContextSource {
                                        if ( !self::userCan( $row, LogPage::DELETED_RESTRICTED, $user ) ) {
                                                $del = Linker::revDeleteLinkDisabled( $canHide );
                                        } else {
-                                               $query = array(
+                                               $query = [
                                                        'target' => SpecialPage::getTitleFor( 'Log', $row->log_type )->getPrefixedDBkey(),
                                                        'type' => 'logging',
                                                        'ids' => $row->log_id,
-                                               );
+                                               ];
                                                $del = Linker::revDeleteLink(
                                                        $query,
                                                        $entryIsSuppressed,
@@ -462,13 +466,13 @@ class LogEventsList extends ContextSource {
                                $user = $wgUser;
                        }
                        if ( $bitfield & LogPage::DELETED_RESTRICTED ) {
-                               $permissions = array( 'suppressrevision', 'viewsuppressed' );
+                               $permissions = [ 'suppressrevision', 'viewsuppressed' ];
                        } else {
-                               $permissions = array( 'deletedhistory' );
+                               $permissions = [ 'deletedhistory' ];
                        }
                        $permissionlist = implode( ', ', $permissions );
                        wfDebug( "Checking for $permissionlist due to $field match on $bitfield\n" );
-                       return call_user_func_array( array( $user, 'isAllowedAny' ), $permissions );
+                       return call_user_func_array( [ $user, 'isAllowedAny' ], $permissions );
                }
                return true;
        }
@@ -506,18 +510,18 @@ class LogEventsList extends ContextSource {
         * @return int Number of total log items (not limited by $lim)
         */
        public static function showLogExtract(
-               &$out, $types = array(), $page = '', $user = '', $param = array()
+               &$out, $types = [], $page = '', $user = '', $param = []
        ) {
-               $defaultParameters = array(
+               $defaultParameters = [
                        'lim' => 25,
-                       'conds' => array(),
+                       'conds' => [],
                        'showIfEmpty' => true,
-                       'msgKey' => array( '' ),
+                       'msgKey' => [ '' ],
                        'wrap' => "$1",
                        'flags' => 0,
                        'useRequestParams' => false,
                        'useMaster' => false,
-               );
+               ];
                # The + operator appends elements of remaining keys from the right
                # handed array to the left handed, whereas duplicated keys are NOT overwritten.
                $param += $defaultParameters;
@@ -530,7 +534,7 @@ class LogEventsList extends ContextSource {
                $flags = $param['flags'];
                $useRequestParams = $param['useRequestParams'];
                if ( !is_array( $msgKey ) ) {
-                       $msgKey = array( $msgKey );
+                       $msgKey = [ $msgKey ];
                }
 
                if ( $out instanceof OutputPage ) {
@@ -571,11 +575,11 @@ class LogEventsList extends ContextSource {
                                $dir = $context->getLanguage()->getDir();
                                $lang = $context->getLanguage()->getHtmlCode();
 
-                               $s = Xml::openElement( 'div', array(
+                               $s = Xml::openElement( 'div', [
                                        'class' => "mw-warning-with-logexcerpt mw-content-$dir",
                                        'dir' => $dir,
                                        'lang' => $lang,
-                               ) );
+                               ] );
 
                                if ( count( $msgKey ) == 1 ) {
                                        $s .= $context->msg( $msgKey[0] )->parseAsBlock();
@@ -589,12 +593,12 @@ class LogEventsList extends ContextSource {
                                $logBody .
                                $loglist->endLogEventsList();
                } elseif ( $showIfEmpty ) {
-                       $s = Html::rawElement( 'div', array( 'class' => 'mw-warning-logempty' ),
+                       $s = Html::rawElement( 'div', [ 'class' => 'mw-warning-logempty' ],
                                $context->msg( 'logempty' )->parse() );
                }
 
                if ( $numRows > $pager->mLimit ) { # Show "Full log" link
-                       $urlParam = array();
+                       $urlParam = [];
                        if ( $page instanceof Title ) {
                                $urlParam['page'] = $page->getPrefixedDBkey();
                        } elseif ( $page != '' ) {
@@ -606,7 +610,7 @@ class LogEventsList extends ContextSource {
                        }
 
                        if ( !is_array( $types ) ) { # Make it an array, if it isn't
-                               $types = array( $types );
+                               $types = [ $types ];
                        }
 
                        # If there is exactly one log type, we can link to Special:Log?type=foo
@@ -617,7 +621,7 @@ class LogEventsList extends ContextSource {
                        $s .= Linker::link(
                                SpecialPage::getTitleFor( 'Log' ),
                                $context->msg( 'log-fulllog' )->escaped(),
-                               array(),
+                               [],
                                $urlParam
                        );
                }
@@ -631,7 +635,7 @@ class LogEventsList extends ContextSource {
                }
 
                /* hook can return false, if we don't want the message to be emitted (Wikia BugId:7093) */
-               if ( Hooks::run( 'LogEventsListShowLogExtract', array( &$s, $types, $page, $user, $param ) ) ) {
+               if ( Hooks::run( 'LogEventsListShowLogExtract', [ &$s, $types, $page, $user, $param ] ) ) {
                        // $out can be either an OutputPage object or a String-by-reference
                        if ( $out instanceof OutputPage ) {
                                $out->addHTML( $s );
@@ -660,7 +664,7 @@ class LogEventsList extends ContextSource {
                }
 
                // Reset the array, clears extra "where" clauses when $par is used
-               $hiddenLogs = array();
+               $hiddenLogs = [];
 
                // Don't show private logs to unprivileged users
                foreach ( $wgLogRestrictions as $logType => $right ) {