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


PHP modules::hook方法代码示例

本文整理汇总了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;
        }
    }
}
开发者ID:Bren2010,项目名称:Takeoverz-Bot,代码行数:31,代码来源:moderator.php

示例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);
开发者ID:Bren2010,项目名称:HTS-Lecture-Bot,代码行数:31,代码来源:lector.php


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