MediaWiki
REL1_24
|
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...
Public Member Functions | |
__construct (Article $article) | |
attemptSave () | |
Attempt submission. | |
edit () | |
This is the function that gets called for "action=edit". | |
getArticle () | |
getBaseRevision () | |
getCancelLink () | |
getCheckboxes (&$tabindex, $checked) | |
Returns an array of html code of the following checkboxes: minor and watch. | |
getContextTitle () | |
Get the context title object. | |
getEditButtons (&$tabindex) | |
Returns an array of html code of the following buttons: save, diff, preview and live. | |
getPreviewText () | |
Get the rendered text for previewing. | |
getSummaryInput ($summary="", $labelText=null, $inputAttrs=null, $spanLabelAttrs=null) | |
Standard summary input and label (wgSummary), abstracted so EditPage subclasses may reorganize the form. | |
getTemplates () | |
getTitle () | |
importFormData (&$request) | |
This function collects the form data and uses it to populate various member variables. | |
initialiseForm () | |
Initialise form fields in the object Called on the first invocation, e.g. | |
internalAttemptSave (&$result, $bot=false) | |
Attempt submission (no UI) | |
isSupportedContentModel ($modelId) | |
Returns if the given content model is editable. | |
livePreview () | |
Output preview text only. | |
noSuchSectionPage () | |
Creates a basic error page which informs the user that they have attempted to edit a nonexistent section. | |
setContextTitle ($title) | |
Set the context Title object. | |
setHeaders () | |
setPreloadedContent (Content $content) | |
Use this method before edit() to preload some content into the edit box. | |
showDiff () | |
Get a diff between the current contents of the edit box and the version of the page we're editing from. | |
showEditForm ($formCallback=null) | |
Send the edit form and related headers to $wgOut. | |
spamPageWithContent ($match=false) | |
Show "your edit contains spam" page with your diff and text. | |
submit () | |
tokenOk (&$request) | |
Make sure the form isn't faking a user's credentials. | |
Static Public Member Functions | |
static | extractSectionTitle ($text) |
Extract the section title from current section text, if any. | |
static | getCopyrightWarning ($title, $format= 'plain') |
Get the copyright warning, by default returns wikitext. | |
static | getEditToolbar () |
Shows a bulletin board style toolbar for common editing functions. | |
static | getPreviewLimitReport ($output) |
Get the Limit report for page previews. | |
static | matchSpamRegex ($text) |
Check given input text against $wgSpamRegex, and return the text of the first match. | |
static | matchSummarySpamRegex ($text) |
Check given input text against $wgSummarySpamRegex, and return the text of the first match. | |
Public Attributes | |
string | $action = 'submit' |
* | |
bool | $allowBlankSummary = false |
* | |
bool | $allowNonTextContent = false |
Set to true to allow editing of non-text content types. | |
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 *. | |
$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= ? *. | |
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 *. | |
bool | $isWrongCaseCssJsPage = false |
* | |
bool | $kblength = false |
* | |
bool stdClass | $lastDelete |
* | |
bool | $live |
* | |
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 |
* | |
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. | |
const | AS_BLANK_ARTICLE = 224 |
Status: user tried to create a blank page and wpIgnoreBlankArticle == false. | |
const | AS_BLOCKED_PAGE_FOR_USER = 215 |
Status: User is blocked from editing this page. | |
const | AS_CONFLICT_DETECTED = 225 |
Status: (non-resolvable) edit conflict. | |
const | AS_CONTENT_TOO_BIG = 216 |
Status: Content too big (> $wgMaxArticleSize) | |
const | AS_END = 231 |
Status: WikiPage::doEdit() was unsuccessful. | |
const | AS_HOOK_ERROR = 210 |
Status: Article update aborted by a hook function. | |
const | AS_HOOK_ERROR_EXPECTED = 212 |
Status: A hook function returned an error. | |
const | AS_IMAGE_REDIRECT_ANON = 233 |
Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false) | |
const | AS_IMAGE_REDIRECT_LOGGED = 234 |
Status: logged in user is not allowed to upload (User::isAllowed('upload') == false) | |
const | AS_MAX_ARTICLE_SIZE_EXCEEDED = 229 |
Status: article is too big (> $wgMaxArticleSize), after merging in the new section. | |
const | AS_NO_CREATE_PERMISSION = 223 |
Status: user tried to create this page, but is not allowed to do that ( Title->userCan('create') == false ) | |
const | AS_PARSE_ERROR = 240 |
Status: can't parse content. | |
const | AS_RATE_LIMITED = 221 |
Status: rate limiter for action 'edit' was tripped. | |
const | AS_READ_ONLY_PAGE = 220 |
Status: wiki is in readonly mode (wfReadOnly() == true) | |
const | AS_READ_ONLY_PAGE_ANON = 218 |
Status: this anonymous user is not allowed to edit this page. | |
const | AS_READ_ONLY_PAGE_LOGGED = 219 |
Status: this logged in user is not allowed to edit this page. | |
const | AS_SPAM_ERROR = 232 |
Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex. | |
const | AS_SUCCESS_NEW_ARTICLE = 201 |
Status: Article successfully created. | |
const | AS_SUCCESS_UPDATE = 200 |
Status: Article successfully updated. | |
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. | |
const | AS_TEXTBOX_EMPTY = 228 |
Status: user tried to create a new section without content. | |
const | EDITFORM_ID = 'editform' |
HTML id and name for the beginning of the edit form. | |
const | POST_EDIT_COOKIE_DURATION = 1200 |
Duration of PostEdit cookie, in seconds. | |
const | POST_EDIT_COOKIE_KEY_PREFIX = 'PostEditRevision' |
Prefix of key for cookie used to pass post-edit state. | |
Protected Member Functions | |
displayPermissionsError (array $permErrors) | |
Display a permissions error page, like OutputPage::showPermissionsErrorPage(), but with the following differences: | |
displayPreviewArea ($previewOutput, $isOnTop=false) | |
getActionURL (Title $title) | |
Returns the URL to use in the form's action attribute. | |
getContentObject ($def_content=null) | |
getCopywarn () | |
Get the copyright warning. | |
getCurrentContent () | |
Get the current content of the page. | |
getEditPermissionErrors () | |
getLastDelete () | |
getPreloadedContent ($preload, $params=array()) | |
Get the contents to be preloaded into the box, either set by an earlier setPreloadText() or by loading the given page. | |
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... | |
isSectionEditSupported () | |
Returns whether section editing is supported for the current page. | |
isWrongCaseCssJsPage () | |
Checks whether the user entered a skin name in uppercase, e.g. | |
previewOnOpen () | |
Should we show a preview when the edit form is first shown? | |
runPostMergeFilters (Content $content, Status $status, User $user) | |
Run hooks that can filter edits just before they get saved. | |
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. | |
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. | |
setPostEditCookie ($statusValue) | |
Sets post-edit cookie indicating the user just saved a particular revision. | |
showConflict () | |
Show an edit conflict. | |
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. | |
showCustomIntro () | |
Attempt to show a custom editing introduction, if supplied. | |
showEditTools () | |
showFormAfterText () | |
showFormBeforeText () | |
showHeader () | |
showHeaderCopyrightWarning () | |
Show the header copyright warning. | |
showIntro () | |
Show all applicable editing introductions. | |
showPreview ($text) | |
Append preview output to $wgOut. | |
showStandardInputs (&$tabindex=2) | |
showSummaryInput ($isSubjectPreview, $summary="") | |
showTextbox ($text, $name, $customAttribs=array()) | |
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. | |
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. | |
toEditContent ($text) | |
Turns the given text into a Content object by unserializing it. | |
toEditText ($content) | |
Gets an editable textual representation of $content. | |
updateWatchlist () | |
Register the change of watch status. | |
wasDeletedSinceLastEdit () | |
Check if a page was deleted while the user was editing it, before submit. | |
Static Protected Member Functions | |
static | matchSpamRegexInternal ($text, $regexes) |
Protected Attributes | |
bool | $allowBlankArticle = false |
* | |
bool | $blankArticle = false |
* | |
bool | $edit |
* | |
Private Member Functions | |
checkUnicodeCompliantBrowser () | |
Check if the browser is on a blacklist of user-agents known to mangle UTF-8 data on form submission. | |
getOriginalContent (User $user) | |
Get the content of the wanted revision, without section extraction. | |
handleStatus (Status $status, $resultDetails) | |
Handle status, such as after attempt save. | |
makeSafe ($invalue) | |
A number of web browsers are known to corrupt non-ASCII characters in a UTF-8 text editing environment. | |
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. | |
newSectionSummary (&$sectionanchor=null) | |
Return the summary to be used for a new section. | |
unmakeSafe ($invalue) | |
Reverse the previously applied transliteration of non-ASCII characters back to UTF-8. | |
Private Attributes | |
null Title | $mContextTitle = null |
* |
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 38 of file EditPage.php.
EditPage::__construct | ( | Article $ | article | ) |
Article | $article |
Definition at line 310 of file EditPage.php.
Attempt submission.
UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError |
Definition at line 1225 of file EditPage.php.
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.
Definition at line 3830 of file EditPage.php.
EditPage::displayPermissionsError | ( | array $ | permErrors | ) | [protected] |
Display a permissions error page, like OutputPage::showPermissionsErrorPage(), but with the following differences:
array | $permErrors | Array of permissions errors, as returned by Title::getUserPermissionsErrors(). |
PermissionsError |
Definition at line 534 of file EditPage.php.
EditPage::displayPreviewArea | ( | $ | previewOutput, |
$ | isOnTop = false |
||
) | [protected] |
Definition at line 2898 of file EditPage.php.
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 387 of file EditPage.php.
static EditPage::extractSectionTitle | ( | $ | text | ) | [static] |
Extract the section title from current section text, if any.
string | $text |
Definition at line 2456 of file EditPage.php.
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.
Definition at line 3247 of file EditPage.php.
Definition at line 323 of file EditPage.php.
Definition at line 1948 of file EditPage.php.
Definition at line 3219 of file EditPage.php.
EditPage::getCheckboxes | ( | &$ | tabindex, |
$ | checked | ||
) |
Returns an array of html code of the following checkboxes: minor and watch.
int | $tabindex | Current tabindex |
array | $checked | Array of checkbox => bool, where bool indicates the checked status of the checkbox |
Definition at line 3637 of file EditPage.php.
EditPage::getContentObject | ( | $ | def_content = null | ) | [protected] |
Content | null | $def_content | The default value to return |
Definition at line 913 of file EditPage.php.
Get the context title object.
If not set, $wgTitle will be returned. This behavior might change in the future to return $this->mTitle instead.
Definition at line 351 of file EditPage.php.
References $article.
static EditPage::getCopyrightWarning | ( | $ | title, |
$ | format = 'plain' |
||
) | [static] |
Get the copyright warning, by default returns wikitext.
Title | $title | |
string | $format | Output format, valid values are any function of a Message object |
Definition at line 3071 of file EditPage.php.
EditPage::getCopywarn | ( | ) | [protected] |
Get the copyright warning.
Renamed to getCopyrightWarning(), old name kept around for backwards compatibility
Definition at line 3060 of file EditPage.php.
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.
Definition at line 1073 of file EditPage.php.
EditPage::getEditButtons | ( | &$ | tabindex | ) |
Returns an array of html code of the following buttons: save, diff, preview and live.
int | $tabindex | Current tabindex |
Definition at line 3701 of file EditPage.php.
References $attribs, $tabindex, array(), check, Html\closeElement(), Xml\expandAttributes(), Html\openElement(), text, Linker\titleAttrib(), and wfMessage().
EditPage::getEditPermissionErrors | ( | ) | [protected] |
Definition at line 500 of file EditPage.php.
static EditPage::getEditToolbar | ( | ) | [static] |
Shows a bulletin board style toolbar for common editing functions.
It can be disabled in the user preferences.
Definition at line 3500 of file EditPage.php.
EditPage::getLastDelete | ( | ) | [protected] |
Definition at line 3281 of file EditPage.php.
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::replaceSection()) 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.
User | $user | The user to get the revision for |
Definition at line 1048 of file EditPage.php.
EditPage::getPreloadedContent | ( | $ | preload, |
$ | params = array() |
||
) | [protected] |
Get the contents to be preloaded into the box, either set by an earlier setPreloadText() or by loading the given page.
string | $preload | Representing the title to preload from. |
array | $params | Parameters to use (interface-message style) in the preloaded text |
Definition at line 1115 of file EditPage.php.
static EditPage::getPreviewLimitReport | ( | $ | output | ) | [static] |
Get the Limit report for page previews.
ParserOutput | $output | ParserOutput object from the parse |
Definition at line 3095 of file EditPage.php.
Get the rendered text for previewing.
MWException |
Definition at line 3325 of file EditPage.php.
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 array( 'id' => false ) to $userInputAttrs.
string | $summary | The value of the summary input |
string | $labelText | The html to place inside the label |
array | $inputAttrs | Array of attrs to use on the input |
array | $spanLabelAttrs | Array of attrs to use on the span inside the label |
Definition at line 2680 of file EditPage.php.
EditPage::getSummaryPreview | ( | $ | isSubjectPreview, |
$ | summary = "" |
||
) | [protected] |
bool | $isSubjectPreview | True if this is the section subject/title up top, or false if this is the comment summary down below the textarea |
string | $summary | The text of the summary to display |
Definition at line 2749 of file EditPage.php.
References array(), and Xml\tags().
Definition at line 3477 of file EditPage.php.
EditPage::handleStatus | ( | Status $ | status, |
$ | resultDetails | ||
) | [private] |
Handle status, such as after attempt save.
Status | $status | |
array | bool | $resultDetails |
ErrorPageError |
Definition at line 1245 of file EditPage.php.
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...
WebRequest | $request |
Definition at line 866 of file EditPage.php.
EditPage::importFormData | ( | &$ | request | ) |
This function collects the form data and uses it to populate various member variables.
WebRequest | $request |
ErrorPageError |
Definition at line 656 of file EditPage.php.
Initialise form fields in the object Called on the first invocation, e.g.
when a user clicks an edit link
Definition at line 875 of file EditPage.php.
References array(), and ContentHandler\getLocalizedName().
EditPage::internalAttemptSave | ( | &$ | result, |
$ | bot = false |
||
) |
Attempt submission (no UI)
array | $result | Array to add statuses to, currently with the possible keys:
|
bool | $bot | True if edit is being made under the bot right. |
Definition at line 1444 of file EditPage.php.
References $wgParser, global, and wfMessage().
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.
Definition at line 646 of file EditPage.php.
EditPage::isSupportedContentModel | ( | $ | modelId | ) |
Returns if the given content model is editable.
string | $modelId | The ID of the content model to test. Use CONTENT_MODEL_XXX constants. |
MWException | If $modelId has no known handler |
Definition at line 367 of file EditPage.php.
EditPage::isWrongCaseCssJsPage | ( | ) | [protected] |
Checks whether the user entered a skin name in uppercase, e.g.
"User:Example/Monobook.css" instead of "monobook.css"
Definition at line 625 of file EditPage.php.
Output preview text only.
This can be sucked into the edit page via JavaScript, and saves the server time rendering the skin as well as theoretically being more robust on the client (doesn't disturb the edit box's undo history, won't eat your text on failure, etc).
Definition at line 3760 of file EditPage.php.
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.
string | $invalue |
Definition at line 3889 of file EditPage.php.
static EditPage::matchSpamRegex | ( | $ | text | ) | [static] |
Check given input text against $wgSpamRegex, and return the text of the first match.
string | $text |
Definition at line 1964 of file EditPage.php.
static EditPage::matchSpamRegexInternal | ( | $ | text, |
$ | regexes | ||
) | [static, protected] |
string | $text | |
array | $regexes |
Definition at line 1989 of file EditPage.php.
References $result, and wfProfileOut().
static EditPage::matchSummarySpamRegex | ( | $ | text | ) | [static] |
Check given input text against $wgSummarySpamRegex, and return the text of the first match.
string | $text |
Definition at line 1978 of file EditPage.php.
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.
Content | $editContent |
Definition at line 1908 of file EditPage.php.
References AS_END.
EditPage::newSectionSummary | ( | &$ | sectionanchor = null | ) | [private] |
Return the summary to be used for a new section.
string | $sectionanchor | Set to the section anchor text |
Definition at line 1396 of file EditPage.php.
References $content, $user, array(), AS_HOOK_ERROR, AS_HOOK_ERROR_EXPECTED, Status\fatal(), ContentHandler\runLegacyHooks(), and wfRunHooks().
Creates a basic error page which informs the user that they have attempted to edit a nonexistent section.
Definition at line 3782 of file EditPage.php.
EditPage::previewOnOpen | ( | ) | [protected] |
Should we show a preview when the edit form is first shown?
Definition at line 592 of file EditPage.php.
EditPage::runPostMergeFilters | ( | Content $ | content, |
Status $ | status, | ||
User $ | user | ||
) | [protected] |
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.
WebRequest | $request | |
string | $field |
Definition at line 3855 of file EditPage.php.
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.
string | $text |
Definition at line 3869 of file EditPage.php.
EditPage::setContextTitle | ( | $ | title | ) |
Set the context Title object.
Definition at line 340 of file EditPage.php.
Definition at line 1999 of file EditPage.php.
References Revision\loadFromTimestamp(), and wfGetDB().
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.
int | $statusValue | The status value (to check for new article status) |
Definition at line 1203 of file EditPage.php.
EditPage::setPreloadedContent | ( | Content $ | content | ) |
Use this method before edit() to preload some content into the edit box.
Content | $content |
Definition at line 1100 of file EditPage.php.
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 3194 of file EditPage.php.
Referenced by showHeader().
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 2811 of file EditPage.php.
References $summary, and wfMessage().
EditPage::showCustomIntro | ( | ) | [protected] |
Attempt to show a custom editing introduction, if supplied.
Definition at line 2146 of file EditPage.php.
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 2961 of file EditPage.php.
References $attribs.
EditPage::showEditForm | ( | $ | formCallback = null | ) |
Send the edit form and related headers to $wgOut.
callable | null | $formCallback | That takes an OutputPage parameter; will be called during form output near the top, for captchas and the like. |
Definition at line 2231 of file EditPage.php.
EditPage::showEditTools | ( | ) | [protected] |
Definition at line 3047 of file EditPage.php.
References wfMessage().
EditPage::showFormAfterText | ( | ) | [protected] |
Definition at line 2786 of file EditPage.php.
EditPage::showFormBeforeText | ( | ) | [protected] |
Definition at line 2770 of file EditPage.php.
EditPage::showHeader | ( | ) | [protected] |
Definition at line 2469 of file EditPage.php.
References showConflict(), and wfMessage().
EditPage::showHeaderCopyrightWarning | ( | ) | [protected] |
Show the header copyright warning.
Definition at line 3019 of file EditPage.php.
References toEditContent().
EditPage::showIntro | ( | ) | [protected] |
Show all applicable editing introductions.
Definition at line 2043 of file EditPage.php.
EditPage::showPreview | ( | $ | text | ) | [protected] |
Append preview output to $wgOut.
Includes category rendering if this is a category page.
string | $text | The HTML to be output for the preview. |
Definition at line 2940 of file EditPage.php.
EditPage::showStandardInputs | ( | &$ | tabindex = 2 | ) | [protected] |
Definition at line 3141 of file EditPage.php.
EditPage::showSummaryInput | ( | $ | isSubjectPreview, |
$ | summary = "" |
||
) | [protected] |
bool | $isSubjectPreview | True if this is the section subject/title up top, or false if this is the comment summary down below the textarea |
string | $summary | The text of the summary to display |
Definition at line 2718 of file EditPage.php.
EditPage::showTextbox | ( | $ | text, |
$ | name, | ||
$ | customAttribs = array() |
||
) | [protected] |
Definition at line 2869 of file EditPage.php.
References $attribs, array(), MWNamespace\getRestrictionLevels(), and wasDeletedSinceLastEdit().
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.
array | $customAttribs | Array of html attributes to use in the textarea |
string | $textoverride | Optional text to override $this->textarea1 with |
Definition at line 2823 of file EditPage.php.
EditPage::showTextbox2 | ( | ) | [protected] |
Definition at line 2865 of file EditPage.php.
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 3036 of file EditPage.php.
References array(), ParserOptions\newFromUserAndLang(), ContentHandler\runLegacyHooks(), and wfRunHooks().
EditPage::spamPageWithContent | ( | $ | match = false | ) |
Show "your edit contains spam" page with your diff and text.
string | array | bool | $match | Text (or array of texts) which triggered one or more filters |
Definition at line 3799 of file EditPage.php.
EditPage::submit | ( | ) |
Definition at line 372 of file EditPage.php.
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.
string | null | bool | $text | Text to unserialize |
MWException | If unserializing the text results in a Content object that is not an instance of TextContent and $this->allowNonTextContent is not true. |
Definition at line 2210 of file EditPage.php.
Referenced by showHeaderCopyrightWarning().
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.
Content | null | bool | string | $content |
MWException | If $content is not an instance of TextContent and $this->allowNonTextContent is not true. |
Definition at line 2177 of file EditPage.php.
EditPage::tokenOk | ( | &$ | request | ) |
Make sure the form isn't faking a user's credentials.
WebRequest | $request |
Definition at line 1179 of file EditPage.php.
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.
string | $invalue |
Definition at line 3931 of file EditPage.php.
EditPage::updateWatchlist | ( | ) | [protected] |
Register the change of watch status.
Definition at line 1879 of file EditPage.php.
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.
Definition at line 3258 of file EditPage.php.
Referenced by showTextbox().
*
Definition at line 184 of file EditPage.php.
bool EditPage::$allowBlankArticle = false [protected] |
*
Definition at line 226 of file EditPage.php.
bool EditPage::$allowBlankSummary = false |
*
Definition at line 222 of file EditPage.php.
bool EditPage::$allowNonTextContent = false |
Set to true to allow editing of non-text content types.
*
Definition at line 301 of file EditPage.php.
string EditPage::$autoSumm = '' |
*
Definition at line 228 of file EditPage.php.
bool EditPage::$blankArticle = false [protected] |
*
Definition at line 224 of file EditPage.php.
bool EditPage::$bot = true |
*
Definition at line 276 of file EditPage.php.
null string EditPage::$contentFormat = null |
*
Definition at line 280 of file EditPage.php.
null string EditPage::$contentModel = null |
*
Definition at line 278 of file EditPage.php.
bool EditPage::$deletedSinceEdit |
*
Definition at line 198 of file EditPage.php.
EditPage::$didSave = false |
Definition at line 296 of file EditPage.php.
bool EditPage::$diff = false |
*
Definition at line 246 of file EditPage.php.
bool EditPage::$edit [protected] |
*
Definition at line 303 of file EditPage.php.
string EditPage::$editFormPageTop = '' |
Before even the preview *.
Definition at line 285 of file EditPage.php.
EditPage::$editFormTextAfterContent = '' |
Definition at line 291 of file EditPage.php.
EditPage::$editFormTextAfterTools = '' |
Definition at line 289 of file EditPage.php.
EditPage::$editFormTextAfterWarn = '' |
Definition at line 288 of file EditPage.php.
EditPage::$editFormTextBeforeContent = '' |
Definition at line 287 of file EditPage.php.
EditPage::$editFormTextBottom = '' |
Definition at line 290 of file EditPage.php.
EditPage::$editFormTextTop = '' |
Definition at line 286 of file EditPage.php.
string EditPage::$editintro = '' |
*
Definition at line 272 of file EditPage.php.
string EditPage::$edittime = '' |
*
Definition at line 262 of file EditPage.php.
bool EditPage::$firsttime |
*
Definition at line 202 of file EditPage.php.
string EditPage::$formtype |
*
Definition at line 200 of file EditPage.php.
bool EditPage::$hasPresetSummary = false |
Has a summary been preset using GET parameter &summary= ? *.
Definition at line 234 of file EditPage.php.
string EditPage::$hookError = '' |
*
Definition at line 230 of file EditPage.php.
bool EditPage::$incompleteForm = false |
*
Definition at line 212 of file EditPage.php.
bool EditPage::$isConflict = false |
*
Definition at line 186 of file EditPage.php.
bool EditPage::$isCssJsSubpage = false |
*
Definition at line 188 of file EditPage.php.
bool EditPage::$isCssSubpage = false |
*
Definition at line 190 of file EditPage.php.
bool EditPage::$isJsSubpage = false |
*
Definition at line 192 of file EditPage.php.
bool EditPage::$isNew = false |
New page or new section *.
Definition at line 196 of file EditPage.php.
bool EditPage::$isWrongCaseCssJsPage = false |
*
Definition at line 194 of file EditPage.php.
bool EditPage::$kblength = false |
*
Definition at line 216 of file EditPage.php.
bool stdClass EditPage::$lastDelete |
*
Definition at line 204 of file EditPage.php.
bool EditPage::$live |
*
Definition at line 305 of file EditPage.php.
Article EditPage::$mArticle |
*
Definition at line 178 of file EditPage.php.
bool EditPage::$mBaseRevision = false |
*
Definition at line 236 of file EditPage.php.
null Title EditPage::$mContextTitle = null [private] |
*
Definition at line 182 of file EditPage.php.
bool EditPage::$minoredit = false |
*
Definition at line 248 of file EditPage.php.
bool EditPage::$missingComment = false |
*
Definition at line 218 of file EditPage.php.
bool EditPage::$missingSummary = false |
*
Definition at line 220 of file EditPage.php.
ParserOutput EditPage::$mParserOutput |
*
Definition at line 232 of file EditPage.php.
EditPage::$mPreloadContent = null |
Definition at line 293 of file EditPage.php.
bool EditPage::$mShowSummaryField = true |
*
Definition at line 238 of file EditPage.php.
Title EditPage::$mTitle |
*
Definition at line 180 of file EditPage.php.
bool EditPage::$mTokenOk = false |
*
Definition at line 206 of file EditPage.php.
bool EditPage::$mTokenOkExceptSuffix = false |
*
Definition at line 208 of file EditPage.php.
bool EditPage::$mTriedSave = false |
*
Definition at line 210 of file EditPage.php.
bool EditPage::$nosummary = false |
*
Definition at line 260 of file EditPage.php.
int EditPage::$oldid = 0 |
*
Definition at line 270 of file EditPage.php.
bool EditPage::$preview = false |
*
Definition at line 244 of file EditPage.php.
EditPage::$previewTextAfterContent = '' |
Definition at line 292 of file EditPage.php.
bool EditPage::$recreate = false |
*
Definition at line 252 of file EditPage.php.
*
Definition at line 242 of file EditPage.php.
null EditPage::$scrolltop = null |
*
Definition at line 274 of file EditPage.php.
string EditPage::$section = '' |
*
Definition at line 264 of file EditPage.php.
string EditPage::$sectiontitle = '' |
*
Definition at line 266 of file EditPage.php.
string EditPage::$starttime = '' |
*
Definition at line 268 of file EditPage.php.
string EditPage::$summary = '' |
EditPage::$suppressIntro = false |
Definition at line 299 of file EditPage.php.
string EditPage::$textbox1 = '' |
*
Definition at line 254 of file EditPage.php.
string EditPage::$textbox2 = '' |
*
Definition at line 256 of file EditPage.php.
bool EditPage::$tooBig = false |
*
Definition at line 214 of file EditPage.php.
EditPage::$undidRev = 0 |
Definition at line 297 of file EditPage.php.
bool EditPage::$watchthis = false |
*
Definition at line 250 of file EditPage.php.
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 93 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 104 of file EditPage.php.
Referenced by ApiEditPage\execute(), EditPageTest\provideCreatePages(), and EditPageTest\testCreatePage().
const EditPage::AS_BLOCKED_PAGE_FOR_USER = 215 |
Status: User is blocked from editing this page.
Definition at line 62 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_CONFLICT_DETECTED = 225 |
Status: (non-resolvable) edit conflict.
Definition at line 109 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 67 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_END = 231 |
Status: WikiPage::doEdit() was unsuccessful.
Definition at line 130 of file EditPage.php.
Referenced by ApiEditPage\execute(), and mergeChangesIntoContent().
const EditPage::AS_HOOK_ERROR = 210 |
Status: Article update aborted by a hook function.
Definition at line 52 of file EditPage.php.
Referenced by ApiEditPage\execute(), and newSectionSummary().
const EditPage::AS_HOOK_ERROR_EXPECTED = 212 |
Status: A hook function returned an error.
Definition at line 57 of file EditPage.php.
Referenced by ApiEditPage\execute(), and newSectionSummary().
const EditPage::AS_IMAGE_REDIRECT_ANON = 233 |
Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)
Definition at line 140 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 145 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 125 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 99 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_PARSE_ERROR = 240 |
Status: can't parse content.
Definition at line 150 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 87 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 82 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 72 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 77 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_SPAM_ERROR = 232 |
Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex.
Definition at line 135 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_SUCCESS_NEW_ARTICLE = 201 |
Status: Article successfully created.
Definition at line 47 of file EditPage.php.
Referenced by ApiEditPage\execute(), and EditPageTest\provideCreatePages().
const EditPage::AS_SUCCESS_UPDATE = 200 |
Status: Article successfully updated.
Definition at line 42 of file EditPage.php.
Referenced by ApiEditPage\execute(), EditPageTest\provideAutoMerge(), EditPageTest\testAutoMerge(), EditPageTest\testSectionEdit(), and EditPageTest\testUpdatePage().
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 115 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 120 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 155 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 176 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 161 of file EditPage.php.