本文整理汇总了PHP中jLocale类的典型用法代码示例。如果您正苦于以下问题:PHP jLocale类的具体用法?PHP jLocale怎么用?PHP jLocale使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了jLocale类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($sel, $locale = null, $charset = null)
{
if ($locale === null) {
$locale = jApp::config()->locale;
}
if ($charset === null) {
$charset = jApp::config()->charset;
}
if (strpos($locale, '_') === false) {
$locale = jLocale::langToLocale($locale);
}
$this->locale = $locale;
$this->charset = $charset;
$this->_suffix = '.' . $charset . '.properties';
$this->_compilerPath = JELIX_LIB_CORE_PATH . 'jLocalesCompiler.class.php';
if (jelix_scan_locale_sel($sel, $this)) {
if ($this->module == '') {
$this->module = jApp::getCurrentModule();
}
$this->_createPath();
$this->_createCachePath();
} else {
throw new jExceptionSelector('jelix~errors.selector.invalid.syntax', array($sel, $this->type));
}
}
示例2: initExpectedValue
function initExpectedValue()
{
$numbers = jLocale::get('jelix~captcha.number');
$id = rand(1, intval($numbers));
$this->question = jLocale::get('jelix~captcha.question.' . $id);
$this->container->privateData[$this->ref] = jLocale::get('jelix~captcha.response.' . $id);
}
示例3: update
/**
*
*/
function update()
{
$id = $this->param('j_user_login');
$pwd = $this->param('pwd');
$pwdconf = $this->param('pwd_confirm');
$rep = $this->getResponse('redirect');
if ($this->personalView && $id != jAuth::getUserSession()->login) {
jMessage::add(jLocale::get('jelix~errors.acl.action.right.needed'), 'error');
$rep->action = 'master_admin~default:index';
return $rep;
}
if (trim($pwd) == '' || $pwd != $pwdconf) {
jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
$rep->action = 'password:index';
$rep->params['j_user_login'] = $id;
return $rep;
}
if (jAuth::changePassword($id, $pwd)) {
jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
if ($this->personalView) {
$rep->action = 'user:index';
} else {
$rep->action = 'default:view';
}
$rep->params['j_user_login'] = $id;
return $rep;
} else {
jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
$rep->action = 'password:index';
$rep->params['j_user_login'] = $id;
}
return $rep;
}
示例4: index
/**
*
*/
function index()
{
$rep = $this->getResponse('html');
$tpl = new jTpl();
$gid = array(0);
$o = new StdClass();
$o->id_aclgrp = '0';
$o->name = jLocale::get('jacl2_admin~acl2.anonymous.group.name');
$o->grouptype = 0;
$groups = array($o);
$grouprights = array(0 => false);
foreach (jAcl2DbUserGroup::getGroupList() as $grp) {
$gid[] = $grp->id_aclgrp;
$groups[] = $grp;
$grouprights[$grp->id_aclgrp] = false;
}
$rights = array();
$p = jAcl2Db::getProfil();
$rs = jDao::get('jelix~jacl2subject', $p)->findAllSubject();
foreach ($rs as $rec) {
$rights[$rec->id_aclsbj] = $grouprights;
}
$rs = jDao::get('jelix~jacl2rights', $p)->getRightsByGroups($gid);
foreach ($rs as $rec) {
$rights[$rec->id_aclsbj][$rec->id_aclgrp] = true;
}
$tpl->assign(compact('groups', 'rights'));
if (jAcl2::check('acl.group.modify')) {
$rep->body->assign('MAIN', $tpl->fetch('groups_right'));
} else {
$rep->body->assign('MAIN', $tpl->fetch('groups_right_view'));
}
return $rep;
}
示例5: index
/**
* Displays a list of project for a given repository.
*
* @param string $repository. Name of the repository.
* @return Html page with a list of projects.
*/
function index()
{
if ($this->param('theme')) {
jApp::config()->theme = $this->param('theme');
}
$rep = $this->getResponse('html');
// Get lizmap services
$services = lizmap::getServices();
// only maps
if ($services->onlyMaps) {
$repository = lizmap::getRepository($services->defaultRepository);
if ($repository && jAcl2::check('lizmap.repositories.view', $repository->getKey())) {
$project = lizmap::getProject($repository->getKey() . '~' . $services->defaultProject);
if ($project) {
// test redirection to an other controller
$items = jEvent::notify('mainviewGetMaps')->getResponse();
foreach ($items as $item) {
if ($item->parentId == $repository->getKey() && $item->id == $services->defaultProject) {
$rep = $this->getResponse('redirectUrl');
$rep->url = $item->url;
return $rep;
}
}
// redirection to default controller
$rep = $this->getResponse('redirect');
$rep->action = 'view~map:index';
return $rep;
}
}
}
// Get repository data
$repository = $this->param('repository');
$repositoryList = array();
if ($repository) {
if (!jAcl2::check('lizmap.repositories.view', $repository)) {
$rep = $this->getResponse('redirect');
$rep->action = 'view~default:index';
jMessage::add(jLocale::get('view~default.repository.access.denied'), 'error');
return $rep;
}
}
$title = jLocale::get("view~default.repository.list.title");
$rep->body->assign('repositoryLabel', $title);
$rep->body->assign('isConnected', jAuth::isConnected());
$rep->body->assign('user', jAuth::getUserSession());
if ($services->allowUserAccountRequests) {
$rep->body->assign('allowUserAccountRequests', True);
}
if ($repository) {
$lrep = lizmap::getRepository($repository);
$title .= ' - ' . $lrep->getData('label');
}
$rep->title = $title;
$rep->body->assignZone('MAIN', 'main_view', array('repository' => $repository));
$rep->addJSCode("\n \$(window).load(function() {\n \$('.liz-project-img').parent().mouseenter(function(){\n var self = \$(this);\n self.find('.liz-project-desc').slideDown();\n self.css('cursor','pointer');\n }).mouseleave(function(){\n var self = \$(this);\n self.find('.liz-project-desc').hide();\n }).click(function(){\n var self = \$(this);\n window.location = self.parent().find('a.liz-project-view').attr('href');\n return false;\n });\n });\n ");
// Js hack to normalize the height of the project thumbnails to avoid line breaks with long project titles
$bp = jApp::config()->urlengine['basePath'];
$rep->addJSLink($bp . 'js/view.js');
return $rep;
}
示例6: onmasteradminGetMenuContent
function onmasteradminGetMenuContent($event)
{
if (jAcl2::check('activeusers.configuration')) {
$item = new masterAdminMenuItem('activeusers', jLocale::get('activeusers_admin~main.masteradmin.menu.item'), jUrl::get('activeusers_admin~default:index'), 120, 'system');
$event->add($item);
}
}
示例7: onmasteradminGetMenuContent
/**
*
*/
function onmasteradminGetMenuContent($event)
{
$plugin = $GLOBALS['gJCoord']->getPlugin('auth', false);
if ($plugin && $plugin->config['driver'] == 'Db' && jAcl2::check('auth.users.list')) {
$event->add(new masterAdminMenuItem('users', jLocale::get('jauthdb_admin~auth.adminmenu.item.list'), jUrl::get('jauthdb_admin~default:index'), 10, 'system'));
}
}
示例8: onhfnuGetMenuContent
/**
* Main Menu of the navbar
* @pararm event $event Object of a listener
*/
function onhfnuGetMenuContent($event)
{
$gJConfig = jApp::config();
$event->add(new hfnuMenuItem('home', jLocale::get('havefnubb~main.home'), jUrl::get('havefnubb~default:index'), 1, 'main'));
$event->add(new hfnuMenuItem('members', jLocale::get('havefnubb~main.member.list'), jUrl::get('havefnubb~members:index'), 2, 'main'));
$event->add(new hfnuMenuItem('search', jLocale::get('havefnubb~main.search'), jUrl::get('hfnusearch~default:index'), 3, 'main'));
if ($gJConfig->havefnubb['rules'] != '') {
$event->add(new hfnuMenuItem('rules', jLocale::get('havefnubb~main.rules'), jUrl::get('havefnubb~default:rules'), 4, 'main'));
}
// dynamic menu
$menus = jClasses::getService('havefnubb~hfnumenusbar')->getMenus();
if (!empty($menus)) {
foreach ($menus as $indx => $menu) {
$event->add(new hfnuMenuItem($menu['itemName'], $menu['name'], $menu['url'], 50 + $menu['order'], 'main'));
}
}
if ($event->getParam('admin') === true) {
$url = '';
try {
// let's try to retrieve the url of the admin, if the admin is in
// the same app
$url = jUrl::get('hfnuadmin~default:index');
} catch (Exception $e) {
if (isset($gJConfig->havefnubb["admin_url"])) {
$url = $gJConfig->havefnubb["admin_url"];
}
}
if ($url) {
$event->add(new hfnuMenuItem('admin', jLocale::get('havefnubb~main.admin.panel'), $url, 100, 'main'));
}
}
}
示例9: update
/**
*
*/
function update()
{
$id = $this->param('id');
$pwd = $this->param('pwd');
$pwdconf = $this->param('pwd_confirm');
$rep = $this->getResponse('redirect');
if (trim($pwd) == '' || $pwd != $pwdconf) {
jMessage::add(jLocale::get('crud.message.bad.password'), 'error');
$rep->action = 'password:index';
$rep->params['id'] = $id;
return $rep;
}
if (jAuth::changePassword($id, $pwd)) {
jMessage::add(jLocale::get('crud.message.change.password.ok', $id), 'notice');
if ($this->personalView) {
$rep->action = 'user:index';
} else {
$rep->action = 'default:view';
}
$rep->params['id'] = $id;
return $rep;
} else {
jMessage::add(jLocale::get('crud.message.change.password.notok'), 'error');
$rep->action = 'password:index';
$rep->params['id'] = $id;
}
return $rep;
}
示例10: index
/**
* Main page
*/
public function index()
{
$submit = $this->param('validate');
if ($submit == jLocale::get('hfnucontact~contact.form.saveBt')) {
$form = jForms::fill('hfnucontact~admincontact');
$rep = $this->getResponse('redirect');
if (!$form->check()) {
$rep->action = 'hfnucontact~admin:index';
return $rep;
}
$HfnucontactConfig = new jIniFileModifier(jApp::configPath('defaultconfig.ini.php'));
$HfnucontactConfig->setValue('email_contact', $this->param('contact'), 'hfnucontact');
$HfnucontactConfig->save();
jMessage::add(jLocale::get('hfnucontact~contact.admin.form.email.saved'), 'ok');
jForms::destroy('hfnucontact~admincontact');
$rep->action = 'hfnucontact~admin:index';
return $rep;
} else {
$form = jForms::create('hfnucontact~admincontact');
}
$form->setData('contact', jApp::config()->hfnucontact['email_contact']);
$rep = $this->getResponse('html');
$tpl = new jTpl();
$tpl->assign('form', $form);
$rep->body->assign('MAIN', $tpl->fetch('hfnucontact~admincontact'));
$rep->body->assign('selectedMenuItem', 'contact');
return $rep;
}
示例11: getDictionary
/**
* Get JSON containing all translation for a given jelix property file.
* @param string $property Name of the property file. Ex: map if searched file is map.UTF-8.properties
* @param string $lang Language. Ex: fr_FR (optional)
* @return binary object The image for this project.
*/
function getDictionary()
{
$rep = $this->getResponse('json');
// Get the property file
$property = $this->param('property');
$lang = $this->param('lang');
if (!$lang) {
$lang = jLocale::getCurrentLang() . '_' . jLocale::getCurrentCountry();
}
$data = array();
$path = jApp::appPath() . 'modules/view/locales/' . $lang . '/' . $property . '.UTF-8.properties';
if (file_exists($path)) {
$lines = file($path);
foreach ($lines as $lineNumber => $lineContent) {
if (!empty($lineContent) and $lineContent != '\\n') {
$exp = explode('=', trim($lineContent));
if (!empty($exp[0])) {
$data[$exp[0]] = jLocale::get('view~dictionnary.' . $exp[0], null, $lang);
}
}
}
}
$rep->data = $data;
return $rep;
}
示例12: _prepareTpl
protected function _prepareTpl()
{
jClasses::inc('masterAdminMenuItem');
$menu = array();
$menu['toplinks'] = new masterAdminMenuItem('toplinks', '', '');
$dashboard = new masterAdminMenuItem('dashboard', jLocale::get('gui.menu.item.dashboard'), jUrl::get('default:index'));
$dashboard->icon = $GLOBALS['gJConfig']->urlengine['jelixWWWPath'] . 'design/images/dashboard.png';
$menu['toplinks']->childItems[] = $dashboard;
$menu['system'] = new masterAdminMenuItem('system', jLocale::get('gui.menu.item.system'), '', 100);
$items = jEvent::notify('masteradminGetMenuContent')->getResponse();
foreach ($items as $item) {
if ($item->parentId) {
if (!isset($menu[$item->parentId])) {
$menu[$item->parentId] = new masterAdminMenuItem($item->parentId, '', '');
}
$menu[$item->parentId]->childItems[] = $item;
} else {
if (isset($menu[$item->id])) {
$menu[$item->id]->copyFrom($item);
} else {
$menu[$item->id] = $item;
}
}
}
usort($menu, "masterAdminItemSort");
foreach ($menu as $topitem) {
usort($topitem->childItems, "masterAdminItemSort");
}
$this->_tpl->assign('menuitems', $menu);
$this->_tpl->assign('selectedMenuItem', $this->param('selectedMenuItem', ''));
}
示例13: in
/**
*
*/
function in()
{
$rep = $this->getResponse('redirectUrl');
$conf = jApp::coord()->getPlugin('auth')->config;
$url_return = '/';
if ($conf['after_login'] == '') {
throw new jException('jcommunity~login.error.no.auth_login');
}
if ($conf['after_logout'] == '') {
throw new jException('jcommunity~login.error.no.auth_logout');
}
$form = jForms::fill('jcommunity~login');
if (!$form) {
$rep->url = jUrl::get($conf['after_logout']);
return $rep;
}
if (!jAuth::login($form->getData('auth_login'), $form->getData('auth_password'), $form->getData('auth_remember_me'))) {
sleep(intval($conf['on_error_sleep']));
$form->setErrorOn('auth_login', jLocale::get('jcommunity~login.error'));
//jMessage::add(jLocale::get('jcommunity~login.error'), 'error');
if ($auth_url_return = $this->param('auth_url_return')) {
$url_return = jUrl::get('login:index', array('auth_url_return' => $auth_url_return));
} else {
$url_return = jUrl::get('login:index');
}
} else {
jForms::destroy('jcommunity~login');
if (!($conf['enable_after_login_override'] && ($url_return = $this->param('auth_url_return')))) {
$url_return = jUrl::get($conf['after_login']);
}
}
$rep->url = $url_return;
return $rep;
}
示例14: beforeAction
/**
* @param array $params plugin parameters for the current action
* @return null or jSelectorAct if action should change
*/
public function beforeAction($params)
{
$langDetected = false;
$lang = '';
if ($this->config['enableUrlDetection']) {
$l = jApp::coord()->request->getParam($this->config['urlParamNameLanguage']);
if ($l !== null) {
$lang = jLocale::getCorrespondingLocale($l);
if ($lang != '') {
$langDetected = true;
}
}
}
if (!$langDetected) {
if (isset($_SESSION['JX_LANG'])) {
$lang = $_SESSION['JX_LANG'];
} else {
if ($this->config['useDefaultLanguageBrowser']) {
$lang = jLocale::getPreferedLocaleFromRequest();
}
}
}
if ($lang != '') {
$_SESSION['JX_LANG'] = $lang;
jApp::config()->locale = $lang;
}
return null;
}
示例15: onmasteradminGetMenuContent
/**
*
*/
function onmasteradminGetMenuContent($event)
{
if (jAcl2::check('auth.users.list')) {
$item = new masterAdminMenuItem('pref', jLocale::get('jpref_admin~admin.item.title'), jUrl::get('jpref_admin~prefs:index'), 50, 'system');
$item->icon = jApp::config()->urlengine['jelixWWWPath'] . 'design/images/cog.png';
$event->add($item);
}
}