本文整理汇总了PHP中i18n_get函数的典型用法代码示例。如果您正苦于以下问题:PHP i18n_get函数的具体用法?PHP i18n_get怎么用?PHP i18n_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了i18n_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_filter_user_name
function admin_filter_user_name($id)
{
$u = new User($id);
if ($u->error) {
return i18n_get('Nobody');
}
return $u->name;
}
示例2: admin_user_groups
/**
* User access levels for the admin/conditional_forward dynamic object embed.
*/
function admin_user_groups()
{
$list = User::access_list();
$out = array();
foreach ($list as $access) {
$out[] = (object) array('key' => $access, 'value' => i18n_get(ucfirst($access)));
}
return $out;
}
示例3: test_cascade
function test_cascade()
{
global $i18n;
// Setup fr_ca -> fr fallback
$i18n = new I18n();
$i18n->language = 'fr_ca';
$i18n->hash_order = array('fr_ca', 'fr');
$i18n->lang_hash['fr_ca'] = array('Home' => 'Maison');
$i18n->lang_hash['fr'] = array('Back' => 'Retournez');
$this->assertEquals('Maison', i18n_get('Home'));
$this->assertEquals('Retournez', i18n_get('Back'));
}
示例4: verify
/**
* Verifies it's an Elefant app or theme with the required
* config info.
*/
public static function verify($config)
{
if (!isset($config->name)) {
self::$error = i18n_get('Verification failed: No name specified');
return false;
}
if (!isset($config->type)) {
self::$error = i18n_get('Verification failed: No type specified.');
return false;
}
if (!in_array($config->type, array('theme', 'app'))) {
// No type or invalid type specified
self::$error = i18n_get('Verification failed: Invalid type.');
return false;
}
if (!isset($config->folder)) {
self::$error = i18n_get('Verification failed: No folder specified');
return false;
}
if (!preg_match('/^[a-z0-9_-]+$/i', $config->folder)) {
// No folder or invalid name (e.g., spaces)
self::$error = i18n_get('Verification failed: Invalid folder name.');
return false;
}
if (!isset($config->version)) {
// Version is required
self::$error = i18n_get('Verification failed: No version specified.');
return false;
}
if (!isset($config->repository) && !isset($config->website)) {
// Repository or website required
self::$error = i18n_get('Verification failed: Repository or website required.');
return false;
}
if (isset($config->requires) && !self::verify_requires($config->requires)) {
// Site failed to meet minimum requirements (PHP or Elefant version)
return false;
}
// Check that it's not overwriting an existing app or theme
if ($config->type == 'theme' && file_exists('layouts/' . $config->folder)) {
self::$error = i18n_get('A theme by this name is already installed.');
return false;
} elseif ($config->type == 'app' && file_exists('apps/' . $config->folder)) {
self::$error = i18n_get('An app by this name is already installed.');
return false;
}
return true;
}
示例5: SimpleXMLElement
$imported = 0;
try {
$posts = new SimpleXMLElement(file_get_contents($file));
foreach ($posts->channel->item as $entry) {
$dc = $entry->children('http://purl.org/dc/elements/1.1/');
$content = $entry->children('http://purl.org/rss/1.0/modules/content/');
$post = array('title' => (string) $entry->title, 'author' => (string) $dc->creator, 'ts' => gmdate('Y-m-d H:i:s', strtotime($entry->pubDate)), 'published' => $_POST['published'], 'body' => str_replace("\n", "<br />\n", (string) $content->encoded), 'tags' => '');
$sep = '';
for ($i = 0; $i < count($entry->category); $i++) {
$post['tags'] .= $sep . $entry->category[$i]->attributes()->nicename;
$sep = ', ';
}
$p = new blog\Post($post);
if ($p->put()) {
Versions::add($p);
$imported++;
}
}
echo '<p>' . i18n_getf('Imported %d posts.', $imported) . '</p>';
echo '<p><a href="/blog/admin">' . i18n_get('Continue') . '</a></p>';
} catch (Exception $e) {
echo '<p><strong>' . i18n_get('Error importing file') . ': ' . $e->getMessage() . '</strong></p>';
echo '<p><a href="/blog/admin">' . i18n_get('Back') . '</a></p>';
}
return;
} else {
echo '<p><strong>' . i18n_get('Error uploading file.') . '</strong></p>';
}
}
$o = new StdClass();
echo $tpl->render('blog/import/wordpress', $o);
示例6: isset
<?php
/**
* Forwards a user to the specified URL location.
* Works as a dynamic object to be embedded
* into the WYSIWYG editor.
*/
$url = isset($data['to']) ? $data['to'] : $_GET['to'];
if (User::is_valid() && User::is('admin')) {
printf('<p>%s:</p><p><a href="%s">%s</a></p>', i18n_get('This page forwards visitors to the following link'), $url, $url);
return;
}
$code = isset($data['code']) ? $data['code'] : (isset($_GET['code']) ? $_GET['code'] : 302);
if ($code === 301) {
$this->permenent_redirect($url);
}
$this->redirect($url);
示例7: filemanager_style_list
/**
* Returns a list of display style options for the gallery handler.
*/
function filemanager_style_list()
{
return array(array('key' => 'lightbox', 'value' => i18n_get('Lightbox')), array('key' => 'embedded', 'value' => i18n_get('Embedded')));
}
示例8: Navigation
* apply CSS to with the `breadcrumb` class, for example:
*
* .breadcrumb {
* list-style-type: none;
* margin: 0;
* padding: 0;
* }
*
* .breadcrumb li {
* list-style-type: none;
* margin: 0;
* padding: 0;
* display: inline;
* }
*/
$n = new Navigation();
$path = $n->path($page->id, true);
$home = array('index' => i18n_get('Home'));
$path = $path ? $path : $home;
if (!in_array('index', array_keys($path))) {
$path = array_merge($home, $path);
}
echo "<ul class=\"breadcrumb\">\n";
foreach ($path as $id => $title) {
if ($id != $page->id) {
printf("<li><a href=\"/%s\">%s</a> <span class=\"divider\">/</span></li>\n", $id, $title);
} else {
printf("<li class=\"active\">%s</li>\n", $title);
}
}
echo '</ul>';
示例9: file_get_contents
<?php
/**
* Changes the default layout template.
*/
if (!User::require_admin()) {
$this->redirect('/admin');
}
$confdata = file_get_contents('conf/config.php');
$confdata = str_replace('default_layout = "' . conf('General', 'default_layout') . '"', 'default_layout = "' . $_GET['layout'] . '"', $confdata);
file_put_contents('conf/config.php', $confdata);
$this->add_notification(i18n_get('Default layout updated.'));
$this->redirect('/designer');
示例10: isset
<?php
/**
* Lists all content blocks for editing.
*/
$page->layout = 'admin';
if (!User::require_admin()) {
$this->redirect('/admin');
}
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$blocks = Block::query('id, title, access')->order('id asc')->fetch_orig($limit, $_GET['offset']);
$count = Block::query()->count();
foreach ($blocks as $k => $b) {
$blocks[$k]->locked = $lock->exists('Block', $b->id);
}
$page->title = i18n_get('Blocks');
echo $tpl->render('blocks/admin', array('blocks' => $blocks, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
示例11: array
$lang = $_POST['code'] . '_' . $_POST['locale'];
} else {
$lang = $_POST['code'];
}
global $i18n;
if ($lang !== $_GET['lang']) {
// Language has changed ids
if (isset($i18n->languages[$lang])) {
// Language already exists
$form->failed = array('dupe');
return false;
}
$i18n->languages[$lang] = $i18n->languages[$_GET['lang']];
unset($i18n->languages[$_GET['lang']]);
rename('lang/' . $_GET['lang'] . '.php', 'lang/' . $lang . '.php');
}
$i18n->languages[$lang]['name'] = $_POST['name'];
$i18n->languages[$lang]['code'] = $_POST['code'];
$i18n->languages[$lang]['locale'] = $_POST['locale'];
$i18n->languages[$lang]['charset'] = $_POST['charset'];
$i18n->languages[$lang]['fallback'] = $_POST['fallback'];
$i18n->languages[$lang]['date_format'] = $_POST['date_format'];
$i18n->languages[$lang]['short_format'] = $_POST['short_format'];
$i18n->languages[$lang]['time_format'] = $_POST['time_format'];
uasort($i18n->languages, 'translator_sort_languages');
if (!Ini::write($i18n->languages, 'lang/languages.php')) {
return false;
}
$form->controller->add_notification(i18n_get('Language updated.'));
$form->controller->redirect('/translator/index');
});
示例12: isset
<?php
/**
* Admin page where you can edit posts and create new ones.
*/
$page->layout = 'admin';
if (!User::require_admin()) {
$this->redirect('/admin');
}
require_once 'apps/blog/lib/Filters.php';
$limit = 20;
$_GET['offset'] = isset($_GET['offset']) ? $_GET['offset'] : 0;
$lock = new Lock();
$posts = blog\Post::query('id, title, ts, author, published')->order('ts desc')->fetch_orig($limit, $_GET['offset']);
$count = blog\Post::query()->count();
foreach ($posts as $k => $p) {
$posts[$k]->locked = $lock->exists('Blog', $p->id);
}
$page->title = i18n_get('Blog Posts');
echo $tpl->render('blog/admin', array('posts' => $posts, 'count' => $count, 'offset' => $_GET['offset'], 'more' => $count > $_GET['offset'] + $limit ? true : false, 'prev' => $_GET['offset'] - $limit, 'next' => $_GET['offset'] + $limit));
示例13: i18n_get
<?php
/**
* Displays the latest blog posts as a bulleted list of links.
*/
if (!$this->internal) {
$page->layout = $appconf['Blog']['layout'];
$page->title = i18n_get('Latest Posts');
}
require_once 'apps/blog/lib/Filters.php';
$p = new blog\Post();
if ($data['tag'] !== '') {
$posts = $p->tagged($data['tag']);
} else {
$posts = $p->headlines();
}
$dates = isset($data['dates']) && $data['dates'] === 'yes' ? true : false;
echo $tpl->render('blog/headlines', array('posts' => $posts, 'dates' => $dates));
示例14: header
<?php
if (!User::require_admin()) {
header('Location: /admin');
exit;
}
if (!isset($_GET['table'])) {
header('Location: /dbman/index');
exit;
}
$page->layout = 'admin';
$sql = sprintf('delete from `%s` where %s = ?', $_GET['table'], DBMan::primary_key($_GET['table']));
if (db_execute($sql, $_GET['key'])) {
$this->add_notification(i18n_get('Item deleted.'));
$this->redirect('/dbman/browse?table=' . $_GET['table']);
}
$page->title = i18n_get('An Error Occurred');
printf("<p>%s</p>\n<p><a href='/dbman/browse?table=%s'>« %s</a></p>\n", db_error(), $_GET['table'], i18n_get('Back'));
示例15: explode
* {! admin/util/dates !}
*
* 2. Filter your dates via:
*
* {{ date_value|I18n::date }}
* {{ date_value|I18n::time }}
* {{ date_value|I18n::date_time }}
*
* These will display dates in the following forms:
*
* January 3, 2012
* 5:30PM
* April 16, 2012 - 11:13AM
*/
$abbr_months = explode(' ', i18n_get('Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'));
$full_months = explode(' ', i18n_get('January February March April May June July August September October November December'));
global $i18n;
$page->add_script('/js/jquery.localize.min.js');
$page->add_script('<script>
$(function () {
$.localize_dates = function () {
$.localize.fullMonths = ' . json_encode($full_months) . ';
$.localize.abbrMonths = ' . json_encode($abbr_months) . ';
$(\'time.datetime\').localize(\'' . $i18n->date_format . ' - ' . $i18n->time_format . '\');
$(\'time.shortdatetime\').localize(\'' . $i18n->short_format . ' - ' . $i18n->time_format . '\');
$(\'time.date\').localize(\'' . $i18n->date_format . '\');
$(\'time.shortdate\').localize(\'' . $i18n->short_format . '\');
$(\'time.time\').localize(\'' . $i18n->time_format . '\');
};
$.localize_dates ();
});