/**
  * Generate an IRC line corresponding to user unification/creation
  * @param Title $userpage
  * @param string $wikiID
  * @return string
  */
 public function getLine($userpage, $wikiID)
 {
     $title = IRCColourfulRCFeedFormatter::cleanupForIRC($userpage->getPrefixedText());
     $wikiID = IRCColourfulRCFeedFormatter::cleanupForIRC($wikiID);
     $url = $userpage->getCanonicalURL();
     $user = IRCColourfulRCFeedFormatter::cleanupForIRC($userpage->getText());
     # see http://www.irssi.org/documentation/formats for some colour codes. prefix is \003,
     # no colour (\003) switches back to the term default
     return "14[[07{$title}14]]4@{$wikiID}10 " . "02{$url} 5* 03{$user} 5*\n";
 }
 /**
  * @see RCFeedFormatter::getLine
  */
 public function getLine(array $feed, RecentChange $rc, $actionComment)
 {
     global $wgWWRCFeedHideLogs, $wgWWRCFeedHideNamespaces;
     $attribs = $rc->getAttributes();
     if ($attribs['rc_type'] == RC_LOG) {
         $title = Title::newFromText('Log/' . $attribs['rc_log_type'], NS_SPECIAL);
     } else {
         $title =& $rc->getTitle();
     }
     if ($attribs['rc_type'] == RC_LOG && in_array($attribs['rc_log_type'], $wgWWRCFeedHideLogs)) {
         return null;
     } elseif (in_array($title->getNamespace(), $wgWWRCFeedHideNamespaces)) {
         return null;
     }
     // if we aren't hiding it, let the core class do all the heavy lifting
     return parent::getLine($feed, $rc, $actionComment);
 }
示例#3
0
 /**
  * @deprecated since 1.22, moved to IRCColourfulRCFeedFormatter
  */
 public static function cleanupForIRC($text)
 {
     wfDeprecated(__METHOD__, '1.22');
     return IRCColourfulRCFeedFormatter::cleanupForIRC($text);
 }
 /**
  * @param string $expected Expected IRC text without colors codes
  * @param string $type Log type (move, delete, suppress, patrol ...)
  * @param string $action A log type action
  * @param array $params
  * @param string $comment (optional) A comment for the log action
  * @param string $msg (optional) A message for PHPUnit :-)
  */
 protected function assertIRCComment($expected, $type, $action, $params, $comment = null, $msg = '', $legacy = false)
 {
     $logEntry = new ManualLogEntry($type, $action);
     $logEntry->setPerformer($this->user);
     $logEntry->setTarget($this->title);
     if ($comment !== null) {
         $logEntry->setComment($comment);
     }
     $logEntry->setParameters($params);
     $logEntry->setLegacy($legacy);
     $formatter = LogFormatter::newFromEntry($logEntry);
     $formatter->setContext($this->context);
     // Apply the same transformation as done in IRCColourfulRCFeedFormatter::getLine for rc_comment
     $ircRcComment = IRCColourfulRCFeedFormatter::cleanupForIRC($formatter->getIRCActionComment());
     $this->assertEquals($expected, $ircRcComment, $msg);
 }