本文整理汇总了PHP中Dog::getUID方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::getUID方法的具体用法?PHP Dog::getUID怎么用?PHP Dog::getUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::getUID方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValue
public function getValue()
{
$key = $this->name;
$def = $this->default;
$sid = Dog::getServer()->getID();
$c = Dog::getChannel();
if ($this->module !== NULL) {
$mod = $this->module;
switch ($this->scope) {
case 'g':
return Dog_Conf_Mod::getConf($mod, $key, $def);
case 's':
return Dog_Conf_Mod_Serv::getConf($mod, $sid, $key, $def);
case 'c':
return $c === false ? $def : Dog_Conf_Mod_Chan::getConf($mod, $c->getID(), $key, $def);
case 'u':
return Dog_Conf_Mod_User::getConf($mod, Dog::getUID(), $key, $def);
}
} elseif ($this->plugin !== NULL) {
$plg = $this->plugin;
switch ($this->scope) {
case 'g':
return Dog_Conf_Plug::getConf($plg, $key, $def);
case 's':
return Dog_Conf_Plug_Serv::getConf($plg, $sid, $key, $def);
case 'c':
return $c === false ? $def : Dog_Conf_Plug_Chan::getConf($plg, $c->getID(), $key, $def);
case 'u':
return Dog_Conf_Plug_User::getConf($plg, Dog::getUID(), $key, $def);
}
}
return $def;
}
示例2: array
$lang = array('en' => array('help' => 'Usage: %CMD% <expression>. Evaluate a mathematical expression and print results. Use _ and $ to referr to the last result.', '00' => '1 ... No ... 0 ... No ... UNDEFINED!', 'err_in' => 'Error in expression.', 'err_lib' => 'The "EvalMath" class by Miles Kaufmann is missing.'));
$plugin = Dog::getPlugin();
if ('' === ($message = $plugin->msg())) {
return $plugin->showHelp();
}
if (false !== ($last = Dog_Conf_Plug_User::getConf($plugin->getName(), Dog::getUID(), 'last', false))) {
$message = str_replace(array('_', '$'), $last, $message);
}
if ($message === '0^0') {
return $plugin->rply('00');
}
if ($message === 'pi') {
return $plugin->reply('4');
}
$path = GWF_PATH . 'core/inc/3p/EvalMath.php';
if (!Common::isFile($path)) {
return $plugin->rply('err_lib');
}
require_once $path;
$eval = new EvalMath();
if (false === ($result = $eval->e($message))) {
return $plugin->rply('err_in');
}
$result = sprintf('%.09f', $result);
if (strpos($result, '.') !== false) {
$result = rtrim($result, '0');
$result = rtrim($result, '.');
}
Dog_Conf_Plug_User::setConf($plugin->getName(), Dog::getUID(), 'last', $result);
Dog::reply($result);
示例3: preg_split
# Split and clean data
$message = $plugin->msg();
$data = preg_split('/(?: or | oder |\\|\\||\\|)/', $message);
$data = array_map('trim', $data);
foreach ($data as $i => $s) {
if ($s === '') {
unset($data[$i]);
}
}
$data = array_unique($data);
# Same data?
$diff = 1;
if (count($last) === count($data)) {
$t = $last;
sort($t);
sort($data);
$diff = count(array_diff($t, $data));
}
# Yes, same data
if ($diff === 0) {
return $plugin->rply('just');
}
# New choose
Dog_Conf_Plug_User::setConf($plg, Dog::getUID(), 'last', serialize($last));
# Yes/No
if (count($data) === 1) {
$key = rand(0, 1) ? 'y' : 'n';
return $plugin->rply($key);
}
# Random
Dog::reply($data[rand(0, count($data) - 1)]);