return true;
}
+ /* static */ function &validTypes() {
+ static $types = array( '', 'block', 'protect', 'rights', 'delete', 'upload' );
+ return $types;
+ }
+
+ /* static */ function isLogType( $type ) {
+ return in_array( $type, LogPage::validTypes() );
+ }
+
+ /* static */ function logName( $type ) {
+ static $typeText = array(
+ '' => 'log',
+ 'block' => 'blocklogpage',
+ 'protect' => 'protectlogpage',
+ 'rights' => 'bureaucratlog',
+ 'delete' => 'dellogpage',
+ 'upload' => 'uploadlogpage',
+ );
+ return str_replace( '_', ' ', wfMsg( $typeText[$type] ) );
+ }
+
+ /* static */ function logHeader( $type ) {
+ static $headerText = array(
+ '' => 'alllogstext',
+ 'block' => 'blocklogtext',
+ 'protect' => 'protectlogtext',
+ 'rights' => '',
+ 'delete' => 'dellogpagetext',
+ 'upload' => 'uploadlogpagetext'
+ );
+ return wfMsg( $headerText[$type] );
+ }
+
/* static */ function actionText( $type, $action, $titleLink ) {
static $actions = array(
'block/block' => 'blocklogentry',
$msg = ( $rc_type == RC_MOVE ) ? '1movedto2' : '1movedto2_redir';
$s .= wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
$this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+ } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
+ # Log updates, etc
+ $logtype = $matches[1];
+ $logname = LogPage::logName( $logtype );
+ $s .= '(' . $this->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
} else {
# Diff link
if ( $rc_type == RC_NEW || $rc_type == RC_LOG ) {
$msg = ( $rc_type == RC_MOVE ) ? "1movedto2" : "1movedto2_redir";
$clink = wfMsg( $msg, $this->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ),
$this->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) );
+ } elseif( $rc_namespace == NS_SPECIAL && preg_match( '!^Log/(.*)$!', $rc_title, $matches ) ) {
+ # Log updates, etc
+ $logtype = $matches[1];
+ $logname = LogPage::logName( $logtype );
+ $clink = '(' . $this->makeKnownLinkObj( $rc->getTitle(), $logname ) . ')';
} else {
$clink = $this->makeKnownLinkObj( $rc->getTitle(), '' ) ;
}
direct link to the section in the autocomment.
Main author: Erik Moeller (moeller@scireview.de)
*/
- function formatComment($comment, &$title)
+ # Note: there's not always a title to pass to this function.
+ # Since you can't set a default parameter for a reference, I've turned it
+ # temporarily to a value pass. Should be adjusted further. --brion
+ function formatComment($comment, $title = NULL)
{
global $wgLang;
$comment = htmlspecialchars( $comment );
class LogViewer {
var $reader, $skin;
- var $typeText = array(
- '' => array( 'log', 'alllogstext' ),
- 'block' => array( 'blocklogpage', 'blocklogtext' ),
- 'protect' => array( 'protectlogpage', 'protectlogtext' ),
- 'rights' => array( 'bureaucratlog', '' ),
- 'delete' => array( 'dellogpage', 'dellogpagetext' ),
- 'upload' => array( 'uploadlogpage', 'uploadlogpagetext' )
- );
-
function LogViewer( &$reader ) {
global $wgUser;
function showHeader( &$out ) {
$type = $this->reader->queryType();
- if( isset( $this->typeText[$type] ) ) {
- list( $title, $headertext ) = $this->typeText[$type];
- $out->setPageTitle( str_replace( '_', ' ', wfMsg( $title ) ) );
- $out->addWikiText( wfMsg( $headertext ) );
+ if( LogPage::isLogType( $type ) ) {
+ $out->setPageTitle( LogPage::logName( $type ) );
+ $out->addWikiText( LogPage::logHeader( $type ) );
}
}
function getTypeMenu() {
$out = "<select name='type'>\n";
- foreach( $this->typeText as $type => $msg ) {
- $text = htmlspecialchars( str_replace( '_', ' ', wfMsg( $msg[0] ) ) );
+ foreach( LogPage::validTypes() as $type ) {
+ $text = htmlspecialchars( LogPage::logName( $type ) );
$selected = ($type == $this->reader->queryType()) ? ' selected="selected"' : '';
$out .= "<option value=\"$type\"$selected>$text</option>\n";
}