MediaWiki  1.28.0
EditPage Class Reference

The edit page/HTML interface (split from Article) The actual database and text munging is still in Article, but it should get easier to call those from alternate interfaces. More...

Collaboration diagram for EditPage:

Public Member Functions

 __construct (Article $article)
 
 attemptSave (&$resultDetails=false)
 Attempt submission. More...
 
 edit ()
 This is the function that gets called for "action=edit". More...
 
 getArticle ()
 
 getBaseRevision ()
 
 getCancelLink ()
 
 getCheckboxes (&$tabindex, $checked)
 Returns an array of html code of the following checkboxes: minor and watch. More...
 
 getContext ()
 
 getContextTitle ()
 Get the context title object. More...
 
 getEditButtons (&$tabindex)
 Returns an array of html code of the following buttons: save, diff, preview and live. More...
 
 getParentRevId ()
 Get the edit's parent revision ID. More...
 
 getPreviewText ()
 Get the rendered text for previewing. More...
 
 getSummaryInput ($summary="", $labelText=null, $inputAttrs=null, $spanLabelAttrs=null)
 Standard summary input and label (wgSummary), abstracted so EditPage subclasses may reorganize the form. More...
 
 getTemplates ()
 
 getTitle ()
 
 importFormData (&$request)
 This function collects the form data and uses it to populate various member variables. More...
 
 initialiseForm ()
 Initialise form fields in the object Called on the first invocation, e.g. More...
 
 internalAttemptSave (&$result, $bot=false)
 Attempt submission (no UI) More...
 
 isSupportedContentModel ($modelId)
 Returns if the given content model is editable. More...
 
 noSuchSectionPage ()
 Creates a basic error page which informs the user that they have attempted to edit a nonexistent section. More...
 
 setApiEditOverride ($enableOverride)
 Allow editing of content that supports API direct editing, but not general direct editing. More...
 
 setContextTitle ($title)
 Set the context Title object. More...
 
 setHeaders ()
 
 setPreloadedContent (Content $content)
 Use this method before edit() to preload some content into the edit box. More...
 
 showDiff ()
 Get a diff between the current contents of the edit box and the version of the page we're editing from. More...
 
 showEditForm ($formCallback=null)
 Send the edit form and related headers to $wgOut. More...
 
 spamPageWithContent ($match=false)
 Show "your edit contains spam" page with your diff and text. More...
 
 submit ()
 
 tokenOk (&$request)
 Make sure the form isn't faking a user's credentials. More...
 

Static Public Member Functions

static extractSectionTitle ($text)
 Extract the section title from current section text, if any. More...
 
static getCopyrightWarning ($title, $format= 'plain', $langcode=null)
 Get the copyright warning, by default returns wikitext. More...
 
static getEditToolbar ($title=null)
 Shows a bulletin board style toolbar for common editing functions. More...
 
static getPreviewLimitReport ($output)
 Get the Limit report for page previews. More...
 
static matchSpamRegex ($text)
 Check given input text against $wgSpamRegex, and return the text of the first match. More...
 
static matchSummarySpamRegex ($text)
 Check given input text against $wgSummarySpamRegex, and return the text of the first match. More...
 

Public Attributes

string $action = 'submit'
 
bool $allowBlankSummary = false
 
string $autoSumm = ''
 
bool $bot = true
 
null string $contentFormat = null
 
null string $contentModel = null
 
bool $deletedSinceEdit
 
 $didSave = false
 
bool $diff = false
 
string $editFormPageTop = ''
 Before even the preview. More...
 
 $editFormTextAfterContent = ''
 
 $editFormTextAfterTools = ''
 
 $editFormTextAfterWarn = ''
 
 $editFormTextBeforeContent = ''
 
 $editFormTextBottom = ''
 
 $editFormTextTop = ''
 
string $editintro = ''
 
string $edittime = ''
 
bool $firsttime
 
string $formtype
 
bool $hasPresetSummary = false
 Has a summary been preset using GET parameter &summary= ? More...
 
string $hookError = ''
 
bool $incompleteForm = false
 
bool $isConflict = false
 
bool $isCssJsSubpage = false
 
bool $isCssSubpage = false
 
bool $isJsSubpage = false
 
bool $isNew = false
 New page or new section. More...
 
bool $isWrongCaseCssJsPage = false
 
bool stdClass $lastDelete
 
Article $mArticle
 
bool $mBaseRevision = false
 
bool $minoredit = false
 
bool $missingComment = false
 
bool $missingSummary = false
 
ParserOutput $mParserOutput
 
 $mPreloadContent = null
 
bool $mShowSummaryField = true
 
Title $mTitle
 
bool $mTokenOk = false
 
bool $mTokenOkExceptSuffix = false
 
bool $mTriedSave = false
 
bool $nosummary = false
 
int $oldid = 0
 
int $parentRevId = 0
 
bool $preview = false
 
 $previewTextAfterContent = ''
 
bool $recreate = false
 
bool $save = false
 
null $scrolltop = null
 
string $section = ''
 
string $sectiontitle = ''
 
string $starttime = ''
 
string $summary = ''
 
 $suppressIntro = false
 
string $textbox1 = ''
 
string $textbox2 = ''
 
bool $tooBig = false
 
 $undidRev = 0
 
bool $watchthis = false
 
const AS_ARTICLE_WAS_DELETED = 222
 Status: article was deleted while editing and param wpRecreate == false or form was not posted. More...
 
const AS_BLANK_ARTICLE = 224
 Status: user tried to create a blank page and wpIgnoreBlankArticle == false. More...
 
const AS_BLOCKED_PAGE_FOR_USER = 215
 Status: User is blocked from editing this page. More...
 
const AS_CANNOT_USE_CUSTOM_MODEL = 241
 Status: when changing the content model is disallowed due to $wgContentHandlerUseDB being false. More...
 
const AS_CHANGE_TAG_ERROR = 237
 Status: an error relating to change tagging. More...
 
const AS_CONFLICT_DETECTED = 225
 Status: (non-resolvable) edit conflict. More...
 
const AS_CONTENT_TOO_BIG = 216
 Status: Content too big (> $wgMaxArticleSize) More...
 
const AS_END = 231
 Status: WikiPage::doEdit() was unsuccessful. More...
 
const AS_HOOK_ERROR = 210
 Status: Article update aborted by a hook function. More...
 
const AS_HOOK_ERROR_EXPECTED = 212
 Status: A hook function returned an error. More...
 
const AS_IMAGE_REDIRECT_ANON = 233
 Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false) More...
 
const AS_IMAGE_REDIRECT_LOGGED = 234
 Status: logged in user is not allowed to upload (User::isAllowed('upload') == false) More...
 
const AS_MAX_ARTICLE_SIZE_EXCEEDED = 229
 Status: article is too big (> $wgMaxArticleSize), after merging in the new section. More...
 
const AS_NO_CHANGE_CONTENT_MODEL = 235
 Status: user tried to modify the content model, but is not allowed to do that ( User::isAllowed('editcontentmodel') == false ) More...
 
const AS_NO_CREATE_PERMISSION = 223
 Status: user tried to create this page, but is not allowed to do that ( Title->userCan('create') == false ) More...
 
const AS_PARSE_ERROR = 240
 Status: can't parse content. More...
 
const AS_RATE_LIMITED = 221
 Status: rate limiter for action 'edit' was tripped. More...
 
const AS_READ_ONLY_PAGE = 220
 Status: wiki is in readonly mode (wfReadOnly() == true) More...
 
const AS_READ_ONLY_PAGE_ANON = 218
 Status: this anonymous user is not allowed to edit this page. More...
 
const AS_READ_ONLY_PAGE_LOGGED = 219
 Status: this logged in user is not allowed to edit this page. More...
 
const AS_SELF_REDIRECT = 236
 Status: user tried to create self-redirect (redirect to the same article) and wpIgnoreSelfRedirect == false. More...
 
const AS_SPAM_ERROR = 232
 Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex. More...
 
const AS_SUCCESS_NEW_ARTICLE = 201
 Status: Article successfully created. More...
 
const AS_SUCCESS_UPDATE = 200
 Status: Article successfully updated. More...
 
const AS_SUMMARY_NEEDED = 226
 Status: no edit summary given and the user has forceeditsummary set and the user is not editing in his own userspace or talkspace and wpIgnoreBlankSummary == false. More...
 
const AS_TEXTBOX_EMPTY = 228
 Status: user tried to create a new section without content. More...
 
const EDITFORM_ID = 'editform'
 HTML id and name for the beginning of the edit form. More...
 
const POST_EDIT_COOKIE_DURATION = 1200
 Duration of PostEdit cookie, in seconds. More...
 
const POST_EDIT_COOKIE_KEY_PREFIX = 'PostEditRevision'
 Prefix of key for cookie used to pass post-edit state. More...
 

Protected Member Functions

 addContentModelChangeLogEntry (User $user, $oldModel, $newModel, $reason)
 
 displayPermissionsError (array $permErrors)
 Display a permissions error page, like OutputPage::showPermissionsErrorPage(), but with the following differences: More...
 
 displayPreviewArea ($previewOutput, $isOnTop=false)
 
 displayViewSourcePage (Content $content, $errorMessage= '')
 Display a read-only View Source page. More...
 
 doPreviewParse (Content $content)
 Parse the page for a preview. More...
 
 getActionURL (Title $title)
 Returns the URL to use in the form's action attribute. More...
 
 getContentObject ($def_content=null)
 
 getCopywarn ()
 Get the copyright warning. More...
 
 getCurrentContent ()
 Get the current content of the page. More...
 
 getEditPermissionErrors ($rigor= 'secure')
 
 getLastDelete ()
 
 getPreloadedContent ($preload, $params=[])
 Get the contents to be preloaded into the box, either set by an earlier setPreloadText() or by loading the given page. More...
 
 getPreviewParserOptions ()
 Get parser options for a preview. More...
 
 getSummaryPreview ($isSubjectPreview, $summary="")
 
 importContentFormData (&$request)
 Subpage overridable method for extracting the page content data from the posted form to be placed in $this->textbox1, if using customized input this method should be overridden and return the page text that will be used for saving, preview parsing and so on... More...
 
 isSectionEditSupported ()
 Returns whether section editing is supported for the current page. More...
 
 isWrongCaseCssJsPage ()
 Checks whether the user entered a skin name in uppercase, e.g. More...
 
 makeTemplatesOnThisPageList (array $templates)
 Wrapper around TemplatesOnThisPageFormatter to make a "templates on this page" list. More...
 
 previewOnOpen ()
 Should we show a preview when the edit form is first shown? More...
 
 runPostMergeFilters (Content $content, Status $status, User $user)
 Run hooks that can filter edits just before they get saved. More...
 
 safeUnicodeInput ($request, $field)
 Filter an input field through a Unicode de-armoring process if it came from an old browser with known broken Unicode editing issues. More...
 
 safeUnicodeOutput ($text)
 Filter an output field through a Unicode armoring process if it is going to an old browser with known broken Unicode editing issues. More...
 
 setPostEditCookie ($statusValue)
 Sets post-edit cookie indicating the user just saved a particular revision. More...
 
 showConflict ()
 Show an edit conflict. More...
 
 showContentForm ()
 Subpage overridable method for printing the form for page content editing By default this simply outputs wpTextbox1 Subclasses can override this to provide a custom UI for editing; be it a form, or simply wpTextbox1 with a modified content that will be reverse modified when extracted from the post data. More...
 
 showCustomIntro ()
 Attempt to show a custom editing introduction, if supplied. More...
 
 showEditTools ()
 
 showFormAfterText ()
 
 showFormBeforeText ()
 
 showHeader ()
 
 showHeaderCopyrightWarning ()
 Show the header copyright warning. More...
 
 showIntro ()
 Show all applicable editing introductions. More...
 
 showPreview ($text)
 Append preview output to $wgOut. More...
 
 showStandardInputs (&$tabindex=2)
 
 showSummaryInput ($isSubjectPreview, $summary="")
 
 showTextbox ($text, $name, $customAttribs=[])
 
 showTextbox1 ($customAttribs=null, $textoverride=null)
 Method to output wpTextbox1 The $textoverride method can be used by subclasses overriding showContentForm to pass back to this method. More...
 
 showTextbox2 ()
 
 showTosSummary ()
 Give a chance for site and per-namespace customizations of terms of service summary link that might exist separately from the copyright notice. More...
 
 toEditContent ($text)
 Turns the given text into a Content object by unserializing it. More...
 
 toEditText ($content)
 Gets an editable textual representation of $content. More...
 
 updateWatchlist ()
 Register the change of watch status. More...
 
 wasDeletedSinceLastEdit ()
 Check if a page was deleted while the user was editing it, before submit. More...
 

Static Protected Member Functions

static matchSpamRegexInternal ($text, $regexes)
 

Protected Attributes

bool $allowBlankArticle = false
 
bool $allowSelfRedirect = false
 
bool $blankArticle = false
 
bool int $contentLength = false
 
IContextSource $context
 
bool $edit
 
bool $selfRedirect = false
 

Private Member Functions

 checkUnicodeCompliantBrowser ()
 Check if the browser is on a blacklist of user-agents known to mangle UTF-8 data on form submission. More...
 
 getOriginalContent (User $user)
 Get the content of the wanted revision, without section extraction. More...
 
 handleStatus (Status $status, $resultDetails)
 Handle status, such as after attempt save. More...
 
 makeSafe ($invalue)
 A number of web browsers are known to corrupt non-ASCII characters in a UTF-8 text editing environment. More...
 
 mergeChangesIntoContent (&$editContent)
 Attempts to do 3-way merge of edit content with a base revision and current content, in case of edit conflict, in whichever way appropriate for the content type. More...
 
 newSectionSummary (&$sectionanchor=null)
 Return the summary to be used for a new section. More...
 
 unmakeSafe ($invalue)
 Reverse the previously applied transliteration of non-ASCII characters back to UTF-8. More...
 

Private Attributes

null array $changeTags = null
 
integer $editRevId = null
 
bool $enableApiEditOverride = false
 Set in ApiEditPage, based on ContentHandler::allowsDirectApiEditing. More...
 
null Title $mContextTitle = null
 
WikiPage $page
 

Detailed Description

The edit page/HTML interface (split from Article) The actual database and text munging is still in Article, but it should get easier to call those from alternate interfaces.

EditPage cares about two distinct titles: $this->mContextTitle is the page that forms submit to, links point to, redirects go to, etc. $this->mTitle (as well as $mArticle) is the page in the database that is actually being edited. These are usually the same, but they are now allowed to be different.

Surgeon General's Warning: prolonged exposure to this class is known to cause headaches, which may be fatal.

Definition at line 42 of file EditPage.php.

Constructor & Destructor Documentation

EditPage::__construct ( Article  $article)

Member Function Documentation

EditPage::addContentModelChangeLogEntry ( User  $user,
  $oldModel,
  $newModel,
  $reason 
)
protected
Parameters
User$user
string | false$oldModelfalse if the page is being newly created
string$newModel
string$reason

Definition at line 2187 of file EditPage.php.

Referenced by internalAttemptSave().

EditPage::attemptSave ( $resultDetails = false)

Attempt submission.

Parameters
array | bool$resultDetailsSee docs for $result in internalAttemptSave
Exceptions
UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError
Returns
Status The resulting status object.

Definition at line 1462 of file EditPage.php.

References $bot, $status, $wgUser, global, internalAttemptSave(), and Hooks\run().

Referenced by edit().

EditPage::checkUnicodeCompliantBrowser ( )
private

Check if the browser is on a blacklist of user-agents known to mangle UTF-8 data on form submission.

Returns true if Unicode should make it through, false if it's known to be a problem.

Returns
bool

Definition at line 4275 of file EditPage.php.

References $wgBrowserBlackList, $wgRequest, as, and global.

Referenced by safeUnicodeOutput(), showFormBeforeText(), and showHeader().

EditPage::displayPermissionsError ( array  $permErrors)
protected

Display a permissions error page, like OutputPage::showPermissionsErrorPage(), but with the following differences:

  • If redlink=1, the user will be redirected to the page
  • If there is content to display or the error occurs while either saving, previewing or showing the difference, it will be a "View source for ..." page displaying the source code after the error message.
Since
1.19
Parameters
array$permErrorsArray of permissions errors, as returned by Title::getUserPermissionsErrors().
Exceptions
PermissionsError

Definition at line 682 of file EditPage.php.

References $content, $wgOut, $wgRequest, displayViewSourcePage(), getContentObject(), and global.

Referenced by edit().

EditPage::displayPreviewArea (   $previewOutput,
  $isOnTop = false 
)
protected

Definition at line 3333 of file EditPage.php.

References $attribs, $wgOut, global, Xml\openElement(), Html\rawElement(), showDiff(), and showPreview().

Referenced by showEditForm().

EditPage::displayViewSourcePage ( Content  $content,
  $errorMessage = '' 
)
protected

Display a read-only View Source page.

Parameters
Content$contentcontent object
string$errorMessageadditional wikitext error message to display

Definition at line 713 of file EditPage.php.

References $e, $textbox1, $wgOut, getContextTitle(), getTemplates(), global, makeTemplatesOnThisPageList(), Hooks\run(), Content\serialize(), showTextbox(), and toEditText().

Referenced by displayPermissionsError(), and edit().

EditPage::doPreviewParse ( Content  $content)
protected

Parse the page for a preview.

Subclasses may override this class, in order to parse with different options, or to otherwise modify the preview HTML.

Parameters
Content$contentThe page content
Returns
array with keys:
  • parserOutput: The ParserOutput object
  • html: The HTML to be displayed

Definition at line 3937 of file EditPage.php.

References $parserOutput, $wgUser, getPreviewParserOptions(), global, and Content\preSaveTransform().

Referenced by getPreviewText().

EditPage::edit ( )

This is the function that gets called for "action=edit".

It sets up various member variables, then passes execution to another function, usually showEditForm()

The edit form is self-submitting, so that when things like preview and edit conflicts occur, we get the same form back with the extra stuff added. Only when the final submission is made and all is well do we actually save and redirect to the newly-edited page.

Definition at line 511 of file EditPage.php.

References $contentModel, $status, $user, $wgOut, $wgRequest, $wgUser, DeferredUpdates\addCallableUpdate(), attemptSave(), diff, displayPermissionsError(), displayViewSourcePage(), First, getContentObject(), getEditPermissionErrors(), global, handleStatus(), importFormData(), initialiseForm(), isWrongCaseCssJsPage(), Revision\newFromId(), noSuchSectionPage(), plain, previewOnOpen(), Hooks\run(), save, showEditForm(), showIntro(), use, wfDebug(), and wfReadOnly().

Referenced by importFormData(), and submit().

static EditPage::extractSectionTitle (   $text)
static

Extract the section title from current section text, if any.

Parameters
string$text
Returns
string|bool String or false

Definition at line 2846 of file EditPage.php.

References $matches, $wgParser, and global.

Referenced by EditPageTest\testExtractSectionTitle().

EditPage::getActionURL ( Title  $title)
protected

Returns the URL to use in the form's action attribute.

This is used by EditPage subclasses when simply customizing the action variable in the constructor is not enough. This can be used when the EditPage lives inside of a Special page rather than a custom page action.

Parameters
Title$titleTitle object for which is being edited (where we go to for &action= links)
Returns
string

Definition at line 3699 of file EditPage.php.

References Title\getLocalURL().

Referenced by showEditForm().

EditPage::getArticle ( )
Returns
Article

Definition at line 429 of file EditPage.php.

References $mArticle.

EditPage::getBaseRevision ( )
Note
: this method is very poorly named. If the user opened the form with ?oldid=X, one might think of X as the "base revision", which is NOT what this returns.
Returns
Revision Current version when the edit was started

Definition at line 2273 of file EditPage.php.

References $mBaseRevision, DB_MASTER, Revision\loadFromTimestamp(), Revision\newFromId(), and wfGetDB().

Referenced by mergeChangesIntoContent().

EditPage::getCancelLink ( )
Returns
string

Definition at line 3673 of file EditPage.php.

References $oldid, Html\buttonAttributes(), getContextTitle(), and Linker\linkKnown().

Referenced by showStandardInputs().

EditPage::getCheckboxes ( $tabindex,
  $checked 
)

Returns an array of html code of the following checkboxes: minor and watch.

Parameters
int$tabindexCurrent tabindex
array$checkedArray of checkbox => bool, where bool indicates the checked status of the checkbox
Returns
array

Definition at line 4117 of file EditPage.php.

References $attribs, $tabindex, $wgUseMediaWikiUIEverywhere, $wgUser, Xml\check(), Html\closeElement(), Xml\expandAttributes(), global, Html\openElement(), Hooks\run(), and Linker\titleAttrib().

Referenced by showStandardInputs().

EditPage::getContentObject (   $def_content = null)
protected
Parameters
Content | null$def_contentThe default value to return
Returns
Content|null Content on success, $def_content for invalid sections
Since
1.21

Definition at line 1102 of file EditPage.php.

References $content, $params, $summary, $wgContLang, $wgOut, $wgRequest, $wgUser, Revision\DELETED_TEXT, getOriginalContent(), getPreloadedContent(), global, Revision\newFromId(), ParserOptions\newFromUserAndLang(), NS_MEDIAWIKI, page, Revision\RAW, toEditContent(), and true.

Referenced by displayPermissionsError(), edit(), and initialiseForm().

EditPage::getContext ( )
Since
1.28
Returns
IContextSource

Definition at line 437 of file EditPage.php.

References $context.

EditPage::getContextTitle ( )

Get the context title object.

If not set, $wgTitle will be returned. This behavior might change in the future to return $this->mTitle instead.

Returns
Title

Definition at line 465 of file EditPage.php.

References $mContextTitle, $wgTitle, and global.

Referenced by displayViewSourcePage(), getCancelLink(), setHeaders(), showEditForm(), and spamPageWithContent().

static EditPage::getCopyrightWarning (   $title,
  $format = 'plain',
  $langcode = null 
)
static

Get the copyright warning, by default returns wikitext.

Parameters
Title$title
string$formatOutput format, valid values are any function of a Message object
Returns
string

Definition at line 3517 of file EditPage.php.

References $title, global, Hooks\run(), and wfMessage().

EditPage::getCopywarn ( )
protected

Get the copyright warning.

Renamed to getCopyrightWarning(), old name kept around for backwards compatibility

Returns
string

Definition at line 3506 of file EditPage.php.

Referenced by showStandardInputs().

EditPage::getCurrentContent ( )
protected

Get the current content of the page.

This is basically similar to WikiPage::getContent( Revision::RAW ) except that when the page doesn't exist an empty content object is returned instead of null.

Since
1.21
Returns
Content

Definition at line 1286 of file EditPage.php.

References $content, $handler, $rev, ContentHandler\getForModelID(), getTitle(), page, and Revision\RAW.

Referenced by getOriginalContent(), internalAttemptSave(), showDiff(), and showEditForm().

EditPage::getEditButtons ( $tabindex)

Returns an array of html code of the following buttons: save, diff, preview and live.

Parameters
int$tabindexCurrent tabindex
Returns
array

Definition at line 4181 of file EditPage.php.

References $attribs, $tabindex, Hooks\run(), Html\submitButton(), and Linker\tooltipAndAccesskeyAttribs().

Referenced by showStandardInputs().

EditPage::getEditPermissionErrors (   $rigor = 'secure')
protected
Parameters
string$rigorSame format as Title::getUserPermissionErrors()
Returns
array

Definition at line 641 of file EditPage.php.

References $wgUser, as, diff, global, and wfArrayDiff2().

Referenced by edit().

static EditPage::getEditToolbar (   $title = null)
static

Shows a bulletin board style toolbar for common editing functions.

It can be disabled in the user preferences.

Parameters
Title$titleTitle object for the page being edited (optional)
Returns
string

Definition at line 3978 of file EditPage.php.

References $params, $title, $wgContLang, $wgEnableUploads, $wgForeignFileRepos, $wgOut, as, Xml\encodeJsCall(), global, ResourceLoader\inDebugMode(), ResourceLoader\makeInlineScript(), NS_FILE, NS_MEDIA, Hooks\run(), MWNamespace\wantSignatures(), and wfMessage().

Referenced by showEditForm().

EditPage::getLastDelete ( )
protected
Returns
bool|stdClass

Definition at line 3733 of file EditPage.php.

References $dbr, DB_REPLICA, LogPage\DELETED_COMMENT, LogPage\DELETED_USER, and wfGetDB().

Referenced by wasDeletedSinceLastEdit().

EditPage::getOriginalContent ( User  $user)
private

Get the content of the wanted revision, without section extraction.

The result of this function can be used to compare user's input with section replaced in its context (using WikiPage::replaceSectionAtRev()) to the original text of the edit.

This differs from Article::getContent() that when a missing revision is encountered the result will be null and not the 'missing-revision' message.

Since
1.19
Parameters
User$userThe user to get the revision for
Returns
Content|null

Definition at line 1241 of file EditPage.php.

References $content, $handler, Revision\FOR_THIS_USER, getCurrentContent(), ContentHandler\getForModelID(), and getTitle().

Referenced by getContentObject().

EditPage::getParentRevId ( )

Get the edit's parent revision ID.

The "parent" revision is the ancestor that should be recorded in this page's revision history. It is either the revision ID of the in-memory article content, or in the case of a 3-way merge in order to rebase across a recoverable edit conflict, the ID of the newer revision to which we have rebased this page.

Since
1.27
Returns
int Revision ID

Definition at line 1270 of file EditPage.php.

References $parentRevId.

Referenced by showEditForm().

EditPage::getPreloadedContent (   $preload,
  $params = [] 
)
protected

Get the contents to be preloaded into the box, either set by an earlier setPreloadText() or by loading the given page.

Parameters
string$preloadRepresenting the title to preload from.
array$paramsParameters to use (interface-message style) in the preloaded text
Returns
Content
Since
1.21

Definition at line 1351 of file EditPage.php.

References $content, $handler, $mPreloadContent, $params, $title, $wgUser, WikiPage\factory(), WikiPage\getContent(), ContentHandler\getForModelID(), WikiPage\getRedirectTarget(), global, WikiPage\isRedirect(), Title\newFromText(), ParserOptions\newFromUser(), Revision\RAW, and wfDebug().

Referenced by getContentObject().

static EditPage::getPreviewLimitReport (   $output)
static

Get the Limit report for page previews.

Since
1.22
Parameters
ParserOutput$outputParserOutput object from the parse
Returns
string HTML

Definition at line 3545 of file EditPage.php.

References $output, $value, as, Html\closeElement(), ParserOutput\getLimitReportData(), Html\openElement(), Html\rawElement(), Hooks\run(), and wfMessage().

Referenced by ApiParse\execute().

EditPage::getPreviewParserOptions ( )
protected

Get parser options for a preview.

Returns
ParserOptions

Definition at line 3920 of file EditPage.php.

References page.

Referenced by doPreviewParse().

EditPage::getPreviewText ( )
EditPage::getSummaryInput (   $summary = "",
  $labelText = null,
  $inputAttrs = null,
  $spanLabelAttrs = null 
)

Standard summary input and label (wgSummary), abstracted so EditPage subclasses may reorganize the form.

Note that you do not need to worry about the label's for=, it will be inferred by the id given to the input. You can remove them both by passing [ 'id' => false ] to $userInputAttrs.

Parameters
string$summaryThe value of the summary input
string$labelTextThe html to place inside the label
array$inputAttrsArray of attrs to use on the input
array$spanLabelAttrsArray of attrs to use on the span inside the label
Returns
array An array in the format [ $label, $input ]

Definition at line 3097 of file EditPage.php.

References Html\input(), Xml\tags(), and Linker\tooltipAndAccesskeyAttribs().

Referenced by showSummaryInput().

EditPage::getSummaryPreview (   $isSubjectPreview,
  $summary = "" 
)
protected
Parameters
bool$isSubjectPreviewTrue if this is the section subject/title up top, or false if this is the comment summary down below the textarea
string$summaryThe text of the summary to display
Returns
string

Definition at line 3165 of file EditPage.php.

References $wgParser, Linker\commentBlock(), diff, global, and Xml\tags().

Referenced by showEditForm(), and showStandardInputs().

EditPage::getTemplates ( )
Returns
array

Definition at line 3954 of file EditPage.php.

References $template, as, and Title\makeTitle().

Referenced by displayViewSourcePage(), and showEditForm().

EditPage::getTitle ( )
Since
1.19
Returns
Title

Definition at line 445 of file EditPage.php.

References $mTitle.

Referenced by getCurrentContent(), getOriginalContent(), internalAttemptSave(), showHeader(), and toEditContent().

EditPage::handleStatus ( Status  $status,
  $resultDetails 
)
private

Handle status, such as after attempt save.

Parameters
Status$status
array | bool$resultDetails
Exceptions
ErrorPageError
Returns
bool False, if output is done, true if rest of the form should be displayed

Definition at line 1483 of file EditPage.php.

References $query, $request, $wgOut, $wgUser, RequestContext\getMain(), Status\getWikiText(), global, Hooks\run(), setPostEditCookie(), and spamPageWithContent().

Referenced by edit().

EditPage::importContentFormData ( $request)
protected

Subpage overridable method for extracting the page content data from the posted form to be placed in $this->textbox1, if using customized input this method should be overridden and return the page text that will be used for saving, preview parsing and so on...

Parameters
WebRequest$request
Returns
string|null

Definition at line 1054 of file EditPage.php.

Referenced by importFormData().

EditPage::importFormData ( $request)

This function collects the form data and uses it to populate various member variables.

Parameters
WebRequest$request
Exceptions
ErrorPageError

Definition at line 831 of file EditPage.php.

References $diff, $e, $handler, $preview, $request, $textbox1, $undidRev, $wgContLang, $wgUser, diff, edit(), ContentHandler\getForModelID(), ContentHandler\getLocalizedName(), global, importContentFormData(), isSectionEditSupported(), NS_USER, NS_USER_TALK, Hooks\run(), safeUnicodeInput(), save, tokenOk(), wfDebug(), and wfTimestampNow().

Referenced by edit().

EditPage::initialiseForm ( )

Initialise form fields in the object Called on the first invocation, e.g.

when a user clicks an edit link

Returns
bool If the requested section is valid

Definition at line 1063 of file EditPage.php.

References $content, $isNew, $wgUser, content, getContentObject(), global, page, and toEditText().

Referenced by edit().

EditPage::internalAttemptSave ( $result,
  $bot = false 
)

Attempt submission (no UI)

Parameters
array$resultArray to add statuses to, currently with the possible keys:
  • spam (string): Spam string from content if any spam is detected by matchSpamRegex.
  • sectionanchor (string): Section anchor for a section save.
  • nullEdit (boolean): Set if doEditContent is OK. True if null edit, false otherwise.
  • redirect (bool): Set if doEditContent is OK. True if resulting revision is a redirect.
bool$botTrue if edit is being made under the bot right.
Returns
Status Status object, possibly with a message, but always with one of the AS_* constants in $status->value,
Todo:
FIXME: This interface is TERRIBLE, but hard to get rid of due to various error display idiosyncrasies. There are also lots of cases where error metadata is set in the object and retrieved later instead of being returned, e.g. AS_CONTENT_TOO_BIG and AS_BLOCKED_PAGE_FOR_USER. All that stuff needs to be cleaned up some time.

Definition at line 1717 of file EditPage.php.

References $autoSumm, $changeTags, $code, $content, $edittime, $flags, $matches, $mTitle, $sectiontitle, $status, $summary, $timestamp, $wgMaxArticleSize, $wgParser, $wgRequest, $wgUser, addContentModelChangeLogEntry(), ChangeTags\canAddTagsAccompanyingChange(), DB_MASTER, EDIT_AUTOSUMMARY, EDIT_FORCE_BOT, EDIT_MINOR, EDIT_NEW, EDIT_UPDATE, etc, false, ContentHandler\getContentText(), getCurrentContent(), getTitle(), global, mergeChangesIntoContent(), StatusValue\newGood(), newSectionSummary(), not, NS_FILE, NS_MEDIAWIKI, of, page, Hooks\run(), runPostMergeFilters(), Title\setContentModel(), toEditContent(), toEditText(), updateWatchlist(), Revision\userWasLastToEdit(), wasDeletedSinceLastEdit(), wfDebug(), wfDebugLog(), and wfReadOnly().

Referenced by attemptSave().

EditPage::isSectionEditSupported ( )
protected

Returns whether section editing is supported for the current page.

Subclasses may override this to replace the default behavior, which is to check ContentHandler::supportsSections.

Returns
bool True if this edit page supports sections, false otherwise.

Definition at line 821 of file EditPage.php.

References ContentHandler\getForTitle().

Referenced by importFormData(), and showHeader().

EditPage::isSupportedContentModel (   $modelId)

Returns if the given content model is editable.

Parameters
string$modelIdThe ID of the content model to test. Use CONTENT_MODEL_XXX constants.
Returns
bool
Exceptions
MWExceptionIf $modelId has no known handler

Definition at line 481 of file EditPage.php.

References ContentHandler\getForModelID().

Referenced by toEditContent(), and toEditText().

EditPage::isWrongCaseCssJsPage ( )
protected

Checks whether the user entered a skin name in uppercase, e.g.

"User:Example/Monobook.css" instead of "monobook.css"

Returns
bool

Definition at line 800 of file EditPage.php.

References $name, and Skin\getSkinNames().

Referenced by edit(), and showHeader().

EditPage::makeSafe (   $invalue)
private

A number of web browsers are known to corrupt non-ASCII characters in a UTF-8 text editing environment.

To protect against this, detected browsers will be served an armored version of the text, with non-ASCII chars converted to numeric HTML character references.

Preexisting such character references will have a 0 added to them to ensure that round-trips do not alter the original data.

Parameters
string$invalue
Returns
string

Definition at line 4332 of file EditPage.php.

Referenced by safeUnicodeOutput().

EditPage::makeTemplatesOnThisPageList ( array  $templates)
protected

Wrapper around TemplatesOnThisPageFormatter to make a "templates on this page" list.

Parameters
Title[]$templates
Returns
string HTML

Definition at line 2821 of file EditPage.php.

References $type, and Html\rawElement().

Referenced by displayViewSourcePage(), and showEditForm().

static EditPage::matchSpamRegex (   $text)
static

Check given input text against $wgSpamRegex, and return the text of the first match.

Parameters
string$text
Returns
string|bool Matching string or false

Definition at line 2290 of file EditPage.php.

References array(), and global.

static EditPage::matchSpamRegexInternal (   $text,
  $regexes 
)
staticprotected
Parameters
string$text
array$regexes
Returns
bool|string

Definition at line 2315 of file EditPage.php.

References $matches, and as.

static EditPage::matchSummarySpamRegex (   $text)
static

Check given input text against $wgSummarySpamRegex, and return the text of the first match.

Parameters
string$text
Returns
string|bool Matching string or false

Definition at line 2304 of file EditPage.php.

References array(), and global.

Referenced by MovePage\checkPermissions(), MergeHistory\checkPermissions(), and SpecialChangeContentModel\getFormFields().

EditPage::mergeChangesIntoContent ( $editContent)
private

Attempts to do 3-way merge of edit content with a base revision and current content, in case of edit conflict, in whichever way appropriate for the content type.

Since
1.21
Parameters
Content$editContent
Returns
bool

Definition at line 2234 of file EditPage.php.

References $handler, DB_MASTER, getBaseRevision(), ContentHandler\getForModelID(), Revision\loadFromTitle(), and wfGetDB().

Referenced by internalAttemptSave().

EditPage::newSectionSummary ( $sectionanchor = null)
private

Return the summary to be used for a new section.

Parameters
string$sectionanchorSet to the section anchor text
Returns
string

Definition at line 1669 of file EditPage.php.

References $summary, $wgParser, and global.

Referenced by internalAttemptSave().

EditPage::noSuchSectionPage ( )

Creates a basic error page which informs the user that they have attempted to edit a nonexistent section.

Definition at line 4227 of file EditPage.php.

References $res, $wgOut, global, and Hooks\run().

Referenced by edit().

EditPage::previewOnOpen ( )
protected

Should we show a preview when the edit form is first shown?

Returns
bool

Definition at line 767 of file EditPage.php.

References $wgRequest, $wgUser, and global.

Referenced by edit().

EditPage::runPostMergeFilters ( Content  $content,
Status  $status,
User  $user 
)
protected

Run hooks that can filter edits just before they get saved.

Parameters
Content$contentThe Content to filter.
Status$statusFor reporting the outcome to the caller
User$userThe user performing the edit
Returns
bool

Definition at line 1614 of file EditPage.php.

References $content, $minoredit, $status, $summary, $user, StatusValue\fatal(), Hooks\run(), and ContentHandler\runLegacyHooks().

Referenced by internalAttemptSave().

EditPage::safeUnicodeInput (   $request,
  $field 
)
protected

Filter an input field through a Unicode de-armoring process if it came from an old browser with known broken Unicode editing issues.

Parameters
WebRequest$request
string$field
Returns
string

Definition at line 4300 of file EditPage.php.

References $request, and unmakeSafe().

Referenced by importFormData().

EditPage::safeUnicodeOutput (   $text)
protected

Filter an output field through a Unicode armoring process if it is going to an old browser with known broken Unicode editing issues.

Parameters
string$text
Returns
string

Definition at line 4314 of file EditPage.php.

References checkUnicodeCompliantBrowser(), and makeSafe().

Referenced by showTextbox().

EditPage::setApiEditOverride (   $enableOverride)

Allow editing of content that supports API direct editing, but not general direct editing.

Set to false by default.

Parameters
bool$enableOverride

Definition at line 492 of file EditPage.php.

EditPage::setContextTitle (   $title)

Set the context Title object.

Parameters
Title | null$titleTitle object or null

Definition at line 454 of file EditPage.php.

References $title.

EditPage::setHeaders ( )

Definition at line 2325 of file EditPage.php.

References $wgOut, $wgUser, false, getContextTitle(), global, and NS_MEDIAWIKI.

Referenced by showEditForm().

EditPage::setPostEditCookie (   $statusValue)
protected

Sets post-edit cookie indicating the user just saved a particular revision.

This uses a temporary cookie for each revision ID so separate saves will never interfere with each other.

The cookie is deleted in the mediawiki.action.view.postEdit JS module after the redirect. It must be clearable by JavaScript code, so it must not be marked HttpOnly. The JavaScript code converts the cookie to a wgPostEdit config variable.

If the variable were set on the server, it would be cached, which is unwanted since the post-edit state should only apply to the load right after the save.

Parameters
int$statusValueThe status value (to check for new article status)

Definition at line 1439 of file EditPage.php.

References $response, RequestContext\getMain(), and page.

Referenced by handleStatus().

EditPage::setPreloadedContent ( Content  $content)

Use this method before edit() to preload some content into the edit box.

Parameters
Content$content
Since
1.21

Definition at line 1336 of file EditPage.php.

References $content.

EditPage::showConflict ( )
protected

Show an edit conflict.

textbox1 is already shown in showEditForm(). If you want to use another entry point to this function, be careful.

Definition at line 3638 of file EditPage.php.

References $handler, $wgOut, ContentHandler\getForModelID(), global, NS_CATEGORY_TALK, NS_MAIN, Hooks\run(), showTextbox2(), and toEditContent().

Referenced by showEditForm().

EditPage::showContentForm ( )
protected

Subpage overridable method for printing the form for page content editing By default this simply outputs wpTextbox1 Subclasses can override this to provide a custom UI for editing; be it a form, or simply wpTextbox1 with a modified content that will be reverse modified when extracted from the post data.

Note that this is basically the inverse for importContentFormData

Definition at line 3229 of file EditPage.php.

References showTextbox1().

Referenced by showEditForm().

EditPage::showCustomIntro ( )
protected

Attempt to show a custom editing introduction, if supplied.

Returns
bool

Definition at line 2497 of file EditPage.php.

References $mTitle, $title, $wgOut, global, and Title\newFromText().

Referenced by showIntro().

EditPage::showDiff ( )

Get a diff between the current contents of the edit box and the version of the page we're editing from.

If this is a section edit, we'll replace the section as for final save and then make a comparison.

Definition at line 3402 of file EditPage.php.

References $wgContLang, $wgOut, $wgUser, getCurrentContent(), global, ParserOptions\newFromUserAndLang(), NS_MEDIAWIKI, page, Hooks\run(), ContentHandler\runLegacyHooks(), and toEditContent().

Referenced by displayPreviewArea(), and spamPageWithContent().

EditPage::showEditForm (   $formCallback = null)
EditPage::showEditTools ( )
protected

Definition at line 3493 of file EditPage.php.

References $wgOut, and global.

Referenced by showEditForm().

EditPage::showFormAfterText ( )
protected

Definition at line 3204 of file EditPage.php.

References $wgOut, $wgUser, global, and Html\hidden().

Referenced by showEditForm().

EditPage::showFormBeforeText ( )
protected

Definition at line 3187 of file EditPage.php.

References $wgOut, checkUnicodeCompliantBrowser(), global, Html\hidden(), name, and type.

Referenced by showEditForm().

EditPage::showHeaderCopyrightWarning ( )
protected

Show the header copyright warning.

Definition at line 3465 of file EditPage.php.

References $wgOut, and global.

Referenced by showHeader().

EditPage::showPreview (   $text)
protected

Append preview output to $wgOut.

Includes category rendering if this is a category page.

Parameters
string$textThe HTML to be output for the preview.

Definition at line 3381 of file EditPage.php.

References $wgOut, global, NS_CATEGORY, and Hooks\run().

Referenced by displayPreviewArea().

EditPage::showStandardInputs ( $tabindex = 2)
protected
EditPage::showSummaryInput (   $isSubjectPreview,
  $summary = "" 
)
protected
Parameters
bool$isSubjectPreviewTrue if this is the section subject/title up top, or false if this is the comment summary down below the textarea
string$summaryThe text of the summary to display

Definition at line 3135 of file EditPage.php.

References $wgOut, getSummaryInput(), global, and list.

Referenced by showEditForm(), and showStandardInputs().

EditPage::showTextbox (   $text,
  $name,
  $customAttribs = [] 
)
protected
EditPage::showTextbox1 (   $customAttribs = null,
  $textoverride = null 
)
protected

Method to output wpTextbox1 The $textoverride method can be used by subclasses overriding showContentForm to pass back to this method.

Parameters
array$customAttribsArray of html attributes to use in the textarea
string$textoverrideOptional text to override $this->textarea1 with

Definition at line 3241 of file EditPage.php.

References $attribs, $customAttribs, MWNamespace\getRestrictionLevels(), showTextbox(), and wasDeletedSinceLastEdit().

Referenced by showContentForm(), and showEditForm().

EditPage::showTextbox2 ( )
protected

Definition at line 3283 of file EditPage.php.

References showTextbox().

Referenced by showConflict(), and spamPageWithContent().

EditPage::showTosSummary ( )
protected

Give a chance for site and per-namespace customizations of terms of service summary link that might exist separately from the copyright notice.

This will display between the save button and the edit tools, so should remain short!

Definition at line 3482 of file EditPage.php.

References $wgOut, global, and Hooks\run().

Referenced by showEditForm().

EditPage::spamPageWithContent (   $match = false)

Show "your edit contains spam" page with your diff and text.

Parameters
string | array | bool$matchText (or array of texts) which triggered one or more filters

Definition at line 4244 of file EditPage.php.

References $textbox1, $wgLang, $wgOut, getContextTitle(), global, showDiff(), showTextbox2(), and wfEscapeWikiText().

Referenced by handleStatus().

EditPage::submit ( )

Definition at line 496 of file EditPage.php.

References edit().

EditPage::toEditContent (   $text)
protected

Turns the given text into a Content object by unserializing it.

If the resulting Content object is not of a type that can be edited using the text base EditPage, an exception will be raised. Set $this->allowNonTextContent to true to allow editing of non-textual content.

Parameters
string | null | bool$textText to unserialize
Returns
Content|bool|null The content object created from $text. If $text was false or null, false resp. null will be returned instead.
Exceptions
MWExceptionIf unserializing the text results in a Content object that is not an instance of TextContent and $this->allowNonTextContent is not true.

Definition at line 2559 of file EditPage.php.

References $content, getTitle(), isSupportedContentModel(), and ContentHandler\makeContent().

Referenced by getContentObject(), getPreviewText(), internalAttemptSave(), showConflict(), and showDiff().

EditPage::toEditText (   $content)
protected

Gets an editable textual representation of $content.

The textual representation can be turned by into a Content object by the toEditContent() method.

If $content is null or false or a string, $content is returned unchanged.

If the given Content object is not of a type that can be edited using the text base EditPage, an exception will be raised. Set $this->allowNonTextContent to true to allow editing of non-textual content.

Parameters
Content | null | bool | string$content
Returns
string The editable text form of the content.
Exceptions
MWExceptionIf $content is not an instance of TextContent and $this->allowNonTextContent is not true.

Definition at line 2531 of file EditPage.php.

References $content, and isSupportedContentModel().

Referenced by displayViewSourcePage(), initialiseForm(), internalAttemptSave(), and showEditForm().

EditPage::tokenOk ( $request)

Make sure the form isn't faking a user's credentials.

Parameters
WebRequest$request
Returns
bool
Access:
private

Definition at line 1415 of file EditPage.php.

References $mTokenOk, $request, $wgUser, and global.

Referenced by importFormData().

EditPage::unmakeSafe (   $invalue)
private

Reverse the previously applied transliteration of non-ASCII characters back to UTF-8.

Used to protect data from corruption by broken web browsers as listed in $wgBrowserBlackList.

Parameters
string$invalue
Returns
string

Definition at line 4374 of file EditPage.php.

References codepointToUtf8().

Referenced by safeUnicodeInput().

EditPage::updateWatchlist ( )
protected

Register the change of watch status.

Definition at line 2204 of file EditPage.php.

References $mTitle, $title, $user, $watchthis, $wgUser, DeferredUpdates\addCallableUpdate(), WatchAction\doWatchOrUnwatch(), global, User\IGNORE_USER_RIGHTS, and use.

Referenced by internalAttemptSave().

EditPage::wasDeletedSinceLastEdit ( )
protected

Check if a page was deleted while the user was editing it, before submit.

Note that we rely on the logging table, which hasn't been always there, but that doesn't matter, because this only applies to brand new deletes.

Returns
bool

Definition at line 3710 of file EditPage.php.

References $deletedSinceEdit, getLastDelete(), TS_MW, and wfTimestamp().

Referenced by internalAttemptSave(), showEditForm(), and showTextbox1().

Member Data Documentation

string EditPage::$action = 'submit'

Definition at line 218 of file EditPage.php.

bool EditPage::$allowBlankArticle = false
protected

Definition at line 278 of file EditPage.php.

bool EditPage::$allowBlankSummary = false

Definition at line 272 of file EditPage.php.

bool EditPage::$allowSelfRedirect = false
protected

Definition at line 284 of file EditPage.php.

string EditPage::$autoSumm = ''

Definition at line 287 of file EditPage.php.

Referenced by internalAttemptSave().

bool EditPage::$blankArticle = false
protected

Definition at line 275 of file EditPage.php.

bool EditPage::$bot = true

Definition at line 364 of file EditPage.php.

Referenced by attemptSave().

null array EditPage::$changeTags = null
private

Definition at line 373 of file EditPage.php.

Referenced by internalAttemptSave().

null string EditPage::$contentFormat = null

Definition at line 370 of file EditPage.php.

bool int EditPage::$contentLength = false
protected

Definition at line 399 of file EditPage.php.

null string EditPage::$contentModel = null

Definition at line 367 of file EditPage.php.

Referenced by edit().

IContextSource EditPage::$context
protected

Definition at line 409 of file EditPage.php.

Referenced by getContext().

bool EditPage::$deletedSinceEdit

Definition at line 239 of file EditPage.php.

Referenced by wasDeletedSinceLastEdit().

EditPage::$didSave = false

Definition at line 390 of file EditPage.php.

bool EditPage::$diff = false

Definition at line 313 of file EditPage.php.

Referenced by importFormData().

bool EditPage::$edit
protected

Definition at line 396 of file EditPage.php.

string EditPage::$editFormPageTop = ''

Before even the preview.

Definition at line 379 of file EditPage.php.

EditPage::$editFormTextAfterContent = ''

Definition at line 385 of file EditPage.php.

EditPage::$editFormTextAfterTools = ''

Definition at line 383 of file EditPage.php.

EditPage::$editFormTextAfterWarn = ''

Definition at line 382 of file EditPage.php.

EditPage::$editFormTextBeforeContent = ''

Definition at line 381 of file EditPage.php.

EditPage::$editFormTextBottom = ''

Definition at line 384 of file EditPage.php.

EditPage::$editFormTextTop = ''

Definition at line 380 of file EditPage.php.

string EditPage::$editintro = ''

Definition at line 358 of file EditPage.php.

integer EditPage::$editRevId = null
private

Definition at line 340 of file EditPage.php.

string EditPage::$edittime = ''

Definition at line 337 of file EditPage.php.

Referenced by internalAttemptSave().

bool EditPage::$enableApiEditOverride = false
private

Set in ApiEditPage, based on ContentHandler::allowsDirectApiEditing.

Definition at line 404 of file EditPage.php.

bool EditPage::$firsttime

Definition at line 245 of file EditPage.php.

string EditPage::$formtype

Definition at line 242 of file EditPage.php.

bool EditPage::$hasPresetSummary = false

Has a summary been preset using GET parameter &summary= ?

Definition at line 296 of file EditPage.php.

string EditPage::$hookError = ''

Definition at line 290 of file EditPage.php.

bool EditPage::$incompleteForm = false

Definition at line 260 of file EditPage.php.

bool EditPage::$isConflict = false

Definition at line 221 of file EditPage.php.

bool EditPage::$isCssJsSubpage = false

Definition at line 224 of file EditPage.php.

bool EditPage::$isCssSubpage = false

Definition at line 227 of file EditPage.php.

bool EditPage::$isJsSubpage = false

Definition at line 230 of file EditPage.php.

bool EditPage::$isNew = false

New page or new section.

Definition at line 236 of file EditPage.php.

Referenced by initialiseForm().

bool EditPage::$isWrongCaseCssJsPage = false

Definition at line 233 of file EditPage.php.

bool stdClass EditPage::$lastDelete

Definition at line 248 of file EditPage.php.

Article EditPage::$mArticle

Definition at line 207 of file EditPage.php.

Referenced by getArticle().

bool EditPage::$mBaseRevision = false

Definition at line 299 of file EditPage.php.

Referenced by getBaseRevision().

null Title EditPage::$mContextTitle = null
private

Definition at line 215 of file EditPage.php.

Referenced by getContextTitle().

bool EditPage::$minoredit = false

Definition at line 316 of file EditPage.php.

Referenced by runPostMergeFilters().

bool EditPage::$missingComment = false

Definition at line 266 of file EditPage.php.

bool EditPage::$missingSummary = false

Definition at line 269 of file EditPage.php.

ParserOutput EditPage::$mParserOutput

Definition at line 293 of file EditPage.php.

EditPage::$mPreloadContent = null

Definition at line 387 of file EditPage.php.

Referenced by getPreloadedContent().

bool EditPage::$mShowSummaryField = true

Definition at line 302 of file EditPage.php.

Title EditPage::$mTitle

Definition at line 212 of file EditPage.php.

Referenced by getTitle(), internalAttemptSave(), showCustomIntro(), and updateWatchlist().

bool EditPage::$mTokenOk = false

Definition at line 251 of file EditPage.php.

Referenced by tokenOk().

bool EditPage::$mTokenOkExceptSuffix = false

Definition at line 254 of file EditPage.php.

bool EditPage::$mTriedSave = false

Definition at line 257 of file EditPage.php.

bool EditPage::$nosummary = false

Definition at line 334 of file EditPage.php.

int EditPage::$oldid = 0

Definition at line 352 of file EditPage.php.

Referenced by getCancelLink().

WikiPage EditPage::$page
private

Definition at line 209 of file EditPage.php.

int EditPage::$parentRevId = 0

Definition at line 355 of file EditPage.php.

Referenced by getParentRevId().

bool EditPage::$preview = false

Definition at line 310 of file EditPage.php.

Referenced by importFormData().

EditPage::$previewTextAfterContent = ''

Definition at line 386 of file EditPage.php.

Referenced by getPreviewText().

bool EditPage::$recreate = false

Definition at line 322 of file EditPage.php.

bool EditPage::$save = false

Definition at line 307 of file EditPage.php.

null EditPage::$scrolltop = null

Definition at line 361 of file EditPage.php.

string EditPage::$section = ''

Definition at line 343 of file EditPage.php.

string EditPage::$sectiontitle = ''

Definition at line 346 of file EditPage.php.

Referenced by internalAttemptSave().

bool EditPage::$selfRedirect = false
protected

Definition at line 281 of file EditPage.php.

string EditPage::$starttime = ''

Definition at line 349 of file EditPage.php.

string EditPage::$summary = ''
EditPage::$suppressIntro = false

Definition at line 393 of file EditPage.php.

string EditPage::$textbox1 = ''
string EditPage::$textbox2 = ''

Definition at line 328 of file EditPage.php.

bool EditPage::$tooBig = false

Definition at line 263 of file EditPage.php.

EditPage::$undidRev = 0

Definition at line 391 of file EditPage.php.

Referenced by importFormData().

bool EditPage::$watchthis = false

Definition at line 319 of file EditPage.php.

Referenced by updateWatchlist().

const EditPage::AS_ARTICLE_WAS_DELETED = 222

Status: article was deleted while editing and param wpRecreate == false or form was not posted.

Definition at line 97 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_BLANK_ARTICLE = 224

Status: user tried to create a blank page and wpIgnoreBlankArticle == false.

Definition at line 108 of file EditPage.php.

Referenced by ApiEditPage\execute(), EditPageTest\provideCreatePages(), EditPageTest\testCreatePage(), and EditPageTest\testCreatePageTrx().

const EditPage::AS_BLOCKED_PAGE_FOR_USER = 215

Status: User is blocked from editing this page.

Definition at line 66 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_CANNOT_USE_CUSTOM_MODEL = 241

Status: when changing the content model is disallowed due to $wgContentHandlerUseDB being false.

Definition at line 178 of file EditPage.php.

const EditPage::AS_CHANGE_TAG_ERROR = 237

Status: an error relating to change tagging.

Look at the message key for more details

Definition at line 167 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_CONFLICT_DETECTED = 225

Status: (non-resolvable) edit conflict.

Definition at line 113 of file EditPage.php.

Referenced by ApiEditPage\execute(), and EditPageTest\provideAutoMerge().

const EditPage::AS_CONTENT_TOO_BIG = 216

Status: Content too big (> $wgMaxArticleSize)

Definition at line 71 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_END = 231

Status: WikiPage::doEdit() was unsuccessful.

Definition at line 134 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_HOOK_ERROR = 210

Status: Article update aborted by a hook function.

Definition at line 56 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_HOOK_ERROR_EXPECTED = 212

Status: A hook function returned an error.

Definition at line 61 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_IMAGE_REDIRECT_ANON = 233

Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)

Definition at line 144 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_IMAGE_REDIRECT_LOGGED = 234

Status: logged in user is not allowed to upload (User::isAllowed('upload') == false)

Definition at line 149 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED = 229

Status: article is too big (> $wgMaxArticleSize), after merging in the new section.

Definition at line 129 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_NO_CHANGE_CONTENT_MODEL = 235

Status: user tried to modify the content model, but is not allowed to do that ( User::isAllowed('editcontentmodel') == false )

Definition at line 155 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_NO_CREATE_PERMISSION = 223

Status: user tried to create this page, but is not allowed to do that ( Title->userCan('create') == false )

Definition at line 103 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_PARSE_ERROR = 240

Status: can't parse content.

Definition at line 172 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_RATE_LIMITED = 221

Status: rate limiter for action 'edit' was tripped.

Definition at line 91 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_READ_ONLY_PAGE = 220

Status: wiki is in readonly mode (wfReadOnly() == true)

Definition at line 86 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_READ_ONLY_PAGE_ANON = 218

Status: this anonymous user is not allowed to edit this page.

Definition at line 76 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_READ_ONLY_PAGE_LOGGED = 219

Status: this logged in user is not allowed to edit this page.

Definition at line 81 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_SELF_REDIRECT = 236

Status: user tried to create self-redirect (redirect to the same article) and wpIgnoreSelfRedirect == false.

Definition at line 161 of file EditPage.php.

const EditPage::AS_SPAM_ERROR = 232

Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex.

Definition at line 139 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_SUCCESS_NEW_ARTICLE = 201

Status: Article successfully created.

Definition at line 51 of file EditPage.php.

Referenced by ApiEditPage\execute(), and EditPageTest\provideCreatePages().

const EditPage::AS_SUMMARY_NEEDED = 226

Status: no edit summary given and the user has forceeditsummary set and the user is not editing in his own userspace or talkspace and wpIgnoreBlankSummary == false.

Definition at line 119 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::AS_TEXTBOX_EMPTY = 228

Status: user tried to create a new section without content.

Definition at line 124 of file EditPage.php.

Referenced by ApiEditPage\execute().

const EditPage::EDITFORM_ID = 'editform'

HTML id and name for the beginning of the edit form.

Definition at line 183 of file EditPage.php.

const EditPage::POST_EDIT_COOKIE_DURATION = 1200

Duration of PostEdit cookie, in seconds.

The cookie will be removed instantly if the JavaScript runs.

Otherwise, though, we don't want the cookies to accumulate. RFC 2109 ( https://www.ietf.org/rfc/rfc2109.txt ) specifies a possible limit of only 20 cookies per domain. This still applies at least to some versions of IE without full updates: https://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx

A value of 20 minutes should be enough to take into account slow loads and minor clock skew while still avoiding cookie accumulation when JavaScript is turned off.

Definition at line 204 of file EditPage.php.

const EditPage::POST_EDIT_COOKIE_KEY_PREFIX = 'PostEditRevision'

Prefix of key for cookie used to pass post-edit state.

The revision id edited is added after this

Definition at line 189 of file EditPage.php.


The documentation for this class was generated from the following file: