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


PHP Dog::getServerByArg方法代码示例

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


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

示例1: array

<?php

$lang = array('en' => array('help' => 'Usage: %CMD% [<server>]. List the channels where %BOT% is online.', 'none' => 'I am not connected to any channel on %s.', 'out' => 'I am in %d channels on %s: %s.'));
$plugin = Dog::getPlugin();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 0) {
    $server = Dog::getServer();
} elseif ($argc !== 1) {
    return $plugin->showHelp();
} else {
    if (false === ($server = Dog::getServerByArg($argv[0]))) {
        return Dog::rply('err_server');
    }
}
if (!$server->isConnected()) {
    return Dog::rply('err_connection');
}
$out = '';
$channels = $server->getChannels();
foreach ($channels as $channel) {
    $channel instanceof Lamb_Channel;
    $out .= sprintf(', %s(%d)', $channel->getName(), count($channel->getUsers()));
}
if ($out === '') {
    return $plugin->rply('none', array($server->displayName()));
}
$plugin->rply('out', array(count($channels), $server->displayName(), substr($out, 2)));
开发者ID:sinfocol,项目名称:gwf3,代码行数:28,代码来源:channels_Pb.php

示例2: parse_url

    $prot = $server->isSSL() ? 'ircs' : 'irc';
    $port = $server->getPort();
} else {
    $url = parse_url($argv[0]);
    if (!isset($url['host'])) {
        return $plugin->rply('err_url');
    }
    $host = $url['host'];
    $prot = isset($url['scheme']) ? strtolower($url['scheme']) : 'irc';
    if ($prot !== 'irc' && $prot !== 'ircs') {
        return $plugin->rply('err_url');
    }
    $default_port = $prot === 'ircs' ? 6697 : 6667;
    $port = isset($url['port']) ? intval($url['port']) : $default_port;
    $options = Dog_Server::DEFAULT_OPTIONS;
    $options |= $prot === 'ircs' ? Dog_Server::SSL : 0;
}
if (false !== ($server = Dog::getServerByArg($argv[0])) || false !== ($server = Dog::getServerByArg($host))) {
    $plugin->reply('reconnecting');
    $server->saveOption(Dog_Server::ACTIVE, true);
    $server->saveOption(Dog_Server::SSL, $prot === 'ircs');
    $server->saveVar('serv_port', $port);
} else {
    $plugin->reply('adding_server');
    $server = Dog_Server::getOrCreate($host, $port, $options);
    $server->setVar('dog_connector', Dog::getUser());
    $server->setConf('ircoppass', GWF_Random::randomKey(8));
    Dog::addServer($server);
}
$server->setConnectIn(0.5);
$plugin->rply('connect');
开发者ID:sinfocol,项目名称:gwf3,代码行数:31,代码来源:join_server_Ib.php


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