本文整理汇总了PHP中lang类的典型用法代码示例。如果您正苦于以下问题:PHP lang类的具体用法?PHP lang怎么用?PHP lang使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了lang类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($host, $user, $pass)
{
$this->sftp = new Net_SFTP($host);
if (!$this->sftp->login($user, $pass)) {
echo message::danger(lang::get('sftp_login_failed'), false);
}
}
示例2: send
/**
* 发送简历
*/
function send()
{
if (input::getInput("post")) {
$back = sf::getModel("backs");
$back->setSubject(input::getInput("post.subject"));
$back->setUserName(input::getInput("post.user_name"));
$back->setUserSex(input::getInput("post.user_sex"));
$back->setUserAge(input::getInput("post.user_age"));
$back->setUserDegree(input::getInput("post.user_degree"));
$back->setIdcard(input::getInput("post.idcard"));
$back->setUserPhone(input::getInput("post.user_phone"));
$back->setUserIm(input::getInput("post.user_im"));
$back->setUserEmail(input::getInput("post.user_email"));
$back->setUserAddress(input::getInput("post.user_address"));
$back->setPostCode(input::getInput("post.post_code"));
$back->setWorkAt(input::getInput("post.work_at"));
$back->setStudyList(input::getInput("post.study_list"));
$back->setWorkList(input::getInput("post.work_list"));
$back->setUpdatedAt(date("Y-m-d H:i:s"));
$back->save();
$this->page_debug(lang::get("Has been saved!"), site_url("job/index"));
}
view::set("job", sf::getModel("jobs", input::getInput("get.id")));
view::apply("inc_body", "template/job_send");
view::display("template/page");
}
示例3: 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");
}
示例4: __construct
public function __construct($requestArray)
{
// make an array with posible privileges
if (!isset($_SESSION['POSIBLEPRIVS'])) {
$_SESSION['POSIBLEPRIVS'] = array('insert' => lang::translate('act_insert'), 'update' => lang::translate('act_update'), 'delete' => lang::translate('act_delete'), 'list' => lang::translate('act_view'), 'uploadfile' => lang::translate('act_uploadfile'), 'deletefile' => lang::translate('act_deletefile'));
}
// get database connection
$this->DB = new db();
// set user and pass to be checked
$this->POST = $requestArray;
// make login if not logged in
if (!isset($_SESSION['USERAUTH']) || empty($_SESSION['USERAUTH'])) {
$_SESSION['USERAUTH'] = $this->login();
}
// if cannot make login
if (empty($_SESSION['USERAUTH'])) {
return $this->createLoginForm();
}
// check login again, for valid info
if (!$this->check()) {
return $this->createLoginForm();
}
// get user data from $this->login()
// after we know everything it's OK
$this->userData = $_SESSION['USERAUTH'];
// populate privileges array
$this->getPriv();
}
示例5: getEMessage
/**
* Получение сообщения
* @return string сообщение
*/
public function getEMessage()
{
// Ибо getMessage - final
$m = lang::o()->if_exists($this->message);
$v = $this->vars;
return $v ? vsprintf($m, $v) : $m;
}
示例6: proc
public function proc()
{
//reg::setKey('/users/errorCountCapcha', system::POST('errorCountCapcha'));
reg::setKey('/users/errorCountBlock', system::POST('errorCountBlock'));
reg::setKey('/users/reg', system::POST('reg', isBool));
reg::setKey('/users/activation', system::POST('activation', isBool));
reg::setKey('/users/confirm', system::POST('confirm', isBool));
reg::setKey('/users/ask_email', system::POST('ask_email', isBool));
//авторизация чере соц. сети
reg::setKey('/users/twitter_bool', system::POST('twitter_bool'), isBool);
reg::setKey('/users/twitter_id', system::POST('twitter_id'), isString);
reg::setKey('/users/twitter_secret', system::POST('twitter_secret'), isString);
reg::setKey('/users/vk_bool', system::POST('vk_bool'), isBool);
reg::setKey('/users/vk_id', system::POST('vk_id'), isString);
reg::setKey('/users/vk_secret', system::POST('vk_secret'), isString);
reg::setKey('/users/ok_bool', system::POST('ok_bool'), isBool);
reg::setKey('/users/ok_id', system::POST('ok_id'), isString);
reg::setKey('/users/ok_public', system::POST('ok_public'), isString);
reg::setKey('/users/ok_secret', system::POST('ok_secret'), isString);
reg::setKey('/users/facebook_bool', system::POST('facebook_bool'), isBool);
reg::setKey('/users/facebook_id', system::POST('facebook_id'), isString);
reg::setKey('/users/facebook_secret', system::POST('facebook_secret'), isString);
reg::setKey('/users/yandex_bool', system::POST('yandex_bool'), isBool);
reg::setKey('/users/google_bool', system::POST('google_bool'), isBool);
ui::MessageBox(lang::get('CONFIG_SAVE_OK'), lang::get('CONFIG_SAVE_OK_MSG'));
reg::clearCache();
system::log(lang::get('CONFIG_LOG_SAVE'), warning);
system::redirect('/users/settings');
}
示例7: getSql
public static function getSql($name)
{
if (!isset(self::$slots[$name])) {
throw new Exception(sprintf(lang::get('slot_name_not_exist'), $name));
}
return self::$slots[$name];
}
示例8: defAction
public function defAction()
{
$count = ormObjects::getCountTrashObjects();
$max_count = uiTable::getMaxCount();
if (uiTable::getCurPage() != 1) {
$niz = empty($start_pos) ? uiTable::getCurPage() * $max_count - $max_count : 0;
$objects = ormObjects::getTrashObjects($niz, $max_count);
} else {
$objects = ormObjects::getTrashObjects($max_count);
}
if (user::issetRight('object_del') && !empty($objects)) {
ui::newButton(lang::get('BTN_NEW_CLEAК_TRASH'), 'javascript:clearTrash();');
}
$table = new uiTable($objects, $count);
$table->addColumn('name', lang::get('TRASH_TABLE_1'), 400);
$table->addColumn('class', lang::get('TRASH_TABLE_2'));
$table->addColumn('date', lang::get('TRASH_TABLE_3'), 0, false, false, 'viewDateTime');
$table->addColumn('user', lang::get('TRASH_TABLE_4'), 200);
$table->addRight('object_restore', 'restore', multi, 'restoreObj(this)', lang::get('TRASH_TABLE_RESTORE'));
$table->addRight('object_del', 'drop', multi);
$table->setDelMessage(lang::get('TRASH_DEL_TITLE'), lang::get('TRASH_DEL_MSG'));
$table->setMultiDelMessage(lang::get('TRASH_DEL_TITLE2'), lang::get('TRASH_DEL_MSG2'));
$table->emptyText(lang::get('TRASH_EMPTY_MSG'));
$html = '
<script type="text/javascript" src="/css_mpanel/restore_objects.js"></script>
<input id="clearTrashTitle" type="hidden" value="' . lang::get('TRASH_DEL_TITLE3') . '">
<input id="clearTrashText" type="hidden" value="' . lang::get('TRASH_DEL_MSG3') . '">
';
return $html . $table->getHTML();
}
示例9: run
public function run()
{
include main::getPluginDir() . '/libs/classes/aws-autoloader.php';
$ad = $this->params['access_details'];
main::log(lang::get('Start copy files to Amazon S3', false));
$files = $this->params['files'];
$dir = isset($ad['dir']) ? $ad['dir'] : '/';
$credentials = new Aws\Common\Credentials\Credentials($ad['AccessKeyId'], $ad['SecretAccessKey']);
$client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
try {
$n = count($files);
for ($i = 0; $i < $n; $i++) {
$filePath = preg_replace('#[/\\\\]+#', '/', BACKUP_DIR . '/' . $dir . '/' . $files[$i]);
$key = $dir ? $dir . '/' . basename($filePath) : basename($filePath);
$key = ltrim(preg_replace('#[/\\\\]+#', '/', $key), '/');
//if first will be '/', file not will be uploaded, but result will be ok
$putRes = $client->putObject(array("Bucket" => $ad['bucket'], 'Key' => $key, 'Body' => fopen($filePath, 'r+')));
if (isset($putRes['RequestId']) && !empty($putRes['RequestId'])) {
main::log(str_replace('%s', basename($filePath), lang::get("File(%s) Upload successfully to Amazon S3", false)));
}
}
main::log(lang::get('End copy files to Amazon S3', false));
} catch (Exception $e) {
main::log('Error send to Amazon s3: ' . $e->getMessage());
$this->setError($e->getMessage());
return false;
} catch (S3Exception $e) {
main::log('Error send to Amazon s3: ' . $e->getMessage());
$this->setError($e->getMessage());
return false;
}
return true;
}
示例10: formBlock
public static function formBlock($module)
{
$form = form::factory('module', 'id=' . $module->getModulId(), 'index.php');
$form->setSave(false);
$form->addFormAttribute('class', '');
$form->setSuccessMessage(null);
$input = $module->OutputFilter($form->get('input'), $module->getSql());
$form->addRawField($input);
$form->addHiddenField('structure_id', $module->getStructureId());
if ($module->getId()) {
$form->setMode('edit');
$online = $module->get('online');
} else {
$form->setMode('add');
$online = 1;
$form->delButton('save-back');
}
$form->addHiddenField('modul', $module->getModulId());
$form->addHiddenField('sort', $module->getSort());
$field = $form->addRadioField('online', $online);
$field->fieldName(lang::get('block_status'));
$field->add(1, lang::get('online'));
$field->add(0, lang::get('offline'));
$form->addHiddenField('id', $module->getId());
$form->addParam('structure_id', type::super('structure_id', 'int'));
return $form;
}
示例11: checkAddon
public static function checkAddon($addons)
{
$return = '';
foreach ($addons as $name => $version) {
if (is_int($name)) {
$name = $version;
$version = false;
}
$config = addonConfig::getConfig($name);
// Nicht installiert
if (!is_array($config)) {
$return .= sprintf(lang::get('addon_not_found'), $name);
continue;
}
if (!addonConfig::isActive($name)) {
$return .= sprintf(lang::get('addon_not_install_active'), $name);
continue;
}
if ($version && $config['version'] < $version) {
$return .= sprintf(lang::get('addon_need_version'), $name, $version);
continue;
}
}
if ($return == '') {
return true;
} else {
return $return;
}
}
示例12: getDB
public static function getDB($key = 'default')
{
self::clearErr();
if (empty($key)) {
$this->code = 1023;
$this->msg = lang::getLang('learn', 'param_error');
}
$config = cfg_db::$default;
if (isset($dbResMap[$key])) {
if (self::$dbResMap[$key]->selectDB($config['db'])) {
return self::$dbResMap[$key];
}
if (self::$dbResMap[$key]->selectDB($config['db'])) {
return self::$dbResMap[$key];
}
$dbResMap[$key]->closeDB();
unset($dbResMap[$key]);
return false;
}
$db = new db($config['host'], $config['port'], $config['db'], $config['user'], $config['password']);
if ($db->errCode > 0) {
self::$code = 1024;
self::$msg = "todo";
return false;
}
self::$dbResMap[$key] = $db;
return self::$dbResMap[$key];
}
示例13: defineLang
private static function defineLang()
{
$cookieLang = in::getCookie('lang');
$getLang = in::getGet('lang');
if (!empty($getLang)) {
self::$lang = in::getGet('lang');
out::setCookie('lang', self::$lang, time() + 60 * 60);
} elseif (!empty($cookieLang)) {
self::$lang = in::getCookie('lang');
} else {
self::$lang = self::defaultLang;
}
if (!@(include_once 'includes/langs/' . self::$lang . '.php')) {
//throw new Exception('includes/langs/'.self::$lang.'.php doesnt exist.');
@(include_once 'includes/langs/' . self::defaultLang . '.php');
}
if (LANGC_DEBUGCHARSET) {
if (LANGC_LANGCHARSET == 'iso-8859-1' && LANGC_CHARSET == 'utf-8') {
$sort = null;
foreach ($STRING as $key => $value) {
$sort[$key] = utf8_encode($STRING[$key]);
}
$STRING = $sort;
} elseif (LANGC_LANGCHARSET == 'utf-8' && LANGC_CHARSET == 'iso-8859-1') {
$sort = null;
foreach ($STRING as $key => $value) {
$sort[$key] = utf8_decode($STRING[$key]);
}
$STRING = $sort;
}
}
self::$strings = $STRING;
}
示例14: defAction
public function defAction()
{
// Формируем список классов для быстрого добавления
$types = ormClasses::get('user')->getAllInheritors();
if (count($types) > 1) {
$class_list = '';
while (list($id, $name) = each($types)) {
$bclass = ormClasses::get($id);
$class_list .= '<li><a href="' . system::au() . '/users/user_add/0/' . $bclass->getSName() . '" >' . $bclass->getName() . '</a></li>';
}
$java = '<script> $("#usel").parent().css("width", "150px"); </script>';
ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add", 'class_list', '<ul id="usel">' . $class_list . '</ul>' . $java);
} else {
ui::newButton(lang::get('BTN_NEW_USER'), "/users/user_add");
}
ui::newButton(lang::get('BTN_NEW_UGROUP'), "/users/group_add");
$sel = new ormSelect('user_group');
$sel->orderBy('name', asc);
$table = new uiTable($sel);
$table->showSearch(true);
$table->addColumn('name', lang::get('USERS_TABLE_FIELD_5'), 0, true);
$table->addColumn('children', lang::get('USERS_TABLE_FIELD_6'), 0, true, true, 'count');
$table->defaultRight('userlist');
$table->addRight('userlist', 'users', single);
$table->addRight('group_upd', 'edit', single);
$table->addRight('group_act', 'active', multi);
$table->addRight('group_del', 'drop', multi);
$table->setDelMessage(lang::get('USERS_DEL_TITLE2'), lang::get('USERS_DEL_TEXT2'));
$table->setMultiDelMessage(lang::get('USERS_DEL_TITLE_MULTI2'), lang::get('USERS_DEL_TEXT_MULTI2'));
return $table->getHTML();
}
示例15: __construct
/**
* Initialize language manager and set up current page language
* @param String $pays language code - must be a subdirectory of /lang
*/
public function __construct($pays)
{
self::$pays = $pays;
self::$type[] = "text";
self::$type[] = "success";
self::$type[] = "error";
self::$type[] = "title";
// Automatic creation of language folder
if (!is_dir(LANG . '/' . $pays)) {
mkdir(LANG . '/' . $pays);
mkdir(LANG . '/' . $pays . '/mail');
}
foreach (self::$type as $t) {
if (!file_exists(LANG . '/' . $pays . '/lang.' . $t . '.xml')) {
// Automatic creation of language files
$template = new template(SYSTEM . '/template/lang.tpl');
$template->assign('lang', $pays);
$file = fopen(LANG . '/' . $pays . '/lang.' . $t . '.xml', "w+");
fputs($file, $template->display());
fclose($file);
}
if (file_exists(LANG . '/' . $pays . '/lang.' . $t . '.xml')) {
$xml = simplexml_load_file(LANG . '/' . $pays . '/lang.' . $t . '.xml', 'SimpleXMLElement', LIBXML_NOCDATA);
foreach ($xml->lang as $line) {
$id = (string) $line['id'];
self::$lang[$t][$id] = $line;
}
}
}
}