throw new PermissionsError( $action, $permErrors );
}
+ wfRunHooks( 'EditPage::showReadOnlyForm:initial', array( $this, &$wgOut ) );
+
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setPageTitle( wfMessage( 'viewsource-title', $this->getContextTitle()->getPrefixedText() ) );
$wgOut->addBacklinkSubtitle( $this->getContextTitle() );
$preload = $wgRequest->getVal( 'preload',
// Custom preload text for new sections
$this->section === 'new' ? 'MediaWiki:addsection-preload' : '' );
+ $params = $wgRequest->getArray( 'preloadparams', array() );
- $content = $this->getPreloadedContent( $preload );
+ $content = $this->getPreloadedContent( $preload, $params );
}
// For existing pages, get text based on "undo" or section parameters.
} else {
if ( $this->section != '' ) {
// Get section edit text (returns $def_text for invalid sections)
- $orig = $this->getOriginalContent();
+ $orig = $this->getOriginalContent( $wgUser );
$content = $orig ? $orig->getSection( $this->section ) : null;
if ( !$content ) {
}
if ( $content === false ) {
- $content = $this->getOriginalContent();
+ $content = $this->getOriginalContent( $wgUser );
}
}
}
* 'missing-revision' message.
*
* @since 1.19
+ * @param User $user The user to get the revision for
* @return Content|null
*/
- private function getOriginalContent() {
+ private function getOriginalContent( User $user ) {
if ( $this->section == 'new' ) {
return $this->getCurrentContent();
}
return $handler->makeEmptyContent();
}
- $content = $revision->getContent();
+ $content = $revision->getContent( Revision::FOR_THIS_USER, $user );
return $content;
}
* 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
*
* @since 1.21
*/
- protected function getPreloadedContent( $preload ) {
+ protected function getPreloadedContent( $preload, $params = array() ) {
global $wgUser;
if ( !empty( $this->mPreloadContent ) ) {
$content = $converted;
}
- return $content->preloadTransform( $title, $parserOptions );
+ return $content->preloadTransform( $title, $parserOptions, $params );
}
/**
* 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
+ * @param Status $status For reporting the outcome to the caller
+ * @param User $user The user performing the edit
*
* @return bool
*/
return $status;
}
} elseif ( !$this->allowBlankSummary
- && !$content->equals( $this->getOriginalContent() )
+ && !$content->equals( $this->getOriginalContent( $wgUser ) )
&& !$content->isRedirect()
&& md5( $this->summary ) == $this->autoSumm
) {
}
/**
- * @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 bool $isSubjectPreview true if this is the section subject/title
+ * up top, or false if this is the comment summary
+ * down below the textarea
* @param string $summary The text of the summary to display
- * @return String
+ * @return string
*/
protected function showSummaryInput( $isSubjectPreview, $summary = "" ) {
global $wgOut, $wgContLang;
}
/**
- * @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 bool $isSubjectPreview true if this is the section subject/title
+ * up top, or false if this is the comment summary
+ * down below the textarea
* @param string $summary the text of the summary to display
- * @return String
+ * @return string
*/
protected function getSummaryPreview( $isSubjectPreview, $summary = "" ) {
// avoid spaces in preview, gets always trimmed on save
'tip' => wfMessage( 'media_tip' )->text(),
'key' => 'M'
) : false,
- class_exists( 'MathRenderer' ) ? array(
- 'image' => $wgLang->getImageFile( 'button-math' ),
- 'id' => 'mw-editbutton-math',
- 'open' => "<math>",
- 'close' => "</math>",
- 'sample' => wfMessage( 'math_sample' )->text(),
- 'tip' => wfMessage( 'math_tip' )->text(),
- 'key' => 'C'
- ) : false,
array(
'image' => $wgLang->getImageFile( 'button-nowiki' ),
'id' => 'mw-editbutton-nowiki',