当前位置: 首页>>代码示例>>PHP>>正文


PHP l10n类代码示例

本文整理汇总了PHP中l10n的典型用法代码示例。如果您正苦于以下问题:PHP l10n类的具体用法?PHP l10n怎么用?PHP l10n使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了l10n类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Fire

 public function Fire()
 {
     if ($this->input->do == 'submit') {
         if (!filter_var($this->input->email, FILTER_VALIDATE_EMAIL)) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('INVALID_EMAIL')));
             return;
         }
         if (strlen($this->input->password) <= 4) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('PASSWORD_TOO_SHORT')));
             return;
         }
         $stmt = Bugdar::$db->Prepare("SELECT COUNT(*) AS count FROM users WHERE email = ?");
         $stmt->Execute(array($this->input->email));
         if ($stmt->FetchObject()->count > 0) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('EMAIL_IN_USE')));
             return;
         }
         $alias = preg_replace('/[^a-zA-Z0-9\\-_,\\. ]/', '', $this->input->alias);
         $salt = phalanx\base\Random(10);
         $user = new User();
         $user->email = $this->input->email;
         $user->alias = preg_replace('/[^a-zA-Z0-9\\-_,\\. ]/', '', $this->input->alias);
         $user->password = sha1($this->input->password);
         $user->usergroup_id = Usergroup::ROLE_REGISTERED;
         $user->Insert();
         $this->user_id = $user->user_id;
         EventPump::Pump()->PostEvent(new StandardSuccessEvent('login', l10n::S('USER_REGISTER_SUCCESS')));
     }
 }
开发者ID:rsesek,项目名称:Bugdar2,代码行数:29,代码来源:user_register.php

示例2: Fire

 public function Fire()
 {
     if ($this->input->do == 'submit') {
         $bug = new Bug($this->input->bug_id);
         try {
             $bug->FetchInto();
         } catch (phalanx\data\ModelException $e) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND')));
             return;
         }
         $body = trim($this->input->body);
         if (empty($body)) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('COMMENT_MISSING_BODY')));
             return;
         }
         $comment = new Comment();
         $comment->bug_id = $bug_id;
         $comment->post_user_id = Bugdar::$auth->current_user();
         $comment->post_date = time();
         $comment->body = $body;
         $comment->Insert();
         $this->comment_id = $comment->comment_id;
         $search = new SearchEngine();
         $search->IndexBug($bug);
         EventPump::Pump()->PostEvent(new StandardSuccessEvent('view_bug/' . $bug_id, l10n::S('USER_REGISTER_SUCCESS')));
     }
 }
开发者ID:rsesek,项目名称:Bugdar2,代码行数:27,代码来源:comment_new.php

示例3: __construct

 /**
  * Constructor.
  *
  */
 public function __construct($okt, $sPostPrefix = 'p_')
 {
     $this->okt = $okt;
     # POST prefix
     $this->sPostPrefix = $sPostPrefix;
     # locales
     l10n::set(OKT_LOCALES_PATH . '/' . $this->okt->user->language . '/definitions.less.editor');
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:12,代码来源:class.oktDefinitionsLessEditor.php

示例4: Fire

 public function Fire()
 {
     $stmt = Bugdar::$db->Prepare("SELECT * FROM " . TABLE_PREFIX . "users WHERE user_id = :id OR alias = :id");
     $stmt->Execute(array('id' => $this->input->_id));
     if (!($this->user = $stmt->FetchObject())) {
         EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('INVALID_USER')));
     }
 }
开发者ID:rsesek,项目名称:Bugdar2,代码行数:8,代码来源:user_view.php

示例5: prepend

 protected function prepend()
 {
     # chargement des principales locales
     l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/main');
     # permissions
     $this->okt->addPerm('rte_tinymce_4_config', __('m_rte_tinymce_4_perm_config'), 'configuration');
     # configuration
     $this->config = $this->okt->newConfig('conf_rte_tinymce_4');
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:9,代码来源:module_handler.php

示例6: _getTemplate

 protected function _getTemplate()
 {
     $d = dirname($this->_file);
     $f = basename($this->_file);
     $lcPath = $d . '/locale/' . $this->_locale . '/' . $f;
     l10n::loadFile($this->_locale, $lcPath);
     $this->_lmsg = l10n::getTemplate($this->_locale, $this->_msg);
     //echo $lcPath.' ';
 }
开发者ID:alexqwert,项目名称:kanon,代码行数:9,代码来源:l10nMessage.php

示例7: __construct

 public function __construct()
 {
     $this->registry = registry::getInstance();
     $this->path = $this->registry["path"];
     $this->html = html::getInstance();
     $this->session = $this->registry["session"];
     $this->cookie = $this->registry["cookie"];
     $this->ajax = new ajax();
     $this->l10n = l10n::getInstance();
 }
开发者ID:ravenlp,项目名称:FlavorPHP,代码行数:10,代码来源:views.class.php

示例8: prepend_admin

 protected function prepend_admin()
 {
     # on détermine si on est actuellement sur ce module
     $this->onThisModule();
     # chargement des locales admin
     l10n::set(__DIR__ . '/locales/' . $this->okt->user->language . '/admin');
     # on ajoutent un item au menu admin
     if (!defined('OKT_DISABLE_MENU')) {
         $this->okt->page->configSubMenu->add(__('m_lbl_fancybox_menu_config'), 'module.php?m=lbl_fancybox&amp;action=config', ON_LBL_FANCYBOX_MODULE && $this->okt->page->action === 'config', 25, $this->okt->checkPerm('fancybox_config'), null);
     }
 }
开发者ID:jewelhuq,项目名称:okatea,代码行数:11,代码来源:module_handler.php

示例9: dc_load_locales

function dc_load_locales()
{
    global $_lang, $core;
    $_lang = $core->auth->getInfo('user_lang');
    $_lang = preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_lang) ? $_lang : 'en';
    if (l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/date') === false && $_lang != 'en') {
        l10n::set(dirname(__FILE__) . '/../../locales/en/date');
    }
    l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/main');
    l10n::set(dirname(__FILE__) . '/../../locales/' . $_lang . '/plugins');
}
开发者ID:HackerMajor,项目名称:root,代码行数:11,代码来源:prepend.php

示例10: detect

 public function detect()
 {
     $langs = $this->options();
     if (isset($_COOKIE['wLang']) && isset($langs[$_COOKIE['wLang']])) {
         return $_COOKIE['wLang'];
     }
     $lang = '';
     if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         $negotiation = new ptlis\ConNeg\Negotiation();
         $lang = $negotiation->languageBest($_SERVER['HTTP_ACCEPT_LANGUAGE'], 'application/json;q=1,application/xml;q=0.7,text/html;q=0.3');
     }
     if (!$lang) {
         return $this->default;
     }
     $l10 = new l10n();
     $map = $l10->catalog($lang);
     if ($map && isset($map['localeFallback'])) {
         return $map['localeFallback'];
     }
     return $this->default;
 }
开发者ID:nilBora,项目名称:konstruktor,代码行数:21,代码来源:Lang.php

示例11: jsToolBar

 protected static function jsToolBar()
 {
     $res = dcPage::cssLoad(dcPage::getPF('dcLegacyEditor/css/jsToolBar/jsToolBar.css')) . dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.js'));
     if (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('enable_wysiwyg')) {
         $res .= dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.wysiwyg.js'));
     }
     $res .= dcPage::jsLoad(dcPage::getPF('dcLegacyEditor/js/jsToolBar/jsToolBar.dotclear.js')) . '<script type="text/javascript">' . "\n" . "//<![CDATA[\n" . "jsToolBar.prototype.dialog_url = 'popup.php'; " . "jsToolBar.prototype.iframe_css = '" . 'body{' . 'font: 12px "DejaVu Sans","Lucida Grande","Lucida Sans Unicode",Arial,sans-serif;' . 'color : #000;' . 'background: #f9f9f9;' . 'margin: 0;' . 'padding : 2px;' . 'border: none;' . (l10n::getTextDirection($GLOBALS['_lang']) == 'rtl' ? 'direction:rtl;' : '') . '}' . 'pre, code, kbd, samp {' . 'font-family:"Courier New",Courier,monospace;' . 'font-size : 1.1em;' . '}' . 'code {' . 'color : #666;' . 'font-weight : bold;' . '}' . 'body > p:first-child {' . 'margin-top: 0;' . '}' . "'; " . "jsToolBar.prototype.base_url = '" . html::escapeJS($GLOBALS['core']->blog->host) . "'; " . "jsToolBar.prototype.switcher_visual_title = '" . html::escapeJS(__('visual')) . "'; " . "jsToolBar.prototype.switcher_source_title = '" . html::escapeJS(__('source')) . "'; " . "jsToolBar.prototype.legend_msg = '" . html::escapeJS(__('You can use the following shortcuts to format your text.')) . "'; " . "jsToolBar.prototype.elements.blocks.options.none = '" . html::escapeJS(__('-- none --')) . "'; " . "jsToolBar.prototype.elements.blocks.options.nonebis = '" . html::escapeJS(__('-- block format --')) . "'; " . "jsToolBar.prototype.elements.blocks.options.p = '" . html::escapeJS(__('Paragraph')) . "'; " . "jsToolBar.prototype.elements.blocks.options.h1 = '" . html::escapeJS(__('Level 1 header')) . "'; " . "jsToolBar.prototype.elements.blocks.options.h2 = '" . html::escapeJS(__('Level 2 header')) . "'; " . "jsToolBar.prototype.elements.blocks.options.h3 = '" . html::escapeJS(__('Level 3 header')) . "'; " . "jsToolBar.prototype.elements.blocks.options.h4 = '" . html::escapeJS(__('Level 4 header')) . "'; " . "jsToolBar.prototype.elements.blocks.options.h5 = '" . html::escapeJS(__('Level 5 header')) . "'; " . "jsToolBar.prototype.elements.blocks.options.h6 = '" . html::escapeJS(__('Level 6 header')) . "'; " . "jsToolBar.prototype.elements.strong.title = '" . html::escapeJS(__('Strong emphasis')) . "'; " . "jsToolBar.prototype.elements.em.title = '" . html::escapeJS(__('Emphasis')) . "'; " . "jsToolBar.prototype.elements.ins.title = '" . html::escapeJS(__('Inserted')) . "'; " . "jsToolBar.prototype.elements.del.title = '" . html::escapeJS(__('Deleted')) . "'; " . "jsToolBar.prototype.elements.quote.title = '" . html::escapeJS(__('Inline quote')) . "'; " . "jsToolBar.prototype.elements.code.title = '" . html::escapeJS(__('Code')) . "'; " . "jsToolBar.prototype.elements.br.title = '" . html::escapeJS(__('Line break')) . "'; " . "jsToolBar.prototype.elements.blockquote.title = '" . html::escapeJS(__('Blockquote')) . "'; " . "jsToolBar.prototype.elements.pre.title = '" . html::escapeJS(__('Preformated text')) . "'; " . "jsToolBar.prototype.elements.ul.title = '" . html::escapeJS(__('Unordered list')) . "'; " . "jsToolBar.prototype.elements.ol.title = '" . html::escapeJS(__('Ordered list')) . "'; " . "jsToolBar.prototype.elements.link.title = '" . html::escapeJS(__('Link')) . "'; " . "jsToolBar.prototype.elements.link.href_prompt = '" . html::escapeJS(__('URL?')) . "'; " . "jsToolBar.prototype.elements.link.hreflang_prompt = '" . html::escapeJS(__('Language?')) . "'; " . "jsToolBar.prototype.elements.img.title = '" . html::escapeJS(__('External image')) . "'; " . "jsToolBar.prototype.elements.img.src_prompt = '" . html::escapeJS(__('URL?')) . "'; " . "jsToolBar.prototype.elements.img_select.title = '" . html::escapeJS(__('Media chooser')) . "'; " . "jsToolBar.prototype.elements.post_link.title = '" . html::escapeJS(__('Link to an entry')) . "'; " . "jsToolBar.prototype.elements.removeFormat = jsToolBar.prototype.elements.removeFormat || {}; " . "jsToolBar.prototype.elements.removeFormat.title = '" . html::escapeJS(__('Remove text formating')) . "'; ";
     if (!$GLOBALS['core']->auth->check('media,media_admin', $GLOBALS['core']->blog->id)) {
         $res .= "jsToolBar.prototype.elements.img_select.disabled = true;\n";
     }
     $res .= "jsToolBar.prototype.toolbar_bottom = " . (isset($GLOBALS['core']->auth) && $GLOBALS['core']->auth->getOption('toolbar_bottom') ? 'true' : 'false') . ";\n";
     $res .= "\n//]]>\n" . "</script>\n";
     return $res;
 }
开发者ID:nikrou,项目名称:dotclear,代码行数:14,代码来源:dc.legacy.editor.behaviors.php

示例12: Fire

 public function Fire()
 {
     $bug = new Bug($this->input->_id);
     try {
         $bug->FetchInto();
     } catch (\phalanx\data\ModelException $e) {
         EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('BUG_ID_NOT_FOUND')));
         return;
     }
     $this->bug = $bug;
     $this->bug_reporter = $bug->FetchReporter();
     $this->attributes = $bug->FetchAttributes();
     $this->comments = $bug->FetchComments();
 }
开发者ID:rsesek,项目名称:Bugdar2,代码行数:14,代码来源:bug_view.php

示例13: Fire

 public function Fire()
 {
     if ($this->input->do == 'fire') {
         $user = new User();
         $user->set_condition('email = :email');
         $user->email = $this->input->email;
         try {
             $user = $user->Fetch();
         } catch (phalanx\data\ModelException $e) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('LOGIN_FAILED')));
             return;
         }
         if ($user->password != md5(sha1($this->input->password) . $user->salt)) {
             EventPump::Pump()->RaiseEvent(new StandardErrorEvent(l10n::S('LOGIN_FAILED')));
             return;
         }
         // We need to set _COOKIE values so that if the last_event requires
         // authentication, we can return the correct state.
         $expires = time() + 60 * 60 * 5;
         $this->_SetCookie('bugdar_user', $user->user_id, $expires);
         $this->_SetCookie('bugdar_pass', $user->authkey, $expires);
         $last_event = NULL;
         if ($this->input->last_event) {
             $last_event = unserialize(base64_decode($this->input->last_event));
             $class = $last_event[0];
             $input = $last_event[1];
             if (!class_exists($class)) {
                 $path = phalanx\base\CamelCaseToUnderscore($class);
                 $path = preg_replace('/_event$/', '', $path);
                 require_once BUGDAR_ROOT . "/events/{$path}.php";
             }
             $last_event = new $class($input);
         }
         $this->successful = TRUE;
         EventPump::Pump()->PostEvent($last_event ?: new StandardSuccessEvent('home', l10n::S('LOGIN_SUCCESSFUL')));
         return;
     }
     // Find the first non-UserLoginEvent that was processed. If the event
     // hasn't been finished, then this event preempted it and we should
     // store its data so that the user can return to what she was doing.
     $events = EventPump::Pump()->GetAllEvents();
     foreach ($events as $event) {
         if (!$event instanceof $this && $event->state() != EventPump::EVENT_FINISHED) {
             $this->last_event = base64_encode(serialize(array(get_class($event), $event->input)));
             break;
         }
     }
 }
开发者ID:rsesek,项目名称:Bugdar2,代码行数:48,代码来源:user_login.php

示例14: __construct

 public function __construct()
 {
     $this->registry = registry::getInstance();
     $this->session = $this->registry["session"];
     $this->cookie = $this->registry["cookie"];
     $this->view = $this->registry["views"];
     $this->themes = $this->registry["themes"];
     $this->path = $this->registry["path"];
     $this->l10n = l10n::getInstance();
     $this->html = html::getInstance();
     $this->ajax = new ajax();
     $this->pagination = pagination::getInstance();
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $this->data = $_POST;
     } else {
         $this->data = NULL;
     }
     $this->isAjax = $this->isAjax();
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:19,代码来源:controller.class.php

示例15: init

 /**
  * Load the translation strings
  *
  * @access public
  * @author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
  * @param  common_ext_Extension $extension
  * @param  string langCode
  * @return mixed
  */
 public static function init(common_ext_Extension $extension, $langCode)
 {
     // if the langCode is empty do nothing
     if (empty($langCode)) {
         throw new Exception("Language is not defined");
     }
     //init the ClearFw l10n tools
     l10n::init();
     $basePath = $extension->getDir();
     if (!empty($_GET['ext']) && is_string($_GET['ext'])) {
         $shownExtension = common_ext_ExtensionsManager::singleton()->getExtensionById($_GET['ext']);
         if (!empty($shownExtension)) {
             try {
                 $basePath = $shownExtension->getDir();
                 $baseUrl = $shownExtension->getConstant('BASE_URL');
             } catch (common_exception_Error $e) {
                 // let the current base path be used...
             }
         }
     }
     l10n::set($basePath . 'locales' . DIRECTORY_SEPARATOR . $langCode . DIRECTORY_SEPARATOR . 'messages');
 }
开发者ID:nagyist,项目名称:tao-core,代码行数:31,代码来源:class.I18n.php


注:本文中的l10n类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。