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


PHP Title::getBaseText方法代码示例

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


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

示例1: createDraftContent

 /**
  * Converts the content of the template according to the given type.
  * @param Title $title
  * @param sting $content
  * @param string $type One of types specified in the TemplateClassificationController
  * @return string
  * @throws MWException
  */
 public function createDraftContent(Title $title, $content, $type)
 {
     $newContent = '';
     if ($type === TemplateClassificationController::TEMPLATE_INFOBOX) {
         /**
          * While we're at it we can mark the base template as an infobox
          */
         $parentTitle = Title::newFromText($title->getBaseText(), $title->getNamespace());
         $tc = new TemplateClassificationController($parentTitle);
         $tc->classifyTemplate(TemplateClassificationController::TEMPLATE_INFOBOX, true);
         $templateConverter = new TemplateConverter($title);
         $newContent = $templateConverter->convertAsInfobox($content);
         $newContent .= $templateConverter->generatePreviewSection($content);
     }
     return $newContent;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:TemplateDraftController.class.php

示例2: getVariableValue


//.........这里部分代码省略.........
             $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())));
             break;
         case 'basepagename':
             $value = wfEscapeWikiText($this->mTitle->getBaseText());
             break;
         case 'basepagenamee':
             $value = wfEscapeWikiText(wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText())));
             break;
         case 'talkpagename':
             if ($this->mTitle->canTalk()) {
                 $talkPage = $this->mTitle->getTalkPage();
                 $value = wfEscapeWikiText($talkPage->getPrefixedText());
             } else {
                 $value = '';
             }
             break;
         case 'talkpagenamee':
             if ($this->mTitle->canTalk()) {
                 $talkPage = $this->mTitle->getTalkPage();
                 $value = wfEscapeWikiText($talkPage->getPrefixedURL());
             } else {
                 $value = '';
             }
             break;
         case 'subjectpagename':
             $subjPage = $this->mTitle->getSubjectPage();
             $value = wfEscapeWikiText($subjPage->getPrefixedText());
             break;
         case 'subjectpagenamee':
             $subjPage = $this->mTitle->getSubjectPage();
             $value = wfEscapeWikiText($subjPage->getPrefixedURL());
             break;
         case 'pageid':
             // requested in bug 23427
             $pageid = $this->getTitle()->getArticleID();
             if ($pageid == 0) {
开发者ID:Tarendai,项目名称:spring-website,代码行数:67,代码来源:Parser.php

示例3: getVariableValue


//.........这里部分代码省略.........
             $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;
         case 'subpagenamee':
             $value = wfEscapeWikiText($this->mTitle->getSubpageUrlForm());
             break;
         case 'basepagename':
             $value = wfEscapeWikiText($this->mTitle->getBaseText());
             break;
         case 'basepagenamee':
             $value = wfEscapeWikiText(wfUrlEncode(str_replace(' ', '_', $this->mTitle->getBaseText())));
             break;
         case 'talkpagename':
             if ($this->mTitle->canTalk()) {
                 $talkPage = $this->mTitle->getTalkPage();
                 $value = wfEscapeWikiText($talkPage->getPrefixedText());
             } else {
                 $value = '';
             }
             break;
         case 'talkpagenamee':
             if ($this->mTitle->canTalk()) {
                 $talkPage = $this->mTitle->getTalkPage();
                 $value = wfEscapeWikiText($talkPage->getPrefixedUrl());
             } else {
                 $value = '';
             }
             break;
         case 'subjectpagename':
             $subjPage = $this->mTitle->getSubjectPage();
             $value = wfEscapeWikiText($subjPage->getPrefixedText());
             break;
         case 'subjectpagenamee':
             $subjPage = $this->mTitle->getSubjectPage();
             $value = wfEscapeWikiText($subjPage->getPrefixedUrl());
             break;
         case 'revisionid':
             # Let the edit saving system know we should parse the page
             # *after* a revision ID has been assigned.
             $this->mOutput->setFlag('vary-revision');
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:67,代码来源:Parser.php

示例4: addImageToGallery

	/**
	 * Adds a single image to the gallery.
	 * Takes care of automatically adding a caption when none is provided and parsing it's wikitext.
	 *
	 * @since 1.5.3
	 *
	 * @param ImageGallery $ig The gallery to add the image to
	 * @param Title $imgTitle The title object of the page of the image
	 * @param string $imgCaption An optional caption for the image
	 */
	protected function addImageToGallery( ImageGallery &$ig, Title $imgTitle, $imgCaption ) {
		global $wgParser;

		if ( empty( $imgCaption ) ) {
			if ( $this->m_params['autocaptions'] ) {
				$imgCaption = $imgTitle->getBaseText();
				
				if ( !$this->m_params['fileextensions'] ) {
					$imgCaption = preg_replace( '#\.[^.]+$#', '', $imgCaption );
				}
			}
			else {
				$imgCaption = '';
			}
		}
		else {
			$imgCaption = $wgParser->recursiveTagParse( $imgCaption );
		}

		$ig->add( $imgTitle, $imgCaption );

		// Only add real images (bug #5586)
		if ( $imgTitle->getNamespace() == NS_IMAGE ) {
			$wgParser->mOutput->addImage( $imgTitle->getDBkey() );
		}
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:36,代码来源:SRF_Gallery.php

示例5: addImageToGallery

 /**
  * Adds a single image to the gallery.
  * Takes care of automatically adding a caption when none is provided and parsing it's wikitext.
  *
  * @since 1.5.3
  *
  * @param ImageGallery $ig The gallery to add the image to
  * @param Title $imgTitle The title object of the page of the image
  * @param string $imgCaption An optional caption for the image
  */
 protected function addImageToGallery(ImageGallery &$ig, Title $imgTitle, $imgCaption, $imgRedirect = '')
 {
     if (empty($imgCaption)) {
         if ($this->m_params['autocaptions']) {
             $imgCaption = $imgTitle->getBaseText();
             if (!$this->m_params['fileextensions']) {
                 $imgCaption = preg_replace('#\\.[^.]+$#', '', $imgCaption);
             }
         } else {
             $imgCaption = '';
         }
     } else {
         if ($imgTitle instanceof Title && $imgTitle->getNamespace() == NS_FILE && !$this->isSpecialPage()) {
             $imgCaption = $GLOBALS['wgParser']->recursiveTagParse($imgCaption);
         }
     }
     // Use image alt as helper for either text
     $imgAlt = $this->params['redirects'] === '' ? $imgCaption : $imgRedirect !== '' ? $imgRedirect : '';
     $ig->add($imgTitle, $imgCaption, $imgAlt);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:30,代码来源:SRF_Gallery.php

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

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

示例8: addImageToGallery

 /**
  * Adds a single image to the gallery.
  * Takes care of automatically adding a caption when none is provided and parsing it's wikitext.
  *
  * @since 1.5.3
  *
  * @param ImageGallery $ig The gallery to add the image to
  * @param Title $imgTitle The title object of the page of the image
  * @param string $imgCaption An optional caption for the image
  */
 protected function addImageToGallery(ImageGallery &$ig, Title $imgTitle, $imgCaption)
 {
     global $wgParser;
     if (empty($imgCaption)) {
         if ($this->m_params['autocaptions']) {
             $imgCaption = $imgTitle->getBaseText();
             if (!$this->m_params['fileextensions']) {
                 $imgCaption = preg_replace('#\\.[^.]+$#', '', $imgCaption);
             }
         } else {
             $imgCaption = '';
         }
     } else {
         $imgCaption = $wgParser->recursiveTagParse($imgCaption);
         // the above call creates getMaxIncludeSize() fatal error on Special Pages
         // below might fix this
         // $imgCaption = $wgParser->transformMsg( $imgCaption, ParserOptions::newFromUser( null ) );
     }
     $ig->add($imgTitle, $imgCaption);
     // Only add real images (bug #5586)
     if ($imgTitle->getNamespace() == NS_IMAGE && !is_null($imgTitle->getDBkey())) {
         $wgParser->mOutput->addImage($imgTitle->getDBkey());
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:SRF_Gallery.php

示例9: getParentTitle

 /**
  * Retrieves parent Title object from provided $title
  * If $title is already a top parent page it returns the same title.
  * @param Title $title
  * @return Title Parent Title
  * @throws MWException
  */
 public function getParentTitle(Title $title)
 {
     return Title::newFromText($title->getBaseText(), NS_TEMPLATE);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:11,代码来源:TemplateDraftHelper.class.php

示例10: getUserInfoFromTitle

	/**
	 * @param $title Title
	 * @return array
	 */
	public static function getUserInfoFromTitle( Title $title ) {
		$user = User::newFromName( $title->getBaseText() );
		// check
		if (!($user instanceof User)) {
			return false;
		}
		if ( !self::isValid($user)) {
			return false;
		}

		return $user;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:16,代码来源:OnlineStatusBar.body.php

示例11: PersonalUrls

 /**
  * Hook to cook the personal menu Seizam style.
  * 
  * @param Array $personal_urls
  * @param Title $title
  * @return Boolean True (=continue hook)
  * 
  */
 public static function PersonalUrls(&$personal_urls, &$title)
 {
     // Remove Preferences
     /* if (isset($personal_urls['preferences']))
        unset ($personal_urls['preferences']); */
     // Remove Contributions
     if (isset($personal_urls['mycontris'])) {
         unset($personal_urls['mycontris']);
     }
     $beginning = array();
     if (isset($personal_urls['userpage'])) {
         $beginning['userpage'] = $personal_urls['userpage'];
         unset($personal_urls['userpage']);
     }
     if (isset($personal_urls['mytalk'])) {
         $beginning['mytalk'] = $personal_urls['mytalk'];
         unset($personal_urls['mytalk']);
     }
     if (isset($personal_urls['logout'])) {
         // Add MySeizam
         $href = Title::makeTitle(NS_SPECIAL, SpecialMySeizam::TITLE_NAME)->getCanonicalURL();
         $middle['myseizam'] = array('text' => wfMsg('sz-myseizam'), 'href' => $href, 'active' => $title->getBaseText() == SpecialMySeizam::TITLE_NAME);
         // Add MyWikiPlaces
         $href = Title::makeTitle(NS_SPECIAL, SpecialWikiplaces::TITLE_NAME)->getCanonicalURL();
         $middle['wikiplaces'] = array('text' => wfMsg('wikiplaces'), 'href' => $href, 'active' => $title->getBaseText() == SpecialWikiplaces::TITLE_NAME);
         $personal_urls = array_merge($middle, $personal_urls);
     }
     $personal_urls = array_merge($beginning, $personal_urls);
     if (isset($personal_urls['logout'])) {
         unset($personal_urls['logout']);
     }
     return true;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:41,代码来源:Skinzam.hooks.php


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