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


PHP OutputPage::getContext方法代码示例

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


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

示例1: getContext

 public function getContext()
 {
     if (!is_object($this->out)) {
         \Wikia\Logger\WikiaLogger::instance()->debug('LogEventsList getContext not an object', ['exception' => new Exception()]);
     }
     return $this->out->getContext();
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:7,代码来源:LogEventsList.php

示例2: addModules

 /**
  * Hook: BeforePageDisplay
  */
 public static function addModules(OutputPage $out, Skin $skin)
 {
     global $wgContentTranslationEventLogging, $wgContentTranslationCampaigns;
     $title = $out->getTitle();
     $user = $out->getUser();
     // Check if CX is available for current user.
     if (!self::isEnabledForUser($user)) {
         if (!$title->exists() && $wgContentTranslationCampaigns['newarticle'] && !$out->getRequest()->getCookie('cx_campaign_newarticle_hide', '') && !$user->isAnon()) {
             $out->addModules('ext.cx.campaigns.newarticle.veloader');
             if ($wgContentTranslationEventLogging) {
                 $out->addModules('ext.cx.eventlogging');
             }
         }
         return;
     }
     // If EventLogging integration is enabled, load the event logging functions module
     if ($wgContentTranslationEventLogging) {
         $out->addModules('ext.cx.eventlogging');
     }
     if ($title->inNamespace(NS_MAIN) && Action::getActionName($out->getContext()) === 'view' && $title->exists()) {
         $out->addModules('ext.cx.interlanguagelink');
     }
     // Add a hover menu for the contributions link in personal toolbar
     $out->addModules('ext.cx.campaigns.contributionsmenu');
     // The current guided tours are only for the user namespace,
     // so load the module only there.
     // In the future there may be guided tours in other namespaces,
     // and then this condition should be changed.
     if (class_exists('GuidedTourHooks') && $title->inNamespace(NS_USER)) {
         $out->addModules('ext.guidedTour');
     }
 }
开发者ID:Wikia,项目名称:mediawiki-extensions-ContentTranslation,代码行数:35,代码来源:ContentTranslation.hooks.php

示例3: onOutputPageMakeCategoryLinks

 /**
  * @static
  * @param OutputPage $out
  * @param $categories
  * @param $links
  * @return bool
  */
 public static function onOutputPageMakeCategoryLinks(&$out, $categories, &$links)
 {
     if (!F::app()->wg->WikiaHubsPages) {
         return true;
     }
     $dbkey = $out->getContext()->getTitle()->getDBKey();
     if (in_array($dbkey, F::app()->wg->WikiaHubsPages)) {
         $categories = null;
         return false;
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:19,代码来源:WikiaHubsHelper.class.php

示例4: tmwAccountsNotice

 /**
  * Add "x email-tmwed open account requests" notice
  * @param $notice
  * @return bool
  */
 public static function tmwAccountsNotice(OutputPage &$out, Skin &$skin)
 {
     global $wgTMWAccountNotice;
     $context = $out->getContext();
     if (!$wgTMWAccountNotice || !$context->getUser()->isAllowed('tmwaccount')) {
         return true;
     }
     # Only show on some special pages
     $title = $context->getTitle();
     if (!$title->isSpecial('Recentchanges') && !$title->isSpecial('Watchlist')) {
         return true;
     }
     $count = TMWAccount::getOpenEmailTMWedCount('*');
     if ($count > 0) {
         $out->prependHtml('<div id="mw-tmwaccount-msg" class="plainlinks mw-tmwaccount-bar">' . $out->parse(wfMsgExt('tmwaccount-newrequests', 'parsemag', $count), false) . '</div>');
     }
     return true;
 }
开发者ID:nelson6e65,项目名称:themanaworld-website,代码行数:23,代码来源:TMWAccountUI.hooks.php

示例5: confirmAccountsNotice

 /**
  * Add "x email-confirmed open account requests" notice
  * @param $notice
  * @return bool
  */
 public static function confirmAccountsNotice(OutputPage &$out, Skin &$skin)
 {
     global $wgConfirmAccountNotice;
     $context = $out->getContext();
     if (!$wgConfirmAccountNotice || !$context->getUser()->isAllowed('confirmaccount')) {
         return true;
     }
     # Only show on some special pages
     $title = $context->getTitle();
     if (!$title->isSpecial('Recentchanges') && !$title->isSpecial('Watchlist')) {
         return true;
     }
     $count = ConfirmAccount::getOpenEmailConfirmedCount('*');
     if ($count > 0) {
         $out->prependHtml('<div id="mw-confirmaccount-msg" class="plainlinks mw-confirmaccount-bar">' . $context->msg('confirmaccount-newrequests')->numParams($count)->parse() . '</div>');
         $out->addModules('ext.confirmAccount');
         // CSS
     }
     return true;
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:25,代码来源:ConfirmAccountUI.hooks.php

示例6: showLogExtract

 /**
  * Show log extract. Either with text and a box (set $msgKey) or without (don't set $msgKey)
  *
  * @param OutputPage|string $out By-reference
  * @param string|array $types Log types to show
  * @param string|Title $page The page title to show log entries for
  * @param string $user The user who made the log entries
  * @param array $param Associative Array with the following additional options:
  * - lim Integer Limit of items to show, default is 50
  * - conds Array Extra conditions for the query (e.g. "log_action != 'revision'")
  * - showIfEmpty boolean Set to false if you don't want any output in case the loglist is empty
  *   if set to true (default), "No matching items in log" is displayed if loglist is empty
  * - msgKey Array If you want a nice box with a message, set this to the key of the message.
  *   First element is the message key, additional optional elements are parameters for the key
  *   that are processed with wfMessage
  * - offset Set to overwrite offset parameter in WebRequest
  *   set to '' to unset offset
  * - wrap String Wrap the message in html (usually something like "<div ...>$1</div>").
  * - flags Integer display flags (NO_ACTION_LINK,NO_EXTRA_USER_LINKS)
  * - useRequestParams boolean Set true to use Pager-related parameters in the WebRequest
  * - useMaster boolean Use master DB
  * @return int Number of total log items (not limited by $lim)
  */
 public static function showLogExtract(&$out, $types = array(), $page = '', $user = '', $param = array())
 {
     $defaultParameters = array('lim' => 25, 'conds' => array(), 'showIfEmpty' => true, 'msgKey' => array(''), 'wrap' => "\$1", 'flags' => 0, 'useRequestParams' => false, 'useMaster' => false);
     # The + operator appends elements of remaining keys from the right
     # handed array to the left handed, whereas duplicated keys are NOT overwritten.
     $param += $defaultParameters;
     # Convert $param array to individual variables
     $lim = $param['lim'];
     $conds = $param['conds'];
     $showIfEmpty = $param['showIfEmpty'];
     $msgKey = $param['msgKey'];
     $wrap = $param['wrap'];
     $flags = $param['flags'];
     $useRequestParams = $param['useRequestParams'];
     if (!is_array($msgKey)) {
         $msgKey = array($msgKey);
     }
     if ($out instanceof OutputPage) {
         $context = $out->getContext();
     } else {
         $context = RequestContext::getMain();
     }
     # Insert list of top 50 (or top $lim) items
     $loglist = new LogEventsList($context, null, $flags);
     $pager = new LogPager($loglist, $types, $user, $page, '', $conds);
     if (!$useRequestParams) {
         # Reset vars that may have been taken from the request
         $pager->mLimit = 50;
         $pager->mDefaultLimit = 50;
         $pager->mOffset = "";
         $pager->mIsBackwards = false;
     }
     if ($param['useMaster']) {
         $pager->mDb = wfGetDB(DB_MASTER);
     }
     if (isset($param['offset'])) {
         # Tell pager to ignore WebRequest offset
         $pager->setOffset($param['offset']);
     }
     if ($lim > 0) {
         $pager->mLimit = $lim;
     }
     // Fetch the log rows and build the HTML if needed
     $logBody = $pager->getBody();
     $numRows = $pager->getNumRows();
     $s = '';
     if ($logBody) {
         if ($msgKey[0]) {
             $dir = $context->getLanguage()->getDir();
             $lang = $context->getLanguage()->getHtmlCode();
             $s = Xml::openElement('div', array('class' => "mw-warning-with-logexcerpt mw-content-{$dir}", 'dir' => $dir, 'lang' => $lang));
             if (count($msgKey) == 1) {
                 $s .= $context->msg($msgKey[0])->parseAsBlock();
             } else {
                 // Process additional arguments
                 $args = $msgKey;
                 array_shift($args);
                 $s .= $context->msg($msgKey[0], $args)->parseAsBlock();
             }
         }
         $s .= $loglist->beginLogEventsList() . $logBody . $loglist->endLogEventsList();
     } elseif ($showIfEmpty) {
         $s = Html::rawElement('div', array('class' => 'mw-warning-logempty'), $context->msg('logempty')->parse());
     }
     if ($numRows > $pager->mLimit) {
         # Show "Full log" link
         $urlParam = array();
         if ($page instanceof Title) {
             $urlParam['page'] = $page->getPrefixedDBkey();
         } elseif ($page != '') {
             $urlParam['page'] = $page;
         }
         if ($user != '') {
             $urlParam['user'] = $user;
         }
         if (!is_array($types)) {
             # Make it an array, if it isn't
//.........这里部分代码省略.........
开发者ID:OrBin,项目名称:mediawiki,代码行数:101,代码来源:LogEventsList.php

示例7: outputPage

 /**
  * initialize various variables and generate the template
  *
  * @param OutputPage $out
  */
 function outputPage(OutputPage $out = null)
 {
     Profiler::instance()->setTemplated(true);
     $oldContext = null;
     if ($out !== null) {
         // Deprecated since 1.20, note added in 1.25
         wfDeprecated(__METHOD__, '1.25');
         $oldContext = $this->getContext();
         $this->setContext($out->getContext());
     }
     $out = $this->getOutput();
     $this->initPage($out);
     $tpl = $this->prepareQuickTemplate($out);
     // execute template
     $res = $tpl->execute();
     // result may be an error
     $this->printOrError($res);
     if ($oldContext) {
         $this->setContext($oldContext);
     }
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:26,代码来源:SkinTemplate.php

示例8: outputPage

 /**
  * initialize various variables and generate the template
  *
  * @param $out OutputPage
  */
 function outputPage(OutputPage $out = null)
 {
     global $wgContLang;
     global $wgScript, $wgStylePath;
     global $wgMimeType, $wgJsMimeType;
     global $wgXhtmlDefaultNamespace, $wgXhtmlNamespaces, $wgHtml5Version;
     global $wgDisableCounters, $wgSitename, $wgLogo, $wgHideInterlanguageLinks;
     global $wgMaxCredits, $wgShowCreditsIfMax;
     global $wgPageShowWatchingUsers;
     global $wgDebugComments;
     global $wgArticlePath, $wgScriptPath, $wgServer;
     wfProfileIn(__METHOD__);
     Profiler::instance()->setTemplated(true);
     $oldContext = null;
     if ($out !== null) {
         // @todo Add wfDeprecated in 1.20
         $oldContext = $this->getContext();
         $this->setContext($out->getContext());
     }
     $out = $this->getOutput();
     $request = $this->getRequest();
     $user = $this->getUser();
     $title = $this->getTitle();
     wfProfileIn(__METHOD__ . '-init');
     $this->initPage($out);
     $tpl = $this->setupTemplate($this->template, 'skins');
     wfProfileOut(__METHOD__ . '-init');
     wfProfileIn(__METHOD__ . '-stuff');
     $this->thispage = $title->getPrefixedDBkey();
     $this->titletxt = $title->getPrefixedText();
     $this->userpage = $user->getUserPage()->getPrefixedText();
     $query = array();
     if (!$request->wasPosted()) {
         $query = $request->getValues();
         unset($query['title']);
         unset($query['returnto']);
         unset($query['returntoquery']);
     }
     $this->thisquery = wfArrayToCGI($query);
     $this->loggedin = $user->isLoggedIn();
     $this->username = $user->getName();
     if ($this->loggedin || $this->showIPinHeader()) {
         $this->userpageUrlDetails = self::makeUrlDetails($this->userpage);
     } else {
         # This won't be used in the standard skins, but we define it to preserve the interface
         # To save time, we check for existence
         $this->userpageUrlDetails = self::makeKnownUrlDetails($this->userpage);
     }
     wfProfileOut(__METHOD__ . '-stuff');
     wfProfileIn(__METHOD__ . '-stuff-head');
     if (!$this->useHeadElement) {
         $tpl->set('pagecss', false);
         $tpl->set('usercss', false);
         $tpl->set('userjs', false);
         $tpl->set('userjsprev', false);
         $tpl->set('jsvarurl', false);
         $tpl->setRef('xhtmldefaultnamespace', $wgXhtmlDefaultNamespace);
         $tpl->set('xhtmlnamespaces', $wgXhtmlNamespaces);
         $tpl->set('html5version', $wgHtml5Version);
         $tpl->set('headlinks', $out->getHeadLinks());
         $tpl->set('csslinks', $out->buildCssLinks());
         $tpl->set('pageclass', $this->getPageClasses($title));
         $tpl->set('skinnameclass', 'skin-' . Sanitizer::escapeClass($this->getSkinName()));
     }
     wfProfileOut(__METHOD__ . '-stuff-head');
     wfProfileIn(__METHOD__ . '-stuff2');
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     $tpl->set('displaytitle', $out->mPageLinkTitle);
     $tpl->setRef('thispage', $this->thispage);
     $tpl->setRef('titleprefixeddbkey', $this->thispage);
     $tpl->set('titletext', $title->getText());
     $tpl->set('articleid', $title->getArticleId());
     $tpl->set('isarticle', $out->isArticle());
     $subpagestr = $this->subPageSubtitle();
     if ($subpagestr !== '') {
         $subpagestr = '<span class="subpages">' . $subpagestr . '</span>';
     }
     $tpl->set('subtitle', $subpagestr . $out->getSubtitle());
     $undelete = $this->getUndeleteLink();
     if ($undelete === '') {
         $tpl->set('undelete', '');
     } else {
         $tpl->set('undelete', '<span class="subpages">' . $undelete . '</span>');
     }
     $tpl->set('catlinks', $this->getCategories());
     if ($out->isSyndicated()) {
         $feeds = array();
         foreach ($out->getSyndicationLinks() as $format => $link) {
             $feeds[$format] = array('text' => $this->msg("feed-{$format}")->text(), 'href' => $link);
         }
         $tpl->setRef('feeds', $feeds);
     } else {
         $tpl->set('feeds', false);
     }
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:media-wiki-law,代码行数:101,代码来源:SkinTemplate.php

示例9: editPageShowEditFormFields

 /**
  * EditPage::showEditForm:fields hook
  *
  * Adds the event fields to the edit form
  *
  * @param EditPage $editPage the current EditPage object.
  * @param OutputPage $outputPage object.
  * @return bool
  */
 public static function editPageShowEditFormFields($editPage, $outputPage)
 {
     if ($editPage->contentModel !== CONTENT_MODEL_WIKITEXT) {
         return true;
     }
     $req = $outputPage->getContext()->getRequest();
     $editingStatsId = $req->getVal('editingStatsId');
     if (!$editingStatsId || !$req->wasPosted()) {
         $editingStatsId = self::getEditingStatsId();
     }
     $outputPage->addHTML(Xml::element('input', array('type' => 'hidden', 'name' => 'editingStatsId', 'id' => 'editingStatsId', 'value' => $editingStatsId)));
     return true;
 }
开发者ID:jpena88,项目名称:mediawiki-dokku-deploy,代码行数:22,代码来源:WikiEditor.hooks.php

示例10: manuscriptIsInViewMode

 private function manuscriptIsInViewMode(OutputPage $out)
 {
     $context = $out->getContext();
     if (Action::getActionName($context) !== 'view') {
         return false;
     }
     return true;
 }
开发者ID:akvankorlaar,项目名称:manuscriptdesk,代码行数:8,代码来源:NewManuscript.hooks.php

示例11: getContext

 public function getContext()
 {
     return $this->out->getContext();
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:4,代码来源:LogEventsList.php

示例12: outputPage

 /**
  * initialize various variables and generate the template
  *
  * @param OutputPage $out
  */
 function outputPage(OutputPage $out = null)
 {
     wfProfileIn(__METHOD__);
     Profiler::instance()->setTemplated(true);
     $oldContext = null;
     if ($out !== null) {
         // @todo Add wfDeprecated in 1.20
         $oldContext = $this->getContext();
         $this->setContext($out->getContext());
     }
     $out = $this->getOutput();
     wfProfileIn(__METHOD__ . '-init');
     $this->initPage($out);
     wfProfileOut(__METHOD__ . '-init');
     $tpl = $this->prepareQuickTemplate($out);
     // execute template
     wfProfileIn(__METHOD__ . '-execute');
     $res = $tpl->execute();
     wfProfileOut(__METHOD__ . '-execute');
     // result may be an error
     $this->printOrError($res);
     if ($oldContext) {
         $this->setContext($oldContext);
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:31,代码来源:SkinTemplate.php


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