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


PHP IContextSource::getLang方法代码示例

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


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

示例1: getLanguage

 /**
  * Get the Language being used for this instance.
  * IndexPager extends ContextSource as of 1.19.
  *
  * @since 0.1
  *
  * @return Language
  */
 public function getLanguage()
 {
     return method_exists($this->context, 'getLanguage') ? $this->context->getLanguage() : $this->context->getLang();
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:12,代码来源:EPPager.php

示例2: addVideo

 /**
  * Add the video into the database
  *
  * @param $url String: URL to the video on the provider service
  * @param $type String: (internal) provider name in lowercase
  * @param $categories String: pipe-separated list of categories
  * @param $watch Boolean: add the new video page to the user's watchlist?
  */
 public function addVideo($url, $type, $categories, $watch = false)
 {
     $user = $this->context->getUser();
     $dbw = wfGetDB(DB_MASTER);
     $now = $dbw->timestamp();
     $desc = wfMsgForContent('video-log-added-entry', Title::makeTitle(NS_VIDEO, $this->getName())->getPrefixedText());
     // Test to see if the row exists using INSERT IGNORE
     // This avoids race conditions by locking the row until the commit, and also
     // doesn't deadlock. SELECT FOR UPDATE causes a deadlock for every race condition.
     $dbw->insert('video', array('video_name' => $this->getName(), 'video_url' => $url, 'video_type' => $type, 'video_user_id' => $user->getID(), 'video_user_name' => $user->getName(), 'video_timestamp' => $now), __METHOD__, 'IGNORE');
     $categoryWikiText = '';
     if ($dbw->affectedRows() == 0) {
         $desc = wfMsgForContent('video-log-updated-entry', Title::makeTitle(NS_VIDEO, $this->getName())->getPrefixedText());
         // Clear cache
         global $wgMemc;
         $key = $this->getCacheKey();
         $wgMemc->delete($key);
         // Collision, this is an update of a video
         // Insert previous contents into oldvideo
         $dbw->insertSelect('oldvideo', 'video', array('ov_name' => 'video_name', 'ov_archive_name' => $dbw->addQuotes(gmdate('YmdHis') . "!{$this->getName()}"), 'ov_url' => 'video_url', 'ov_type' => 'video_type', 'ov_user_id' => 'video_user_id', 'ov_user_name' => 'video_user_name', 'ov_timestamp' => 'video_timestamp'), array('video_name' => $this->getName()), __METHOD__);
         // Update the current video row
         $dbw->update('video', array('video_url' => $url, 'video_type' => $type, 'video_user_id' => $user->getID(), 'video_user_name' => $user->getName(), 'video_timestamp' => $now), array('video_name' => $this->getName()), __METHOD__);
     }
     $descTitle = $this->getTitle();
     $article = new Article($descTitle);
     $watch = $watch || $user->isWatched($descTitle);
     // Get the localized category name
     $videoCategoryName = wfMsgForContent('video-category-name');
     if ($categories) {
         $categories .= "|{$videoCategoryName}";
     } else {
         $categories = "{$videoCategoryName}";
     }
     // Loop through category variable and individually build Category Tab for Wiki text
     if ($categories) {
         $categories_array = explode('|', $categories);
         foreach ($categories_array as $ctg) {
             $ctg = trim($ctg);
             if ($ctg) {
                 $catName = $this->context->getLang()->getNsText(NS_CATEGORY);
                 $tag = "[[{$catName}:{$ctg}]]";
                 if (strpos($categoryWikiText, $tag) === false) {
                     $categoryWikiText .= "\n{$tag}";
                 }
             }
         }
     }
     if ($descTitle->exists()) {
         # Invalidate the cache for the description page
         $descTitle->invalidateCache();
         $descTitle->purgeSquid();
     } else {
         // New video; create the description page.
         // Supress the recent changes bc it will appear in the log/video
         $article->doEdit($categoryWikiText, $desc, EDIT_SUPPRESS_RC);
     }
     if ($watch) {
         $user->addWatch($descTitle);
     }
     // Add the log entry
     $log = new LogPage('video');
     $log->addEntry('video', $descTitle, $desc);
     // Commit the transaction now, in case something goes wrong later
     // The most important thing is that videos don't get lost, especially archives
     $dbw->commit();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:74,代码来源:VideoClass.php

示例3: getLang

 /**
  * Get the language of the user doing the action
  *
  * @return Language object
  */
 public function getLang()
 {
     return $this->context->getLang();
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:9,代码来源:RevisionList.php


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