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


PHP EditPage::getTitle方法代码示例

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


在下文中一共展示了EditPage::getTitle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: editFilter

 /**
  * handler for editFilter hook
  *
  * @param EditPage $editPage -- edit page instance
  * @static
  */
 public static function editFilter($editPage, $text, $section, &$hookError, $summary)
 {
     wfProfileIn(__METHOD__);
     $title = $editPage->getTitle();
     /* 
      * Hook is called for both page creations and edits. We should only check
      * if the page is created = page does not exist (RT#61104)
      */
     if ($title->exists()) {
         wfProfileOut(__METHOD__);
         return true;
     }
     /**
      * pass to check title method
      */
     $ret = PhalanxTitleBlock::checkTitle($title);
     wfProfileOut(__METHOD__);
     return $ret;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:25,代码来源:PhalanxTitleBlock.class.php

示例4: onEditPageShowEditFormInitial

 /**
  * Load the JsonData object if we're in one of the configured namespaces
  * @param EditPage $editPage
  */
 public static function onEditPageShowEditFormInitial(&$editPage)
 {
     global $wgJsonData;
     $title = $editPage->getTitle();
     $ns = $title->getNamespace();
     if (JsonData::isJsonDataNeeded($ns)) {
         $wgJsonData = new JsonData($title);
         try {
             $jsonref = $wgJsonData->getJsonRef();
             $jsonref->validate();
         } catch (JsonSchemaException $e) {
             // if the JSON is null, don't sweat an error, since that will
             // frequently be the case for new pages
             if ($e->subtype != 'validate-fail-null' || !$editPage->firsttime) {
                 //TODO: clean up server error mechanism
                 $wgJsonData->servererror .= "<b>" . wfMessage('jsondata-server-error') . "</b>: " . htmlspecialchars($e->getMessage()) . "<br/>";
             }
         } catch (Exception $e) {
             $wgJsonData->servererror .= "<b>" . wfMessage('jsondata-server-error') . "</b>: " . htmlspecialchars($e->getMessage()) . "<br/>";
         }
         $wgJsonData->outputEditor(&$editPage);
     }
     return true;
 }
开发者ID:robla,项目名称:mediawiki-jsondata,代码行数:28,代码来源:JsonData.hooks.php

示例5: editBoxes

 /**
  * @param EditPage $editpage
  * @return string
  */
 private static function editBoxes(EditPage $editpage)
 {
     $context = $editpage->getArticle()->getContext();
     $request = $context->getRequest();
     $groupId = $request->getText('loadgroup', '');
     $th = new TranslationHelpers($editpage->getTitle(), $groupId);
     if ($editpage->firsttime && !$request->getCheck('oldid') && !$request->getCheck('undo')) {
         $editpage->textbox1 = (string) $th->getTranslation();
     } else {
         $th->setTranslation($editpage->textbox1);
     }
     TranslationHelpers::addModules($context->getOutput());
     return $th->getBoxes();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:18,代码来源:TranslateEditAddons.php

示例6: 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()->inNamespace(NS_CAMPAIGN)) {
         return true;
     }
     $content = new CampaignContent($text);
     try {
         $content->validate();
     } catch (JsonSchemaException $e) {
         $error = $e->getMessage();
     }
     return true;
 }
开发者ID:robksawyer,项目名称:lathe.tools,代码行数:22,代码来源:CampaignHooks.php

示例7: onAfterDisplayingTextbox

 /**
  * Wikia change - Add modules and console in the editor in Oasis
  *
  * @param  EditPage $editPage
  * @param  Array   $hidden
  * @return bool
  */
 public static function onAfterDisplayingTextbox(EditPage $editPage, &$hidden)
 {
     $app = F::app();
     if (!$app->checkSkin('oasis') || !$editPage instanceof EditPageLayout || $editPage->getTitle()->getNamespace() !== NS_MODULE) {
         return true;
     }
     $editPage->addCustomCheckbox('scribunto_ignore_errors', wfMessage('scribunto-ignore-errors')->escaped(), false);
     $app->wg->Out->addModules('ext.scribunto.edit');
     $app->wg->Out->addHtml('<div class="wikia-scribunto-console"><div id="mw-scribunto-console"></div></div>');
     return true;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:18,代码来源:Hooks.php

示例8: doStore

 protected function doStore(EditPage $editor)
 {
     $title = $editor->getTitle();
     // If they used redlink=1 and the page exists, redirect to the main article and send notice
     if ($this->getRequest()->getBool('redlink') && $title->exists()) {
         $this->logMessage(wfMessage('sf_autoedit_redlinkexists')->parse(), self::WARNING);
     }
     $permErrors = $title->getUserPermissionsErrors('edit', $this->getUser());
     // if this title needs to be created, user needs create rights
     if (!$title->exists()) {
         $permErrors = array_merge($permErrors, wfArrayDiff2($title->getUserPermissionsErrors('create', $this->getUser()), $permErrors));
     }
     if ($permErrors) {
         // Auto-block user's IP if the account was "hard" blocked
         $this->getUser()->spreadAnyEditBlock();
         foreach ($permErrors as $error) {
             $this->logMessage(call_user_func_array('wfMessage', $error)->parse());
         }
         return;
     }
     $resultDetails = false;
     # Allow bots to exempt some edits from bot flagging
     $bot = $this->getUser()->isAllowed('bot') && $editor->bot;
     $request = $editor->sfFauxRequest;
     if ($editor->tokenOk($request)) {
         $ctx = RequestContext::getMain();
         $tempTitle = $ctx->getTitle();
         $ctx->setTitle($title);
         $status = $editor->internalAttemptSave($resultDetails, $bot);
         $ctx->setTitle($tempTitle);
     } else {
         throw new MWException(wfMessage('session_fail_preview')->parse());
     }
     switch ($status->value) {
         case EditPage::AS_HOOK_ERROR_EXPECTED:
             // A hook function returned an error
             // show normal Edit page
             // remove Preview and Diff standard buttons from editor page
             Hooks::register('EditPageBeforeEditButtons', function (&$editor, &$buttons, &$tabindex) {
                 foreach (array_keys($buttons) as $key) {
                     if ($key !== 'save') {
                         unset($buttons[$key]);
                     }
                 }
             });
             // Context title needed for correct Cancel link
             $editor->setContextTitle($title);
             $editor->showEditForm();
             return false;
             // success
         // success
         case EditPage::AS_CONTENT_TOO_BIG:
             // Content too big (> $wgMaxArticleSize)
         // Content too big (> $wgMaxArticleSize)
         case EditPage::AS_ARTICLE_WAS_DELETED:
             // article was deleted while editting and param wpRecreate == false or form was not posted
         // article was deleted while editting and param wpRecreate == false or form was not posted
         case EditPage::AS_CONFLICT_DETECTED:
             // (non-resolvable) edit conflict
         // (non-resolvable) edit conflict
         case EditPage::AS_SUMMARY_NEEDED:
             // no edit summary given and the user has forceeditsummary set and the user is not editting in his own userspace or talkspace and wpIgnoreBlankSummary == false
         // no edit summary given and the user has forceeditsummary set and the user is not editting in his own userspace or talkspace and wpIgnoreBlankSummary == false
         case EditPage::AS_TEXTBOX_EMPTY:
             // user tried to create a new section without content
         // user tried to create a new section without content
         case EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED:
             // article is too big (> $wgMaxArticleSize), after merging in the new section
         // article is too big (> $wgMaxArticleSize), after merging in the new section
         case EditPage::AS_END:
             // WikiPage::doEdit() was unsuccessfull
             throw new MWException(wfMessage('sf_autoedit_fail', $this->mOptions['target'])->parse());
         case EditPage::AS_HOOK_ERROR:
             // Article update aborted by a hook function
             $this->logMessage('Article update aborted by a hook function', self::DEBUG);
             return false;
             // success
             // TODO: This error code only exists from 1.21 onwards. It is
             // suitably handled by the default branch, but really should get its
             // own branch. Uncomment once compatibility to pre1.21 is dropped.
             //			case EditPage::AS_PARSE_ERROR: // can't parse content
             //
             //				throw new MWException( $status->getHTML() );
             //				return true; // fail
         // success
         // TODO: This error code only exists from 1.21 onwards. It is
         // suitably handled by the default branch, but really should get its
         // own branch. Uncomment once compatibility to pre1.21 is dropped.
         //			case EditPage::AS_PARSE_ERROR: // can't parse content
         //
         //				throw new MWException( $status->getHTML() );
         //				return true; // fail
         case EditPage::AS_SUCCESS_NEW_ARTICLE:
             // Article successfully created
             $query = $resultDetails['redirect'] ? 'redirect=no' : '';
             $anchor = isset($resultDetails['sectionanchor']) ? $resultDetails['sectionanchor'] : '';
             $this->getOutput()->redirect($title->getFullURL($query) . $anchor);
             $this->getResult()->addValue(NULL, 'redirect', $title->getFullURL($query) . $anchor);
             return false;
             // success
//.........这里部分代码省略.........
开发者ID:paladox,项目名称:mediawiki-extensions-SemanticForms,代码行数:101,代码来源:SF_AutoeditAPI.php

示例9: validateScript

    /**
     * @param EditPage $editor
     * @param string $text
     * @param string $error
     * @param string $summary
     * @return bool
     */
    public static function validateScript(EditPage $editor, $text, &$error, $summary)
    {
        global $wgOut;
        $title = $editor->getTitle();
        if (!$title->hasContentModel(CONTENT_MODEL_SCRIBUNTO)) {
            return true;
        }
        $engine = Scribunto::newDefaultEngine();
        $engine->setTitle($title);
        $status = $engine->validate($text, $title->getPrefixedDBkey());
        if ($status->isOK()) {
            return true;
        }
        $errmsg = $status->getWikiText('scribunto-error-short', 'scribunto-error-long');
        $error = <<<WIKI
<div class="errorbox">
{$errmsg}
</div>
<br clear="all" />
WIKI;
        if (isset($status->scribunto_error->params['module'])) {
            $module = $status->scribunto_error->params['module'];
            $line = $status->scribunto_error->params['line'];
            if ($module === $title->getPrefixedDBkey() && preg_match('/^\\d+$/', $line)) {
                $wgOut->addInlineScript('window.location.hash = ' . Xml::encodeJsVar("#mw-ce-l{$line}"));
            }
        }
        return true;
    }
开发者ID:sammykumar,项目名称:TheVRForums,代码行数:36,代码来源:Hooks.php


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