本文整理汇总了PHP中Title::getPrefixedText方法的典型用法代码示例。如果您正苦于以下问题:PHP Title::getPrefixedText方法的具体用法?PHP Title::getPrefixedText怎么用?PHP Title::getPrefixedText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Title
的用法示例。
在下文中一共展示了Title::getPrefixedText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: movePage
protected function movePage(Title $oldPage, Title $newPage)
{
$mp = new MovePage($oldPage, $newPage);
$valid = $mp->isValidMove();
if (!$valid->isOK()) {
wfDebugLog('CentralAuthRename', "Invalid page move: {$oldPage->getPrefixedText()} -> {$newPage->getPrefixedText()}");
return;
}
$msg = wfMessage('centralauth-rename-movelog')->params($this->params['from'], $this->params['to'])->inContentLanguage()->text();
$status = $mp->move($this->user, $msg, !$this->params['suppressredirects']);
if (!$status->isOK()) {
wfDebugLog('CentralAuthRename', "Page move failed: {$oldPage->getPrefixedText()} -> {$newPage->getPrefixedText()}");
}
}
示例2: getFooterMessages
protected function getFooterMessages()
{
$parentUrl = $this->pageTitle->getFullURL('action=unwatch');
$parentTitleText = $this->pageTitle->getPrefixedText();
$footerMessages = [$this->getMessage('emailext-unfollow-text', $parentUrl, $parentTitleText)->parse()];
return array_merge($footerMessages, parent::getFooterMessages());
}
示例3: performAction
protected function performAction()
{
$jobs = array();
$target = $this->title;
$base = $this->title->getPrefixedText();
$translationPages = $this->getTranslationPages();
$user = $this->getUser();
foreach ($translationPages as $old) {
$jobs[$old->getPrefixedText()] = TranslateDeleteJob::newJob($old, $base, !$this->singleLanguage(), $user);
}
$sectionPages = $this->getSectionPages();
foreach ($sectionPages as $old) {
$jobs[$old->getPrefixedText()] = TranslateDeleteJob::newJob($old, $base, !$this->singleLanguage(), $user);
}
if (!$this->doSubpages) {
$subpages = $this->getSubpages();
foreach ($subpages as $old) {
if (TranslatablePage::isTranslationPage($old)) {
continue;
}
$jobs[$old->getPrefixedText()] = TranslateDeleteJob::newJob($old, $base, !$this->singleLanguage(), $user);
}
}
JobQueueGroup::singleton()->push($jobs);
$cache = wfGetCache(CACHE_DB);
$cache->set(wfMemcKey('pt-base', $target->getPrefixedText()), array_keys($jobs), 60 * 60 * 6);
if (!$this->singleLanguage()) {
$this->page->unmarkTranslatablePage();
}
$this->clearMetadata();
MessageGroups::singleton()->recache();
MessageIndexRebuildJob::newJob()->insert();
$this->getOutput()->addWikiMsg('pt-deletepage-started');
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:34,代码来源:SpecialPageTranslationDeletePage.php
示例4: performAction
protected function performAction()
{
$jobs = array();
$target = $this->title;
$base = $this->title->getPrefixedText();
$translationPages = $this->getTranslationPages();
foreach ($translationPages as $old) {
$jobs[$old->getPrefixedText()] = DeleteJob::newJob($old, $base, !$this->singleLanguage(), $this->user);
}
$sectionPages = $this->getSectionPages();
foreach ($sectionPages as $old) {
$jobs[$old->getPrefixedText()] = DeleteJob::newJob($old, $base, !$this->singleLanguage(), $this->user);
}
if (!$this->doSubpages) {
$subpages = $this->getSubpages();
foreach ($subpages as $old) {
if (TranslatablePage::isTranslationPage($old)) {
continue;
}
$jobs[$old->getPrefixedText()] = DeleteJob::newJob($old, $base, !$this->singleLanguage(), $this->user);
}
}
Job::batchInsert($jobs);
$cache = wfGetCache(CACHE_DB);
$cache->set(wfMemcKey('pt-base', $target->getPrefixedText()), array_keys($jobs), 60 * 60 * 6);
if (!$this->singleLanguage()) {
$this->page->removeTags();
}
MessageGroups::clearCache();
MessageIndexRebuildJob::newJob()->insert();
global $wgOut;
$wgOut->addWikiMsg('pt-deletepage-started');
}
示例5: whatlinkshereForm
function whatlinkshereForm()
{
// We get nicer value from the title object
$this->opts->consumeValue('target');
// Reset these for new requests
$this->opts->consumeValues(['back', 'from']);
$target = $this->target ? $this->target->getPrefixedText() : '';
$namespace = $this->opts->consumeValue('namespace');
$nsinvert = $this->opts->consumeValue('invert');
# Build up the form
$f = Xml::openElement('form', ['action' => wfScript()]);
# Values that should not be forgotten
$f .= Html::hidden('title', $this->getPageTitle()->getPrefixedText());
foreach ($this->opts->getUnconsumedValues() as $name => $value) {
$f .= Html::hidden($name, $value);
}
$f .= Xml::fieldset($this->msg('whatlinkshere')->text());
# Target input (.mw-searchInput enables suggestions)
$f .= Xml::inputLabel($this->msg('whatlinkshere-page')->text(), 'target', 'mw-whatlinkshere-target', 40, $target, ['class' => 'mw-searchInput']);
$f .= ' ';
# Namespace selector
$f .= Html::namespaceSelector(['selected' => $namespace, 'all' => '', 'label' => $this->msg('namespace')->text()], ['name' => 'namespace', 'id' => 'namespace', 'class' => 'namespaceselector']);
$f .= ' ' . Xml::checkLabel($this->msg('invert')->text(), 'invert', 'nsinvert', $nsinvert, ['title' => $this->msg('tooltip-whatlinkshere-invert')->text()]);
$f .= ' ';
# Submit
$f .= Xml::submitButton($this->msg('whatlinkshere-submit')->text());
# Close
$f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
return $f;
}
示例6: doUpdate
public function doUpdate()
{
$job = new HTMLCacheUpdateJob($this->mTitle, array('table' => $this->mTable, 'recursive' => true) + Job::newRootJobParams("htmlCacheUpdate:{$this->mTable}:{$this->mTitle->getPrefixedText()}"));
$count = $this->mTitle->getBacklinkCache()->getNumLinks($this->mTable, 100);
if ($count >= 100) {
// many backlinks
JobQueueGroup::singleton()->lazyPush($job);
} else {
// few backlinks ($count might be off even if 0)
$dbw = wfGetDB(DB_MASTER);
$dbw->onTransactionIdle(function () use($job) {
$job->run();
// just do the purge query now
});
}
}
示例7: getInternalLinkAttributesObj
/**
* Get the appropriate HTML attributes to add to the "a" element of an in-
* ternal link, given the Title object for the page we want to link to.
*
* @param Title $nt The Title object
* @param string $unused Unused
* @param string $class The contents of the class attribute, default none
* @param mixed $title Optional (unescaped) string to use in the title
* attribute; if false, default to the name of the page we're linking to
*/
function getInternalLinkAttributesObj($nt, $unused = null, $class = '', $title = false)
{
if ($title === false) {
$title = $nt->getPrefixedText();
}
return $this->getLinkAttributesInternal($title, $class);
}
示例8: siblings
/**
* @param Title $title
* @return array of SisterSiteLink
*/
function siblings( $title ) {
$normal = self::normalize( $title->getPrefixedText() );
$dbr = wfGetDB( DB_SLAVE );
$result = $dbr->select(
array( 'sistersites_page', 'sistersites_site' ),
array(
'ssp_url',
'ssp_title',
'sss_name',
'sss_interwiki',
),
array(
'ssp_normalized_title' => $normal,
'ssp_site=sss_id',
),
__METHOD__ );
$out = array();
while( $row = $dbr->fetchObject( $result ) ) {
$out[] = new SisterSitesLink( $row );
}
$dbr->freeResult( $result );
return $out;
}
示例9: makeWlhLink
/**
* Make a "what links here" link for a given title
*
* @param Title $title Title to make the link for
* @param Skin $skin Skin to use
* @param object $result Result row
* @return string
*/
private function makeWlhLink($title, $skin, $result)
{
global $wgLang;
$wlh = SpecialPage::getTitleFor('Whatlinkshere');
$label = wfMsgExt('nlinks', array('parsemag', 'escape'), $wgLang->formatNum($result->value));
return $skin->link($wlh, $label, array(), array('target' => $title->getPrefixedText()));
}
示例10: whatlinkshereForm
function whatlinkshereForm()
{
global $wgScript;
// We get nicer value from the title object
$this->opts->consumeValue('target');
// Reset these for new requests
$this->opts->consumeValues(array('back', 'from'));
$target = $this->target ? $this->target->getPrefixedText() : '';
$namespace = $this->opts->consumeValue('namespace');
# Build up the form
$f = Xml::openElement('form', array('action' => $wgScript));
# Values that should not be forgotten
$f .= Html::hidden('title', $this->getTitle()->getPrefixedText());
foreach ($this->opts->getUnconsumedValues() as $name => $value) {
$f .= Html::hidden($name, $value);
}
$f .= Xml::fieldset(wfMsg('whatlinkshere'));
# Target input
$f .= Xml::inputLabel(wfMsg('whatlinkshere-page'), 'target', 'mw-whatlinkshere-target', 40, $target);
$f .= ' ';
# Namespace selector
$f .= Xml::label(wfMsg('namespace'), 'namespace') . ' ' . Xml::namespaceSelector($namespace, '');
$f .= ' ';
# Submit
$f .= Xml::submitButton(wfMsg('allpagessubmit'));
# Close
$f .= Xml::closeElement('fieldset') . Xml::closeElement('form') . "\n";
return $f;
}
示例11: watchTitle
private function watchTitle(Title $title, User $user, array $params, $compatibilityMode = false)
{
if (!$title->isWatchable()) {
return array('title' => $title->getPrefixedText(), 'watchable' => 0);
}
$res = array('title' => $title->getPrefixedText());
if ($params['unwatch']) {
$status = UnwatchAction::doUnwatch($title, $user);
$res['unwatched'] = $status->isOK();
if ($status->isOK()) {
$res['message'] = $this->msg('removedwatchtext', $title->getPrefixedText())->title($title)->parseAsBlock();
}
} else {
$status = WatchAction::doWatch($title, $user);
$res['watched'] = $status->isOK();
if ($status->isOK()) {
$res['message'] = $this->msg('addedwatchtext', $title->getPrefixedText())->title($title)->parseAsBlock();
}
}
if (!$status->isOK()) {
if ($compatibilityMode) {
$this->dieStatus($status);
}
$res['error'] = $this->getErrorFromStatus($status);
}
return $res;
}
示例12: getAncestorPages
/**
* Delivers all ancestors of a given subpage.
*
* @param Title $page The page to get the ancestors from.
* @param int $depth Maximum depth back to the most distant ancestor relative from the given
* subpage. If negative, that many elements from the top-level parent will be returend.
* null means no limit.
*
* @return Title[] All ancestor pages of the given subpage in order from the top-level ancestor
* to the direct parent.
*/
static function getAncestorPages( Title $page, $depth = null ) {
$parts = preg_split( "/\//", $page->getPrefixedText(), 2 );
$rootPage = Title::newFromText( $parts[0] );
$pageFamily = SubpageInfo::getSubpages( $rootPage );
$pages = array();
//A page can't be it's own parent AND only a existing page can be a parent:
if( !( $rootPage->equals( $page ) ) && $rootPage->exists() ) {
$pages[] = $rootPage;
}
if( ! empty( $pageFamily ) ) { // order is top-level parent to direct parent
foreach( $pageFamily as &$relativePage ) {
if( SubpageInfo::isAncestorOf( $relativePage, $page ) ) {
$pages[] = $relativePage;
}
}
}
if( $depth !== null ) {
if( $depth <= 0 ) {
$pages = array_slice( $pages, 0, -$depth );
} else {
$pages = array_slice( $pages, -$depth );
}
}
return $pages;
}
示例13: getSupportUrl
/**
* Target URL for a link provided by a support button/aid.
*
* @param $title Title Title object for the translation message.
* @since 2015.09
*/
public static function getSupportUrl(Title $title)
{
global $wgTranslateSupportUrl, $wgTranslateSupportUrlNamespace;
$namespace = $title->getNamespace();
// Fetch the configuration for this namespace if possible, or the default.
if (isset($wgTranslateSupportUrlNamespace[$namespace])) {
$config = $wgTranslateSupportUrlNamespace[$namespace];
} elseif ($wgTranslateSupportUrl) {
$config = $wgTranslateSupportUrl;
} else {
throw new TranslationHelperException("Support page not configured");
}
// Preprocess params
$params = array();
if (isset($config['params'])) {
foreach ($config['params'] as $key => $value) {
$params[$key] = str_replace('%MESSAGE%', $title->getPrefixedText(), $value);
}
}
// Return the URL or make one from the page
if (isset($config['url'])) {
return wfAppendQuery($config['url'], $params);
} elseif (isset($config['page'])) {
$page = Title::newFromText($config['page']);
if (!$page) {
throw new TranslationHelperException("Support page not configured properly");
}
return $page->getFullUrl($params);
} else {
throw new TranslationHelperException("Support page not configured properly");
}
}
示例14: getRollbackToken
/**
* @deprecated since 1.24
* @param int $pageid
* @param Title $title
* @param Revision $rev
* @return bool|string
*/
public static function getRollbackToken($pageid, $title, $rev)
{
global $wgUser;
if (!$wgUser->isAllowed('rollback')) {
return false;
}
return $wgUser->getEditToken(array($title->getPrefixedText(), $rev->getUserText()));
}
示例15: testIrcMsgForLogTypeMove
/**
* @covers LogFormatter::getIRCActionComment
* @covers LogFormatter::getIRCActionText
*/
public function testIrcMsgForLogTypeMove()
{
$move_params = array('4::target' => $this->target->getPrefixedText(), '5::noredir' => 0);
$sep = $this->context->msg('colon-separator')->text();
# move/move
$this->assertIRCComment($this->context->msg('1movedto2', 'SomeTitle', 'TestTarget')->plain() . $sep . $this->user_comment, 'move', 'move', $move_params, $this->user_comment);
# move/move_redir
$this->assertIRCComment($this->context->msg('1movedto2_redir', 'SomeTitle', 'TestTarget')->plain() . $sep . $this->user_comment, 'move', 'move_redir', $move_params, $this->user_comment);
}