MediaWiki  1.27.4
ImagePage Class Reference

Class for viewing MediaWiki file description pages. More...

Inheritance diagram for ImagePage:
Collaboration diagram for ImagePage:

Public Member Functions

 delete ()
 Delete the file, or an earlier version of it. More...
 
 getContentObject ()
 Overloading Article's getContentObject method. More...
 
 getDisplayedFile ()
 
 getDuplicates ()
 
 getFile ()
 
 getForeignCategories ()
 
 getImageLimitsFromOption ($user, $optionName)
 Returns the corresponding $wgImageLimits entry for the selected user option. More...
 
 getUploadUrl ()
 
 isLocal ()
 
 render ()
 Handler for action=render Include body text only; none of the image extras. More...
 
 setFile ($file)
 
 showError ($description)
 Display an error with a wikitext description. More...
 
 view ()
 
- Public Member Functions inherited from Article
 __construct (Title $title, $oldId=null)
 Constructor and clear the article. More...
 
 __get ($fname)
 Use PHP's magic __get handler to handle accessing of raw WikiPage fields for backwards compatibility. More...
 
 __set ($fname, $fvalue)
 Use PHP's magic __set handler to handle setting of raw WikiPage fields for backwards compatibility. More...
 
 addHelpLink ($to, $overrideBaseUrl=false)
 Adds help link with an icon via page indicators. More...
 
 adjustDisplayTitle (ParserOutput $pOutput)
 Adjust title for pages with displaytitle, -{T|}- or language conversion. More...
 
 checkFlags ($flags)
 Call to WikiPage function for backwards compatibility. More...
 
 checkTouched ()
 Call to WikiPage function for backwards compatibility. More...
 
 clear ()
 Clear the object. More...
 
 clearPreparedEdit ()
 Call to WikiPage function for backwards compatibility. More...
 
 commitRollback ($fromP, $summary, $bot, &$resultDetails, User $guser=null)
 
 confirmDelete ($reason)
 Output deletion confirmation dialog. More...
 
 delete ()
 UI entry point for page deletion. More...
 
 doDelete ($reason, $suppress=false)
 Perform a deletion and output success or failure messages. More...
 
 doDeleteArticle ($reason, $suppress=false, $u1=null, $u2=null, &$error= '')
 
 doDeleteArticleReal ($reason, $suppress=false, $u1=null, $u2=null, &$error= '', User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doDeleteUpdates ($id, Content $content=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doEdit ($text, $summary, $flags=0, $baseRevId=false, $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doEditContent (Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialFormat=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doEditUpdates (Revision $revision, User $user, array $options=[])
 Call to WikiPage function for backwards compatibility. More...
 
 doPurge ()
 Call to WikiPage function for backwards compatibility. More...
 
 doQuickEditContent (Content $content, User $user, $comment= '', $minor=false, $serialFormat=null)
 Call to WikiPage function for backwards compatibility. More...
 
 doRollback ($fromP, $summary, $token, $bot, &$resultDetails, User $user=null)
 
 doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user)
 
 doViewUpdates (User $user, $oldid=0)
 Call to WikiPage function for backwards compatibility. More...
 
 exists ()
 Call to WikiPage function for backwards compatibility. More...
 
 fetchContent ()
 Get text of an article from database Does NOT follow redirects. More...
 
 followRedirect ()
 Call to WikiPage function for backwards compatibility. More...
 
 generateReason (&$hasHistory)
 
 getActionOverrides ()
 Call to WikiPage function for backwards compatibility. More...
 
 getAutoDeleteReason (&$hasHistory)
 Call to WikiPage function for backwards compatibility. More...
 
 getCategories ()
 Call to WikiPage function for backwards compatibility. More...
 
 getComment ($audience=Revision::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getContent ()
 Note that getContent does not follow redirects anymore. More...
 
 getContentHandler ()
 Call to WikiPage function for backwards compatibility. More...
 
 getContentModel ()
 Call to WikiPage function for backwards compatibility. More...
 
 getContext ()
 Gets the context this Article is executed in. More...
 
 getContributors ()
 Call to WikiPage function for backwards compatibility. More...
 
 getCreator ($audience=Revision::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getDeletionUpdates (Content $content=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getHiddenCategories ()
 Call to WikiPage function for backwards compatibility. More...
 
 getId ()
 Call to WikiPage function for backwards compatibility. More...
 
 getLatest ()
 Call to WikiPage function for backwards compatibility. More...
 
 getLinksTimestamp ()
 Call to WikiPage function for backwards compatibility. More...
 
 getMinorEdit ()
 Call to WikiPage function for backwards compatibility. More...
 
 getOldestRevision ()
 Call to WikiPage function for backwards compatibility. More...
 
 getOldID ()
 
 getOldIDFromRequest ()
 Sets $this->mRedirectUrl to a correct URL if the query parameters are incorrect. More...
 
 getPage ()
 Get the WikiPage object of this instance. More...
 
 getParserOptions ()
 Get parser options suitable for rendering the primary article wikitext. More...
 
 getParserOutput ($oldid=null, User $user=null)
 #@- More...
 
 getRedirectTarget ()
 Call to WikiPage function for backwards compatibility. More...
 
 getRedirectURL ($rt)
 Call to WikiPage function for backwards compatibility. More...
 
 getRevIdFetched ()
 Use this to fetch the rev ID used on page views. More...
 
 getRevision ()
 Call to WikiPage function for backwards compatibility. More...
 
 getRevisionFetched ()
 Get the fetched Revision object depending on request parameters or null on failure. More...
 
 getRobotPolicy ($action, $pOutput=null)
 Get the robot policy to be used for the current view. More...
 
 getText ($audience=Revision::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getTimestamp ()
 Call to WikiPage function for backwards compatibility. More...
 
 getTitle ()
 Get the title object of the article. More...
 
 getTouched ()
 Call to WikiPage function for backwards compatibility. More...
 
 getUndoContent (Revision $undo, Revision $undoafter=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getUser ($audience=Revision::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 getUserText ($audience=Revision::FOR_PUBLIC, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 hasViewableContent ()
 Call to WikiPage function for backwards compatibility. More...
 
 insertOn ($dbw, $pageId=null)
 Call to WikiPage function for backwards compatibility. More...
 
 insertProtectNullRevision ($revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 insertRedirect ()
 Call to WikiPage function for backwards compatibility. More...
 
 insertRedirectEntry (Title $rt, $oldLatest=null)
 Call to WikiPage function for backwards compatibility. More...
 
 isCountable ($editInfo=false)
 Call to WikiPage function for backwards compatibility. More...
 
 isCurrent ()
 Returns true if the currently-referenced revision is the current edit to this page (and it exists). More...
 
 isFileCacheable ()
 Check if the page can be cached. More...
 
 isRedirect ()
 Call to WikiPage function for backwards compatibility. More...
 
 loadFromRow ($data, $from)
 Call to WikiPage function for backwards compatibility. More...
 
 loadPageData ($from= 'fromdb')
 Call to WikiPage function for backwards compatibility. More...
 
 lockAndGetLatest ()
 Call to WikiPage function for backwards compatibility. More...
 
 makeParserOptions ($context)
 Call to WikiPage function for backwards compatibility. More...
 
 pageDataFromId ($dbr, $id, $options=[])
 Call to WikiPage function for backwards compatibility. More...
 
 pageDataFromTitle ($dbr, $title, $options=[])
 Call to WikiPage function for backwards compatibility. More...
 
 prepareContentForEdit (Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true)
 Call to WikiPage function for backwards compatibility. More...
 
 prepareTextForEdit ($text, $revid=null, User $user=null)
 Call to WikiPage function for backwards compatibility. More...
 
 protect ()
 action=protect handler More...
 
 protectDescription (array $limit, array $expiry)
 Call to WikiPage function for backwards compatibility. More...
 
 protectDescriptionLog (array $limit, array $expiry)
 Call to WikiPage function for backwards compatibility. More...
 
 render ()
 Handle action=render. More...
 
 replaceSectionAtRev ($sectionId, Content $sectionContent, $sectionTitle= '', $baseRevId=null)
 Call to WikiPage function for backwards compatibility. More...
 
 replaceSectionContent ($sectionId, Content $sectionContent, $sectionTitle= '', $edittime=null)
 Call to WikiPage function for backwards compatibility. More...
 
 setContext ($context)
 Sets the context this Article is executed in. More...
 
 setOldSubtitle ($oldid=0)
 Generate the navigation links when browsing through an article revisions It shows the information as: Revision as of \<date\>; view current revision \<- Previous version | Next Version -\> More...
 
 setParserOptions (ParserOptions $options)
 Override the ParserOptions used to render the primary article wikitext. More...
 
 setRedirectedFrom (Title $from)
 Tell the page view functions that this view was redirected from another page on the wiki. More...
 
 setTimestamp ($ts)
 Call to WikiPage function for backwards compatibility. More...
 
 shouldCheckParserCache (ParserOptions $parserOptions, $oldId)
 Call to WikiPage function for backwards compatibility. More...
 
 showDeletedRevisionHeader ()
 If the revision requested for view is deleted, check permissions. More...
 
 showMissingArticle ()
 Show the error text for a missing article. More...
 
 showNamespaceHeader ()
 Show a header specific to the namespace currently being viewed, like [[MediaWiki:Talkpagetext]]. More...
 
 showPatrolFooter ()
 If patrol is possible, output a patrol UI box. More...
 
 showRedirectedFromHeader ()
 If this request is a redirect view, send "redirected from" subtitle to the output. More...
 
 showViewFooter ()
 Show the footer section of an ordinary page view. More...
 
 supportsSections ()
 Call to WikiPage function for backwards compatibility. More...
 
 triggerOpportunisticLinksUpdate (ParserOutput $parserOutput)
 Call to WikiPage function for backwards compatibility. More...
 
 unprotect ()
 action=unprotect handler (alias) More...
 
 updateCategoryCounts (array $added, array $deleted)
 Call to WikiPage function for backwards compatibility. More...
 
 updateIfNewerOn ($dbw, $revision)
 Call to WikiPage function for backwards compatibility. More...
 
 updateRedirectOn ($dbw, $redirectTitle, $lastRevIsRedirect=null)
 Call to WikiPage function for backwards compatibility. More...
 
 updateRestrictions ($limit=[], $reason= '', &$cascade=0, $expiry=[])
 
 updateRevisionOn ($dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
 Call to WikiPage function for backwards compatibility. More...
 
 view ()
 This is the default action of the index.php entry point: just view the page of the given title. More...
 
 viewRedirect ($target, $appendSubtitle=true, $forceKnown=false)
 Return the HTML for the top of a redirect page. More...
 

Static Public Member Functions

static newFromID ($id)
 Constructor from a page id. More...
 
- Static Public Member Functions inherited from Article
static formatRobotPolicy ($policy)
 Converts a String robot policy into an associative array, to allow merging of several policies using array_merge(). More...
 
static getAutosummary ($oldtext, $newtext, $flags)
 
static getRedirectHeaderHtml (Language $lang, $target, $forceKnown=false)
 Return the HTML for the top of a redirect page. More...
 
static newFromID ($id)
 Constructor from a page id. More...
 
static newFromTitle ($title, IContextSource $context)
 Create an Article object of the appropriate class for the given page. More...
 
static newFromWikiPage (WikiPage $page, IContextSource $context)
 Create an Article object of the appropriate class for the given page. More...
 
static onArticleCreate ($title)
 
static onArticleDelete ($title)
 
static onArticleEdit ($title)
 
static purgePatrolFooterCache ($articleID)
 Purge the cache used to check if it is worth showing the patrol footer For example, it is done during re-uploads when file patrol is used. More...
 
static selectFields ()
 

Protected Member Functions

 closeShowImage ()
 For overloading. More...
 
 compare ($a, $b)
 Callback for usort() to do link sorts by (namespace, title) Function copied from Title::compare() More...
 
 doRenderLangOpt (array $langChoices, $curLang, $defaultLang)
 Output a drop-down box for language options for the file. More...
 
 getDisplayWidthHeight ($maxWidth, $maxHeight, $width, $height)
 Get the width and height to display image at. More...
 
 getThumbSizes ($origWidth, $origHeight)
 Get alternative thumbnail sizes. More...
 
 imageDupes ()
 
 imageHistory ()
 If the page we've just displayed is in the "Image" namespace, we follow it with an upload history of the image and its usage. More...
 
 imageLinks ()
 
 loadFile ()
 
 makeMetadataTable ($metadata)
 Make a table with metadata to be shown in the output page. More...
 
 newPage (Title $title)
 
 openShowImage ()
 
 printSharedImageText ()
 Show a notice that the file is from a shared repository. More...
 
 queryImageLinks ($target, $limit)
 
 showTOC ($metadata)
 Create the TOC. More...
 
 uploadLinksBox ()
 Print out the various links at the bottom of the image page, e.g. More...
 
- Protected Member Functions inherited from Article
 fetchContentObject ()
 Get text content object Does NOT follow redirects. More...
 
 getContentObject ()
 Returns a Content object representing the pages effective display content, not necessarily the revision's content! More...
 
 newPage (Title $title)
 
 showCssOrJsPage ($showCacheHint=true)
 Show a page view for a page formatted as CSS or JavaScript. More...
 
 showDiffPage ()
 Show a diff page according to current request variables. More...
 
 tryFileCache ()
 checkLastModified returns true if it has taken care of all output to the client that is necessary for this request. More...
 

Protected Attributes

bool $mExtraDescription = false
 
WikiFilePage $mPage
 
- Protected Attributes inherited from Article
IContextSource $mContext
 The context this Article is executed in. More...
 
WikiPage $mPage
 The WikiPage object of this instance. More...
 

Private Member Functions

 getThumbPrevText ($params, $sizeLinkBigImagePreview)
 Make the text under the image to say what size preview. More...
 
 makeSizeLink ($params, $width, $height)
 Creates an thumbnail of specified size and returns an HTML link to it. More...
 

Private Attributes

File $displayImg
 
bool $fileLoaded
 
FileRepo $repo
 

Additional Inherited Members

- Public Attributes inherited from Article
string $mContent
 Text of the revision we are working on. More...
 
bool $mContentLoaded = false
 Is the content ($mContent) already loaded? More...
 
Content $mContentObject
 Content of the revision we are working on. More...
 
int null $mOldId
 The oldid of the article that is to be shown, 0 for the current revision. More...
 
ParserOptions $mParserOptions
 ParserOptions object for $wgUser articles. More...
 
ParserOutput $mParserOutput
 
Title $mRedirectedFrom = null
 Title from which we were redirected here. More...
 
string bool $mRedirectUrl = false
 URL to redirect to or false if none. More...
 
int $mRevIdFetched = 0
 Revision ID of revision we are working on. More...
 
Revision $mRevision = null
 Revision we are working on. More...
 

Detailed Description

Class for viewing MediaWiki file description pages.

Definition at line 28 of file ImagePage.php.

Member Function Documentation

ImagePage::closeShowImage ( )
protected

For overloading.

Definition at line 787 of file ImagePage.php.

Referenced by view().

ImagePage::compare (   $a,
  $b 
)
protected

Callback for usort() to do link sorts by (namespace, title) Function copied from Title::compare()

Parameters
object$aObject page to compare with
object$bObject page to compare with
Returns
int Result of string comparison, or namespace comparison

Definition at line 1028 of file ImagePage.php.

ImagePage::delete ( )

Delete the file, or an earlier version of it.

Definition at line 994 of file ImagePage.php.

ImagePage::doRenderLangOpt ( array  $langChoices,
  $curLang,
  $defaultLang 
)
protected

Output a drop-down box for language options for the file.

Parameters
array$langChoicesArray of string language codes
string$curLangLanguage code file is being viewed in.
string$defaultLangLanguage code that image is rendered in by default
Returns
string HTML to insert underneath image.

Definition at line 1072 of file ImagePage.php.

References $code, $lang, $name, $wgScript, as, Language\fetchLanguageName(), Article\getContext(), Article\getTitle(), global, Html\hidden(), Xml\option(), Html\rawElement(), Xml\submitButton(), text, and wfBCP47().

Referenced by openShowImage().

ImagePage::getContentObject ( )

Overloading Article's getContentObject method.

Omit noarticletext if sharedupload; text will be fetched from the shared upload server if possible.

Returns
string

Definition at line 301 of file ImagePage.php.

References Article\getId(), and loadFile().

ImagePage::getDisplayedFile ( )
Returns
File

Definition at line 236 of file ImagePage.php.

References $displayImg, and loadFile().

Referenced by ImageHistoryList\__construct().

ImagePage::getDisplayWidthHeight (   $maxWidth,
  $maxHeight,
  $width,
  $height 
)
protected

Get the width and height to display image at.

Note
This method assumes that it is only called if one of the dimensions are bigger than the max, or if the image is vectorized.
Parameters
int$maxWidthMax width to display at
int$maxHeightMax height to display at
int$widthActual width of the image
int$heightActual height of the image
Exceptions
MWException
Returns
array Array (width, height)

Definition at line 1154 of file ImagePage.php.

Referenced by openShowImage().

ImagePage::getDuplicates ( )
See also
WikiFilePage::getDuplicates
Returns
array|null

Definition at line 1236 of file ImagePage.php.

ImagePage::getFile ( )
See also
WikiFilePage::getFile
Returns
bool|File

Definition at line 1220 of file ImagePage.php.

ImagePage::getForeignCategories ( )
See also
WikiFilePage::getForeignCategories
Returns
TitleArray|Title[]

Definition at line 1244 of file ImagePage.php.

ImagePage::getImageLimitsFromOption (   $user,
  $optionName 
)

Returns the corresponding $wgImageLimits entry for the selected user option.

Parameters
User$user
string$optionNameName of a option to check, typically imagesize or thumbsize
Returns
array
Since
1.21

Definition at line 1044 of file ImagePage.php.

References $user, $wgImageLimits, User\getDefaultOption(), and global.

Referenced by getThumbSizes(), and openShowImage().

ImagePage::getThumbPrevText (   $params,
  $sizeLinkBigImagePreview 
)
private

Make the text under the image to say what size preview.

Parameters
$paramsarray parameters for thumbnail
$sizeLinkBigImagePreviewHTML for the current size
Returns
string HTML output

Definition at line 646 of file ImagePage.php.

References $params, Article\getContext(), and list.

Referenced by openShowImage().

ImagePage::getThumbSizes (   $origWidth,
  $origHeight 
)
protected

Get alternative thumbnail sizes.

Note
This will only list several alternatives if thumbnails are rendered on 404
Parameters
int$origWidthActual width of image
int$origHeightActual height of image
Returns
array An array of [width, height] pairs.

Definition at line 1190 of file ImagePage.php.

References $wgImageLimits, Article\getContext(), getImageLimitsFromOption(), Article\getUser(), and global.

Referenced by openShowImage().

ImagePage::getUploadUrl ( )

Definition at line 736 of file ImagePage.php.

References SpecialPage\getTitleFor(), and loadFile().

Referenced by uploadLinksBox().

ImagePage::imageDupes ( )
protected
ImagePage::imageHistory ( )
protected

If the page we've just displayed is in the "Image" namespace, we follow it with an upload history of the image and its usage.

Definition at line 794 of file ImagePage.php.

References $out, Article\getContext(), loadFile(), and uploadLinksBox().

Referenced by view().

ImagePage::isLocal ( )
See also
WikiFilePage::isLocal
Returns
bool

Definition at line 1228 of file ImagePage.php.

ImagePage::makeMetadataTable (   $metadata)
protected

Make a table with metadata to be shown in the output page.

Todo:
FIXME: Bad interface, see note on MediaHandler::formatMetadata().
Parameters
array$metadataThe array containing the Exif data
Returns
string The metadata table. This is treated as Wikitext (!)

Definition at line 273 of file ImagePage.php.

References $type, as, Sanitizer\escapeId(), and Article\getContext().

Referenced by view().

ImagePage::makeSizeLink (   $params,
  $width,
  $height 
)
private

Creates an thumbnail of specified size and returns an HTML link to it.

Parameters
array$paramsScaler parameters
int$width
int$height
Returns
string

Definition at line 684 of file ImagePage.php.

References $params, Article\getContext(), and Html\rawElement().

Referenced by openShowImage().

static ImagePage::newFromID (   $id)
static

Constructor from a page id.

Parameters
int$idArticle ID to load
Returns
ImagePage|null

Definition at line 60 of file ImagePage.php.

References $t, and Title\newFromID().

ImagePage::newPage ( Title  $title)
protected
Parameters
Title$title
Returns
WikiFilePage

Definition at line 50 of file ImagePage.php.

ImagePage::printSharedImageText ( )
protected

Show a notice that the file is from a shared repository.

Definition at line 703 of file ImagePage.php.

References $out, Article\getContext(), FileRepo\getDisplayName(), and loadFile().

Referenced by openShowImage().

ImagePage::queryImageLinks (   $target,
  $limit 
)
protected
Parameters
string$target
int$limit
Returns
ResultWrapper

Definition at line 815 of file ImagePage.php.

References $dbr, $limit, DB_SLAVE, and wfGetDB().

Referenced by imageLinks().

ImagePage::render ( )

Handler for action=render Include body text only; none of the image extras.

Definition at line 103 of file ImagePage.php.

References Article\getContext(), and view().

ImagePage::setFile (   $file)
Parameters
File$file
Returns
void

Definition at line 71 of file ImagePage.php.

ImagePage::showError (   $description)

Display an error with a wikitext description.

Parameters
string$description

Definition at line 1011 of file ImagePage.php.

References $out, and Article\getContext().

ImagePage::showTOC (   $metadata)
protected

Create the TOC.

Parameters
bool$metadataWhether or not to show the metadata link
Returns
string

Definition at line 247 of file ImagePage.php.

References Article\getContext(), and Hooks\run().

Referenced by view().

ImagePage::uploadLinksBox ( )
protected

Print out the various links at the bottom of the image page, e.g.

reupload, external editing (and instructions link) etc.

Definition at line 749 of file ImagePage.php.

References $out, $wgEnableUploads, Article\getContext(), Article\getTitle(), getUploadUrl(), Article\getUser(), global, loadFile(), Linker\makeExternalLink(), text, and UploadBase\userCanReUpload().

Referenced by imageHistory().

Member Data Documentation

File ImagePage::$displayImg
private

Definition at line 30 of file ImagePage.php.

Referenced by getDisplayedFile().

bool ImagePage::$fileLoaded
private

Definition at line 36 of file ImagePage.php.

bool ImagePage::$mExtraDescription = false
protected

Definition at line 39 of file ImagePage.php.

WikiFilePage ImagePage::$mPage
protected

Definition at line 44 of file ImagePage.php.

FileRepo ImagePage::$repo
private

Definition at line 33 of file ImagePage.php.


The documentation for this class was generated from the following file: