本文整理汇总了PHP中ChangeTags类的典型用法代码示例。如果您正苦于以下问题:PHP ChangeTags类的具体用法?PHP ChangeTags怎么用?PHP ChangeTags使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChangeTags类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: doTagRow
function doTagRow($tag, $hitcount)
{
$user = $this->getUser();
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('code', null, $tag));
$disp = ChangeTags::tagDescription($tag);
if ($user->isAllowed('editinterface')) {
$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();
if ($user->isAllowed('editinterface')) {
$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);
$active = isset($this->definedTags[$tag]) ? 'tags-active-yes' : 'tags-active-no';
$active = $this->msg($active)->escaped();
$newRow .= Xml::tags('td', null, $active);
$hitcountLabel = $this->msg('tags-hitcount')->numParams($hitcount)->escaped();
$hitcountLink = Linker::link(SpecialPage::getTitleFor('Recentchanges'), $hitcountLabel, array(), array('tagfilter' => $tag));
// add raw $hitcount for sorting, because tags-hitcount contains numbers and letters
$newRow .= Xml::tags('td', array('data-sort-value' => $hitcount), $hitcountLink);
return Xml::tags('tr', null, $newRow) . "\n";
}
开发者ID:biribogos,项目名称:wikihow-src,代码行数:29,代码来源:SpecialTags.php
示例2: 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
示例3: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
$sk = $this->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
global $wgLang;
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$msg = wfMessage("tag-{$tag}-description");
$desc = !$msg->exists() ? '' : $msg->parse();
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsgHtml('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsgExt('tags-hitcount', array('parsemag'), $wgLang->formatNum($hitcount));
$hitcount = $sk->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:eFFemeer,项目名称:seizamcore,代码行数:25,代码来源:SpecialTags.php
示例4: doTagRow
function doTagRow($tag, $hitcount)
{
static $sk = null, $doneTags = array();
if (!$sk) {
global $wgUser;
$sk = $wgUser->getSkin();
}
if (in_array($tag, $doneTags)) {
return '';
}
$newRow = '';
$newRow .= Xml::tags('td', null, Xml::element('tt', null, $tag));
$disp = ChangeTags::tagDescription($tag);
$disp .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $disp);
$desc = wfMsgExt("tag-{$tag}-description", 'parseinline');
$desc = wfEmptyMsg("tag-{$tag}-description", $desc) ? '' : $desc;
$desc .= ' (' . $sk->link(Title::makeTitle(NS_MEDIAWIKI, "Tag-{$tag}-description"), wfMsg('tags-edit')) . ')';
$newRow .= Xml::tags('td', null, $desc);
$hitcount = wfMsg('tags-hitcount', $hitcount);
$hitcount = $sk->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:ruizrube,项目名称:spdef,代码行数:25,代码来源:SpecialTags.php
示例5: doQuery
/**
* @param IDatabase $db
* @return mixed
*/
public function doQuery($db)
{
$ids = array_map('intval', $this->ids);
$queryInfo = ['tables' => ['revision', 'user'], 'fields' => array_merge(Revision::selectFields(), Revision::selectUserFields()), 'conds' => ['rev_page' => $this->title->getArticleID(), 'rev_id' => $ids], 'options' => ['ORDER BY' => 'rev_id DESC'], 'join_conds' => ['page' => Revision::pageJoinCond(), 'user' => Revision::userJoinCond()]];
ChangeTags::modifyDisplayQuery($queryInfo['tables'], $queryInfo['fields'], $queryInfo['conds'], $queryInfo['join_conds'], $queryInfo['options'], '');
$live = $db->select($queryInfo['tables'], $queryInfo['fields'], $queryInfo['conds'], __METHOD__, $queryInfo['options'], $queryInfo['join_conds']);
if ($live->numRows() >= count($ids)) {
// All requested revisions are live, keeps things simple!
return $live;
}
$archiveQueryInfo = ['tables' => ['archive'], 'fields' => Revision::selectArchiveFields(), 'conds' => ['ar_rev_id' => $ids], 'options' => ['ORDER BY' => 'ar_rev_id DESC'], 'join_conds' => []];
ChangeTags::modifyDisplayQuery($archiveQueryInfo['tables'], $archiveQueryInfo['fields'], $archiveQueryInfo['conds'], $archiveQueryInfo['join_conds'], $archiveQueryInfo['options'], '');
// Check if any requested revisions are available fully deleted.
$archived = $db->select($archiveQueryInfo['tables'], $archiveQueryInfo['fields'], $archiveQueryInfo['conds'], __METHOD__, $archiveQueryInfo['options'], $archiveQueryInfo['join_conds']);
if ($archived->numRows() == 0) {
return $live;
} elseif ($live->numRows() == 0) {
return $archived;
} else {
// Combine the two! Whee
$rows = [];
foreach ($live as $row) {
$rows[$row->rev_id] = $row;
}
foreach ($archived as $row) {
$rows[$row->ar_rev_id] = $row;
}
krsort($rows);
return new FakeResultWrapper(array_values($rows));
}
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:35,代码来源:RevDelRevisionList.php
示例6: displayRevisions
/**
* Display a list with the passed revisions.
*
* @since 0.1
*
* @param EPPageObject $object
*/
protected function displayRevisions(EPPageObject $object)
{
$conditions = array('type' => get_class($object));
if ($object->hasIdField()) {
$conditions['object_id'] = $object->getId();
}
$action = htmlspecialchars($GLOBALS['wgScript']);
$request = $this->getRequest();
$out = $this->getOutput();
/**
* Add date selector to quickly get to a certain time
*/
$year = $request->getInt('year');
$month = $request->getInt('month');
$tagFilter = $request->getVal('tagfilter');
$tagSelector = ChangeTags::buildTagFilterSelector($tagFilter);
/**
* Option to show only revisions that have been (partially) hidden via RevisionDelete
*/
if ($request->getBool('deleted')) {
$conditions['deleted'] = true;
}
$checkDeleted = Xml::checkLabel($this->msg('history-show-deleted')->text(), 'deleted', 'mw-show-deleted-only', $request->getBool('deleted')) . "\n";
$out->addHTML("<form action=\"{$action}\" method=\"get\" id=\"mw-history-searchform\">" . Xml::fieldset($this->msg('history-fieldset-title')->text(), false, array('id' => 'mw-history-search')) . Html::hidden('title', $this->getTitle()->getPrefixedDBKey()) . "\n" . Html::hidden('action', 'history') . "\n" . Xml::dateMenu($year, $month) . ' ' . ($tagSelector ? implode(' ', $tagSelector) . ' ' : '') . $checkDeleted . Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n" . '</fieldset></form>');
$pager = new EPRevisionPager($this->getContext(), $conditions);
if ($pager->getNumRows()) {
$out->addHTML($pager->getNavigationBar() . $pager->getBody() . $pager->getNavigationBar());
} else {
// TODO
}
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:38,代码来源:EPHistoryAction.php
示例7: getDiv
function getDiv($value)
{
$this->tagFilter = ChangeTags::buildTagFilterSelector($value);
if ($this->tagFilter) {
return parent::getDiv($value);
}
return '';
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:8,代码来源:HTMLTagFilter.php
示例8: tagProxyChange
function tagProxyChange($recentChange)
{
global $wgTagProxyActions, $wgUser;
if ($wgTagProxyActions && self::isProxy(wfGetIP()) && !$wgUser->isAllowed('notagproxychanges')) {
ChangeTags::addTags('proxy', $recentChange->mAttribs['rc_id'], $recentChange->mAttribs['rc_this_oldid'], $recentChange->mAttribs['rc_logid']);
}
return true;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:8,代码来源:AutoProxyBlock.body.php
示例9: execute
public function execute()
{
global $wgVisualEditorNamespaces, $wgVisualEditorUseChangeTagging;
$user = $this->getUser();
$params = $this->extractRequestParams();
$page = Title::newFromText($params['page']);
if (!$page) {
$this->dieUsageMsg('invalidtitle', $params['page']);
}
if (!in_array($page->getNamespace(), $wgVisualEditorNamespaces)) {
$this->dieUsage("VisualEditor is not enabled in namespace " . $page->getNamespace(), 'novenamespace');
}
$parserParams = array();
if (isset($params['oldwt'])) {
$parserParams['oldwt'] = $params['oldwt'];
} else {
if (isset($params['oldid'])) {
$parserParams['oldid'] = $params['oldid'];
}
}
if ($params['cachekey'] !== null) {
$wikitext = $this->trySerializationCache($params['cachekey']);
if (!is_string($wikitext)) {
$this->dieUsage('No cached serialization found with that key', 'badcachekey');
}
} else {
$wikitext = $this->postHTML($page, $params['html'], $parserParams);
if ($wikitext === false) {
$this->dieUsage('Error contacting the Parsoid server', 'parsoidserver');
}
}
$saveresult = $this->saveWikitext($page, $wikitext, $params);
$editStatus = $saveresult['edit']['result'];
// Error
if ($editStatus !== 'Success') {
$result = array('result' => 'error', 'edit' => $saveresult['edit']);
// Success
} else {
if (isset($saveresult['edit']['newrevid']) && $wgVisualEditorUseChangeTagging) {
ChangeTags::addTags('visualeditor', null, intval($saveresult['edit']['newrevid']), null);
if ($params['needcheck']) {
ChangeTags::addTags('visualeditor-needcheck', null, intval($saveresult['edit']['newrevid']), null);
}
}
// Return result of parseWikitext instead of saveWikitext so that the
// frontend can update the page rendering without a refresh.
$result = $this->parseWikitext($page, $params['useskin']);
if ($result === false) {
$this->dieUsage('Error contacting the Parsoid server', 'parsoidserver');
}
$result['isRedirect'] = $page->isRedirect();
if (isset($saveresult['edit']['newrevid'])) {
$result['newrevid'] = intval($saveresult['edit']['newrevid']);
}
$result['result'] = 'success';
}
$this->getResult()->addValue(null, $this->getModuleName(), $result);
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:58,代码来源:ApiVisualEditorEdit.php
示例10: onArticleSaveComplete
/**
* @desc Mark all edits made via mobile skin with a mobileedit tag
*
* @param $article
* @param $user
* @param $text
* @param $summary
* @param $minoredit
* @param $watchthis
* @param $sectionanchor
* @param $flags
* @param $revision Revision
* @param $status
* @param $baseRevId
*/
public static function onArticleSaveComplete(&$article, &$user, $text, $summary, $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{
$app = F::app();
//Add Mobile Edit tag when an article was saved via mobile skin
if ($app->checkSkin('wikiamobile') && !is_null($revision)) {
ChangeTags::addTags('mobileedit', null, $revision->getId(), null);
}
return true;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:24,代码来源:WikiaMobileEditorController.class.php
示例11: doQuery
/**
* @param IDatabase $db
* @return mixed
*/
public function doQuery($db)
{
$timestamps = [];
foreach ($this->ids as $id) {
$timestamps[] = $db->timestamp($id);
}
$tables = ['archive'];
$fields = Revision::selectArchiveFields();
$conds = ['ar_namespace' => $this->title->getNamespace(), 'ar_title' => $this->title->getDBkey(), 'ar_timestamp' => $timestamps];
$join_conds = [];
$options = ['ORDER BY' => 'ar_timestamp DESC'];
ChangeTags::modifyDisplayQuery($tables, $fields, $conds, $join_conds, $options, '');
return $db->select($tables, $fields, $conds, __METHOD__, $options, $join_conds);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:18,代码来源:RevDelArchiveList.php
示例12: updateChangeTagsOnAll
/**
* Add/remove change tags from all the revisions in the list.
*
* @param array $tagsToAdd
* @param array $tagsToRemove
* @param array $params
* @param string $reason
* @param User $user
* @return Status
*/
public function updateChangeTagsOnAll($tagsToAdd, $tagsToRemove, $params, $reason, $user)
{
// @codingStandardsIgnoreStart Generic.CodeAnalysis.ForLoopWithTestFunctionCall.NotAllowed
for ($this->reset(); $this->current(); $this->next()) {
// @codingStandardsIgnoreEnd
$item = $this->current();
$status = ChangeTags::updateTagsWithChecks($tagsToAdd, $tagsToRemove, null, $item->getId(), null, $params, $reason, $user);
// Should only fail on second and subsequent times if the user trips
// the rate limiter
if (!$status->isOK()) {
break;
}
}
return $status;
}
开发者ID:mb720,项目名称:mediawiki,代码行数:25,代码来源:ChangeTagsRevisionList.php
示例13: execute
public function execute()
{
$this->useTransactionalTimeLimit();
$params = $this->extractRequestParams();
$user = $this->getUser();
if (!$user->isAllowed('undelete')) {
$this->dieUsageMsg('permdenied-undelete');
}
if ($user->isBlocked()) {
$this->dieBlocked($user->getBlock());
}
$titleObj = Title::newFromText($params['title']);
if (!$titleObj || $titleObj->isExternal()) {
$this->dieUsageMsg(['invalidtitle', $params['title']]);
}
// Check if user can add tags
if (!is_null($params['tags'])) {
$ableToTag = ChangeTags::canAddTagsAccompanyingChange($params['tags'], $user);
if (!$ableToTag->isOK()) {
$this->dieStatus($ableToTag);
}
}
// Convert timestamps
if (!isset($params['timestamps'])) {
$params['timestamps'] = [];
}
if (!is_array($params['timestamps'])) {
$params['timestamps'] = [$params['timestamps']];
}
foreach ($params['timestamps'] as $i => $ts) {
$params['timestamps'][$i] = wfTimestamp(TS_MW, $ts);
}
$pa = new PageArchive($titleObj, $this->getConfig());
$retval = $pa->undelete(isset($params['timestamps']) ? $params['timestamps'] : [], $params['reason'], $params['fileids'], false, $user, $params['tags']);
if (!is_array($retval)) {
$this->dieUsageMsg('cannotundelete');
}
if ($retval[1]) {
Hooks::run('FileUndeleteComplete', [$titleObj, $params['fileids'], $this->getUser(), $params['reason']]);
}
$this->setWatch($params['watchlist'], $titleObj);
$info['title'] = $titleObj->getPrefixedText();
$info['revisions'] = intval($retval[0]);
$info['fileversions'] = intval($retval[1]);
$info['reason'] = $retval[2];
$this->getResult()->addValue(null, $this->getModuleName(), $info);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:47,代码来源:ApiUndelete.php
示例14: execute
/**
* Extracts the title and reason from the request parameters and invokes
* the local delete() function with these as arguments. It does not make use of
* the delete function specified by Article.php. If the deletion succeeds, the
* details of the article deleted and the reason for deletion are added to the
* result object.
*/
public function execute()
{
$this->useTransactionalTimeLimit();
$params = $this->extractRequestParams();
$pageObj = $this->getTitleOrPageId($params, 'fromdbmaster');
if (!$pageObj->exists()) {
$this->dieUsageMsg('notanarticle');
}
$titleObj = $pageObj->getTitle();
$reason = $params['reason'];
$user = $this->getUser();
// Check that the user is allowed to carry out the deletion
$errors = $titleObj->getUserPermissionsErrors('delete', $user);
if (count($errors)) {
$this->dieUsageMsg($errors[0]);
}
// If change tagging was requested, check that the user is allowed to tag,
// and the tags are valid
if (count($params['tags'])) {
$tagStatus = ChangeTags::canAddTagsAccompanyingChange($params['tags'], $user);
if (!$tagStatus->isOK()) {
$this->dieStatus($tagStatus);
}
}
if ($titleObj->getNamespace() == NS_FILE) {
$status = self::deleteFile($pageObj, $user, $params['oldimage'], $reason, false, $params['tags']);
} else {
$status = self::delete($pageObj, $user, $reason, $params['tags']);
}
if (is_array($status)) {
$this->dieUsageMsg($status[0]);
}
if (!$status->isGood()) {
$this->dieStatus($status);
}
// Deprecated parameters
if ($params['watch']) {
$watch = 'watch';
} elseif ($params['unwatch']) {
$watch = 'unwatch';
} else {
$watch = $params['watchlist'];
}
$this->setWatch($watch, $titleObj, 'watchdeletion');
$r = ['title' => $titleObj->getPrefixedText(), 'reason' => $reason, 'logid' => $status->value];
$this->getResult()->addValue(null, $this->getModuleName(), $r);
}
开发者ID:paladox,项目名称:mediawiki,代码行数:54,代码来源:ApiDelete.php
示例15: getQueryInfo
function getQueryInfo()
{
$conds = [];
$conds['rc_new'] = 1;
$namespace = $this->opts->getValue('namespace');
$namespace = $namespace === 'all' ? false : intval($namespace);
$username = $this->opts->getValue('username');
$user = Title::makeTitleSafe(NS_USER, $username);
$rcIndexes = [];
if ($namespace !== false) {
if ($this->opts->getValue('invert')) {
$conds[] = 'rc_namespace != ' . $this->mDb->addQuotes($namespace);
} else {
$conds['rc_namespace'] = $namespace;
}
}
if ($user) {
$conds['rc_user_text'] = $user->getText();
$rcIndexes = 'rc_user_text';
} elseif (User::groupHasPermission('*', 'createpage') && $this->opts->getValue('hideliu')) {
# If anons cannot make new pages, don't "exclude logged in users"!
$conds['rc_user'] = 0;
}
# If this user cannot see patrolled edits or they are off, don't do dumb queries!
if ($this->opts->getValue('hidepatrolled') && $this->getUser()->useNPPatrol()) {
$conds['rc_patrolled'] = 0;
}
if ($this->opts->getValue('hidebots')) {
$conds['rc_bot'] = 0;
}
if ($this->opts->getValue('hideredirs')) {
$conds['page_is_redirect'] = 0;
}
// Allow changes to the New Pages query
$tables = ['recentchanges', 'page'];
$fields = ['rc_namespace', 'rc_title', 'rc_cur_id', 'rc_user', 'rc_user_text', 'rc_comment', 'rc_timestamp', 'rc_patrolled', 'rc_id', 'rc_deleted', 'length' => 'page_len', 'rev_id' => 'page_latest', 'rc_this_oldid', 'page_namespace', 'page_title'];
$join_conds = ['page' => ['INNER JOIN', 'page_id=rc_cur_id']];
Hooks::run('SpecialNewpagesConditions', [&$this, $this->opts, &$conds, &$tables, &$fields, &$join_conds]);
$options = [];
if ($rcIndexes) {
$options = ['USE INDEX' => ['recentchanges' => $rcIndexes]];
}
$info = ['tables' => $tables, 'fields' => $fields, 'conds' => $conds, 'options' => $options, 'join_conds' => $join_conds];
// Modify query for tags
ChangeTags::modifyDisplayQuery($info['tables'], $info['fields'], $info['conds'], $info['join_conds'], $info['options'], $this->opts['tagfilter']);
return $info;
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:47,代码来源:NewPagesPager.php
示例16: addTags
protected function addTags($items, $dry)
{
$count = count($items);
if (!$count) {
$this->output("No revisions to tag\n");
return;
}
if ($dry) {
$this->output("{$count} revisions would be tagged\n");
return;
}
$this->output("{$count} rows are tagged\n");
foreach ($items as $item) {
list($row, $revId) = $item;
ChangeTags::addTags('contenttranslation', null, $revId, null, FormatJson::encode(array('from' => $row->translation_source_language, 'to' => $row->translation_target_language)));
}
}
开发者ID:Rjaylyn,项目名称:mediawiki-extensions-ContentTranslation,代码行数:17,代码来源:fix-stats.php
示例17: getHTML
/**
* @return string A HTML <li> element representing this revision, showing
* change tags and everything
*/
public function getHTML()
{
$difflink = $this->list->msg('parentheses')->rawParams($this->getDiffLink())->escaped();
$revlink = $this->getRevisionLink();
$userlink = Linker::revUserLink($this->revision);
$comment = Linker::revComment($this->revision);
if ($this->isDeleted()) {
$revlink = "<span class=\"history-deleted\">{$revlink}</span>";
}
$content = "{$difflink} {$revlink} {$userlink} {$comment}";
$attribs = array();
$tags = $this->getTags();
if ($tags) {
list($tagSummary, $classes) = ChangeTags::formatSummaryRow($tags, 'edittags');
$content .= " {$tagSummary}";
$attribs['class'] = implode(' ', $classes);
}
return Xml::tags('li', $attribs, $content);
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:23,代码来源:ChangeTagsRevisionItem.php
示例18: execute
public function execute()
{
$this->useTransactionalTimeLimit();
$user = $this->getUser();
$params = $this->extractRequestParams();
$titleObj = $this->getRbTitle($params);
$pageObj = WikiPage::factory($titleObj);
$summary = $params['summary'];
$details = [];
// If change tagging was requested, check that the user is allowed to tag,
// and the tags are valid
if (count($params['tags'])) {
$tagStatus = ChangeTags::canAddTagsAccompanyingChange($params['tags'], $user);
if (!$tagStatus->isOK()) {
$this->dieStatus($tagStatus);
}
}
$retval = $pageObj->doRollback($this->getRbUser($params), $summary, $params['token'], $params['markbot'], $details, $user, $params['tags']);
// We don't care about multiple errors, just report one of them
if ($retval) {
if (isset($retval[0][0]) && ($retval[0][0] == 'alreadyrolled' || $retval[0][0] == 'cantrollback')) {
$error = $retval[0];
$userMessage = $this->msg($error[0], array_slice($error, 1));
// dieUsageMsg() doesn't support $extraData
$errorCode = $error[0];
$errorInfo = isset(ApiBase::$messageMap[$errorCode]) ? ApiBase::$messageMap[$errorCode]['info'] : $errorCode;
$this->dieUsage($errorInfo, $errorCode, 0, ['messageHtml' => $userMessage->parseAsBlock()]);
}
$this->dieUsageMsg(reset($retval));
}
$watch = 'preferences';
if (isset($params['watchlist'])) {
$watch = $params['watchlist'];
}
// Watch pages
$this->setWatch($watch, $titleObj, 'watchrollback');
$info = ['title' => $titleObj->getPrefixedText(), 'pageid' => intval($details['current']->getPage()), 'summary' => $details['summary'], 'revid' => intval($details['newid']), 'old_revid' => intval($details['current']->getID()), 'last_revid' => intval($details['target']->getID())];
$oldUser = $details['current']->getUserText(Revision::FOR_THIS_USER);
$lastUser = $details['target']->getUserText(Revision::FOR_THIS_USER);
$diffUrl = $titleObj->getFullURL(['diff' => $info['revid'], 'oldid' => $info['old_revid'], 'diffonly' => '1']);
$info['messageHtml'] = $this->msg('rollback-success-notify')->params($oldUser, $lastUser, $diffUrl)->parseAsBlock();
$this->getResult()->addValue(null, $this->getModuleName(), $info);
}
开发者ID:claudinec,项目名称:galan-wiki,代码行数:43,代码来源:ApiRollback.php
示例19: processIndividual
protected function processIndividual($type, $params, $id)
{
$idResult = array($type => $id);
// validate the ID
$valid = false;
switch ($type) {
case 'rcid':
$valid = RecentChange::newFromId($id);
break;
case 'revid':
$valid = Revision::newFromId($id);
break;
case 'logid':
$valid = self::validateLogId($id);
break;
}
if (!$valid) {
$idResult['status'] = 'error';
$idResult += $this->parseMsg(array("nosuch{$type}", $id));
return $idResult;
}
$status = ChangeTags::updateTagsWithChecks($params['add'], $params['remove'], $type === 'rcid' ? $id : null, $type === 'revid' ? $id : null, $type === 'logid' ? $id : null, null, $params['reason'], $this->getUser());
if (!$status->isOK()) {
if ($status->hasMessage('actionthrottledtext')) {
$idResult['status'] = 'skipped';
} else {
$idResult['status'] = 'failure';
$idResult['errors'] = $this->getErrorFormatter()->arrayFromStatus($status, 'error');
}
} else {
$idResult['status'] = 'success';
if (is_null($status->value->logId)) {
$idResult['noop'] = '';
} else {
$idResult['actionlogid'] = $status->value->logId;
$idResult['added'] = $status->value->addedTags;
ApiResult::setIndexedTagName($idResult['added'], 't');
$idResult['removed'] = $status->value->removedTags;
ApiResult::setIndexedTagName($idResult['removed'], 't');
}
}
return $idResult;
}
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:43,代码来源:ApiTag.php
示例20: showForm
public function showForm()
{
global $wgScript;
// Add explanatory text
$this->getOutput()->addWikiMsg('problemchanges-list', $this->getLanguage()->formatNum($this->pager->getNumRows()));
$form = Html::openElement('form', array('name' => 'problemchanges', 'action' => $wgScript, 'method' => 'get')) . "\n";
$form .= "<fieldset><legend>" . $this->msg('problemchanges-legend')->escaped() . "</legend>\n";
$form .= Html::hidden('title', $this->getPageTitle()->getPrefixedDBKey()) . "\n";
$form .= FlaggedRevs::qualityVersions() ? "<span style='white-space: nowrap;'>" . FlaggedRevsXML::getLevelMenu($this->level, 'revreview-filter-stable') . '</span> ' : "";
$tagForm = ChangeTags::buildTagFilterSelector($this->tag);
if (count($tagForm)) {
$form .= Xml::tags('td', array('class' => 'mw-label'), $tagForm[0]);
$form .= Xml::tags('td', array('class' => 'mw-input'), $tagForm[1]);
}
$form .= '<br />' . Xml::label($this->msg("problemchanges-category")->text(), 'wpCategory') . ' ' . Xml::input('category', 30, $this->category, array('id' => 'wpCategory')) . ' ';
$form .= Xml::submitButton($this->msg('allpagessubmit')->text()) . "\n";
$form .= '</fieldset>';
$form .= Html::closeElement('form') . "\n";
$this->getOutput()->addHTML($form);
}
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:20,代码来源:ProblemChanges_body.php
注:本文中的ChangeTags类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论