[ Index ] |
PHP Cross Reference of MediaWiki-1.24.0 |
[Source view] [Print] [Project Stats]
User interface for page editing. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
File Size: | 4032 lines (127 kb) |
Included or required: | 0 times |
Referenced: | 1 time |
Includes or requires: | 0 files |
EditPage:: (79 methods):
__construct()
getArticle()
getTitle()
setContextTitle()
getContextTitle()
isSupportedContentModel()
submit()
edit()
getEditPermissionErrors()
displayPermissionsError()
previewOnOpen()
isWrongCaseCssJsPage()
isSectionEditSupported()
importFormData()
importContentFormData()
initialiseForm()
getContentObject()
getOriginalContent()
getCurrentContent()
setPreloadedContent()
getPreloadedContent()
tokenOk()
setPostEditCookie()
attemptSave()
handleStatus()
runPostMergeFilters()
newSectionSummary()
internalAttemptSave()
updateWatchlist()
mergeChangesIntoContent()
getBaseRevision()
matchSpamRegex()
matchSummarySpamRegex()
matchSpamRegexInternal()
setHeaders()
showIntro()
showCustomIntro()
toEditText()
toEditContent()
showEditForm()
extractSectionTitle()
showHeader()
getSummaryInput()
showSummaryInput()
getSummaryPreview()
showFormBeforeText()
showFormAfterText()
showContentForm()
showTextbox1()
showTextbox2()
showTextbox()
displayPreviewArea()
showPreview()
showDiff()
showHeaderCopyrightWarning()
showTosSummary()
showEditTools()
getCopywarn()
getCopyrightWarning()
getPreviewLimitReport()
showStandardInputs()
showConflict()
getCancelLink()
getActionURL()
wasDeletedSinceLastEdit()
getLastDelete()
getPreviewText()
getTemplates()
getEditToolbar()
getCheckboxes()
getEditButtons()
livePreview()
noSuchSectionPage()
spamPageWithContent()
checkUnicodeCompliantBrowser()
safeUnicodeInput()
safeUnicodeOutput()
makeSafe()
unmakeSafe()
__construct( Article $article ) X-Ref |
param: Article $article |
getArticle() X-Ref |
return: Article |
getTitle() X-Ref |
return: Title |
setContextTitle( $title ) X-Ref |
Set the context Title object param: Title|null $title Title object or null |
getContextTitle() X-Ref |
Get the context title object. If not set, $wgTitle will be returned. This behavior might change in the future to return $this->mTitle instead. return: Title |
isSupportedContentModel( $modelId ) X-Ref |
Returns if the given content model is editable. param: string $modelId The ID of the content model to test. Use CONTENT_MODEL_XXX constants. return: bool |
submit() X-Ref |
No description |
edit() X-Ref |
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. |
getEditPermissionErrors() X-Ref |
return: array |
displayPermissionsError( array $permErrors ) X-Ref |
Display a permissions error page, like OutputPage::showPermissionsErrorPage(), but with the following differences: - If redlink=1, the user will be redirected to the page - If there is content to display or the error occurs while either saving, previewing or showing the difference, it will be a "View source for ..." page displaying the source code after the error message. param: array $permErrors Array of permissions errors, as returned by |
previewOnOpen() X-Ref |
Should we show a preview when the edit form is first shown? return: bool |
isWrongCaseCssJsPage() X-Ref |
Checks whether the user entered a skin name in uppercase, e.g. "User:Example/Monobook.css" instead of "monobook.css" return: bool |
isSectionEditSupported() X-Ref |
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. return: bool True if this edit page supports sections, false otherwise. |
importFormData( &$request ) X-Ref |
This function collects the form data and uses it to populate various member variables. param: WebRequest $request |
importContentFormData( &$request ) X-Ref |
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... param: WebRequest $request |
initialiseForm() X-Ref |
Initialise form fields in the object Called on the first invocation, e.g. when a user clicks an edit link return: bool If the requested section is valid |
getContentObject( $def_content = null ) X-Ref |
param: Content|null $def_content The default value to return return: Content|null Content on success, $def_content for invalid sections |
getOriginalContent( User $user ) X-Ref |
Get the content of the wanted revision, without section extraction. The result of this function can be used to compare user's input with section replaced in its context (using WikiPage::replaceSection()) to the original text of the edit. This differs from Article::getContent() that when a missing revision is encountered the result will be null and not the 'missing-revision' message. param: User $user The user to get the revision for return: Content|null |
getCurrentContent() X-Ref |
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. return: Content |
setPreloadedContent( Content $content ) X-Ref |
Use this method before edit() to preload some content into the edit box param: Content $content |
getPreloadedContent( $preload, $params = array() X-Ref |
Get the contents to be preloaded into the box, either set by an earlier setPreloadText() or by loading the given page. param: string $preload Representing the title to preload from. param: array $params Parameters to use (interface-message style) in the preloaded text return: Content |
tokenOk( &$request ) X-Ref |
Make sure the form isn't faking a user's credentials. param: WebRequest $request return: bool |
setPostEditCookie( $statusValue ) X-Ref |
Sets post-edit cookie indicating the user just saved a particular revision. This uses a temporary cookie for each revision ID so separate saves will never interfere with each other. The cookie is deleted in the mediawiki.action.view.postEdit JS module after the redirect. It must be clearable by JavaScript code, so it must not be marked HttpOnly. The JavaScript code converts the cookie to a wgPostEdit config variable. If the variable were set on the server, it would be cached, which is unwanted since the post-edit state should only apply to the load right after the save. param: int $statusValue The status value (to check for new article status) |
attemptSave() X-Ref |
Attempt submission return: bool False if output is done, true if the rest of the form should be displayed |
handleStatus( Status $status, $resultDetails ) X-Ref |
Handle status, such as after attempt save param: Status $status param: array|bool $resultDetails return: bool False, if output is done, true if rest of the form should be displayed |
runPostMergeFilters( Content $content, Status $status, User $user ) X-Ref |
Run hooks that can filter edits just before they get saved. param: Content $content The Content to filter. param: Status $status For reporting the outcome to the caller param: User $user The user performing the edit return: bool |
newSectionSummary( &$sectionanchor = null ) X-Ref |
Return the summary to be used for a new section. param: string $sectionanchor Set to the section anchor text return: string |
internalAttemptSave( &$result, $bot = false ) X-Ref |
Attempt submission (no UI) param: array $result Array to add statuses to, currently with the param: bool $bot True if edit is being made under the bot right. return: Status Status object, possibly with a message, but always with |
updateWatchlist() X-Ref |
Register the change of watch status |
mergeChangesIntoContent( &$editContent ) X-Ref |
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. param: Content $editContent return: bool |
getBaseRevision() X-Ref |
return: Revision |
matchSpamRegex( $text ) X-Ref |
Check given input text against $wgSpamRegex, and return the text of the first match. param: string $text return: string|bool Matching string or false |
matchSummarySpamRegex( $text ) X-Ref |
Check given input text against $wgSummarySpamRegex, and return the text of the first match. param: string $text return: string|bool Matching string or false |
matchSpamRegexInternal( $text, $regexes ) X-Ref |
param: string $text param: array $regexes return: bool|string |
setHeaders() X-Ref |
No description |
showIntro() X-Ref |
Show all applicable editing introductions |
showCustomIntro() X-Ref |
Attempt to show a custom editing introduction, if supplied return: bool |
toEditText( $content ) X-Ref |
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. param: Content|null|bool|string $content return: string The editable text form of the content. |
toEditContent( $text ) X-Ref |
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. param: string|null|bool $text Text to unserialize return: Content The content object created from $text. If $text was false |
showEditForm( $formCallback = null ) X-Ref |
Send the edit form and related headers to $wgOut param: callable|null $formCallback That takes an OutputPage parameter; will be called |
extractSectionTitle( $text ) X-Ref |
Extract the section title from current section text, if any. param: string $text return: string|bool String or false |
showHeader() X-Ref |
return: bool |
getSummaryInput( $summary = "", $labelText = null,$inputAttrs = null, $spanLabelAttrs = null) X-Ref |
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. param: string $summary The value of the summary input param: string $labelText The html to place inside the label param: array $inputAttrs Array of attrs to use on the input param: array $spanLabelAttrs Array of attrs to use on the span inside the label return: array An array in the format array( $label, $input ) |
showSummaryInput( $isSubjectPreview, $summary = "" ) X-Ref |
param: bool $isSubjectPreview True if this is the section subject/title param: string $summary The text of the summary to display |
getSummaryPreview( $isSubjectPreview, $summary = "" ) X-Ref |
param: bool $isSubjectPreview True if this is the section subject/title param: string $summary The text of the summary to display return: string |
showFormBeforeText() X-Ref |
No description |
showFormAfterText() X-Ref |
No description |
showContentForm() X-Ref |
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 |
showTextbox1( $customAttribs = null, $textoverride = null ) X-Ref |
Method to output wpTextbox1 The $textoverride method can be used by subclasses overriding showContentForm to pass back to this method. param: array $customAttribs Array of html attributes to use in the textarea param: string $textoverride Optional text to override $this->textarea1 with |
showTextbox2() X-Ref |
No description |
showTextbox( $text, $name, $customAttribs = array() X-Ref |
No description |
displayPreviewArea( $previewOutput, $isOnTop = false ) X-Ref |
No description |
showPreview( $text ) X-Ref |
Append preview output to $wgOut. Includes category rendering if this is a category page. param: string $text The HTML to be output for the preview. |
showDiff() X-Ref |
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. |
showHeaderCopyrightWarning() X-Ref |
Show the header copyright warning. |
showTosSummary() X-Ref |
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! |
showEditTools() X-Ref |
No description |
getCopywarn() X-Ref |
Get the copyright warning Renamed to getCopyrightWarning(), old name kept around for backwards compatibility return: string |
getCopyrightWarning( $title, $format = 'plain' ) X-Ref |
Get the copyright warning, by default returns wikitext param: Title $title param: string $format Output format, valid values are any function of a Message object return: string |
getPreviewLimitReport( $output ) X-Ref |
Get the Limit report for page previews param: ParserOutput $output ParserOutput object from the parse return: string HTML |
showStandardInputs( &$tabindex = 2 ) X-Ref |
No description |
showConflict() X-Ref |
Show an edit conflict. textbox1 is already shown in showEditForm(). If you want to use another entry point to this function, be careful. |
getCancelLink() X-Ref |
return: string |
getActionURL( Title $title ) X-Ref |
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. param: Title $title Title object for which is being edited (where we go to for &action= links) return: string |
wasDeletedSinceLastEdit() X-Ref |
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. return: bool |
getLastDelete() X-Ref |
return: bool|stdClass |
getPreviewText() X-Ref |
Get the rendered text for previewing. return: string |
getTemplates() X-Ref |
return: array |
getEditToolbar() X-Ref |
Shows a bulletin board style toolbar for common editing functions. It can be disabled in the user preferences. return: string |
getCheckboxes( &$tabindex, $checked ) X-Ref |
Returns an array of html code of the following checkboxes: minor and watch param: int $tabindex Current tabindex param: array $checked Array of checkbox => bool, where bool indicates the checked return: array |
getEditButtons( &$tabindex ) X-Ref |
Returns an array of html code of the following buttons: save, diff, preview and live param: int $tabindex Current tabindex return: array |
livePreview() X-Ref |
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). |
noSuchSectionPage() X-Ref |
Creates a basic error page which informs the user that they have attempted to edit a nonexistent section. |
spamPageWithContent( $match = false ) X-Ref |
Show "your edit contains spam" page with your diff and text param: string|array|bool $match Text (or array of texts) which triggered one or more filters |
checkUnicodeCompliantBrowser() X-Ref |
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. return: bool |
safeUnicodeInput( $request, $field ) X-Ref |
Filter an input field through a Unicode de-armoring process if it came from an old browser with known broken Unicode editing issues. param: WebRequest $request param: string $field return: string |
safeUnicodeOutput( $text ) X-Ref |
Filter an output field through a Unicode armoring process if it is going to an old browser with known broken Unicode editing issues. param: string $text return: string |
makeSafe( $invalue ) X-Ref |
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. param: string $invalue return: string |
unmakeSafe( $invalue ) X-Ref |
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. param: string $invalue return: string |
Generated: Fri Nov 28 14:03:12 2014 | Cross-referenced by PHPXref 0.7.1 |