当前位置: 首页>>代码示例>>PHP>>正文


PHP File::getTimestamp方法代码示例

本文整理汇总了PHP中File::getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:PHP File::getTimestamp方法的具体用法?PHP File::getTimestamp怎么用?PHP File::getTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在File的用法示例。


在下文中一共展示了File::getTimestamp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getVideoDataByFile

 /**
  * get video data from file
  * @param File $file
  * @param boolean $premiumOnly
  * @return array|null  $video
  */
 public function getVideoDataByFile($file, $premiumOnly = false)
 {
     $app = F::app();
     $app->wf->ProfileIn(__METHOD__);
     $video = null;
     if ($file instanceof File && $file->exists() && F::build('WikiaFileHelper', array($file), 'isFileTypeVideo')) {
         if (!($premiumOnly && $file->isLocal())) {
             $fileMetadata = $file->getMetadata();
             $userId = $file->getUser('id');
             $addedAt = $file->getTimestamp() ? $file->getTimestamp() : $this->wf->Timestamp(TS_MW);
             $duration = 0;
             $hdfile = 0;
             if ($fileMetadata) {
                 $fileMetadata = unserialize($fileMetadata);
                 if (array_key_exists('duration', $fileMetadata)) {
                     $duration = $fileMetadata['duration'];
                 }
                 if (array_key_exists('hd', $fileMetadata)) {
                     $hdfile = $fileMetadata['hd'] ? 1 : 0;
                 }
             }
             $premium = $file->isLocal() ? 0 : 1;
             $video = array('videoTitle' => $file->getTitle()->getDBKey(), 'addedAt' => $addedAt, 'addedBy' => $userId, 'duration' => $duration, 'premium' => $premium, 'hdfile' => $hdfile);
         }
     }
     $app->wf->ProfileOut(__METHOD__);
     return $video;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:VideoInfoHelper.class.php

示例2: indexCrawledDocuments

 /**
  * Indexes document that was set in __construct.
  */
 public function indexCrawledDocuments()
 {
     $sFileName = $this->oFile->getName();
     $oFileMinorDocType = $this->oDbr->selectRow('image', 'img_minor_mime', array('img_name' => $sFileName, 'img_major_mime' => 'application'));
     if ($oFileMinorDocType === false) {
         return;
     }
     $sFileDocType = $this->mimeDecoding($oFileMinorDocType->img_minor_mime, $sFileName);
     if (!$this->checkDocType($sFileDocType, $sFileName)) {
         return;
     }
     $sFileTimestamp = $this->oFile->getTimestamp();
     $sVirtualFilePath = $this->oFile->getPath();
     $oFileRepoLocalRef = $this->oFile->getRepo()->getLocalReference($sVirtualFilePath);
     if (!is_null($oFileRepoLocalRef)) {
         $sFilePath = $oFileRepoLocalRef->getPath();
     }
     if ($this->checkExistence($sVirtualFilePath, 'repo', $sFileTimestamp, $sFileName)) {
         return;
     }
     $sFileText = $this->getFileText($sFilePath, $sFileName);
     $doc = $this->makeRepoDocument($sFileDocType, $sFileName, $sFileText, $sFilePath, $sFileTimestamp, $sVirtualFilePath);
     if ($doc) {
         // mode and ERROR_MSG_KEY are only passed for the case when addDocument fails
         $this->oMainControl->addDocument($doc, $this->mode, self::S_ERROR_MSG_KEY);
     }
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:30,代码来源:BuildIndexMwSingleFile.class.php

示例3: getTimestamp

 /**
  * @return String: timestamp
  */
 function getTimestamp()
 {
     if ($this->mRevision) {
         return $this->mRevision->getTimestamp();
     } elseif ($this->mImage) {
         return $this->mImage->getTimestamp();
     }
     return '';
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:12,代码来源:SearchResult.php

示例4: getLink

 /**
  * Get the link to the file.
  * Overridden by RevDelArchivedFileItem.
  * @return string
  */
 protected function getLink()
 {
     $date = htmlspecialchars($this->list->getLanguage()->userTimeAndDate($this->file->getTimestamp(), $this->list->getUser()));
     if (!$this->isDeleted()) {
         # Regular files...
         return Html::rawElement('a', array('href' => $this->file->getUrl()), $date);
     }
     # Hidden files...
     if (!$this->canViewContent()) {
         $link = $date;
     } else {
         $link = Linker::link(SpecialPage::getTitleFor('Revisiondelete'), $date, array(), array('target' => $this->list->title->getPrefixedText(), 'file' => $this->file->getArchiveName(), 'token' => $this->list->getUser()->getEditToken($this->file->getArchiveName())));
     }
     return '<span class="history-deleted">' . $link . '</span>';
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:20,代码来源:RevDelFileItem.php

示例5: getExtendedMetadataFromFile

 /**
  * Get file-based metadata in standardized format.
  *
  * Note that for a remote file, this might return metadata supplied by extensions.
  *
  * @param File $file File to use
  * @return array [<property name> => ['value' => <value>]], or [] on error
  * @since 1.23
  */
 protected function getExtendedMetadataFromFile(File $file)
 {
     // If this is a remote file accessed via an API request, we already
     // have remote metadata so we just ignore any local one
     if ($file instanceof ForeignAPIFile) {
         // In case of error we pretend no metadata - this will get cached.
         // Might or might not be a good idea.
         return $file->getExtendedMetadata() ?: [];
     }
     $uploadDate = wfTimestamp(TS_ISO_8601, $file->getTimestamp());
     $fileMetadata = ['DateTime' => ['value' => $uploadDate, 'source' => 'mediawiki-metadata']];
     $title = $file->getTitle();
     if ($title) {
         $text = $title->getText();
         $pos = strrpos($text, '.');
         if ($pos) {
             $name = substr($text, 0, $pos);
         } else {
             $name = $text;
         }
         $fileMetadata['ObjectName'] = ['value' => $name, 'source' => 'mediawiki-metadata'];
     }
     return $fileMetadata;
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:33,代码来源:FormatMetadata.php

示例6: getThumbForLine

 /**
  * @param File $file
  * @return string
  */
 protected function getThumbForLine($file)
 {
     $lang = $this->getLanguage();
     $user = $this->getUser();
     if ($file->allowInlineDisplay() && $file->userCan(File::DELETED_FILE, $user) && !$file->isDeleted(File::DELETED_FILE)) {
         $params = ['width' => '120', 'height' => '120'];
         $timestamp = wfTimestamp(TS_MW, $file->getTimestamp());
         $thumbnail = $file->transform($params);
         $options = ['alt' => $this->msg('filehist-thumbtext', $lang->userTimeAndDate($timestamp, $user), $lang->userDate($timestamp, $user), $lang->userTime($timestamp, $user))->text(), 'file-link' => true];
         if (!$thumbnail) {
             return $this->msg('filehist-nothumb')->escaped();
         }
         return $thumbnail->toHtml($options);
     } else {
         return $this->msg('filehist-nothumb')->escaped();
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:21,代码来源:ImageHistoryList.php

示例7: getTimestamp

 /**
  * Extract the timestamp of the old version
  *
  * @return string
  */
 private function getTimestamp()
 {
     return $this->oldfile->getTimestamp();
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:9,代码来源:FileDeleteForm.php

示例8: writeUpload

 /**
  * @param File $file
  * @param bool $dumpContents
  * @return string
  */
 function writeUpload($file, $dumpContents = false)
 {
     if ($file->isOld()) {
         $archiveName = "      " . Xml::element('archivename', null, $file->getArchiveName()) . "\n";
     } else {
         $archiveName = '';
     }
     if ($dumpContents) {
         $be = $file->getRepo()->getBackend();
         # Dump file as base64
         # Uses only XML-safe characters, so does not need escaping
         # @todo Too bad this loads the contents into memory (script might swap)
         $contents = '      <contents encoding="base64">' . chunk_split(base64_encode($be->getFileContents(array('src' => $file->getPath())))) . "      </contents>\n";
     } else {
         $contents = '';
     }
     if ($file->isDeleted(File::DELETED_COMMENT)) {
         $comment = Xml::element('comment', array('deleted' => 'deleted'));
     } else {
         $comment = Xml::elementClean('comment', null, $file->getDescription());
     }
     return "    <upload>\n" . $this->writeTimestamp($file->getTimestamp()) . $this->writeContributor($file->getUser('id'), $file->getUser('text')) . "      " . $comment . "\n" . "      " . Xml::element('filename', null, $file->getName()) . "\n" . $archiveName . "      " . Xml::element('src', null, $file->getCanonicalURL()) . "\n" . "      " . Xml::element('size', null, $file->getSize()) . "\n" . "      " . Xml::element('sha1base36', null, $file->getSha1()) . "\n" . "      " . Xml::element('rel', null, $file->getRel()) . "\n" . $contents . "    </upload>\n";
 }
开发者ID:Habatchii,项目名称:wikibase-for-mediawiki,代码行数:28,代码来源:Export.php

示例9: doQuery

 function doQuery()
 {
     if ($this->mQueryDone) {
         return;
     }
     $this->mImg = $this->mImagePage->getFile();
     // ensure loading
     if (!$this->mImg->exists()) {
         return;
     }
     $queryLimit = $this->mLimit + 1;
     // limit plus extra row
     if ($this->mIsBackwards) {
         // Fetch the file history
         $this->mHist = $this->mImg->getHistory($queryLimit, null, $this->mOffset, false);
         // The current rev may not meet the offset/limit
         $numRows = count($this->mHist);
         if ($numRows <= $this->mLimit && $this->mImg->getTimestamp() > $this->mOffset) {
             $this->mHist = array_merge(array($this->mImg), $this->mHist);
         }
     } else {
         // The current rev may not meet the offset
         if (!$this->mOffset || $this->mImg->getTimestamp() < $this->mOffset) {
             $this->mHist[] = $this->mImg;
         }
         // Old image versions (fetch extra row for nav links)
         $oiLimit = count($this->mHist) ? $this->mLimit : $this->mLimit + 1;
         // Fetch the file history
         $this->mHist = array_merge($this->mHist, $this->mImg->getHistory($oiLimit, $this->mOffset, null, false));
     }
     $numRows = count($this->mHist);
     // Total number of query results
     if ($numRows) {
         # Index value of top item in the list
         $firstIndex = $this->mIsBackwards ? $this->mHist[$numRows - 1]->getTimestamp() : $this->mHist[0]->getTimestamp();
         # Discard the extra result row if there is one
         if ($numRows > $this->mLimit && $numRows > 1) {
             if ($this->mIsBackwards) {
                 # Index value of item past the index
                 $this->mPastTheEndIndex = $this->mHist[0]->getTimestamp();
                 # Index value of bottom item in the list
                 $lastIndex = $this->mHist[1]->getTimestamp();
                 # Display range
                 $this->mRange = array(1, $numRows - 1);
             } else {
                 # Index value of item past the index
                 $this->mPastTheEndIndex = $this->mHist[$numRows - 1]->getTimestamp();
                 # Index value of bottom item in the list
                 $lastIndex = $this->mHist[$numRows - 2]->getTimestamp();
                 # Display range
                 $this->mRange = array(0, $numRows - 2);
             }
         } else {
             # Setting indexes to an empty string means that they will be
             # omitted if they would otherwise appear in URLs. It just so
             # happens that this  is the right thing to do in the standard
             # UI, in all the relevant cases.
             $this->mPastTheEndIndex = '';
             # Index value of bottom item in the list
             $lastIndex = $this->mIsBackwards ? $this->mHist[0]->getTimestamp() : $this->mHist[$numRows - 1]->getTimestamp();
             # Display range
             $this->mRange = array(0, $numRows - 1);
         }
     } else {
         $firstIndex = '';
         $lastIndex = '';
         $this->mPastTheEndIndex = '';
     }
     if ($this->mIsBackwards) {
         $this->mIsFirst = $numRows < $queryLimit;
         $this->mIsLast = $this->mOffset == '';
         $this->mLastShown = $firstIndex;
         $this->mFirstShown = $lastIndex;
     } else {
         $this->mIsFirst = $this->mOffset == '';
         $this->mIsLast = $numRows < $queryLimit;
         $this->mLastShown = $lastIndex;
         $this->mFirstShown = $firstIndex;
     }
     $this->mQueryDone = true;
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:81,代码来源:ImagePage.php

示例10: formatResult

 /**
  *
  * @param Skin $skin
  * @param File $result
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgContLang;
     $nt = $result->getTitle();
     $text = $wgContLang->convert($nt->getText());
     $plink = Linker::link(Title::newFromText($nt->getPrefixedText()), $text);
     $userText = $result->getUser('text');
     $user = Linker::link(Title::makeTitle(NS_USER, $userText), $userText);
     $time = $this->getLanguage()->userTimeAndDate($result->getTimestamp(), $this->getUser());
     return "{$plink} . . {$user} . . {$time}";
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:SpecialFileDuplicateSearch.php

示例11: wfReplaceImageServer

 /**
  * Get a thumbnail object from a file and parameters.
  * If $path is set to null, the output file is treated as a source copy.
  * If $path is set to false, no output file will be created.
  *
  * @param File $file File object
  * @param string $url URL path to the thumb
  * @param int $width File's width
  * @param int $height File's height
  * @param string|bool|null $path Filesystem path to the thumb
  * @param int|bool $page Page number, for multi-page files
  */
 function __construct($file, $url, $width, $height, $path = false, $page = false)
 {
     $this->file = $file;
     $this->url = $url;
     # start wikia change
     $timestamp = !empty($file) ? $file->getTimestamp() : false;
     $this->url = wfReplaceImageServer($this->url, $timestamp);
     # end wikia change
     # These should be integers when they get here.
     # If not, there's a bug somewhere.  But let's at
     # least produce valid HTML code regardless.
     $this->width = round($width);
     $this->height = round($height);
     $this->path = $path;
     $this->page = $page;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:MediaTransformOutput.php

示例12: onThumbnailVideoHTML

 public static function onThumbnailVideoHTML($options, $linkAttribs, $imageAttribs, File $file, &$html)
 {
     global $wgRTEParserEnabled;
     if (!empty($wgRTEParserEnabled)) {
         return true;
     }
     if (is_null(self::$isWikiaMobile)) {
         self::init();
     }
     if (self::$isWikiaMobile) {
         wfProfileIn(__METHOD__);
         /**
          * WikiaMobile: lazy loading images in a SEO-friendly manner
          * @author Federico "Lox" Lucignano <federico@wikia-inc.com
          * @author Artur Klajnerok <arturk@wikia-inc.com>
          */
         $origImg = Xml::element('img', $imageAttribs, '', true);
         if (empty($imageAttribs['alt'])) {
             unset($imageAttribs['alt']);
         }
         //Not all 'files' have getProviderName defined
         if (is_callable([$file, 'getProviderName'])) {
             $provider = $file->getProviderName();
         } else {
             $provider = '';
         }
         $imageParams = array('type' => 'video', 'provider' => $provider, 'full' => $imageAttribs['src']);
         if (!empty($imageAttribs['data-video-key'])) {
             $imageParams['name'] = htmlspecialchars($imageAttribs['data-video-key']);
         }
         if (!empty($options['caption'])) {
             $imageParams['capt'] = 1;
         }
         // TODO: this resizes every video thumbnail with a width over 64px regardless of where it appears.
         // We may want to add the ability to allow custom image widths (like on the file page history table for example)
         $size = WikiaMobileMediaService::calculateMediaSize($file->getWidth(), $file->getHeight());
         $thumb = $file->transform($size);
         $imageAttribs['src'] = wfReplaceImageServer($thumb->getUrl(), $file->getTimestamp());
         $imageAttribs['width'] = $size['width'];
         $imageAttribs['height'] = $size['height'];
         $data = ['attributes' => $imageAttribs, 'parameters' => [$imageParams], 'anchorAttributes' => $linkAttribs, 'noscript' => $origImg, 'isSmall' => WikiaMobileMediaService::isSmallImage($imageAttribs['width'], $imageAttribs['height'])];
         $title = $file->getTitle()->getDBKey();
         $titleText = $file->getTitle()->getText();
         $views = MediaQueryService::getTotalVideoViewsByTitle($title);
         $data['content'] = Xml::element('span', ['class' => 'videoInfo'], "{$titleText} (" . $file->getHandler()->getFormattedDuration() . ", " . wfMessage('wikiamobile-video-views-counter', $views)->inContentLanguage()->text() . ')');
         $html = F::app()->sendRequest('WikiaMobileMediaService', 'renderImageTag', $data, true)->toString();
         wfProfileOut(__METHOD__);
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:50,代码来源:ImageTweaksHooks.class.php

示例13: formatResult

 /**
  *
  * @param Skin $skin
  * @param File $result
  * @return string
  */
 function formatResult($skin, $result)
 {
     global $wgContLang, $wgLang;
     $nt = $result->getTitle();
     $text = $wgContLang->convert($nt->getText());
     $plink = $skin->link(Title::newFromText($nt->getPrefixedText()), $text);
     $userText = $result->getUser('text');
     $user = $skin->link(Title::makeTitle(NS_USER, $userText), $userText);
     $time = $wgLang->timeanddate($result->getTimestamp());
     return "{$plink} . . {$user} . . {$time}";
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:17,代码来源:SpecialFileDuplicateSearch.php

示例14: onThumbnailVideoHTML

 public function onThumbnailVideoHTML($options, $linkAttribs, $imageAttribs, File $file, &$html)
 {
     $this->wf->profileIn(__METHOD__);
     if (self::$isWikiaMobile) {
         /**
          * WikiaMobile: lazy loading images in a SEO-friendly manner
          * @author Federico "Lox" Lucignano <federico@wikia-inc.com
          * @author Artur Klajnerok <arturk@wikia-inc.com>
          */
         $origImg = Xml::element('img', $imageAttribs, '', true);
         if (empty($imageAttribs['alt'])) {
             unset($imageAttribs['alt']);
         }
         $imageParams = array('type' => 'video', 'full' => $imageAttribs['src']);
         if (!empty($linkAttribs['data-video-name'])) {
             $imageParams['name'] = $linkAttribs['data-video-name'];
         }
         if (!empty($options['caption'])) {
             $imageParams['capt'] = true;
         }
         if ($file instanceof File) {
             $size = WikiaMobileMediaService::calculateMediaSize($file->getWidth(), $file->getHeight());
             $thumb = $file->transform($size);
             $imageAttribs['src'] = wfReplaceImageServer($thumb->getUrl(), $file->getTimestamp());
             $imageAttribs['width'] = $size['width'];
             $imageAttribs['height'] = $size['height'];
         }
         $data = array('attributes' => $imageAttribs, 'parameters' => array($imageParams), 'anchorAttributes' => $linkAttribs, 'noscript' => $origImg);
         if ($file instanceof File) {
             $title = $file->getTitle()->getDBKey();
             $titleText = $file->getTitle()->getText();
             $data['content'] = Xml::element('span', array('class' => 'videoInfo'), "{$titleText} (" . $file->getHandler()->getFormattedDuration() . ", " . $this->wf->MsgForContent('wikiamobile-video-views-counter', MediaQueryService::getTotalVideoViewsByTitle($title)) . ')');
         }
         $html = $this->app->sendRequest('WikiaMobileMediaService', 'renderImageTag', $data, true)->toString();
     }
     $this->wf->profileOut(__METHOD__);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:38,代码来源:ImageTweaksHooks.class.php

示例15: formatResult

 /**
  *
  * @param Skin $skin
  * @param File $result
  * @return string HTML
  */
 function formatResult($skin, $result)
 {
     global $wgContLang;
     $nt = $result->getTitle();
     $text = $wgContLang->convert($nt->getText());
     $plink = Linker::link($nt, htmlspecialchars($text));
     $userText = $result->getUser('text');
     if ($result->isLocal()) {
         $userId = $result->getUser('id');
         $user = Linker::userLink($userId, $userText);
         $user .= '<span style="white-space: nowrap;">';
         $user .= Linker::userToolLinks($userId, $userText);
         $user .= '</span>';
     } else {
         $user = htmlspecialchars($userText);
     }
     $time = htmlspecialchars($this->getLanguage()->userTimeAndDate($result->getTimestamp(), $this->getUser()));
     return "{$plink} . . {$user} . . {$time}";
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:25,代码来源:SpecialFileDuplicateSearch.php


注:本文中的File::getTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。