本文整理汇总了PHP中language::language_names方法的典型用法代码示例。如果您正苦于以下问题:PHP language::language_names方法的具体用法?PHP language::language_names怎么用?PHP language::language_names使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类language
的用法示例。
在下文中一共展示了language::language_names方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unix_locales
public function unix_locales()
{
global $session;
if (is_callable('shell_exec') && false === stripos(ini_get('disable_functions'), 'shell_exec')) {
$locales = shell_exec('locale -a');
$tmp = explode("\n", $locales);
} else {
// default list of unix locales
$locales = "aa_DJ,aa_ER,aa_ER@saaho,aa_ET,af_ZA,am_ET,an_ES,ar_AE,ar_BH,ar_DZ,ar_EG,ar_IN,ar_IQ,ar_JO,ar_KW,ar_LB,ar_LY,ar_MA,ar_OM,ar_QA,ar_SA,ar_SD,ar_SY,ar_TN,ar_YE,as_IN,ast_ES,az_AZ,be_BY,be_BY@latin,ber_DZ,ber_MA,bg_BG,bn_BD,bn_IN,bo_CN,bo_IN,bokmal,bokm,br_FR,bs_BA,byn_ER,C,ca_AD,ca_ES,ca_FR,ca_IT,catalan,crh_UA,croatian,csb_PL,cs_CZ,cv_RU,cy_GB,czech,da_DK,danish,dansk,de_AT,de_BE,de_CH,de_DE,de_LU,deutsch,dutch,dv_MV,dv_MV.utf8,dz_BT,dz_BT.utf8,eesti,el_CY,el_GR,en_AG,en_AU,en_BW,en_CA,en_DK,en_GB,en_HK,en_IE,en_IN,en_NG,en_NZ,en_PH,en_SG,en_US,en_ZA,en_ZW,es_AR,es_BO,es_CL,es_CO,es_CR,es_DO,es_EC,es_ES,es_GT,es_HN,es_MX,es_NI,es_PA,es_PE,es_PR,es_PY,es_SV,estonian,es_US,es_UY,es_VE,et_EE,eu_ES,fa_IR,fi_FI,fil_PH,finnish,fo_FO,fran栩s,fr_BE,fr_CA,fr_CH,french,fr_FR,fr_LU,fur_IT,fy_DE,fy_NL,ga_IE,galego,galician,gd_GB,german,gez_ER,gez_ET,gl_ES,greek,gu_IN,gv_GB,ha_NG,hebrew,he_IL,hi_IN,hne_IN,hr_HR,hrvatski,hsb_DE,ht_HT,hu_HU,hungarian,hy_AM,icelandic,id_ID,ig_NG,ik_CA,is_IS,italian,it_CH,it_IT,iu_CA,iw_IL,ja_JP,japanese,ka_GE,kk_KZ,kl_GL,km_KH,kn_IN,kok_IN,ko_KR,korean,ks_IN,ku_TR,kw_GB,ky_KG,lg_UG,li_BE,li_NL,lithuanian,lo_LA,lt_LT,lv_LV,mai_IN,mg_MG,mi_NZ,mk_MK,ml_IN,mn_MN,mr_IN,ms_MY,mt_MT,my_MM,nb_NO,nds_DE,nds_NL,ne_NP,nl_AW,nl_BE,nl_NL,nn_NO,no_NO,norwegian,nr_ZA,nso_ZA,nynorsk,oc_FR,om_ET,om_KE,or_IN,pa_IN,pap_AN,pa_PK,pl_PL,polish,portuguese,POSIX,ps_AF,pt_BR,pt_PT,romanian,ro_RO,ru_RU,russian,ru_UA,rw_RW,sa_IN,sc_IT,sd_IN,se_NO,shs_CA,sid_ET,si_LK,sk_SK,slovak,slovene,slovenian,sl_SI,so_DJ,so_ET,so_KE,so_SO,spanish,sq_AL,sq_MK,sr_ME,sr_RS,ss_ZA,st_ZA,sv_FI,sv_SE,swedish,ta_IN,te_IN,tg_TJ,thai,th_TH,ti_ER,ti_ET,tig_ER,tk_TM,tl_PH,tn_ZA,tr_CY,tr_TR,ts_ZA,tt_RU,turkish,ug_CN,uk_UA,ur_PK,uz_UZ,ve_ZA,vi_VN,wa_BE,wo_SN,xh_ZA,yi_US,yo_NG,zh_CN,zh_HK,zh_SG,zh_TW,zu_ZA";
$tmp = explode(",", $locales);
}
$locales = array();
$languages = language::language_names(false);
$countries = property::countries($session['lang'], true);
$tmp = array_filter($tmp);
foreach ($tmp as $loc) {
if (in_array($loc, array('C', 'POSIX'))) {
continue;
}
if (strpos($loc, '.') === false) {
if (in_array($loc . '.utf8', $tmp)) {
continue;
}
} else {
// there is a dot in the locale name
$check = substr($loc, 0, strpos($loc, '.')) . '.utf8';
if (in_array($check, $tmp) && $check != $loc) {
continue;
}
}
$language = @$languages[substr($loc, 0, 2)];
if (empty($language)) {
$language = '?';
}
$country = @$countries[substr($loc, 3, 2)];
if (!empty($country)) {
$country = ' (' . $country . ')';
}
$locales[$loc] = $language . $country . ' [' . $loc . ']';
}
return $locales;
}
示例2: run
function run()
{
global $user;
global $layout;
global $DB;
$out = '';
$item = new user();
switch ($_REQUEST['act']) {
case 1:
// json data retrieval & operations
switch ($_REQUEST['oper']) {
case 'del':
// remove rows
$ids = $_REQUEST['ids'];
$deleted = 0;
foreach ($ids as $id) {
$item = new user();
$item->load($id);
$deleted = $deleted + $item->delete();
}
echo json_encode(count($ids) == $deleted);
break;
default:
// list or search
$page = intval($_REQUEST['page']);
$max = intval($_REQUEST['rows']);
$offset = ($page - 1) * $max;
$orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
$where = " 1=1 ";
if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
if (isset($_REQUEST['quicksearch'])) {
$where .= $item->quicksearch($_REQUEST['quicksearch']);
} else {
if (isset($_REQUEST['filters'])) {
$where .= navitable::jqgridsearch($_REQUEST['filters']);
} else {
// single search
$where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
}
}
}
$DB->queryLimit('id,username,email,profile,language,blocked', 'nv_users', $where, $orderby, $offset, $max);
$dataset = $DB->result();
$total = $DB->foundRows();
//echo $DB->get_last_error();
$out = array();
$profiles = profile::profile_names();
$languages = language::language_names();
for ($i = 0; $i < count($dataset); $i++) {
$out[$i] = array(0 => $dataset[$i]['id'], 1 => '<strong>' . $dataset[$i]['username'] . '</strong>', 2 => $dataset[$i]['email'], 3 => $profiles[$dataset[$i]['profile']], 4 => $languages[$dataset[$i]['language']], 5 => $dataset[$i]['blocked'] == 1 ? '<img src="img/icons/silk/cancel.png" />' : '');
}
navitable::jqgridJson($out, $page, $offset, $max, $total);
break;
}
session_write_close();
exit;
break;
case 2:
// edit/new form
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
}
if (isset($_REQUEST['form-sent'])) {
$item->load_from_post();
try {
$item->save();
permission::update_permissions(json_decode($_REQUEST['navigate_permissions_changes'], true), 0, $item->id);
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
} catch (Exception $e) {
$layout->navigate_notification($e->getMessage(), true, true);
}
}
$out = users_form($item);
break;
case 4:
// remove
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
if ($item->delete() > 0) {
$layout->navigate_notification(t(55, 'Item removed successfully.'), false);
$out = users_list();
} else {
$layout->navigate_notification(t(56, 'Unexpected error.'), false);
$out = users_form($item);
}
}
break;
case 0:
// list / search result
// list / search result
default:
$out = users_list();
break;
}
return $out;
}
示例3: webusers_form
//.........这里部分代码省略.........
if (!empty($item->joindate)) {
$navibars->add_tab_content_row(array('<label>' . t(247, 'Date joined') . '</label>', core_ts2date($item->joindate, true)));
}
if (!empty($item->lastseen)) {
$navibars->add_tab_content_row(array('<label>' . t(563, 'Last seen') . '</label>', core_ts2date($item->lastseen, true)));
}
$navibars->add_tab_content_row(array('<label>' . t(249, 'Newsletter') . '</label>', $naviforms->checkbox('webuser-newsletter', $item->newsletter)));
$webuser_access = array('0' => t(321, "Allowed"), '1' => t(47, "Blocked"), '2' => t(622, "Date range"));
$navibars->add_tab_content_row(array('<label>' . t(364, 'Access') . '</label>', $naviforms->selectfield('webuser-access', array_keys($webuser_access), array_values($webuser_access), $item->access, 'navigate_webusers_change_access();')));
if (empty($item->access_begin)) {
$item->access_begin = '';
}
$navibars->add_tab_content_row(array('<label> <img src="img/icons/silk/date_go.png" /> ' . t(623, 'Begin') . '</label>', $naviforms->datefield('webuser-access-begin', $item->access_begin, true, ' width:200px; ')));
if (empty($item->access_end)) {
$item->access_end = '';
}
$navibars->add_tab_content_row(array('<label> <img src="img/icons/silk/date_delete.png" /> ' . t(624, 'End') . '</label>', $naviforms->datefield('webuser-access-end', $item->access_end, true, ' width:200px; ')));
$layout->add_script('
function navigate_webusers_change_access()
{
$("#webuser-access-begin").parent().hide();
$("#webuser-access-end").parent().hide();
if($("#webuser-access").val() == "2")
{
$("#webuser-access-begin").parent().show();
$("#webuser-access-end").parent().show();
}
}
navigate_webusers_change_access();
');
// private_comment is deprecated in NV 2.0
if (!empty($item->private_comment)) {
$navibars->add_tab_content_row(array('<label>' . t(538, 'Private comment') . '</label>', $naviforms->textarea('webuser-private_comment', $item->private_comment)));
}
$navibars->add_tab(t(506, "Groups"));
$webuser_groups = webuser_group::all_in_array();
$navibars->add_tab_content_row(array('<label>' . t(506, "Groups") . '</label>', $naviforms->multiselect('webuser-groups', array_keys($webuser_groups), array_values($webuser_groups), $item->groups)));
$navibars->add_tab(t(308, "Personal"));
$navibars->add_tab_content_row(array('<label>' . t(159, 'Name') . '</label>', $naviforms->textfield('webuser-fullname', $item->fullname)));
$navibars->add_tab_content_row(array('<label>' . t(160, 'Type') . ' / ' . t(304, 'Gender') . '</label>', $naviforms->buttonset('webuser-gender', array('male' => '<img src="img/icons/silk/male.png" align="absbottom" /> ' . t(305, 'Male'), 'female' => '<img src="img/icons/silk/female.png" align="absbottom" /> ' . t(306, 'Female'), 'company' => '<img src="img/icons/silk/building.png" align="absbottom" /> ' . t(592, 'Company'), '' => '<img src="img/icons/silk/help.png" align="absbottom" /> ' . t(307, 'Unspecified')), $item->gender)));
$navibars->add_tab_content_row(array('<label>' . t(248, 'Birthdate') . '</label>', $naviforms->datefield('webuser-birthdate', $item->birthdate, false)));
$countries = property::countries();
$country_names = array_values($countries);
$country_codes = array_keys($countries);
// include "country not defined" item
array_unshift($country_codes, '');
array_unshift($country_names, '(' . t(307, "Unspecified") . ')');
$navibars->add_tab_content_row(array('<label>' . t(224, 'Country') . '</label>', $naviforms->selectfield("webuser-country", $country_codes, $country_names, strtoupper($item->country))));
$timezones = property::timezones();
if (empty($item->timezone)) {
$item->timezone = date_default_timezone_get();
}
$navibars->add_tab_content_row(array('<label>' . t(97, 'Timezone') . '</label>', $naviforms->selectfield("webuser-timezone", array_keys($timezones), array_values($timezones), $item->timezone)));
$layout->add_script('
var webuser_country = "' . $item->country . '";
$("#webuser-country").bind("change blur", function()
{
if($(this).val() != webuser_country)
{
webuser_country = $(this).val();
$.getJSON("?fid=' . $_REQUEST['fid'] . '", { country: $(this).val(), act: 90 }, function(data)
{
$("#webuser-timezone").find("option").remove();
$.each(data, function(value, text)
{
$("<option />", {
value: value,
html: text
}).appendTo("#webuser-timezone");
});
});
}
});
');
// Language selector
$data = language::language_names(false);
$select = $naviforms->selectfield('webuser-language', array_keys($data), array_values($data), $item->language);
$navibars->add_tab_content_row(array('<label>' . t(46, 'Language') . '</label>', $select));
$navibars->add_tab(t(233, "Address"));
$navibars->add_tab_content_row(array('<label>' . t(233, 'Address') . '</label>', $naviforms->textfield('webuser-address', $item->address)));
$navibars->add_tab_content_row(array('<label>' . t(319, 'Location') . '</label>', $naviforms->textfield('webuser-location', $item->location)));
$navibars->add_tab_content_row(array('<label>' . t(318, 'Zip code') . '</label>', $naviforms->textfield('webuser-zipcode', $item->zipcode)));
$navibars->add_tab_content_row(array('<label>' . t(320, 'Phone') . '</label>', $naviforms->textfield('webuser-phone', $item->phone)));
$navibars->add_tab(t(309, "Social"));
$navibars->add_tab_content_row(array('<label>' . t(177, 'Website') . '</label>', $naviforms->textfield('webuser-social_website', $item->social_website)));
if (!empty($theme->webusers['properties'])) {
$properties_html = navigate_property_layout_form('webuser', $theme->name, 'webuser', $item->id);
if (!empty($properties_html)) {
$navibars->add_tab(t(77, "Properties"));
$navibars->add_tab_content($properties_html);
}
}
if (!empty($item->id)) {
$layout->navigate_notes_dialog('webuser', $item->id);
}
$events->trigger('webuser', 'edit', array('webuser' => &$item, 'navibars' => &$navibars, 'naviforms' => &$naviforms));
return $navibars->generate();
}
示例4: name_by_code
/**
* Return the local name for a language via its 2-letters code.
*
* @param string $code Language code (2 letters)
* @return $language_name The name of the lanaguage.
*/
public static function name_by_code($code)
{
global $world_languages;
if (empty($world_languages)) {
$world_languages = language::language_names(false);
}
if (strpos($code, '_') > 0) {
$code = explode('_', $code);
$name = $world_languages[$code[0]];
$name .= ' (' . $code[1] . ')';
} else {
$name = $world_languages[$code];
}
return $name;
}