X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiImageRotate.php;h=2b9935341b06aeee1c1ab55db2b28fab2cc6759e;hb=3f5717cac84199d4118a0e2b497f7e11d6d5320a;hp=7a544ec0e250989762d4382210a6cf6ed3b83d4d;hpb=67e70a2650ef1e90651c1478bf82270a9162ba66;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiImageRotate.php b/includes/api/ApiImageRotate.php index 7a544ec0e2..2b9935341b 100644 --- a/includes/api/ApiImageRotate.php +++ b/includes/api/ApiImageRotate.php @@ -34,10 +34,10 @@ class ApiImageRotate extends ApiBase { private static function addValues( array &$result, $values, $flag = null, $name = null ) { foreach ( $values as $val ) { if ( $val instanceof Title ) { - $v = array(); + $v = []; ApiQueryBase::addTitleInfo( $v, $val ); } elseif ( $name !== null ) { - $v = array( $name => $val ); + $v = [ $name => $val ]; } else { $v = $val; } @@ -54,13 +54,13 @@ class ApiImageRotate extends ApiBase { $params = $this->extractRequestParams(); $rotation = $params['rotation']; - $continuationManager = new ApiContinuationManager( $this, array(), array() ); + $continuationManager = new ApiContinuationManager( $this, [], [] ); $this->setContinuationManager( $continuationManager ); $pageSet = $this->getPageSet(); $pageSet->execute(); - $result = array(); + $result = []; self::addValues( $result, $pageSet->getInvalidTitlesAndReasons(), 'invalid' ); self::addValues( $result, $pageSet->getSpecialTitles(), 'special', 'title' ); @@ -69,14 +69,14 @@ class ApiImageRotate extends ApiBase { self::addValues( $result, $pageSet->getInterwikiTitlesAsResult() ); foreach ( $pageSet->getTitles() as $title ) { - $r = array(); + $r = []; $r['id'] = $title->getArticleID(); ApiQueryBase::addTitleInfo( $r, $title ); if ( !$title->exists() ) { $r['missing'] = true; } - $file = wfFindFile( $title, array( 'latest' => true ) ); + $file = wfFindFile( $title, [ 'latest' => true ] ); if ( !$file ) { $r['result'] = 'Failure'; $r['errormessage'] = 'File does not exist'; @@ -110,11 +110,11 @@ class ApiImageRotate extends ApiBase { $ext = strtolower( pathinfo( "$srcPath", PATHINFO_EXTENSION ) ); $tmpFile = TempFSFile::factory( 'rotate_', $ext ); $dstPath = $tmpFile->getPath(); - $err = $handler->rotate( $file, array( - "srcPath" => $srcPath, - "dstPath" => $dstPath, - "rotation" => $rotation - ) ); + $err = $handler->rotate( $file, [ + 'srcPath' => $srcPath, + 'dstPath' => $dstPath, + 'rotation' => $rotation + ] ); if ( !$err ) { $comment = wfMessage( 'rotate-comment' @@ -184,15 +184,15 @@ class ApiImageRotate extends ApiBase { } public function getAllowedParams( $flags = 0 ) { - $result = array( - 'rotation' => array( - ApiBase::PARAM_TYPE => array( '90', '180', '270' ), + $result = [ + 'rotation' => [ + ApiBase::PARAM_TYPE => [ '90', '180', '270' ], ApiBase::PARAM_REQUIRED => true - ), - 'continue' => array( + ], + 'continue' => [ ApiBase::PARAM_HELP_MSG => 'api-help-param-continue', - ), - ); + ], + ]; if ( $flags ) { $result += $this->getPageSet()->getFinalParams( $flags ); } @@ -205,12 +205,12 @@ class ApiImageRotate extends ApiBase { } protected function getExamplesMessages() { - return array( + return [ 'action=imagerotate&titles=File:Example.jpg&rotation=90&token=123ABC' => 'apihelp-imagerotate-example-simple', 'action=imagerotate&generator=categorymembers&gcmtitle=Category:Flip&gcmtype=file&' . 'rotation=180&token=123ABC' => 'apihelp-imagerotate-example-generator', - ); + ]; } }