\n" );
}
@@ -2019,31 +2024,42 @@ HTML
if ( $wgRawHtml && !$this->mTokenOk ) {
// Could be an offsite preview attempt. This is very unsafe if
// HTML is enabled, as it could be an attack.
- $parsedNote = $wgOut->parse( "
" .
- wfMsg( 'session_fail_preview_html' ) . "
" );
+ $parsedNote = '';
+ if ( $this->textbox1 !== '' ) {
+ // Do not put big scary notice, if previewing the empty
+ // string, which happens when you initially edit
+ // a category page, due to automatic preview-on-open.
+ $parsedNote = $wgOut->parse( "
" .
+ wfMsg( 'session_fail_preview_html' ) . "
" );
+ }
wfProfileOut( __METHOD__ );
return $parsedNote;
}
- # don't parse user css/js, show message about preview
+ # don't parse non-wikitext pages, show message about preview
# XXX: stupid php bug won't let us use $this->getContextTitle()->isCssJsSubpage() here -- This note has been there since r3530. Sure the bug was fixed time ago?
- if ( $this->isCssJsSubpage || $this->mTitle->isCssOrJsPage() ) {
- $level = 'user';
- if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
+ if ( $this->isCssJsSubpage || !$this->mTitle->isWikitextPage() ) {
+ if( $this->mTitle->isCssJsSubpage() ) {
+ $level = 'user';
+ } elseif( $this->mTitle->isCssOrJsPage() ) {
$level = 'site';
+ } else {
+ $level = false;
}
# Used messages to make sure grep find them:
# Messages: usercsspreview, userjspreview, sitecsspreview, sitejspreview
- if (preg_match( "/\\.css$/", $this->mTitle->getText() ) ) {
- $previewtext = "
";
+ $class = "mw-code mw-js";
+ } else {
+ throw new MWException( 'A CSS/JS (sub)page but which is not css nor js!' );
+ }
}
$parserOptions->setTidy( true );
@@ -2065,12 +2081,6 @@ HTML
wfRunHooks( 'EditPageGetPreviewText', array( $this, &$toparse ) );
- // In which language to parse the page
- // (Should this still be only for MediaWiki pages, or for all pages?)
- if ( $this->mTitle->getNamespace() == NS_MEDIAWIKI ) {
- $parserOptions->setTargetLanguage( $this->mTitle->getPageLanguage() );
- }
- $parserOptions->setTargetLanguage( $this->mTitle->getPageLanguage() );
$parserOptions->setTidy( true );
$parserOptions->enableLimitReport();
$parserOutput = $wgParser->parse( $this->mArticle->preSaveTransform( $toparse ),
@@ -2096,12 +2106,11 @@ HTML
'
' . htmlspecialchars( wfMsg( 'preview' ) ) . "
" .
$wgOut->parse( $note ) . $conflict . "\n";
- global $wgBetterDirectionality;
- if( $wgBetterDirectionality ) {
- $pageLang = $this->mTitle->getPageLanguage();
- $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir() );
- $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
- }
+ $pageLang = $this->mTitle->getPageLanguage();
+ $attribs = array( 'lang' => $pageLang->getCode(), 'dir' => $pageLang->getDir(),
+ 'class' => 'mw-content-'.$pageLang->getDir() );
+ $previewHTML = Html::rawElement( 'div', $attribs, $previewHTML );
+
wfProfileOut( __METHOD__ );
return $previewhead . $previewHTML . $this->previewTextAfterContent;
}
@@ -2126,6 +2135,28 @@ HTML
}
}
+ function getDistantTemplates() {
+ global $wgEnableInterwikiTemplatesTracking;
+ if ( !$wgEnableInterwikiTemplatesTracking ) {
+ return array( );
+ }
+ if ( $this->preview || $this->section != '' ) {
+ $templates = array();
+ if ( !isset( $this->mParserOutput ) ) return $templates;
+ $templatesList = $this->mParserOutput->getDistantTemplates();
+ foreach( $templatesList as $prefix => $templatesbyns ) {
+ foreach( $templatesbyns as $ns => $template ) {
+ foreach( array_keys( $template ) as $dbk ) {
+ $templates[] = Title::makeTitle( $ns, $dbk, null, $prefix );
+ }
+ }
+ }
+ return $templates;
+ } else {
+ return $this->mArticle->getUsedDistantTemplates();
+ }
+ }
+
/**
* Call the stock "user is blocked" page
*/
@@ -2154,23 +2185,21 @@ HTML
* Produce the stock "please login to edit pages" page
*/
function userNotLoggedInPage() {
- global $wgUser, $wgOut;
- $skin = $wgUser->getSkin();
+ global $wgOut;
$loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
- $loginLink = $skin->link(
+ $loginLink = Linker::linkKnown(
$loginTitle,
wfMsgHtml( 'loginreqlink' ),
array(),
- array( 'returnto' => $this->getContextTitle()->getPrefixedText() ),
- array( 'known', 'noclasses' )
+ array( 'returnto' => $this->getContextTitle()->getPrefixedText() )
);
$wgOut->setPageTitle( wfMsg( 'whitelistedittitle' ) );
$wgOut->setRobotPolicy( 'noindex,nofollow' );
$wgOut->setArticleRelated( false );
- $wgOut->addWikiMsgArray( 'whitelistedittext', array( $loginLink ), array( 'replaceafter' ) );
+ $wgOut->addHTML( wfMessage( 'whitelistedittext' )->rawParams( $loginLink )->parse() );
$wgOut->returnToMain( false, $this->getContextTitle() );
}
@@ -2338,10 +2367,8 @@ HTML
* filename of the button image (without path), the opening
* tag, the closing tag, optionally a sample text that is
* inserted between the two when no selection is highlighted
- * and an option to select which switches the automatic
- * selection of inserted text (default is true, see
- * mw-editbutton-image). The tip text is shown when the user
- * moves the mouse over the button.
+ * and. The tip text is shown when the user moves the mouse
+ * over the button.
*
* Also here: accesskeys (key), which are not used yet until
* someone can figure out a way to make them work in
@@ -2402,7 +2429,6 @@ HTML
'sample' => wfMsg( 'image_sample' ),
'tip' => wfMsg( 'image_tip' ),
'key' => 'D',
- 'select' => true
) : false,
$imagesAvailable ? array(
'image' => $wgLang->getImageFile( 'button-media' ),
@@ -2458,10 +2484,6 @@ HTML
continue;
}
- if( !isset( $tool['select'] ) ) {
- $tool['select'] = true;
- }
-
$params = array(
$image = $wgStylePath . '/common/images/' . $tool['image'],
// Note that we use the tip both for the ALT tag and the TITLE tag of the image.
@@ -2495,13 +2517,12 @@ HTML
* minor and watch
*
* @param $tabindex Current tabindex
- * @param $skin Skin object
* @param $checked Array of checkbox => bool, where bool indicates the checked
* status of the checkbox
*
* @return array
*/
- public function getCheckboxes( &$tabindex, $skin, $checked ) {
+ public function getCheckboxes( &$tabindex, $checked ) {
global $wgUser;
$checkboxes = array();
@@ -2519,7 +2540,7 @@ HTML
$checkboxes['minor'] =
Xml::check( 'wpMinoredit', $checked['minor'], $attribs ) .
" ";
}
}
@@ -2535,7 +2556,7 @@ HTML
$checkboxes['watch'] =
Xml::check( 'wpWatchthis', $checked['watch'], $attribs ) .
" ";
}
wfRunHooks( 'EditPageBeforeEditChecks', array( &$this, &$checkboxes, &$tabindex ) );
@@ -2626,19 +2647,16 @@ HTML
* @return string
*/
public function getCancelLink() {
- global $wgUser;
-
$cancelParams = array();
if ( !$this->isConflict && $this->mArticle->getOldID() > 0 ) {
$cancelParams['oldid'] = $this->mArticle->getOldID();
}
- return $wgUser->getSkin()->link(
+ return Linker::linkKnown(
$this->getContextTitle(),
wfMsgExt( 'cancel', array( 'parseinline' ) ),
array( 'id' => 'mw-editform-cancel' ),
- $cancelParams,
- array( 'known', 'noclasses' )
+ $cancelParams
);
}