more accurate documentation for addValue() method
[lhc/web/wiklou.git] / includes / api / ApiQueryAllimages.php
index fbfdeca..bdb819d 100644 (file)
@@ -109,13 +109,13 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
 
                $sha1 = false;
                if ( isset( $params['sha1'] ) ) {
-                       if ( !self::validateSha1Hash( $params['sha1'] ) ) {
+                       if ( !$this->validateSha1Hash( $params['sha1'] ) ) {
                                $this->dieUsage( 'The SHA1 hash provided is not valid', 'invalidsha1hash' );
                        }
                        $sha1 = wfBaseConvert( $params['sha1'], 16, 36, 31 );
                } elseif ( isset( $params['sha1base36'] ) ) {
                        $sha1 = $params['sha1base36'];
-                       if ( !self::validateSha1Base36Hash( $sha1 ) ) {
+                       if ( !$this->validateSha1Base36Hash( $sha1 ) ) {
                                $this->dieUsage( 'The SHA1Base36 hash provided is not valid', 'invalidsha1base36hash' );
                        }
                }
@@ -162,8 +162,8 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                                $file = $repo->newFileFromRow( $row );
                                $info = array_merge( array( 'name' => $row->img_name ),
                                        ApiQueryImageInfo::getInfo( $file, $prop, $result ) );
-                               self::addTitleInfo( $info, $file->getTitle() ); 
-                                       
+                               self::addTitleInfo( $info, $file->getTitle() );
+
                                $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $info );
                                if ( !$fit ) {
                                        $this->setContinueEnumParameter( 'from', $this->keyToTitle( $row->img_name ) );
@@ -181,22 +181,6 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                }
        }
 
-       /**
-        * @param $hash string
-        * @return bool
-        */
-       public static function validateSha1Hash( $hash ) {
-               return preg_match( '/[a-fA-F0-9]{40}/', $hash );
-       }
-
-       /**
-        * @param $hash string
-        * @return bool
-        */
-       public static function validateSha1Base36Hash( $hash ) {
-               return preg_match( '/[a-zA-Z0-9]{31}/', $hash );
-       }
-
        public function getAllowedParams() {
                return array (
                        'from' => null,
@@ -265,7 +249,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                ) );
        }
 
-       protected function getExamples() {
+       public function getExamples() {
                return array(
                        'Simple Use',
                        ' Show a list of images starting at the letter "B"',
@@ -276,6 +260,10 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
                );
        }
 
+       public function getHelpUrls() {
+               return 'http://www.mediawiki.org/wiki/API:Allimages';
+       }
+
        public function getVersion() {
                return __CLASS__ . ': $Id$';
        }