当前位置: 首页>>代码示例>>PHP>>正文


PHP phpFreeChat::PreFilterMsg方法代码示例

本文整理汇总了PHP中phpFreeChat::PreFilterMsg方法的典型用法代码示例。如果您正苦于以下问题:PHP phpFreeChat::PreFilterMsg方法的具体用法?PHP phpFreeChat::PreFilterMsg怎么用?PHP phpFreeChat::PreFilterMsg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在phpFreeChat的用法示例。


在下文中一共展示了phpFreeChat::PreFilterMsg方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     if (trim($param) == "") {
         // error
         $cmdp = $p;
         $cmdp["param"] = _pfc("Missing parameter");
         $cmdp["param"] .= " (" . $this->usage . ")";
         $cmd =& pfcCommand::Factory("error");
         $cmd->run($xml_reponse, $cmdp);
         return;
     }
     $msg = phpFreeChat::PreFilterMsg($param);
     $ct->write($recipient, "*me*", $this->name, $u->getNickname() . " " . $msg);
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:22,代码来源:me.class.php

示例2: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     $nick = $u->getNickname();
     $text_src = phpFreeChat::PreFilterMsg(trim($param));
     $text_src = str_replace(" ", "", $text_src);
     try {
         $p = new Parser($text_src);
         $p->setDebug($ct, $nick, $recipient);
         $ov = $p->Parse();
         $text = $nick . " : " . $text_src . " >> " . $ov->str . " = " . $ov->val;
     } catch (Exception $e) {
         $text = "Error: " . $e->getMessage();
     }
     $ct->write($recipient, $nick, "send", $text);
 }
开发者ID:a711960,项目名称:phpdiceroller,代码行数:23,代码来源:dice.class.php

示例3: run

 function run(&$xml_reponse, $p)
 {
     $clientid = $p["clientid"];
     $param = $p["param"];
     $sender = $p["sender"];
     $recipient = $p["recipient"];
     $recipientid = $p["recipientid"];
     $c =& pfcGlobalConfig::Instance();
     $u =& pfcUserConfig::Instance();
     $ct =& pfcContainer::Instance();
     $nick = $ct->getNickname($u->nickid);
     //phpFreeChat::FilterSpecialChar($sender);
     $text = phpFreeChat::PreFilterMsg($param);
     //        $offline = $container->getMeta("offline", "nickname", $u->privmsg[$recipientid]["name"]);
     // if this channel is a pv (one to one channel),
     // first of all, check if the other user is connected
     // if he is not connected anymore, display an error
     $can_send = true;
     if (isset($u->privmsg[$recipientid])) {
         $pvnickid = $u->privmsg[$recipientid]["pvnickid"];
         $pvnick = $ct->getNickname($pvnickid);
         //$u->privmsg[$recipientid]["name"];
         //      $pvnickid = $ct->getNickId($pvnick);
         // now check if this user is currently online
         $onlineusers = $ct->getOnlineNick(NULL);
         if (!in_array($pvnickid, $onlineusers["nickid"])) {
             // send an error because the user is not online
             $cmdp = $p;
             $cmdp["param"] = _pfc("Can't send the message, %s is offline", $pvnick);
             $cmd =& pfcCommand::Factory("error");
             $cmd->run($xml_reponse, $cmdp);
             $can_send = false;
         }
     }
     // check the sent text is not empty and the user has a none empty nickname
     $errors = array();
     if ($text == "") {
         $errors["pfc_words"] = _pfc("Text cannot be empty");
     }
     if ($nick == "") {
         $errors["pfc_handle"] = _pfc("Please enter your nickname");
     }
     if (count($errors) > 0) {
         // an error occured, just ignore the message and display errors
         $cmdp = $p;
         $cmdp["param"] = $errors;
         $cmd =& pfcCommand::Factory("error");
         $cmd->run($xml_reponse, $cmdp);
         if (isset($errors["pfc_handle"])) {
             // the nick is empty so give it focus
             $xml_reponse->script("\$('pfc_handle').focus();");
         }
         $can_send = false;
     }
     // Now send the message if there is no errors
     if ($can_send) {
         $msgid = $ct->write($recipient, $nick, "send", $text);
         if (is_array($msgid)) {
             $cmdp = $p;
             $cmdp["param"] = implode(",", $msgid);
             $cmd =& pfcCommand::Factory("error");
             $cmd->run($xml_reponse, $cmdp);
             return;
         }
         // a message has been posted so :
         // - clear errors
         // - give focus to "words" field
         // @todo move this code in the handleResponse function
         $xml_reponse->script("pfc.clearError(Array('pfc_words" . "','pfc_handle" . "'));");
         $xml_reponse->script("\$('pfc_words').focus();");
     }
     $xml_reponse->script("pfc.handleResponse('" . $this->name . "', 'ok', '');");
 }
开发者ID:danielheyman,项目名称:EazySubs,代码行数:73,代码来源:send.class.php


注:本文中的phpFreeChat::PreFilterMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。