本文整理匯總了PHP中EditPage::edit方法的典型用法代碼示例。如果您正苦於以下問題:PHP EditPage::edit方法的具體用法?PHP EditPage::edit怎麽用?PHP EditPage::edit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類EditPage
的用法示例。
在下文中一共展示了EditPage::edit方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: edit
function edit()
{
parent::edit();
// handle "section=new" case
$section = $this->app->getGlobal('wgRequest')->getVal('section');
if ($section == 'new') {
$this->mSummaryBox['placeholder'] = wfMsg('editpagelayout-pageControls-newSectionLabel');
}
}
示例2: show
public function show()
{
$page = $this->page;
$user = $this->getUser();
if (wfRunHooks('CustomEditor', array($page, $user))) {
$editor = new EditPage($page);
$editor->edit();
}
}
示例3: show
public function show()
{
if ($this->getContext()->getConfig()->get('UseMediaWikiUIEverywhere')) {
$out = $this->getOutput();
$out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox'));
}
$page = $this->page;
$user = $this->getUser();
if (wfRunHooks('CustomEditor', array($page, $user))) {
$editor = new EditPage($page);
$editor->edit();
}
}
示例4: showEditForm
/**
* Display the Edit page for an article for an AJAX request. Outputs
* HTML.
*
* @param Title $title title object describing which article to edit
*/
public static function showEditForm($title)
{
global $wgRequest, $wgTitle, $wgOut;
$wgTitle = $title;
$article = new Article($title);
$editor = new EditPage($article);
$editor->edit();
if ($wgOut->mRedirect != '' && $wgRequest->wasPosted()) {
$wgOut->redirect('');
$rev = Revision::newFromTitle($title);
$wgOut->addHTML($wgOut->parse($rev->getText()));
}
}
示例5: show
public function show()
{
$this->useTransactionalTimeLimit();
$out = $this->getOutput();
$out->setRobotPolicy('noindex,nofollow');
if ($this->getContext()->getConfig()->get('UseMediaWikiUIEverywhere')) {
$out->addModuleStyles(array('mediawiki.ui.input', 'mediawiki.ui.checkbox'));
}
$page = $this->page;
$user = $this->getUser();
if (Hooks::run('CustomEditor', array($page, $user))) {
$editor = new EditPage($page);
$editor->edit();
}
}
示例6: edit
function edit()
{
global $wgOut, $wgUser, $wgHooks, $wgTitle;
//add some user variables
$seqPlayer = new MV_SequencePlayer($wgTitle);
mvAddGlobalJSVariables(array('mvSeqExportUrl' => $seqPlayer->getExportUrl()));
//add the "switch" link to the top of the page
$wgOut->addHTML('<span id="swich_seq_links">
<a id="swich_seq_text" style="display:none"
href="javascript:mv_do_sequence_edit_swap(\'text\')">' . wfMsg('mv_sequence_edit_text') . '</a>' . '<a id="switch_seq_wysiwyg"
href="javascript:mv_do_sequence_edit_swap(\'seq_update\')">' . wfMsg('mv_sequence_edit_visual_editor') . '</a>' . '</span>' . '<div id="seq_edit_container" style="display:none;position:relative;width:100%;height:580px;background:#AAA"></div>');
$wgOut->addHTML('<div id="mv_text_edit_container"> ');
parent::edit();
$wgOut->addHTML('</div>');
}
示例7: edit
function edit()
{
global $wgOut, $wgUser, $wgHooks;
//check permission if admin show 'edit files'
if ($wgUser->isAllowed('mv_edit_stream')) {
//add in the edit stream ajax form:
//$wgHooks['EditPage::showEditForm:fields'][] = array($this, 'displayEditStreamFiles');
$this->displayEditStreamFiles();
}
if ($this->mv_action == 'new_stream_file' || $this->mv_action == 'edit_stream_files' || $this->mv_action == 'add_existing_stream_file') {
//make the request look like a GET
//that way we don't run importFormData with empty POST
$_SERVER['REQUEST_METHOD'] = 'GET';
}
parent::edit();
}
示例8: show
public function show()
{
$page = $this->page;
$request = $this->getRequest();
$user = $this->getUser();
$context = $this->getContext();
if (wfRunHooks('CustomEditor', array($page, $user))) {
if (ExternalEdit::useExternalEngine($context, 'edit') && $this->getName() == 'edit' && !$request->getVal('section') && !$request->getVal('oldid')) {
$extedit = new ExternalEdit($context);
$extedit->execute();
} else {
$editor = new EditPage($page);
$editor->edit();
}
}
}
示例9: show
public function show()
{
$page = $this->page;
$request = $this->getRequest();
$user = $this->getUser();
$context = $this->getContext();
if (wfRunHooks('CustomEditor', array($page, $user))) {
if (ExternalEdit::useExternalEngine($context, 'edit') && $this->getName() == 'edit' && !$request->getVal('section') && !$request->getVal('oldid')) {
$extedit = new ExternalEdit($context);
$extedit->execute();
} else {
$editor = new EditPage($page);
/* Wikia change begin - @author: macbre */
/* Allow extensions to change EditPage class used for rendering edit pages */
wfRunHooks('AlternateEditPageClass', array(&$editor));
/* Wikia change - end */
$editor->edit();
}
}
}
示例10: showSummarizeForm
/**
* @param $thread Thread
*/
function showSummarizeForm($thread)
{
$submitted_nonce = $this->request->getVal('lqt_nonce');
$nonce_key = wfMemcKey('lqt-nonce', $submitted_nonce, $this->user->getName());
if (!$this->handleNonce($submitted_nonce, $nonce_key)) {
return;
}
if ($thread->summary()) {
$article = $thread->summary();
} else {
$t = $this->newSummaryTitle($thread);
$article = new Article($t, 0);
}
$html = Xml::openElement('div', array('class' => 'lqt-edit-form lqt-summarize-form'));
$this->output->addHTML($html);
$this->output->addWikiMsg('lqt-summarize-intro');
$talkpage = $thread->article();
LqtHooks::$editTalkpage = $talkpage;
LqtHooks::$editArticle = $article;
LqtHooks::$editThread = $thread;
LqtHooks::$editType = 'summarize';
LqtHooks::$editAppliesTo = $thread;
$e = new EditPage($article);
// Add an offset so it works if it's on the wrong page.
$dbr = wfGetDB(DB_SLAVE);
$offset = wfTimestamp(TS_UNIX, $thread->topmostThread()->sortkey());
$offset++;
$offset = $dbr->timestamp($offset);
$e->suppressIntro = true;
$e->editFormTextBeforeContent .= $this->perpetuate('lqt_method', 'hidden') . $this->perpetuate('lqt_operand', 'hidden') . Html::hidden('lqt_nonce', MWCryptRand::generateHex(32)) . Html::hidden('offset', $offset);
$e->edit();
if ($e->didSave) {
$bump = !$this->request->getCheck('wpBumpThread') || $this->request->getBool('wpBumpThread');
LqtView::summarizeMetadataUpdates(array('thread' => $thread, 'article' => $article, 'summary' => $e->summary, 'bump' => $bump));
if ($submitted_nonce && $nonce_key) {
global $wgMemc;
$wgMemc->set($nonce_key, 1, 3600);
}
}
if ($this->output->getRedirect() != '') {
$redirectTitle = clone $talkpage->getTitle();
$redirectTitle->setFragment('#' . $this->anchorName($thread));
$this->output->redirect($this->title->getLocalURL());
}
$this->output->addHTML('</div>');
}
示例11: edit
function edit()
{
global $wgRequest;
$this->importFormData($wgRequest);
EditPage::edit();
}
示例12: execute
/**
* cuteCUTE
**/
function execute($par)
{
global $wgRequest, $wgOut, $wgUser, $wgLang, $wgParser, $efType, $wgTitle;
$target = isset($par) ? $par : $wgRequest->getVal('target');
wfLoadExtensionMessages('EditFinder');
self::setTemplatePath();
if ($wgUser->isBlocked()) {
$wgOut->blockedPage();
return;
}
if ($wgUser->getID() == 0) {
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->errorpage('nosuchspecialpage', 'nospecialpagetext');
return;
}
$this->topicMode = strtolower($par) == 'topic' || strtolower($wgRequest->getVal('edittype')) == 'topic';
if ($wgRequest->getVal('fetchArticle')) {
$wgOut->setArticleBodyOnly(true);
echo json_encode($this->getNextArticle());
return;
} elseif ($wgRequest->getVal('show-article')) {
$wgOut->setArticleBodyOnly(true);
if ($wgRequest->getInt('aid') == '') {
$catsJs = $this->topicMode ? "editFinder.getThoseInterests();" : "editFinder.getThoseCats();";
$catsTxt = $this->topicMode ? "interests" : "categories";
$wgOut->addHTML('<div class="article_inner">No articles found. <a href="#" onclick="' . $catsJs . '">Select more ' . $catsTxt . '</a> and try again.</div>');
return;
}
$t = Title::newFromID($wgRequest->getInt('aid'));
$articleTitleLink = $t->getLocalURL();
$articleTitle = $t->getText();
//$edittype = $a['edittype'];
//get article
$a = new Article($t);
$r = Revision::newFromTitle($t);
$popts = $wgOut->parserOptions();
$popts->setTidy(true);
$popts->enableLimitReport();
$parserOutput = $wgParser->parse($r->getText(), $t, $popts, true, true, $a->getRevIdFetched());
$popts->setTidy(false);
$popts->enableLimitReport(false);
$html = WikihowArticleHTML::processArticleHTML($parserOutput->getText(), array('no-ads', 'ns' => NS_MAIN));
$wgOut->addHTML($html);
return;
} elseif ($wgRequest->getVal('edit-article')) {
// SHOW THE EDIT FORM
$wgOut->setArticleBodyOnly(true);
$t = Title::newFromID($wgRequest->getInt('aid'));
$a = new Article($t);
$editor = new EditPage($a);
$editor->edit();
return;
} elseif ($wgRequest->getVal('action') == 'submit') {
$wgOut->setArticleBodyOnly(true);
$efType = strtolower($wgRequest->getVal('type'));
$t = Title::newFromID($wgRequest->getInt('aid'));
$a = new Article($t);
//log it
$params = array($efType);
$log = new LogPage('EF_' . substr($efType, 0, 7), false);
// false - dont show in recentchanges
$log->addEntry('', $t, 'Repaired an article -- ' . strtoupper($efType) . '.', $params);
$text = $wgRequest->getVal('wpTextbox1');
$sum = $wgRequest->getVal('wpSummary');
//save the edit
$a->doEdit($text, $sum, EDIT_UPDATE);
wfRunHooks("EditFinderArticleSaveComplete", array($a, $text, $sum, $wgUser, $efType));
return;
} elseif ($wgRequest->getVal('confirmation')) {
$wgOut->setArticleBodyOnly(true);
echo $this->confirmationModal($wgRequest->getVal('type'), $wgRequest->getInt('aid'));
wfProfileOut(__METHOD__);
return;
} elseif ($wgRequest->getVal('cancel-confirmation')) {
$wgOut->setArticleBodyOnly(true);
echo $this->cancelConfirmationModal($wgRequest->getInt('aid'));
wfProfileOut(__METHOD__);
return;
} else {
//default view (same as most of the views)
$sk = $wgUser->getSkin();
$wgOut->setArticleBodyOnly(false);
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('mousetrap.min.js', 'jquery.cookie.js'), 'extensions/wikihow/common', false));
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('preview.js'), 'skins/common', false));
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('clientscript.js', 'preview.js'), 'skins/common', false));
$wgOut->addScript(HtmlSnips::makeUrlTags('js', array('editfinder.js'), 'extensions/wikihow/editfinder', false));
$efType = strtolower($target);
if (strpos($efType, '/') !== false) {
$efType = substr($efType, 0, strpos($efType, '/'));
}
if ($efType == '') {
//no type specified? send 'em to format...
$wgOut->redirect('/Special:EditFinder/Format');
}
$wgOut->addHTML('<script>var g_eftype = "' . $target . '";</script>');
//add main article info
$vars = array('pagetitle' => wfMsg('app-name') . ': ' . wfMsg($efType), 'question' => wfMsg('editfinder-question'), 'yep' => wfMsg('editfinder_yes'), 'nope' => wfMsg('editfinder_no'), 'helparticle' => wfMsg('help_' . $efType));
//.........這裏部分代碼省略.........
示例13: execute
function execute($par)
{
global $wgUser, $wgOut, $wgRequest, $wgTitle;
if ($wgUser->isBlocked()) {
$wgOut->blockedPage();
return;
}
if (!($wgUser->isSysop() || in_array('newarticlepatrol', $wgUser->getRights()))) {
$wgOut->setRobotpolicy('noindex,nofollow');
$wgOut->showErrorPage('nosuchspecialpage', 'nospecialpagetext');
return;
}
wfLoadExtensionMessages("NFDGuardian");
if ($wgRequest->getVal('fetchInnards')) {
//get next article to vote on
$wgOut->disable();
$result = self::getNextInnards($wgRequest->getVal('nfd_type'));
print_r(json_encode($result));
return;
} else {
if ($wgRequest->getVal('getVoteBlock')) {
//get all the votes for the right rail module
$wgOut->setArticleBodyOnly(true);
$wgOut->addHTML(self::getVoteBlock($wgRequest->getVal('nfd_id')));
return;
} else {
if ($wgRequest->getVal('edit')) {
//get the html that goes into the page when a user clicks the edit tab
$wgOut->setArticleBodyOnly(true);
$t = Title::newFromID($wgRequest->getVal('articleId'));
if ($t) {
$a = new Article($t);
$editor = new EditPage($a);
$editor->edit();
//Old code for when we wanted to remove
//the nfd template from the edit window
/*$content = $wgOut->getHTML();
$wgOut->clearHTML();
//grab the edit form
$data = array();
$data['form'] = $content;
//then take out the template
$c = new NFDProcessor();
$template = $c->getFullTemplate($wgRequest->getVal('nfd_id'));
$articleContent = $a->getContent();
$articleContent = str_replace($template, "", $articleContent);
$data['newContent'] = $articleContent;
print_r(json_encode($data));*/
}
return;
} else {
if ($wgRequest->getVal('discussion')) {
//get the html that goes into the page when a user clicks the discussion tab
$wgOut->setArticleBodyOnly(true);
$t = Title::newFromID($wgRequest->getVal('articleId'));
if ($t) {
$tDiscussion = $t->getTalkPage();
if ($tDiscussion) {
$a = new Article($tDiscussion);
$content = $a->getContent();
$wgOldTitle = $wgTitle;
$wgTitle = $tDiscussion;
$wgOut->addHTML($wgOut->parse($content));
$wgOut->addHTML(PostComment::getForm(true, $tDiscussion, true));
$wgTitle = $wgOldTitle;
}
}
return;
} else {
if ($wgRequest->getVal('confirmation')) {
//get confirmation dialog after user has edited the article
$wgOut->setArticleBodyOnly(true);
echo $this->confirmationModal($wgRequest->getVal('articleId'));
return;
} else {
if ($wgRequest->getVal('history')) {
//get the html that goes into the page when a user clicks the history tab
$wgOut->setArticleBodyOnly(true);
$t = Title::newFromID($wgRequest->getVal('articleId'));
if ($t) {
$historyContext = clone $this->getContext();
$historyContext->setTitle($t);
$historyContext->setWikiPage(WikiPage::factory($t));
$pageHistory = Action::factory("history", WikiPage::factory($t), $historyContext);
$pageHistory->onView();
return;
}
} else {
if ($wgRequest->getVal('diff')) {
//get the html that goes into the page when a user asks for a diffs
$wgOut->setArticleBodyOnly(true);
$t = Title::newFromID($wgRequest->getVal('articleId'));
if ($t) {
$a = new Article($t);
$wgOut->addHtml('<div class="article_inner">');
$a->view();
$wgOut->addHtml('</div>');
}
//.........這裏部分代碼省略.........