/**
* Status: Article successfully updated
*/
- const AS_SUCCESS_UPDATE = 200;
+ const AS_SUCCESS_UPDATE = 200;
/**
* Status: Article successfully created
*/
- const AS_SUCCESS_NEW_ARTICLE = 201;
+ const AS_SUCCESS_NEW_ARTICLE = 201;
/**
* Status: Article update aborted by a hook function
*/
- const AS_HOOK_ERROR = 210;
+ const AS_HOOK_ERROR = 210;
/**
* Status: A hook function returned an error
*/
- const AS_HOOK_ERROR_EXPECTED = 212;
+ const AS_HOOK_ERROR_EXPECTED = 212;
/**
- * Status: User is blocked from editting this page
+ * Status: User is blocked from editing this page
*/
- const AS_BLOCKED_PAGE_FOR_USER = 215;
+ const AS_BLOCKED_PAGE_FOR_USER = 215;
/**
* Status: Content too big (> $wgMaxArticleSize)
*/
- const AS_CONTENT_TOO_BIG = 216;
+ const AS_CONTENT_TOO_BIG = 216;
/**
* Status: User cannot edit? (not used)
*/
- const AS_USER_CANNOT_EDIT = 217;
+ const AS_USER_CANNOT_EDIT = 217;
/**
* Status: this anonymous user is not allowed to edit this page
*/
- const AS_READ_ONLY_PAGE_ANON = 218;
+ const AS_READ_ONLY_PAGE_ANON = 218;
/**
* Status: this logged in user is not allowed to edit this page
*/
- const AS_READ_ONLY_PAGE_LOGGED = 219;
+ const AS_READ_ONLY_PAGE_LOGGED = 219;
/**
* Status: wiki is in readonly mode (wfReadOnly() == true)
*/
- const AS_READ_ONLY_PAGE = 220;
+ const AS_READ_ONLY_PAGE = 220;
/**
* Status: rate limiter for action 'edit' was tripped
*/
- const AS_RATE_LIMITED = 221;
+ const AS_RATE_LIMITED = 221;
/**
- * Status: article was deleted while editting and param wpRecreate == false or form
+ * Status: article was deleted while editing and param wpRecreate == false or form
* was not posted
*/
- const AS_ARTICLE_WAS_DELETED = 222;
+ const AS_ARTICLE_WAS_DELETED = 222;
/**
* Status: user tried to create this page, but is not allowed to do that
- * ( Title->usercan('create') == false )
+ * ( Title->userCan('create') == false )
*/
- const AS_NO_CREATE_PERMISSION = 223;
+ const AS_NO_CREATE_PERMISSION = 223;
/**
* Status: user tried to create a blank page
*/
- const AS_BLANK_ARTICLE = 224;
+ const AS_BLANK_ARTICLE = 224;
/**
* Status: (non-resolvable) edit conflict
*/
- const AS_CONFLICT_DETECTED = 225;
+ const AS_CONFLICT_DETECTED = 225;
/**
* 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
+ * editing in his own userspace or talkspace and wpIgnoreBlankSummary == false
*/
- const AS_SUMMARY_NEEDED = 226;
+ const AS_SUMMARY_NEEDED = 226;
/**
* Status: user tried to create a new section without content
*/
- const AS_TEXTBOX_EMPTY = 228;
+ const AS_TEXTBOX_EMPTY = 228;
/**
* Status: article is too big (> $wgMaxArticleSize), after merging in the new section
/**
* not used
*/
- const AS_OK = 230;
+ const AS_OK = 230;
/**
- * Status: WikiPage::doEdit() was unsuccessfull
+ * Status: WikiPage::doEdit() was unsuccessful
*/
- const AS_END = 231;
+ const AS_END = 231;
/**
* Status: summary contained spam according to one of the regexes in $wgSummarySpamRegex
*/
- const AS_SPAM_ERROR = 232;
+ const AS_SPAM_ERROR = 232;
/**
* Status: anonymous user is not allowed to upload (User::isAllowed('upload') == false)
*/
- const AS_IMAGE_REDIRECT_ANON = 233;
+ const AS_IMAGE_REDIRECT_ANON = 233;
/**
* Status: logged in user is not allowed to upload (User::isAllowed('upload') == false)
*/
- const AS_IMAGE_REDIRECT_LOGGED = 234;
+ const AS_IMAGE_REDIRECT_LOGGED = 234;
/**
* Status: can't parse content
*/
- const AS_PARSE_ERROR = 240;
+ const AS_PARSE_ERROR = 240;
/**
* HTML id and name for the beginning of the edit form.
*/
- const EDITFORM_ID = 'editform';
+ const EDITFORM_ID = 'editform';
/**
* Prefix of key for cookie used to pass post-edit state.
public $previewTextAfterContent = '';
public $mPreloadContent = null;
- /* $didSave should be set to true whenever an article was succesfully altered. */
+ /* $didSave should be set to true whenever an article was successfully altered. */
public $didSave = false;
public $undidRev = 0;
$this->isConflict = false;
// css / js subpages of user pages get a special treatment
- $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
- $this->isCssSubpage = $this->mTitle->isCssSubpage();
- $this->isJsSubpage = $this->mTitle->isJsSubpage();
+ $this->isCssJsSubpage = $this->mTitle->isCssJsSubpage();
+ $this->isCssSubpage = $this->mTitle->isCssSubpage();
+ $this->isJsSubpage = $this->mTitle->isJsSubpage();
$this->isWrongCaseCssJsPage = $this->isWrongCaseCssJsPage();
# Show applicable editing introductions
* "View source for ..." page displaying the source code after the error message.
*
* @since 1.19
- * @param $permErrors Array of permissions errors, as returned by
+ * @param array $permErrors of permissions errors, as returned by
* Title::getUserPermissionsErrors().
* @throws PermissionsError
*/
// The edit page was reached via a red link.
// Redirect to the article page and let them click the edit tab if
// they really want a permission error.
- $wgOut->redirect( $this->mTitle->getFullUrl() );
+ $wgOut->redirect( $this->mTitle->getFullURL() );
return;
}
// The edit page was reached via a red link.
// Redirect to the article page and let them click the edit tab if
// they really want a permission error.
- $wgOut->redirect( $this->mTitle->getFullUrl() );
+ $wgOut->redirect( $this->mTitle->getFullURL() );
} else {
$wgOut->readOnlyPage( $source, $protected, $reasons, $action );
}
// Nothing *to* preview for new sections
return false;
} elseif ( ( $wgRequest->getVal( 'preload' ) !== null || $this->mTitle->exists() ) && $wgUser->getOption( 'previewonfirst' ) ) {
- // Standard preference behaviour
+ // Standard preference behavior
return true;
} elseif ( !$this->mTitle->exists() &&
isset( $wgPreviewOnOpenNamespaces[$this->mTitle->getNamespace()] ) &&
$this->starttime = null;
}
- $this->recreate = $request->getCheck( 'wpRecreate' );
+ $this->recreate = $request->getCheck( 'wpRecreate' );
$this->minoredit = $request->getCheck( 'wpMinoredit' );
$this->watchthis = $request->getCheck( 'wpWatchthis' );
} else {
# Not a posted form? Start with nothing.
wfDebug( __METHOD__ . ": Not a posted form.\n" );
- $this->textbox1 = '';
- $this->summary = '';
+ $this->textbox1 = '';
+ $this->summary = '';
$this->sectiontitle = '';
- $this->edittime = '';
- $this->starttime = wfTimestampNow();
- $this->edit = false;
- $this->preview = false;
- $this->save = false;
- $this->diff = false;
- $this->minoredit = false;
- $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overriden by request parameters
- $this->recreate = false;
+ $this->edittime = '';
+ $this->starttime = wfTimestampNow();
+ $this->edit = false;
+ $this->preview = false;
+ $this->save = false;
+ $this->diff = false;
+ $this->minoredit = false;
+ $this->watchthis = $request->getBool( 'watchthis', false ); // Watch may be overridden by request parameters
+ $this->recreate = false;
// When creating a new section, we can preload a section title by passing it as the
// preloadtitle parameter in the URL (Bug 13100)
/**
* 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
+ * this method should be overridden and return the page text that will be used
* for saving, preview parsing and so on...
*
* @param $request WebRequest
* 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
+ * This differs from Article::getContent() that when a missing revision is
* encountered the result will be null and not the
* 'missing-revision' message.
*
$rev = $this->mArticle->getRevision();
$content = $rev ? $rev->getContent( Revision::RAW ) : null;
- if ( $content === false || $content === null ) {
+ if ( $content === false || $content === null ) {
if ( !$this->contentModel ) $this->contentModel = $this->getTitle()->getContentModel();
$handler = ContentHandler::getForModelID( $this->contentModel );
}
}
-
/**
* Use this method before edit() to preload some text into the edit box
*
* Get the contents to be preloaded into the box, either set by
* an earlier setPreloadText() or by loading the given page.
*
- * @param $preload String: representing the title to preload from.
+ * @param string $preload representing the title to preload from.
*
* @return String
*
* Get the contents to be preloaded into the box, either set by
* an earlier setPreloadText() or by loading the given page.
*
- * @param $preload String: representing the title to preload from.
+ * @param string $preload representing the title to preload from.
*
* @return Content
*
// FIXME: once the interface for internalAttemptSave() is made nicer, this should use the message in $status
if ( $status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE ) {
$this->didSave = true;
- $this->setPostEditCookie();
+ if ( !$resultDetails['nullEdit'] ) {
+ $this->setPostEditCookie();
+ }
}
switch ( $status->value ) {
/**
* Attempt submission (no UI)
*
- * @param $result
- * @param $bot bool
+ * @param array $result array to add statuses to, currently with the possible keys:
+ * spam - string - Spam string from content if any spam is detected by matchSpamRegex
+ * sectionanchor - string - Section anchor for a section save
+ * nullEdit - boolean - Set if doEditContent is OK. True if null edit, false otherwise.
+ * redirect - boolean - Set if doEditContent is OK. True if resulting revision is a redirect
+ * @param bool $bot True if edit is being made under the bot right.
*
* @return Status object, possibly with a message, but always with one of the AS_* constants in $status->value,
*
return $doEditStatus;
}
+ $result['nullEdit'] = $doEditStatus->hasMessage( 'edit-no-change' );
$result['redirect'] = $content->isRedirect();
$this->updateWatchlist();
wfProfileOut( __METHOD__ );
* 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
+ * @param string|null|bool $text Text to unserialize
* @return Content The content object created from $text. If $text was false or null, false resp. null will be
* returned instead.
*
}
if ( $this->hasPresetSummary ) {
- // If a summary has been preset using &summary= we dont want to prompt for
+ // If a summary has been preset using &summary= we don't want to prompt for
// a different summary. Only prompt for a summary if the summary is blanked.
// (Bug 17416)
$this->autoSumm = md5( '' );
}
if ( $this->isConflict ) {
- // In an edit conflict bypass the overrideable content form method
+ // In an edit conflict bypass the overridable content form method
// and fallback to the raw wpTextbox1 since editconflicts can't be
// resolved between page source edits and custom ui edits using the
// custom edit ui.
$this->showHeaderCopyrightWarning();
}
-
/**
* Standard summary input and label (wgSummary), abstracted so EditPage
* subclasses may reorganize the form.
* inferred by the id given to the input. You can remove them both by
* passing array( 'id' => false ) to $userInputAttrs.
*
- * @param $summary string The value of the summary input
- * @param $labelText string The html to place inside the label
- * @param $inputAttrs array of attrs to use on the input
- * @param $spanLabelAttrs array of attrs to use on the span inside the label
+ * @param string $summary The value of the summary input
+ * @param string $labelText The html to place inside the label
+ * @param array $inputAttrs of attrs to use on the input
+ * @param array $spanLabelAttrs of attrs to use on the span inside the label
*
* @return array An array in the format array( $label, $input )
*/
function getSummaryInput( $summary = "", $labelText = null, $inputAttrs = null, $spanLabelAttrs = null ) {
- // Note: the maxlength is overriden in JS to 255 and to make it use UTF-8 bytes, not characters.
+ // Note: the maxlength is overridden in JS to 255 and to make it use UTF-8 bytes, not characters.
$inputAttrs = ( is_array( $inputAttrs ) ? $inputAttrs : array() ) + array(
'id' => 'wpSummary',
'maxlength' => '200',
* @param $isSubjectPreview Boolean: true if this is the section subject/title
* up top, or false if this is the comment summary
* down below the textarea
- * @param $summary String: The text of the summary to display
+ * @param string $summary The text of the summary to display
* @return String
*/
protected function showSummaryInput( $isSubjectPreview, $summary = "" ) {
* @param $isSubjectPreview Boolean: true if this is the section subject/title
* up top, or false if this is the comment summary
* down below the textarea
- * @param $summary String: the text of the summary to display
+ * @param string $summary the text of the summary to display
* @return String
*/
protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
* The $textoverride method can be used by subclasses overriding showContentForm
* to pass back to this method.
*
- * @param $customAttribs array of html attributes to use in the textarea
- * @param $textoverride String: optional text to override $this->textarea1 with
+ * @param array $customAttribs of html attributes to use in the textarea
+ * @param string $textoverride optional text to override $this->textarea1 with
*/
protected function showTextbox1( $customAttribs = null, $textoverride = null ) {
if ( $this->wasDeletedSinceLastEdit() && $this->formtype == 'save' ) {
* Append preview output to $wgOut.
* Includes category rendering if this is a category page.
*
- * @param $text String: the HTML to be output for the preview.
+ * @param string $text the HTML to be output for the preview.
*/
protected function showPreview( $text ) {
global $wgOut;
* Returns an array of html code of the following checkboxes:
* minor and watch
*
- * @param $tabindex int Current tabindex
- * @param $checked Array of checkbox => bool, where bool indicates the checked
+ * @param int $tabindex Current tabindex
+ * @param array $checked of checkbox => bool, where bool indicates the checked
* status of the checkbox
*
* @return array
* Returns an array of html code of the following buttons:
* save, diff, preview and live
*
- * @param $tabindex int Current tabindex
+ * @param int $tabindex Current tabindex
*
* @return array
*/
/**
* Produce the stock "your edit contains spam" page
*
- * @param $match string|bool Text which triggered one or more filters
+ * @param string|bool $match Text which triggered one or more filters
* @deprecated since 1.17 Use method spamPageWithContent() instead
*/
static function spamPage( $match = false ) {
* @private
*/
function makesafe( $invalue ) {
- // Armor existing references for reversability.
+ // Armor existing references for reversibility.
$invalue = strtr( $invalue, array( "&#x" => "�" ) );
$bytesleft = 0;
$i++;
} while ( ctype_xdigit( $invalue[$i] ) && ( $i < strlen( $invalue ) ) );
- // Do some sanity checks. These aren't needed for reversability,
+ // Do some sanity checks. These aren't needed for reversibility,
// but should help keep the breakage down if the editor
// breaks one of the entities whilst editing.
if ( ( substr( $invalue, $i, 1 ) == ";" ) and ( strlen( $hexstring ) <= 6 ) ) {
$result .= substr( $invalue, $i, 1 );
}
}
- // reverse the transform that we made for reversability reasons.
+ // reverse the transform that we made for reversibility reasons.
return strtr( $result, array( "�" => "&#x" ) );
}
}