}
/**
- * @param $file File:
+ * @param $file File:
* @return void
*/
public function setFile( $file ) {
$showmeta = false;
}
- if ( !$diff && $this->displayImg->exists() )
+ if ( !$diff && $this->displayImg->exists() ) {
$wgOut->addHTML( $this->showTOC( $showmeta ) );
+ }
- if ( !$diff )
+ if ( !$diff ) {
$this->openShowImage();
+ }
# No need to display noarticletext, we use our own message, output in openShowImage()
if ( $this->getID() ) {
# Allow extensions to add something after the image links
$html = '';
wfRunHooks( 'ImagePageAfterImageLinks', array( $this, &$html ) );
- if ( $html )
+ if ( $html ) {
$wgOut->addHTML( $html );
+ }
if ( $showmeta ) {
$wgOut->addHTML( Xml::element( 'h2', array( 'id' => 'metadata' ), wfMsg( 'metadata' ) ) . "\n" );
public function isRedirect( $text = false ) {
$this->loadFile();
- if ( $this->img->isLocal() )
+ if ( $this->img->isLocal() ) {
return parent::isRedirect( $text );
+ }
return (bool)$this->img->getRedirected();
}
if ( !is_null( $this->dupes ) ) {
return $this->dupes;
}
- if ( !( $hash = $this->img->getSha1() ) ) {
+ $hash = $this->img->getSha1();
+ if ( !( $hash ) ) {
return $this->dupes = array();
}
$dupes = RepoGroup::singleton()->findBySha1( $hash );
$size = $this->img->getSize();
foreach ( $dupes as $index => $file ) {
$key = $file->getRepoName() . ':' . $file->getName();
- if ( $key == $self )
+ if ( $key == $self ) {
unset( $dupes[$index] );
- if ( $file->getSize() != $size )
+ }
+ if ( $file->getSize() != $size ) {
unset( $dupes[$index] );
+ }
}
return $this->dupes = $dupes;
-
}
/**
*/
protected function showTOC( $metadata ) {
$r = array(
- '<li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>',
- '<li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>',
- '<li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>',
+ '<li><a href="#file">' . wfMsgHtml( 'file-anchor-link' ) . '</a></li>',
+ '<li><a href="#filehistory">' . wfMsgHtml( 'filehist' ) . '</a></li>',
+ '<li><a href="#filelinks">' . wfMsgHtml( 'imagelinks' ) . '</a></li>',
);
if ( $metadata ) {
$r[] = '<li><a href="#metadata">' . wfMsgHtml( 'metadata' ) . '</a></li>';
# image
# "Download high res version" link below the image
- # $msgsize = wfMsgHtml('file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->displayImg->getSize() ), $mime );
+ # $msgsize = wfMsgHtml( 'file-info-size', $width_orig, $height_orig, $sk->formatSize( $this->displayImg->getSize() ), $mime );
# We'll show a thumbnail of this image
if ( $width > $maxWidth || $height > $maxHeight ) {
# Calculate the thumbnail size.
$thumbnail = $this->displayImg->transform( $params );
$showLink = true;
- $anchorclose = "<br />" . $msgsmall;
+ $anchorclose = '<br />' . $msgsmall;
$isMulti = $this->displayImg->isMultipage() && $this->displayImg->pageCount() > 1;
if ( $isMulti ) {
$wgOut->addHTML(
'</td><td><div class="multipageimagenavbox">' .
Xml::openElement( 'form', $formParams ) .
- Html::hidden( 'title', $this->getTitle()->getPrefixedDbKey() ) .
+ Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) .
wfMsgExt( 'imgmultigoto', array( 'parseinline', 'replaceafter' ), $select ) .
Xml::submitButton( wfMsg( 'imgmultigo' ) ) .
Xml::closeElement( 'form' ) .
$icon = $this->displayImg->iconThumb();
$wgOut->addHTML( '<div class="fullImageLink" id="file">' .
- $icon->toHtml( array( 'file-link' => true ) ) .
- "</div>\n" );
+ $icon->toHtml( array( 'file-link' => true ) ) .
+ "</div>\n" );
}
$showLink = true;
}
-
if ( $showLink ) {
$filename = wfEscapeWikiText( $this->displayImg->getName() );
$linktext = $filename;
$uploadTitle = SpecialPage::getTitleFor( 'Upload' );
$nofile = array(
'filepage-nofile-link',
- $uploadTitle->getFullUrl( array( 'wpDestFile' => $this->img->getName() ) )
+ $uploadTitle->getFullURL( array( 'wpDestFile' => $this->img->getName() ) )
);
- }
- else
- {
+ } else {
$nofile = 'filepage-nofile';
}
// Note, if there is an image description page, but
if ( !$this->getID() ) {
// If there is no image, no shared image, and no description page,
// output a 404, to be consistent with articles.
- $wgRequest->response()->header( "HTTP/1.1 404 Not Found" );
+ $wgRequest->response()->header( 'HTTP/1.1 404 Not Found' );
}
}
}
public function getUploadUrl() {
$this->loadFile();
$uploadTitle = SpecialPage::getTitleFor( 'Upload' );
- return $uploadTitle->getFullUrl( array(
+ return $uploadTitle->getFullURL( array(
'wpDestFile' => $this->img->getName(),
'wpForReUpload' => 1
) );
}
$this->loadFile();
- if ( !$this->img->isLocal() )
+ if ( !$this->img->isLocal() ) {
return;
+ }
$sk = $wgUser->getSkin();
),
array( 'known', 'noclasses' )
);
- $wgOut->addHTML( '<li id="mw-imagepage-edit-external">' . $elink . ' <small>' . wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) . "</small></li>\n" );
+ $wgOut->addHTML(
+ '<li id="mw-imagepage-edit-external">' . $elink . ' <small>' .
+ wfMsgExt( 'edit-externally-help', array( 'parseinline' ) ) .
+ "</small></li>\n"
+ );
}
$wgOut->addHTML( "</ul>\n" );
);
$count = $dbr->numRows( $res );
if ( $count == 0 ) {
- $wgOut->wrapWikiMsg( Html::rawElement( 'div', array ( 'id' => 'mw-imagepage-nolinkstoimage' ), "\n$1\n" ), 'nolinkstoimage' );
+ $wgOut->wrapWikiMsg(
+ Html::rawElement( 'div',
+ array( 'id' => 'mw-imagepage-nolinkstoimage' ), "\n$1\n" ),
+ 'nolinkstoimage'
+ );
return;
}
);
}
- $wgOut->addHTML( Html::openElement( 'ul', array( 'class' => 'mw-imagepage-linkstoimage' ) ) . "\n" );
+ $wgOut->addHTML(
+ Html::openElement( 'ul',
+ array( 'class' => 'mw-imagepage-linkstoimage' ) ) . "\n"
+ );
$sk = $wgUser->getSkin();
$count = 0;
$elements = array();
}
// Sort the list by namespace:title
- usort ( $elements, array( $this, 'compare' ) );
+ usort( $elements, array( $this, 'compare' ) );
// Create links for every element
foreach( $elements as $element ) {
$link = $sk->linkKnown( Title::makeTitle( $element->page_namespace, $element->page_title ) );
$wgOut->addHTML( Html::rawElement(
- 'li',
- array( 'id' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ),
- $link
- ) . "\n"
+ 'li',
+ array( 'id' => 'mw-imagepage-linkstoimage-ns' . $element->page_namespace ),
+ $link
+ ) . "\n"
);
};
global $wgUser, $wgOut, $wgLang;
$redirects = $this->getTitle()->getRedirectsHere( NS_FILE );
- if ( count( $redirects ) == 0 ) return;
+ if ( count( $redirects ) == 0 ) {
+ return;
+ }
$wgOut->addHTML( "<div id='mw-imagepage-section-redirectstofile'>\n" );
$wgOut->addWikiMsg( 'redirectstofile',
$wgOut->addHTML( "<li>{$link}</li>\n" );
}
$wgOut->addHTML( "</ul></div>\n" );
-
}
protected function imageDupes() {
public function doPurge() {
$this->loadFile();
if ( $this->img->exists() ) {
- wfDebug( "ImagePage::doPurge purging " . $this->img->getName() . "\n" );
+ wfDebug( 'ImagePage::doPurge purging ' . $this->img->getName() . "\n" );
$update = new HTMLCacheUpdate( $this->mTitle, 'imagelinks' );
$update->doUpdate();
$this->img->upgradeRow();
$this->img->purgeCache();
} else {
- wfDebug( "ImagePage::doPurge no image for " . $this->img->getName() . "; limiting purge to cache only\n" );
+ wfDebug( 'ImagePage::doPurge no image for ' . $this->img->getName() . "; limiting purge to cache only\n" );
// even if the file supposedly doesn't exist, force any cached information
// to be updated (in case the cached information is wrong)
$this->img->purgeCache();
*/
function showError( $description ) {
global $wgOut;
- $wgOut->setPageTitle( wfMsg( "internalerror" ) );
- $wgOut->setRobotPolicy( "noindex,nofollow" );
+ $wgOut->setPageTitle( wfMsg( 'internalerror' ) );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
$wgOut->enableClientCache( false );
$wgOut->addWikiText( $description );
}
/**
- * @param $iscur
- * @param File $file
+ * @param $iscur
+ * @param $file File
* @return string
*/
public function imageHistoryLine( $iscur, $file ) {
# Link to remove from history
if ( $wgUser->isAllowed( 'delete' ) ) {
$q = array( 'action' => 'delete' );
- if ( !$iscur )
+ if ( !$iscur ) {
$q['oldimage'] = $img;
+ }
$row .= $this->skin->link(
$this->title,
wfMsgHtml( $iscur ? 'filehist-deleteall' : 'filehist-deleteone' ),
// Image dimensions + size
$row .= '<td>';
$row .= htmlspecialchars( $file->getDimensionsString() );
- $row .= " <span style='white-space: nowrap;'>(" . $this->skin->formatSize( $file->getSize() ) . ')</span>';
+ $row .= ' <span style="white-space: nowrap;">(' . $this->skin->formatSize( $file->getSize() ) . ')</span>';
$row .= '</td>';
// Uploading user
if ( $file->isDeleted( File::DELETED_USER ) ) {
$row .= '<span class="history-deleted">' . wfMsgHtml( 'rev-deleted-user' ) . '</span>';
} else {
- $row .= $this->skin->userLink( $user, $usertext ) . " <span style='white-space: nowrap;'>" .
- $this->skin->userToolLinks( $user, $usertext ) . "</span>";
+ $row .= $this->skin->userLink( $user, $usertext ) . ' <span style="white-space: nowrap;">' .
+ $this->skin->userToolLinks( $user, $usertext ) . '</span>';
}
} else {
$row .= htmlspecialchars( $usertext );
$rowClass = null;
wfRunHooks( 'ImagePageFileHistoryLine', array( $this, $file, &$row, &$rowClass ) );
- $classAttr = $rowClass ? " class='$rowClass'" : "";
+ $classAttr = $rowClass ? " class='$rowClass'" : '';
return "<tr{$classAttr}>{$row}</tr>\n";
}
/**
- * @param File $file
+ * @param $file File
* @return string
*/
protected function getThumbForLine( $file ) {
'file-link' => true,
);
- if ( !$thumbnail ) return wfMsgHtml( 'filehist-nothumb' );
+ if ( !$thumbnail ) {
+ return wfMsgHtml( 'filehist-nothumb' );
+ }
return $thumbnail->toHtml( $options );
} else {
}
function doQuery() {
- if ( $this->mQueryDone ) return;
+ if ( $this->mQueryDone ) {
+ return;
+ }
$this->mImg = $this->mImagePage->getFile(); // ensure loading
if ( !$this->mImg->exists() ) {
return;