MediaWiki
1.30.0
|
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 (&$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 old style: minor and watch. More... | |
getCheckboxesDefinition ( $checked) | |
Return an array of checkbox definitions. More... | |
getCheckboxesOOUI (&$tabindex, $checked) | |
Returns an array of checkboxes for the edit form, including 'minor' and 'watch' checkboxes and any other added by extensions. More... | |
getCheckboxesWidget (&$tabindex, $checked) | |
Returns an array of checkboxes for the edit form, including 'minor' and 'watch' checkboxes and any other added by extensions. More... | |
getContext () | |
getContextTitle () | |
Get the context title object. More... | |
getEditButtons (&$tabindex) | |
Returns an array of html code of the following buttons: save, diff and preview. 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... | |
getSummaryInputOOUI ( $summary="", $labelText=null, $inputAttrs=null) | |
Builds a standard summary input with a label. More... | |
getSummaryInputWidget ( $summary="", $labelText=null, $inputAttrs=null) | |
Builds a standard summary input with a label. 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... | |
isOouiEnabled () | |
Check if the edit page is using OOUI controls. More... | |
isSupportedContentModel ( $modelId) | |
Returns if the given content model is editable. More... | |
makeTemplatesOnThisPageList (array $templates) | |
Wrapper around TemplatesOnThisPageFormatter to make a "templates on this page" list. 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 OutputPage. 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 |
string | $contentModel |
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 |
Revision 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 | AS_UNICODE_NOT_SUPPORTED = 242 |
Status: edit rejected because browser doesn't support Unicode. 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... | |
const | UNICODE_CHECK = 'β³π²β₯πππΎπΈβ΄πΉβ―' |
Used for Unicode support checks. More... | |
Protected Member Functions | |
addContentModelChangeLogEntry (User $user, $oldModel, $newModel, $reason) | |
addEditNotices () | |
addExplainConflictHeader (OutputPage $out) | |
addLongPageWarningHeader () | |
addNewLineAtEnd ( $wikitext) | |
addPageProtectionWarningHeaders () | |
addTalkPageText () | |
buildTextboxAttribs ( $name, array $customAttribs, User $user) | |
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... | |
getSubmitButtonLabel () | |
Get the message key of the label for the button to save the page. 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... | |
incrementConflictStats () | |
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... | |
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 () | |
Inserts optional text shown below edit and upload forms. More... | |
showFormAfterText () | |
showFormBeforeText () | |
showHeader () | |
showHeaderCopyrightWarning () | |
Show the header copyright warning. More... | |
showIntro () | |
Show all applicable editing introductions. More... | |
showPreview ( $text) | |
Append preview output to OutputPage. 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 | |
getOriginalContent (User $user) | |
Get the content of the wanted revision, without section extraction. More... | |
getSummaryInputAttributes (array $inputAttrs=null) | |
Helper function for summary input functions, which returns the neccessary attributes for the input. More... | |
guessSectionName ( $text) | |
Turns section name wikitext into anchors for use in HTTP redirects. More... | |
handleStatus (Status $status, $resultDetails) | |
Handle status, such as after attempt save. More... | |
incrementEditFailureStats ( $failureType) | |
incrementResolvedConflicts () | |
Log when a page was successfully saved after the edit conflict view. 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... | |
Private Attributes | |
null array | $changeTags = null |
int | $editRevId = null |
bool | $enableApiEditOverride = false |
Set in ApiEditPage, based on ContentHandler::allowsDirectApiEditing. More... | |
bool | $isOldRev = false |
Whether an old revision is edited. More... | |
null Title | $mContextTitle = null |
WikiPage | $page |
string null | $unicodeCheck |
What the user submitted in the 'wpUnicodeCheck' field. More... | |
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.
EditPage::__construct | ( | Article | $article | ) |
Article | $article |
Definition at line 452 of file EditPage.php.
References $article, $handler, ContentHandler\getForModelID(), Article\getPage(), and page.
|
protected |
User | $user | |
string | false | $oldModel | false if the page is being newly created |
string | $newModel | |
string | $reason |
Definition at line 2249 of file EditPage.php.
References $user.
Referenced by internalAttemptSave().
|
protected |
Definition at line 4533 of file EditPage.php.
References $out, and captcha-old\count.
Referenced by showEditForm().
|
protected |
OutputPage | $out |
Definition at line 4637 of file EditPage.php.
Referenced by showHeader().
|
protected |
|
protected |
string | $wikitext |
Definition at line 4691 of file EditPage.php.
Referenced by showTextbox().
|
protected |
Definition at line 4594 of file EditPage.php.
References $out, $page, as, captcha-old\count, MWNamespace\getRestrictionLevels(), list, and LogEventsList\showLogExtract().
Referenced by showHeader().
|
protected |
EditPage::attemptSave | ( | & | $resultDetails = false | ) |
Attempt submission.
array | bool | &$resultDetails | See docs for $result in internalAttemptSave |
UserBlockedError|ReadOnlyError|ThrottledError|PermissionsError |
Definition at line 1511 of file EditPage.php.
References $bot, internalAttemptSave(), and Hooks\run().
Referenced by edit().
string | $name | |
mixed[] | $customAttribs | |
User | $user |
Definition at line 4651 of file EditPage.php.
References $attribs, $customAttribs, $name, and $user.
Referenced by showTextbox().
|
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 740 of file EditPage.php.
References $action, $out, displayViewSourcePage(), and getContentObject().
Referenced by edit().
|
protected |
Definition at line 3363 of file EditPage.php.
References $attribs, $out, Xml\openElement(), Html\rawElement(), showDiff(), and showPreview().
Referenced by showEditForm().
|
protected |
Display a read-only View Source page.
Content | $content | content object |
string | $errorMessage | additional wikitext error message to display |
Definition at line 770 of file EditPage.php.
References $e, $out, $textbox1, getContextTitle(), getTemplates(), makeTemplatesOnThisPageList(), Hooks\run(), Content\serialize(), showTextbox(), and toEditText().
Referenced by displayPermissionsError(), and edit().
|
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.
Content | $content | The page content |
Definition at line 3987 of file EditPage.php.
References $user, getPreviewParserOptions(), 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 566 of file EditPage.php.
References $contentModel, $request, DeferredUpdates\addCallableUpdate(), attemptSave(), diff, displayPermissionsError(), displayViewSourcePage(), First, getContentObject(), getEditPermissionErrors(), handleStatus(), importFormData(), initialiseForm(), isWrongCaseCssJsPage(), Revision\newFromId(), noSuchSectionPage(), plain, previewOnOpen(), Hooks\run(), save, showEditForm(), showIntro(), wfDebug(), and wfReadOnly().
Referenced by importFormData(), and submit().
|
static |
Extract the section title from current section text, if any.
string | $text |
Definition at line 2927 of file EditPage.php.
References $matches, $wgParser, and global.
Referenced by showHeader(), and EditPageTest\testExtractSectionTitle().
|
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 3742 of file EditPage.php.
References $title, and captcha-old\action.
Referenced by showEditForm().
EditPage::getArticle | ( | ) |
Definition at line 467 of file EditPage.php.
References $mArticle.
Referenced by WikiEditorHooks\editPageAttemptSave(), WikiEditorHooks\editPageAttemptSaveAfter(), and WikiEditorHooks\editPageShowEditFormInitial().
EditPage::getBaseRevision | ( | ) |
Definition at line 2332 of file EditPage.php.
References $mBaseRevision, DB_MASTER, Revision\loadFromTimestamp(), Revision\newFromId(), and wfGetDB().
Referenced by mergeChangesIntoContent().
EditPage::getCancelLink | ( | ) |
Definition at line 3715 of file EditPage.php.
References $oldid, and getContextTitle().
Referenced by showStandardInputs().
EditPage::getCheckboxes | ( | & | $tabindex, |
$checked | |||
) |
Returns an array of html code of the following checkboxes old style: minor and watch.
int | &$tabindex | Current tabindex |
array | $checked | See getCheckboxesDefinition() |
Definition at line 4222 of file EditPage.php.
References $attribs, $name, $options, $tabindex, $wgUseMediaWikiUIEverywhere, as, Xml\check(), getCheckboxesDefinition(), global, Html\rawElement(), Hooks\run(), Xml\tags(), and Linker\titleAttrib().
EditPage::getCheckboxesDefinition | ( | $checked | ) |
Return an array of checkbox definitions.
Array keys correspond to the <input>
'name' attribute to use for each checkbox.
Array values are associative arrays with the following keys:
<input>
<label>
<label>
array | $checked | Array of checkbox name (matching the 'legacy-name') => bool, where bool indicates the checked status of the checkbox |
Definition at line 4178 of file EditPage.php.
References $user, and Hooks\run().
Referenced by getCheckboxes(), and getCheckboxesWidget().
EditPage::getCheckboxesOOUI | ( | & | $tabindex, |
$checked | |||
) |
Returns an array of checkboxes for the edit form, including 'minor' and 'watch' checkboxes and any other added by extensions.
int | &$tabindex | Current tabindex |
array | $checked | Array of checkbox => bool, where bool indicates the checked status of the checkbox |
Definition at line 4283 of file EditPage.php.
References $tabindex, and getCheckboxesWidget().
EditPage::getCheckboxesWidget | ( | & | $tabindex, |
$checked | |||
) |
Returns an array of checkboxes for the edit form, including 'minor' and 'watch' checkboxes and any other added by extensions.
int | &$tabindex | Current tabindex |
array | $checked | Array of checkbox => bool, where bool indicates the checked status of the checkbox |
Definition at line 4297 of file EditPage.php.
References $html, $name, $options, $tabindex, $title, as, getCheckboxesDefinition(), Hooks\run(), string, and Linker\titleAttrib().
Referenced by getCheckboxesOOUI(), and showStandardInputs().
|
protected |
Content | null | $def_content | The default value to return |
Definition at line 1161 of file EditPage.php.
References $out, $params, $request, $summary, $user, $wgContLang, 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 | ( | ) |
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.
Definition at line 503 of file EditPage.php.
References $mContextTitle, $wgTitle, global, wfDebugLog(), and wfGetAllCallers().
Referenced by displayViewSourcePage(), getCancelLink(), setHeaders(), showEditForm(), and spamPageWithContent().
|
static |
Get the copyright warning, by default returns wikitext.
Title | $title | |
string | $format | Output format, valid values are any function of a Message object |
Language | string | null | $langcode | Language code or Language object. |
Definition at line 3550 of file EditPage.php.
References $title, $wgRightsText, global, Hooks\run(), and wfMessage().
Referenced by getCopywarn().
|
protected |
Get the copyright warning.
Renamed to getCopyrightWarning(), old name kept around for backwards compatibility
Definition at line 3538 of file EditPage.php.
References getCopyrightWarning().
Referenced by showStandardInputs().
|
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 1344 of file EditPage.php.
References $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 and preview.
int | &$tabindex | Current tabindex |
Definition at line 4388 of file EditPage.php.
References $attribs, $tabindex, Linker\accesskey(), getSubmitButtonLabel(), Hooks\run(), and Linker\titleAttrib().
Referenced by showStandardInputs().
|
protected |
string | $rigor | Same format as Title::getUserPermissionErrors() |
Definition at line 696 of file EditPage.php.
References $user, as, diff, and wfArrayDiff2().
Referenced by edit().
|
static |
Shows a bulletin board style toolbar for common editing functions.
It can be disabled in the user preferences.
Definition at line 4028 of file EditPage.php.
References $params, $title, $wgContLang, $wgEnableUploads, $wgForeignFileRepos, $wgOut, as, captcha-old\count, Xml\encodeJsCall(), global, NS_FILE, NS_MEDIA, Hooks\run(), MWNamespace\wantSignatures(), and wfMessage().
|
protected |
Definition at line 3776 of file EditPage.php.
References $dbr, DB_REPLICA, LogPage\DELETED_COMMENT, LogPage\DELETED_USER, CommentStore\newKey(), and wfGetDB().
Referenced by wasDeletedSinceLastEdit().
|
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.
User | $user | The user to get the revision for |
Definition at line 1303 of file EditPage.php.
References $handler, $user, Revision\FOR_THIS_USER, getCurrentContent(), and ContentHandler\getForModelID().
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.
Definition at line 1328 of file EditPage.php.
References $parentRevId.
Referenced by showEditForm().
|
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 1405 of file EditPage.php.
References $handler, $mPreloadContent, $page, $params, $title, $user, WikiPage\factory(), WikiPage\getContent(), ContentHandler\getForModelID(), WikiPage\getRedirectTarget(), WikiPage\isRedirect(), Title\newFromText(), ParserOptions\newFromUser(), Revision\RAW, and wfDebug().
Referenced by getContentObject().
|
static |
Get the Limit report for page previews.
ParserOutput | $output | ParserOutput object from the parse |
Definition at line 3578 of file EditPage.php.
References $output, $value, as, Html\closeElement(), Html\openElement(), Html\rawElement(), Hooks\run(), and wfMessage().
Referenced by ApiParse\execute().
|
protected |
Get parser options for a preview.
Definition at line 3970 of file EditPage.php.
References page.
Referenced by doPreviewParse().
EditPage::getPreviewText | ( | ) |
Get the rendered text for previewing.
MWException |
Definition at line 3824 of file EditPage.php.
References $attribs, $mTokenOk, $out, $previewTextAfterContent, CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, captcha-old\count, doPreviewParse(), incrementEditFailureStats(), Html\rawElement(), Hooks\run(), toEditContent(), and true.
Referenced by showEditForm().
|
protected |
Get the message key of the label for the button to save the page.
Definition at line 4364 of file EditPage.php.
Referenced by getEditButtons(), and showHeader().
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.
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 3122 of file EditPage.php.
References $input, $summary, getSummaryInputAttributes(), Html\input(), Xml\tags(), Linker\tooltipAndAccesskeyAttribs(), and wfDeprecated().
|
private |
Helper function for summary input functions, which returns the neccessary attributes for the input.
array | null | $inputAttrs | Array of attrs to use on the input |
Definition at line 3096 of file EditPage.php.
Referenced by getSummaryInput(), and getSummaryInputWidget().
EditPage::getSummaryInputOOUI | ( | $summary = "" , |
|
$labelText = null , |
|||
$inputAttrs = null |
|||
) |
Builds a standard summary input with a label.
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 |
Definition at line 3159 of file EditPage.php.
References getSummaryInputWidget(), and wfDeprecated().
EditPage::getSummaryInputWidget | ( | $summary = "" , |
|
$labelText = null , |
|||
$inputAttrs = null |
|||
) |
Builds a standard summary input with a label.
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 |
Definition at line 3173 of file EditPage.php.
References $summary, Linker\accesskey(), getSummaryInputAttributes(), and Linker\titleAttrib().
Referenced by getSummaryInputOOUI(), and showSummaryInput().
|
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 3234 of file EditPage.php.
References $summary, $wgParser, Linker\commentBlock(), diff, global, and Xml\tags().
Referenced by showEditForm(), and showStandardInputs().
EditPage::getTemplates | ( | ) |
Definition at line 4004 of file EditPage.php.
References $template, as, and Title\makeTitle().
Referenced by displayViewSourcePage(), and showEditForm().
EditPage::getTitle | ( | ) |
Definition at line 483 of file EditPage.php.
References $mTitle.
Referenced by getCurrentContent(), internalAttemptSave(), showHeader(), toEditContent(), and SpamBlacklistHooks\validate().
|
private |
Turns section name wikitext into anchors for use in HTTP redirects.
Various versions of Microsoft browsers misinterpret fragment encoding of Location: headers resulting in mojibake in address bar. Redirect them to legacy section IDs, if possible. All the other browsers get HTML5 if the wiki is configured for it, to spread the new style links more efficiently.
string | $text |
Definition at line 4713 of file EditPage.php.
References $wgParser, and global.
Referenced by internalAttemptSave(), and newSectionSummary().
|
private |
Handle status, such as after attempt save.
Status | $status | |
array | bool | $resultDetails |
ErrorPageError |
Definition at line 1542 of file EditPage.php.
References $out, $query, $request, AS_ARTICLE_WAS_DELETED, AS_BLANK_ARTICLE, AS_BLOCKED_PAGE_FOR_USER, AS_CANNOT_USE_CUSTOM_MODEL, AS_CONFLICT_DETECTED, AS_CONTENT_TOO_BIG, AS_END, AS_HOOK_ERROR, AS_HOOK_ERROR_EXPECTED, AS_IMAGE_REDIRECT_ANON, AS_IMAGE_REDIRECT_LOGGED, AS_MAX_ARTICLE_SIZE_EXCEEDED, AS_NO_CHANGE_CONTENT_MODEL, AS_NO_CREATE_PERMISSION, AS_PARSE_ERROR, AS_RATE_LIMITED, AS_READ_ONLY_PAGE, AS_READ_ONLY_PAGE_ANON, AS_READ_ONLY_PAGE_LOGGED, AS_SELF_REDIRECT, AS_SPAM_ERROR, AS_SUCCESS_NEW_ARTICLE, AS_SUCCESS_UPDATE, AS_SUMMARY_NEEDED, AS_TEXTBOX_EMPTY, AS_UNICODE_NOT_SUPPORTED, incrementResolvedConflicts(), Hooks\run(), setPostEditCookie(), and spamPageWithContent().
Referenced by edit().
|
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 1113 of file EditPage.php.
Referenced by importFormData().
EditPage::importFormData | ( | & | $request | ) |
This function collects the form data and uses it to populate various member variables.
WebRequest | &$request |
ErrorPageError |
Definition at line 888 of file EditPage.php.
References $changeTags, $diff, $e, $handler, $preview, $request, $textbox1, $undidRev, $user, diff, edit(), ContentHandler\getForModelID(), ContentHandler\getLocalizedName(), importContentFormData(), isSectionEditSupported(), NS_USER, NS_USER_TALK, Hooks\run(), save, tokenOk(), wfDebug(), wfEscapeWikiText(), and wfTimestampNow().
Referenced by edit().
|
protected |
Definition at line 3700 of file EditPage.php.
References NS_CATEGORY_TALK, and NS_MAIN.
Referenced by showConflict().
|
private |
Definition at line 3961 of file EditPage.php.
Referenced by getPreviewText().
|
private |
Log when a page was successfully saved after the edit conflict view.
Definition at line 1524 of file EditPage.php.
Referenced by handleStatus().
EditPage::initialiseForm | ( | ) |
Initialise form fields in the object Called on the first invocation, e.g.
when a user clicks an edit link
Definition at line 1122 of file EditPage.php.
References $isNew, $user, content, getContentObject(), page, and toEditText().
Referenced by edit().
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 1771 of file EditPage.php.
References $autoSumm, $bot, $changeTags, $code, $edittime, $flags, $matches, $mTitle, $request, $sectiontitle, $summary, $undidRev, $user, addContentModelChangeLogEntry(), AS_CANNOT_USE_CUSTOM_MODEL, AS_CHANGE_TAG_ERROR, AS_END, AS_HOOK_ERROR, AS_HOOK_ERROR_EXPECTED, AS_IMAGE_REDIRECT_ANON, AS_IMAGE_REDIRECT_LOGGED, AS_NO_CREATE_PERMISSION, AS_PARSE_ERROR, AS_RATE_LIMITED, AS_READ_ONLY_PAGE, AS_READ_ONLY_PAGE_LOGGED, AS_SELF_REDIRECT, AS_SPAM_ERROR, AS_SUCCESS_NEW_ARTICLE, AS_SUCCESS_UPDATE, AS_SUMMARY_NEEDED, AS_TEXTBOX_EMPTY, AS_UNICODE_NOT_SUPPORTED, ChangeTags\canAddTagsAccompanyingChange(), DB_MASTER, EDIT_AUTOSUMMARY, EDIT_FORCE_BOT, EDIT_MINOR, EDIT_NEW, EDIT_UPDATE, etc, false, ContentHandler\getContentText(), getCurrentContent(), getTitle(), guessSectionName(), matchSpamRegex(), matchSummarySpamRegex(), 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::isOouiEnabled | ( | ) |
Check if the edit page is using OOUI controls.
Definition at line 521 of file EditPage.php.
|
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 878 of file EditPage.php.
References ContentHandler\getForTitle().
Referenced by importFormData(), and showEditForm().
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 532 of file EditPage.php.
References ContentHandler\getForModelID().
Referenced by toEditContent(), and toEditText().
|
protected |
Checks whether the user entered a skin name in uppercase, e.g.
"User:Example/Monobook.css" instead of "monobook.css"
Definition at line 857 of file EditPage.php.
References $name, and Skin\getSkinNames().
Referenced by edit(), and showHeader().
EditPage::makeTemplatesOnThisPageList | ( | array | $templates | ) |
Wrapper around TemplatesOnThisPageFormatter to make a "templates on this page" list.
Title[] | $templates |
Definition at line 2903 of file EditPage.php.
References $type, and Html\rawElement().
Referenced by displayViewSourcePage(), and showEditForm().
|
static |
Check given input text against $wgSpamRegex, and return the text of the first match.
string | $text |
Definition at line 2349 of file EditPage.php.
References $regexes, $wgSpamRegex, array(), global, and matchSpamRegexInternal().
Referenced by internalAttemptSave().
|
staticprotected |
string | $text | |
array | $regexes |
Definition at line 2374 of file EditPage.php.
References $matches, $regexes, and as.
Referenced by matchSpamRegex(), and matchSummarySpamRegex().
|
static |
Check given input text against $wgSummarySpamRegex, and return the text of the first match.
string | $text |
Definition at line 2363 of file EditPage.php.
References $regexes, $wgSummarySpamRegex, array(), global, and matchSpamRegexInternal().
Referenced by MovePage\checkPermissions(), MergeHistory\checkPermissions(), SpecialChangeContentModel\getFormFields(), and internalAttemptSave().
|
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 2294 of file EditPage.php.
References $handler, DB_MASTER, getBaseRevision(), ContentHandler\getForModelID(), Revision\loadFromTitle(), and wfGetDB().
Referenced by internalAttemptSave().
|
private |
Return the summary to be used for a new section.
string | $sectionanchor | Set to the section anchor text |
Definition at line 1723 of file EditPage.php.
References $summary, $wgParser, global, and guessSectionName().
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 4459 of file EditPage.php.
References $out, $res, and Hooks\run().
Referenced by edit().
|
protected |
Should we show a preview when the edit form is first shown?
Definition at line 823 of file EditPage.php.
References $request.
Referenced by edit().
Run hooks that can filter edits just before they get saved.
Content | $content | The Content to filter. |
Status | $status | For reporting the outcome to the caller |
User | $user | The user performing the edit |
Definition at line 1676 of file EditPage.php.
References $user, AS_HOOK_ERROR, AS_HOOK_ERROR_EXPECTED, and Hooks\run().
Referenced by internalAttemptSave().
|
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 4513 of file EditPage.php.
References $request.
|
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 4526 of file EditPage.php.
EditPage::setApiEditOverride | ( | $enableOverride | ) |
Allow editing of content that supports API direct editing, but not general direct editing.
Set to false by default.
bool | $enableOverride |
Definition at line 543 of file EditPage.php.
EditPage::setContextTitle | ( | $title | ) |
EditPage::setHeaders | ( | ) |
Definition at line 2384 of file EditPage.php.
References $out, $user, false, getContextTitle(), and NS_MEDIAWIKI.
Referenced by showEditForm().
|
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.
Article::view deletes the cookie on server-side after the redirect and converts the value to the global JavaScript variable wgPostEdit.
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 1490 of file EditPage.php.
References $response, and page.
Referenced by handleStatus().
EditPage::setPreloadedContent | ( | Content | $content | ) |
Use this method before edit() to preload some content into the edit box.
Content | $content |
Definition at line 1390 of file EditPage.php.
|
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 3675 of file EditPage.php.
References $handler, $out, ContentHandler\getForModelID(), incrementConflictStats(), Hooks\run(), showTextbox2(), and toEditContent().
Referenced by showEditForm().
|
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 3293 of file EditPage.php.
References showTextbox1().
Referenced by showEditForm().
|
protected |
Attempt to show a custom editing introduction, if supplied.
Definition at line 2559 of file EditPage.php.
References $mTitle, $title, 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 3432 of file EditPage.php.
References $user, $wgContLang, getCurrentContent(), global, ParserOptions\newFromUserAndLang(), NS_MEDIAWIKI, page, Hooks\run(), and toEditContent().
Referenced by displayPreviewArea(), and spamPageWithContent().
EditPage::showEditForm | ( | $formCallback = null | ) |
Send the edit form and related headers to OutputPage.
callable | null | $formCallback | That takes an OutputPage parameter; will be called during form output near the top, for captchas and the like. |
The $formCallback parameter is deprecated since MediaWiki 1.25. Please use the EditPage::showEditForm:fields hook instead.
Definition at line 2643 of file EditPage.php.
References $out, $textbox1, $user, $username, addEditNotices(), addTalkPageText(), Xml\checkLabel(), Xml\closeElement(), diff, displayPreviewArea(), Xml\element(), Linker\formatHiddenCategories(), getActionURL(), getContextTitle(), getCurrentContent(), getParentRevId(), getPreviewText(), getSummaryPreview(), getTemplates(), Html\hidden(), isSectionEditSupported(), makeTemplatesOnThisPageList(), CommentStore\newKey(), Xml\openElement(), Html\openElement(), page, Html\rawElement(), Hooks\run(), setHeaders(), showConflict(), showContentForm(), showEditTools(), showFormAfterText(), showFormBeforeText(), showHeader(), showStandardInputs(), showSummaryInput(), showTextbox1(), showTosSummary(), Linker\titleAttrib(), toEditText(), wasDeletedSinceLastEdit(), and wfWarn().
Referenced by edit().
|
protected |
Inserts optional text shown below edit and upload forms.
Can be used to offer special characters not present on most keyboards for copying/pasting.
Definition at line 3526 of file EditPage.php.
Referenced by showEditForm().
|
protected |
Definition at line 3265 of file EditPage.php.
References Html\hidden().
Referenced by showEditForm().
|
protected |
Definition at line 3256 of file EditPage.php.
References $out, and Html\hidden().
Referenced by showEditForm().
|
protected |
Definition at line 2937 of file EditPage.php.
References $isCssSubpage, $out, $user, addExplainConflictHeader(), addLongPageWarningHeader(), addPageProtectionWarningHeaders(), Revision\DELETED_TEXT, diff, extractSectionTitle(), getSubmitButtonLabel(), getTitle(), SpecialPage\getTitleFor(), isWrongCaseCssJsPage(), page, showHeaderCopyrightWarning(), wfReadOnly(), and wfReadOnlyReason().
Referenced by showEditForm().
|
protected |
Show the header copyright warning.
Definition at line 3495 of file EditPage.php.
Referenced by showHeader().
|
protected |
Show all applicable editing introductions.
Definition at line 2443 of file EditPage.php.
References $dbr, $out, $user, $username, CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, DB_REPLICA, MWNamespace\getCanonicalName(), in, User\isIP(), Skin\makeInternalOrExternalUrl(), User\newFromName(), Block\newFromTarget(), not, NS_FILE, NS_MEDIAWIKI, NS_USER, NS_USER_TALK, showCustomIntro(), LogEventsList\showLogExtract(), Block\TYPE_AUTO, wfEscapeWikiText(), wfExpandUrl(), wfFindFile(), and wfGetDB().
Referenced by edit().
|
protected |
Append preview output to OutputPage.
Includes category rendering if this is a category page.
string | $text | The HTML to be output for the preview. |
Definition at line 3411 of file EditPage.php.
References $out, and Hooks\run().
Referenced by displayPreviewArea().
|
protected |
Definition at line 3620 of file EditPage.php.
References $out, $tabindex, Html\element(), getCancelLink(), getCheckboxesWidget(), getCopywarn(), getEditButtons(), getSummaryPreview(), Html\linkButton(), Skin\makeInternalOrExternalUrl(), Hooks\run(), and showSummaryInput().
Referenced by showEditForm().
|
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 3206 of file EditPage.php.
References getSummaryInputWidget().
Referenced by showEditForm(), and showStandardInputs().
|
protected |
Definition at line 3355 of file EditPage.php.
References $attribs, $customAttribs, $name, addNewLineAtEnd(), buildTextboxAttribs(), and Html\textarea().
Referenced by displayViewSourcePage(), showTextbox1(), and showTextbox2().
|
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 3305 of file EditPage.php.
References $attribs, $customAttribs, captcha-old\count, MWNamespace\getRestrictionLevels(), showTextbox(), and wasDeletedSinceLastEdit().
Referenced by showContentForm(), and showEditForm().
|
protected |
Definition at line 3351 of file EditPage.php.
References showTextbox().
Referenced by showConflict(), and spamPageWithContent().
|
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 3511 of file EditPage.php.
References $out, and Hooks\run().
Referenced by showEditForm().
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 4478 of file EditPage.php.
References $out, $textbox1, getContextTitle(), showDiff(), showTextbox2(), and wfEscapeWikiText().
Referenced by handleStatus().
EditPage::submit | ( | ) |
Definition at line 550 of file EditPage.php.
References edit(), and wfDeprecated().
|
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 2620 of file EditPage.php.
References getTitle(), isSupportedContentModel(), and ContentHandler\makeContent().
Referenced by getContentObject(), getPreviewText(), internalAttemptSave(), showConflict(), and showDiff().
|
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 2592 of file EditPage.php.
References isSupportedContentModel().
Referenced by displayViewSourcePage(), initialiseForm(), internalAttemptSave(), and showEditForm().
EditPage::tokenOk | ( | & | $request | ) |
Make sure the form isn't faking a user's credentials.
WebRequest | &$request |
Definition at line 1468 of file EditPage.php.
References $mTokenOk, $request, and $user.
Referenced by importFormData().
|
protected |
Register the change of watch status.
Definition at line 2266 of file EditPage.php.
References $mTitle, $title, $user, $watchthis, DeferredUpdates\addCallableUpdate(), WatchAction\doWatchOrUnwatch(), User\IGNORE_USER_RIGHTS, and use.
Referenced by internalAttemptSave().
|
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 3753 of file EditPage.php.
References $deletedSinceEdit, getLastDelete(), and wfTimestamp().
Referenced by internalAttemptSave(), showEditForm(), and showTextbox1().
Definition at line 234 of file EditPage.php.
Referenced by displayPermissionsError().
|
protected |
Definition at line 306 of file EditPage.php.
bool EditPage::$allowBlankSummary = false |
Definition at line 300 of file EditPage.php.
|
protected |
Definition at line 312 of file EditPage.php.
string EditPage::$autoSumm = '' |
Definition at line 315 of file EditPage.php.
Referenced by internalAttemptSave().
|
protected |
Definition at line 303 of file EditPage.php.
bool EditPage::$bot = true |
Definition at line 392 of file EditPage.php.
Referenced by attemptSave(), and internalAttemptSave().
|
private |
Definition at line 401 of file EditPage.php.
Referenced by importFormData(), and internalAttemptSave().
null string EditPage::$contentFormat = null |
Definition at line 398 of file EditPage.php.
|
protected |
Definition at line 427 of file EditPage.php.
string EditPage::$contentModel |
Definition at line 395 of file EditPage.php.
Referenced by edit().
|
protected |
Definition at line 437 of file EditPage.php.
Referenced by getContext().
bool EditPage::$deletedSinceEdit |
Definition at line 267 of file EditPage.php.
Referenced by wasDeletedSinceLastEdit().
EditPage::$didSave = false |
Definition at line 418 of file EditPage.php.
bool EditPage::$diff = false |
Definition at line 341 of file EditPage.php.
Referenced by importFormData().
|
protected |
Definition at line 424 of file EditPage.php.
string EditPage::$editFormPageTop = '' |
Before even the preview.
Definition at line 407 of file EditPage.php.
EditPage::$editFormTextAfterContent = '' |
Definition at line 413 of file EditPage.php.
EditPage::$editFormTextAfterTools = '' |
Definition at line 411 of file EditPage.php.
EditPage::$editFormTextAfterWarn = '' |
Definition at line 410 of file EditPage.php.
EditPage::$editFormTextBeforeContent = '' |
Definition at line 409 of file EditPage.php.
EditPage::$editFormTextBottom = '' |
Definition at line 412 of file EditPage.php.
EditPage::$editFormTextTop = '' |
Definition at line 408 of file EditPage.php.
string EditPage::$editintro = '' |
Definition at line 386 of file EditPage.php.
|
private |
Definition at line 368 of file EditPage.php.
string EditPage::$edittime = '' |
Definition at line 365 of file EditPage.php.
Referenced by internalAttemptSave().
|
private |
Set in ApiEditPage, based on ContentHandler::allowsDirectApiEditing.
Definition at line 432 of file EditPage.php.
bool EditPage::$firsttime |
Definition at line 273 of file EditPage.php.
string EditPage::$formtype |
Definition at line 270 of file EditPage.php.
bool EditPage::$hasPresetSummary = false |
Has a summary been preset using GET parameter &summary= ?
Definition at line 324 of file EditPage.php.
string EditPage::$hookError = '' |
Definition at line 318 of file EditPage.php.
bool EditPage::$incompleteForm = false |
Definition at line 288 of file EditPage.php.
bool EditPage::$isConflict = false |
Definition at line 237 of file EditPage.php.
bool EditPage::$isCssJsSubpage = false |
Definition at line 243 of file EditPage.php.
bool EditPage::$isCssSubpage = false |
Definition at line 249 of file EditPage.php.
Referenced by showHeader().
bool EditPage::$isJsSubpage = false |
Definition at line 255 of file EditPage.php.
bool EditPage::$isNew = false |
New page or new section.
Definition at line 264 of file EditPage.php.
Referenced by initialiseForm().
|
private |
Whether an old revision is edited.
Definition at line 442 of file EditPage.php.
bool EditPage::$isWrongCaseCssJsPage = false |
Definition at line 261 of file EditPage.php.
bool stdClass EditPage::$lastDelete |
Definition at line 276 of file EditPage.php.
Article EditPage::$mArticle |
Definition at line 220 of file EditPage.php.
Referenced by getArticle().
Definition at line 327 of file EditPage.php.
Referenced by getBaseRevision().
|
private |
Definition at line 231 of file EditPage.php.
Referenced by getContextTitle().
bool EditPage::$minoredit = false |
Definition at line 344 of file EditPage.php.
bool EditPage::$missingComment = false |
Definition at line 294 of file EditPage.php.
bool EditPage::$missingSummary = false |
Definition at line 297 of file EditPage.php.
ParserOutput EditPage::$mParserOutput |
Definition at line 321 of file EditPage.php.
EditPage::$mPreloadContent = null |
Definition at line 415 of file EditPage.php.
Referenced by getPreloadedContent().
bool EditPage::$mShowSummaryField = true |
Definition at line 330 of file EditPage.php.
Title EditPage::$mTitle |
Definition at line 228 of file EditPage.php.
Referenced by getTitle(), internalAttemptSave(), showCustomIntro(), and updateWatchlist().
bool EditPage::$mTokenOk = false |
Definition at line 279 of file EditPage.php.
Referenced by getPreviewText(), and tokenOk().
bool EditPage::$mTokenOkExceptSuffix = false |
Definition at line 282 of file EditPage.php.
bool EditPage::$mTriedSave = false |
Definition at line 285 of file EditPage.php.
bool EditPage::$nosummary = false |
Definition at line 362 of file EditPage.php.
int EditPage::$oldid = 0 |
Definition at line 380 of file EditPage.php.
Referenced by getCancelLink().
|
private |
Definition at line 222 of file EditPage.php.
Referenced by addPageProtectionWarningHeaders(), and getPreloadedContent().
int EditPage::$parentRevId = 0 |
Definition at line 383 of file EditPage.php.
Referenced by getParentRevId().
bool EditPage::$preview = false |
Definition at line 338 of file EditPage.php.
Referenced by importFormData().
EditPage::$previewTextAfterContent = '' |
Definition at line 414 of file EditPage.php.
Referenced by getPreviewText().
bool EditPage::$recreate = false |
Definition at line 350 of file EditPage.php.
bool EditPage::$save = false |
Definition at line 335 of file EditPage.php.
null EditPage::$scrolltop = null |
Definition at line 389 of file EditPage.php.
string EditPage::$section = '' |
Definition at line 371 of file EditPage.php.
string EditPage::$sectiontitle = '' |
Definition at line 374 of file EditPage.php.
Referenced by internalAttemptSave().
|
protected |
Definition at line 309 of file EditPage.php.
string EditPage::$starttime = '' |
Definition at line 377 of file EditPage.php.
string EditPage::$summary = '' |
Definition at line 359 of file EditPage.php.
Referenced by getContentObject(), getSummaryInput(), getSummaryInputWidget(), getSummaryPreview(), internalAttemptSave(), and newSectionSummary().
EditPage::$suppressIntro = false |
Definition at line 421 of file EditPage.php.
string EditPage::$textbox1 = '' |
Definition at line 353 of file EditPage.php.
Referenced by displayViewSourcePage(), importFormData(), showEditForm(), and spamPageWithContent().
string EditPage::$textbox2 = '' |
Definition at line 356 of file EditPage.php.
bool EditPage::$tooBig = false |
Definition at line 291 of file EditPage.php.
EditPage::$undidRev = 0 |
Definition at line 419 of file EditPage.php.
Referenced by importFormData(), and internalAttemptSave().
|
private |
What the user submitted in the 'wpUnicodeCheck' field.
Definition at line 447 of file EditPage.php.
bool EditPage::$watchthis = false |
Definition at line 347 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 102 of file EditPage.php.
Referenced by WikiEditorHooks\editPageAttemptSaveAfter(), ApiEditPage\execute(), and handleStatus().
const EditPage::AS_BLANK_ARTICLE = 224 |
Status: user tried to create a blank page and wpIgnoreBlankArticle == false.
Definition at line 113 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), 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 71 of file EditPage.php.
Referenced by ApiEditPage\execute(), and handleStatus().
const EditPage::AS_CANNOT_USE_CUSTOM_MODEL = 241 |
Status: when changing the content model is disallowed due to $wgContentHandlerUseDB being false.
Definition at line 183 of file EditPage.php.
Referenced by handleStatus(), and internalAttemptSave().
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 172 of file EditPage.php.
Referenced by internalAttemptSave().
const EditPage::AS_CONFLICT_DETECTED = 225 |
Status: (non-resolvable) edit conflict.
Definition at line 118 of file EditPage.php.
Referenced by WikiEditorHooks\editPageAttemptSaveAfter(), ApiEditPage\execute(), handleStatus(), and EditPageTest\provideAutoMerge().
const EditPage::AS_CONTENT_TOO_BIG = 216 |
Status: Content too big (> $wgMaxArticleSize)
Definition at line 76 of file EditPage.php.
Referenced by ApiEditPage\execute(), and handleStatus().
const EditPage::AS_END = 231 |
Status: WikiPage::doEdit() was unsuccessful.
Definition at line 139 of file EditPage.php.
Referenced by handleStatus(), and internalAttemptSave().
const EditPage::AS_HOOK_ERROR = 210 |
Status: Article update aborted by a hook function.
Definition at line 61 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), internalAttemptSave(), and runPostMergeFilters().
const EditPage::AS_HOOK_ERROR_EXPECTED = 212 |
Status: A hook function returned an error.
Definition at line 66 of file EditPage.php.
Referenced by SimpleCaptcha\confirmEditMerged(), ApiEditPage\execute(), handleStatus(), internalAttemptSave(), and runPostMergeFilters().
const EditPage::AS_IMAGE_REDIRECT_ANON = 233 |
Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)
Definition at line 149 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_IMAGE_REDIRECT_LOGGED = 234 |
Status: logged in user is not allowed to upload (User::isAllowed('upload') == false)
Definition at line 154 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_MAX_ARTICLE_SIZE_EXCEEDED = 229 |
Status: article is too big (> $wgMaxArticleSize), after merging in the new section.
Definition at line 134 of file EditPage.php.
Referenced by ApiEditPage\execute(), and handleStatus().
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 160 of file EditPage.php.
Referenced by ApiEditPage\execute(), and handleStatus().
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 108 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_PARSE_ERROR = 240 |
Status: can't parse content.
Definition at line 177 of file EditPage.php.
Referenced by handleStatus(), and internalAttemptSave().
const EditPage::AS_RATE_LIMITED = 221 |
Status: rate limiter for action 'edit' was tripped.
Definition at line 96 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_READ_ONLY_PAGE = 220 |
Status: wiki is in readonly mode (wfReadOnly() == true)
Definition at line 91 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_READ_ONLY_PAGE_ANON = 218 |
Status: this anonymous user is not allowed to edit this page.
Definition at line 81 of file EditPage.php.
Referenced by ApiEditPage\execute(), and handleStatus().
const EditPage::AS_READ_ONLY_PAGE_LOGGED = 219 |
Status: this logged in user is not allowed to edit this page.
Definition at line 86 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_SELF_REDIRECT = 236 |
Status: user tried to create self-redirect (redirect to the same article) and wpIgnoreSelfRedirect == false.
Definition at line 166 of file EditPage.php.
Referenced by handleStatus(), and internalAttemptSave().
const EditPage::AS_SPAM_ERROR = 232 |
Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex.
Definition at line 144 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_SUCCESS_NEW_ARTICLE = 201 |
Status: Article successfully created.
Definition at line 56 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), internalAttemptSave(), and EditPageTest\provideCreatePages().
const EditPage::AS_SUCCESS_UPDATE = 200 |
Status: Article successfully updated.
Definition at line 51 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), internalAttemptSave(), EditPageTest\provideAutoMerge(), EditPageTest\testAutoMerge(), EditPageTest\testSectionEdit(), EditPageTest\testUpdatePage(), and EditPageTest\testUpdatePageTrx().
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 124 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_TEXTBOX_EMPTY = 228 |
Status: user tried to create a new section without content.
Definition at line 129 of file EditPage.php.
Referenced by ApiEditPage\execute(), handleStatus(), and internalAttemptSave().
const EditPage::AS_UNICODE_NOT_SUPPORTED = 242 |
Status: edit rejected because browser doesn't support Unicode.
Definition at line 188 of file EditPage.php.
Referenced by handleStatus(), and internalAttemptSave().
const EditPage::EDITFORM_ID = 'editform' |
HTML id and name for the beginning of the edit form.
Definition at line 193 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 214 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 199 of file EditPage.php.
Referenced by Article\view().
const EditPage::UNICODE_CHECK = 'β³π²β₯πππΎπΈβ΄πΉβ―' |
Used for Unicode support checks.
Definition at line 46 of file EditPage.php.
Referenced by EditPageTest\assertEdit(), ApiEditPage\execute(), and EditPageTest\testCheckDirectEditingDisallowed_forNonTextContent().