* (bug 14401) Fix Safari access key tooltips for Windows and >3.1 Mac versions
* (bug 14432) Fix notice regression in Special:Newpages feed mode
* (bug 11951) EditPage::getEditToolbar() is now static.
+* (bug 14404) Use of {{int:...}} to generate links no longer breaks links table
+ if user has a custom interface language
=== API changes in 1.13 ===
*/
function isRedirect( $text = false ) {
if ( $text === false ) {
- if ( $this->mDataLoaded )
+ if ( $this->mDataLoaded )
return $this->mIsRedirect;
-
+
// Apparently loadPageData was never called
$this->loadContent();
$titleObj = Title::newFromRedirect( $this->fetchContent() );
$this->viewUpdates();
wfProfileOut( __METHOD__ );
}
-
+
protected function viewRedirect( $target, $overwriteSubtitle = true, $forceKnown = false ) {
global $wgParser, $wgOut, $wgContLang, $wgStylePath, $wgUser;
-
+
# Display redirect
$imageDir = $wgContLang->isRTL() ? 'rtl' : 'ltr';
$imageUrl = $wgStylePath.'/common/images/redirect' . $imageDir . '.png';
-
+
if( $overwriteSubtitle ) {
$wgOut->setSubtitle( wfMsgHtml( 'redirectpagesub' ) );
}
$wgOut->addHTML( '<img src="'.$imageUrl.'" alt="#REDIRECT " />' .
'<span class="redirectText">'.$link.'</span>' );
-
+
}
function addTrackbacks() {
# Update page
$ok = $this->updateRevisionOn( $dbw, $revision, $lastRevision );
-
+
wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, $baseRevId) );
if( !$ok ) {
# Update the page record with revision data
$this->updateRevisionOn( $dbw, $revision, 0 );
-
+
wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) );
if( !( $flags & EDIT_SUPPRESS_RC ) ) {
'page_id' => $id
), 'Article::protect'
);
-
+
wfRunHooks( 'NewRevisionFromEditComplete', array($this, $nullRevision, false) );
wfRunHooks( 'ArticleProtectComplete', array( &$this, &$wgUser, $limit, $reason ) );
function doDelete( $reason, $suppress = false ) {
global $wgOut, $wgUser;
wfDebug( __METHOD__."\n" );
-
+
$id = $this->getId();
if (wfRunHooks('ArticleDelete', array(&$this, &$wgUser, &$reason))) {
if( empty( $summary ) ){
$summary = wfMsgForContent( 'revertpage' );
}
-
+
# Allow the custom summary to use the same args as the default message
$args = array(
$target->getUserText(), $from, $s->rev_id,
$wgLang->timeanddate(wfTimestamp(TS_MW, $s->rev_timestamp), true),
$current->getId(), $wgLang->timeanddate($current->getTimestamp())
);
- $summary = wfMsgReplaceArgs( $summary, $args );
+ $summary = wfMsgReplaceArgs( $summary, $args );
# Save
$flags = EDIT_UPDATE;
. $wgUser->getSkin()->userToolLinks( $target->getUser(), $target->getUserText() );
$wgOut->addHtml( wfMsgExt( 'rollback-success', array( 'parse', 'replaceafter' ), $old, $new ) );
$wgOut->returnToMain( false, $this->mTitle );
-
+
if( !$wgRequest->getBool( 'hidediff', false ) ) {
$de = new DifferenceEngine( $this->mTitle, $current->getId(), 'next', false, true );
$de->showDiff( '', '' );
/**
* Prepare text which is about to be saved.
- * Returns a stdclass with source, pst and output members
+ * Returns a stdclass with source, pst, output and user members
*/
function prepareTextForEdit( $text, $revid=null ) {
if ( $this->mPreparedEdit && $this->mPreparedEdit->newText == $text && $this->mPreparedEdit->revid == $revid) {
$edit->revid = $revid;
$edit->newText = $text;
$edit->pst = $this->preSaveTransform( $text );
- $options = new ParserOptions;
+ $user = new User();
+ $options = new ParserOptions( $user );
$options->setTidy( true );
+ $options->setInterfaceMessage( true ); // @bug 14404
$options->enableLimitReport();
$edit->output = $wgParser->parse( $edit->pst, $this->mTitle, $options, true, true, $revid );
$edit->oldText = $this->getContent();
+ $edit->user = $user;
$this->mPreparedEdit = $edit;
return $edit;
}
# Save it to the parser cache
if ( $wgEnableParserCache ) {
$parserCache = ParserCache::singleton();
- $parserCache->save( $editInfo->output, $this, $wgUser );
+ $parserCache->save( $editInfo->output, $this, $editInfo->user, /*content*/true );
}
# Update the links tables
$revision->insertOn( $dbw );
$this->updateRevisionOn( $dbw, $revision );
$dbw->commit();
-
+
wfRunHooks( 'NewRevisionFromEditComplete', array($this, $revision, false) );
wfProfileOut( __METHOD__ );
static function intFunction( $parser, $part1 = '' /*, ... */ ) {
if ( strval( $part1 ) !== '' ) {
$args = array_slice( func_get_args(), 2 );
- return wfMsgReal( $part1, $args, true );
+ $opts = array();
+ if( ( $langObj = $parser->mOptions->getTargetLanguage() ) !== null ){
+ $opts['language'] = $langObj->getCode();
+ } else if( $parser->mOptions->getInterfaceMessage() ) {
+ $opts[] = 'content';
+ }
+ $msg = call_user_func_array( 'wfMsgExt',
+ array_merge( array( $part1, $opts ), $args ) );
+ return $parser->replaceVariables( $msg );
} else {
return array( 'found' => false );
}
$this->mMemc =& $memCached;
}
- function getKey( &$article, &$user ) {
+ function getKey( &$article, &$user, $content = false ) {
global $action;
- $hash = $user->getPageRenderingHash();
+ $hash = $user->getPageRenderingHash( $content );
if( !$article->mTitle->quickUserCan( 'edit' ) ) {
// section edit links are suppressed even if the user has them on
$edit = '!edit=0';
return $value;
}
- function save( $parserOutput, &$article, &$user ){
+ function save( $parserOutput, &$article, &$user, $content = false ){
global $wgParserCacheExpireTime;
- $key = $this->getKey( $article, $user );
+ $key = $this->getKey( $article, $user, $content );
if( $parserOutput->getCacheTime() != -1 ) {
* @todo document
* @ingroup Parser
*/
-class ParserOptions
-{
+class ParserOptions {
# All variables are supposed to be private in theory, although in practise this is not the case.
- var $mUseTeX; # Use texvc to expand <math> tags
- var $mUseDynamicDates; # Use DateFormatter to format dates
- var $mInterwikiMagic; # Interlanguage links are removed and returned in an array
- var $mAllowExternalImages; # Allow external images inline
- var $mAllowExternalImagesFrom; # If not, any exception?
- var $mSkin; # Reference to the preferred skin
- var $mDateFormat; # Date format index
- var $mEditSection; # Create "edit section" links
- var $mNumberHeadings; # Automatically number headings
- var $mAllowSpecialInclusion; # Allow inclusion of special pages
- var $mTidy; # Ask for tidy cleanup
- var $mInterfaceMessage; # Which lang to call for PLURAL and GRAMMAR
- var $mTargetLanguage; # Overrides above setting with arbitrary language
- var $mMaxIncludeSize; # Maximum size of template expansions, in bytes
- var $mMaxPPNodeCount; # Maximum number of nodes touched by PPFrame::expand()
- var $mMaxPPExpandDepth; # Maximum recursion depth in PPFrame::expand()
- var $mMaxTemplateDepth; # Maximum recursion depth for templates within templates
- var $mRemoveComments; # Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
- var $mTemplateCallback; # Callback for template fetching
- var $mEnableLimitReport; # Enable limit report in an HTML comment on output
- var $mTimestamp; # Timestamp used for {{CURRENTDAY}} etc.
+ var $mUseTeX; //!< Use texvc to expand <math> tags
+ var $mUseDynamicDates; //!< Use DateFormatter to format dates
+ var $mInterwikiMagic; //!< Interlanguage links are removed and returned in an array
+ var $mAllowExternalImages; //!< Allow external images inline
+ var $mAllowExternalImagesFrom; //!< If not, any exception?
+ var $mSkin; //!< Reference to the preferred skin
+ var $mDateFormat; //!< Date format index
+ var $mEditSection; //!< Create "edit section" links
+ var $mNumberHeadings; //!< Automatically number headings
+ var $mAllowSpecialInclusion; //!< Allow inclusion of special pages
+ var $mTidy; //!< Ask for tidy cleanup
+ var $mInterfaceMessage; //!< Which lang to call for PLURAL and GRAMMAR
+ var $mTargetLanguage; //!< Overrides above setting with arbitrary language
+ var $mMaxIncludeSize; //!< Maximum size of template expansions, in bytes
+ var $mMaxPPNodeCount; //!< Maximum number of nodes touched by PPFrame::expand()
+ var $mMaxPPExpandDepth; //!< Maximum recursion depth in PPFrame::expand()
+ var $mMaxTemplateDepth; //!< Maximum recursion depth for templates within templates
+ var $mRemoveComments; //!< Remove HTML comments. ONLY APPLIES TO PREPROCESS OPERATIONS
+ var $mTemplateCallback; //!< Callback for template fetching
+ var $mEnableLimitReport; //!< Enable limit report in an HTML comment on output
+ var $mTimestamp; //!< Timestamp used for {{CURRENTDAY}} etc.
- var $mUser; # Stored user object, just used to initialise the skin
+ var $mUser; //!< Stored user object, just used to initialise the skin
function getUseTeX() { return $this->mUseTeX; }
function getUseDynamicDates() { return $this->mUseDynamicDates; }
/**
* Get parser options
- * @static
+ * @param $user User
*/
static function newFromUser( $user ) {
return new ParserOptions( $user );
global $wgUseTeX, $wgUseDynamicDates, $wgInterwikiMagic, $wgAllowExternalImages;
global $wgAllowExternalImagesFrom, $wgAllowSpecialInclusion, $wgMaxArticleSize;
global $wgMaxPPNodeCount, $wgMaxTemplateDepth, $wgMaxPPExpandDepth;
- $fname = 'ParserOptions::initialiseFromUser';
- wfProfileIn( $fname );
+
+ wfProfileIn( __METHOD__ );
+
if ( !$userInput ) {
global $wgUser;
if ( isset( $wgUser ) ) {
$this->mRemoveComments = true;
$this->mTemplateCallback = array( 'Parser', 'statelessFetchTemplate' );
$this->mEnableLimitReport = false;
- wfProfileOut( $fname );
+
+ wfProfileOut( __METHOD__ );
}
}
}
wfProfileIn( __METHOD__.'-parse' );
- $options = new ParserOptions;
+ $user = new User();
+ $options = new ParserOptions( $user );
+ $options->setInterfaceMessage( true );
$parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() );
wfProfileOut( __METHOD__.'-parse' );
wfProfileIn( __METHOD__.'-update' );
* which will give them a chance to modify this key based on their own
* settings.
*
+ * @param $content Bool: wheter use the content language to generate the
+ * hash
* @return string
*/
- function getPageRenderingHash() {
+ function getPageRenderingHash( $content = false ) {
global $wgContLang, $wgUseDynamicDates, $wgLang;
- if( $this->mHash ){
+ if( $this->mHash && !$content ){
return $this->mHash;
}
$confstr .= '!' . $this->getDatePreference();
}
$confstr .= '!' . ($this->getOption( 'numberheadings' ) ? '1' : '');
- $confstr .= '!' . $wgLang->getCode();
+ if( $content ){
+ $confstr .= '!' . $wgContLang->getCode();
+ } else {
+ $confstr .= '!' . $wgLang->getCode();
+ }
$confstr .= '!' . $this->getOption( 'thumbsize' );
// add in language specific options, if any
$extra = $wgContLang->getExtraHashOptions();