本文整理汇总了PHP中modules::hook方法的典型用法代码示例。如果您正苦于以下问题:PHP modules::hook方法的具体用法?PHP modules::hook怎么用?PHP modules::hook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类modules
的用法示例。
在下文中一共展示了modules::hook方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: modules
$modules = new modules();
$operators = array();
$reqCommand = "";
$updateInterval = 30;
$nextUpdate = time() + $updateInterval;
$socket = fsockopen($server, $port);
cmd_send("USER " . $nick . " " . $nick . " " . $nick . " : " . $nick);
// Register user data.
cmd_send("NICK " . $nick);
// Change nick.
cmd_send("JOIN " . $channel);
// Join default channel.
while (1) {
while (!feof($socket)) {
$data = fgets($socket);
$pingCheck = substr($data, 0, strlen("PING :"));
if ($pingCheck == "PING :") {
$pong = substr($data, strlen("PING :"));
cmd_send("PONG :" . $pong);
} else {
$message = new ircMsg($data);
$command = strtolower($message->getCommand());
$modules->hook($command, $message);
}
$time = time();
if ($time >= $nextUpdate) {
$modules->hook("periodic", NULL);
$nextUpdate = $time + $updateInterval;
}
}
}
示例2: while
cmd_send("NICK " . $nick);
// Change nick.
cmd_send("JOIN " . $channel);
// Join default channel.
while (1) {
while ($data = fgets($socket)) {
$pingCheck = substr($data, 0, strlen("PING :"));
if ($pingCheck == "PING :") {
// Play ping-pong.
$pong = substr($data, strlen("PING :"));
cmd_send("PONG :" . $pong);
} elseif (!empty($data)) {
$message = new ircMsg($data);
if ($output && $rawOutput == FALSE) {
$smartData = array('command' => strtolower($message->getCommand()), 'message' => $message);
$modules->hook('smartOutput', $smartData);
} elseif ($output == TRUE) {
echo $data;
}
$command = trim(strtolower($message->getCommand()));
if ($command == "privmsg") {
// First part of this is ensuring that the user/channel isn't on the ignore list.
$parameters = $message->getParameters();
$preWhere = trim($parameters[0]);
if ($preWhere == $message->getNick()) {
$where = $message->getNick();
} else {
$where = $parameters[0];
}
$chanSearch = array_search($where, $quietArray);
$nickSearch = array_search($message->getNick(), $quietArray);