本文整理汇总了PHP中Dog::lang方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::lang方法的具体用法?PHP Dog::lang怎么用?PHP Dog::lang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::lang方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchDefinitionE
function fetchDefinitionE(Dog_Plugin $plugin, $term)
{
$output = array();
$res = GWF_HTTP::getFromUrl('http://www.urbandictionary.com/define.php?term=' . $term);
if ($res === false) {
return Dog::lang('err_timeout');
}
if (strstr($res, "isn't defined <a href")) {
return $plugin->lang('none_yet', array($term, urlencode($term)));
}
preg_match('#<div class=\'meaning\'>(.+?)</div>.*?<div class=\'example\'>(.*?)</div>#s', $res, $arr);
$definition = trim(html_entity_decode(strip_tags(preg_replace('#<\\s*?br\\s*?/?\\s*?>#', "\n", $arr[1]))));
$definition = strtr($definition, array("\r" => ' ', "\n" => ' '));
while (false !== strstr($definition, ' ')) {
$definition = str_replace(' ', ' ', $definition);
}
if (strlen($definition) > 800) {
$definition = substr($definition, 0, 800) . '...';
}
$output['definition'] = $definition;
if (!empty($arr[2])) {
$example = trim(html_entity_decode(strip_tags(preg_replace('#<\\s*?br\\s*?/?\\s*?>#', "\n", $arr[2]))));
$example = strtr($example, array("\r" => ' | ', "\n" => ' | '));
while (false !== strstr($example, ' | | ')) {
$example = str_replace(' | | ', ' | ', $example);
}
while (false !== strstr($example, ' ')) {
$example = str_replace(' ', ' ', $example);
}
if (strlen($example) > 800) {
$example = substr($example, 0, 800) . '...';
}
$output['example'] = $example;
}
return $output;
}
示例2: getHelp
public function getHelp()
{
return 'help' === ($help = $this->lang('help')) ? Dog::lang('err_no_help') : $help;
}
示例3: getHelp
public function getHelp($trigger, $args = NULL)
{
$key = 'help_' . $trigger;
if ($key === ($help = $this->lang_->lang($key))) {
return Dog::lang('err_no_help');
}
return $this->replaceLang($help, $args, $trigger);
}
示例4: showVarNames
public static function showVarNames(array $vars, $scope = NULL)
{
$serv = Dog::getServer();
$chan = Dog::getChannel();
$user = Dog::getUser();
$back = array();
foreach ($vars as $var) {
$var instanceof Dog_Var;
if ($var->inScope($scope) && $var->hasPermission($serv, $chan, $user)) {
$back[] = $var->getName();
}
}
return count($back) ? implode(', ', $back) : Dog::lang('none');
}
示例5: connect
public function connect()
{
if ($this->next_connect <= microtime(true)) {
$this->attempt++;
echo "Dog_IRC::connect() to {$this->getURL()}{$this->displaySSL()} attempt {$this->attempt}.\n";
if (false === $this->connection->connect($this)) {
$this->setConnectIn($this->getNextConnectTime());
if (false !== ($connector = $this->getVarDefault('dog_connector', false))) {
$connector instanceof Dog_User;
$connector->sendPRIVMSG(Dog::lang('err_connecting', array($this->displayLongName())));
}
if ($this->attempt > 3 && !$this->hasConnectedOnce()) {
Dog::removeServer($this);
$this->delete();
}
return false;
} else {
$this->attempt = 2;
return Dog_Auth::connect($this);
}
}
}
示例6: onSend
public function onSend(Dog_Server $server, Dog_User $user, $message)
{
// $c = Dog::getTrigger();
if (false === ($nickname = Common::substrUntil($message, ' ', false))) {
return $this->lang('help_send');
}
$message = Common::substrFrom($message, ' ');
if (false === ($user_to = Dog_User::getForServer($server->getID(), $nickname))) {
return Dog::lang('err_user');
}
if (false === Dog_Note::isWithinLimits($user->getID())) {
return $this->lang('err_limit', array(Dog_Note::LIMIT_AMT, GWF_Time::humanDuration(Dog_Note::LIMIT_TIME)));
}
if (false !== ($channel = Dog::getChannel())) {
if (false !== $channel->getUserByName($nickname)) {
return $this->lang('err_in_chan', array($nickname));
}
}
if (false === Dog_Note::insertNote($user, $user_to, $message)) {
return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $this->lang('msg_sent', array($nickname));
}
示例7: dogplug_scopetxt
function dogplug_scopetxt(Dog_Plugin $plugin, $priv, $scope)
{
$priv = Dog::lang('priv_' . $priv);
$scope = Dog::lang('scop_' . $scope);
return ' ' . $plugin->lang('scope', array($scope, $priv));
}
示例8: displayChar
public static function displayChar($char)
{
return Dog::lang('priv_' . $char);
}
示例9: array
<?php
# :irc.giz.org 001 Dog :Welcome to the gizmore IRC Network Dog!Dawg@localhost
# Set bot mode
$server = Dog::getServer();
$nick = Dog::getNickname();
Dog::getOrCreateUserByName(Dog::argv(0));
if (!$server->isOptionEnabled(Dog_Server::NO_BOTFLAG)) {
$server->sendRAW("MODE {$nick} +b");
$server->sendRAW("MODE {$nick} +B");
}
if (false !== ($connector = $server->getVarDefault('dog_connector', false))) {
$server->unsetVar('dog_connector');
$connector instanceof Dog_User;
$connector->sendPRIVMSG(Dog::lang('msg_connected', array($server->displayLongName(), Dog::getNickname(), $server->getConf('ircoppass'))));
}
$server->saveOption(Dog_Server::HAS_CONNECTED_ONCE);
$server->getNick()->identify();