public static function showCharacterDifference( $old, $new ) {
global $wgRCChangedSizeThreshold, $wgLang, $wgMiserMode;
$szdiff = $new - $old;
+
+ $code = $wgLang->getCode();
+ static $fastCharDiff = array();
+ if ( !isset($fastCharDiff[$code]) ) {
+ $fastCharDiff[$code] = $wgMiserMode || wfMsgNoTrans( 'rc-change-size' ) === '$1';
+ }
- $formatedSize = ( $wgMiserMode?
- $wgLang->formatNum($szdiff) : // avoid expensive calculations
- wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape' ), $wgLang->formatNum( $szdiff ) )
- );
+ $formatedSize = $wgLang->formatNum($szdiff);
+
+ if ( !$fastCharDiff[$code] ) {
+ $formatedSize = wfMsgExt( 'rc-change-size', array( 'parsemag', 'escape' ), $formatedSize );
+ }
if( abs( $szdiff ) > abs( $wgRCChangedSizeThreshold ) ) {
$tag = 'strong';
* Format a line using the old system (aka without any javascript).
*/
public function recentChangesLine( &$rc, $watched = false, $linenumber = NULL ) {
- global $wgContLang, $wgLang, $wgRCShowChangedSize, $wgUser;
+ global $wgLang, $wgRCShowChangedSize, $wgUser;
wfProfileIn( __METHOD__ );
# Should patrol-related stuff be shown?
$unpatrolled = $wgUser->useRCPatrol() && !$rc->mAttribs['rc_patrolled'];
* Format a line for enhanced recentchange (aka with javascript and block of lines).
*/
public function recentChangesLine( &$baseRC, $watched = false ) {
- global $wgLang, $wgContLang, $wgUser;
+ global $wgLang, $wgUser;
wfProfileIn( __METHOD__ );
$showdifflinks = false;
}
- $time = $wgContLang->time( $rc_timestamp, true, true );
+ $time = $wgLang->time( $rc_timestamp, true, true );
$rc->watched = $watched;
$rc->link = $clink;
$rc->timestamp = $time;
$querycur = $curIdEq + array( 'diff' => '0', 'oldid' => $rc_this_oldid );
$querydiff = $curIdEq + array( 'diff' => $rc_this_oldid, 'oldid' =>
$rc_last_oldid ) + $rcIdQuery;
- $attribs = array( 'tabindex' => $baseRC->counter );
if( !$showdifflinks ) {
$curLink = $this->message['cur'];
if ( $rc_type != RC_NEW ) {
$curLink = $this->message['cur'];
} else {
- $curUrl = wfUrlencode( $rc->getTitle()->getLinkUrl( $querycur ) );
+ $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
$curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
}
$diffLink = $this->message['diff'];
} else {
- $diffUrl = wfUrlencode( $rc->getTitle()->getLinkUrl( $querydiff ) );
- $curUrl = wfUrlencode( $rc->getTitle()->getLinkUrl( $querycur ) );
+ $diffUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querydiff ) );
+ $curUrl = htmlspecialchars( $rc->getTitle()->getLinkUrl( $querycur ) );
$diffLink = "<a href=\"$diffUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['diff']}</a>";
$curLink = "<a href=\"$curUrl\" tabindex=\"{$baseRC->counter}\">{$this->message['cur']}</a>";
}
* @return string a HTML formated line (generated using $r)
*/
protected function recentChangesBlockLine( $rcObj ) {
- global $wgContLang, $wgRCShowChangedSize;
+ global $wgRCShowChangedSize;
wfProfileIn( __METHOD__ );