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


PHP Title::getSubpageText方法代码示例

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


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

示例1: getCurrentLang

 /**
  * Returns the language code for a title.
  * 
  * @param Title $title
  * 
  * @return string
  */
 public static function getCurrentLang(Title $title)
 {
     $subPage = explode('/', $title->getSubpageText());
     $subPage = array_pop($subPage);
     if ($subPage != '' && array_key_exists($subPage, Language::getLanguageNames(false))) {
         return $subPage;
     }
     global $wgLanguageCode;
     return $wgLanguageCode;
 }
开发者ID:JeroenDeDauw,项目名称:LiveTranslate,代码行数:17,代码来源:LiveTranslate_Functions.php

示例2: getVariableValue

 /**
  * Return value of a magic variable (like PAGENAME)
  *
  * @private
  *
  * @param $index integer
  * @param bool|\PPFrame $frame
  *
  * @throws MWException
  * @return string
  */
 function getVariableValue($index, $frame = false)
 {
     global $wgContLang, $wgSitename, $wgServer;
     global $wgArticlePath, $wgScriptPath, $wgStylePath;
     if (is_null($this->mTitle)) {
         // If no title set, bad things are going to happen
         // later. Title should always be set since this
         // should only be called in the middle of a parse
         // operation (but the unit-tests do funky stuff)
         throw new MWException(__METHOD__ . ' Should only be ' . ' called while parsing (no title set)');
     }
     /**
      * Some of these require message or data lookups and can be
      * expensive to check many times.
      */
     if (wfRunHooks('ParserGetVariableValueVarCache', array(&$this, &$this->mVarCache))) {
         if (isset($this->mVarCache[$index])) {
             return $this->mVarCache[$index];
         }
     }
     $ts = wfTimestamp(TS_UNIX, $this->mOptions->getTimestamp());
     wfRunHooks('ParserGetVariableValueTs', array(&$this, &$ts));
     $pageLang = $this->getFunctionLang();
     switch ($index) {
         case 'currentmonth':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('m'));
             break;
         case 'currentmonth1':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentmonthname':
             $value = $pageLang->getMonthName(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentmonthnamegen':
             $value = $pageLang->getMonthNameGen(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentmonthabbrev':
             $value = $pageLang->getMonthAbbreviation(MWTimestamp::getInstance($ts)->format('n'));
             break;
         case 'currentday':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('j'));
             break;
         case 'currentday2':
             $value = $pageLang->formatNum(MWTimestamp::getInstance($ts)->format('d'));
             break;
         case 'localmonth':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('m'));
             break;
         case 'localmonth1':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localmonthname':
             $value = $pageLang->getMonthName(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localmonthnamegen':
             $value = $pageLang->getMonthNameGen(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localmonthabbrev':
             $value = $pageLang->getMonthAbbreviation(MWTimestamp::getLocalInstance($ts)->format('n'));
             break;
         case 'localday':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('j'));
             break;
         case 'localday2':
             $value = $pageLang->formatNum(MWTimestamp::getLocalInstance($ts)->format('d'));
             break;
         case 'pagename':
             $value = wfEscapeWikiText($this->mTitle->getText());
             break;
         case 'pagenamee':
             $value = wfEscapeWikiText($this->mTitle->getPartialURL());
             break;
         case 'fullpagename':
             $value = wfEscapeWikiText($this->mTitle->getPrefixedText());
             break;
         case 'fullpagenamee':
             $value = wfEscapeWikiText($this->mTitle->getPrefixedURL());
             break;
         case 'subpagename':
             $value = wfEscapeWikiText($this->mTitle->getSubpageText());
             break;
         case 'subpagenamee':
             $value = wfEscapeWikiText($this->mTitle->getSubpageUrlForm());
             break;
         case 'rootpagename':
             $value = wfEscapeWikiText($this->mTitle->getRootText());
             break;
         case 'rootpagenamee':
             $value = wfEscapeWikiText(wfUrlEncode(str_replace(' ', '_', $this->mTitle->getRootText())));
//.........这里部分代码省略.........
开发者ID:Tarendai,项目名称:spring-website,代码行数:101,代码来源:Parser.php

示例3: getVariableValue

 /**
  * Return value of a magic variable (like PAGENAME)
  *
  * @private
  *
  * @param $index integer
  * @param $frame PPFrame
  */
 function getVariableValue($index, $frame = false)
 {
     global $wgContLang, $wgSitename, $wgServer;
     global $wgArticlePath, $wgScriptPath, $wgStylePath;
     /**
      * Some of these require message or data lookups and can be
      * expensive to check many times.
      */
     if (wfRunHooks('ParserGetVariableValueVarCache', array(&$this, &$this->mVarCache))) {
         if (isset($this->mVarCache[$index])) {
             return $this->mVarCache[$index];
         }
     }
     $ts = wfTimestamp(TS_UNIX, $this->mOptions->getTimestamp());
     wfRunHooks('ParserGetVariableValueTs', array(&$this, &$ts));
     # Use the time zone
     global $wgLocaltimezone;
     if (isset($wgLocaltimezone)) {
         $oldtz = date_default_timezone_get();
         date_default_timezone_set($wgLocaltimezone);
     }
     $localTimestamp = date('YmdHis', $ts);
     $localMonth = date('m', $ts);
     $localMonth1 = date('n', $ts);
     $localMonthName = date('n', $ts);
     $localDay = date('j', $ts);
     $localDay2 = date('d', $ts);
     $localDayOfWeek = date('w', $ts);
     $localWeek = date('W', $ts);
     $localYear = date('Y', $ts);
     $localHour = date('H', $ts);
     if (isset($wgLocaltimezone)) {
         date_default_timezone_set($oldtz);
     }
     switch ($index) {
         case 'currentmonth':
             $value = $wgContLang->formatNum(gmdate('m', $ts));
             break;
         case 'currentmonth1':
             $value = $wgContLang->formatNum(gmdate('n', $ts));
             break;
         case 'currentmonthname':
             $value = $wgContLang->getMonthName(gmdate('n', $ts));
             break;
         case 'currentmonthnamegen':
             $value = $wgContLang->getMonthNameGen(gmdate('n', $ts));
             break;
         case 'currentmonthabbrev':
             $value = $wgContLang->getMonthAbbreviation(gmdate('n', $ts));
             break;
         case 'currentday':
             $value = $wgContLang->formatNum(gmdate('j', $ts));
             break;
         case 'currentday2':
             $value = $wgContLang->formatNum(gmdate('d', $ts));
             break;
         case 'localmonth':
             $value = $wgContLang->formatNum($localMonth);
             break;
         case 'localmonth1':
             $value = $wgContLang->formatNum($localMonth1);
             break;
         case 'localmonthname':
             $value = $wgContLang->getMonthName($localMonthName);
             break;
         case 'localmonthnamegen':
             $value = $wgContLang->getMonthNameGen($localMonthName);
             break;
         case 'localmonthabbrev':
             $value = $wgContLang->getMonthAbbreviation($localMonthName);
             break;
         case 'localday':
             $value = $wgContLang->formatNum($localDay);
             break;
         case 'localday2':
             $value = $wgContLang->formatNum($localDay2);
             break;
         case 'pagename':
             $value = wfEscapeWikiText($this->mTitle->getText());
             break;
         case 'pagenamee':
             $value = wfEscapeWikiText($this->mTitle->getPartialURL());
             break;
         case 'fullpagename':
             $value = wfEscapeWikiText($this->mTitle->getPrefixedText());
             break;
         case 'fullpagenamee':
             $value = wfEscapeWikiText($this->mTitle->getPrefixedURL());
             break;
         case 'subpagename':
             $value = wfEscapeWikiText($this->mTitle->getSubpageText());
             break;
//.........这里部分代码省略.........
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:101,代码来源:Parser.php

示例4: addCategoryPage

 /**
  * Hook
  *
  * @param $catView
  * @param Title $title
  * @param $row
  * @param $sortkey
  *
  * @return bool
  * @internal param $CategoryViewer
  */
 public static function addCategoryPage(&$catView, &$title, &$row, $sortkey)
 {
     if (in_array($row->page_namespace, array(NS_BLOG_ARTICLE, NS_BLOG_LISTING))) {
         /**
          * initialize CategoryView->blogs array
          */
         if (!isset($catView->blogs)) {
             $catView->blogs = array();
         }
         if (F::app()->checkSkin('wikiamobile')) {
             $catView->blogs[] = ['name' => $title->getText(), 'url' => $title->getLocalUrl()];
             return false;
         }
         /**
          * initialize CategoryView->blogs_start_char array
          */
         if (!isset($catView->blogs_start_char)) {
             $catView->blogs_start_char = array();
         }
         // remove user blog:foo from displayed titles (requested by Angie)
         // "User blog:Homersimpson89/Best Simpsons episode..." -> "Best Simpsons episode..."
         $text = $title->getSubpageText();
         $userName = $title->getBaseText();
         $link = $catView->getSkin()->link($title, $userName . " - " . $text);
         $catView->blogs[] = $row->page_is_redirect ? '<span class="redirect-in-category">' . $link . '</span>' : $link;
         // The blog entries should be sorted on the category page
         // just like other pages
         $catView->blogs_start_char[] = $catView->collation->getFirstLetter($sortkey);
         /**
          * when we return false it won't be displayed as normal category but
          * in "other" categories
          */
         return false;
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:47,代码来源:BlogArticle.php

示例5: onUserCan

 /**
  * Hook-Handler for 'userCan', prevents foreign access to a users sidebar settings
  * @param Title $oTitle Title object being checked against
  * @param User $oUser Current user object
  * @param string $sAction Action being checked
  * @param bool $bResult Pointer to result returned if hook returns false. If null is returned,	userCan checks are continued by internal code.
  * @return bool false if the user accesses a UserSidebar Title of another user, true in all other cases.
  */
 public function onUserCan($oTitle, $oUser, $sAction, $bResult)
 {
     if ($sAction != 'edit') {
         return true;
     }
     if ($oTitle->getNamespace() != NS_USER || !$oTitle->isSubpage()) {
         return true;
     }
     if (strcasecmp($oTitle->getSubpageText(), 'Sidebar') == 0) {
         $oBasePage = Title::newFromText($oTitle->getBaseText(), NS_USER);
         if (!$oBasePage->equals($oUser->getUserPage())) {
             $bResult = false;
             return false;
         }
     }
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:25,代码来源:UserSidebar.class.php

示例6: isTitleDraft

 /**
  * Checks if the Title object is a Draft subpage of a template
  *
  * @param Title $title
  * @return bool
  */
 public static function isTitleDraft(Title $title)
 {
     return $title->getNamespace() === NS_TEMPLATE && $title->isSubpage() && ($title->getSubpageText() === wfMessage('templatedraft-subpage')->inContentLanguage()->escaped() || $title->getSubpageText() === wfMessage('templatedraft-subpage')->inLanguage('en')->escaped());
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:TemplateDraftHelper.class.php


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