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


PHP Title::getText方法代码示例

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


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

示例1: execute

 public function execute($par)
 {
     $request = $this->getRequest();
     $par = (string) $par;
     // Yes, the use of getVal() and getText() is wanted, see bug T22365
     $this->text = $request->getVal('wpTitle', $par);
     $this->title = Title::newFromText($this->text);
     $this->reason = $request->getText('reason');
     // Checkboxes that default being checked are tricky
     $this->doSubpages = $request->getBool('subpages', !$request->wasPosted());
     $user = $this->getUser();
     if ($this->doBasicChecks() !== true) {
         return;
     }
     $out = $this->getOutput();
     // Real stuff starts here
     if (TranslatablePage::isSourcePage($this->title)) {
         $title = $this->msg('pt-deletepage-full-title', $this->title->getPrefixedText());
         $out->setPagetitle($title);
         $this->code = '';
         $this->page = TranslatablePage::newFromTitle($this->title);
     } else {
         $page = TranslatablePage::isTranslationPage($this->title);
         if ($page) {
             $title = $this->msg('pt-deletepage-lang-title', $this->title->getPrefixedText());
             $out->setPagetitle($title);
             list(, $this->code) = TranslateUtils::figureMessage($this->title->getText());
             $this->page = $page;
         } else {
             throw new ErrorPageError('pt-deletepage-invalid-title', 'pt-deletepage-invalid-text');
         }
     }
     if (!$user->isAllowed('pagetranslation')) {
         throw new PermissionsError('pagetranslation');
     }
     // Is there really no better way to do this?
     $subactionText = $request->getText('subaction');
     switch ($subactionText) {
         case $this->msg('pt-deletepage-action-check')->text():
             $subaction = 'check';
             break;
         case $this->msg('pt-deletepage-action-perform')->text():
             $subaction = 'perform';
             break;
         case $this->msg('pt-deletepage-action-other')->text():
             $subaction = '';
             break;
         default:
             $subaction = '';
     }
     if ($subaction === 'check' && $this->checkToken() && $request->wasPosted()) {
         $this->showConfirmation();
     } elseif ($subaction === 'perform' && $this->checkToken() && $request->wasPosted()) {
         $this->performAction();
     } else {
         $this->showForm();
     }
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:58,代码来源:SpecialPageTranslationDeletePage.php

示例2: makePageLink

 protected function makePageLink(Title $title = null, $parameters = array(), $html = null)
 {
     global $wgContLang, $wgUserrightsInterwikiDelimiter;
     if (!$this->plaintext) {
         $text = $wgContLang->ucfirst($title->getText());
         $parts = explode($wgUserrightsInterwikiDelimiter, $text, 2);
         if (count($parts) === 2) {
             $titleLink = WikiMap::foreignUserLink($parts[1], $parts[0], htmlspecialchars($title->getText()));
             if ($titleLink !== false) {
                 return $titleLink;
             }
         }
     }
     return parent::makePageLink($title, $parameters, $title ? $title->getText() : null);
 }
开发者ID:Acidburn0zzz,项目名称:mediawiki,代码行数:15,代码来源:RightsLogFormatter.php

示例3: getUserName

 /**
  * Get name of the user this page referrs to
  */
 public static function getUserName(Title $title, $namespaces, $fallbackToGlobal = true)
 {
     wfProfileIn(__METHOD__);
     global $wgUser, $wgRequest;
     $userName = null;
     if (in_array($title->getNamespace(), $namespaces)) {
         // get "owner" of this user / user talk / blog page
         $parts = explode('/', $title->getText());
     } else {
         if ($title->getNamespace() == NS_SPECIAL) {
             if ($title->isSpecial('Following') || $title->isSpecial('Contributions')) {
                 $target = $wgRequest->getText('target');
                 if ($target != '') {
                     // /wiki/Special:Contributions?target=FooBar (RT #68323)
                     $parts = array($target);
                 } else {
                     // get user this special page referrs to
                     $parts = explode('/', $wgRequest->getText('title', false));
                     // remove special page name
                     array_shift($parts);
                 }
             }
         }
     }
     if (isset($parts[0]) && $parts[0] != '') {
         //this line was usign urldecode($parts[0]) before, see RT #107278, user profile pages with '+' symbols get 'non-existing' message
         $userName = str_replace('_', ' ', $parts[0]);
     } elseif ($fallbackToGlobal) {
         // fallback value
         $userName = $wgUser->getName();
     }
     wfProfileOut(__METHOD__);
     return $userName;
 }
开发者ID:yusufchang,项目名称:app,代码行数:37,代码来源:UserPagesHeaderController.class.php

示例4: setHeaders

 /**
  * Set headers, titles and other bits
  */
 private function setHeaders()
 {
     global $wgOut;
     $wgOut->setPageTitle(wfMessage('filedelete', $this->title->getText()));
     $wgOut->setRobotPolicy('noindex,nofollow');
     $wgOut->addBacklinkSubtitle($this->title);
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:10,代码来源:FileDeleteForm.php

示例5: getExhibitionItems

 public function getExhibitionItems(Title $title)
 {
     wfProfileIn(__METHOD__);
     if (class_exists('CategoryDataService')) {
         $cacheKey = $this->getExhibitionItemsCacheKey($title->getText());
         $items = $this->wg->memc->get($cacheKey);
         if (!is_array($items)) {
             $exh = CategoryDataService::getMostVisited($title->getDBkey(), null, self::EXHIBITION_ITEMS_LIMIT);
             $ids = array_keys($exh);
             $length = count($ids);
             $items = array();
             for ($i = 0; $i < $length; $i++) {
                 $pageId = $ids[$i];
                 $imgRespnse = $this->app->sendRequest('ImageServing', 'index', array('ids' => array($pageId), 'height' => 150, 'width' => 150, 'count' => 1));
                 $img = $imgRespnse->getVal('result');
                 if (!empty($img[$pageId])) {
                     $img = $img[$pageId][0]['url'];
                 } else {
                     $img = false;
                 }
                 $oTitle = Title::newFromID($pageId);
                 $items[] = ['img' => $img, 'title' => $oTitle->getText(), 'url' => $oTitle->getFullURL()];
             }
             $this->wg->memc->set($cacheKey, $items, self::CACHE_TTL_EXHIBITION);
         }
         wfProfileOut(__METHOD__);
         return $items;
     }
     wfProfileOut(__METHOD__);
     return false;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:31,代码来源:WikiaMobileCategoryModel.class.php

示例6: onSubmit

 public function onSubmit(array $data)
 {
     $cat = false;
     $categoryStr = $data['category'];
     if ($categoryStr) {
         $cat = Title::newFromText($categoryStr, NS_CATEGORY);
     }
     if ($cat && $cat->getNamespace() !== NS_CATEGORY) {
         // Someone searching for something like "Wikipedia:Foo"
         $cat = Title::makeTitleSafe(NS_CATEGORY, $categoryStr);
     }
     if ($cat) {
         $this->setCategory($cat);
     }
     if (!$this->category && $categoryStr) {
         $msg = $this->msg('randomincategory-invalidcategory', wfEscapeWikiText($categoryStr));
         return Status::newFatal($msg);
     } elseif (!$this->category) {
         return false;
         // no data sent
     }
     $title = $this->getRandomTitle();
     if (is_null($title)) {
         $msg = $this->msg('randomincategory-nopages', $this->category->getText());
         return Status::newFatal($msg);
     }
     $this->getOutput()->redirect($title->getFullURL());
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:28,代码来源:SpecialRandomInCategory.php

示例7: placesForCategory

 protected function placesForCategory(Title $oTitle)
 {
     $placesModel = F::build('PlacesModel');
     $categoryName = $oTitle->getText();
     $this->wg->Out->setPageTitle(wfMsg('places-in-category', $categoryName));
     return $placesModel->getFromCategories($categoryName);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:7,代码来源:PlacesSpecialController.class.php

示例8: onSkinSubPageSubtitleAfterTitle

 /**
  * @brief remove User:: from back link
  *
  * @author Tomek Odrobny
  *
  * @param Title $title
  * @param String $ptext
  *
  * @return Boolean
  */
 public static function onSkinSubPageSubtitleAfterTitle($title, &$ptext)
 {
     if (!empty($title) && $title->getNamespace() == NS_USER) {
         $ptext = $title->getText();
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:UserProfilePageHooks.class.php

示例9: fnForumIndexProtector

function fnForumIndexProtector(Title &$title, User &$user, $action, &$result)
{
    if ($user->isLoggedIn()) {
        #this doesnt apply to logged in users, bail, but keep going
        return true;
    }
    if ($action != 'edit' && $action != 'create') {
        #only kill editing actions (what else can anons even do?), bail, but keep going
        return true;
    }
    #this only applies to Forum:Index and Forum_talk:Index
    #check pagename
    if ($title->getText() != 'Index') {
        #wrong pagename, bail, but keep going
        return true;
    }
    $ns = $title->getNamespace();
    #check namespace(s)
    if ($ns == NS_FORUM || $ns == NS_FORUM_TALK) {
        #bingo bango, its a match!
        $result = array('protectedpagetext');
        Wikia::log(__METHOD__, __LINE__, "anon trying to edit forum:index, killing request");
        #bail, and stop the request
        return false;
    }
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:27,代码来源:ForumIndexProtector.php

示例10: setTitlesDefault

 private function setTitlesDefault()
 {
     $ns = $this->title->getNamespace();
     $titles = array();
     if (!MWNamespace::hasSubpages($ns)) {
         $titles[] = $this->title;
     } else {
         $explosion = explode('/', $this->title->getText());
         $text = '';
         foreach ($explosion as $atom) {
             $text .= $atom;
             $titles[] = Title::newFromText($text, $ns);
             $text .= '/';
         }
     }
     $this->titles = $titles;
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:17,代码来源:TitleExplosion.php

示例11: onContentHandlerDefaultModelFor

 /**
  * Convert the content model of messages that are actually JSON to JSON.
  * This only affects validation and UI when saving and editing, not
  * loading the content.
  *
  * @param Title $title
  * @param string $model
  * @return bool
  */
 public static function onContentHandlerDefaultModelFor(Title $title, &$model)
 {
     $messages = array('Visualeditor-cite-tool-definition.json', 'Visualeditor-quick-access-characters.json');
     if ($title->inNamespace(NS_MEDIAWIKI) && in_array($title->getText(), $messages)) {
         $model = CONTENT_MODEL_JSON;
     }
     return true;
 }
开发者ID:brandonphuong,项目名称:mediawiki,代码行数:17,代码来源:VisualEditor.hooks.php

示例12: efLoadLookupUserLink

/**
 * Add a link to Special:LookupUser from Special:Contributions/USERNAME
 * if the user has 'lookupuser' permission
 *
 * @param integer $id
 * @param Title $nt
 *
 * @return bool true
 */
function efLoadLookupUserLink($id, $nt, &$links)
{
    global $wgUser;
    if ($wgUser->isAllowed('lookupuser') && $id !== 0) {
        $links[] = Linker::linkKnown(SpecialPage::getTitleFor('LookupUser'), wfMsgHtml('lookupuser'), array(), array('target' => $nt->getText()));
    }
    return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:LookupUser.php

示例13: wfCOArticleCommentCheck

function wfCOArticleCommentCheck(Title $title)
{
    global $wgCommentsOnlyNamespaces;
    if (in_array($title->getNamespace(), $wgCommentsOnlyNamespaces) && ($title->getText() == 'Index' || $title->equals(Title::newMainPage()))) {
        return false;
    }
    return true;
}
开发者ID:yusufchang,项目名称:app,代码行数:8,代码来源:CommentsOnly.php

示例14: setLanguage

 /**
  * If the page ends in '/<language code>' then set the page's language to that code.
  * @param Title $title page title object
  * @param string|Language $pageLang the page content language (either an object or a language code)
  * @param Language $wgLang the user language
  */
 public static function setLanguage($title, &$pageLang, $wgLang)
 {
     $matches = array();
     if (preg_match('/\\/..$/', $title->getText(), $matches)) {
         $pageLang = substr($matches[0], 1);
     }
     return true;
 }
开发者ID:zoglun,项目名称:mediawiki-extensions-CirrusSearch,代码行数:14,代码来源:Jenkins.php

示例15: ContributionsToolLinks

 /**
  * @static
  * @param $id
  * @param Title $nt
  * @param $links
  * @return bool
  */
 public static function ContributionsToolLinks($id, $nt, &$links)
 {
     global $wgUser;
     if ($id != 0 && $wgUser->isAllowed('lookupcontribs')) {
         $attribs = array('href' => 'http://community.wikia.com/wiki/Special:LookupContribs?target=' . urlencode($nt->getText()), 'title' => wfMsg('right-lookupcontribs'));
         $links[] = Xml::openElement('a', $attribs) . wfMsg('lookupcontribs') . Xml::closeElement('a');
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:SpecialLookupContribs_hooks.php


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