本文整理汇总了PHP中i18n::T方法的典型用法代码示例。如果您正苦于以下问题:PHP i18n::T方法的具体用法?PHP i18n::T怎么用?PHP i18n::T使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类i18n
的用法示例。
在下文中一共展示了i18n::T方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
$id = (int) $this->get_param('id');
$page = (int) $this->get_param('page');
// @todo move pagination to filters?
if (!$page) {
$page = ($pf = $this->_controller->get_router()->get_filter('pagination')) ? $pf->get_start() : 0;
}
// load by id
$searchs = $this->_controller->get_context()->get_search_handle();
$search_results = $this->_controller->get_context()->get_search_result_handle();
$item = $searchs->get_by_id($id);
if ($item) {
$this->renderer->set_return('keyword', $item->keyword);
if ($item->c_count) {
/** @var \tf\core\collection_filter*/
$f = $search_results->set_order('time DESC')->get_filter('/search/' . $id . '/')->set_config(array('where_sql' => 'pid = ' . $item->id))->set_per_page($this->_per_page)->set_pagination($page);
$this->renderer->set_return('posts', $f->apply()->as_array());
} else {
$this->renderer->set_message(i18n::T('sat.search_not_found'), false);
return false;
}
} else {
$this->renderer->set_return('keyword', '');
}
}
示例2: smarty_modifier_i18n
/**
* I18N string
*
* {"cars2\\body_type_id"|i18n}
* {"Параметр"|i18n:'module.prefix':params}
*
* Type: modifier<br>
* Name: lower<br>
* Purpose: convert string to lowercase
*
* @param string
* @return string
*/
function smarty_modifier_i18n($id, $prefix = '', $params = null)
{
if ($prefix) {
$id = $prefix . '.' . $id;
}
return i18n::T($id, $params);
}
示例3: action_system
function action_system()
{
$this->collection->toggle_system($this->params->id, 'true' == functions::request_var('to', 'false'));
if ($this->in_ajax()) {
$this->_ajax_answer(true, i18n::T('Status changed'));
}
}
示例4: action_api_editor_menu
/**
* Editor nav menu
*/
function action_api_editor_menu()
{
/** @var tf_editor $ed */
$ed = core::lib('editor');
$menu = array();
// dies on get_editor_actions
$menu['core'] = core::get_instance()->get_editor_actions();
foreach (core::modules() as $module) {
$menu[$module->get_name()] = $module->get_editor_actions();
}
$menuNormalized = array();
foreach ($menu as $key => $actions) {
$submenuNormalized = array();
if (!empty($actions)) {
foreach ($actions as $subKey => $subMenu) {
if (!empty($subMenu['url'])) {
$subMenu['url'] = $ed->make_url($subMenu['url'], 1);
}
$submenuNormalized[] = !$subMenu ? array() : array_merge(array('id' => $subKey), $subMenu);
}
$menuNormalized[] = array('id' => $key, 'title' => i18n::T(array($key, '_name')), 'actions' => $submenuNormalized);
}
}
$this->renderer->set_ajax_answer($menuNormalized)->ajax_flush();
}
示例5: run
/**
* Remember!
* Assign current item in controller for comment linking!
*/
function run()
{
if (loader::in_ajax() !== true) {
throw new controller_exception('Cant touch this ' . __METHOD__);
return false;
}
core::dprint('run comment modify');
$pctl = core::modules()->get_router()->get_controller();
$user = core::lib('auth')->get_user();
/**
* Parent item, must be assigned thru @see module_controller::set_current_item()
* @var abs_collection_item
*/
$post = $pctl->get_current_item();
// var_dump(get_class($post), core::get_modules()->get_router()->get_name());
if (!$post) {
throw new controller_exception('No item assigned');
}
if (!$post->has_behavior('sat.commentable')) {
throw new controller_exception('Not commentable');
}
$comments = $post->behavior('sat.commentable')->get_attach_model();
//get_comments();
$request = core::lib('request');
$renderer = core::lib('renderer');
$user_id = core::lib('auth')->get_user()->id;
$pid = (int) $request->post('pid', 0);
$limit = core::selfie()->cfg('comment_interval', 60);
$auth = core::lib('auth');
/** @var aregistry $sd */
$sd = $auth->get_current_session()->get_storage();
$time = $sd->comments_last_time;
//$time = $comments->get_last_time($pid, $user_id);
// disallow by interval
if ($time && $time + $limit > time()) {
$pctl->set_null_template();
$renderer->set_ajax_answer(array('status' => false, 'id' => 0, 'message' => vsprintf(i18n::T('sat\\comment_interval_restriction'), $time + $limit - time())))->ajax_flush();
// else core::get_instance()->set_message(array('content', 'comment_interval_restriction'));
return;
// exit
}
$sd->comments_last_time = time();
$username = functions::request_var('username', '');
$text = functions::request_var('text', '');
$api = functions::request_var('api');
$id = $comments->modify(array('user_ip' => core::lib('auth')->get_user_ip(true), 'user_id' => $user_id, 'ctype_id' => $post->get_ctype_id(), 'username' => $username, 'pid' => $pid, 'text' => $text, 'type' => functions::request_var('type', 0), 'tpid' => functions::request_var('tpid', 0), 'api' => $api));
$comment = $comments->get_item_by_id($id);
if (!$comment) {
throw new controller_exception('[ajax] Comment create failed');
}
$comment->load_secondary();
$renderer->set_data('comment', $comment->render())->set_ajax_answer(array('status' => true, 'id' => $id))->set_ajax_message(i18n::T('sat\\comment_posted'));
//->set_main_template('content/comment/view');
$renderer->ajax_flush('shared/comments/comment');
// alright, update counter
return $id;
}
示例6: run
function run()
{
/** @var tf_sat $module */
$module = $this->_controller->get_context();
$id = $this->get_param('id');
$category = $this->get_param('category');
/** @var categoryID $cat_filt */
$cat_filt = false;
if ($category) {
$hcat = $module->get_news_category_handle()->where_slug($category)->set_limit(1)->load();
if (!$hcat->count()) {
throw new controller_exception('bad cat');
}
$cat_filt = $hcat->get_item()->id;
}
if (empty($id)) {
throw new controller_exception('Bad id');
}
$uc = $module->get_news_handle();
$u = $uc->with_deps(true)->where('slug', $id)->where('site_id', $module->get_current_site_id())->append_where($cat_filt ? "pid = {$cat_filt}" : false)->load_first();
// ->set_limit(1)
// ->load()
// ->get_item();
if (!$u) {
throw new controller_exception(i18n::T('sat\\No such news'));
}
// $u->load_secondary();
/*
$u->get_similar();
$u->get_attach_images();
$u->get_comments()->load_secondary();
$u->render_comments();
*/
$this->renderer->return->news_item = $u->render();
$this->renderer->set_page_title($u->title);
$this->_controller->set_current_item($u);
// see also
// [fav] @refactor dups
/*
if (!$this->_controller->get_user()->is_anonymous()) {
$hfavs = core::module('content')->get_fav_handle();
$fav_group = $hfavs->get_fav_desc(1);
$is_favorite = $hfavs->check_fav($u->id, $this->_controller->get_user()->get_id(), $fav_group['id']);
$tpl_fav = array(
'gid' => $fav_group['id']
, 'id' => $u->id
, 'active' => $is_favorite
);
$this->renderer->set_current('fav', $tpl_fav);
}
*/
// [/fav]
}
示例7: create_html_control
/**
* Create html control
* @abstract create_control
*/
function create_html_control()
{
$fvalue = $this->get_fvalue();
$options = array();
$options[] = "<option value='0'>" . i18n::T('undefined') . "</option>";
foreach ($this->select_options as $k => $v) {
$selected = $fvalue == $k ? 'selected="selected"' : '';
$options[] = "<option value='{$k}' {$selected}>{$v}</option>";
}
$options = join("\n", $options);
return sprintf('<select name="_efs[%s][%s]" size="1">%s</select>', $this->get_group() ? $this->_group->name : '@fixme@', $this->name, $options);
}
示例8: get_editor_actions
/**
* Get edit actions list
* @return mixed
*/
function get_editor_actions()
{
if (!isset($this->editor_actions)) {
$actions_file = "{$this->root_dir}editor/actions.php";
if (file_exists($actions_file)) {
$this->editor_actions = (require $actions_file);
}
if (!empty($this->editor_actions)) {
foreach ($this->editor_actions as $key => &$action) {
if (!isset($this->editor_default_action) && !empty($action['default'])) {
$this->editor_default_action = $key;
}
if (!isset($action['title']) && is_string($key)) {
$action['title'] = i18n::T($this->get_name() . '.' . $key);
}
}
}
}
return $this->editor_actions;
}
示例9: virtual_parent
function virtual_parent($type)
{
if ($type == 'view') {
return $this->get_parent() ? sprintf('<a href="%s" target="_blank">%s</a>', $this->_parent->get_url('self'), $this->_parent->id . '| ' . $this->_parent->title) : i18n::T('deleted');
}
}
示例10: _toggle_flag
function _toggle_flag($flag)
{
$this->collection->toggle_flag($flag, $this->params->id, 'true' == functions::request_var('to', 'false'));
if ($this->in_ajax()) {
$this->_ajax_answer(true, i18n::T('Status changed'));
}
$this->_update_tree($this->params->pid);
}
示例11: action_active
function action_active()
{
if (is_callable(array($this, 'action_active_before'))) {
$this->action_active_before();
}
$this->collection->toggle_active($this->params->id, 'true' == functions::request_var('to', 'false'));
if (is_callable(array($this, 'action_active_after'))) {
$this->action_active_after();
}
if ($this->in_ajax()) {
$this->_ajax_answer(true, i18n::T('Status changed'));
}
}
示例12: error
/**
* @param $msg
* @param int $code
* @return $this
*/
function error($msg, $code = 500)
{
@header(' ', true, $code);
$error = i18n::T('errors.' . $code);
$template = loader::in_ajax() ? 'partials/error' : 'error';
$this->renderer->set_page_title($error)->set_return('error', array('message' => $error, 'code' => $code))->set_return('message', $msg)->set_main_template($template);
$this->renderer->output();
$this->halt();
}
示例13: load_objects
/**
* Load access objects
* @todo customize?
*/
function load_objects()
{
core::dprint('[W:] load auth entries');
$this->_objects = array();
/*
'core' =>
array (size=3)
'config' =>
array (size=3)
'url' => string '?m=core&c=config' (length=16)
'title' => string 'Переменные' (length=20)
'default' => boolean true
'logs' =>
array (size=2)
'url' => string '?m=core&c=logs' (length=14)
'title' => string 'Логи' (length=8)
'mail_tpl' =>
array (size=2)
'url' => string '?m=core&c=mail_tpl' (length=18)
'title' => string 'Шаблоны писем' (length=25)
*/
$actions = array();
$actions['core'] = $this->core->get_editor_actions();
foreach (core::modules() as $module) {
$actions[$module->get_name()] = $module->get_editor_actions();
}
foreach ($actions as $name => $operations) {
$object = array('title' => i18n::T(array($name, '_name')), 'name' => $name, 'items' => array(array('id' => 0, 'title' => '*')));
if (!empty($operations)) {
foreach ($operations as $opID => $op) {
$object['items'][] = array('id' => $opID, 'title' => $op['title']);
}
}
$this->_objects[] = $object;
}
return;
/*
$pr = core::module('sestat')->get_project_handle()->load();
$this->_objects[] = array(
'title' => 'Статистика'
, 'name' => 'mod_sestat'
, 'items' => array(array('id' => 0, 'title' => '*'))
);
$this->_objects[] = array(
'title' => 'Пользователи'
, 'name' => 'mod_users'
, 'items' => array(array('id' => 0, 'title' => '*'))
);
$this->_objects[] = array(
'title' => 'Настройки'
, 'name' => 'mod_core'
, 'items' => array(array('id' => 0, 'title' => '*'))
);
$this->_objects[] = array(
'title' => 'Проекты'
, 'name' => 'projects' // section name
, 'items' => array(array('id' => 0, 'title' => '*'))
);
foreach ($pr as $p) {
$c = count($this->_objects) - 1;
$this->_objects[$c]['items']
[]= array('id' => $p->id, 'title' => $p->title);
}
*/
}