MediaWiki
REL1_19
|
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. | |
blockedPage () | |
Call the stock "user is blocked" page. | |
checkUnicodeCompliantBrowser () | |
Check if the browser is on a blacklist of user-agents known to mangle UTF-8 data on form 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. | |
getContent ($def_text= '') | |
Fetch initial editing page content. | |
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) | |
livePreview () | |
Output preview text only. | |
makesafe ($invalue) | |
A number of web browsers are known to corrupt non-ASCII characters in a UTF-8 text editing environment. | |
mergeChangesInto (&$editText) | |
noCreatePermission () | |
Show an error page saying to the user that he has insufficient permissions to create a new page. | |
noSuchSectionPage () | |
Creates a basic error page which informs the user that they have attempted to edit a nonexistent section. | |
readOnlyPage ($source=null, $protected=false, $reasons=array(), $action=null) | |
Show a read-only error Parameters are the same as OutputPage:readOnlyPage() Redirect to the article page if redlink=1. | |
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. | |
safeUnicodeText ($request, $text) | |
sectionAnchor ($text) | |
Format an anchor fragment as it would appear for a given section name. | |
setContextTitle ($title) | |
Set the context Title object. | |
setHeaders () | |
setPreloadedText ($text) | |
Use this method before edit() to preload some text 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. | |
unmakesafe ($invalue) | |
Reverse the previously applied transliteration of non-ASCII characters back to UTF-8. | |
userNotLoggedInPage () | |
Produce the stock "please login to edit pages" page. | |
Static Public Member Functions | |
static | extractSectionTitle ($text) |
Extract the section title from current section text, if any. | |
static | getEditToolbar () |
Shows a bulletin board style toolbar for common editing functions. | |
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 $wgSpamRegex, and return the text of the first match. | |
static | spamPage ($match=false) |
Produce the stock "your edit contains spam" page. | |
Public Attributes | |
$action = 'submit' | |
$allowBlankSummary = false | |
$autoSumm = '' | |
$bot = true | |
$deletedSinceEdit | |
$didSave = false | |
$diff = false | |
$editFormPageTop = '' | |
$editFormTextAfterContent = '' | |
$editFormTextAfterTools = '' | |
$editFormTextAfterWarn = '' | |
$editFormTextBeforeContent = '' | |
$editFormTextBottom = '' | |
$editFormTextTop = '' | |
$editintro = '' | |
$edittime = '' | |
$firsttime | |
$formtype | |
$hookError = '' | |
$incompleteForm = false | |
$isConflict = false | |
$isCssJsSubpage = false | |
$isCssSubpage = false | |
$isJsSubpage = false | |
$isNew = false | |
$isWrongCaseCssJsPage = false | |
$kblength = false | |
$lastDelete | |
$mArticle | |
$mBaseRevision = false | |
$minoredit = false | |
$missingComment = false | |
$missingSummary = false | |
$mParserOutput | |
$mPreloadText = '' | |
$mShowSummaryField = true | |
$mTitle | |
$mTokenOk = false | |
$mTokenOkExceptSuffix = false | |
$mTriedSave = false | |
$nosummary = false | |
$oldid = 0 | |
$preview = false | |
$previewTextAfterContent = '' | |
$recreate = false | |
$save = false | |
$scrolltop = null | |
$section = '' | |
$sectiontitle = '' | |
$starttime = '' | |
$summary = '' | |
$suppressIntro = false | |
$textbox1 = '' | |
$textbox2 = '' | |
$tooBig = false | |
$undidRev = 0 | |
$watchthis = false | |
const | AS_ARTICLE_WAS_DELETED = 222 |
Status: article was deleted while editting and param wpRecreate == false or form was not posted. | |
const | AS_BLANK_ARTICLE = 224 |
Status: user tried to create a blank page. | |
const | AS_BLOCKED_PAGE_FOR_USER = 215 |
Status: User is blocked from editting 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 unsuccessfull. | |
const | AS_FILTERING = 211 |
Status: The filter function set in $wgFilterCallback returned true (= block it) | |
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_OK = 230 |
not used | |
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 editting 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 | AS_USER_CANNOT_EDIT = 217 |
Status: User cannot edit? (not used) | |
Protected Member Functions | |
commitWatch () | |
Commit the change of watch status. | |
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. | |
getCopywarn () | |
getEditPermissionErrors () | |
getLastDelete () | |
getPreloadedText ($preload) | |
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 overrided and return the page text that will be used for saving, preview parsing and so on... | |
isSectionEditSupported () | |
Does this EditPage class support section editing? This is used by EditPage subclasses to indicate their ui cannot handle section edits. | |
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? | |
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 () | |
showIntro () | |
Show all applicable editing introductions. | |
showPreview ($text) | |
Append preview output to $wgOut. | |
showStandardInputs (&$tabindex=2) | |
showSummaryInput ($isSubjectPreview, $summary="") | |
showTextbox ($content, $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. | |
userWasLastToEdit ($id, $edittime) | |
Check if no edits were made by other users since the time a user started editing the page. | |
wasDeletedSinceLastEdit () | |
Check if a page was deleted while the user was editing it, before submit. | |
Static Protected Member Functions | |
static | matchSpamRegexInternal ($text, $regexes) |
Private Member Functions | |
getCurrentText () | |
Get the actual text of the page. | |
getOriginalContent () | |
Get the content of the wanted revision, without section extraction. | |
Private Attributes | |
$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 22 of file EditPage.php.
EditPage::__construct | ( | Article $ | article | ) |
$article | Article |
Definition at line 217 of file EditPage.php.
References Article\getTitle().
Attempt submission.
Definition at line 954 of file EditPage.php.
References $bot, $wgOut, $wgUser, getContextTitle(), internalAttemptSave(), spamPageWithContent(), and wfRunHooks().
Referenced by edit().
Call the stock "user is blocked" page.
Definition at line 2953 of file EditPage.php.
References $wgUser, and wfDeprecated().
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 3068 of file EditPage.php.
References $wgBrowserBlackList.
Referenced by safeUnicodeOutput(), showFormBeforeText(), and showHeader().
EditPage::commitWatch | ( | ) | [protected] |
Commit the change of watch status.
Definition at line 1453 of file EditPage.php.
References $wgUser, WatchAction\doUnwatch(), WatchAction\doWatch(), and wfGetDB().
Referenced by internalAttemptSave().
EditPage::displayPermissionsError | ( | array $ | permErrors | ) | [protected] |
Display a permissions error page, like OutputPage::showPermissionsErrorPage(), but with the following differences:
$permErrors | Array of permissions errors, as returned by Title::getUserPermissionsErrors(). |
Definition at line 420 of file EditPage.php.
References $action, $wgOut, Linker\formatTemplates(), getContent(), getContextTitle(), getTemplates(), Html\rawElement(), showTextbox(), and wfMessage().
Referenced by edit().
EditPage::displayPreviewArea | ( | $ | previewOutput, |
$ | isOnTop = false |
||
) | [protected] |
Definition at line 2256 of file EditPage.php.
References $wgOut, Xml\openElement(), showDiff(), and showPreview().
Referenced by showEditForm().
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 277 of file EditPage.php.
References $wgOut, $wgUser, attemptSave(), displayPermissionsError(), getEditPermissionErrors(), importFormData(), initialiseForm(), isWrongCaseCssJsPage(), livePreview(), noSuchSectionPage(), previewOnOpen(), showEditForm(), showIntro(), wfDebug(), wfProfileIn(), wfProfileOut(), wfReadOnly(), and wfRunHooks().
Referenced by importFormData(), and submit().
static EditPage::extractSectionTitle | ( | $ | text | ) | [static] |
Extract the section title from current section text, if any.
string | $text |
Definition at line 1869 of file EditPage.php.
References $matches, and $wgParser.
Referenced by showHeader(), and 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.
$title | Title object for which is being edited (where we go to for &action= links) |
Definition at line 2449 of file EditPage.php.
References Title\getLocalURL().
Referenced by showEditForm().
Definition at line 225 of file EditPage.php.
Definition at line 1539 of file EditPage.php.
References Revision\loadFromTimestamp(), and wfGetDB().
Referenced by mergeChangesInto().
Definition at line 2426 of file EditPage.php.
References getContextTitle(), Linker\linkKnown(), and wfMsgExt().
Referenced by showStandardInputs().
EditPage::getCheckboxes | ( | &$ | tabindex, |
$ | checked | ||
) |
Returns an array of html code of the following checkboxes: minor and watch.
$tabindex | Current tabindex |
$checked | Array of checkbox => bool, where bool indicates the checked status of the checkbox |
Definition at line 2827 of file EditPage.php.
References $wgUser, Xml\check(), Xml\expandAttributes(), Linker\titleAttrib(), wfMsg(), wfMsgExt(), and wfRunHooks().
Referenced by showStandardInputs().
EditPage::getContent | ( | $ | def_text = '' | ) |
Fetch initial editing page content.
$def_text | string |
Definition at line 755 of file EditPage.php.
References $wgOut, $wgParser, Revision\DELETED_TEXT, getOriginalContent(), getPreloadedText(), Revision\newFromId(), wfMsgForContent(), wfMsgNoTrans(), wfProfileIn(), and wfProfileOut().
Referenced by displayPermissionsError(), and initialiseForm().
Get the context title object.
If not set, $wgTitle will be returned. This behavior might changed in the future to return $this->mTitle instead.
Definition at line 253 of file EditPage.php.
References $wgTitle.
Referenced by attemptSave(), displayPermissionsError(), getCancelLink(), setHeaders(), showEditForm(), and spamPageWithContent().
EditPage::getCopywarn | ( | ) | [protected] |
Definition at line 2360 of file EditPage.php.
References $wgRightsText, wfMsgForContent(), and wfRunHooks().
Referenced by showEditForm().
EditPage::getCurrentText | ( | ) | [private] |
Get the actual text of the page.
This is basically similar to WikiPage::getRawText() except that when the page doesn't exist an empty string is returned instead of false.
Definition at line 879 of file EditPage.php.
Referenced by getOriginalContent(), showEditForm(), and spamPageWithContent().
EditPage::getEditButtons | ( | &$ | tabindex | ) |
Returns an array of html code of the following buttons: save, diff, preview and live.
$tabindex | Current tabindex |
Definition at line 2876 of file EditPage.php.
References Xml\element(), wfMsg(), and wfRunHooks().
Referenced by showStandardInputs().
EditPage::getEditPermissionErrors | ( | ) | [protected] |
Definition at line 387 of file EditPage.php.
References $wgUser, and wfArrayDiff2().
Referenced by edit().
static EditPage::getEditToolbar | ( | ) | [static] |
Shows a bulletin board style toolbar for common editing functions.
It can be disabled in the user preferences. The necessary JavaScript code can be found in skins/common/edit.js.
Definition at line 2658 of file EditPage.php.
References $wgContLang, $wgEnableUploads, $wgForeignFileRepos, $wgLang, $wgOut, $wgStylePath, $wgUseTeX, Xml\encodeJsCall(), Html\inlineScript(), ResourceLoader\makeLoaderConditionalScript(), wfMsg(), and wfRunHooks().
Referenced by showEditForm().
EditPage::getLastDelete | ( | ) | [protected] |
Definition at line 2479 of file EditPage.php.
References $dbr, LogPage\DELETED_COMMENT, LogPage\DELETED_USER, wfGetDB(), and wfMsgHtml().
Referenced by wasDeletedSinceLastEdit().
EditPage::getOriginalContent | ( | ) | [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 difers from Article::getContent() that when a missing revision is encountered the result will be an empty string and not the 'missing-article' message.
Definition at line 860 of file EditPage.php.
References getCurrentText().
Referenced by getContent(), and internalAttemptSave().
EditPage::getPreloadedText | ( | $ | preload | ) | [protected] |
Get the contents to be preloaded into the box, either set by an earlier setPreloadText() or by loading the given page.
$preload | String: representing the title to preload from. |
Definition at line 904 of file EditPage.php.
References $page, $title, $wgParser, $wgUser, WikiPage\factory(), Title\newFromText(), and ParserOptions\newFromUser().
Referenced by getContent().
Get the rendered text for previewing.
Definition at line 2515 of file EditPage.php.
References $wgOut, $wgParser, $wgRawHtml, $wgUser, Title\newFromRedirectArray(), ParserOptions\newFromUser(), Html\rawElement(), wfMsg(), wfMsgForContent(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by livePreview(), and showEditForm().
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.
$summary | string The value of the summary input |
$labelText | string The html to place inside the label |
$inputAttrs | array of attrs to use on the input |
$spanLabelAttrs | array of attrs to use on the span inside the label |
Definition at line 2063 of file EditPage.php.
References $input, $summary, Html\input(), Xml\tags(), and Linker\tooltipAndAccesskeyAttribs().
Referenced by showSummaryInput().
EditPage::getSummaryPreview | ( | $ | isSubjectPreview, |
$ | summary = "" |
||
) | [protected] |
$isSubjectPreview | Boolean: true if this is the section subject/title up top, or false if this is the comment summary down below the textarea |
$summary | String: the text of the summary to display |
Definition at line 2122 of file EditPage.php.
References $summary, $wgParser, Linker\commentBlock(), Xml\tags(), wfMsgExt(), and wfMsgForContent().
Referenced by showEditForm(), and showStandardInputs().
Definition at line 2634 of file EditPage.php.
References Title\makeTitle().
Referenced by displayPermissionsError(), and showEditForm().
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 overrided and return the page text that will be used for saving, preview parsing and so on...
$request | WebRequest |
Definition at line 713 of file EditPage.php.
Referenced by importFormData().
EditPage::importFormData | ( | &$ | request | ) |
This function collects the form data and uses it to populate various member variables.
$request | WebRequest |
Definition at line 548 of file EditPage.php.
References $textbox1, $wgLang, $wgUser, edit(), importContentFormData(), safeUnicodeInput(), tokenOk(), wfDebug(), wfProfileIn(), wfProfileOut(), wfRunHooks(), and wfTimestampNow().
Referenced by edit().
Initialise form fields in the object Called on the first invocation, e.g.
when a user clicks an edit link
Definition at line 722 of file EditPage.php.
References $wgUser, getContent(), and wfProxyCheck().
Referenced by edit().
EditPage::internalAttemptSave | ( | &$ | result, |
$ | bot = false |
||
) |
Attempt submission (no UI)
$result | |
$bot | bool |
FIXME: This interface is TERRIBLE, but hard to get rid of due to various error display idiosyncrasies. There are also lots of cases where error metadata is set in the object and retrieved later instead of being returned, e.g. AS_CONTENT_TOO_BIG and AS_BLOCKED_PAGE_FOR_USER. All that stuff needs to be cleaned up some time.
Definition at line 1050 of file EditPage.php.
References $bot, $matches, $result, $wgFilterCallback, $wgMaxArticleSize, $wgParser, $wgUser, AS_END, AS_HOOK_ERROR, AS_HOOK_ERROR_EXPECTED, AS_IMAGE_REDIRECT_LOGGED, AS_NO_CREATE_PERMISSION, AS_RATE_LIMITED, AS_READ_ONLY_PAGE, AS_READ_ONLY_PAGE_LOGGED, AS_SPAM_ERROR, AS_SUCCESS_NEW_ARTICLE, AS_SUCCESS_UPDATE, AS_SUMMARY_NEEDED, AS_TEXTBOX_EMPTY, commitWatch(), Title\GAID_FOR_UPDATE, getOriginalContent(), matchSpamRegex(), matchSummarySpamRegex(), mergeChangesInto(), Title\newFromRedirect(), Status\newGood(), userWasLastToEdit(), wasDeletedSinceLastEdit(), wfDebug(), wfDebugLog(), wfMsgForContent(), wfProfileIn(), wfProfileOut(), wfReadOnly(), and wfRunHooks().
Referenced by attemptSave().
EditPage::isSectionEditSupported | ( | ) | [protected] |
Does this EditPage class support section editing? This is used by EditPage subclasses to indicate their ui cannot handle section edits.
Definition at line 540 of file EditPage.php.
Referenced by showHeader().
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 520 of file EditPage.php.
References Skin\getSkinNames().
Referenced by edit(), and showHeader().
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 2930 of file EditPage.php.
References $wgOut, echo, Xml\element(), getPreviewText(), and Xml\tags().
Referenced by edit().
EditPage::makesafe | ( | $ | invalue | ) |
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.
$invalue | String |
Definition at line 3140 of file EditPage.php.
References $result.
Referenced by safeUnicodeOutput().
static EditPage::matchSpamRegex | ( | $ | text | ) | [static] |
Check given input text against $wgSpamRegex, and return the text of the first match.
$text | string |
Definition at line 1557 of file EditPage.php.
References $wgSpamRegex, and matchSpamRegexInternal().
Referenced by internalAttemptSave().
static EditPage::matchSpamRegexInternal | ( | $ | text, |
$ | regexes | ||
) | [static, protected] |
$text | string |
$regexes | array |
Definition at line 1582 of file EditPage.php.
References $matches.
Referenced by matchSpamRegex(), and matchSummarySpamRegex().
static EditPage::matchSummarySpamRegex | ( | $ | text | ) | [static] |
Check given input text against $wgSpamRegex, and return the text of the first match.
$text string
Definition at line 1571 of file EditPage.php.
References $wgSummarySpamRegex, and matchSpamRegexInternal().
Referenced by internalAttemptSave(), and Title\isValidMoveOperation().
EditPage::mergeChangesInto | ( | &$ | editText | ) |
$editText string
Definition at line 1504 of file EditPage.php.
References $result, getBaseRevision(), Revision\loadFromTitle(), wfGetDB(), wfMerge(), wfProfileIn(), and wfProfileOut().
Referenced by internalAttemptSave().
Show an error page saying to the user that he has insufficient permissions to create a new page.
Definition at line 2976 of file EditPage.php.
References wfDeprecated().
Creates a basic error page which informs the user that they have attempted to edit a nonexistent section.
Definition at line 2986 of file EditPage.php.
References $res, $wgOut, wfMessage(), wfMsgExt(), and wfRunHooks().
Referenced by edit().
EditPage::previewOnOpen | ( | ) | [protected] |
Should we show a preview when the edit form is first shown?
Definition at line 489 of file EditPage.php.
References $wgPreviewOnOpenNamespaces, and $wgUser.
Referenced by edit().
EditPage::readOnlyPage | ( | $ | source = null , |
$ | protected = false , |
||
$ | reasons = array() , |
||
$ | action = null |
||
) |
Show a read-only error Parameters are the same as OutputPage:readOnlyPage() Redirect to the article page if redlink=1.
Definition at line 470 of file EditPage.php.
References $action, $wgOut, and wfDeprecated().
EditPage::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.
$request | WebRequest |
$field | String |
Definition at line 3092 of file EditPage.php.
References unmakesafe().
Referenced by importFormData().
EditPage::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.
$text | String |
Definition at line 3119 of file EditPage.php.
References $wgContLang, checkUnicodeCompliantBrowser(), and makesafe().
Referenced by showTextbox().
EditPage::safeUnicodeText | ( | $ | request, |
$ | text | ||
) |
$request | WebRequest |
$text | string |
Definition at line 3104 of file EditPage.php.
References unmakesafe().
EditPage::sectionAnchor | ( | $ | text | ) |
Format an anchor fragment as it would appear for a given section name.
$text | String |
Definition at line 3056 of file EditPage.php.
References $wgParser.
EditPage::setContextTitle | ( | $ | title | ) |
Set the context Title object.
$title | Title object or null |
Definition at line 242 of file EditPage.php.
References $title.
Definition at line 1592 of file EditPage.php.
References $title, $wgOut, $wgUser, getContextTitle(), and wfMessage().
Referenced by showEditForm().
EditPage::setPreloadedText | ( | $ | text | ) |
Use this method before edit() to preload some text into the edit box.
$text | string |
Definition at line 893 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 2408 of file EditPage.php.
References $wgOut, DifferenceEngine\setText(), showTextbox2(), wfMsg(), wfMsgExt(), and wfRunHooks().
Referenced by showEditForm().
EditPage::showContentForm | ( | ) | [protected] |
Subpage overridable method for printing the form for page content editing By default this simply outputs wpTextbox1 Subclasses can override this to provide a custom UI for editing; be it a form, or simply wpTextbox1 with a modified content that will be reverse modified when extracted from the post data.
Note that this is basically the inverse for importContentFormData
Definition at line 2177 of file EditPage.php.
References showTextbox1().
Referenced by showEditForm().
EditPage::showCustomIntro | ( | ) | [protected] |
Attempt to show a custom editing introduction, if supplied.
Definition at line 1692 of file EditPage.php.
References $title, $wgOut, and Title\newFromText().
Referenced by showIntro().
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 2307 of file EditPage.php.
References $wgContLang, $wgOut, $wgParser, $wgUser, ParserOptions\newFromUserAndLang(), DifferenceEngine\setText(), wfMsgExt(), and wfRunHooks().
Referenced by displayPreviewArea().
EditPage::showEditForm | ( | $ | formCallback = null | ) |
Send the edit form and related headers to $wgOut.
$formCallback | Callback that takes an OutputPage parameter; will be called during form output near the top, for captchas and the like. |
Definition at line 1713 of file EditPage.php.
References $comment, $wgOut, $wgUser, Xml\checkLabel(), displayPreviewArea(), Linker\formatHiddenCategories(), Linker\formatTemplates(), getActionURL(), getContextTitle(), getCopywarn(), getCurrentText(), getEditToolbar(), getPreviewText(), getSummaryPreview(), getTemplates(), Html\hidden(), Html\openElement(), Html\rawElement(), setHeaders(), showConflict(), showContentForm(), showEditTools(), showFormAfterText(), showFormBeforeText(), showHeader(), showStandardInputs(), showSummaryInput(), showTextbox1(), showTosSummary(), Linker\titleAttrib(), wasDeletedSinceLastEdit(), wfMsg(), wfMsgExt(), wfProfileIn(), wfProfileOut(), and wfRunHooks().
Referenced by edit().
EditPage::showEditTools | ( | ) | [protected] |
Definition at line 2353 of file EditPage.php.
References $wgOut, and wfMessage().
Referenced by showEditForm().
EditPage::showFormAfterText | ( | ) | [protected] |
Definition at line 2152 of file EditPage.php.
References $wgOut, $wgUser, and Html\hidden().
Referenced by showEditForm().
EditPage::showFormBeforeText | ( | ) | [protected] |
Definition at line 2137 of file EditPage.php.
References $section, $wgOut, checkUnicodeCompliantBrowser(), and Html\hidden().
Referenced by showEditForm().
EditPage::showHeader | ( | ) | [protected] |
Definition at line 1879 of file EditPage.php.
References $page, $wgLang, $wgMaxArticleSize, $wgOut, $wgUser, checkUnicodeCompliantBrowser(), Revision\DELETED_TEXT, extractSectionTitle(), MWNamespace\hasSubpages(), isSectionEditSupported(), isWrongCaseCssJsPage(), LogEventsList\showLogExtract(), wfMessage(), wfMsgNoTrans(), wfReadOnly(), and wfReadOnlyReason().
Referenced by showEditForm().
EditPage::showIntro | ( | ) | [protected] |
Show all applicable editing introductions.
Definition at line 1628 of file EditPage.php.
References $user, $wgOut, $wgUser, User\isIP(), User\newFromName(), showCustomIntro(), LogEventsList\showLogExtract(), and wfEscapeWikiText().
Referenced by edit().
EditPage::showPreview | ( | $ | text | ) | [protected] |
Append preview output to $wgOut.
Includes category rendering if this is a category page.
$text | String: the HTML to be output for the preview. |
Definition at line 2286 of file EditPage.php.
References $wgOut, and wfRunHooks().
Referenced by displayPreviewArea().
EditPage::showStandardInputs | ( | &$ | tabindex = 2 | ) | [protected] |
Definition at line 2377 of file EditPage.php.
References $wgOut, getCancelLink(), getCheckboxes(), getEditButtons(), getSummaryPreview(), Skin\makeInternalOrExternalUrl(), showSummaryInput(), wfMsg(), wfMsgExt(), and wfMsgForContent().
Referenced by showEditForm().
EditPage::showSummaryInput | ( | $ | isSubjectPreview, |
$ | summary = "" |
||
) | [protected] |
$isSubjectPreview | Boolean: true if this is the section subject/title up top, or false if this is the comment summary down below the textarea |
$summary | String: The text of the summary to display |
Definition at line 2096 of file EditPage.php.
References $input, $summary, $wgContLang, $wgOut, getSummaryInput(), and wfMsgExt().
Referenced by showEditForm(), and showStandardInputs().
EditPage::showTextbox | ( | $ | content, |
$ | name, | ||
$ | customAttribs = array() |
||
) | [protected] |
Definition at line 2229 of file EditPage.php.
References $wgOut, $wgUser, safeUnicodeOutput(), and Html\textarea().
Referenced by displayPermissionsError(), showTextbox1(), and showTextbox2().
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.
$customAttribs | An array of html attributes to use in the textarea |
$textoverride | String: optional text to override $this->textarea1 with |
Definition at line 2189 of file EditPage.php.
References showTextbox(), and wasDeletedSinceLastEdit().
Referenced by showContentForm(), and showEditForm().
EditPage::showTextbox2 | ( | ) | [protected] |
Definition at line 2225 of file EditPage.php.
References showTextbox().
Referenced by showConflict(), and spamPageWithContent().
EditPage::showTosSummary | ( | ) | [protected] |
Give a chance for site and per-namespace customizations of terms of service summary link that might exist separately from the copyright notice.
This will display between the save button and the edit tools, so should remain short!
Definition at line 2342 of file EditPage.php.
References $wgOut, wfMessage(), and wfRunHooks().
Referenced by showEditForm().
static EditPage::spamPage | ( | $ | match = false | ) | [static] |
Produce the stock "your edit contains spam" page.
$match | Text which triggered one or more filters |
Definition at line 3004 of file EditPage.php.
References $wgOut, $wgTitle, wfDeprecated(), wfEscapeWikiText(), and wfMessage().
EditPage::spamPageWithContent | ( | $ | match = false | ) |
Show "your edit contains spam" page with your diff and text.
$match | Text which triggered one or more filters |
Definition at line 3026 of file EditPage.php.
References $wgOut, getContextTitle(), getCurrentText(), DifferenceEngine\setText(), showTextbox2(), wfEscapeWikiText(), wfMessage(), wfMsg(), and wfMsgExt().
Referenced by attemptSave().
EditPage::submit | ( | ) |
Definition at line 262 of file EditPage.php.
References edit().
EditPage::tokenOk | ( | &$ | request | ) |
Make sure the form isn't faking a user's credentials.
$request | WebRequest |
Definition at line 942 of file EditPage.php.
References $wgUser.
Referenced by importFormData().
EditPage::unmakesafe | ( | $ | invalue | ) |
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.
$invalue | String |
Definition at line 3182 of file EditPage.php.
References $result, and codepointToUtf8().
Referenced by safeUnicodeInput(), and safeUnicodeText().
Produce the stock "please login to edit pages" page.
Definition at line 2965 of file EditPage.php.
References wfDeprecated().
EditPage::userWasLastToEdit | ( | $ | id, |
$ | edittime | ||
) | [protected] |
Check if no edits were made by other users since the time a user started editing the page.
Limit to 50 revisions for the sake of performance.
$id | int |
$edittime | string |
Definition at line 1477 of file EditPage.php.
References $edittime, $res, and wfGetDB().
Referenced by internalAttemptSave().
EditPage::wasDeletedSinceLastEdit | ( | ) | [protected] |
Check if a page was deleted while the user was editing it, before submit.
Note that we rely on the logging table, which hasn't been always there, but that doesn't matter, because this only applies to brand new deletes.
Definition at line 2459 of file EditPage.php.
References getLastDelete(), and wfTimestamp().
Referenced by internalAttemptSave(), showEditForm(), and showTextbox1().
EditPage::$action = 'submit' |
Definition at line 157 of file EditPage.php.
Referenced by displayPermissionsError(), and readOnlyPage().
EditPage::$allowBlankSummary = false |
Definition at line 176 of file EditPage.php.
EditPage::$autoSumm = '' |
Definition at line 177 of file EditPage.php.
EditPage::$bot = true |
Definition at line 194 of file EditPage.php.
Referenced by attemptSave(), and internalAttemptSave().
EditPage::$deletedSinceEdit |
Definition at line 164 of file EditPage.php.
EditPage::$didSave = false |
Definition at line 209 of file EditPage.php.
EditPage::$diff = false |
Definition at line 190 of file EditPage.php.
EditPage::$editFormPageTop = '' |
Definition at line 198 of file EditPage.php.
EditPage::$editFormTextAfterContent = '' |
Definition at line 204 of file EditPage.php.
EditPage::$editFormTextAfterTools = '' |
Definition at line 202 of file EditPage.php.
EditPage::$editFormTextAfterWarn = '' |
Definition at line 201 of file EditPage.php.
EditPage::$editFormTextBeforeContent = '' |
Definition at line 200 of file EditPage.php.
EditPage::$editFormTextBottom = '' |
Definition at line 203 of file EditPage.php.
EditPage::$editFormTextTop = '' |
Definition at line 199 of file EditPage.php.
EditPage::$editintro = '' |
Definition at line 194 of file EditPage.php.
EditPage::$edittime = '' |
Definition at line 193 of file EditPage.php.
Referenced by userWasLastToEdit().
EditPage::$firsttime |
Definition at line 166 of file EditPage.php.
EditPage::$formtype |
Definition at line 165 of file EditPage.php.
EditPage::$hookError = '' |
Definition at line 178 of file EditPage.php.
EditPage::$incompleteForm = false |
Definition at line 171 of file EditPage.php.
EditPage::$isConflict = false |
Definition at line 158 of file EditPage.php.
EditPage::$isCssJsSubpage = false |
Definition at line 159 of file EditPage.php.
EditPage::$isCssSubpage = false |
Definition at line 160 of file EditPage.php.
EditPage::$isJsSubpage = false |
Definition at line 161 of file EditPage.php.
EditPage::$isNew = false |
Definition at line 163 of file EditPage.php.
EditPage::$isWrongCaseCssJsPage = false |
Definition at line 162 of file EditPage.php.
EditPage::$kblength = false |
Definition at line 173 of file EditPage.php.
EditPage::$lastDelete |
Definition at line 167 of file EditPage.php.
EditPage::$mArticle |
Definition at line 150 of file EditPage.php.
EditPage::$mBaseRevision = false |
Definition at line 186 of file EditPage.php.
EditPage::$mContextTitle = null [private] |
Definition at line 156 of file EditPage.php.
EditPage::$minoredit = false |
Definition at line 191 of file EditPage.php.
EditPage::$missingComment = false |
Definition at line 174 of file EditPage.php.
EditPage::$missingSummary = false |
Definition at line 175 of file EditPage.php.
EditPage::$mParserOutput |
Definition at line 184 of file EditPage.php.
EditPage::$mPreloadText = '' |
Definition at line 206 of file EditPage.php.
EditPage::$mShowSummaryField = true |
Definition at line 187 of file EditPage.php.
EditPage::$mTitle |
Definition at line 155 of file EditPage.php.
EditPage::$mTokenOk = false |
Definition at line 168 of file EditPage.php.
EditPage::$mTokenOkExceptSuffix = false |
Definition at line 169 of file EditPage.php.
EditPage::$mTriedSave = false |
Definition at line 170 of file EditPage.php.
EditPage::$nosummary = false |
Definition at line 192 of file EditPage.php.
EditPage::$oldid = 0 |
Definition at line 194 of file EditPage.php.
EditPage::$preview = false |
Definition at line 190 of file EditPage.php.
EditPage::$previewTextAfterContent = '' |
Definition at line 205 of file EditPage.php.
EditPage::$recreate = false |
Definition at line 191 of file EditPage.php.
EditPage::$save = false |
Definition at line 190 of file EditPage.php.
EditPage::$scrolltop = null |
Definition at line 194 of file EditPage.php.
EditPage::$section = '' |
Definition at line 193 of file EditPage.php.
Referenced by showFormBeforeText().
EditPage::$sectiontitle = '' |
Definition at line 193 of file EditPage.php.
EditPage::$starttime = '' |
Definition at line 193 of file EditPage.php.
EditPage::$summary = '' |
Definition at line 192 of file EditPage.php.
Referenced by getSummaryInput(), getSummaryPreview(), and showSummaryInput().
EditPage::$suppressIntro = false |
Definition at line 212 of file EditPage.php.
EditPage::$textbox1 = '' |
Definition at line 192 of file EditPage.php.
Referenced by importFormData().
EditPage::$textbox2 = '' |
Definition at line 192 of file EditPage.php.
EditPage::$tooBig = false |
Definition at line 172 of file EditPage.php.
EditPage::$undidRev = 0 |
Definition at line 210 of file EditPage.php.
EditPage::$watchthis = false |
Definition at line 191 of file EditPage.php.
const EditPage::AS_ARTICLE_WAS_DELETED = 222 |
Status: article was deleted while editting and param wpRecreate == false or form was not posted.
Definition at line 88 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_BLANK_ARTICLE = 224 |
Status: user tried to create a blank page.
Definition at line 99 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_BLOCKED_PAGE_FOR_USER = 215 |
Status: User is blocked from editting this page.
Definition at line 52 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_CONFLICT_DETECTED = 225 |
Status: (non-resolvable) edit conflict.
Definition at line 104 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_CONTENT_TOO_BIG = 216 |
Status: Content too big (> $wgMaxArticleSize)
Definition at line 57 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_END = 231 |
Status: WikiPage::doEdit() was unsuccessfull.
Definition at line 130 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_FILTERING = 211 |
Status: The filter function set in $wgFilterCallback returned true (= block it)
Definition at line 42 of file EditPage.php.
Referenced by ApiEditPage\execute().
const EditPage::AS_HOOK_ERROR = 210 |
Status: Article update aborted by a hook function.
Definition at line 37 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_HOOK_ERROR_EXPECTED = 212 |
Status: A hook function returned an error.
Definition at line 47 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
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(), 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 120 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 94 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_OK = 230 |
not used
Definition at line 125 of file EditPage.php.
const EditPage::AS_RATE_LIMITED = 221 |
Status: rate limiter for action 'edit' was tripped.
Definition at line 82 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_READ_ONLY_PAGE = 220 |
Status: wiki is in readonly mode (wfReadOnly() == true)
Definition at line 77 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_READ_ONLY_PAGE_ANON = 218 |
Status: this anonymous user is not allowed to edit this page.
Definition at line 67 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 72 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
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(), and internalAttemptSave().
const EditPage::AS_SUCCESS_NEW_ARTICLE = 201 |
Status: Article successfully created.
Definition at line 32 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_SUCCESS_UPDATE = 200 |
Status: Article successfully updated.
Definition at line 27 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_SUMMARY_NEEDED = 226 |
Status: no edit summary given and the user has forceeditsummary set and the user is not editting in his own userspace or talkspace and wpIgnoreBlankSummary == false.
Definition at line 110 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_TEXTBOX_EMPTY = 228 |
Status: user tried to create a new section without content.
Definition at line 115 of file EditPage.php.
Referenced by ApiEditPage\execute(), and internalAttemptSave().
const EditPage::AS_USER_CANNOT_EDIT = 217 |
Status: User cannot edit? (not used)
Definition at line 62 of file EditPage.php.