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


PHP Title::isSubpage方法代码示例

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


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

示例1: newFromTitle

 /**
  * factory method, create either Item or List object from title
  *
  * @author ADi
  * @param Title $title
  * @return TopListBase
  */
 public static function newFromTitle(Title $title)
 {
     $object = null;
     if ($title->getNamespace() == NS_TOPLIST) {
         if (!$title->isSubpage()) {
             $object = TopList::newFromTitle($title);
         } else {
             $object = TopListItem::newFromTitle($title);
         }
     }
     return $object;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:19,代码来源:TopListBase.class.php

示例2: newFromTitle

 /**
  * @author Federico "Lox" Lucignano
  *
  * Factory method
  *
  * @param Title $title a Title class instance for the article
  * @param boolean $skipPhalanxCheck a flag informs to check Phalanx or not
  *
  * @return TopList|bool|mixed a TopList instance, false in case $title is not in the NS_TOPLIST namespace
  */
 public static function newFromTitle(Title $title, $skipPhalanxCheck = false)
 {
     global $wgMemc;
     $notPhalanxBlocked = true;
     //FB#16388: we don't need to check Phalanx blocks while deleting
     if (!$skipPhalanxCheck) {
         //FB#8083: blocked titles are not being filtered, this should be handled automatically by Phalanx though...
         $error_msg = '';
         if (!wfRunHooks("PageTitleFilter", array($title, &$error_msg))) {
             $notPhalanxBlocked = false;
         }
     }
     if ($title->getNamespace() == NS_TOPLIST && !$title->isSubpage() && $notPhalanxBlocked) {
         $list = new self();
         $list->mTitle = $title;
         //needed to let getItems fetch fresh data when instantiating more tha once with the same title object
         $wgMemc->set($list->_getNeedRefreshCacheKey(), true);
         return $list;
     }
     return false;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:TopList.class.php

示例3: showForm

 /**
  * Show the form
  *
  * @param array $err Error messages. Each item is an error message.
  *    It may either be a string message name or array message name and
  *    parameters, like the second argument to OutputPage::wrapWikiMsg().
  */
 function showForm($err)
 {
     global $wgContLang;
     $this->getSkin()->setRelevantTitle($this->oldTitle);
     $oldTitleLink = Linker::link($this->oldTitle);
     $out = $this->getOutput();
     $out->setPageTitle($this->msg('move-page', $this->oldTitle->getPrefixedText()));
     $out->addModules('mediawiki.special.movePage');
     $out->addModuleStyles('mediawiki.special.movePage.styles');
     $this->addHelpLink('Help:Moving a page');
     $newTitle = $this->newTitle;
     if (!$newTitle) {
         # Show the current title as a default
         # when the form is first opened.
         $newTitle = $this->oldTitle;
     } elseif (!count($err)) {
         # If a title was supplied, probably from the move log revert
         # link, check for validity. We can then show some diagnostic
         # information and save a click.
         $newerr = $this->oldTitle->isValidMoveOperation($newTitle);
         if (is_array($newerr)) {
             $err = $newerr;
         }
     }
     $user = $this->getUser();
     if (count($err) == 1 && isset($err[0][0]) && $err[0][0] == 'articleexists' && $newTitle->quickUserCan('delete', $user)) {
         $out->addWikiMsg('delete_and_move_text', $newTitle->getPrefixedText());
         $movepagebtn = $this->msg('delete_and_move')->text();
         $submitVar = 'wpDeleteAndMove';
         $confirm = true;
         $err = array();
     } else {
         if ($this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage()) {
             $out->wrapWikiMsg("<div class=\"error mw-moveuserpage-warning\">\n\$1\n</div>", 'moveuserpage-warning');
         } elseif ($this->oldTitle->getNamespace() == NS_CATEGORY) {
             $out->wrapWikiMsg("<div class=\"error mw-movecategorypage-warning\">\n\$1\n</div>", 'movecategorypage-warning');
         }
         $out->addWikiMsg($this->getConfig()->get('FixDoubleRedirects') ? 'movepagetext' : 'movepagetext-noredirectfixer');
         $movepagebtn = $this->msg('movepagebtn')->text();
         $submitVar = 'wpMove';
         $confirm = false;
     }
     if (count($err) == 1 && isset($err[0][0]) && $err[0][0] == 'file-exists-sharedrepo' && $user->isAllowed('reupload-shared')) {
         $out->addWikiMsg('move-over-sharedrepo', $newTitle->getPrefixedText());
         $submitVar = 'wpMoveOverSharedFile';
         $err = array();
     }
     $oldTalk = $this->oldTitle->getTalkPage();
     $oldTitleSubpages = $this->oldTitle->hasSubpages();
     $oldTitleTalkSubpages = $this->oldTitle->getTalkPage()->hasSubpages();
     $canMoveSubpage = ($oldTitleSubpages || $oldTitleTalkSubpages) && !count($this->oldTitle->getUserPermissionsErrors('move-subpages', $user));
     # We also want to be able to move assoc. subpage talk-pages even if base page
     # has no associated talk page, so || with $oldTitleTalkSubpages.
     $considerTalk = !$this->oldTitle->isTalkPage() && ($oldTalk->exists() || $oldTitleTalkSubpages && $canMoveSubpage);
     $dbr = wfGetDB(DB_SLAVE);
     if ($this->getConfig()->get('FixDoubleRedirects')) {
         $hasRedirects = $dbr->selectField('redirect', '1', array('rd_namespace' => $this->oldTitle->getNamespace(), 'rd_title' => $this->oldTitle->getDBkey()), __METHOD__);
     } else {
         $hasRedirects = false;
     }
     if ($considerTalk) {
         $out->addWikiMsg('movepagetalktext');
     }
     if (count($err)) {
         $out->addHTML("<div class='error'>\n");
         $action_desc = $this->msg('action-move')->plain();
         $out->addWikiMsg('permissionserrorstext-withaction', count($err), $action_desc);
         if (count($err) == 1) {
             $errMsg = $err[0];
             $errMsgName = array_shift($errMsg);
             if ($errMsgName == 'hookaborted') {
                 $out->addHTML("<p>{$errMsg[0]}</p>\n");
             } else {
                 $out->addWikiMsgArray($errMsgName, $errMsg);
             }
         } else {
             $errStr = array();
             foreach ($err as $errMsg) {
                 if ($errMsg[0] == 'hookaborted') {
                     $errStr[] = $errMsg[1];
                 } else {
                     $errMsgName = array_shift($errMsg);
                     $errStr[] = $this->msg($errMsgName, $errMsg)->parse();
                 }
             }
             $out->addHTML('<ul><li>' . implode("</li>\n<li>", $errStr) . "</li></ul>\n");
         }
         $out->addHTML("</div>\n");
     }
     if ($this->oldTitle->isProtected('move')) {
         # Is the title semi-protected?
         if ($this->oldTitle->isSemiProtected('move')) {
             $noticeMsg = 'semiprotectedpagemovewarning';
//.........这里部分代码省略.........
开发者ID:ngertrudiz,项目名称:mediawiki,代码行数:101,代码来源:SpecialMovepage.php

示例4: onGetTalkPage

 /**
  * Convert talk page links to wall page links for wall enabled wikis
  *
  * @param Title $title
  * @param Title $talkPageTitle
  *
  * @return bool
  */
 public static function onGetTalkPage(Title $title, Title &$talkPageTitle)
 {
     if (!empty(F::app()->wg->EnableWallExt) && !$title->isSubpage() && $title->getNamespace() == NS_USER) {
         $talkPageTitle = Title::makeTitle(NS_USER_WALL, $title->getDBkey());
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:15,代码来源:WallHooksHelper.class.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: isWAMFAQPage

 protected function isWAMFAQPage(Title $title)
 {
     return $title->isSubpage() && $title->getDBKey() == self::WAM_FAQ_PAGE_NAME;
 }
开发者ID:yusufchang,项目名称:app,代码行数:4,代码来源:WAMPageArticle.class.php

示例7: 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

示例8: onLinkEnd

 /**
  * Adds additional data to links generated by the framework. This allows us
  * to add more functionality to the UI.
  * @param SkinTemplate $skin
  * @param Title $target
  * @param array $options
  * @param string $html
  * @param array $attribs
  * @param string $ret
  * @return boolean Always true to keep hook running
  */
 public function onLinkEnd($skin, $target, $options, &$html, &$attribs, &$ret)
 {
     if ($target->getNamespace() == NS_USER && $target->isSubpage() === false) {
         $oUser = User::newFromName($target->getText());
         if ($oUser instanceof User) {
             $sMailAddress = $oUser->getEmail();
             $attribs['data-bs-user-has-email'] = empty($sMailAddress) ? false : true;
             //This is already in BSF, but it is only included when the anchor
             //content is the same as the username
             $attribs['data-bs-username'] = $target->getText();
         }
     }
     if ($target->getNamespace() >= 0 && $target->isContentPage()) {
         $attribs['data-bs-is-contentpage'] = true;
     }
     if ($target->getNamespace() === NS_FILE) {
         $oFile = wfFindFile($target);
         if ($oFile instanceof File) {
             $attribs['data-bs-filename'] = $oFile->getName();
             if ($oFile->exists()) {
                 $attribs['data-bs-fileurl'] = $oFile->getUrl();
             }
         }
     }
     return true;
 }
开发者ID:hfroese,项目名称:mediawiki-extensions-BlueSpiceExtensions,代码行数:37,代码来源:ContextMenu.class.php


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