本文整理汇总了PHP中Dog::setupUser方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::setupUser方法的具体用法?PHP Dog::setupUser怎么用?PHP Dog::setupUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::setupUser方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: substr
<?php
# :gizmore!gizmore@localhost PRIVMSG Dog :.join #sr
if (false === ($user = Dog::getOrCreateUser())) {
return;
}
$serv = Dog::getServer();
$serv->addUser($user);
$user = Dog::setupUser();
$chan = Dog::setupChannel();
if ($user === false) {
return Dog::suppressModules();
}
# Log PRIVMSGs
$msg = Dog::getIRCMsg()->getArg(1);
if (Dog::getIRCMsg()->shouldLog()) {
Dog_Log::user($user, $msg);
Dog_Log::channel($chan, $msg);
}
# Exec Stuff
if (!$user->isBot()) {
if ('' !== ($trigger = Common::substrUntil($msg, ' '))) {
if (Dog_Init::isTrigger($serv, $chan, $trigger[0])) {
if ($user->isFlooding()) {
return;
}
Dog::setTriggered();
$trigger = substr($trigger, 1);
if (false !== ($plug = Dog_Plugin::getPlug($trigger))) {
if (!$plug->isInScope($serv, $chan)) {
Dog::scopeError($plug->getScope());
示例2:
<?php
# :Dog!Dawg@localhost JOIN :#sr
$msg = Dog::getIRCMsg();
$serv = Dog::getServer();
if (false === ($user = Dog::getOrCreateUser())) {
return Dog_Log::critical("Cannot create user!");
}
$serv->addUser($user);
if (false === Dog::setupUser()) {
return Dog_Log::critical('Cannot setup user!');
}
$chan_name = $msg->getArg(0);
if (false === ($channel = $serv->getChannelByName($chan_name))) {
if (false === ($channel = Dog_Channel::getOrCreate($serv, $chan_name))) {
return;
}
$serv->addChannel($channel);
}
$channel->addUser($user);
if (false === Dog::setupChannel()) {
Dog_Log::critical('Cannot setup channel.');
}
示例3: foreach
<?php
# :Dog!gizmore@localhost NICK gizmore
$old_user = Dog::setupUser();
$serv = Dog::getServer();
if (false === ($new_user = Dog::getOrCreateUserByName(Dog::argv(0)))) {
Dog::suppressModules();
return Dog_Log::critical('Cannot create user!');
}
# Copy channels with privs
if ($old_user) {
$old_uid = $old_user->getID();
$serv->addUser($new_user);
foreach ($serv->getChannels() as $channel) {
$channel instanceof Dog_Channel;
if (false !== $channel->getUserByID($old_uid)) {
$channel->addUser($new_user, $channel->getPriv($old_user));
}
}
$serv->removeUser($old_user);
echo "OLD DOG: {$old_user->getName()}\n";
echo "OLD DOG: " . Dog::getNickname() . "\n";
if ($old_user->getName() === Dog::getNickname()) {
if (false !== ($nick = Dog_Nick::getExistingNick($serv, Dog::argv(0)))) {
$serv->setNick($nick);
$serv->setNicknum(0);
$nick->identify();
} else {
$serv->setNickName(Dog::argv(0));
}
}
示例4:
<?php
# :krashed__!~dig@mx.renome.ua QUIT :Excess Flood
if (false !== ($user = Dog::setupUser())) {
Dog::getServer()->removeUser($user);
} else {
Dog_Log::error('Cannot get use from quit');
Dog_Log::error(Dog::getMessage());
}
示例5:
<?php
# :gizmore!gizmore@localhost KICK #sr Dog :gizmore
Dog::setupUser();
$server = Dog::getServer();
$channel = Dog::setupChannel();
if (false !== ($user = Dog::getOrLoadUserByArg(Dog::argv(1)))) {
$channel->removeUser($user);
}
if (Dog::getNickname() === $user->getName()) {
$server->removeChannel($channel);
}