本文整理汇总了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);
}
示例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);
}
示例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', '');");
}