本文整理汇总了PHP中ParserOutput::addImage方法的典型用法代码示例。如果您正苦于以下问题:PHP ParserOutput::addImage方法的具体用法?PHP ParserOutput::addImage怎么用?PHP ParserOutput::addImage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParserOutput
的用法示例。
在下文中一共展示了ParserOutput::addImage方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchFileAndTitle
/**
* Fetch a file and its title and register a reference to it.
* If 'broken' is a key in $options then the file will appear as a broken thumbnail.
* @param Title $title
* @param Array $options Array of options to RepoGroup::findFile
* @return Array ( File or false, Title of file )
*/
function fetchFileAndTitle($title, $options = array())
{
if (isset($options['broken'])) {
$file = false;
// broken thumbnail forced by hook
} elseif (isset($options['sha1'])) {
// get by (sha1,timestamp)
$file = RepoGroup::singleton()->findFileFromKey($options['sha1'], $options);
} else {
// get by (name,timestamp)
$file = wfFindFile($title, $options);
}
$time = $file ? $file->getTimestamp() : false;
$sha1 = $file ? $file->getSha1() : false;
# Register the file as a dependency...
$this->mOutput->addImage($title->getDBkey(), $time, $sha1);
if ($file && !$title->equals($file->getTitle())) {
# Update fetched file title
$title = $file->getTitle();
if (is_null($file->getRedirectedTitle())) {
# This file was not a redirect, but the title does not match.
# Register under the new name because otherwise the link will
# get lost.
$this->mOutput->addImage($title->getDBkey(), $time, $sha1);
}
}
return array($file, $title);
}
示例2: fetchFileAndTitle
/**
* Fetch a file and its title and register a reference to it.
* If 'broken' is a key in $options then the file will appear as a broken thumbnail.
* @param Title $title
* @param array $options Array of options to RepoGroup::findFile
* @return Array ( File or false, Title of file )
*/
function fetchFileAndTitle($title, $options = array())
{
$file = $this->fetchFileNoRegister($title, $options);
$time = $file ? $file->getTimestamp() : false;
$sha1 = $file ? $file->getSha1() : false;
# Register the file as a dependency...
$this->mOutput->addImage($title->getDBkey(), $time, $sha1);
if ($file && !$title->equals($file->getTitle())) {
# Update fetched file title
$title = $file->getTitle();
$this->mOutput->addImage($title->getDBkey(), $time, $sha1);
}
return array($file, $title);
}
示例3: fetchFileAndTitle
/**
* Fetch a file and its title and register a reference to it.
* If 'broken' is a key in $options then the file will appear as a broken thumbnail.
* @param Title $title
* @param array $options Array of options to RepoGroup::findFile
* @return Array ( File or false, Title of file )
*/
function fetchFileAndTitle( $title, $options = array() ) {
$file = $this->fetchFileNoRegister( $title, $options );
$time = $file ? $file->getTimestamp() : false;
$sha1 = $file ? $file->getSha1() : false;
# Register the file as a dependency...
$this->mOutput->addImage( $title->getDBkey(), $time, $sha1 );
if ( $file && !$title->equals( $file->getTitle() ) ) {
# Update fetched file title
$title = $file->getTitle();
if ( is_null( $file->getRedirectedTitle() ) ) {
# This file was not a redirect, but the title does not match.
# Register under the new name because otherwise the link will
# get lost.
$this->mOutput->addImage( $title->getDBkey(), $time, $sha1 );
}
}
return array( $file, $title );
}