public static function logHeader( $type ) {
global $wgLogHeaders, $wgMessageCache;
$wgMessageCache->loadAllMessages();
- return wfMsgExt($wgLogHeaders[$type],array('parseinline'));
+ return wfMsgExt($wgLogHeaders[$type], array( 'parseinline' ) );
}
/**
* @static
+ * Note that if $skin is null, we want to use the wiki content language, since that
+ * will go to the irc feed.
* @return HTML string
*/
public static function actionText( $type, $action, $title = null, $skin = null,
}
$params[2] = isset( $params[2] ) ?
self::formatBlockFlags( $params[2], is_null( $skin ) ) : '';
+
// Page protections
} else if ( $type == 'protect' && count($params) == 3 ) {
// Restrictions and expiries
$details .= ' ['.wfMsgForContent('protect-summary-cascade').']';
}
}
+
// Page moves
} else if ( $type == 'move' && count( $params ) == 3 ) {
if( $params[2] ) {
$details .= ' [' . wfMsgForContent( 'move-redirect-suppressed' ) . ']';
}
}
+
// Revision deletion
} else if ( preg_match( '/^(delete|suppress)\/revision$/', $key ) && count( $params ) == 5 ) {
$count = substr_count( $params[2], ',' ) + 1; // revisions
$ofield = intval( substr( $params[3], 7 ) ); // <ofield=x>
$nfield = intval( substr( $params[4], 7 ) ); // <nfield=x>
- $details .= ': '.RevisionDeleter::getLogMessage( $count, $nfield, $ofield, false );
+ $details .= ': ' . RevisionDeleter::getLogMessage( $count, $nfield, $ofield, false, is_null($skin) );
+
// Log deletion
} else if ( preg_match( '/^(delete|suppress)\/event$/', $key ) && count( $params ) == 4 ) {
$count = substr_count( $params[1], ',' ) + 1; // log items
$ofield = intval( substr( $params[2], 7 ) ); // <ofield=x>
$nfield = intval( substr( $params[3], 7 ) ); // <nfield=x>
- $details .= ': '.RevisionDeleter::getLogMessage( $count, $nfield, $ofield, true );
+ $details .= ': ' . RevisionDeleter::getLogMessage( $count, $nfield, $ofield, true, is_null($skin) );
}
+
if ( $skin ) {
$rv = wfMsgHtml( $wgLogActions[$key], $params ) . $details;
} else {
}
/**
- * Gets an array describing the changes made to the visibilit of the revision.
- * If the resulting array is $arr, then $arr[0] will contain an array of strings
- * describing the items that were hidden, $arr[2] will contain an array of strings
- * describing the items that were unhidden, and $arr[3] will contain an array with
- * a single string, which can be one of "applied restrictions to sysops",
- * "removed restrictions from sysops", or null.
+ * Gets an array of message keys describing the changes made to the visibility
+ * of the revision. If the resulting array is $arr, then $arr[0] will contain an
+ * array of strings describing the items that were hidden, $arr[2] will contain
+ * an array of strings describing the items that were unhidden, and $arr[3] will
+ * contain an array with a single string, which can be one of "applied
+ * restrictions to sysops", "removed restrictions from sysops", or null.
*
* @param $n Integer: the new bitfield.
* @param $o Integer: the old bitfield.
$diff = $n ^ $o;
$ret = array( 0 => array(), 1 => array(), 2 => array() );
// Build bitfield changes in language
- self::checkItem( wfMsgForContent( 'revdelete-content' ),
+ self::checkItem( 'revdelete-content',
Revision::DELETED_TEXT, $diff, $n, $ret );
- self::checkItem( wfMsgForContent( 'revdelete-summary' ),
+ self::checkItem( 'revdelete-summary',
Revision::DELETED_COMMENT, $diff, $n, $ret );
- self::checkItem( wfMsgForContent( 'revdelete-uname' ),
+ self::checkItem( 'revdelete-uname',
Revision::DELETED_USER, $diff, $n, $ret );
// Restriction application to sysops
if( $diff & Revision::DELETED_RESTRICTED ) {
if( $n & Revision::DELETED_RESTRICTED )
- $ret[2][] = wfMsgForContent( 'revdelete-restricted' );
+ $ret[2][] = 'revdelete-restricted';
else
- $ret[2][] = wfMsgForContent( 'revdelete-unrestricted' );
+ $ret[2][] = 'revdelete-unrestricted';
}
return $ret;
}
* @param $nbitfield Integer: The new bitfield for the revision.
* @param $obitfield Integer: The old bitfield for the revision.
* @param $isForLog Boolean
+ * @param $forContent Boolean
*/
- public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false ) {
- global $wgLang;
+ public static function getLogMessage( $count, $nbitfield, $obitfield, $isForLog = false, $forContent = false ) {
+ global $wgLang, $wgContLang;
+
+ $lang = $forContent ? $wgContLang : $wgLang;
+ $msgFunc = $forContent ? "wfMsgForContent" : "wfMsg";
+
$s = '';
$changes = self::getChanges( $nbitfield, $obitfield );
+ array_walk($changes, 'RevisionDeleter::expandMessageArray', $forContent);
+
+ $changesText = array();
+
if( count( $changes[0] ) ) {
- $s .= wfMsgForContent( 'revdelete-hid', implode( ', ', $changes[0] ) );
+ $changesText[] = $msgFunc( 'revdelete-hid', $lang->commaList( $changes[0] ) );
}
if( count( $changes[1] ) ) {
- if ($s) $s .= '; ';
- $s .= wfMsgForContent( 'revdelete-unhid', implode( ', ', $changes[1] ) );
+ $changesText[] = $msgFunc( 'revdelete-unhid', $lang->commaList( $changes[1] ) );
}
+
+ $s = $lang->semicolonList( $changesText );
if( count( $changes[2] ) ) {
- $s .= $s ? ' (' . $changes[2][0] . ')' : $changes[2][0];
+ $s .= $s ? ' (' . $changes[2][0] . ')' : ' ' . $changes[2][0];
}
+
$msg = $isForLog ? 'logdelete-log-message' : 'revdelete-log-message';
- return wfMsgExt( $msg, array( 'parsemag', 'content' ), $s, $wgLang->formatNum($count) );
-
+ return wfMsgExt( $msg, $forContent ? array( 'parsemag', 'content' ) : array( 'parsemag' ), $s, $lang->formatNum($count) );
+ }
+
+ private static function expandMessageArray(& $msg, $key, $forContent) {
+ if ( is_array ($msg) ) {
+ array_walk($msg, 'RevisionDeleter::expandMessageArray', $forContent);
+ } else {
+ if ( $forContent ) {
+ $msg = wfMsgForContent($msg);
+ } else {
+ $msg = wfMsg($msg);
+ }
+ }
}
// Get DB field name for URL param...