当前位置: 首页>>代码示例>>PHP>>正文


PHP lng函数代码示例

本文整理汇总了PHP中lng函数的典型用法代码示例。如果您正苦于以下问题:PHP lng函数的具体用法?PHP lng怎么用?PHP lng使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了lng函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public static function get($id, $default, $args = [])
 {
     defined('REDIS_ACTIVE') || define('REDIS_ACTIVE', false);
     if (false === REDIS_ACTIVE) {
         return count($args) ? static::assign($default, $args) : $default;
     }
     $defaultLng = Config::get('application.language', DEFAULT_LANGUAGE);
     $lng = lng();
     $cache = redis()->get('lang.' . $lng . '.' . $id);
     $cacheEn = redis()->get('lang.en.' . $id);
     if (strlen($cache) && strlen($cacheEn)) {
         return $cache;
     }
     if ($defaultLng == $lng) {
         $translation = count($args) ? static::assign($default, $args) : $default;
         $save = $default;
     } else {
         $row = self::getDb()->where(['key', '=', $id])->where(['language', '=', $lng])->first(true);
         if ($row) {
             $translation = count($args) ? static::assign($row->translation, $args) : $row->translation;
             $save = $row->translation;
         } else {
             $translation = count($args) ? static::assign($default, $args) : $default;
             $save = $default;
             self::getDb()->create(['key' => $id, 'language' => $lng, 'translation' => $save])->save();
         }
     }
     redis()->set('lang.' . $lng . '.' . $id, $save);
     if (!strlen($cacheEn)) {
         redis()->set('lang.en.' . $id, $save);
         self::getDb()->create(['key' => $id, 'language' => 'en', 'translation' => $save])->save();
     }
     return $translation;
 }
开发者ID:schpill,项目名称:thin,代码行数:34,代码来源:Lang.php

示例2: events

 public function events()
 {
     if (!env('student')) {
         redirect('m=login');
     }
     $updisciplineId = val($_REQUEST, 'updisciplineId');
     $learningMode = val($_REQUEST, 'learningMode');
     if (empty($updisciplineId) || empty($learningMode)) {
         throw new Exception('Missed required param', 404);
     }
     $updiscipline = entry_sql('SELECT * FROM updiscipline WHERE updisciplineId=:updisciplineId', array(':updisciplineId' => $updisciplineId));
     if (empty($updiscipline)) {
         throw new Exception('Updiscipline not found', 404);
     }
     $groupPeriod = entry_sql('SELECT gp.* FROM group_history gh INNER JOIN group_period gp USING(groupPeriodId) WHERE gh.studentId=:studentId AND gp.sersemester=:sersemester', array('studentId' => studentId(), 'sersemester' => $updiscipline['sersemester']));
     if (empty($groupPeriod)) {
         throw new Exception('Cannot detect groupPeriod', 404);
     }
     $events = entries_sql('SELECT * FROM event WHERE updisciplineId=:updisciplineId AND groupPeriodId=:groupPeriodId AND learningMode=:learningMode', array('groupPeriodId' => $groupPeriod['groupPeriodId'], 'updisciplineId' => $updiscipline['updisciplineId'], 'learningMode' => $learningMode));
     array_walk($events, function (&$event, $k, $studentId) {
         $event['c'] = material::i($event['instanceType'])->c();
         $event['grade'] = material::i($event['instanceType'])->get_grade($event['instanceId'], $studentId);
     }, studentId());
     env('breadcrumbs', array(array(lng('up:disciplines'), '/?c=up'), array($updiscipline['disciplineName'], '/?c=up&m=events&updisciplineId=' . $updisciplineId . '&learningMode=' . $learningMode), lng('up:events')));
     tpl('up/events', array('updiscipline' => $updiscipline, 'events' => $events, 'result' => entry_sql('SELECT * FROM result WHERE studentId=:studentId AND updisciplineId=:updisciplineId AND learningMode=:learningMode', array('studentId' => studentId(), 'updisciplineId' => $updiscipline['updisciplineId'], 'learningMode' => $learningMode))));
 }
开发者ID:vealexeev,项目名称:quiz_engine_light,代码行数:26,代码来源:up.php

示例3: Show

 public function Show($modal_mode = true)
 {
     if (!$this->user) {
         return false;
     }
     $statistic = $this->user->getStatistic();
     $main_info['name'] = $this->user->name();
     $tmpParam = $this->user->getStatisticTime('active_last');
     $main_info['active_last'] = $tmpParam ? self::TimeFrom($tmpParam) : 'Никогда';
     // toDo show Online \ Offline
     $main_info['skin'] = $this->user->getSkinLink(false, '&', true);
     $main_info['female'] = $this->user->isFemale() ? 1 : 0;
     $user_info['group'] = array($this->user->getGroupName(), 'Группа');
     $user_info['play_times'] = array((int) $statistic['play_times'], 'Проведенных игр');
     $tmpParam = $this->user->gameLoginLast();
     $user_info['play_last'] = array($tmpParam ? self::TimeFrom($tmpParam) : 'Никогда', 'Вход в игру');
     $tmpParam = $this->user->getStatisticTime('create_time');
     $user_info['create_time'] = array($tmpParam ? $tmpParam : 'Неизвестно', 'Дата регистрации');
     $user_info['comments_num'] = array((int) $statistic['comments_num'], 'Комментарии');
     $user_info['undress_times'] = array((int) $statistic['undress_times'], 'Перевоплощения');
     if ($this->admin_mode && !$this->self_ignore) {
         $tmpParam = $this->user->email();
         $user_info['email'] = array($tmpParam ? $tmpParam : lng('NOT_SET'), 'Почта');
         $user_info['money'] = array($this->user->getMoney() . ' руб.', 'Баланс');
         $user_info['ip'] = array($this->user->ip(), 'IP');
     }
     ob_start();
     include $this->GetView('common_profile.html');
     return ob_get_clean();
 }
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:30,代码来源:profile.class.php

示例4: _up_breadcrumbs

 protected function _up_breadcrumbs($event)
 {
     $updiscipline = entry_sql('SELECT * FROM updiscipline WHERE updisciplineId=:updisciplineId', array(':updisciplineId' => $event['updisciplineId']));
     if (empty($updiscipline)) {
         throw new Exception('Cannot fetch updiscipline "' . $event['updisciplineId'] . '"', 500);
     }
     return array(array(lng('up:disciplines'), '/?c=up'), array($updiscipline['disciplineName'], '/?c=up&m=events&updisciplineId=' . $event['updisciplineId'] . '&learningMode=' . $event['learningMode']), lng('up:events'), array($event['name'], '/?c=' . material::i($event['instanceType'])->c() . '&eventId=' . $event['eventId'] . '&id=' . $event['instanceId']));
 }
开发者ID:vealexeev,项目名称:quiz_engine_light,代码行数:8,代码来源:controller.php

示例5: get

 public function get($key, $lng = null, $default = null, $args = [])
 {
     $lng = is_null($lng) ? lng() : $lng;
     $keyT = $key . '.' . $lng;
     $val = array_get($this->data, $keyT, $default);
     if (!empty($args) && fnmatch('##*##', $val)) {
         foreach ($args as $k => $v) {
             $val = str_replace("##{$k}##", $v, $val);
         }
     }
     return $val;
 }
开发者ID:schpill,项目名称:standalone,代码行数:12,代码来源:translate.php

示例6: upgrade

    public function upgrade(PDO $pdo)
    {
        if ($this->fromVersion != schema_version($pdo)) {
            throw new RuntimeException(lng('cantexec'));
        }
        $pdo->exec(<<<SQL
CREATE TABLE
    {$pdo->prefix}flood
(
    userid INT(10) NOT NULL DEFAULT 0,
    type TINYINT(1) DEFAULT NULL,
    time TIMESTAMP(6) NOT NULL,
    ip VARCHAR(16) NOT NULL DEFAULT ''
) ENGINE = HEAP
SQL
);
        $pdo->exec(<<<SQL
INSERT INTO
    {$pdo->prefix}registrygroup
VALUES
    (8, 'Flood Protection', 7),
    (9, 'Error Reporting', 8)
SQL
);
        $pdo->exec(<<<SQL
INSERT INTO
    {$pdo->prefix}registry
VALUES
    ('flood_login_count', '3', 'integer', 'Login failure count', 'Number of failed logins before the account gets locked for specific IP.<br>(0 to disable)', 8, 1),
    ('flood_login_timeout', '15', 'integer', 'Login failure timeout', 'Time (in minutes) for which an account gets locked after several failed logins.', 8, 2),
    ('flood_register_count', '5', 'integer', 'Registration count', 'Number of registrations before register gets locked for specific IP.<br>(0 to disable)', 8, 3),
    ('flood_register_timeout', '15', 'integer', 'Registration timeout', 'Time (in minutes) for which an IP gets locked after several registrations.', 8, 4),
    ('flood_mail_count', '3', 'integer', 'Mail count', 'Number of sent mails before mail function gets locked for specific user.<br>(0 to disable)', 8, 5),
    ('flood_mail_timeout', '15', 'integer', 'Mail timeout', 'Time (in minutes) for which mail function gets locked after several sent mails.', 8, 6),
    ('debug_what', '0', 'integer', 'Error Reporting', '0 - Disabled<br>1 - PHP only<br>2 - SQL only<br>3 - both', 9, 0),
    ('debug_mail', '0', 'boolean', 'Error Mails', 'Send error reports as email? This requires &quot;Use eMail Functions&quot; and &quot;Board Admin/Tech eMail&quot;.', 9, 1),
    ('debug_do_log', '0', 'boolean', 'Log errors?', 'Log errors to file?<br>In order to use this feature, you must create a directory with the correct permissions and set the path below.<br><strong>It is highly recommended that this directory be secured by a .htaccess</strong>.', 9, 2),
    ('debug_log_path', 'logs/thwb_err', 'string', 'Log file path', 'path to the log file and log file prefix.<br><strong>See above</strong>.', 9, 3)
SQL
);
        $stmt = $pdo->prepare(<<<SQL
UPDATE
    {$pdo->prefix}registry
SET
    keyvalue = :version
WHERE
    keyname = 'version'
SQL
);
        $stmt->bindValue(':version', $this->toVersion, PDO::PARAM_STR);
        $stmt->execute();
    }
开发者ID:adrianbroher,项目名称:thwboard,代码行数:52,代码来源:ThWboardMigration.5.php

示例7: upgrade

    public function upgrade(PDO $pdo)
    {
        if ($this->fromVersion != schema_version($pdo)) {
            throw new RuntimeException(lng('cantexec'));
        }
        $pdo->exec(<<<SQL
ALTER TABLE
    {$pdo->prefix}user
ADD COLUMN
    usernoipcheck TINYINT(1) UNSIGNED NOT NULL DEFAULT 0
SQL
);
        $pdo->exec(<<<SQL
UPDATE
    {$pdo->prefix}style
SET
    boardimage = './templates/default/images/space.png'
WHERE
    boardimage = './templates/default/images/space.gif'
SQL
);
        $pdo->exec(<<<SQL
UPDATE
    {$pdo->prefix}style
SET
    boardimage = './templates/default/images/newtopic.png'
WHERE
    boardimage = './templates/default/images/newtopic.gif'
SQL
);
        $pdo->exec(<<<SQL
UPDATE
    {$pdo->prefix}style
SET
    stdfont = 'Verdana, Helevetica'
WHERE
    stdfont = 'Verdana'
SQL
);
        $stmt = $pdo->prepare(<<<SQL
UPDATE
    {$pdo->prefix}registry
SET
    keyvalue = :version
WHERE
    keyname = 'version'
SQL
);
        $stmt->bindValue(':version', $this->toVersion, PDO::PARAM_STR);
        $stmt->execute();
    }
开发者ID:adrianbroher,项目名称:thwboard,代码行数:51,代码来源:ThWboardMigration.3.php

示例8: tryExit

function tryExit()
{
    global $rcodes;
    $message = '';
    $rnum = sizeof($rcodes);
    if (!$rnum) {
        return;
    }
    for ($i = 0; $i < $rnum; $i++) {
        $modifed = true;
        switch ($rcodes[$i]) {
            case 2:
                $message .= lng('INCORRECT') . '. (' . lng('LOGIN') . ')';
                break;
            case 3:
                $message .= lng('INCORRECT') . '. (' . lng('PASS') . ')';
                break;
            case 4:
                $message .= lng('INCORRECT') . '. (' . lng('REPASS') . ')';
                break;
            case 12:
                $message .= lng('INCORRECT') . '. (' . lng('EMAIL') . ')';
                break;
            case 6:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('LOGIN') . ')';
                break;
            case 7:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('PASS') . ')';
                break;
            case 8:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('REPASS') . ')';
                break;
            case 9:
                $message .= lng('REPASSVSPASS');
                break;
            case 13:
                $message .= lng('INCORRECT_LEN') . '. (' . lng('EMAIL') . ')';
                break;
            default:
                $modifed = false;
                break;
        }
        if ($modifed) {
            $message .= "<br />";
        }
    }
    aExit(2, $message);
}
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:48,代码来源:register.php

示例9: CaptchaCheck

function CaptchaCheck($exit_mess = 2, $ajaxExit = true, $post_name = 'antibot')
{
    if (!isset($_SESSION)) {
        session_start();
    }
    $input = Filter::input($post_name, 'post', 'int', true);
    if (empty($_SESSION['code']) or $input === false or $_SESSION['code'] != $input) {
        if (isset($_SESSION['code'])) {
            unset($_SESSION['code']);
        }
        if ($ajaxExit) {
            aExit($exit_mess, lng('CAPTCHA_FAIL'));
        }
        return false;
    }
    unset($_SESSION['code']);
    return true;
}
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:18,代码来源:ajax.php

示例10: login

 public function login()
 {
     if (studentId()) {
         redirect('c=up');
     }
     $login = val($_REQUEST, 'login');
     $passw = val($_REQUEST, 'passw');
     if (!empty($passw)) {
         $studentId = field_sql('SELECT studentId FROM student WHERE login=:login AND passw=:passw', array('login' => $login, 'passw' => md5($passw)));
         if (empty($studentId)) {
             env('warning', lng('main:loginfailed'));
         } else {
             $_SESSION['studentId'] = $studentId;
             redirect('c=up');
         }
     }
     env('breadcrumbs', array(lng('main:loginpage')));
     tpl('login_form', array('login' => $login, 'passw' => ''));
 }
开发者ID:vealexeev,项目名称:quiz_engine_light,代码行数:19,代码来源:front.php

示例11: get

 public function get($key, $default, $args = [])
 {
     $translation = $default;
     $locale = session('web')->getLanguage();
     if (!$locale) {
         $locale = lng();
         session('web')->setLanguage($locale);
     }
     if (fnmatch('*_*', $locale)) {
         list($locale, $d) = explode('_', $locale, 2);
     }
     $locale = strtolower($locale);
     if (false !== $this->mustTranslate) {
         $row = $this->db->where(['key', '=', $key])->first();
         if ($row) {
             if (!isset($row[$locale])) {
                 $translate = $this->db->find((int) $row['id']);
                 $setter = setter($locale);
                 $translate->{$setter}('')->save();
             }
             $translation = isAke($row, $locale, $default);
             if (!strlen($translation)) {
                 $translation = $default;
             }
         } else {
             $default = preg_replace('~[\\r\\n]+~', '', $default);
             $translate = $this->db->firstOrCreate(['key' => $key]);
             $setter = setter(DEFAULT_LANGUAGE);
             $translate->{$setter}($default);
             $setter = setter($locale);
             $translate->{$setter}('')->save();
         }
     }
     if (!empty($args)) {
         foreach ($args as $k => $v) {
             $translation = str_replace('%' . $k . '%', $v, $translation);
         }
     }
     return $translation;
 }
开发者ID:schpill,项目名称:standalone,代码行数:40,代码来源:i18n.php

示例12: SaveAction

 public function SaveAction()
 {
     global $CONFIG;
     #special case login
     if (req('save_type') == 'facebook') {
         $this->SaveFacebook();
         return;
     }
     try {
         $login = trim($_REQUEST['item']['login']);
         $pwd = $_REQUEST['item']['pwdh'];
         if ($_REQUEST["item"]["chpwd"] == "1") {
             $pwd = $_REQUEST['item']['pwd'];
         }
         $pwd = substr(trim($pwd), 0, 32);
         if (!strlen($login) || !strlen($pwd)) {
             $this->ferr("REGISTER", True);
             throw new ApplicationException("");
         }
         $hU = db_row("select * from users where email=" . dbq($login) . " and pwd=" . dbq($pwd));
         if (!isset($hU['access_level']) || $hU['status'] != 0) {
             throw new ApplicationException(lng("User Authentication Error"));
         }
         $this->model->do_login($hU['id']);
         $gourl = reqs('gourl');
         if ($gourl && !preg_match("/^http/i", $gourl)) {
             #if url set and not external url (hack!) given
             fw::redirect($gourl);
         } else {
             fw::redirect($CONFIG['LOGGED_DEFAULT_URL']);
         }
     } catch (ApplicationException $ex) {
         $this->fw->G['err_ctr'] = reqi('err_ctr') + 1;
         $this->set_form_error($ex->getMessage());
         $this->route_redirect("Index");
     }
 }
开发者ID:osalabs,项目名称:osafw-php,代码行数:37,代码来源:Login.php

示例13: upgrade

    public function upgrade(PDO $pdo)
    {
        if ($this->fromVersion != schema_version($pdo)) {
            throw new RuntimeException(lng('cantexec'));
        }
        $pdo->exec(<<<SQL
ALTER TABLE
    {$pdo->prefix}calendar
ADD COLUMN
    userid INT(10) UNSIGNED NOT NULL
SQL
);
        $stmt = $pdo->prepare(<<<SQL
UPDATE
    {$pdo->prefix}registry
SET
    keyvalue = :version
WHERE
    keyname = 'version'
SQL
);
        $stmt->bindValue(':version', $this->toVersion, PDO::PARAM_STR);
        $stmt->execute();
    }
开发者ID:adrianbroher,项目名称:thwboard,代码行数:24,代码来源:ThWboardMigration.1.php

示例14: loadTool

<?php

if (!defined('MCR')) {
    exit;
}
loadTool('catalog.class.php');
$category = Filter::input('cid', 'get', 'int');
if ($category) {
    $news_manager = new NewsManager($category, 'news/', 'index.php?cid=' . $category . '&');
} else {
    $news_manager = new NewsManager(-1, 'news/');
}
/* Default vars */
$page = lng('PAGE_NEWS');
/* Get \ Post options */
$curlist = Filter::input('l', 'get', 'int');
if ($curlist <= 0) {
    $curlist = 1;
}
$menu->SetItemActive('main');
$content_main .= $news_manager->ShowNewsListing($curlist);
$content_main .= $news_manager->ShowCategorySelect();
$news_manager->destroy();
unset($news_manager);
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:24,代码来源:news.php

示例15: ShowThemeSelectorOpt

 public function ShowThemeSelectorOpt()
 {
     global $config;
     if (!$this->isThemesEnabled()) {
         return '<option value="-1">' . lng('NOT_SET') . '</option>';
     }
     $theme_list = $this->GetThemeList();
     $html_list = '';
     for ($i = 0; $i < sizeof($theme_list); $i++) {
         $html_list .= '<option value="' . $theme_list[$i]['id'] . '" ' . ($theme_list[$i]['id'] === $config['s_theme'] ? 'selected' : '') . '>' . $theme_list[$i]['name'] . '</option>';
     }
     return $html_list;
 }
开发者ID:qexyorg,项目名称:webMCR-1,代码行数:13,代码来源:alist.class.php


注:本文中的lng函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。