var $mExtraDescription = false;
/**
- * @param $title Title
+ * @param Title $title
* @return WikiFilePage
*/
protected function newPage( Title $title ) {
/**
* Constructor from a page id
- * @param int $id article ID to load
+ * @param int $id Article ID to load
* @return ImagePage|null
*/
public static function newFromID( $id ) {
}
/**
- * @param $file File:
+ * @param File $file
* @return void
*/
public function setFile( $file ) {
/**
* Create the TOC
*
- * @param $metadata Boolean: whether or not to show the metadata link
- * @return String
+ * @param bool $metadata Whether or not to show the metadata link
+ * @return string
*/
protected function showTOC( $metadata ) {
$r = array(
*
* @todo FIXME: Bad interface, see note on MediaHandler::formatMetadata().
*
- * @param array $metadata the array containing the Exif data
- * @return String The metadata table. This is treated as Wikitext (!)
+ * @param array $metadata The array containing the Exif data
+ * @return string The metadata table. This is treated as Wikitext (!)
*/
protected function makeMetadataTable( $metadata ) {
$r = "<div class=\"mw-imagepage-section-metadata\">";
$renderLang = $request->getVal( 'lang' );
if ( !is_null( $renderLang ) ) {
- $params['lang'] = $renderLang;
+ $handler = $this->displayImg->getHandler();
+ if ( $handler && $handler->validateParam( 'lang', $renderLang ) ) {
+ $params['lang'] = $renderLang;
+ } else {
+ $renderLang = null;
+ }
}
$width_orig = $this->displayImg->getWidth( $page );
/**
* Creates an thumbnail of specified size and returns an HTML link to it
* @param array $params Scaler parameters
- * @param $width int
- * @param $height int
+ * @param int $width
+ * @param int $height
* @return string
*/
private function makeSizeLink( $params, $width, $height ) {
}
/**
- * @param $target
- * @param $limit
+ * @param string $target
+ * @param int $limit
* @return ResultWrapper
*/
protected function queryImageLinks( $target, $limit ) {
return $dbr->select(
array( 'imagelinks', 'page' ),
- array( 'page_namespace', 'page_title', 'page_is_redirect', 'il_to' ),
+ array( 'page_namespace', 'page_title', 'il_to' ),
array( 'il_to' => $target, 'il_from = page_id' ),
__METHOD__,
array( 'LIMIT' => $limit + 1, 'ORDER BY' => 'il_from', )
$limit = 100;
$out = $this->getContext()->getOutput();
- $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit + 1 );
+
$rows = array();
$redirects = array();
+ foreach ( $this->getTitle()->getRedirectsHere( NS_FILE ) as $redir ) {
+ $redirects[$redir->getDBkey()] = array();
+ $rows[] = (object)array(
+ 'page_namespace' => NS_FILE,
+ 'page_title' => $redir->getDBkey(),
+ );
+ }
+
+ $res = $this->queryImageLinks( $this->getTitle()->getDBkey(), $limit + 1 );
foreach ( $res as $row ) {
- if ( $row->page_is_redirect ) {
- $redirects[$row->page_title] = array();
- }
$rows[] = $row;
}
$count = count( $rows );
/**
* Display an error with a wikitext description
*
- * @param $description String
+ * @param string $description
*/
function showError( $description ) {
$out = $this->getContext()->getOutput();
* Callback for usort() to do link sorts by (namespace, title)
* Function copied from Title::compare()
*
- * @param $a object page to compare with
- * @param $b object page to compare with
- * @return Integer: result of string comparison, or namespace comparison
+ * @param object $a Object page to compare with
+ * @param object $b Object page to compare with
+ * @return int Result of string comparison, or namespace comparison
*/
protected function compare( $a, $b ) {
if ( $a->page_namespace == $b->page_namespace ) {
/**
* Returns the corresponding $wgImageLimits entry for the selected user option
*
- * @param $user User
+ * @param User $user
* @param string $optionName Name of a option to check, typically imagesize or thumbsize
* @return array
* @since 1.21
/**
* Output a drop-down box for language options for the file
*
- * @param Array $langChoices Array of string language codes
- * @param String $curLang Language code file is being viewed in.
- * @param String $defaultLang Language code that image is rendered in by default
- * @return String HTML to insert underneath image.
+ * @param array $langChoices Array of string language codes
+ * @param string $curLang Language code file is being viewed in.
+ * @param string $defaultLang Language code that image is rendered in by default
+ * @return string HTML to insert underneath image.
*/
protected function doRenderLangOpt( array $langChoices, $curLang, $defaultLang ) {
global $wgScript;
if ( !$haveDefaultLang ) {
// Its hard to know if the content is really in the default language, or
// if its just unmarked content that could be in any language.
- $opts = Xml::option( wfMessage( 'img-lang-default' )->text(), '', $defaultLang === $curLang ) . $opts;
+ $opts = Xml::option( wfMessage( 'img-lang-default' )->text(), $defaultLang, $defaultLang === $curLang ) . $opts;
}
if ( !$haveCurrentLang && $defaultLang !== $curLang ) {
$name = Language::fetchLanguageName( $curLang, $this->getContext()->getLanguage()->getCode() );
}
/**
- * @param $navLinks string
+ * @param string $navLinks
* @return string
*/
public function beginImageHistoryList( $navLinks = '' ) {
}
/**
- * @param $navLinks string
+ * @param string $navLinks
* @return string
*/
public function endImageHistoryList( $navLinks = '' ) {
}
/**
- * @param $iscur
- * @param $file File
+ * @param bool $iscur
+ * @param File $file
* @return string
*/
public function imageHistoryLine( $iscur, $file ) {
}
/**
- * @param $file File
+ * @param File $file
* @return string
*/
protected function getThumbForLine( $file ) {
}
/**
- * @param $enable bool
+ * @param bool $enable
*/
protected function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;
}
/**
- * @param $row object
+ * @param object $row
* @return string
*/
function formatRow( $row ) {
}
/**
- * @param $enable bool
+ * @param bool $enable
*/
protected function preventClickjacking( $enable = true ) {
$this->preventClickjacking = $enable;