当前位置: 首页>>代码示例>>PHP>>正文


PHP EditPage类代码示例

本文整理汇总了PHP中EditPage的典型用法代码示例。如果您正苦于以下问题:PHP EditPage类的具体用法?PHP EditPage怎么用?PHP EditPage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了EditPage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onAlternateEdit

 /**
  * Blocks view source page & make it so that users cannot create/edit
  * pages that are on the takedown list.
  *
  * @param EditPage $editPage edit page instance
  * @return bool show edit page form?
  */
 public static function onAlternateEdit(EditPage $editPage)
 {
     $wg = F::app()->wg;
     $wf = F::app()->wf;
     $title = $editPage->getTitle();
     // Block view-source on the certain pages.
     if ($title->exists()) {
         // Look at the page-props to see if this page is blocked.
         if (!$wg->user->isAllowed('editlyricfind')) {
             // some users (staff/admin) will be allowed to edit these to prevent vandalism/spam issues.
             $removedProp = $wf->GetWikiaPageProp(WPP_LYRICFIND_MARKED_FOR_REMOVAL, $title->getArticleID());
             if (!empty($removedProp)) {
                 $wg->Out->addHTML(Wikia::errorbox(wfMessage('lyricfind-editpage-blocked')));
                 $blockEdit = true;
             }
         }
     } else {
         // Page is being created. Prevent this if page is prohibited by LyricFind.
         $blockEdit = LyricFindTrackingService::isPageBlockedViaApi($amgId = "", $gracenoteId = "", $title->getText());
         if ($blockEdit) {
             $wg->Out->addHTML(Wikia::errorbox(wfMessage('lyricfind-creation-blocked')));
         }
     }
     return !$blockEdit;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:32,代码来源:LyricFindHooks.class.php

示例2: execute

 public function execute()
 {
     global $wgHooks;
     $out = $this->mSpecial->getOutput();
     if (!ModerationCanSkip::canSkip($this->moderator)) {
         // In order to merge, moderator must also be automoderated
         throw new ModerationError('moderation-merge-not-automoderated');
     }
     $dbw = wfGetDB(DB_MASTER);
     $row = $dbw->selectRow('moderation', array('mod_namespace AS namespace', 'mod_title AS title', 'mod_user_text AS user_text', 'mod_text AS text', 'mod_conflict AS conflict'), array('mod_id' => $this->id), __METHOD__);
     if (!$row) {
         throw new ModerationError('moderation-edit-not-found');
     }
     if (!$row->conflict) {
         throw new ModerationError('moderation-merge-not-needed');
     }
     $title = Title::makeTitle($row->namespace, $row->title);
     $article = new Article($title);
     ModerationEditHooks::$NewMergeID = $this->id;
     $editPage = new EditPage($article);
     $editPage->isConflict = true;
     $editPage->setContextTitle($title);
     $editPage->textbox1 = $row->text;
     $editPage->summary = wfMessage("moderation-merge-comment", $row->user_text)->inContentLanguage()->plain();
     $editPage->showEditForm();
 }
开发者ID:ATCARES,项目名称:mediawiki-moderation,代码行数:26,代码来源:ModerationActionMerge.php

示例3: onEditPageImportFormData

 /**
  * Concatenate categories on EditPage POST
  *
  * @param EditPage $editPage
  * @param WebRequest $request
  *
  * @return Boolean because it's a hook
  */
 public static function onEditPageImportFormData($editPage, $request)
 {
     $app = F::app();
     if ($request->wasPosted()) {
         $categories = $editPage->safeUnicodeInput($request, 'categories');
         $categories = CategoryHelper::changeFormat($categories, 'json', 'array');
         // Concatenate categories to article wikitext (if there are any).
         if (!empty($categories)) {
             if (!empty($app->wg->EnableAnswers)) {
                 // don't add categories if the page is a redirect
                 $magicWords = $app->wg->ContLang->getMagicWords();
                 $redirects = $magicWords['redirect'];
                 // first element doesn't interest us
                 array_shift($redirects);
                 // check for localized versions of #REDIRECT
                 foreach ($redirects as $alias) {
                     if (stripos($editPage->textbox1, $alias) === 0) {
                         return true;
                     }
                 }
             }
             // Extract categories from the article, merge them with those passed in, weed out
             // duplicates and finally append them back to the article (BugId:99348).
             $data = CategoryHelper::extractCategoriesFromWikitext($editPage->textbox1, true);
             $categories = CategoryHelper::getUniqueCategories($data['categories'], $categories);
             $categories = CategoryHelper::changeFormat($categories, 'array', 'wikitext');
             // Remove trailing whitespace (BugId:11238)
             $editPage->textbox1 = $data['wikitext'] . rtrim($categories);
         }
     }
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:CategorySelectHooksHelper.class.php

示例4: getDiff

 public function getDiff($wikitext, $section = '')
 {
     wfProfileIn(__METHOD__);
     $section = intval($section);
     // create "fake" EditPage
     if (function_exists('CategorySelectInitializeHooks')) {
         CategorySelectInitializeHooks(null, null, $this->mTitle, null, null, null, true);
     }
     $article = new Article($this->mTitle);
     $editPage = new EditPage($article);
     $editPage->textbox1 = $wikitext;
     $editPage->edittime = null;
     $editPage->section = $section > 0 ? $section : '';
     // render diff HTML to $wgOut
     $out = $this->app->getGlobal('wgOut');
     $oldHtml = $out->getHTML();
     $out->clearHTML();
     $editPage->showDiff();
     $diff = $out->getHTML();
     // restore state of output
     $out->clearHTML();
     $out->addHTML($oldHtml);
     wfProfileOut(__METHOD__);
     return $diff;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:25,代码来源:EditPageService.class.php

示例5: onEditForm

 /**
  * Monitors edit page usage
  */
 public static function onEditForm(EditPage $editPage)
 {
     global $wgUser, $wgEditPageTrackingRegistrationCutoff, $wgMemc;
     // Anonymous users
     if ($wgUser->isAnon()) {
         return true;
     }
     if ($wgEditPageTrackingRegistrationCutoff && $wgUser->getRegistration() < $wgEditPageTrackingRegistrationCutoff) {
         // User registered before the cutoff
         return true;
     }
     if (EditPageTracking::getFirstEditPage($wgUser)) {
         // Already stored.
         return true;
     }
     // Record it
     $dbw = wfGetDB(DB_MASTER);
     $title = $editPage->getArticle()->getTitle();
     $timestamp = wfTimestampNow();
     $row = array('ept_user' => $wgUser->getId(), 'ept_namespace' => $title->getNamespace(), 'ept_title' => $title->getDBkey(), 'ept_timestamp' => $dbw->timestamp($timestamp));
     $dbw->insert('edit_page_tracking', $row, __METHOD__);
     $wgUser->mFirstEditPage = $timestamp;
     $cacheKey = wfMemcKey('first-edit-page', $wgUser->getId());
     $wgMemc->set($cacheKey, $timestamp, 86400);
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:29,代码来源:EditPageTracking.php

示例6: show

 public function show()
 {
     $page = $this->page;
     $user = $this->getUser();
     if (wfRunHooks('CustomEditor', array($page, $user))) {
         $editor = new EditPage($page);
         $editor->edit();
     }
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:9,代码来源:EditAction.php

示例7: 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;
    }
开发者ID:hala54,项目名称:DSMW,代码行数:56,代码来源:DSMWPropertyTypeJob.php

示例8: onEditConflict

 /**
  * @since 1.1
  *
  * @param EditPage $editor
  * @param OutputPage &$out
  *
  * @return true
  */
 public function onEditConflict(EditPage &$editor, OutputPage &$out)
 {
     $conctext = $editor->textbox1;
     $actualtext = $editor->textbox2;
     $initialtext = $editor->getBaseRevision()->mText;
     // TODO: WTF?!
     $editor->mArticle->doEdit($actualtext, $editor->summary, $editor->minoredit ? EDIT_MINOR : 0);
     $query = Title::newFromRedirect($actualtext) === null ? '' : 'redirect=no';
     $out->redirect($editor->mTitle->getFullURL($query));
     return true;
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:19,代码来源:DSMW.hooks.php

示例9: editShowCaptcha

 /**
  * Insert the captcha prompt into an edit form.
  * @param EditPage $editPage
  */
 function editShowCaptcha($editPage)
 {
     $context = $editPage->getArticle()->getContext();
     $page = $editPage->getArticle()->getPage();
     $out = $context->getOutput();
     if (isset($page->ConfirmEdit_ActivateCaptcha) || $this->showEditCaptcha || $this->shouldCheck($page, '', '', false)) {
         $out->addWikiText($this->getMessage($this->action));
         $out->addHTML($this->getForm());
     }
     unset($page->ConfirmEdit_ActivateCaptcha);
 }
开发者ID:eliagbayani,项目名称:LiteratureEditor,代码行数:15,代码来源:Captcha.php

示例10: wfAntiSpamInputCheck

function wfAntiSpamInputCheck()
{
    if (!empty($_POST['antispam'])) {
        $title = new Title();
        $article = new Article($title);
        $edit = new EditPage($article);
        $edit->spamPageWithContent();
        return false;
    } else {
        return true;
    }
}
开发者ID:yusufchang,项目名称:app,代码行数:12,代码来源:AntiSpamInput.php

示例11: onAlternateEdit

 /**
  * @desc Redirects to Special:CSS if this is a try of edition of Wikia.css
  *
  * @param EditPage $editPage
  * @return bool
  */
 public static function onAlternateEdit(EditPage $editPage)
 {
     wfProfileIn(__METHOD__);
     $app = F::app();
     $model = new SpecialCssModel();
     if (static::shouldRedirect($app, $model, $editPage->getArticle()->getTitle())) {
         $oldid = $app->wg->Request->getIntOrNull('oldid');
         $app->wg->Out->redirect($model->getSpecialCssUrl(false, $oldid ? array('oldid' => $oldid) : null));
     }
     wfProfileOut(__METHOD__);
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:SpecialCssHooks.class.php

示例12: onEditFilterMerged

 /**
  * Validates that the revised contents are valid JSON.
  * If not valid, rejects edit with error message.
  * @param EditPage $editor
  * @param string $text: Content of the revised article.
  * @param string &$error: Error message to return.
  * @param string $summary: Edit summary provided for edit.
  * @return True
  */
 static function onEditFilterMerged($editor, $text, &$error, $summary)
 {
     if ($editor->getTitle()->getNamespace() !== NS_SCHEMA) {
         return true;
     }
     $content = new JsonSchemaContent($text);
     try {
         $content->validate();
     } catch (JsonSchemaException $e) {
         $error = $e->getMessage();
     }
     return true;
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:22,代码来源:JsonSchemaHooks.php

示例13: 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()));
     }
 }
开发者ID:ErdemA,项目名称:wikihow,代码行数:19,代码来源:QuickEdit.body.php

示例14: 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();
     }
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:13,代码来源:EditAction.php

示例15: 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();
     }
 }
开发者ID:OrBin,项目名称:mediawiki,代码行数:15,代码来源:EditAction.php


注:本文中的EditPage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。