More documentation of parameters following up r104591
[lhc/web/wiklou.git] / includes / ImagePage.php
index 9a017da..a599ab7 100644 (file)
@@ -18,6 +18,10 @@ class ImagePage extends Article {
 
        var $mExtraDescription = false;
 
+       /**
+        * @param $title Title
+        * @return WikiFilePage
+        */
        protected function newPage( Title $title ) {
                // Overload mPage with a file-specific page
                return new WikiFilePage( $title );
@@ -184,6 +188,9 @@ class ImagePage extends Article {
                $wgOut->addModuleStyles( 'filepage' );
        }
 
+       /**
+        * @return File
+        */
        public function getDisplayedFile() {
                $this->loadFile();
                return $this->displayImg;
@@ -243,6 +250,7 @@ class ImagePage extends Article {
         *
         * Omit noarticletext if sharedupload; text will be fetched from the
         * shared upload server if possible.
+        * @return string
         */
        public function getContent() {
                $this->loadFile();
@@ -324,9 +332,13 @@ class ImagePage extends Article {
                                                rawParams( $this->makeSizeLink( $params, $width, $height ) )->
                                                parse() . ' ' .
                                                Html::rawElement( 'span', array( 'class' => 'mw-filepage-other-resolutions' ),
-                                                       wfMessage( 'show-big-image-other' )->
-                                                       rawParams( $wgLang->pipeList( $otherSizes ), count( $otherSizes ) )->parse()
+                                                       wfMessage( 'show-big-image-other' )->rawParams( $wgLang->pipeList( $otherSizes ) )->
+                                                       params( count( $otherSizes ) )->parse()
                                                );
+                               } elseif ( $width == 0 && $height == 0 ){
+                                       # Some sort of audio file that doesn't have dimensions
+                                       # Don't output a no hi res message for such a file
+                                       $msgsmall = '';
                                } else {
                                        # Image is small enough to show full size on image page
                                        $msgsmall = wfMessage( 'file-nohires' )->parse();
@@ -394,7 +406,7 @@ class ImagePage extends Article {
                                                'action' => $wgScript,
                                                'onchange' => 'document.pageselector.submit();',
                                        );
-
+                                       $options = array();
                                        for ( $i = 1; $i <= $count; $i++ ) {
                                                $options[] = Xml::option( $wgLang->formatNum( $i ), $i, $i == $page );
                                        }
@@ -409,7 +421,7 @@ class ImagePage extends Article {
                                                wfMsgExt( 'imgmultigoto', array( 'parseinline', 'replaceafter' ), $select ) .
                                                Xml::submitButton( wfMsg( 'imgmultigo' ) ) .
                                                Xml::closeElement( 'form' ) .
-                                               "<hr />$thumb1\n$thumb2<br clear=\"all\" /></div></td></tr></table>"
+                                               "<hr />$thumb1\n$thumb2<br style=\"clear: both\" /></div></td></tr></table>"
                                        );
                                }
                        } else {
@@ -480,9 +492,10 @@ EOT
 
        /**
         * Creates an thumbnail of specified size and returns an HTML link to it
-        * @param array $params Scaler parameters
-        * @param int $width
-        * @param int $height
+        * @param $params array Scaler parameters
+        * @param $width int
+        * @param $height int
+        * @return string
         */
        private function makeSizeLink( $params, $width, $height ) {
                $params['width'] = $width;
@@ -611,6 +624,11 @@ EOT
                }
        }
 
+       /**
+        * @param $target
+        * @param $limit
+        * @return ResultWrapper
+        */
        protected function queryImageLinks( $target, $limit ) {
                $dbr = wfGetDB( DB_SLAVE );
 
@@ -743,6 +761,9 @@ EOT
                );
                $wgOut->addHTML( "<ul class='mw-imagepage-duplicates'>\n" );
 
+               /**
+                * @var $file File
+                */
                foreach ( $dupes as $file ) {
                        $fromSrc = '';
                        if ( $file->isLocal() ) {
@@ -767,20 +788,14 @@ EOT
         * Delete the file, or an earlier version of it
         */
        public function delete() {
-               global $wgUploadMaintenance;
-               if ( $wgUploadMaintenance && $this->getTitle() && $this->getTitle()->getNamespace() == NS_FILE ) {
-                       global $wgOut;
-                       $wgOut->wrapWikiMsg( "<div class='error'>\n$1\n</div>\n", array( 'filedelete-maintenance' ) );
-                       return;
-               }
-
-               $this->loadFile();
-               if ( !$this->mPage->getFile()->exists() || !$this->mPage->getFile()->isLocal() || $this->mPage->getFile()->getRedirected() ) {
+               $file = $this->mPage->getFile();
+               if ( !$file->exists() || !$file->isLocal() || $file->getRedirected() ) {
                        // Standard article deletion
                        parent::delete();
                        return;
                }
-               $deleter = new FileDeleteForm( $this->mPage->getFile() );
+
+               $deleter = new FileDeleteForm( $file );
                $deleter->execute();
        }
 
@@ -791,7 +806,7 @@ EOT
         */
        function showError( $description ) {
                global $wgOut;
-               $wgOut->setPageTitle( wfMsg( 'internalerror' ) );
+               $wgOut->setPageTitle( wfMessage( 'internalerror' ) );
                $wgOut->setRobotPolicy( 'noindex,nofollow' );
                $wgOut->setArticleRelated( false );
                $wgOut->enableClientCache( false );
@@ -837,6 +852,11 @@ class ImageHistoryList {
         */
        protected $imagePage;
 
+       /**
+        * @var File
+        */
+       protected $current;
+
        protected $repo, $showThumb;
        protected $preventClickjacking = false;
 
@@ -852,14 +872,24 @@ class ImageHistoryList {
                $this->showThumb = $wgShowArchiveThumbnails && $this->img->canRender();
        }
 
+       /**
+        * @return ImagePage
+        */
        public function getImagePage() {
                return $this->imagePage;
        }
 
+       /**
+        * @return File
+        */
        public function getFile() {
                return $this->img;
        }
 
+       /**
+        * @param $navLinks string
+        * @return string
+        */
        public function beginImageHistoryList( $navLinks = '' ) {
                global $wgOut, $wgUser;
                return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) ) . "\n"
@@ -877,6 +907,10 @@ class ImageHistoryList {
                        . "</tr>\n";
        }
 
+       /**
+        * @param $navLinks string
+        * @return string
+        */
        public function endImageHistoryList( $navLinks = '' ) {
                return "</table>\n$navLinks\n</div>\n";
        }
@@ -952,7 +986,7 @@ class ImageHistoryList {
                                        array(
                                                'action' => 'revert',
                                                'oldimage' => $img,
-                                               'wpEditToken' => $wgUser->editToken( $img )
+                                               'wpEditToken' => $wgUser->getEditToken( $img )
                                        ),
                                        array( 'known', 'noclasses' )
                                );
@@ -980,7 +1014,7 @@ class ImageHistoryList {
                                        array(
                                                'target' => $this->title->getPrefixedText(),
                                                'file' => $img,
-                                               'token' => $wgUser->editToken( $img )
+                                               'token' => $wgUser->getEditToken( $img )
                                        ),
                                        array( 'known', 'noclasses' )
                                );
@@ -1024,7 +1058,7 @@ class ImageHistoryList {
                if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
                        $row .= '<td><span class="history-deleted">' . wfMsgHtml( 'rev-deleted-comment' ) . '</span></td>';
                } else {
-                       $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::commentBlock( $description, $this->title ) . '</td>';
+                       $row .= '<td dir="' . $wgContLang->getDir() . '">' . Linker::formatComment( $description, $this->title ) . '</td>';
                }
 
                $rowClass = null;
@@ -1067,10 +1101,16 @@ class ImageHistoryList {
                }
        }
 
+       /**
+        * @param $enable bool
+        */
        protected function preventClickjacking( $enable = true ) {
                $this->preventClickjacking = $enable;
        }
 
+       /**
+        * @return bool
+        */
        public function getPreventClickjacking() {
                return $this->preventClickjacking;
        }
@@ -1102,6 +1142,9 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                $this->mRange = array( 0, 0 ); // display range
        }
 
+       /**
+        * @return Title
+        */
        function getTitle() {
                return $this->mTitle;
        }
@@ -1110,14 +1153,23 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                return false;
        }
 
+       /**
+        * @return string
+        */
        function getIndexField() {
                return '';
        }
 
+       /**
+        * @return string
+        */
        function formatRow( $row ) {
                return '';
        }
 
+       /**
+        * @return string
+        */
        function getBody() {
                $s = '';
                $this->doQuery();
@@ -1221,10 +1273,16 @@ class ImageHistoryPseudoPager extends ReverseChronologicalPager {
                $this->mQueryDone = true;
        }
 
+       /**
+        * @param $enable bool
+        */
        protected function preventClickjacking( $enable = true ) {
                $this->preventClickjacking = $enable;
        }
 
+       /**
+        * @return bool
+        */
        public function getPreventClickjacking() {
                return $this->preventClickjacking;
        }