當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。