本文整理汇总了PHP中EditPage::attemptSave方法的典型用法代码示例。如果您正苦于以下问题:PHP EditPage::attemptSave方法的具体用法?PHP EditPage::attemptSave怎么用?PHP EditPage::attemptSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EditPage
的用法示例。
在下文中一共展示了EditPage::attemptSave方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
wfProfileIn('DSMWPropertyTypeJob::run()');
$title = Title::newFromText('changeSetID', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::String]]';
$editpage->attemptSave();
}
$title = Title::newFromText('hasSemanticQuery', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::String]]';
$editpage->attemptSave();
}
$title = Title::newFromText('patchID', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::String]]';
$editpage->attemptSave();
}
$title = Title::newFromText('siteID', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::String]]';
$editpage->attemptSave();
}
$title = Title::newFromText('pushFeedServer', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::URL]]';
$editpage->attemptSave();
}
$title = Title::newFromText('pushFeedName', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::String]]';
$editpage->attemptSave();
}
$title = Title::newFromText('hasOperation', SMW_NS_PROPERTY);
if (!$title->exists()) {
$article = new Article($title);
$editpage = new EditPage($article);
$editpage->textbox1 = '[[has type::Record]]
[[has fields::String;String;String;Text]]';
$editpage->attemptSave();
}
wfProfileOut('DSMWPropertyTypeJob::run()');
return true;
}
示例2: alfCustomActions
function alfCustomActions($action, $article)
{
if ($action == "createPage") {
$pageContent = "";
if (isset($_REQUEST["pageContent"]) == true) {
$pageContent = $_REQUEST["pageContent"];
}
// Create the new page with the given title
$editor = new EditPage($article);
$editor->save = true;
$editor->textbox1 = urldecode($pageContent);
$editor->attemptSave();
return false;
} else {
return true;
}
}
示例3: execute
//.........这里部分代码省略.........
if ($ep->sectiontitle !== '') {
$sectionTitle = $ep->sectiontitle;
} else {
$sectionTitle = $ep->summary;
}
$contentObj = $contentHandler->unserializeContent($content, $contentFormat);
$fullContentObj = $articleObject->replaceSectionContent($params['section'], $contentObj, $sectionTitle);
if ($fullContentObj) {
$content = $fullContentObj->serialize($contentFormat);
} else {
// This most likely means we have an edit conflict which means that the edit
// wont succeed anyway.
$this->dieUsageMsg('editconflict');
}
}
// Run hooks
// Handle APIEditBeforeSave parameters
$r = array();
if (!Hooks::run('APIEditBeforeSave', array($ep, $content, &$r))) {
if (count($r)) {
$r['result'] = 'Failure';
$apiResult->addValue(null, $this->getModuleName(), $r);
return;
}
$this->dieUsageMsg('hookaborted');
}
// Do the actual save
$oldRevId = $articleObject->getRevIdFetched();
$result = null;
// Fake $wgRequest for some hooks inside EditPage
// @todo FIXME: This interface SUCKS
$oldRequest = $wgRequest;
$wgRequest = $req;
$status = $ep->attemptSave($result);
$wgRequest = $oldRequest;
switch ($status->value) {
case EditPage::AS_HOOK_ERROR:
case EditPage::AS_HOOK_ERROR_EXPECTED:
if (isset($status->apiHookResult)) {
$r = $status->apiHookResult;
$r['result'] = 'Failure';
$apiResult->addValue(null, $this->getModuleName(), $r);
return;
} else {
$this->dieUsageMsg('hookaborted');
}
case EditPage::AS_PARSE_ERROR:
$this->dieUsage($status->getMessage(), 'parseerror');
case EditPage::AS_IMAGE_REDIRECT_ANON:
$this->dieUsageMsg('noimageredirect-anon');
case EditPage::AS_IMAGE_REDIRECT_LOGGED:
$this->dieUsageMsg('noimageredirect-logged');
case EditPage::AS_SPAM_ERROR:
$this->dieUsageMsg(array('spamdetected', $result['spam']));
case EditPage::AS_BLOCKED_PAGE_FOR_USER:
$this->dieUsage('You have been blocked from editing', 'blocked', 0, array('blockinfo' => ApiQueryUserInfo::getBlockInfo($user->getBlock())));
case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
case EditPage::AS_CONTENT_TOO_BIG:
$this->dieUsageMsg(array('contenttoobig', $this->getConfig()->get('MaxArticleSize')));
case EditPage::AS_READ_ONLY_PAGE_ANON:
$this->dieUsageMsg('noedit-anon');
case EditPage::AS_READ_ONLY_PAGE_LOGGED:
$this->dieUsageMsg('noedit');
case EditPage::AS_READ_ONLY_PAGE:
$this->dieReadOnly();
case EditPage::AS_RATE_LIMITED:
示例4: attemptSave
/**
* Attempt submission
* @return bool false if output is done, true if the rest of the form should be displayed
*/
function attemptSave()
{
$break = parent::attemptSave();
return $break;
}
示例5: submitForm
/**
* Try to submit the form.
*
* @return Mixed: boolean false on failure, nothing on success; if
* everything went well, the user is redirected to their new
* page
*/
function submitForm()
{
global $wgOut, $wgRequest, $wgServer, $wgScript, $wgScriptPath;
// check if we are editing in red link mode
if ($wgRequest->getCheck('wpSubmitCreateplate')) {
$mainform = new CreatePageCreateplateForm();
$mainform->showForm('');
$mainform->showCreateplate();
return false;
} else {
$valid = $this->checkArticleExists($wgRequest->getVal('Createtitle'));
if ($valid != '') {
// no title? this means overwriting Main Page...
$mainform = new CreatePageCreateplateForm();
$mainform->showForm($valid);
$editor = new CreatePageMultiEditor($this->mCreateplate);
$editor->generateForm($editor->glueArticle());
return false;
}
if ($wgRequest->getCheck('wpSave')) {
$editor = new CreatePageMultiEditor($this->mCreateplate);
$rtitle = Title::newFromText($wgRequest->getVal('Createtitle'));
$rarticle = new Article($rtitle, $rtitle->getArticleID());
$editpage = new EditPage($rarticle);
$editpage->mTitle = $rtitle;
$editpage->mArticle = $rarticle;
$editpage->textbox1 = CreateMultiPage::unescapeBlankMarker($editor->glueArticle());
$editpage->minoredit = $wgRequest->getCheck('wpMinoredit');
$editpage->watchthis = $wgRequest->getCheck('wpWatchthis');
$editpage->summary = $wgRequest->getVal('wpSummary');
$_SESSION['article_createplate'] = $this->mCreateplate;
// pipe tags to pipes
wfCreatePageUnescapeKnownMarkupTags($editpage->textbox1);
$editpage->attemptSave();
return false;
} elseif ($wgRequest->getCheck('wpPreview')) {
$mainform = new CreatePageCreatePlateForm();
$editor = new CreatePageMultiEditor($this->mCreateplate, true);
$content = $editor->glueArticle(true, false);
$content_static = $editor->glueArticle(true);
$mainform->showForm('', $content_static);
$editor->generateForm($content);
return false;
} elseif ($wgRequest->getCheck('wpAdvancedEdit')) {
$editor = new CreatePageMultiEditor($this->mCreateplate);
$content = CreateMultiPage::unescapeBlankMarker($editor->glueArticle());
wfCreatePageUnescapeKnownMarkupTags($content);
$_SESSION['article_content'] = $content;
$wgOut->redirect($wgServer . $wgScript . '?title=' . $wgRequest->getVal('Createtitle') . '&action=edit&createpage=true');
} elseif ($wgRequest->getCheck('wpImageUpload')) {
$mainform = new CreatePageCreatePlateForm();
$mainform->showForm('');
$editor = new CreatePageMultiEditor($this->mCreateplate);
$content = $editor->glueArticle();
$editor->generateForm($content);
} elseif ($wgRequest->getCheck('wpCancel')) {
if ($wgRequest->getVal('Createtitle') != '') {
$wgOut->redirect($wgServer . $wgScript . '?title=' . $wgRequest->getVal('Createtitle'));
} else {
$wgOut->redirect($wgServer . $wgScript);
}
}
}
}