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


PHP Title::getDBKey方法代码示例

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


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

示例1: onArticleFromTitle

 /**
  * @param Title $title
  * @param Page $article
  *
  * @return true because it's a hook
  */
 public function onArticleFromTitle(&$title, &$article)
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     $dbKeyName = $title->getDBKey();
     if (!empty($app->wg->EnableWikiaHomePageExt) && $this->isHubsPage($dbKeyName)) {
         $app->wg->SuppressPageHeader = true;
         $article = F::build('WikiaHubsV2Article', array($title, $this->getHubPageId($dbKeyName)));
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:18,代码来源:WikiaHubsV2Hooks.php

示例2: onArticleFromTitle

 /**
  * @param Title $title
  * @param Page $article
  *
  * @return true because it's a hook
  */
 public static function onArticleFromTitle(&$title, &$article)
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     if (WikiaPageType::isWikiaHubMain() || $title->isSubpageOf(Title::newMainPage())) {
         $model = new WikiaHubsV3HooksModel();
         $dbKeyName = $title->getDBKey();
         $dbKeyNameSplit = explode('/', $dbKeyName);
         $hubTimestamp = $model->getTimestampFromSplitDbKey($dbKeyNameSplit);
         $app->wg->SuppressRail = true;
         $app->wg->SuppressFooter = true;
         if (!$app->wg->request->wasPosted()) {
             // don't change article object while saving data
             $article = new WikiaHubsV3Article($title, $hubTimestamp);
         }
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:WikiaHubsV3Hooks.php

示例3: newFromTitle

 /**
  * @param $title Title
  * @param $repo ForeignApiRepo
  * @return ForeignAPIFile|null
  */
 static function newFromTitle(Title $title, $repo)
 {
     $data = $repo->fetchImageQuery(array('titles' => 'File:' . $title->getDBKey(), 'iiprop' => self::getProps(), 'prop' => 'imageinfo', 'iimetadataversion' => MediaHandler::getMetadataVersion()));
     $info = $repo->getImageInfo($data);
     if ($info) {
         $lastRedirect = isset($data['query']['redirects']) ? count($data['query']['redirects']) - 1 : -1;
         if ($lastRedirect >= 0) {
             $newtitle = Title::newFromText($data['query']['redirects'][$lastRedirect]['to']);
             $img = new self($newtitle, $repo, $info, true);
             if ($img) {
                 $img->redirectedFrom($title->getDBkey());
             }
         } else {
             $img = new self($title, $repo, $info, true);
         }
         return $img;
     } else {
         return null;
     }
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:25,代码来源:ForeignAPIFile.php

示例4: updateArchive

 /**
  * Update the revision's rev_deleted field
  * @param Revision $rev
  * @param Title $title
  * @param int $bitfield new rev_deleted bitfield value
  */
 function updateArchive($rev, $title, $bitfield)
 {
     $this->dbw->update('archive', array('ar_deleted' => $bitfield), array('ar_namespace' => $title->getNamespace(), 'ar_title' => $title->getDBKey(), 'ar_timestamp' => $this->dbw->timestamp($rev->getTimestamp()), 'ar_rev_id' => $rev->getId()), __METHOD__);
 }
开发者ID:ruizrube,项目名称:spdef,代码行数:10,代码来源:SpecialRevisiondelete.php

示例5: onRemovePremiumVideo

 /**
  * Hook: remove premium video and clear cache
  * @param Title $title
  * @return true
  */
 public static function onRemovePremiumVideo($title)
 {
     if ($title instanceof Title) {
         $videoInfo = VideoInfo::newFromTitle($title->getDBKey());
         if (!empty($videoInfo) && $videoInfo->isPremium()) {
             $videoInfo->deleteVideo();
             // clear cache
             $mediaService = new MediaQueryService();
             $mediaService->clearCacheTotalVideos();
             $mediaService->clearCacheTotalPremiumVideos();
         }
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:VideoInfoHooksHelper.class.php

示例6: getNumberOfUsage

 public function getNumberOfUsage(Title $title)
 {
     $num = 0;
     $db =& wfGetDB(DB_SLAVE);
     if ($title->getNamespace() == NS_TEMPLATE) {
         $templatelinks = $db->tableName('templatelinks');
         $res = $db->query('SELECT COUNT(tl_from) AS numOfSubjects FROM ' . $templatelinks . ' s WHERE tl_title = ' . $db->addQuotes($title->getDBKey()) . ' GROUP BY tl_title ');
     } else {
         if ($title->getNamespace() == SMW_NS_PROPERTY) {
             $smw_atts2 = $db->tableName('smw_atts2');
             $smw_rels2 = $db->tableName('smw_rels2');
             $smw_ids = $db->tableName('smw_ids');
             $res = $db->query('SELECT COUNT(s_id) AS numOfSubjects FROM ' . $smw_atts2 . ' s JOIN ' . $smw_ids . ' ON p_id = smw_id WHERE smw_title = ' . $db->addQuotes($title->getDBKey()) . ' GROUP BY smw_title ' . ' UNION SELECT COUNT(s_id) AS numOfSubjects FROM ' . $smw_rels2 . ' s JOIN ' . $smw_ids . ' ON p_id = smw_id WHERE smw_title = ' . $db->addQuotes($title->getDBKey()) . ' GROUP BY smw_title');
         }
     }
     if ($db->numRows($res) > 0) {
         $row = $db->fetchObject($res);
         $num = $row->numOfSubjects;
     }
     $db->freeResult($res);
     return $num;
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:22,代码来源:SMW_SemanticStoreSQL2.php

示例7: isWAMFAQPage

 protected function isWAMFAQPage(Title $title)
 {
     return $title->isSubpage() && $title->getDBKey() == self::WAM_FAQ_PAGE_NAME;
 }
开发者ID:yusufchang,项目名称:app,代码行数:4,代码来源:WAMPageArticle.class.php

示例8: onFileRenameComplete

 /**
  * Hook: add new video if old video does not exist or rename old video and clear cache when file is renamed
  * @param $form
  * @param Title $oldTitle
  * @param Title $newTitle
  * @return true
  */
 public static function onFileRenameComplete(&$form, &$oldTitle, &$newTitle)
 {
     if (!F::build('VideoInfoHelper', array(), 'videoInfoExists')) {
         return true;
     }
     $videoInfo = F::build('VideoInfo', array($oldTitle->getDBKey()), 'newFromTitle');
     if (empty($videoInfo)) {
         // add new video
         $videoInfoHelper = F::build('VideoInfoHelper');
         $videoData = $videoInfoHelper->getVideoDataByTitle($newTitle);
         if (!empty($videoData)) {
             $videoInfo = F::build('VideoInfo', array($videoData));
             $videoInfo->addVideo();
             $mediaService = F::build('MediaQueryService');
             $mediaService->clearCacheTotalVideos();
         }
     } else {
         $videoInfo->renameVideo($newTitle->getDBKey());
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:28,代码来源:VideoInfoHooksHelper.class.php

示例9: getMediaDataFromCache

 private function getMediaDataFromCache(Title $media, $length = 256)
 {
     wfProfileIn(__METHOD__);
     if (!isset($this->mediaCache[$media->getDBKey()])) {
         $file = wfFindFile($media);
         if (!empty($file) && $file->canRender()) {
             $articleService = new ArticleService($media);
             $isVideo = WikiaFileHelper::isFileTypeVideo($file);
             if ($isVideo) {
                 /** @var $videoHandler VideoHandler */
                 $videoHandler = $file->getHandler();
                 $thumb = $file->transform(array('width' => 320), 0);
             } else {
                 $videoHandler = false;
             }
             $this->mediaCache[$media->getDBKey()] = array('title' => $media->getText(), 'desc' => $articleService->getTextSnippet($length), 'type' => $isVideo ? self::MEDIA_TYPE_VIDEO : self::MEDIA_TYPE_IMAGE, 'meta' => $videoHandler ? array_merge($videoHandler->getVideoMetadata(true), $videoHandler->getEmbedSrcData()) : array(), 'thumbUrl' => !empty($thumb) ? $thumb->getUrl() : false);
         } else {
             $this->mediaCache[$media->getDBKey()] = false;
         }
     }
     wfProfileOut(__METHOD__);
     return $this->mediaCache[$media->getDBKey()];
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:MediaQueryService.class.php

示例10: setTitle

 public function setTitle(Title $title)
 {
     $this->title = $title;
     $pageId = $title->getArticleId();
     if ($pageId) {
         $this->pageId = $pageId;
     } else {
         $this->extra['page_title'] = $title->getDBKey();
         $this->extra['page_namespace'] = $title->getNamespace();
     }
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:11,代码来源:Event.php

示例11: restorePremiumVideo

 /**
  * restore premium video
  * @param Title $title
  * @param integer $userId
  * @return boolean $affected
  */
 public function restorePremiumVideo($title, $userId)
 {
     wfProfileIn(__METHOD__);
     $affected = false;
     if ($title instanceof Title) {
         $videoInfo = VideoInfo::newFromTitle($title->getDBKey());
         if (empty($videoInfo)) {
             $newVideoInfo = $this->getVideoInfoFromTitle($title, true);
             if (!empty($newVideoInfo)) {
                 // add premium video if not exist
                 $affected = $newVideoInfo->addPremiumVideo($userId);
             }
         } else {
             $affected = $videoInfo->restoreVideo();
         }
     }
     wfProfileOut(__METHOD__);
     return $affected;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:VideoInfoHelper.class.php


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