本文整理汇总了PHP中SpecialPage类的典型用法代码示例。如果您正苦于以下问题:PHP SpecialPage类的具体用法?PHP SpecialPage怎么用?PHP SpecialPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpecialPage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testRequireLoginNotAnon
public function testRequireLoginNotAnon()
{
$specialPage = new SpecialPage('Watchlist', 'viewmywatchlist');
$user = User::newFromName("UTSysop");
$specialPage->getContext()->setUser($user);
$specialPage->requireLogin();
// no exception thrown, logged in use can access special page
$this->assertTrue(true);
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:9,代码来源:SpecialPageTest.php
示例2: execute
/**
* Main execution point
*
* @param string $subpage
*/
function execute($subpage)
{
// Anons don't get a watchlist
$this->requireLogin('watchlistanontext');
$output = $this->getOutput();
$request = $this->getRequest();
$this->addHelpLink('Help:Watching pages');
$output->addModules(array('mediawiki.special.changeslist.visitedstatus'));
$mode = SpecialEditWatchlist::getMode($request, $subpage);
if ($mode !== false) {
if ($mode === SpecialEditWatchlist::EDIT_RAW) {
$title = SpecialPage::getTitleFor('EditWatchlist', 'raw');
} elseif ($mode === SpecialEditWatchlist::EDIT_CLEAR) {
$title = SpecialPage::getTitleFor('EditWatchlist', 'clear');
} else {
$title = SpecialPage::getTitleFor('EditWatchlist');
}
$output->redirect($title->getLocalURL());
return;
}
$this->checkPermissions();
$user = $this->getUser();
$opts = $this->getOptions();
$config = $this->getConfig();
if (($config->get('EnotifWatchlist') || $config->get('ShowUpdatedMarker')) && $request->getVal('reset') && $request->wasPosted()) {
$user->clearAllNotifications();
$output->redirect($this->getPageTitle()->getFullURL($opts->getChangedValues()));
return;
}
parent::execute($subpage);
}
开发者ID:admonkey,项目名称:mediawiki,代码行数:36,代码来源:SpecialWatchlist.php
示例3: 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, $this->msg('suspicious-userlogout'), $this->msg('loginerror'));
}
$this->setHeaders();
$this->outputHeader();
// Make sure it's possible to log out
$session = MediaWiki\Session\SessionManager::getGlobalSession();
if (!$session->canSetUser()) {
throw new ErrorPageError('cannotlogoutnow-title', 'cannotlogoutnow-text', [$session->getProvider()->describe(RequestContext::getMain()->getLanguage())]);
}
$user = $this->getUser();
$oldName = $user->getName();
$user->logout();
$loginURL = SpecialPage::getTitleFor('Userlogin')->getFullURL($this->getRequest()->getValues('returnto', 'returntoquery'));
$out = $this->getOutput();
$out->addWikiMsg('logouttext', $loginURL);
// Hook.
$injected_html = '';
Hooks::run('UserLogoutComplete', [&$user, &$injected_html, $oldName]);
$out->addHTML($injected_html);
$out->returnToMain();
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:29,代码来源:SpecialUserlogout.php
示例4: getActionLinks
public function getActionLinks() {
if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
|| $this->entry->getSubtype() !== 'move'
|| !$this->context->getUser()->isAllowed( 'move' ) )
{
return '';
}
$params = $this->extractParameters();
$destTitle = Title::newFromText( $params[3] );
if ( !$destTitle ) {
return '';
}
$revert = Linker::linkKnown(
SpecialPage::getTitleFor( 'Movepage' ),
$this->msg( 'revertmove' )->escaped(),
array(),
array(
'wpOldTitle' => $destTitle->getPrefixedDBkey(),
'wpNewTitle' => $this->entry->getTarget()->getPrefixedDBkey(),
'wpReason' => $this->msg( 'revertmove' )->inContentLanguage()->text(),
'wpMovetalk' => 0
)
);
return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:27,代码来源:MoveLogFormatter.php
示例5: formatLogEntry
static function formatLogEntry($type, $action, $title, $sk, $parameters)
{
$msg = "lqt-log-action-{$action}";
switch ($action) {
case 'merge':
if ($parameters[0]) {
$msg = 'lqt-log-action-merge-across';
} else {
$msg = 'lqt-log-action-merge-down';
}
break;
case 'move':
$smt = new SpecialMoveThread();
$rightsCheck = $smt->checkUserRights($parameters[1] instanceof Title ? $parameters[1] : Title::newFromText($parameters[1]), $parameters[0] instanceof Title ? $parameters[0] : Title::newFromText($parameters[0]));
if ($rightsCheck === true) {
$parameters[] = Message::rawParam(Linker::link(SpecialPage::getTitleFor('MoveThread', $title), wfMessage('revertmove')->text(), array(), array('dest' => $parameters[0])));
} else {
$parameters[] = '';
}
break;
default:
// Give grep a chance to find the usages:
// lqt-log-action-move, lqt-log-action-split, lqt-log-action-subjectedit,
// lqt-log-action-resort, lqt-log-action-signatureedit
$msg = "lqt-log-action-{$action}";
break;
}
array_unshift($parameters, $title->getPrefixedText());
$html = wfMessage($msg, $parameters);
if ($sk === null) {
return StringUtils::delimiterReplace('<', '>', '', $html->inContentLanguage()->parse());
}
return $html->parse();
}
开发者ID:Rikuforever,项目名称:wiki,代码行数:34,代码来源:LogFormatter.php
示例6: __construct
/**
* Constructor
*/
public function __construct()
{
global $wgUser;
parent::__construct('ChangeAuthor', 'changeauthor');
$this->selfTitle = SpecialPage::getTitleFor('ChangeAuthor');
$this->skin = $wgUser->getSkin();
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:10,代码来源:ChangeAuthor.body.php
示例7: __construct
/**
* Constructor: initialise object
* Get data POSTed through the form and assign them to the object
*
* @param $request WebRequest: Data posted.
*/
public function __construct( $request = null ) {
global $wgRequest;
SpecialPage::__construct( 'PictureGameAjaxUpload', 'upload', false );
$this->loadRequest( is_null( $request ) ? $wgRequest : $request );
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:13,代码来源:AjaxUploadForm.php
示例8: showForm
function showForm($form, $errmsg = null)
{
global $wgOut, $wgRequest, $wgParser, $wgUser, $wgSpecialFormRecaptcha;
$self = SpecialPage::getTitleFor(wfMsgForContent('form') . '/' . $form->name);
$wgOut->setPageTitle($form->title);
if (!is_null($form->instructions)) {
$wgOut->addHTML(Xml::openElement('div', array('class' => 'instructions')) . $wgOut->parse($form->instructions) . Xml::closeElement('div') . Xml::element('br'));
}
if (!is_null($errmsg)) {
$wgOut->addHTML(Xml::openElement('div', array('class' => 'error')) . $wgOut->parse($errmsg) . Xml::closeElement('div') . Xml::element('br'));
}
$wgOut->addHTML(Xml::openElement('form', array('method' => 'post', 'action' => $self->getLocalURL())));
foreach ($form->fields as $field) {
$wgOut->addHTML($field->render($wgRequest->getText($field->name)) . Xml::element('br') . "\n");
}
# Anonymous user, use recaptcha
if ($wgUser->getId() == 0 && $wgSpecialFormRecaptcha) {
require_once 'recaptchalib.php';
global $recaptcha_public_key;
# same as used by Recaptcha plugin
$wgOut->addHTML(recaptcha_get_html($recaptcha_public_key));
}
$wgOut->addHTML(Xml::element('input', array('type' => 'submit', 'value' => wfMsg('formsave'))));
$wgOut->addHTML(Xml::closeElement('form'));
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:SpecialForm.body.php
示例9: formatResult
/**
* @param Skin $skin
* @param object $result Result row
* @return string
*/
function formatResult($skin, $result)
{
$title = Title::makeTitle(NS_TEMPLATE, $result->title);
$pageLink = Linker::linkKnown($title, null, array(), array('redirect' => 'no'));
$wlhLink = Linker::linkKnown(SpecialPage::getTitleFor('Whatlinkshere', $title->getPrefixedText()), $this->msg('unusedtemplateswlh')->escaped());
return $this->getLanguage()->specialList($pageLink, $wlhLink);
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:12,代码来源:SpecialUnusedtemplates.php
示例10: execute
/**
* Show the special page
*
* @param $params Mixed: parameter(s) passed to the page or null
*/
public function execute($params)
{
$out = $this->getOutput();
$user = $this->getUser();
// Set the page title, robot policies, etc.
$this->setHeaders();
/**
* Redirect anonymous users to the login page
* It will automatically return them to the ViewRelationshipRequests page
*/
if (!$user->isLoggedIn()) {
$out->setPageTitle($this->msg('ur-error-page-title')->plain());
$login = SpecialPage::getTitleFor('Userlogin');
$out->redirect($login->getFullURL('returnto=Special:ViewRelationshipRequests'));
return false;
}
// Add CSS & JS
$out->addModuleStyles('ext.socialprofile.userrelationship.css');
$out->addModules('ext.socialprofile.userrelationship.js');
$rel = new UserRelationship($user->getName());
$friend_request_count = $rel->getOpenRequestCount($user->getID(), 1);
$foe_request_count = $rel->getOpenRequestCount($user->getID(), 2);
if ($this->getRequest()->wasPosted() && $_SESSION['alreadysubmitted'] == false) {
$_SESSION['alreadysubmitted'] = true;
$rel->addRelationshipRequest($this->user_name_to, $this->relationship_type, $_POST['message']);
$output = '<br /><span class="title">' . $this->msg('ur-already-submitted')->plain() . '</span><br /><br />';
$out->addHTML($output);
} else {
$_SESSION['alreadysubmitted'] = false;
$output = '';
$out->setPageTitle($this->msg('ur-requests-title')->plain());
$requests = $rel->getRequestList(0);
if ($requests) {
foreach ($requests as $request) {
$user_from = Title::makeTitle(NS_USER, $request['user_name_from']);
$avatar = new wAvatar($request['user_id_from'], 'l');
$avatar_img = $avatar->getAvatarURL();
if ($request['type'] == 'Foe') {
$msg = $this->msg('ur-requests-message-foe', htmlspecialchars($user_from->getFullURL()), $request['user_name_from'])->text();
} else {
$msg = $this->msg('ur-requests-message-friend', htmlspecialchars($user_from->getFullURL()), $request['user_name_from'])->text();
}
$message = $out->parse(trim($request['message']), false);
$output .= "<div class=\"relationship-action black-text\" id=\"request_action_{$request['id']}\">\n\t\t\t\t\t \t{$avatar_img}" . $msg;
if ($request['message']) {
$output .= '<div class="relationship-message">' . $message . '</div>';
}
$output .= '<div class="cleared"></div>
<div class="relationship-buttons">
<input type="button" class="site-button" value="' . $this->msg('ur-accept')->plain() . '" data-response="1" />
<input type="button" class="site-button" value="' . $this->msg('ur-reject')->plain() . '" data-response="-1" />
</div>
</div>';
}
} else {
$output = $this->msg('ur-no-requests-message')->parse();
}
$out->addHTML($output);
}
}
开发者ID:Reasno,项目名称:SocialProfile,代码行数:65,代码来源:SpecialViewRelationshipRequests.php
示例11: displayEditForm
function displayEditForm()
{
global $wgOut, $wgRequest;
$url = $wgRequest->getVal('_url');
$title = $wgRequest->getVal('_title');
$l = new Link();
$link = $l->getLinkByPageID($wgRequest->getInt('id'));
if (is_array($link)) {
$url = htmlspecialchars($link['url'], ENT_QUOTES);
$description = htmlspecialchars($link['description'], ENT_QUOTES);
} else {
$title = SpecialPage::getTitleFor('LinkSubmit');
$wgOut->redirect($title->getFullURL());
}
$wgOut->setPageTitle(wfMsg('linkfilter-edit-title', $link['title']));
$_SESSION['alreadysubmitted'] = false;
$output = '<div class="lr-left">
<div class="link-home-navigation">
<a href="' . Link::getHomeLinkURL() . '">' . wfMsg('linkfilter-home-button') . '</a>';
if (Link::canAdmin()) {
$output .= ' <a href="' . Link::getLinkAdminURL() . '">' . wfMsg('linkfilter-approve-links') . '</a>';
}
$output .= '<div class="cleared"></div>
</div>
<form name="link" id="linksubmit" method="post" action="">
<div class="link-submit-title">
<label>' . wfMsg('linkfilter-url') . '</label>
</div>
<input tabindex="2" class="lr-input" type="text" name="lf_URL" id="lf_URL" value="' . $url . '"/>
<div class="link-submit-title">
<label>' . wfMsg('linkfilter-description') . '</label>
</div>
<div class="link-characters-left">' . wfMsg('linkfilter-description-max') . ' - ' . wfMsg('linkfilter-description-left', '<span id="desc-remaining">300</span>') . '</div>
<textarea tabindex="3" class="lr-input" rows="4" name="lf_desc" id="lf_desc">' . $description . '</textarea>
<div class="link-submit-title">
<label>' . wfMsg('linkfilter-type') . '</label>
</div>
<select tabindex="4" name="lf_type" id="lf_type">
<option value="">-</option>';
$linkTypes = Link::getLinkTypes();
foreach ($linkTypes as $id => $type) {
$selected = '';
if ($link['type'] == $id) {
$selected = ' selected="selected"';
}
$output .= "<option value=\"{$id}\"{$selected}>{$type}</option>";
}
$output .= '</select>
<div class="link-submit-button">
<input tabindex="5" class="site-button" type="button" id="link-submit-button" value="' . wfMsg('linkfilter-submit-button') . '" />
</div>
</form>
</div>';
$output .= '<div class="lr-right">' . wfMsgExt('linkfilter-instructions', 'parse') . '</div>
<div class="cleared"></div>';
return $output;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:60,代码来源:SpecialLinkEdit.php
示例12: addToolboxLink
/**
* @param $tpl
* @return bool
*/
public static function addToolboxLink( &$tpl ) {
global $wgOut, $wgShortUrlPrefix;
if ( !is_string( $wgShortUrlPrefix ) ) {
$urlPrefix = SpecialPage::getTitleFor( 'ShortUrl' )->getCanonicalUrl() . '/';
} else {
$urlPrefix = $wgShortUrlPrefix;
}
$title = $wgOut->getTitle();
if ( ShortUrlUtils::needsShortUrl( $title ) ) {
$shortId = ShortUrlUtils::encodeTitle( $title );
$shortURL = $urlPrefix . $shortId;
$html = Html::rawElement( 'li', array( 'id' => 't-shorturl' ),
Html::Element( 'a', array(
'href' => $shortURL,
'title' => wfMsg( 'shorturl-toolbox-title' )
),
wfMsg( 'shorturl-toolbox-text' ) )
);
echo $html;
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:29,代码来源:ShortUrl.hooks.php
示例13: doTagRow
function doTagRow($tag, $hitcount)
{
static $doneTags = array();
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('code', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' ';
$editLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), $this->msg('tags-edit')->escaped());
$disp .= $this->msg('parentheses')->rawParams($editLink)->escaped();
$newRow .= Xml::tags('td', null, $disp);
$msg = $this->msg("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' ';
$editDescLink = Linker::link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), $this->msg('tags-edit')->escaped());
$desc .= $this->msg('parentheses')->rawParams($editDescLink)->escaped();
$newRow .= Xml::tags('td', null, $desc);
$hitcount = $this->msg('tags-hitcount')->numParams($hitcount)->escaped();
$hitcount = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcount, array(), array('tagfilter' => $tag));
$newRow .= Xml::tags('td', null, $hitcount);
$doneTags[] = $tag;
return Xml::tags('tr', null, $newRow) . "\n";
}
开发者ID:seedbank,项目名称:old-repo,代码行数:25,代码来源:SpecialTags.php
示例14: logFeedback
public function logFeedback($params, $itemId)
{
$title = SpecialPage::getTitleFor('FeedbackDashboard', $itemId);
$reason = wfMessage('moodbar-log-reason')->params($params['type'], $params['comment'])->text();
$log = new LogPage('moodbar');
$log->addEntry('feedback', $title, $reason);
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:7,代码来源:ApiMoodBar.php
示例15: getRedirectTarget
public function getRedirectTarget()
{
if ($this->getTitle()->getPrefixedText() === 'Redirected') {
return SpecialPage::getTitleFor('Blankpage');
}
return null;
}
开发者ID:felixonmars,项目名称:mediawiki-extensions-MobileFrontend,代码行数:7,代码来源:ApiMobileViewTest.php
示例16: getPageGroups
private function getPageGroups()
{
global $wgSortSpecialPages;
$pages = SpecialPage::getUsablePages();
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 = SpecialPage::getGroup($page);
if (!isset($groups[$group])) {
$groups[$group] = array();
}
$groups[$group][$page->getDescription()] = array($page->getTitle(), $page->isRestricted());
}
}
/** 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:GodelDesign,项目名称:Godel,代码行数:33,代码来源:SpecialSpecialpages.php
示例17: notificator_Render
public static function notificator_Render($parser, $receiver = '', $receiverLabel = '')
{
global $wgScript, $wgTitle;
if (!$receiverLabel) {
$receiverLabel = $receiver;
}
// Check that the database table is in place
if (!Notificator::checkDatabaseTableExists()) {
$output = '<span class="error">' . htmlspecialchars(wfMsg('notificator-db-table-does-not-exist')) . '</span>';
return array($output, 'noparse' => true, 'isHTML' => true);
}
// The rendering is different, depending on whether a valid e-mail address
// has been provided, or not - the differing part of the HTML form is being
// built here
if (Notificator::receiverIsValid($receiver)) {
// Valid e-mail address available, so build a hidden input with that address
// set, and a button
$receiverInputAndSubmitButton = Html::hidden('receiver', $receiver) . Html::element('input', array('type' => 'submit', 'value' => wfMsg('notificator-notify-address-or-name', $receiverLabel)));
} else {
// No (valid) e-mail address available, build a text input and a button
$receiverInputAndSubmitButton = Html::element('input', array('type' => 'text', 'name' => 'receiver', 'value' => wfMsg('notificator-e-mail-address'), 'onfocus' => 'if (this.value == \'' . wfMsg('notificator-e-mail-address') . '\') {this.value=\'\'}')) . Html::element('input', array('type' => 'submit', 'value' => wfMsg('notificator-notify')));
}
// Now we assemble the form, consisting of two hidden inputs for page ID and rev ID,
// as well as the $receiverInputAndSubmitButton built above
$output = Html::rawElement('form', array('action' => SpecialPage::getTitleFor('Notificator')->getLocalURL(), 'method' => 'post', 'enctype' => 'multipart/form-data'), Html::hidden('pageId', $wgTitle->getArticleID()) . Html::hidden('revId', $wgTitle->getLatestRevID()) . $receiverInputAndSubmitButton);
return $parser->insertStripItem($output, $parser->mStripState);
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:27,代码来源:Notificator.body.php
示例18: formatResult
function formatResult($skin, $result)
{
$title = Title::makeTitle(NS_TEMPLATE, $result->title);
$pageLink = $skin->linkKnown($title, null, array(), array('redirect' => 'no'));
$wlhLink = $skin->linkKnown(SpecialPage::getTitleFor('Whatlinkshere'), wfMsgHtml('unusedtemplateswlh'), array(), array('target' => $title->getPrefixedText()));
return wfSpecialList($pageLink, $wlhLink);
}
开发者ID:rocLv,项目名称:conference,代码行数:7,代码来源:SpecialUnusedtemplates.php
示例19: setupMwRdf
function setupMwRdf()
{
global $wgParser, $wgMessageCache, $wgRequest, $wgOut, $wgHooks;
$wgMessageCache->addMessages(array('rdf' => 'Rdf', 'rdf-inpage' => "Embedded In-page Turtle", 'rdf-dcmes' => "Dublin Core Metadata Element Set", 'rdf-cc' => "Creative Commons", 'rdf-image' => "Embedded images", 'rdf-linksfrom' => "Links from the page", 'rdf-links' => "All links", 'rdf-linksto' => "Links to the page", 'rdf-history' => "Historical versions", 'rdf-interwiki' => "Interwiki links", 'rdf-categories' => "Categories", 'rdf-target' => "Target page", 'rdf-modelnames' => "Model(s)", 'rdf-format' => "Output format", 'rdf-output-rdfxml' => "RDFXML", 'rdf-output-turtle' => "Turtle", 'rdf-output-ntriples' => "NTriples", 'rdf-instructions' => "Select the target page and RDF models you're interested in."));
$wgParser->setHook('rdf', 'renderMwRdf');
SpecialPage::addPage(new SpecialPage('Rdf', '', true, 'wfRdfSpecialPage', 'extensions/Rdf/Rdf.php'));
SpecialPage::addPage(new SpecialPage('RdfQuery', '', true, 'wfSpecialRdfQuery', 'extensions/Rdf/Rdf.php'));
# next we set some hooks for saving and clearing RDF data. Each
# hook is called on the same ModelingAgent object as it preserves
# the list of pages we link to in its state
$wgHooks['ArticleSave'][] = array('wfRdfOnArticleSave');
$wgHooks['ArticleSaveComplete'][] = array('wfRdfOnArticleSaveComplete');
$wgHooks['TitleMoveComplete'][] = array('wfRdfOnTitleMoveComplete');
$wgHooks['ArticleDeleteComplete'][] = array('wfRdfOnArticleDeleteComplete');
# Add an RDF metadata link if requested
$action = $wgRequest->getText('action', 'view');
# Note: $wgTitle not yet set; have to get it from the request
$title = $wgRequest->getText('title');
if (!isset($title) || strlen($title) == 0) {
return true;
}
$nt = Title::newFromText($title);
if (!isset($nt) || $nt->getNamespace() == NS_SPECIAL) {
return true;
}
# finally *if* this is a page view we need to add the link
if (!$action == 'view') {
return true;
}
$rdft = Title::makeTitle(NS_SPECIAL, "Rdf");
$target = $nt->getPrefixedDBkey();
$linkdata = array('title' => 'RDF Metadata', 'type' => 'application/rdf+xml', 'href' => $rdft->getLocalURL("target={$target}"));
$wgOut->addMetadataLink($linkdata);
return true;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:35,代码来源:SetupRdf.php
示例20: execute
public function execute()
{
global $wgUser, $wgTranslateWorkflowStates;
if (!$wgTranslateWorkflowStates) {
$this->dieUsage('Message group review not in use', 'disabled');
}
if (!$wgUser->isallowed(self::$right)) {
$this->dieUsage('Permission denied', 'permissiondenied');
}
$requestParams = $this->extractRequestParams();
$group = MessageGroups::getGroup($requestParams['group']);
if (!$group) {
$this->dieUsageMsg(array('missingparam', 'group'));
}
$languages = Language::getLanguageNames(false);
if (!isset($languages[$requestParams['language']])) {
$this->dieUsageMsg(array('missingparam', 'language'));
}
$dbr = wfGetDB(DB_SLAVE);
$groupid = $group->getId();
$currentState = $dbr->selectField('translate_groupreviews', 'tgr_state', array('tgr_group' => $groupid, 'tgr_lang' => $requestParams['language']), __METHOD__);
if ($currentState == $requestParams['state']) {
$this->dieUsage('The requested state is identical to the current state', 'sameworkflowstate');
}
$dbw = wfGetDB(DB_MASTER);
$table = 'translate_groupreviews';
$row = array('tgr_group' => $groupid, 'tgr_lang' => $requestParams['language'], 'tgr_state' => $requestParams['state']);
$index = array('tgr_group', 'tgr_language');
$res = $dbw->replace($table, array($index), $row, __METHOD__);
$logger = new LogPage('translationreview');
$logParams = array($requestParams['language'], $group->getLabel(), $currentState, $requestParams['state']);
$logger->addEntry('group', SpecialPage::getTitleFor('Translate', $groupid), '', $logParams, $wgUser);
$output = array('review' => array('group' => $group->getId(), 'language' => $requestParams['language'], 'state' => $requestParams['state']));
$this->getResult()->addValue(null, $this->getModuleName(), $output);
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:35,代码来源:ApiGroupReview.php
注:本文中的SpecialPage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论