本文整理汇总了PHP中l10n::getISOcodes方法的典型用法代码示例。如果您正苦于以下问题:PHP l10n::getISOcodes方法的具体用法?PHP l10n::getISOcodes怎么用?PHP l10n::getISOcodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类l10n
的用法示例。
在下文中一共展示了l10n::getISOcodes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exception
throw new Exception(__('No such blog.'));
}
$blog_id = $rs->blog_id;
$blog_url = $rs->blog_url;
$blog_status = $rs->blog_status;
$blog_name = $rs->blog_name;
$blog_desc = $rs->blog_desc;
$blog_settings = new dcSettings($core, $blog_id);
} catch (Exception $e) {
$core->error->add($e->getMessage());
}
$action = 'blog.php';
$redir = 'blog.php?id=%s&upd=1';
}
# Language codes
$langs = l10n::getISOcodes(1, 1);
foreach ($langs as $k => $v) {
$lang_avail = $v == 'en' || is_dir(DC_L10N_ROOT . '/' . $v);
$lang_combo[] = new formSelectOption($k, $v, $lang_avail ? 'avail10n' : '');
}
# Status combo
foreach ($core->getAllBlogStatus() as $k => $v) {
$status_combo[$v] = (string) $k;
}
# URL scan modes
$url_scan_combo = array('PATH_INFO' => 'path_info', 'QUERY_STRING' => 'query_string');
# Post URL combo
$post_url_combo = array(__('year/month/day/title') => '{y}/{m}/{d}/{t}', __('year/month/title') => '{y}/{m}/{t}', __('year/title') => '{y}/{t}', __('title') => '{t}');
if (!in_array($blog_settings->post_url_format, $post_url_combo)) {
$post_url_combo[html::escapeHTML($blog_settings->post_url_format)] = html::escapeHTML($blog_settings->post_url_format);
}
示例2: formSelectOption
$categories_combo[] = new formSelectOption(str_repeat(' ', $categories->level - 1) . '• ' . html::escapeHTML($categories->cat_title), $categories->cat_id);
}
} catch (Exception $e) {
}
# Status combo
foreach ($core->blog->getAllPostStatus() as $k => $v) {
$status_combo[$v] = (string) $k;
}
# Formaters combo
foreach ($core->getFormaters() as $v) {
$formaters_combo[$v] = $v;
}
# Languages combo
$rs = $core->blog->getLangs(array('order' => 'asc'));
$all_langs = l10n::getISOcodes(0, 1);
$lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(1, 1));
while ($rs->fetch()) {
if (isset($all_langs[$rs->post_lang])) {
$lang_combo[__('Most used')][$all_langs[$rs->post_lang]] = $rs->post_lang;
unset($lang_combo[__('Available')][$all_langs[$rs->post_lang]]);
} else {
$lang_combo[__('Most used')][$rs->post_lang] = $rs->post_lang;
}
}
unset($all_langs);
unset($rs);
# Get entry informations
if (!empty($_REQUEST['id'])) {
$params['post_id'] = $_REQUEST['id'];
$post = $core->blog->getPosts($params);
if ($post->isEmpty()) {
示例3: findLocales
protected function findLocales()
{
$langs = l10n::getISOcodes(1, 1);
foreach ($langs as $k => $v) {
if ($this->parent_theme) {
$this->po = array_merge($this->po, $this->getFilesInDir($this->parent_theme . '/locales/' . $v, 'po', $v . '/'));
}
$this->po = array_merge($this->po, $this->getFilesInDir($this->user_theme . '/locales/' . $v, 'po', $v . '/'));
}
}
示例4: doChangePostLang
public static function doChangePostLang($core, dcPostsActionsPage $ap, $post)
{
$posts_ids = $ap->getIDs();
if (empty($posts_ids)) {
throw new Exception(__('No entry selected'));
}
if (isset($post['new_lang'])) {
$new_lang = $post['new_lang'];
$cur = $core->con->openCursor($core->prefix . 'post');
$cur->post_lang = $new_lang;
$cur->update('WHERE post_id ' . $core->con->in($posts_ids));
dcPage::addSuccessNotice(sprintf(__('%d entry has been successfully set to language "%s"', '%d entries have been successfully set to language "%s"', count($posts_ids)), count($posts_ids), html::escapeHTML(l10n::getLanguageName($new_lang))));
$ap->redirect(true);
} else {
$ap->beginPage(dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', $ap->getCallerTitle() => $ap->getRedirection(true), __('Change language for this selection') => '')));
# lang list
# Languages combo
$rs = $core->blog->getLangs(array('order' => 'asc'));
$all_langs = l10n::getISOcodes(0, 1);
$lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(1, 1));
while ($rs->fetch()) {
if (isset($all_langs[$rs->post_lang])) {
$lang_combo[__('Most used')][$all_langs[$rs->post_lang]] = $rs->post_lang;
unset($lang_combo[__('Available')][$all_langs[$rs->post_lang]]);
} else {
$lang_combo[__('Most used')][$rs->post_lang] = $rs->post_lang;
}
}
unset($all_langs);
unset($rs);
echo '<form action="' . $ap->getURI() . '" method="post">' . $ap->getCheckboxes() . '<p><label for="new_lang" class="classic">' . __('Entry language:') . '</label> ' . form::combo('new_lang', $lang_combo, '');
echo $core->formNonce() . $ap->getHiddenFields() . form::hidden(array('action'), 'lang') . '<input type="submit" value="' . __('Save') . '" /></p>' . '</form>';
$ap->endPage();
}
}
示例5: langs
public static function langs(&$w)
{
global $core, $_ctx;
if ($w->homeonly && $core->url->type != 'default' && $core->url->type != 'lang') {
return;
}
$rs = $core->blog->getLangs();
if ($rs->count() <= 1) {
return;
}
$langs = l10n::getISOcodes();
$res = '<div class="langs">' . ($w->title ? '<h2>' . html::escapeHTML($w->title) . '</h2>' : '') . '<ul>';
while ($rs->fetch()) {
$l = $_ctx->cur_lang == $rs->post_lang ? '<strong>%s</strong>' : '%s';
$lang_name = isset($langs[$rs->post_lang]) ? $langs[$rs->post_lang] : $rs->post_lang;
$res .= ' <li>' . sprintf($l, '<a href="' . $core->blog->url . $core->url->getBase('lang') . $rs->post_lang . '" ' . 'class="lang-' . $rs->post_lang . '">' . $lang_name . '</a>') . ' </li>';
}
$res .= '</ul></div>';
return $res;
}
示例6: box
/**
Returns a combo containing all available and installed languages for administration pages
@return <b>array</b> the combo box (form::combo -compatible format)
*/
public static function getAdminLangsCombo()
{
$lang_combo = array();
$langs = l10n::getISOcodes(1, 1);
foreach ($langs as $k => $v) {
$lang_avail = $v == 'en' || is_dir(DC_L10N_ROOT . '/' . $v);
$lang_combo[] = new formSelectOption($k, $v, $lang_avail ? 'avail10n' : '');
}
return $lang_combo;
}
示例7: langs
public static function langs($w)
{
global $core, $_ctx;
if ($w->offline) {
return;
}
if ($w->homeonly == 1 && $core->url->type != 'default' && $core->url->type != 'lang' || $w->homeonly == 2 && ($core->url->type == 'default' || $core->url->type == 'lang')) {
return;
}
$rs = $core->blog->getLangs();
if ($rs->count() <= 1) {
return;
}
$langs = l10n::getISOcodes();
$res = ($w->title ? $w->renderTitle(html::escapeHTML($w->title)) : '') . '<ul>';
while ($rs->fetch()) {
$l = $_ctx->cur_lang == $rs->post_lang ? '<strong>%s</strong>' : '%s';
$lang_name = isset($langs[$rs->post_lang]) ? $langs[$rs->post_lang] : $rs->post_lang;
$res .= ' <li>' . sprintf($l, '<a href="' . $core->blog->url . $core->url->getURLFor('lang', $rs->post_lang) . '" ' . 'class="lang-' . $rs->post_lang . '">' . $lang_name . '</a>') . ' </li>';
}
$res .= '</ul>';
return $w->renderDiv($w->content_only, 'langs ' . $w->class, '', $res);
}
示例8: intval
<?php
/**
* @ingroup okt_module_guestbook
* @brief La page de la liste des signatures.
*
*/
# Accès direct interdit
if (!defined('ON_GUESTBOOK_MODULE')) {
die;
}
$aLanguages = l10n::getISOcodes();
$do = !empty($_REQUEST['do']) ? $_REQUEST['do'] : null;
$id = !empty($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
$ids = array();
$multiple = false;
if (!empty($_REQUEST['sigs_ids'])) {
foreach ($_REQUEST['sigs_ids'] as $k => $v) {
$ids[$k] = (int) $v;
}
$multiple = true;
}
# marquer comme étant du SPAM
if ($do == 'spam' && $okt->modules->moduleExists('antispam')) {
if ($multiple) {
$ok = true;
foreach ($ids as $cur_id) {
$ok = $ok && $okt->guestbook->markSigAsSpam($cur_id);
}
if ($ok) {
$okt->page->flashMessages->addSuccess(__('m_guestbook_Signatures_were_updated'));