X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFeedWatchlist.php;h=af5b1afc28e5fb529ec00f94d9cf0845a2a73b78;hb=d1ac58cd85c46b5c9265ba479a45fd348c554064;hp=c841d830a9496dc1eaa62e5a90a679115164aaec;hpb=121d68243b36fdec06e70c73c4f6f5c04e9f6f23;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFeedWatchlist.php b/includes/api/ApiFeedWatchlist.php index c841d830a9..af5b1afc28 100644 --- a/includes/api/ApiFeedWatchlist.php +++ b/includes/api/ApiFeedWatchlist.php @@ -67,7 +67,7 @@ class ApiFeedWatchlist extends ApiBase { $endTime = wfTimestamp( TS_MW, time() - intval( $params['hours'] * 60 * 60 ) ); // Prepare parameters for nested request - $fauxReqArr = array( + $fauxReqArr = [ 'action' => 'query', 'meta' => 'siteinfo', 'siprop' => 'general', @@ -76,7 +76,7 @@ class ApiFeedWatchlist extends ApiBase { 'wldir' => 'older', // reverse order - from newest to oldest 'wlend' => $endTime, // stop at this time 'wllimit' => min( 50, $this->getConfig()->get( 'FeedLimit' ) ) - ); + ]; if ( $params['wlowner'] !== null ) { $fauxReqArr['wlowner'] = $params['wlowner']; @@ -112,8 +112,8 @@ class ApiFeedWatchlist extends ApiBase { $module = new ApiMain( $fauxReq ); $module->execute(); - $data = $module->getResult()->getResultData( array( 'query', 'watchlist' ) ); - $feedItems = array(); + $data = $module->getResult()->getResultData( [ 'query', 'watchlist' ] ); + $feedItems = []; foreach ( (array)$data as $key => $info ) { if ( ApiResult::isMetadataKey( $key ) ) { continue; @@ -176,20 +176,20 @@ class ApiFeedWatchlist extends ApiBase { $titleStr = $info['title']; $title = Title::newFromText( $titleStr ); - $curidParam = array(); + $curidParam = []; if ( !$title || $title->isExternal() ) { // Probably a formerly-valid title that's now conflicting with an // interwiki prefix or the like. if ( isset( $info['pageid'] ) ) { $title = Title::newFromID( $info['pageid'] ); - $curidParam = array( 'curid' => $info['pageid'] ); + $curidParam = [ 'curid' => $info['pageid'] ]; } if ( !$title || $title->isExternal() ) { return null; } } if ( isset( $info['revid'] ) ) { - $titleUrl = $title->getFullURL( array( 'diff' => $info['revid'] ) ); + $titleUrl = $title->getFullURL( [ 'diff' => $info['revid'] ] ); } else { $titleUrl = $title->getFullURL( $curidParam ); } @@ -233,34 +233,34 @@ class ApiFeedWatchlist extends ApiBase { public function getAllowedParams( $flags = 0 ) { $feedFormatNames = array_keys( $this->getConfig()->get( 'FeedClasses' ) ); - $ret = array( - 'feedformat' => array( + $ret = [ + 'feedformat' => [ ApiBase::PARAM_DFLT => 'rss', ApiBase::PARAM_TYPE => $feedFormatNames - ), - 'hours' => array( + ], + 'hours' => [ ApiBase::PARAM_DFLT => 24, ApiBase::PARAM_TYPE => 'integer', ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => 72, - ), + ], 'linktosections' => false, - ); + ]; - $copyParams = array( + $copyParams = [ 'allrev' => 'allrev', 'owner' => 'wlowner', 'token' => 'wltoken', 'show' => 'wlshow', 'type' => 'wltype', 'excludeuser' => 'wlexcludeuser', - ); + ]; if ( $flags ) { $wlparams = $this->getWatchlistModule()->getAllowedParams( $flags ); foreach ( $copyParams as $from => $to ) { $p = $wlparams[$from]; if ( !is_array( $p ) ) { - $p = array( ApiBase::PARAM_DFLT => $p ); + $p = [ ApiBase::PARAM_DFLT => $p ]; } if ( !isset( $p[ApiBase::PARAM_HELP_MSG] ) ) { $p[ApiBase::PARAM_HELP_MSG] = "apihelp-query+watchlist-param-$from"; @@ -286,12 +286,12 @@ class ApiFeedWatchlist extends ApiBase { } protected function getExamplesMessages() { - return array( + return [ 'action=feedwatchlist' => 'apihelp-feedwatchlist-example-default', 'action=feedwatchlist&allrev=&hours=6' => 'apihelp-feedwatchlist-example-all6hrs', - ); + ]; } public function getHelpUrls() {