summaryrefslogtreecommitdiff
path: root/includes/rcfeed/IRCColourfulRCFeedFormatter.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2014-12-27 15:41:37 +0100
committerPierre Schmitz <pierre@archlinux.de>2014-12-31 11:43:28 +0100
commitc1f9b1f7b1b77776192048005dcc66dcf3df2bfb (patch)
tree2b38796e738dd74cb42ecd9bfd151803108386bc /includes/rcfeed/IRCColourfulRCFeedFormatter.php
parentb88ab0086858470dd1f644e64cb4e4f62bb2be9b (diff)
Update to MediaWiki 1.24.1
Diffstat (limited to 'includes/rcfeed/IRCColourfulRCFeedFormatter.php')
-rw-r--r--includes/rcfeed/IRCColourfulRCFeedFormatter.php49
1 files changed, 41 insertions, 8 deletions
diff --git a/includes/rcfeed/IRCColourfulRCFeedFormatter.php b/includes/rcfeed/IRCColourfulRCFeedFormatter.php
index 507369f3..02a8d7eb 100644
--- a/includes/rcfeed/IRCColourfulRCFeedFormatter.php
+++ b/includes/rcfeed/IRCColourfulRCFeedFormatter.php
@@ -1,11 +1,36 @@
<?php
+
+/**
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * Generates a colourful notification intended for humans on IRC.
+ *
+ * @since 1.22
+ */
+
class IRCColourfulRCFeedFormatter implements RCFeedFormatter {
/**
- * Generates a colourful notification intended for humans on IRC.
* @see RCFeedFormatter::getLine
*/
public function getLine( array $feed, RecentChange $rc, $actionComment ) {
- global $wgUseRCPatrol, $wgUseNPPatrol, $wgLocalInterwiki,
+ global $wgUseRCPatrol, $wgUseNPPatrol, $wgLocalInterwikis,
$wgCanonicalServer, $wgScript;
$attribs = $rc->getAttributes();
if ( $attribs['rc_type'] == RC_LOG ) {
@@ -31,7 +56,7 @@ class IRCColourfulRCFeedFormatter implements RCFeedFormatter {
$query .= '&rcid=' . $attribs['rc_id'];
}
// HACK: We need this hook for WMF's secure server setup
- wfRunHooks( 'IRCLineURL', array( &$url, &$query ) );
+ wfRunHooks( 'IRCLineURL', array( &$url, &$query, $rc ) );
$url .= $query;
}
@@ -52,19 +77,27 @@ class IRCColourfulRCFeedFormatter implements RCFeedFormatter {
if ( $attribs['rc_type'] == RC_LOG ) {
$targetText = $rc->getTitle()->getPrefixedText();
- $comment = self::cleanupForIRC( str_replace( "[[$targetText]]", "[[\00302$targetText\00310]]", $actionComment ) );
+ $comment = self::cleanupForIRC( str_replace(
+ "[[$targetText]]",
+ "[[\00302$targetText\00310]]",
+ $actionComment
+ ) );
$flag = $attribs['rc_log_action'];
} else {
$comment = self::cleanupForIRC( $attribs['rc_comment'] );
$flag = '';
- if ( !$attribs['rc_patrolled'] && ( $wgUseRCPatrol || $attribs['rc_type'] == RC_NEW && $wgUseNPPatrol ) ) {
+ if ( !$attribs['rc_patrolled']
+ && ( $wgUseRCPatrol || $attribs['rc_type'] == RC_NEW && $wgUseNPPatrol )
+ ) {
$flag .= '!';
}
- $flag .= ( $attribs['rc_type'] == RC_NEW ? "N" : "" ) . ( $attribs['rc_minor'] ? "M" : "" ) . ( $attribs['rc_bot'] ? "B" : "" );
+ $flag .= ( $attribs['rc_type'] == RC_NEW ? "N" : "" )
+ . ( $attribs['rc_minor'] ? "M" : "" ) . ( $attribs['rc_bot'] ? "B" : "" );
}
- if ( $feed['add_interwiki_prefix'] === true && $wgLocalInterwiki !== false ) {
- $prefix = $wgLocalInterwiki;
+ if ( $feed['add_interwiki_prefix'] === true && $wgLocalInterwikis ) {
+ // we use the first entry in $wgLocalInterwikis in recent changes feeds
+ $prefix = $wgLocalInterwikis[0];
} elseif ( $feed['add_interwiki_prefix'] ) {
$prefix = $feed['add_interwiki_prefix'];
} else {