public function send(ChannelSubscriber $sender, $msg, $isACTION = false) { $msg = str_replace("%", "%%", $msg); if (strtolower($this->name) === "mandatory") { $this->broadcast("[NOTICE] <{$sender}> {$msg}", self::LEVEL_IMPORTANT_INFO); return; } if ($sender->isMuted()) { $sender->tell("You were muted! You can't chat!"); return; } $msg = $sender->formatChat($msg, $isACTION); if ($this->class !== self::CLASS_MODULAR) { $msg = "#{$this}>{$msg}"; } $words = $sender->getMain()->getWordsJSON(); $regex = sprintf($words["badword_detection_regexp"], implode("|", $words["badwords"])); if ($count = preg_match_all($regex, $msg, $matches)) { $sender->tell("Your message contains %d bad words: %s", $count, $implosion = implode(", ", $matches[$words["badword_regexp_parenthese_order"]])); $sender->getMain()->securityAppend("%s sent %d bad words (%s) in the message %s", $sender->getID(), $count, $implosion, $msg); if ($sender instanceof Session) { // TODO warn } return; } foreach ($this->subscribers as $sub) { if (!$sub->isDeafTo($sender)) { $sub->tell($msg); } } }