本文整理汇总了PHP中Dog::getScope方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::getScope方法的具体用法?PHP Dog::getScope怎么用?PHP Dog::getScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::getScope方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dog_plugin_alert_func4
if (0 >= ($seconds = GWF_TimeConvert::humanToSeconds($seconds))) {
return $plug->rply('err_seconds');
}
if (GWF_Time::ONE_DAY * 8 < $seconds) {
return $plug->rply('err_too_long');
}
// Try to parse back duration from parsed seconds
if (false === ($delay = GWF_TimeConvert::humanDurationISO(Dog::getLangISO(), $seconds))) {
return $plug->rply('err_seconds');
}
$user = Dog::getUser();
if (!isset($DOG_PLUG_ALERT_TIMERS[$user->getID()])) {
$DOG_PLUG_ALERT_TIMERS[$user->getID()] = 0;
}
if ($DOG_PLUG_ALERT_TIMERS[$user->getID()] >= 3) {
return $plug->rply('err_too_much');
}
if (!function_exists('dog_plugin_alert_func4')) {
function dog_plugin_alert_func4(array $args)
{
global $DOG_PLUG_ALERT_TIMERS;
$scope = $args[0];
$scope instanceof Dog_Scope;
Dog::setScope($scope);
Dog::reply($args[1]);
$DOG_PLUG_ALERT_TIMERS[$scope->getUser()->getID()]--;
}
}
Dog_Timer::addTimer('dog_plugin_alert_func4', array(Dog::getScope(), $plug->argvMsgFrom(1)), $seconds, false);
$DOG_PLUG_ALERT_TIMERS[$user->getID()]++;
$plug->rply('msg_remember', array($delay));
示例2: async
/**
* Queue something for async.
* @param string $type
* @param mixed $message - Input for typefunc
* @param mixed $callback
* @param array $args - callback args
*/
public function async($type, $message, $callback = null, array $args = array(), array $includes = array())
{
if (!GWF_Callback::isCallback($callback, true, true)) {
echo "Dog_WorkerThread::async() - Invalid Callback!\n";
} elseif (!in_array($type, self::$TYPES, true)) {
echo "Dog_WorkerThread::async() - Unknown Type: {$type}\n";
} elseif (!is_array($args)) {
echo "Dog_WorkerThread::async() - Args is not an array\n";
} elseif (!$this->forked) {
# Fallback to synchronous
return $this->sync($type, $message, $callback, $args, $includes);
} else {
return $this->queue($type, Dog::getScope(), $message, $callback, $args, $includes);
}
return false;
}