Merge "Remove the $wgHandheldStyle config variable entirely"
[lhc/web/wiklou.git] / includes / specials / SpecialListfiles.php
index c864ae2..f508b7c 100644 (file)
@@ -22,7 +22,6 @@
  */
 
 class SpecialListFiles extends IncludableSpecialPage {
-
        public function __construct() {
                parent::__construct( 'Listfiles' );
        }
@@ -39,7 +38,12 @@ class SpecialListFiles extends IncludableSpecialPage {
                        $search = $this->getRequest()->getText( 'ilsearch', '' );
                }
 
-               $pager = new ImageListPager( $this->getContext(), $userName, $search, $this->including() );
+               $pager = new ImageListPager(
+                       $this->getContext(),
+                       $userName,
+                       $search,
+                       $this->including()
+               );
 
                if ( $this->including() ) {
                        $html = $pager->getBody();
@@ -67,7 +71,9 @@ class ImageListPager extends TablePager {
        var $mSearch = '';
        var $mIncluding = false;
 
-       function __construct( IContextSource $context, $userName = null, $search = '', $including = false ) {
+       function __construct( IContextSource $context, $userName = null, $search = '',
+               $including = false
+       ) {
                global $wgMiserMode;
 
                $this->mIncluding = $including;
@@ -83,6 +89,7 @@ class ImageListPager extends TablePager {
                if ( $search != '' && !$wgMiserMode ) {
                        $this->mSearch = $search;
                        $nt = Title::newFromURL( $this->mSearch );
+
                        if ( $nt ) {
                                $dbr = wfGetDB( DB_SLAVE );
                                $this->mQueryConds[] = 'LOWER(img_name)' .
@@ -118,10 +125,11 @@ class ImageListPager extends TablePager {
                                'img_user_text' => $this->msg( 'listfiles_user' )->text(),
                                'img_description' => $this->msg( 'listfiles_description' )->text(),
                        );
-                       if( !$wgMiserMode ) {
+                       if ( !$wgMiserMode ) {
                                $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
                        }
                }
+
                return $this->mFieldNames;
        }
 
@@ -134,6 +142,7 @@ class ImageListPager extends TablePager {
                        # No index for both img_size and img_user_text
                        return !isset( $this->mQueryConds['img_user_text'] );
                }
+
                return in_array( $field, $sortable );
        }
 
@@ -145,7 +154,7 @@ class ImageListPager extends TablePager {
                $options = $join_conds = array();
 
                # Depends on $wgMiserMode
-               if( isset( $this->mFieldNames['count'] ) ) {
+               if ( isset( $this->mFieldNames['count'] ) ) {
                        $tables[] = 'oldimage';
 
                        # Need to rewrite this one
@@ -157,7 +166,7 @@ class ImageListPager extends TablePager {
                        unset( $field );
 
                        $dbr = wfGetDB( DB_SLAVE );
-                       if( $dbr->implicitGroupby() ) {
+                       if ( $dbr->implicitGroupby() ) {
                                $options = array( 'GROUP BY' => 'img_name' );
                        } else {
                                $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
@@ -165,11 +174,12 @@ class ImageListPager extends TablePager {
                        }
                        $join_conds = array( 'oldimage' => array( 'LEFT JOIN', 'oi_name = img_name' ) );
                }
+
                return array(
-                       'tables'     => $tables,
-                       'fields'     => $fields,
-                       'conds'      => $this->mQueryConds,
-                       'options'    => $options,
+                       'tables' => $tables,
+                       'fields' => $fields,
+                       'conds' => $this->mQueryConds,
+                       'options' => $options,
                        'join_conds' => $join_conds
                );
        }
@@ -193,22 +203,30 @@ class ImageListPager extends TablePager {
                        case 'thumb':
                                $file = wfLocalFile( $value );
                                $thumb = $file->transform( array( 'width' => 180, 'height' => 360 ) );
+
                                return $thumb->toHtml( array( 'desc-link' => true ) );
                        case 'img_timestamp':
-                               return htmlspecialchars( $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ) );
+                               $timeAndDate = $this->getLanguage()->userTimeAndDate( $value, $this->getUser() );
+                               return htmlspecialchars( $timeAndDate );
                        case 'img_name':
                                static $imgfile = null;
-                               if ( $imgfile === null ) $imgfile = $this->msg( 'imgfile' )->text();
+                               if ( $imgfile === null ) {
+                                       $imgfile = $this->msg( 'imgfile' )->text();
+                               }
 
                                // Weird files can maybe exist? Bug 22227
                                $filePage = Title::makeTitleSafe( NS_FILE, $value );
-                               if( $filePage ) {
-                                       $link = Linker::linkKnown( $filePage, htmlspecialchars( $filePage->getText() ) );
+                               if ( $filePage ) {
+                                       $link = Linker::linkKnown(
+                                               $filePage,
+                                               htmlspecialchars( $filePage->getText() )
+                                       );
                                        $download = Xml::element( 'a',
                                                array( 'href' => wfLocalFile( $filePage )->getURL() ),
                                                $imgfile
                                        );
                                        $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
+
                                        return "$link $download";
                                } else {
                                        return htmlspecialchars( $value );
@@ -223,6 +241,7 @@ class ImageListPager extends TablePager {
                                } else {
                                        $link = htmlspecialchars( $value );
                                }
+
                                return $link;
                        case 'img_size':
                                return htmlspecialchars( $this->getLanguage()->formatSize( $value ) );
@@ -238,20 +257,26 @@ class ImageListPager extends TablePager {
                $inputForm = array();
                $inputForm['table_pager_limit_label'] = $this->getLimitSelect();
                if ( !$wgMiserMode ) {
-                       $inputForm['listfiles_search_for'] = Html::input( 'ilsearch', $this->mSearch, 'text',
+                       $inputForm['listfiles_search_for'] = Html::input(
+                               'ilsearch',
+                               $this->mSearch,
+                               'text',
                                array(
-                                       'size'          => '40',
+                                       'size' => '40',
                                        'maxlength' => '255',
-                                       'id'            => 'mw-ilsearch',
-                       ) );
+                                       'id' => 'mw-ilsearch',
+                               )
+                       );
                }
                $inputForm['username'] = Html::input( 'user', $this->mUserName, 'text', array(
-                       'size'          => '40',
+                       'size' => '40',
                        'maxlength' => '255',
-                       'id'            => 'mw-listfiles-user',
+                       'id' => 'mw-listfiles-user',
                ) );
+
                return Html::openElement( 'form',
-                               array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' ) ) .
+                       array( 'method' => 'get', 'action' => $wgScript, 'id' => 'mw-listfiles-form' )
+               ) .
                        Xml::fieldset( $this->msg( 'listfiles' )->text() ) .
                        Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
                        Xml::buildForm( $inputForm, 'table_pager_limit_submit' ) .
@@ -280,6 +305,7 @@ class ImageListPager extends TablePager {
                                $query['user'] = $this->mUserName;
                        }
                }
+
                return $queries;
        }
 
@@ -288,6 +314,7 @@ class ImageListPager extends TablePager {
                if ( !isset( $queries['user'] ) && !is_null( $this->mUserName ) ) {
                        $queries['user'] = $this->mUserName;
                }
+
                return $queries;
        }