本文整理汇总了PHP中wfFindFile函数的典型用法代码示例。如果您正苦于以下问题:PHP wfFindFile函数的具体用法?PHP wfFindFile怎么用?PHP wfFindFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfFindFile函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getEmbedCode
public function getEmbedCode()
{
$articleId = $this->getVal('articleId', '');
$title = $this->getVal('fileTitle', '');
$width = $this->getVal('width', '');
$autoplay = $this->getVal('autoplay', false);
$error = '';
if (empty($title)) {
$error = $this->wf->msgForContent('videohandler-error-missing-parameter', 'title');
} else {
if (empty($width)) {
$error = $this->wf->msgForContent('videohandler-error-missing-parameter', 'width');
} else {
$title = Title::newFromText($title, NS_FILE);
$file = $title instanceof Title ? wfFindFile($title) : false;
if ($file === false) {
$error = $this->wf->msgForContent('videohandler-error-video-no-exist');
} else {
$videoId = $file->getVideoId();
$assetUrl = $file->getPlayerAssetUrl();
$embedCode = $file->getEmbedCode($articleId, $width, $autoplay, true);
$this->setVal('videoId', $videoId);
$this->setVal('asset', $assetUrl);
$this->setVal('embedCode', $embedCode);
//@todo support json embed code
}
}
}
if (!empty($error)) {
$this->setVal('error', $error);
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:VideoHandlerController.class.php
示例2: addWikiaVars
public function addWikiaVars(&$obj, BaseTemplate &$tpl)
{
global $wgUser;
wfProfileIn(__METHOD__);
// ads
$this->setupAds($tpl);
// setup footer links
$tpl->set('footerlinks', wfMsgExt('Shared-Monobook-footer-wikia-links', 'parse'));
# rt33045
$tpl->set('contact', '<a href="' . $wgUser->getSkin()->makeUrl('Special:Contact') . '" title="Contact Wikia">Contact Wikia</a>');
# BAC-1036, CE-278
/* Replace Wikia logo path
This functionality is for finding proper path of Wiki.png instead of const one from wgLogo
wikia logo should be stored under File:Wiki.png on current wikia. If wfFindFile doesn't find it
on current wikia it tires to fallback to starter.wikia.com where the default one is stored
*/
$logoPage = Title::newFromText('Wiki.png', NS_FILE);
$logoFile = wfFindFile($logoPage);
if ($logoFile) {
$tpl->set('logopath', $logoFile->getUrl());
} else {
$tpl->set('logopath', wfReplaceImageServer($tpl->data['logopath']));
}
wfProfileOut(__METHOD__);
return true;
}
开发者ID:yusufchang,项目名称:app,代码行数:26,代码来源:WikiaMonoBook.php
示例3: getMediaData
/**
* Get data for each gallery item
* @param array $item Data about the media item
* @param int $index Where the item shows up in the gallery
* @return array|null
*/
protected function getMediaData(array $item, $index)
{
$file = wfFindFile($item['title']);
if (!$file instanceof File) {
WikiaLogger::instance()->error('File with title: ' . $item['title'] . 'doesn\'t exist', ['class' => __CLASS__]);
return null;
}
$dimension = MediaGalleryHelper::getImageWidth($this->itemCount, $index);
$thumbUrl = WikiaFileHelper::getSquaredThumbnailUrl($file, $dimension);
$dimensions = ['width' => $dimension, 'height' => $dimension];
$thumb = $file->transform($dimensions);
if (!$thumb instanceof ThumbnailImage) {
WikiaLogger::instance()->error('ThumbnailImage from title: ' . $item['title'] . ' couldn\'t be created.', ['thumbClass' => get_class($thumb)]);
return null;
}
$thumb->setUrl($thumbUrl);
$thumbnail = $this->app->renderView('ThumbnailController', 'gallery', ['thumb' => $thumb]);
$caption = '';
if (!empty($item['caption'])) {
// parse any wikitext in caption. Logic borrowed from WikiaMobileMediaService::renderMediaGroup.
$parser = $this->getParser();
$caption = $parser->internalParse($item['caption']);
$parser->replaceLinkHolders($caption);
$caption = $parser->killMarkers($caption);
}
$title = $file->getTitle();
return ['thumbUrl' => $thumbUrl, 'thumbHtml' => $thumbnail, 'caption' => $caption, 'linkHref' => $file->getTitle()->getLinkURL(), 'title' => $title->getText(), 'dbKey' => $title->getDBKey()];
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:34,代码来源:MediaGalleryModel.class.php
示例4: execute
public function execute()
{
global $wgUser;
# Change to current working directory
$oldCwd = getcwd();
chdir($oldCwd);
# Options processing
$user = $this->getOption('u', 'Delete page script');
$reason = $this->getOption('r', '');
$interval = $this->getOption('i', 0);
if ($this->hasArg()) {
$file = fopen($this->getArg(), 'r');
} else {
$file = $this->getStdin();
}
# Setup
if (!$file) {
$this->error("Unable to read file, exiting", true);
}
$wgUser = User::newFromName($user);
$dbw = wfGetDB(DB_MASTER);
# Handle each entry
for ($linenum = 1; !feof($file); $linenum++) {
$line = trim(fgets($file));
if ($line == '') {
continue;
}
$page = Title::newFromText($line);
if (is_null($page)) {
$this->output("Invalid title '{$line}' on line {$linenum}\n");
continue;
}
if (!$page->exists()) {
$this->output("Skipping nonexistent page '{$line}'\n");
continue;
}
$this->output($page->getPrefixedText());
$dbw->begin();
if ($page->getNamespace() == NS_FILE) {
$art = new ImagePage($page);
$img = wfFindFile($art->mTitle);
if (!$img || !$img->isLocal() || !$img->delete($reason)) {
$this->output(" FAILED to delete image file... ");
}
} else {
$art = new Article($page);
}
$success = $art->doDeleteArticle($reason);
$dbw->commit();
if ($success) {
$this->output(" Deleted!\n");
} else {
$this->output(" FAILED to delete article\n");
}
if ($interval) {
sleep($interval);
}
wfWaitForSlaves();
}
}
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:60,代码来源:deleteBatch.php
示例5: execute
/**
* Start doing stuff
*
* @param $par Mixed: parameter passed to the special page or null
*/
public function execute($par)
{
global $wgOut;
wfProfileIn(__METHOD__);
$dbr = wfGetDB(DB_SLAVE);
$where = array();
if ($this->mQuery) {
$where = array('article_tag' => $this->mQuery);
}
$foo = $dbr->select('imagetags', 'img_name', $where, __METHOD__);
$imageNames = array();
foreach ($foo as $omg) {
$imageNames[] = $omg;
}
$imageNamesString = implode(',', $imageNames);
// @todo CHECKME
$res = $dbr->select('image', array('img_name', 'img_timestamp'), array("img_name IN {$imageNamesString}"), __METHOD__, array('ORDER BY' => 'img_timestamp DESC', 'LIMIT' => TAGGEDIMGS_PER_PAGE, 'OFFSET' => $this->mStartPage * TAGGEDIMGS_PER_PAGE));
foreach ($res as $o) {
$img = wfFindFile($o->img_name);
$this->add($img, '');
}
$res = $dbr->select('imagetags', 'COUNT(img_name) AS img_count', $where, __METHOD__, array('GROUP BY' => 'article_tag'));
$o = $dbr->fetchObject($res);
if ($o) {
$this->mCount = $o->img_count;
}
$wgOut->setPageTitle(wfMsg('imagetagging-taggedimages-title', $this->mQuery ? $this->mQuery : 'all'));
$wgOut->setRobotPolicy('noindex,nofollow');
$wgOut->addHTML($this->toHTML());
wfProfileOut(__METHOD__);
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:36,代码来源:ImageTagging_body.php
示例6: addImage
/**
* Add image to parser output for later usage
*
* @param string $title
*/
public function addImage($title)
{
$file = wfFindFile($title);
$tmstmp = $file ? $file->getTimestamp() : false;
$sha1 = $file ? $file->getSha1() : false;
$this->parser->getOutput()->addImage($title, $tmstmp, $sha1);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:MediaWikiParserService.php
示例7: displayCategoryTable
function displayCategoryTable()
{
global $wgOut;
$catmap = Categoryhelper::getIconMap();
ksort($catmap);
$queryString = WikihowCategoryViewer::getViewModeParam();
if (!empty($queryString)) {
$queryString = "?" . $queryString;
}
$wgOut->addHTML("<div class='section_text'>");
foreach ($catmap as $cat => $image) {
$title = Title::newFromText($image);
if ($title) {
$file = wfFindFile($title, false);
$sourceWidth = $file->getWidth();
$sourceHeight = $file->getHeight();
$heightPreference = false;
if (self::CAT_HEIGHT > self::CAT_WIDTH && $sourceWidth > $sourceHeight) {
//desired image is portrait
$heightPreference = true;
}
$thumb = $file->getThumbnail(self::CAT_WIDTH, self::CAT_HEIGHT, true, true, $heightPreference);
$category = urldecode(str_replace("-", " ", $cat));
$catTitle = Title::newFromText("Category:" . $category);
if ($catTitle) {
$wgOut->addHTML("<div class='thumbnail'><a href='{$catTitle->getLocalUrl()}{$queryString}'><img src='" . wfGetPad($thumb->getUrl()) . "' /><div class='text'><p><span>{$category}</span></p></div></a></div>");
}
}
}
$wgOut->addHTML("<div class='clearall'></div>");
$wgOut->addHTML("</div><!-- end section_text -->");
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:32,代码来源:Categorylisting.body.php
示例8: getImagePreview
public static function getImagePreview()
{
wfProfileIn(__METHOD__);
global $wgTitle;
// limit dimensions of returned image
global $wgRequest;
$maxWidth = $wgRequest->getInt('maxwidth', 500) - 20;
$maxHeight = $wgRequest->getInt('maxheight', 300) - 75;
$image = wfFindFile($wgTitle);
if (empty($image)) {
wfProfileOut(__METHOD__);
return array();
}
// get original dimensions of an image
$width = $image->getWidth();
$height = $image->getHeight();
// don't try to make image larger
if ($width > $maxWidth or $height > $maxHeight) {
$width = $maxWidth;
$height = $maxHeight;
}
// generate thumbnail
$thumb = $image->transform(array('width' => $width, 'height' => $height));
wfProfileOut(__METHOD__);
return array('width' => $thumb->getWidth(), 'height' => $thumb->getHeight(), 'html' => $thumb->toHtml());
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:26,代码来源:MyHomeAjax.class.php
示例9: execute
public function execute()
{
global $wgRequest;
wfProfileIn(__METHOD__);
extract($this->extractRequestParams());
$imageServing = new ImageServing(array($Id), $Size, array("w" => $Size, "h" => $Height));
foreach ($imageServing->getImages(1) as $key => $value) {
$tmpTitle = Title::newFromText($value[0]['name'], NS_FILE);
$image = wfFindFile($tmpTitle);
// BugId:31460 ForeignAPIFile does not support loading metadata from the file itself.
// Note, that ForeignAPIFile::getPath() is a dommy method and always returns false, so
// the 'File not found' dieUsage() call in the next if block is inevitable for ForeignAPIFile objects.
if ($FailOnFileNotFound && false == $image instanceof ForeignAPIFile) {
$image->loadFromFile();
// side effect forces isMissing() check to fail if file really does not exist
}
if (!($image instanceof File && $image->exists()) || $image->isMissing() || $image->mime == 'unknown/unknown') {
$this->dieUsage('File not found', 'filenotfound');
}
$width = $image->getWidth();
$height = $image->getHeight();
$imageUrl = $imageServing->getUrl($image->getName(), $width, $height);
}
$result = $this->getResult();
$result->addValue('image', $this->getModuleName(), $imageUrl);
$result->addValue('imagepage', $this->getModuleName(), $tmpTitle->getFullUrl());
wfProfileOut(__METHOD__);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:WikiaApiCroppedImage.php
示例10: execute
function execute($par)
{
global $wgRequest, $wgOut;
$this->setHeaders();
$this->outputHeader();
$file = !is_null($par) ? $par : $wgRequest->getText('file');
$title = Title::makeTitleSafe(NS_FILE, $file);
if (!$title instanceof Title || $title->getNamespace() != NS_FILE) {
$this->showForm($title);
} else {
$file = wfFindFile($title);
if ($file && $file->exists()) {
$url = $file->getURL();
$width = $wgRequest->getInt('width', -1);
$height = $wgRequest->getInt('height', -1);
if ($width != -1) {
$mto = $file->transform(array('width' => $width, 'height' => $height));
if ($mto && !$mto->isError()) {
$url = $mto->getURL();
}
}
$wgOut->redirect($url);
} else {
$wgOut->setStatusCode(404);
$this->showForm($title);
}
}
}
开发者ID:GodelDesign,项目名称:Godel,代码行数:28,代码来源:SpecialFilepath.php
示例11: getBadge
public static function getBadge($badgeTypeId)
{
wfProfileIn(__METHOD__);
global $wgExternalSharedDB;
global $wgEnableAchievementsStoreLocalData;
$badges = array();
if (empty($wgEnableAchievementsStoreLocalData)) {
$dbr = wfGetDB(DB_SLAVE, array(), $wgExternalSharedDB);
} else {
$dbr = wfGetDB(DB_SLAVE);
}
$res = $dbr->select('ach_custom_badges', array('id', 'enabled', 'sponsored', 'badge_tracking_url', 'hover_tracking_url', 'click_tracking_url'), array('id' => $badgeTypeId), __METHOD__);
if ($row = $dbr->fetchObject($res)) {
$badge = array();
$image = wfFindFile(AchConfig::getInstance()->getBadgePictureName($row->id));
if ($image) {
$hoverImage = wfFindFile(AchConfig::getInstance()->getHoverPictureName($row->id));
$badge['type_id'] = $row->id;
$badge['enabled'] = $row->enabled;
$badge['thumb_url'] = $image->createThumb(90);
$badge['awarded_users'] = AchPlatinumService::getAwardedUserNames($row->id);
$badge['is_sponsored'] = $row->sponsored;
$badge['badge_tracking_url'] = $row->badge_tracking_url;
$badge['hover_tracking_url'] = $row->hover_tracking_url;
$badge['click_tracking_url'] = $row->click_tracking_url;
$badge['hover_content_url'] = is_object($hoverImage) ? wfReplaceImageServer($hoverImage->getFullUrl()) : null;
wfProfileOut(__METHOD__);
return $badge;
}
}
wfProfileOut(__METHOD__);
return false;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:AchPlatinumService.class.php
示例12: getVideoData
public function getVideoData($titleText, $thumbnailWidth, $videoWidth = self::DEFAULT_OASIS_VIDEO_WIDTH, $autoplay = true, $useMaster = false, $cityShort = 'life', $videoHeight = '', $useJWPlayer = true, $inAjaxResponse = false)
{
wfProfileIn(__METHOD__);
$data = array();
$title = Title::newFromText($titleText, NS_FILE);
$file = wfFindFile($title);
if (!WikiaFileHelper::isVideoFile($file)) {
$data['error'] = wfMsg('related-videos-error-no-video-title');
} else {
$meta = unserialize($file->getMetadata());
$trans = $file->transform(array('width' => $thumbnailWidth, 'height' => -1));
$thumb = array('width' => $trans->width, 'height' => $trans->height, 'thumb' => $trans->url);
$data['external'] = 0;
// false means it is not set. Meaningful values: 0 and 1.
$data['id'] = $titleText;
$data['fullUrl'] = $title->getFullURL();
$data['prefixedUrl'] = $title->getPrefixedURL();
$data['description'] = $file->getDescription();
$data['duration'] = $meta['duration'];
$data['embedCode'] = null;
$data['embedJSON'] = null;
$data['provider'] = $file->minor_mime;
$data['thumbnailData'] = $thumb;
$data['title'] = $file->getTitle()->getText();
$data['timestamp'] = $file->getTimestamp();
$data['uniqueId'] = $file->getVideoUniqueId();
}
$data['owner'] = '';
$data['ownerUrl'] = '';
wfProfileOut(__METHOD__);
return $data;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:RelatedVideosData.class.php
示例13: formatImageLink
function formatImageLink($imageName, $linkTarget, $altText)
{
if (preg_match('/^(http|ftp)/', $imageName)) {
$imageUrl = $imageName;
$sizeAttrs = "";
} else {
$imageTitle = Title::makeTitleSafe(NS_IMAGE, $imageName);
if (is_null($imageTitle)) {
return "(invalid image name)";
}
$image = wfFindFile($imageTitle);
if (is_null($image)) {
return "(invalid image)";
}
$imageUrl = $image->getViewURL();
$sizeAttrs = 'width="' . IntVal($image->getWidth()) . '" height="' . IntVal($image->getHeight()) . '"';
}
if (preg_match('/^(http|ftp)/', $linkTarget)) {
$linkUrl = $linkTarget;
} else {
$linkTitle = Title::newFromText($linkTarget);
if (is_null($linkTitle)) {
return "(invalid link target)";
}
$linkUrl = $linkTitle->getLocalUrl();
}
return '<a href="' . htmlspecialchars($linkUrl) . '"><img src="' . htmlspecialchars($imageUrl) . '" ' . $sizeAttrs . ' alt="' . htmlspecialchars($altText) . '" title="' . htmlspecialchars($altText) . '" /></a>';
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:ImageLink.php
示例14: onAfterInitialize
/**
* set appropriate status code for deleted pages
*
* @author ADi
* @author Władysław Bodzek <[email protected]>
* @param Title $title
* @param Article $article
* @return bool
*/
public static function onAfterInitialize(&$title, &$article, &$output)
{
if (!$title->exists() && $title->isDeleted()) {
$setDeletedStatusCode = true;
// handle special cases
switch ($title->getNamespace()) {
case NS_CATEGORY:
// skip non-empty categories
if (Category::newFromTitle($title)->getPageCount() > 0) {
$setDeletedStatusCode = false;
}
break;
case NS_FILE:
// skip existing file with deleted description
$file = wfFindFile($title);
if ($file && $file->exists()) {
$setDeletedStatusCode = false;
}
break;
}
if ($setDeletedStatusCode) {
$output->setStatusCode(SEOTweaksHooksHelper::DELETED_PAGES_STATUS_CODE);
}
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:SEOTweaksHooksHelper.class.php
示例15: checkDupImage
/**
* Check to see if an image was already uploaded for wikiphoto
*/
public static function checkDupImage($filename)
{
$dbr = self::getDB('read');
$contents = @file_get_contents($filename);
if ($contents) {
$sha1 = sha1($contents);
$db_title = $dbr->selectField('images_sha1', 'is_page_title', array('is_sha1' => $sha1), __METHOD__);
if ($db_title) {
$title = Title::newFromDBkey('Image:' . $db_title);
if ($title && $title->exists()) {
$file = wfFindFile($title);
if ($file) {
$path = $file->getPath();
if ($path && @file_exists($path)) {
$contents = @file_get_contents($path);
if ($contents) {
$sha1_orig = sha1($contents);
if ($sha1_orig == $sha1) {
return $title->getText();
}
}
}
}
}
}
}
return '';
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:31,代码来源:DupImage.class.php
示例16: execute
function execute($par)
{
$this->setHeaders();
$this->outputHeader();
$request = $this->getRequest();
$file = !is_null($par) ? $par : $request->getText('file');
$title = Title::newFromText($file, NS_FILE);
if (!$title instanceof Title || $title->getNamespace() != NS_FILE) {
$this->showForm($title);
} else {
$file = wfFindFile($title);
if ($file && $file->exists()) {
// Default behaviour: Use the direct link to the file.
$url = $file->getURL();
$width = $request->getInt('width', -1);
$height = $request->getInt('height', -1);
// If a width is requested...
if ($width != -1) {
$mto = $file->transform(array('width' => $width, 'height' => $height));
// ... and we can
if ($mto && !$mto->isError()) {
// ... change the URL to point to a thumbnail.
$url = $mto->getURL();
}
}
$this->getOutput()->redirect($url);
} else {
$this->getOutput()->setStatusCode(404);
$this->showForm($title);
}
}
}
开发者ID:seedbank,项目名称:old-repo,代码行数:32,代码来源:SpecialFilepath.php
示例17: openShowVideo
protected function openShowVideo()
{
wfProfileIn(__METHOD__);
$app = F::app();
JSMessages::enqueuePackage('VideoPage', JSMessages::EXTERNAL);
$file = $this->getDisplayedFile();
//If a timestamp is specified, show the archived version of the video (if it exists)
$timestamp = $app->wg->Request->getInt('t', 0);
if ($timestamp > 0) {
$archiveFile = wfFindFile($this->mTitle, $timestamp);
if ($archiveFile instanceof LocalFile && $archiveFile->exists()) {
$file = $archiveFile;
}
}
$autoplay = $app->wg->VideoPageAutoPlay;
// JS for VideoBootstrap
$embedCode = $file->getEmbedCode(self::VIDEO_WIDTH, ['autoplay' => $autoplay]);
// Tell JS that HTML will already be loaded on the page.
$embedCode['htmlPreloaded'] = 1;
// HTML is no longer needed in VideoBootstrap
$html = $embedCode['html'];
unset($embedCode['html']);
$videoDisplay = '<script type="text/javascript">window.playerParams = ' . json_encode($embedCode) . ';</script>';
$videoDisplay .= '<div class="fullImageLink" id="file">' . $html . '</div>';
$videoDisplay .= $this->getVideoInfoLine($file);
$app->wg->Out->addHTML($videoDisplay);
wfProfileOut(__METHOD__);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:WikiaFilePage.php
示例18: Wordmark
public function Wordmark()
{
$themeSettings = new ThemeSettings();
$settings = $themeSettings->getSettings();
$wordmarkURL = '';
if ($settings['wordmark-type'] == 'graphic') {
wfProfileIn(__METHOD__ . 'graphicWordmark');
$imageTitle = Title::newFromText($themeSettings::WordmarkImageName, NS_IMAGE);
$file = wfFindFile($imageTitle);
$attributes = [];
$wordmarkStyle = '';
if ($file instanceof File) {
$wordmarkURL = $file->getUrl();
$attributes[] = 'width="' . $file->width . '"';
$attributes[] = 'height="' . $file->height . '"';
if (!empty($attributes)) {
$this->wordmarkStyle = ' ' . implode(' ', $attributes) . ' ';
}
}
wfProfileOut(__METHOD__ . 'graphicWordmark');
}
$mainPageURL = Title::newMainPage()->getLocalURL();
$this->setVal('mainPageURL', $mainPageURL);
$this->setVal('wordmarkText', $settings['wordmark-text']);
$this->setVal('wordmarkFontSize', $settings['wordmark-font-size']);
$this->setVal('wordmarkUrl', $wordmarkURL);
$this->setVal('wordmarkStyle', $wordmarkStyle);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:LocalNavigationController.class.php
示例19: getFile
/**
* Get the current file version (null if this not a File page)
* @return File|null|false
*/
public function getFile()
{
if ($this->file === null && $this->mTitle->getNamespace() == NS_FILE) {
$this->file = wfFindFile($this->mTitle);
}
return $this->file;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:11,代码来源:FlaggableWikiPage.php
示例20: newAttachmentData
function newAttachmentData($id)
{
$obj = $this->cacheManager->retrieveAtachmentData($id);
if ($obj instanceof \PageAttachment\Attachment\AttachmentData) {
$pageAttachmentData = $obj;
} else {
$title = \Title::newFromID($id);
$article = new \Article($title, NS_FILE);
$file = \wfFindFile($title);
$size = $file->getSize();
$description = $this->replaceHtmlTags($file->getDescriptionText());
$dateUploaded = $article->getTimestamp();
$uploadedBy = null;
if ($this->runtimeConfig->isShowUserRealName()) {
$uploadedBy = \User::whoIsReal($article->getUser());
}
if ($uploadedBy == null) {
$uploadedBy = \User::whoIs($article->getUser());
}
$attachedToPages = null;
if ($this->securityManager->isRemoveAttachmentPermanentlyEnabled()) {
$attachedToPages = $this->getAttachedToPages($id);
}
$pageAttachmentData = new AttachmentData($id, $title, $size, $description, $dateUploaded, $uploadedBy, $attachedToPages);
$this->cacheManager->storeAttachmentData($pageAttachmentData);
}
return $pageAttachmentData;
}
开发者ID:mediawiki-extensions,项目名称:mediawiki-page-attachment,代码行数:28,代码来源:AttachmentDataFactory.php
注:本文中的wfFindFile函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论