本文整理汇总了PHP中EditPage::getCheckboxes方法的典型用法代码示例。如果您正苦于以下问题:PHP EditPage::getCheckboxes方法的具体用法?PHP EditPage::getCheckboxes怎么用?PHP EditPage::getCheckboxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditPage
的用法示例。
在下文中一共展示了EditPage::getCheckboxes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
//.........这里部分代码省略.........
if ($title->getNamespace() == NS_USER || $title->getNamespace() == NS_USER_TALK) {
$parts = explode('/', $title->getText(), 2);
$targetUsername = $parts[0];
$targetUser = User::newFromName($targetUsername, false);
if (!($targetUser && $targetUser->isLoggedIn()) && !User::isIP($targetUsername)) {
// User does not exist
$notices[] = "<div class=\"mw-userpage-userdoesnotexist error\">\n" . $this->msg('userpage-userdoesnotexist', wfEscapeWikiText($targetUsername)) . "\n</div>";
} elseif ($targetUser->isBlocked()) {
// Show log extract if the user is currently blocked
$notices[] = $this->msg('blocked-notice-logextract', $targetUser->getName())->parseAsBlock() . $this->getLastLogEntry($targetUser->getUserPage(), 'block');
}
}
// Blocked user notice
if ($user->isBlockedFrom($title) && $user->getBlock()->prevents('edit') !== false) {
$notices[] = call_user_func_array(array($this, 'msg'), $user->getBlock()->getPermissionsError($this->getContext()))->parseAsBlock();
}
// Blocked user notice for global blocks
if (class_exists('GlobalBlocking')) {
$error = GlobalBlocking::getUserBlockErrors($user, $this->getRequest()->getIP());
if (count($error)) {
$notices[] = call_user_func_array(array($this, 'msg'), $error)->parseAsBlock();
}
}
// HACK: Build a fake EditPage so we can get checkboxes from it
$article = new Article($title);
// Deliberately omitting ,0 so oldid comes from request
$ep = new EditPage($article);
$req = $this->getRequest();
$req->setVal('format', 'text/x-wiki');
$ep->importFormData($req);
// By reference for some reason (bug 52466)
$tabindex = 0;
$states = array('minor' => false, 'watch' => false);
$checkboxes = $ep->getCheckboxes($tabindex, $states);
// HACK: Find out which red links are on the page
// We do the lookup for the current version. This might not be entirely complete
// if we're loading an oldid, but it'll probably be close enough, and LinkCache
// will automatically request any additional data it needs.
$links = array();
$wikipage = WikiPage::factory($title);
$popts = $wikipage->makeParserOptions('canonical');
$cached = ParserCache::singleton()->get($article, $popts, true);
$links = array('missing' => array(), 'known' => $restoring || !$cached ? array() : 1);
if ($cached) {
foreach ($cached->getLinks() as $namespace => $cachedTitles) {
foreach ($cachedTitles as $cachedTitleText => $exists) {
$cachedTitle = Title::makeTitle($namespace, $cachedTitleText);
if (!$cachedTitle->isKnown()) {
$links['missing'][] = $cachedTitle->getPrefixedText();
} elseif ($links['known'] !== 1) {
$links['known'][] = $cachedTitle->getPrefixedText();
}
}
}
}
// Add information about current page
if (!$title->isKnown()) {
$links['missing'][] = $title->getPrefixedText();
} elseif ($links['known'] !== 1) {
$links['known'][] = $title->getPrefixedText();
}
// On parser cache miss, just don't bother populating red link data
$result = array('result' => 'success', 'notices' => $notices, 'checkboxes' => $checkboxes, 'links' => $links, 'protectedClasses' => implode(' ', $protectedClasses), 'watched' => $user->isWatched($title), 'basetimestamp' => $baseTimestamp, 'starttimestamp' => wfTimestampNow(), 'oldid' => $oldid);
if ($params['paction'] === 'parse') {
$result['content'] = $content;
}
示例2: execute
//.........这里部分代码省略.........
}
}
// Show notice when editing user / user talk page of a user that doesn't exist
// or who is blocked
// HACK of course this code is partly duplicated from EditPage.php :(
if ($page->getNamespace() == NS_USER || $page->getNamespace() == NS_USER_TALK) {
$parts = explode('/', $page->getText(), 2);
$targetUsername = $parts[0];
$targetUser = User::newFromName($targetUsername, false);
if (!($targetUser && $targetUser->isLoggedIn()) && !User::isIP($targetUsername)) {
// User does not exist
$notices[] = "<div class=\"mw-userpage-userdoesnotexist error\">\n" . $this->msg('userpage-userdoesnotexist', wfEscapeWikiText($targetUsername)) . "\n</div>";
}
// Some upstream code is deleted from here, more information:
// https://github.com/Wikia/app/commit/d54b481d3f6e5b092b212a2c98b2cb5452bee26c
// https://github.com/Wikia/app/commit/681e7437078206460f7c0cb1837095e656d8ba85
}
if (class_exists('GlobalBlocking')) {
$error = GlobalBlocking::getUserBlockErrors($user, $this->getRequest()->getIP());
if (count($error)) {
$notices[] = call_user_func_array(array($this, 'msg'), $error)->parseAsBlock();
}
}
// HACK: Build a fake EditPage so we can get checkboxes from it
$article = new Article($page);
// Deliberately omitting ,0 so oldid comes from request
$ep = new EditPage($article);
$req = $this->getRequest();
$req->setVal('format', 'text/x-wiki');
$ep->importFormData($req);
// By reference for some reason (bug 52466)
$tabindex = 0;
$states = array('minor' => false, 'watch' => false);
$checkboxes = $ep->getCheckboxes($tabindex, $states);
// HACK: Find out which red links are on the page
// We do the lookup for the current version. This might not be entirely complete
// if we're loading an oldid, but it'll probably be close enough, and LinkCache
// will automatically request any additional data it needs.
$links = array();
$wikipage = WikiPage::factory($page);
$popts = $wikipage->makeParserOptions('canonical');
$cached = ParserCache::singleton()->get($article, $popts, true);
if ($cached) {
foreach ($cached->getLinks() as $ns => $dbks) {
foreach ($dbks as $dbk => $id) {
$links[Title::makeTitle($ns, $dbk)->getPrefixedText()] = array('missing' => $id == 0);
}
}
}
// On parser cache miss, just don't bother populating red link data
if ($parsed === false) {
$this->dieUsage('Error contacting the Parsoid server', 'parsoidserver');
} else {
$result = array_merge(array('result' => 'success', 'notices' => $notices, 'checkboxes' => $checkboxes, 'links' => $links, 'protectedClasses' => implode(' ', $protectedClasses), 'anoneditwarning' => $anoneditwarning), $parsed['result']);
}
break;
case 'parsefragment':
$content = $this->parseWikitextFragment($page, $params['wikitext']);
if ($content === false) {
$this->dieUsage('Error contacting the Parsoid server', 'parsoidserver');
} else {
$result = array('result' => 'success', 'content' => $content);
}
break;
case 'serialize':
if ($params['cachekey'] !== null) {