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


PHP OutputPage::getRequest方法代码示例

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


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

示例1: onBeforePageDisplay

 /**
  *
  * @param OutputPage $oOutputPage
  * @param Skin $oSkin
  * @return boolean - always true
  */
 public function onBeforePageDisplay(&$oOutputPage, &$oSkin)
 {
     if (!in_array($oOutputPage->getRequest()->getVal('action', 'view'), array('edit', 'submit'))) {
         return true;
     }
     $oOutputPage->addModules('bluespice.insertLink.interWikiLinks');
     //TODO implement ow
     $oOutputPage->addJsConfigVars('BSInterWikiPrefixes', $this->getInterWikiLinkPrefixes());
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:16,代码来源:InterWikiLinks.class.php

示例2: onBeforePageDisplay

 /**
  * Handler for the BeforePageDisplay hook, injects special behaviour
  * for PropertySuggestions in the EntitySuggester (if page is in EntityNamespace)
  *
  *
  * @param OutputPage $out
  * @param Skin $skin
  * @return bool
  */
 public static function onBeforePageDisplay(OutputPage &$out, Skin &$skin)
 {
     if ($out->getRequest()->getCheck('nosuggestions')) {
         return true;
     }
     $entityNamespaceLookup = WikibaseRepo::getDefaultInstance()->getEntityNamespaceLookup();
     $itemNamespace = $entityNamespaceLookup->getEntityNamespace(CONTENT_MODEL_WIKIBASE_ITEM);
     if ($out->getTitle()->getNamespace() !== $itemNamespace) {
         return true;
     }
     $out->addModules('ext.PropertySuggester.EntitySelector');
     return true;
 }
开发者ID:siebrand,项目名称:PropertySuggester,代码行数:22,代码来源:PropertySuggesterHooks.php

示例3: onBeforePageDisplay

 /**
  * BeforePageDisplay hook handler
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay
  *
  * @param OutputPage $out
  * @param Skin $sk
  * @return bool
  */
 public static function onBeforePageDisplay(&$out, &$sk)
 {
     global $wgWPBSkinBlacklist, $wgWPBEnableDefaultBanner;
     $context = MobileContext::singleton();
     $config = $context->getMFConfig();
     $mfEnableXAnalyticsLogging = $config->get('MFEnableXAnalyticsLogging');
     $mfAppPackageId = $config->get('MFAppPackageId');
     $mfAppScheme = $config->get('MFAppScheme');
     $mfNoIndexPages = $config->get('MFNoindexPages');
     $mfMobileUrlTemplate = $context->getMobileUrlTemplate();
     $tabletSize = $config->get('MFDeviceWidthTablet');
     // show banners using WikidataPageBanner, if installed and all pre-conditions fulfilled
     if (ExtensionRegistry::getInstance()->isLoaded('WikidataPageBanner') && $context->isBetaGroupMember()) {
         // turn default banners on
         $wgWPBEnableDefaultBanner = true;
         // Turn on the banner experiment
         $needle = array_search('minerva', $wgWPBSkinBlacklist);
         if ($needle !== false) {
             unset($wgWPBSkinBlacklist[$needle]);
         }
     }
     $title = $sk->getTitle();
     $request = $context->getRequest();
     // Migrate prefixed disableImages cookie to unprefixed cookie.
     if (isset($_COOKIE[$config->get('CookiePrefix') . 'disableImages'])) {
         if ((bool) $request->getCookie('disableImages')) {
             $context->setDisableImagesCookie(true);
         }
         $request->response()->clearCookie('disableImages');
     }
     # Add deep link to a mobile app specified by $wgMFAppScheme
     if ($mfAppPackageId !== false && $title->isContentPage() && $request->getRawQueryString() === '') {
         $fullUrl = $title->getFullURL();
         $mobileUrl = $context->getMobileUrl($fullUrl);
         $path = preg_replace("/^([a-z]+:)?(\\/)*/", '', $mobileUrl, 1);
         $scheme = 'http';
         if ($mfAppScheme !== false) {
             $scheme = $mfAppScheme;
         } else {
             $protocol = $request->getProtocol();
             if ($protocol != '') {
                 $scheme = $protocol;
             }
         }
         $hreflink = 'android-app://' . $mfAppPackageId . '/' . $scheme . '/' . $path;
         $out->addLink(array('rel' => 'alternate', 'href' => $hreflink));
     }
     // an canonical/alternate link is only useful, if the mobile and desktop URL are different
     // and $wgMFNoindexPages needs to be true
     if ($mfMobileUrlTemplate && $mfNoIndexPages) {
         if (!$context->shouldDisplayMobileView()) {
             // add alternate link to desktop sites - bug T91183
             $desktopUrl = $title->getFullUrl();
             $link = array('rel' => 'alternate', 'media' => 'only screen and (max-width: ' . $tabletSize . 'px)', 'href' => $context->getMobileUrl($desktopUrl));
         } else {
             // add canonical link to mobile pages, instead of noindex - bug T91183
             $link = array('rel' => 'canonical', 'href' => $title->getFullUrl());
         }
         $out->addLink($link);
     }
     // Set X-Analytics HTTP response header if necessary
     if ($context->shouldDisplayMobileView()) {
         $analyticsHeader = $mfEnableXAnalyticsLogging ? $context->getXAnalyticsHeader() : false;
         if ($analyticsHeader) {
             $resp = $out->getRequest()->response();
             $resp->header($analyticsHeader);
         }
         // in mobile view: always add vary header
         $out->addVaryHeader('Cookie');
         // Allow modifications in mobile only mode
         Hooks::run('BeforePageDisplayMobile', array(&$out, &$sk));
     }
     return true;
 }
开发者ID:micha6554,项目名称:mediawiki-extensions-MobileFrontend,代码行数:82,代码来源:MobileFrontend.hooks.php

示例4: makeCustomURL

 /**
  * Build a load.php URL using OutputPage instance to get  most of the required information
  *
  * @param OutputPage $out
  * @param string|array $modules Module names
  * @param string $only
  * @param bool|string $user User name (true to get it from OutputPage)
  * @param string $version
  * @param array $extraQuery
  * @return string
  */
 public static function makeCustomURL(OutputPage $out, $modules, $only = ResourceLoaderModule::TYPE_COMBINED, $user = null, $version = null, $extraQuery = array())
 {
     if ($user === true) {
         $user = $out->getUser()->getName();
     } else {
         if ($user === false || $user === null) {
             $user = null;
         } else {
             $user = (string) $user;
         }
     }
     $url = ResourceLoader::makeLoaderURL($modules, $out->getLanguage()->getCode(), $out->getSkin()->getSkinName(), $user, $version, ResourceLoader::inDebugMode(), $only === ResourceLoaderModule::TYPE_COMBINED ? null : $only, $out->isPrintable(), $out->getRequest()->getBool('handheld'), $extraQuery);
     return $url;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:ResourceLoader.php

示例5: onBeforeSendCacheControl

 /**
  * Add X-Served-By and X-Backend-Response-Time response headers to MediaWiki pages
  *
  * See BAC-550 for details
  *
  * @param OutputPage $out
  * @param Skin $sk
  * @return bool
  * @author macbre
  */
 static function onBeforeSendCacheControl(OutputPage $out)
 {
     self::addExtraHeaders($out->getRequest()->response());
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:Wikia.php

示例6: onBeforePageDisplay

 /**
  * BeforePageDisplay hook handler
  * @see https://www.mediawiki.org/wiki/Manual:Hooks/BeforePageDisplay
  *
  * @param OutputPage $out
  * @param Skin $sk
  * @return bool
  */
 public static function onBeforePageDisplay(&$out, &$sk)
 {
     $context = MobileContext::singleton();
     $config = $context->getMFConfig();
     $mfEnableXAnalyticsLogging = $config->get('MFEnableXAnalyticsLogging');
     $mfAppPackageId = $config->get('MFAppPackageId');
     $mfAppScheme = $config->get('MFAppScheme');
     $mfNoIndexPages = $config->get('MFNoindexPages');
     $mfMobileUrlTemplate = $context->getMobileUrlTemplate();
     $tabletSize = $config->get('MFDeviceWidthTablet');
     $title = $sk->getTitle();
     $request = $context->getRequest();
     # Add deep link to a mobile app specified by $wgMFAppScheme
     if ($mfAppPackageId !== false && $title->isContentPage() && $request->getRawQueryString() === '') {
         $fullUrl = $title->getFullURL();
         $mobileUrl = $context->getMobileUrl($fullUrl);
         $path = preg_replace("/^([a-z]+:)?(\\/)*/", '', $mobileUrl, 1);
         $scheme = 'http';
         if ($mfAppScheme !== false) {
             $scheme = $mfAppScheme;
         } else {
             $protocol = $request->getProtocol();
             if ($protocol != '') {
                 $scheme = $protocol;
             }
         }
         $hreflink = 'android-app://' . $mfAppPackageId . '/' . $scheme . '/' . $path;
         $out->addLink(array('rel' => 'alternate', 'href' => $hreflink));
     }
     // an canonical/alternate link is only useful, if the mobile and desktop URL are different
     // and $wgMFNoindexPages needs to be true
     if ($mfMobileUrlTemplate && $mfNoIndexPages) {
         if (!$context->shouldDisplayMobileView()) {
             // add alternate link to desktop sites - bug T91183
             $desktopUrl = $title->getFullUrl();
             $link = array('rel' => 'alternate', 'media' => 'only screen and (max-width: ' . $tabletSize . 'px)', 'href' => $context->getMobileUrl($desktopUrl));
         } else {
             // add canonical link to mobile pages, instead of noindex - bug T91183
             $link = array('rel' => 'canonical', 'href' => $title->getFullUrl());
         }
         $out->addLink($link);
     }
     // Set X-Analytics HTTP response header if necessary
     if ($context->shouldDisplayMobileView()) {
         $analyticsHeader = $mfEnableXAnalyticsLogging ? $context->getXAnalyticsHeader() : false;
         if ($analyticsHeader) {
             $resp = $out->getRequest()->response();
             $resp->header($analyticsHeader);
         }
         // in mobile view: always add vary header
         $out->addVaryHeader('Cookie');
     }
     return true;
 }
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:62,代码来源:MobileFrontend.hooks.php

示例7: getHTMLIframeForZoomviewer

 /**
  * Generate the HTML for the iframe
  */
 private function getHTMLIframeForZoomviewer(OutputPage $out)
 {
     global $wgScriptPath, $wgLang;
     $viewer_type = $this->getViewerType($out->getRequest());
     $viewer_path = $this->getViewerPath($viewer_type);
     $image_file_path = $this->constructImageFilePath();
     $language = $wgLang->getCode();
     $website_name = 'ManuscriptDesk';
     return '<iframe id="zoomviewerframe" src="' . $wgScriptPath . '/extensions/NewManuscript/' . $viewer_path . '?image=' . $image_file_path . '&amp;lang=' . $language . '&amp;sitename=' . urlencode($website_name) . '"></iframe>';
 }
开发者ID:akvankorlaar,项目名称:manuscriptdesk,代码行数:13,代码来源:NewManuscript.hooks.php

示例8: newArticleCampaign

 /**
  * Hook: EditPage::showEditForm:initial
  */
 public static function newArticleCampaign(EditPage $newPage, OutputPage $out)
 {
     global $wgContentTranslationCampaigns, $wgContentTranslationEventLogging;
     $user = $out->getUser();
     if (!$wgContentTranslationCampaigns['newarticle'] || $out->getRequest()->getCookie('cx_campaign_newarticle_hide', '') || $newPage->mTitle->exists() || !$newPage->mTitle->inNamespace(NS_MAIN) || $user->isAnon() || BetaFeatures::isFeatureEnabled($user, 'cx')) {
         return true;
     }
     // If EventLogging integration is enabled, load the event logging functions module
     // to measure and analyse the usage of this entry point.
     if ($wgContentTranslationEventLogging) {
         $out->addModules('ext.cx.eventlogging');
     }
     $out->addModules('ext.cx.campaigns.newarticle');
 }
开发者ID:Wikia,项目名称:mediawiki-extensions-ContentTranslation,代码行数:17,代码来源:ContentTranslation.hooks.php

示例9: onEditPageShowEditFormFields

 /**
  * Called when the normal wikitext editor is shown.
  * Inserts a 'veswitched' hidden field if requested by the client
  *
  * @param $editPage EditPage
  * @param $output OutputPage
  * @return boolean true
  */
 public static function onEditPageShowEditFormFields(EditPage $editPage, OutputPage $output)
 {
     $request = $output->getRequest();
     if ($request->getBool('veswitched')) {
         $output->addHTML(Xml::input('veswitched', false, '1', array('type' => 'hidden')));
     }
     return true;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:16,代码来源:VisualEditor.hooks.php

示例10: onOutputPageBeforeHTML

 /**
  * Display Related Discussion (Forum posts) in bottom of article
  * @param OutputPage $out
  * @param string $text article HTML
  * @return bool: true because it is a hook
  */
 public static function onOutputPageBeforeHTML(OutputPage $out, &$text)
 {
     $app = F::app();
     $title = $out->getTitle();
     if ($out->isArticle() && $title->exists() && $title->getNamespace() == NS_MAIN && !Wikia::isMainPage() && $out->getRequest()->getVal('diff') === null && $out->getRequest()->getVal('action') !== 'render' && !$app->checkSkin('wikiamobile', $out->getSkin())) {
         // VOLDEV-46: Omit zero-state, only render if there are related forum threads
         $messages = RelatedForumDiscussionController::getData($title->getArticleId());
         unset($messages['lastupdate']);
         if (!empty($messages)) {
             $text .= $app->renderView('RelatedForumDiscussionController', 'index', array('messages' => $messages));
         }
     }
     return true;
 }
开发者ID:yusufchang,项目名称:app,代码行数:20,代码来源:ForumHooksHelper.class.php

示例11: onBeforePageDisplay

 /**
  * Adds the 'ext.bluespice.responsibleeditors' module to the OutputPage
  * @param OutputPage $out
  * @param Skin $skin
  * @return boolean
  */
 public function onBeforePageDisplay($out, $skin)
 {
     if ($out->getRequest()->getVal('action', 'view') == 'view' && !$out->getTitle()->isSpecialPage()) {
         $out->addModules('ext.bluespice.responsibleEditors');
         $out->addModuleStyles('ext.bluespice.responsibleEditors.styles');
         //Make information about current pages RespEds available on client side
         $iArticleId = $out->getTitle()->getArticleID();
         $aResponsibleEditorIds = $this->getResponsibleEditorIdsByArticleId($iArticleId);
         $oData = new stdClass();
         $oData->articleId = $iArticleId;
         $oData->editorIds = $aResponsibleEditorIds;
         $out->addJsConfigVars('bsResponsibleEditors', $oData);
     }
     if (BsExtensionManager::getExtension('Bookshelf') !== null) {
         //Attach Bookshelfs plugin if in context
         if (SpecialPage::getTitleFor('BookshelfBookManager')->equals($out->getTitle())) {
             $out->addModules('ext.bluespice.responsibleEditors.bookshelfPlugin');
         }
     }
     if (BsExtensionManager::getExtension('SuperList') !== null) {
         //Attach SuperList plugin if in context
         if (SpecialPage::getTitleFor('SuperList')->equals($out->getTitle())) {
             $out->addModules('ext.bluespice.responsibleEditors.superList');
         }
     }
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:33,代码来源:ResponsibleEditors.class.php

示例12: onBeforePageDisplay

 public static function onBeforePageDisplay(OutputPage &$out, &$skin)
 {
     if (!$out->getTitle()->isSpecial('WikiAdmin')) {
         return true;
     }
     if (strtolower($out->getRequest()->getVal('mode')) != 'preferences') {
         return true;
     }
     $out->addInlineStyle('.bs-prefs legend{cursor:pointer;}');
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:11,代码来源:Preferences.class.php

示例13: addConfig

 /**
  * Hook: MakeGlobalVariablesScript
  *
  * Adds $wgTranslateDocumentationLanguageCode to ResourceLoader configuration
  * when Special:Translate is shown.
  */
 public static function addConfig(&$vars, OutputPage $out)
 {
     $request = $out->getRequest();
     $title = $out->getTitle();
     list($alias, ) = SpecialPageFactory::resolveAlias($title->getText());
     if (SpecialTranslate::isBeta($request) && $title->isSpecialPage() && ($alias === 'Translate' || $alias === 'TranslationStash' || $alias === 'SearchTranslations')) {
         global $wgTranslateDocumentationLanguageCode, $wgTranslatePermissionUrl, $wgTranslateUseSandbox;
         $vars['TranslateRight'] = $out->getUser()->isAllowed('translate');
         $vars['TranslateMessageReviewRight'] = $out->getUser()->isAllowed('translate-messagereview');
         $vars['DeleteRight'] = $out->getUser()->isAllowed('delete');
         $vars['wgTranslateDocumentationLanguageCode'] = $wgTranslateDocumentationLanguageCode;
         $vars['wgTranslatePermissionUrl'] = $wgTranslatePermissionUrl;
         $vars['wgTranslateUseSandbox'] = $wgTranslateUseSandbox;
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:22,代码来源:TranslateHooks.php


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