示例#1
0
 protected function injectCommand(Chain $chain, $msg, $isPrivate = true)
 {
     $request = $chain->getRequest();
     $request['msg'] = $msg;
     if ($isPrivate) {
         $request['to'] = $chain->getUser()->getId();
     } else {
         $request['self'] = 1;
     }
     $chain->setRequest($request);
 }
示例#2
0
 /**
  * C-o-R pattern
  * @param Chain $chain input stream
  * @return false|null|true
  */
 public function handleRequest(Chain $chain)
 {
     $request = $chain->getRequest();
     $text = strip_tags(htmlentities(trim($request['msg'])));
     $msgMaxLength = DI::get()->getConfig()->msgMaxLength;
     if (mb_strlen($text) > $msgMaxLength) {
         $text = mb_strcut($text, 0, $msgMaxLength) . self::CUT;
     }
     $request['msg'] = $text;
     $chain->setRequest($request);
 }