From: Aaron Schulz Date: Sun, 9 Mar 2008 02:27:03 +0000 (+0000) Subject: * Bold sysop-restricted content X-Git-Tag: 1.31.0-rc.0~49195 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=7aa0c405978aacddd3f07b1f65d097e32ee90b6c;p=lhc%2Fweb%2Fwiklou.git * Bold sysop-restricted content * Remove hard-coded checks --- diff --git a/includes/PageHistory.php b/includes/PageHistory.php index 2cd56f9ec4..9550da65f6 100644 --- a/includes/PageHistory.php +++ b/includes/PageHistory.php @@ -37,6 +37,20 @@ class PageHistory { $this->mTitle =& $article->mTitle; $this->mNotificationTimestamp = NULL; $this->mSkin = $wgUser->getSkin(); + $this->preCacheMessages(); + } + + /** + * As we use the same small set of messages in various methods and that + * they are called often, we call them once and save them in $this->message + */ + function preCacheMessages() { + // Precache various messages + if( !isset( $this->message ) ) { + foreach( explode(' ', 'cur last rev-delundel' ) as $msg ) { + $this->message[$msg] = wfMsgExt( $msg, array( 'escape') ); + } + } } /** @@ -202,35 +216,31 @@ class PageHistory { $arbitrary = $this->diffButtons( $rev, $firstInList, $counter ); $link = $this->revLink( $rev ); - $user = $this->mSkin->userLink( $rev->getUser(), $rev->getUserText() ) - . $this->mSkin->userToolLinks( $rev->getUser(), $rev->getUserText() ); - $s .= "($curlink) ($lastlink) $arbitrary"; if( $wgUser->isAllowed( 'deleterevision' ) ) { $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); if( $firstInList ) { - // We don't currently handle well changing the top revision's settings - $del = wfMsgHtml( 'rev-delundel' ); + // We don't currently handle well changing the top revision's settings + $del = $this->message['rev-delundel']; } else if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { // If revision was hidden from sysops - $del = wfMsgHtml( 'rev-delundel' ); + $del = $this->message['rev-delundel']; } else { $del = $this->mSkin->makeKnownLinkObj( $revdel, - wfMsg( 'rev-delundel' ), + $this->message['rev-delundel'], 'target=' . urlencode( $this->mTitle->getPrefixedDbkey() ) . '&oldid=' . urlencode( $rev->getId() ) ); + // Bolden oversighted content + if( $rev->isDeleted( Revision::DELETED_RESTRICTED ) ) + $del = "$del"; } - $s .= " ($del) "; + $s .= " ($del) "; } $s .= " $link"; - #getUser is safe, but this avoids making the invalid untargeted contribs links - if( $row->rev_deleted & Revision::DELETED_USER ) { - $user = '' . wfMsg('rev-deleted-user') . ''; - } - $s .= " $user"; - + $s .= ' '.$this->mSkin->revUserTools( $rev, true ); + if( $row->rev_minor_edit ) { $s .= ' ' . wfElement( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') ); } @@ -256,7 +266,7 @@ class PageHistory { } #add blurb about text having been deleted if( $row->rev_deleted & Revision::DELETED_TEXT ) { - $s .= ' ' . wfMsgHtml( 'deletedrev' ); + $s .= ' ' . wfMsgHtml( 'deletedrev' ) . ''; } $tools = array(); @@ -309,7 +319,7 @@ class PageHistory { /** @todo document */ function curLink( $rev, $latest ) { - $cur = wfMsgExt( 'cur', array( 'escape') ); + $cur = $this->message['cur']; if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) { return $cur; } else { @@ -322,7 +332,7 @@ class PageHistory { /** @todo document */ function lastLink( $rev, $next, $counter ) { - $last = wfMsgExt( 'last', array( 'escape' ) ); + $last = $this->message['last']; if ( is_null( $next ) ) { # Probably no next row return $last;