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


PHP Title::isSpecialPage方法代码示例

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


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

示例1: displayAdminDashboard

 /**
  * @brief Helper function which determines whether to display the Admin Dashboard Chrome in the Oasis Skin
  * @param WikiaApp $app
  * @param Title $title Title of page we are on
  * @return boolean
  */
 public static function displayAdminDashboard($app, $title)
 {
     // Admin Dashboard is only for logged in plus a list of groups
     if (!$app->wg->User->isLoggedIn()) {
         return false;
     }
     if (!$app->wg->User->isAllowed('admindashboard')) {
         return false;
     }
     if ($title && $title->isSpecialPage()) {
         $bits = explode('/', $title->getDBkey(), 2);
         $alias = array_shift(SpecialPageFactory::resolveAlias($bits[0]));
         // NOTE: keep this list in alphabetical order
         static $exclusionList = array("AbTesting", "ApiExplorer", "ApiGate", "Chat", "CloseWiki", "Code", "Confirmemail", "Connect", "Contact", "Contributions", "CreateBlogPage", "CreatePage", "CreateNewWiki", "CreateTopList", "Crunchyroll", "EditAccount", "EditTopList", "Following", "Forum", "ImageReview", "Invalidateemail", "LandingPageSmurfs", "LayoutBuilder", "LayoutBuilderForm", "Leaderboard", "LookupContribs", "LookupUser", "ManageWikiaHome", "MiniEditor", "MovePage", "MultiLookup", "NewFiles", "Newimages", "Our404Handler", "PageLayoutBuilder", "PageLayoutBuilderForm", "Phalanx", "PhalanxStats", "PhotoPopSetup", "Places", "Play", "Preferences", "PromoteImageReview", "ScavengerHunt", "Search", "Signup", "SiteWideMessages", "SponsorshipDashboard", "StructuredData", "TaskManager", "ThemeDesigner", "ThemeDesignerPreview", "UserLogin", "UserManagement", "UserPathPrediction", "UserSignup", "Version", "Videos", "WhereIsExtension", "WikiActivity", "WikiaHubsV2", "WikiaSearch", "WikiaStyleGuide", "WikiFactory", "WikiFactoryReporter", "WikiStats");
         return !in_array($alias, $exclusionList);
     }
     return false;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:24,代码来源:AdminDashboardLogic.class.php

示例2: getPageClasses

 /**
  * Takes a title and returns classes to apply to the body tag
  * @param Title $title
  * @return string
  */
 public function getPageClasses($title)
 {
     $className = $this->getMode();
     if ($title->isMainPage()) {
         $className .= ' page-Main_Page ';
     } elseif ($title->isSpecialPage()) {
         $className .= ' mw-mf-special ';
     }
     if ($this->isMobileMode) {
         $className .= ' mw-mobile-mode';
     } else {
         $className .= ' mw-desktop-mode';
     }
     if ($this->isAuthenticatedUser()) {
         $className .= ' is-authenticated';
     }
     return $className;
 }
开发者ID:GoProjectOwner,项目名称:mediawiki-extensions-MobileFrontend,代码行数:23,代码来源:SkinMinerva.php

示例3: getRedirectURL

 /**
  * Get the Title object or URL to use for a redirect. We use Title
  * objects for same-wiki, non-special redirects and URLs for everything
  * else.
  * @param Title $rt Redirect target
  * @return bool|Title|string False, Title object of local target, or string with URL
  */
 public function getRedirectURL($rt)
 {
     if (!$rt) {
         return false;
     }
     if ($rt->isExternal()) {
         if ($rt->isLocal()) {
             // Offsite wikis need an HTTP redirect.
             // This can be hard to reverse and may produce loops,
             // so they may be disabled in the site configuration.
             $source = $this->mTitle->getFullURL('redirect=no');
             return $rt->getFullURL(['rdfrom' => $source]);
         } else {
             // External pages without "local" bit set are not valid
             // redirect targets
             return false;
         }
     }
     if ($rt->isSpecialPage()) {
         // Gotta handle redirects to special pages differently:
         // Fill the HTTP response "Location" header and ignore the rest of the page we're on.
         // Some pages are not valid targets.
         if ($rt->isValidRedirectTarget()) {
             return $rt->getFullURL();
         } else {
             return false;
         }
     }
     return $rt;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:37,代码来源:WikiPage.php

示例4: normaliseSpecialPage

 /**
  * @param $title Title
  * @return Title
  */
 static function normaliseSpecialPage(Title $title)
 {
     if ($title->isSpecialPage()) {
         list($name, $subpage) = SpecialPageFactory::resolveAlias($title->getDBkey());
         if (!$name) {
             return $title;
         }
         $ret = SpecialPage::getTitleFor($name, $subpage);
         $ret->mFragment = $title->getFragment();
         return $ret;
     } else {
         return $title;
     }
 }
开发者ID:h4ck3rm1k3,项目名称:mediawiki,代码行数:18,代码来源:Linker.php

示例5: getTitleLink

 /**
  * @todo Document
  * @param string $type
  * @param Language|null $lang
  * @param Title $title
  * @param array $params
  * @return string
  */
 protected static function getTitleLink($type, $lang, $title, &$params)
 {
     if (!$lang) {
         return $title->getPrefixedText();
     }
     if ($title->isSpecialPage()) {
         list($name, $par) = SpecialPageFactory::resolveAlias($title->getDBkey());
         # Use the language name for log titles, rather than Log/X
         if ($name == 'Log') {
             $logPage = new LogPage($par);
             $titleLink = Linker::link($title, $logPage->getName()->escaped());
             $titleLink = wfMessage('parentheses')->inLanguage($lang)->rawParams($titleLink)->escaped();
         } else {
             $titleLink = Linker::link($title);
         }
     } else {
         $titleLink = Linker::link($title);
     }
     return $titleLink;
 }
开发者ID:T282,项目名称:mediawiki,代码行数:28,代码来源:LogPage.php

示例6: tryNormaliseRedirect

 /**
  * Handle redirects for uncanonical title requests.
  *
  * Handles:
  * - Redirect loops.
  * - No title in URL.
  * - $wgUsePathInfo URLs.
  * - URLs with a variant.
  * - Other non-standard URLs (as long as they have no extra query parameters).
  *
  * Behaviour:
  * - Normalise title values:
  *   /wiki/Foo%20Bar -> /wiki/Foo_Bar
  * - Normalise empty title:
  *   /wiki/ -> /wiki/Main
  *   /w/index.php?title= -> /wiki/Main
  * - Normalise non-standard title urls:
  *   /w/index.php?title=Foo_Bar -> /wiki/Foo_Bar
  * - Don't redirect anything with query parameters other than 'title' or 'action=view'.
  *
  * @param Title $title
  * @return bool True if a redirect was set.
  * @throws HttpError
  */
 private function tryNormaliseRedirect(Title $title)
 {
     $request = $this->context->getRequest();
     $output = $this->context->getOutput();
     if ($request->getVal('action', 'view') != 'view' || $request->wasPosted() || count($request->getValueNames(['action', 'title'])) || !Hooks::run('TestCanonicalRedirect', [$request, $title, $output])) {
         return false;
     }
     if ($title->isSpecialPage()) {
         list($name, $subpage) = SpecialPageFactory::resolveAlias($title->getDBkey());
         if ($name) {
             $title = SpecialPage::getTitleFor($name, $subpage);
         }
     }
     // Redirect to canonical url, make it a 301 to allow caching
     $targetUrl = wfExpandUrl($title->getFullURL(), PROTO_CURRENT);
     if ($targetUrl != $request->getFullRequestURL()) {
         $output->setCdnMaxage(1200);
         $output->redirect($targetUrl, '301');
         return true;
     }
     // If there is no title, or the title is in a non-standard encoding, we demand
     // a redirect. If cgi somehow changed the 'title' query to be non-standard while
     // the url is standard, the server is misconfigured.
     if ($request->getVal('title') === null || $title->getPrefixedDBkey() != $request->getVal('title')) {
         $message = "Redirect loop detected!\n\n" . "This means the wiki got confused about what page was " . "requested; this sometimes happens when moving a wiki " . "to a new server or changing the server configuration.\n\n";
         if ($this->config->get('UsePathInfo')) {
             $message .= "The wiki is trying to interpret the page " . "title from the URL path portion (PATH_INFO), which " . "sometimes fails depending on the web server. Try " . "setting \"\$wgUsePathInfo = false;\" in your " . "LocalSettings.php, or check that \$wgArticlePath " . "is correct.";
         } else {
             $message .= "Your web server was detected as possibly not " . "supporting URL path components (PATH_INFO) correctly; " . "check your LocalSettings.php for a customized " . "\$wgArticlePath setting and/or toggle \$wgUsePathInfo " . "to true.";
         }
         throw new HttpError(500, $message);
     }
     return false;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:58,代码来源:MediaWiki.php

示例7: getPageClasses

 /**
  * TODO: document
  * @param Title $title
  * @return string
  */
 function getPageClasses($title)
 {
     $numeric = 'ns-' . $title->getNamespace();
     if ($title->isSpecialPage()) {
         $type = 'ns-special';
         // bug 23315: provide a class based on the canonical special page name without subpages
         list($canonicalName) = SpecialPageFactory::resolveAlias($title->getDBkey());
         if ($canonicalName) {
             $type .= ' ' . Sanitizer::escapeClass("mw-special-{$canonicalName}");
         } else {
             $type .= ' mw-invalidspecialpage';
         }
     } elseif ($title->isTalkPage()) {
         $type = 'ns-talk';
     } else {
         $type = 'ns-subject';
     }
     $name = Sanitizer::escapeClass('page-' . $title->getPrefixedText());
     return "{$numeric} {$type} {$name}";
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:25,代码来源:Skin.php

示例8: showVenusSkin

 /**
  * Check if the current page should be rendered using Venus
  *
  * @param Title $title
  * @return bool
  */
 public static function showVenusSkin(Title $title)
 {
     global $wgEnableVenusSkin, $wgEnableVenusSpecialSearch, $wgEnableVenusArticle, $wgRequest;
     $wrapper = new GlobalStateWrapper(['wgTitle' => $title]);
     $isSearch = false;
     $isArticlePage = false;
     $wrapper->wrap(function () use(&$isSearch, &$isArticlePage) {
         $isSearch = WikiaPageType::isSearch();
         $isArticlePage = WikiaPageType::isArticlePage();
     });
     $action = $wgRequest->getVal('action');
     $diff = $wgRequest->getVal('diff');
     $isSpecialSearch = $isSearch && $wgEnableVenusSpecialSearch;
     $isSpecialVenusTest = $title->isSpecialPage() && $title->getText() == 'VenusTest';
     $isVenusArticle = $isArticlePage && $wgEnableVenusArticle && (empty($action) || $action == 'view') && empty($diff);
     return $wgEnableVenusSkin && ($isSpecialSearch || $isSpecialVenusTest || $isVenusArticle);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:23,代码来源:VenusHooks.class.php

示例9: getViewMoreLikeThis

 /**
  * Creates MoreLinkThis View
  * @param Title $oTitle Current title object
  * @param string $sOrigin origin of request
  * @return View $oViewMlt MoreLikeThis view
  */
 public function getViewMoreLikeThis($oTitle)
 {
     $oViewMlt = new ViewMoreLikeThis();
     if ($oTitle->isSpecialPage()) {
         return $oViewMlt;
     }
     $oResults = $this->getMltData($oTitle);
     $aMlt = array();
     //$aMlt[] = implode( ', ', $oResults->interestingTerms );
     if ($oResults !== null && !empty($oResults->response->docs)) {
         foreach ($oResults->response->docs as $oRes) {
             if (count($aMlt) === 5) {
                 break;
             }
             $oMltTitle = $oRes->namespace != 999 ? Title::makeTitle($oRes->namespace, $oRes->title) : Title::makeTitle(NS_FILE, $oRes->title);
             if (!$oMltTitle->userCan('read') || $oMltTitle->getArticleID() === $oTitle->getArticleID() || $oMltTitle->isRedirect()) {
                 continue;
             }
             $sHtml = $oMltTitle->getPrefixedText();
             $aMlt[] = Linker::link($oMltTitle, $sHtml);
         }
     }
     if (empty($aMlt)) {
         $aMlt[] = wfMessage('bs-extendedsearch-no-mlt-found')->text();
     }
     $oViewMlt->setOption('mlt', $aMlt);
     return $oViewMlt;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:34,代码来源:ExtendedSearchBase.class.php


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