本文整理汇总了PHP中SpecialPageFactory类的典型用法代码示例。如果您正苦于以下问题:PHP SpecialPageFactory类的具体用法?PHP SpecialPageFactory怎么用?PHP SpecialPageFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpecialPageFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getPageGroups
private function getPageGroups()
{
global $wgSortSpecialPages;
$pages = SpecialPageFactory::getUsablePages($this->getUser());
if (!count($pages)) {
# Yeah, that was pointless. Thanks for coming.
return false;
}
/** Put them into a sortable array */
$groups = array();
foreach ($pages as $page) {
if ($page->isListed()) {
$group = SpecialPageFactory::getGroup($page);
if (!isset($groups[$group])) {
$groups[$group] = array();
}
$groups[$group][$page->getDescription()] = array($page->getTitle(), $page->isRestricted(), $page->isExpensive());
}
}
/** Sort */
if ($wgSortSpecialPages) {
foreach ($groups as $group => $sortedPages) {
ksort($groups[$group]);
}
}
/** Always move "other" to end */
if (array_key_exists('other', $groups)) {
$other = $groups['other'];
unset($groups['other']);
$groups['other'] = $other;
}
return $groups;
}
开发者ID:laiello,项目名称:media-wiki-law,代码行数:33,代码来源:SpecialSpecialpages.php
示例2: wfCreatePageConfirmEdit
function wfCreatePageConfirmEdit(&$captcha, &$editPage, $newtext, $section, $merged, &$result)
{
global $wgTitle, $wgCreatePageCoverRedLinks;
// Enable only if the configuration global is set to true,
// only for Special:CreatePage and only when ConfirmEdit is installed
$canonspname = array_shift(SpecialPageFactory::resolveAlias($wgTitle->getDBkey()));
if (!$wgCreatePageCoverRedLinks) {
return true;
}
if ($canonspname != 'CreatePage') {
return true;
}
if (!class_exists('SimpleCaptcha')) {
return true;
}
if ($captcha->shouldCheck($editPage, $newtext, $section, $merged)) {
if ($captcha->passCaptcha()) {
$result = true;
return false;
} else {
// display CAP page
$mainform = new CreatePageCreatePlateForm();
$mainform->showForm('', false, array(&$captcha, 'editCallback'));
$editor = new CreatePageMultiEditor($_SESSION['article_createplate']);
$editor->generateForm($newtext);
$result = false;
return false;
}
} else {
return true;
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:32,代码来源:CreateAPage.php
示例3: onSpecialPage_initList
public static function onSpecialPage_initList( &$list ) {
global $wgOpenIDOnly, $wgOpenIDClientOnly;
if ( $wgOpenIDOnly ) {
$list['Userlogin'] = 'SpecialOpenIDLogin';
# as Special:CreateAccount is an alias for Special:UserLogin/signup
# we show our own OpenID page here, too
$list['CreateAccount'] = 'SpecialOpenIDLogin';
}
# Special pages are added at global scope;
# remove server-related ones if client-only flag is set
$addList = array( 'Login', 'Convert', 'Dashboard' );
if ( !$wgOpenIDClientOnly ) {
$addList[] = 'Server';
$addList[] = 'XRDS';
}
foreach ( $addList as $sp ) {
$list['OpenID' . $sp] = 'SpecialOpenID' . $sp;
SpecialPageFactory::setGroup( 'OpenID' . $sp, 'openid' );
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:26,代码来源:OpenID.hooks.php
示例4: buildData
public function buildData()
{
global $wgUser, $wgTitle;
$page = SpecialPageFactory::getPage($this->name);
if (!is_object($page)) {
$this->buildExternalData();
return;
}
$this->available = true;
$this->enabled = $page->userCanExecute($wgUser);
$this->caption = $page->getDescription();
$this->description = $page->getDescription();
$this->href = $page->getTitle()->getLocalUrl();
switch ($this->name) {
case 'RecentChangesLinked':
$this->href .= '/' . $wgTitle->getPartialUrl();
break;
case 'Contributions':
$this->href .= '/' . $wgUser->getTitleKey();
break;
}
$specialPageName = $page->getName();
$options = array();
wfRunHooks("UserCommand::SpecialPage::{$specialPageName}", array($this, &$options));
foreach ($options as $k => $v) {
$this->{$k} = $v;
}
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:28,代码来源:SpecialPageUserCommand.php
示例5: buildData
public function buildData()
{
global $wgUser, $wgTitle;
$page = SpecialPageFactory::getPage($this->name);
if (!is_object($page)) {
$this->buildExternalData();
// BugId:22989 - we don't want the PageLayoutBuilder to be shown if disabled.
if ('LayoutBuilder' == $this->name) {
// do not show PLB if it's not available on the wiki
$this->available = $this->enabled;
}
return;
}
$this->available = true;
$this->enabled = $page->userCanExecute($wgUser);
$this->caption = $page->getDescription();
$this->description = $page->getDescription();
$this->href = $page->getTitle()->getLocalUrl();
switch ($this->name) {
case 'RecentChangesLinked':
$this->href .= '/' . $wgTitle->getPartialUrl();
break;
case 'Contributions':
$this->href .= '/' . $wgUser->getTitleKey();
break;
}
$specialPageName = $page->getName();
$options = array();
wfRunHooks("UserCommand::SpecialPage::{$specialPageName}", array($this, &$options));
foreach ($options as $k => $v) {
$this->{$k} = $v;
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:33,代码来源:SpecialPageUserCommand.php
示例6: testSpecialPage
/**
* @dataProvider provideSpecialPages
*/
public function testSpecialPage($name)
{
$page = SpecialPageFactory::getPage($name);
$title = $page->getPageTitle();
$context = RequestContext::newExtraneousContext($title);
$page->setContext($context);
try {
$page->run(null);
} catch (PermissionsError $e) {
// This is okay
wfDebug('Permissions error caught; expected.');
} catch (ErrorPageError $e) {
// This is okay as well
wfDebug('Page error caught; expected.');
}
$this->assertTrue(true, "Special page {$name} was executed succesfully with anon user");
$user = new MockSuperUser();
$context->setUser($user);
$page->setContext($context);
// This should not throw permission errors
try {
$page->run(null);
} catch (ErrorPageError $e) {
// This is okay here
wfDebug('Page error caught; expected.');
}
$this->assertTrue(true, "Special page {$name} was executed succesfully with super user");
}
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:31,代码来源:SpecialPagesTest.php
示例7: execute
function execute($par)
{
/**
* Some satellite ISPs use broken precaching schemes that log people out straight after
* they're logged in (bug 17790). Luckily, there's a way to detect such requests.
*/
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '&') !== false) {
wfDebug("Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n");
throw new HttpError(400, wfMessage('suspicious-userlogout'), wfMessage('loginerror'));
}
$this->setHeaders();
$this->outputHeader();
$user = $this->getUser();
$oldName = $user->getName();
$user->logout();
$out = $this->getOutput();
$out->addWikiMsg('logouttext');
// Hook.
$injected_html = '';
wfRunHooks('UserLogoutComplete', array(&$user, &$injected_html, $oldName));
$out->addHTML($injected_html);
$mReturnTo = $this->getRequest()->getVal('returnto');
$mReturnToQuery = $this->getRequest()->getVal('returntoquery');
$title = Title::newFromText($mReturnTo);
if (!empty($title)) {
$mResolvedReturnTo = strtolower(array_shift(SpecialPageFactory::resolveAlias($title->getDBKey())));
if (in_array($mResolvedReturnTo, array('userlogout', 'signup', 'connect'))) {
$titleObj = Title::newMainPage();
$mReturnTo = $titleObj->getText();
$mReturnToQuery = '';
}
}
$out->returnToMain(false, $mReturnTo, $mReturnToQuery);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:SpecialUserlogout.php
示例8: getPageGroups
private function getPageGroups()
{
$pages = SpecialPageFactory::getUsablePages($this->getUser());
if (!count($pages)) {
# Yeah, that was pointless. Thanks for coming.
return false;
}
/** Put them into a sortable array */
$groups = [];
/** @var SpecialPage $page */
foreach ($pages as $page) {
if ($page->isListed()) {
$group = $page->getFinalGroupName();
if (!isset($groups[$group])) {
$groups[$group] = [];
}
$groups[$group][$page->getDescription()] = [$page->getPageTitle(), $page->isRestricted(), $page->isCached()];
}
}
/** Sort */
foreach ($groups as $group => $sortedPages) {
ksort($groups[$group]);
}
/** Always move "other" to end */
if (array_key_exists('other', $groups)) {
$other = $groups['other'];
unset($groups['other']);
$groups['other'] = $other;
}
return $groups;
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:31,代码来源:SpecialSpecialpages.php
示例9: show
public function show()
{
$special = SpecialPageFactory::getPage('Revisiondelete');
$special->setContext($this->getContext());
$special->getContext()->setTitle($special->getPageTitle());
$special->run('');
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:7,代码来源:RevisiondeleteAction.php
示例10: __construct
function __construct( $name = 'RandomExcludeBlank' ){
global $wgContentNamespaces;
$this->namespaces = $wgContentNamespaces;
parent::__construct( $name );
SpecialPageFactory::setGroup( 'RandomExcludeBlank','redirects' );
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:8,代码来源:SpecialPureWikiDeletion.php
示例11: formatChangeLine
/**
* @param RecentChange $rc
* @param string[] &$classes
* @param bool $watched
*
* @return string
*/
private function formatChangeLine(RecentChange $rc, array &$classes, $watched)
{
$html = '';
$unpatrolled = $this->showAsUnpatrolled($rc);
if ($rc->mAttribs['rc_log_type']) {
$logtitle = SpecialPage::getTitleFor('Log', $rc->mAttribs['rc_log_type']);
$this->insertLog($html, $logtitle, $rc->mAttribs['rc_log_type']);
$flags = $this->recentChangesFlags(array('unpatrolled' => $unpatrolled, 'bot' => $rc->mAttribs['rc_bot']), '');
if ($flags !== '') {
$html .= ' ' . $flags;
}
// Log entries (old format) or log targets, and special pages
} elseif ($rc->mAttribs['rc_namespace'] == NS_SPECIAL) {
list($name, $htmlubpage) = SpecialPageFactory::resolveAlias($rc->mAttribs['rc_title']);
if ($name == 'Log') {
$this->insertLog($html, $rc->getTitle(), $htmlubpage);
}
// Regular entries
} else {
$this->insertDiffHist($html, $rc, $unpatrolled);
# M, N, b and ! (minor, new, bot and unpatrolled)
$html .= $this->recentChangesFlags(array('newpage' => $rc->mAttribs['rc_type'] == RC_NEW, 'minor' => $rc->mAttribs['rc_minor'], 'unpatrolled' => $unpatrolled, 'bot' => $rc->mAttribs['rc_bot']), '');
$html .= $this->getArticleLink($rc, $unpatrolled, $watched);
}
# Edit/log timestamp
$this->insertTimestamp($html, $rc);
# Bytes added or removed
if ($this->getConfig()->get('RCShowChangedSize')) {
$cd = $this->formatCharacterDifference($rc);
if ($cd !== '') {
$html .= $cd . ' <span class="mw-changeslist-separator">. .</span> ';
}
}
if ($rc->mAttribs['rc_type'] == RC_LOG) {
$html .= $this->insertLogEntry($rc);
} elseif ($this->isCategorizationWithoutRevision($rc)) {
$html .= $this->insertComment($rc);
} else {
# User tool links
$this->insertUserRelatedLinks($html, $rc);
# LTR/RTL direction mark
$html .= $this->getLanguage()->getDirMark();
$html .= $this->insertComment($rc);
}
# Tags
$this->insertTags($html, $rc, $classes);
# Rollback
$this->insertRollback($html, $rc);
# For subclasses
$this->insertExtra($html, $rc, $classes);
# How many users watch this page
if ($rc->numberofWatchingusers > 0) {
$html .= ' ' . $this->numberofWatchingusers($rc->numberofWatchingusers);
}
return $html;
}
开发者ID:Kaph-Noir,项目名称:mediawiki,代码行数:63,代码来源:OldChangesList.php
示例12: addLicencing
/**
* Add the terms of service to the registration form.
* Die if this fails.
* @return Boolean: true
*/
function addLicencing(&$out, &$skin)
{
$context = $out;
$title = $context->getTitle();
$pagename = '';
list($pagename, ) = SpecialPageFactory::resolveAlias($title->getBaseText());
if ($title->isSpecialPage() && $pagename == "Userlogin") {
$query = $context->getRequest()->getQueryValues();
if (!empty($query["type"]) && $query["type"] == "signup") {
// Append the licence iframe and text message
$search_token = '<div class="mw-createacct-benefits-container">';
$replacement = <<<EOT
<div>
<h2>Nutzungsbedingungen</h2>
<ul>
<li>Mit der Anmeldung auf „offene-bibel.de“ inklusive aller Unterbereiche und Subdomains (im Folgenden „Offene Bibel“) schließt du einen Nutzungsvertrag mit dem Betreiber der Offenen Bibel ab (im Folgenden „Betreiber“) und erklärst dich mit den nachfolgenden Regelungen einverstanden.</li>
<li>Wenn du mit diesen Regelungen nicht einverstanden bist, so darfst du die Offene Bibel nicht weiter nutzen. Für die Nutzung der Offenen Bibel gelten jeweils die an dieser Stelle veröffentlichten Regelungen.</li>
<li>Der Nutzungsvertrag wird auf unbestimmte Zeit geschlossen und kann von beiden Seiten ohne Einhaltung einer Frist jederzeit gekündigt werden.</li>
</ul>
<h2>Lizenz der Beiträge</h2>
<ul>
<li>Mit dem Erstellen eines Beitrags (Forenbeitrag, Blogeintrag, Newsbeitrag, Kommentar, Wikieintrag, ...) akzeptierst du, dass du deinen Beitrag damit automatisch unter die <a title="Urheberrecht" href="/wiki/Die_Offene_Bibel:Urheberrecht">CC-by-sa 3.0</a> stellst. Abweichende Lizenzen eingestellter Texte oder Medien, Bilder, Dateien,... müssen vermerkt werden.</li>
<li>Diese Lizenz für deinen Beitrag bleibt unabhängig von der Weiternutzung der Offenen Bibel bestehen.</li>
</ul>
<h2>Pflichten des Nutzers</h2>
<ul>
<li>Du erklärst mit der Erstellung eines Beitrags, dass er keine Inhalte enthält, die gegen geltendes Recht oder die guten Sitten verstoßen. Du erklärst insbesondere, dass du das Recht besitzt, die in deinen Beiträgen verwendeten Links und Bilder zu setzen bzw. zu verwenden.</li>
<li>Du nimmst zur Kenntnis, dass der Betreiber keine Verantwortung für die Inhalte von Beiträgen übernimmt, die er nicht selbst erstellt hat oder die er nicht zur Kenntnis genommen hat. Du gestattest dem Betreiber, dein Benutzerkonto, Beiträge und Funktionen jederzeit zu löschen oder zu sperren.</li>
<li>Du gestattest dem Betreiber darüber hinaus, deine Beiträge abzuändern, sofern sie gegen o. g. Regeln verstoßen oder geeignet sind, dem Betreiber oder einem Dritten Schaden zuzufügen.</li>
<li>Du verpflichtest dich, deine Zugangsdaten (insbesondere Passwörter) geheim zu halten und nicht an Dritte weiterzugeben.</li>
</ul>
<h2>Änderungsvorbehalt</h2>
<ul>
<li>Der Betreiber ist berechtigt, die Nutzungsbedingungen, die Eckpunkte und die Datenschutzrichtlinie zu ändern. Die Änderung wird dem Nutzer per E-Mail mitgeteilt.</li>
<li>Der Nutzer ist berechtigt, den Änderungen zu widersprechen. Im Falle des Widerspruchs erlischt das zwischen dem Betreiber und dem Nutzer bestehende Vertragsverhältnis mit sofortiger Wirkung.</li>
<li>Die Änderungen gelten als anerkannt und verbindlich, wenn der Nutzer den Änderungen zugestimmt hat.</li>
</ul>
<h2>Weitere Regeln</h2>
<ul>
<li>Du verpflichtest dich, keine illegalen, pornografischen, menschenverachtenden und/oder gegen die guten Sitten verstoßenden Beiträge einzustellen. Achte bei deinen Beiträgen auf einen angemessenen Ton, beleidige niemanden.</li>
<li>Die Offene Bibel für Werbezwecke zu nutzen ist untersagt (Ausnahmen sind <i>nach Rücksprache mit dem Betreiber</i> möglich).</li>
<li>Der Betreiber behält sich vor, bei Verstößen gegen diese Regeln oder die <a href="/wiki/Eckpunkte">Eckpunkte</a> Benutzer zeitweise oder ganz zu sperren.</li>
<li>Der Betreiber behält sich das Recht vor, ohne Rücksprache Beiträge zu ändern oder zu löschen, falls sie den Regeln oder <a href="/wiki/Eckpunkte">Eckpunkten</a> widersprechen oder den Portalfrieden gefährden. </li>
</ul>
</div>
<div class="mw-createacct-benefits-container" style="display:none">
EOT;
$replacement_count = 0;
$out->mBodytext = preg_replace("/{$search_token}/", "{$replacement}", $out->mBodytext, -1, $replacement_count);
#if($replacement_count != 1) {
# die("Registration form terms of service logic broken.");
#}
}
}
return true;
}
开发者ID:Offene-Bibel,项目名称:offene-bibel.de,代码行数:61,代码来源:OffeneBibel.php
示例13: show
public function show()
{
$action = self::getName();
if ($action === 'nosuchaction') {
throw new ErrorPageError($this->msg('nosuchaction'), $this->msg('nosuchactiontext'));
}
// map actions to (whitelisted) special pages
$special = SpecialPageFactory::getPage(self::$actionToSpecialPageMapping[$action]);
$special->setContext($this->getContext());
$special->getContext()->setTitle($special->getPageTitle());
$special->run('');
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:12,代码来源:SpecialPageAction.php
示例14: onSkinTemplatePageBeforeUserMsg
/**
* hook handler
* check conditions and display message
*
* @author Maciej Błaszkowski <marooned at wikia-inc.com>
*/
static function onSkinTemplatePageBeforeUserMsg(&$msgs)
{
global $wgUser, $wgMemc, $wgCookiePrefix;
if (self::$messageSeen) {
//user is just seeing the message - hide notification for this session
return true;
}
//get timestamp of message
$communityMessagesTimestamp = $wgMemc->get(wfMemcKey('CommunityMessagesTimestamp'));
if (!$communityMessagesTimestamp) {
$msgTitle = Title::newFromText('community-corner', NS_MEDIAWIKI);
if ($msgTitle) {
$msgRev = Revision::newFromTitle($msgTitle);
if ($msgRev) {
$communityMessagesTimestamp = wfTimestamp(TS_UNIX, $msgRev->getTimestamp());
$wgMemc->set(wfMemcKey('CommunityMessagesTimestamp'), $communityMessagesTimestamp, 86400);
}
}
}
if (!$communityMessagesTimestamp) {
//no message?
return true;
}
if ($communityMessagesTimestamp < time() - 86400) {
//message older than 24h - do not inform user about it
return true;
}
if ($wgUser->isLoggedIn()) {
$userTimestamp = self::getUserTimestamp($wgUser);
if ($userTimestamp !== false && $userTimestamp >= $communityMessagesTimestamp) {
//old, seen message
return true;
}
} else {
//anon
//compare timestamp from cookie
if (isset($_COOKIE[$wgCookiePrefix . 'CommunityMessages']) && $_COOKIE[$wgCookiePrefix . 'CommunityMessages'] >= $communityMessagesTimestamp) {
//old, seen message
return true;
}
}
if ($msgs != '') {
$msgs .= '<br/>';
}
// render message
$msg = '';
if (SpecialPageFactory::exists('WikiActivity')) {
$msg = wfMsgExt('communitymessages-notice-msg', array('parseinline', 'content'));
}
// macbre: add an easy way for Oasis to show it's own notification for community messages
wfRunHooks('CommunityMessages::showMessage', array(&$msg));
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:59,代码来源:CommunityMessages.class.php
示例15: printAltFormsList
function printAltFormsList($alt_forms, $target_name)
{
$text = "";
$fe = SpecialPageFactory::getPage('FormEdit');
$fe_url = $fe->getTitle()->getFullURL();
$i = 0;
foreach ($alt_forms as $alt_form) {
if ($i++ > 0) {
$text .= ', ';
}
$text .= "<a href=\"{$fe_url}/{$alt_form}/{$target_name}\">" . str_replace('_', ' ', $alt_form) . '</a>';
}
return $text;
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:14,代码来源:SF_FormEdit.php
示例16: execute
function execute($par)
{
global $wgUser;
/* wikia change */
/**
* Some satellite ISPs use broken precaching schemes that log people out straight after
* they're logged in (bug 17790). Luckily, there's a way to detect such requests.
*/
if (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], '&') !== false) {
wfDebug("Special:Userlogout request {$_SERVER['REQUEST_URI']} looks suspicious, denying.\n");
throw new HttpError(400, wfMessage('suspicious-userlogout'), wfMessage('loginerror'));
}
$this->setHeaders();
$this->outputHeader();
$user = $this->getUser();
$oldName = $user->getName();
$user->logout();
/*
* Special pages use the new-style context-based user object. However, much of the rest of the world
* (e.g. Global Nav) uses the old-style global wgUser object. As such, when we log out we need to
* ensure that both copies of the user object are properly addressed, or else parts of the page will still
* believe they have an authenticated user object.
*
* Once the old-style global wgUser object is fully deprecated, this line can be removed.
*/
$wgUser->logout();
/* wikia change */
// Wikia change
// regenerate session ID on user logout to avoid race conditions with
// long running requests logging the user back in (@see PLATFORM-1028)
wfResetSessionID();
$out = $this->getOutput();
$out->addWikiMsg('logouttext');
// Hook.
$injected_html = '';
wfRunHooks('UserLogoutComplete', array(&$user, &$injected_html, $oldName));
$out->addHTML($injected_html);
$mReturnTo = $this->getRequest()->getVal('returnto');
$mReturnToQuery = $this->getRequest()->getVal('returntoquery');
$title = Title::newFromText($mReturnTo);
if (!empty($title)) {
$mResolvedReturnTo = strtolower(array_shift(SpecialPageFactory::resolveAlias($title->getDBKey())));
if (in_array($mResolvedReturnTo, array('userlogout', 'signup', 'connect'))) {
$titleObj = Title::newMainPage();
$mReturnTo = $titleObj->getText();
$mReturnToQuery = '';
}
}
$out->returnToMain(false, $mReturnTo, $mReturnToQuery);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:50,代码来源:SpecialUserlogout.php
示例17: efDspHook
function efDspHook(&$list)
{
global $wgDisabledSpecialPages;
foreach ($wgDisabledSpecialPages as $page) {
$title = efDspMakeTitle($page);
if (!$title) {
continue;
}
$canonicalName = array_shift(SpecialPageFactory::resolveAlias($title->getDBkey()));
if (!efDspWhitelisted($canonicalName) && isset($list[$canonicalName])) {
unset($list[$canonicalName]);
}
}
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:15,代码来源:DisableSpecialPages.php
示例18: printAltFormsList
function printAltFormsList($alt_forms, $target_name)
{
$text = "";
$fe = SpecialPageFactory::getPage('FormEdit');
$fe_url = $fe->getTitle()->getFullURL();
$i = 0;
foreach ($alt_forms as $alt_form) {
if ($i++ > 0) {
$text .= ', ';
}
$altFormURL = $fe_url . '/' . rawurlencode($alt_form) . '/' . rawurlencode($target_name);
$text .= Html::element('a', array('href' => $altFormURL), str_replace('_', ' ', $alt_form));
}
return $text;
}
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:15,代码来源:SF_FormEdit.php
示例19: testSubPageRedirect
public function testSubPageRedirect()
{
$ctx = new RequestContext();
SpecialPageFactory::executePath(Title::newFromText('Special:Search/foo_bar'), $ctx);
$url = $ctx->getOutput()->getRedirect();
// some older versions of hhvm have a bug that doesn't parse relative
// urls with a port, so help it out a little bit.
// https://github.com/facebook/hhvm/issues/7136
$url = wfExpandUrl($url, PROTO_CURRENT);
$parts = parse_url($url);
$this->assertEquals('/w/index.php', $parts['path']);
parse_str($parts['query'], $query);
$this->assertEquals('Special:Search', $query['title']);
$this->assertEquals('foo bar', $query['search']);
}
开发者ID:paladox,项目名称:mediawiki,代码行数:15,代码来源:SpecialSearchTest.php
示例20: parseItem
/**
* Parse one line from MediaWiki message to array with indexes 'text' and 'href'
*
* @return array
* @author Inez Korczynski <[email protected]>
*/
public static function parseItem($line)
{
$href = $specialCanonicalName = false;
$line_temp = explode('|', trim($line, '* '), 3);
$line_temp[0] = trim($line_temp[0], '[]');
if (count($line_temp) >= 2 && $line_temp[1] != '') {
$line = trim($line_temp[1]);
$link = trim(wfMsgForContent($line_temp[0]));
} else {
$line = trim($line_temp[0]);
$link = trim($line_temp[0]);
}
$descText = null;
if (count($line_temp) > 2 && $line_temp[2] != '') {
$desc = $line_temp[2];
if (wfEmptyMsg($desc, $descText = wfMsg($desc))) {
$descText = $desc;
}
}
if (wfEmptyMsg($line, $text = wfMsg($line))) {
$text = $line;
}
if ($link != null) {
if (wfEmptyMsg($line_temp[0], $link)) {
$link = $line_temp[0];
}
if (preg_match('/^(?:' . wfUrlProtocols() . ')/', $link)) {
$href = $link;
} else {
$title = Title::newFromText($link);
if ($title) {
if ($title->getNamespace() == NS_SPECIAL) {
$dbkey = $title->getDBkey();
$specialCanonicalName = SpecialPageFactory::resolveAlias($dbkey);
if (!$specialCanonicalName) {
$specialCanonicalName = $dbkey;
}
}
$title = $title->fixSpecialName();
$href = $title->getLocalURL();
} else {
$href = '#';
}
}
}
return array('text' => $text, 'href' => $href, 'org' => $line_temp[0], 'desc' => $descText, 'specialCanonicalName' => $specialCanonicalName);
}
开发者ID:Southparkfan,项目名称:monaco-port,代码行数:53,代码来源:MonacoSidebar.class.php
注:本文中的SpecialPageFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论