本文整理汇总了PHP中lang::o方法的典型用法代码示例。如果您正苦于以下问题:PHP lang::o方法的具体用法?PHP lang::o怎么用?PHP lang::o使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lang
的用法示例。
在下文中一共展示了lang::o方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show_online
/**
* Вывод списка online-пользователей
* @return null
*/
public function show_online()
{
$i = (int) config::o()->v('online_interval');
if (!$i) {
$i = 15;
}
$time = time() - $i;
$res = db::o()->p($time)->query('SELECT userdata FROM sessions
WHERE time > ? GROUP BY IF(uid>0,uid,ip)');
$res = db::o()->fetch2array($res);
tpl::o()->assign("res", $res);
$c = count($res);
$mo = stats::o()->read("max_online");
if (!intval($mo) || $mo < $c) {
$mo = $c;
stats::o()->write("max_online", $c);
stats::o()->write("max_online_time", time());
}
$mot = stats::o()->read("max_online_time");
tpl::o()->assign("record_total", $mo);
tpl::o()->assign("record_time", $mot);
/* @var $user user */
$user = plugins::o()->get_module("user");
lang::o()->get("profile");
tpl::o()->register_modifier("gau", array($user, "get_age"));
tpl::o()->assign("bdl", $this->bd_list());
tpl::o()->display("blocks/contents/online.tpl");
}
示例2: getEMessage
/**
* Получение сообщения
* @return string сообщение
*/
public function getEMessage()
{
// Ибо getMessage - final
$m = lang::o()->if_exists($this->message);
$v = $this->vars;
return $v ? vsprintf($m, $v) : $m;
}
示例3: init
/**
* Инициализация управления категориями
* @return null
*/
public function init()
{
$admin_file = globals::g('admin_file');
lang::o()->get('admin/cats');
$act = $_GET['act'];
$type = $_GET['type'];
if (!$type || !$this->cats->change_type($type)) {
$type = 'content';
}
tpl::o()->assign('oldadmin_file', $admin_file);
$admin_file .= '&type=' . $type;
globals::s('admin_file', $admin_file);
tpl::o()->assign('admin_file', $admin_file);
tpl::o()->assign('cat_type', $type);
switch ($act) {
case "add":
case "edit":
try {
$this->add((int) $_GET['id'], $act == "add");
} catch (EngineException $e) {
$e->defaultCatch(true);
}
break;
case "save":
$this->save($type, $_POST);
break;
default:
$this->show();
break;
}
}
示例4: init
/**
* Инициализация нижнего блока
* @return null
*/
public function init()
{
if (!config::o()->mstate('downm')) {
return;
}
lang::o()->get("blocks/downm");
print "Down block inited";
}
示例5: get_group
/**
* Получение нового ID группы
* @param int $group старый ID группы
* @return int новый ID группы
*/
public function get_group($group)
{
$group = (int) $group;
if (!$this->groups || !is_array($this->groups) || !$this->groups[$group]) {
printf(lang::o()->v('convert_cant_find_group'), $group);
die;
}
return $this->groups[$group];
}
示例6: init
/**
* Инициализация чата
* @return null
*/
public function init()
{
if (!users::o()->perm('chat')) {
return;
}
if (!config::o()->mstate('chat')) {
return;
}
lang::o()->get("blocks/chat");
tpl::o()->display('chat/index.tpl');
}
示例7: init
/**
* Инициализация блока новостей
* @return null
*/
public function init()
{
if (!config::o()->mstate('news')) {
return;
}
lang::o()->get('news');
$l = (int) config::o()->v('news_max');
$a = db::o()->cname('news')->query('SELECT n.*, u.username, u.group FROM news AS n
LEFT JOIN users AS u ON u.id=n.poster_id
ORDER BY n.posted_time DESC' . ($l ? ' LIMIT ' . $l : ""));
tpl::o()->assign('rows', $a);
tpl::o()->display('news/index.tpl');
}
示例8: check
/**
* Функция проверки кода recaptcha
* @param array $error массив ошибок
* @param string $var $_POST переменная для проверки введённого кода
* @return null
*/
public function check(&$error, $var = "recaptcha_challenge_field")
{
$posted_code = $_POST[$var];
if (!$posted_code) {
$error[] = lang::o()->v('captcha_false_captcha');
return;
}
$r = recaptcha_check_answer(config::o()->v('recaptcha_private_key'), $_SERVER["REMOTE_ADDR"], $posted_code, $_POST["recaptcha_response_field"]);
if (!$r || !is_object($r) || !$r->is_valid) {
$error[] = lang::o()->v('captcha_false_captcha');
return;
}
return true;
}
示例9: init
/**
* Инициализация блока контента
* @return null
*/
public function init()
{
lang::o()->get("content");
if (!users::o()->perm('content')) {
return;
}
/* @var $content content */
$content = plugins::o()->get_module("content");
if (!is_callable(array($content, "show"))) {
return;
}
tpl::o()->assign('content_in_block', true);
$content->show();
}
示例10: show_selector
/**
* Вывод селектора параметров
* @param array $row массив группы
* @param int $v значение параметра
* @return string HTML код
*/
public function show_selector($row, $v)
{
$m = $row['allowed'];
$n = $row['perm'];
$s = "";
if (strpos($n, "edit_") === 0 || strpos($n, "del_") === 0) {
$a = "_e";
}
for ($i = $m; $i >= 0; $i--) {
$l = lang::o()->visset("groups_rule_" . $n . "_value_" . $i) ? lang::o()->v("groups_rule_" . $n . "_value_" . $i) : lang::o()->v("groups_value_" . $i . ($i ? $a : ""));
$s .= "<input type='radio' name='can_" . $n . "'\n value='" . $i . "'" . ($v == $i ? " checked='checked'" : "") . "> " . $l . " ";
}
return $s;
}
示例11: init
/**
* Инициализация блока календаря
* @return null
*/
public function init()
{
$day_of_week = implode(',', array_map(array(db::o(), 'esc'), array_map('trim', explode(",", lang::o()->v('calendar_day_of_week')))));
$months = input::$months;
$monthes = array();
// lol'd
foreach ($months as $month) {
$monthes[] = db::o()->esc(lang::o()->v('month_' . $month));
}
$content = $this->count_content();
tpl::o()->assign("content_count", $content);
tpl::o()->assign('day_of_week', $day_of_week);
tpl::o()->assign("months", implode(",", $monthes));
tpl::o()->display("blocks/contents/calendar.tpl");
}
示例12: check
/**
* Функция проверки кода captcha
* @param array $error массив ошибок
* @param string $var $_POST переменная для проверки введённого кода
* @return null
*/
public function check(&$error, $var = "captcha_code")
{
$posted_code = $_POST[$var];
if (!$posted_code) {
$error[] = lang::o()->v('captcha_false_captcha');
return;
}
$code = (array) $_SESSION['captcha_key'];
if (in_array(mb_strtoupper($posted_code), $code)) {
return true;
} else {
$error[] = lang::o()->v('captcha_false_captcha');
return;
}
}
示例13: build
/**
* Построение плагина
* @param array $data массив данных
* @return null
* @throws EngineException
*/
public function build($data)
{
lang::o()->get('admin/plugins');
$data_params = array("plugin", "version", "author", "name", "descr", "comp", "comp_min", "comp_max");
extract(rex($data, $data_params));
if (!validword($plugin)) {
throw new EngineException("plugins_invalid_name");
}
$settings = modsettings::o()->make($data);
$defaults = modsettings::o()->save(modsettings::nocache_id, $data);
$vars = array($plugin, var_export((string) $version, true), var_export((string) $author, true), var_export((string) $name, true), var_export((string) $descr, true), var_export((string) $comp, true), var_export((string) $comp_min, true), var_export((string) $comp_max, true), var_export((array) $settings, true), $plugin, var_export((array) $defaults, true));
$contents = @file_get_contents(ROOT . self::plugin_template);
$contents = vsprintf($contents, $vars);
/* @var $uploader uploader */
$uploader = n("uploader");
$uploader->download_headers($contents, 'plugin.' . $plugin . '.php', 'text/plain');
}
示例14: init
/**
* Инициализация блока-торрентов
* @return null
*/
public function init()
{
if (!config::o()->v('torrents_on')) {
return;
}
lang::o()->get("blocks/content");
if (!users::o()->perm('content')) {
return;
}
$curcats = $this->settings['cats'];
if (!$curcats) {
return;
}
print "Torrents block inited";
$this->get_children($curcats);
tpl::o()->assign('curcats', array_reverse($curcats));
}
示例15: init
/**
* Инициализация модуля обратной связи
* @return null
*/
public function init()
{
$admin_file = globals::g('admin_file');
lang::o()->get('admin/feedback');
$act = $_GET["act"];
switch ($act) {
case "clear":
/* @var $o feedback_man_ajax */
$o = plugins::o()->get_module('feedback', 1, true);
$o->clear();
furl::o()->location($admin_file);
break;
default:
$this->show($_GET['sort'], $_GET['type']);
break;
}
}