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


PHP Skin::getRequest方法代码示例

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


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

示例1: onBeforePageDisplay

 public static function onBeforePageDisplay(\OutputPage &$output, \Skin &$skin)
 {
     $title = $output->getTitle();
     // Disallow commenting on pages without article id
     if ($title->getArticleID() == 0) {
         return true;
     }
     if ($title->isSpecialPage()) {
         return true;
     }
     // These could be explicitly allowed in later version
     if (!$title->canTalk()) {
         return true;
     }
     if ($title->isTalkPage()) {
         return true;
     }
     if ($title->isMainPage()) {
         return true;
     }
     // Do not display when printing
     if ($output->isPrintable()) {
         return true;
     }
     // Disable if not viewing
     if ($skin->getRequest()->getVal('action', 'view') != 'view') {
         return true;
     }
     // Blacklist several namespace
     if (in_array($title->getNamespace(), array(NS_MEDIAWIKI, NS_TEMPLATE, NS_CATEGORY, NS_FILE, NS_USER))) {
         return true;
     }
     $output->addModules('ext.pagerating');
     return true;
 }
开发者ID:nbdd0121,项目名称:MW-PageRating,代码行数:35,代码来源:Hooks.php

示例2: onBeforePageDisplay

 public static function onBeforePageDisplay(OutputPage &$output, Skin &$skin)
 {
     $title = $output->getTitle();
     // Disallow commenting on pages without article id
     if ($title->getArticleID() == 0) {
         return true;
     }
     if ($title->isSpecialPage()) {
         return true;
     }
     // These could be explicitly allowed in later version
     if (!$title->canTalk()) {
         return true;
     }
     if ($title->isTalkPage()) {
         return true;
     }
     // No commenting on main page
     if ($title->isMainPage()) {
         return true;
     }
     // Do not display when printing
     if ($output->isPrintable()) {
         return true;
     }
     // Disable if not viewing
     if ($skin->getRequest()->getVal('action', 'view') != 'view') {
         return true;
     }
     // Blacklist several namespace
     if (in_array($title->getNamespace(), self::getFilteredNamespace())) {
         return true;
     }
     if ($output->getUser()->isAllowed('commentadmin-restricted')) {
         $output->addJsConfigVars(array('commentadmin' => ''));
     }
     global $wgFlowThreadConfig;
     $config = array('Avatar' => $wgFlowThreadConfig['Avatar'], 'AnonymousAvatar' => $wgFlowThreadConfig['AnonymousAvatar']);
     if (\FlowThread\Post::canPost($output->getUser())) {
         $output->addJsConfigVars(array('canpost' => ''));
     } else {
         $config['CantPostNotice'] = wfMessage('flowthread-ui-cantpost')->toString();
     }
     global $wgFlowThreadConfig;
     $output->addJsConfigVars(array('wgFlowThreadConfig' => $config));
     $output->addModules('ext.flowthread');
     return true;
 }
开发者ID:nbdd0121,项目名称:MW-FlowThread,代码行数:48,代码来源:FlowThread_body.php

示例3: prepareFooter

 /**
  * Prepares the footer for the skins serving the desktop and mobile sites.
  * @param Skin $skin
  * @param QuickTemplate $tpl
  */
 public static function prepareFooter($skin, $tpl)
 {
     $title = $skin->getTitle();
     $req = $skin->getRequest();
     $ctx = MobileContext::singleton();
     // Certain pages might be blacklisted and not have a mobile equivalent.
     if (!$ctx->isBlacklistedPage()) {
         if ($ctx->shouldDisplayMobileView()) {
             MobileFrontendSkinHooks::mobileFooter($skin, $tpl, $ctx, $title, $req);
         } else {
             MobileFrontendSkinHooks::desktopFooter($skin, $tpl, $ctx, $title, $req);
         }
     }
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:19,代码来源:MobileFrontend.skin.hooks.php

示例4: tabify

 /**
  * Adds the task-based tabs on Special:Translate and few other special pages.
  * Hook: SkinTemplateNavigation::SpecialPage
  * @since 2012-02-10
  */
 static function tabify(Skin $skin, array &$tabs)
 {
     $title = $skin->getTitle();
     list($alias, $sub) = SpecialPageFactory::resolveAlias($title->getText());
     $pagesInGroup = array('Translate', 'LanguageStats', 'MessageGroupStats');
     if (!in_array($alias, $pagesInGroup, true)) {
         return true;
     }
     $skin->getOutput()->addModuleStyles('ext.translate.tabgroup');
     // Extract subpage syntax, otherwise the values are not passed forward
     $params = array();
     if (trim($sub) !== '') {
         if ($alias === 'Translate' || $alias === 'MessageGroupStats') {
             $params['group'] = $sub;
         } elseif ($alias === 'LanguageStats') {
             // Breaks if additional parameters besides language are code provided
             $params['language'] = $sub;
         }
     }
     $request = $skin->getRequest();
     // However, query string params take precedence
     $params['language'] = $request->getVal('language');
     $params['group'] = $request->getVal('group');
     $taction = $request->getVal('taction', 'translate');
     $translate = SpecialPage::getTitleFor('Translate');
     $languagestats = SpecialPage::getTitleFor('LanguageStats');
     $messagegroupstats = SpecialPage::getTitleFor('MessageGroupStats');
     // Clear the special page tab that might be there already
     $tabs['namespaces'] = array();
     $tabs['namespaces']['translate'] = array('text' => wfMessage('translate-taction-translate')->text(), 'href' => $translate->getLocalUrl($params), 'class' => 'tux-tab');
     if ($alias === 'Translate' && $taction === 'translate') {
         $tabs['namespaces']['translate']['class'] .= ' selected';
     }
     if (!self::isBeta($request)) {
         $tabs['namespaces']['proofread'] = array('text' => wfMessage('translate-taction-proofread')->text(), 'href' => $translate->getLocalUrl(array('taction' => 'proofread') + $params), 'class' => 'tux-tab');
         if ($alias === 'Translate' && $taction === 'proofread') {
             $tabs['namespaces']['proofread']['class'] .= ' selected';
         }
     }
     $tabs['views']['lstats'] = array('text' => wfMessage('translate-taction-lstats')->text(), 'href' => $languagestats->getLocalUrl($params), 'class' => 'tux-tab');
     if ($alias === 'LanguageStats') {
         $tabs['views']['lstats']['class'] .= ' selected';
     }
     $tabs['views']['mstats'] = array('text' => wfMessage('translate-taction-mstats')->text(), 'href' => $messagegroupstats->getLocalUrl($params), 'class' => 'tux-tab');
     if ($alias === 'MessageGroupStats') {
         $tabs['views']['mstats']['class'] .= ' selected';
     }
     // Kind of hackish, but works for now
     global $wgTranslateTasks;
     foreach (array_keys($wgTranslateTasks) as $taskname) {
         if (!preg_match('/^export-/', $taskname)) {
             continue;
         }
         $tabs['views']['export'] = array('text' => wfMessage('translate-taction-export')->text(), 'href' => $translate->getLocalUrl(array('taction' => 'export') + $params), 'class' => 'tux-tab');
         if ($alias === 'Translate' && $taction === 'export') {
             $tabs['views']['export']['class'] .= ' selected';
         }
         // We only need the tab to apper once ;)
         break;
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:67,代码来源:SpecialTranslate.php


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