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


PHP Context::geti18n方法代码示例

本文整理汇总了PHP中thebuggenie\core\framework\Context::geti18n方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::geti18n方法的具体用法?PHP Context::geti18n怎么用?PHP Context::geti18n使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thebuggenie\core\framework\Context的用法示例。


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

示例1: getConfigSections

 /**
  * Return associated configuration sections
  *
  * @param I18n $i18n The translation object
  *
  * @return array
  */
 public static function getConfigSections($i18n)
 {
     $config_sections = array('general' => array(), self::CONFIGURATION_SECTION_MODULES => array());
     if (Context::getScope()->getID() == 1) {
         $config_sections['general'][self::CONFIGURATION_SECTION_SCOPES] = array('route' => 'configure_scopes', 'description' => $i18n->__('Scopes'), 'icon' => 'scopes', 'details' => $i18n->__('Scopes are self-contained Bug Genie environments. Configure them here.'));
     }
     $config_sections['general'][self::CONFIGURATION_SECTION_SETTINGS] = array('route' => 'configure_settings', 'description' => $i18n->__('Settings'), 'icon' => 'general_small', 'details' => $i18n->__('Every setting in the bug genie can be adjusted in this section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_THEMES] = array('route' => 'configuration_themes', 'description' => $i18n->__('Theme'), 'icon' => 'themes', 'details' => $i18n->__('Configure the selected theme from this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ROLES] = array('route' => 'configure_roles', 'description' => $i18n->__('Roles'), 'icon' => 'roles', 'details' => $i18n->__('Configure roles in this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_AUTHENTICATION] = array('route' => 'configure_authentication', 'description' => $i18n->__('Authentication'), 'icon' => 'authentication', 'details' => $i18n->__('Configure the authentication method in this section'));
     if (Context::getScope()->isUploadsEnabled()) {
         $config_sections['general'][self::CONFIGURATION_SECTION_UPLOADS] = array('route' => 'configure_files', 'description' => $i18n->__('Uploads and attachments'), 'icon' => 'files', 'details' => $i18n->__('All settings related to file uploads are controlled from this section.'));
     }
     $config_sections['general'][self::CONFIGURATION_SECTION_IMPORT] = array('route' => 'import_home', 'description' => $i18n->__('Import data'), 'icon' => 'import_small', 'details' => $i18n->__('Import data from CSV files and other sources.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_PROJECTS] = array('route' => 'configure_projects', 'description' => $i18n->__('Projects'), 'icon' => 'projects', 'details' => $i18n->__('Set up all projects in this configuration section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ISSUETYPES] = array('route' => 'configure_issuetypes', 'icon' => 'issuetypes', 'description' => $i18n->__('Issue types'), 'details' => $i18n->__('Manage issue types and configure issue fields for each issue type here'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ISSUEFIELDS] = array('route' => 'configure_issuefields', 'icon' => 'resolutiontypes', 'description' => $i18n->__('Issue fields'), 'details' => $i18n->__('Status types, resolution types, categories, custom fields, etc. are configurable from this section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_WORKFLOW] = array('route' => 'configure_workflow', 'icon' => 'workflow', 'description' => $i18n->__('Workflow'), 'details' => $i18n->__('Set up and edit workflow configuration from this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_USERS] = array('route' => 'configure_users', 'description' => $i18n->__('Users, teams and clients'), 'icon' => 'users', 'details' => $i18n->__('Manage users, user teams and clients from this section.'));
     $config_sections['general'][self::CONFIGURATION_SECTION_MODULES] = array('route' => 'configure_modules', 'description' => $i18n->__('Manage modules'), 'icon' => 'modules', 'details' => $i18n->__('Manage Bug Genie extensions from this section. New modules are installed from here.'), 'module' => 'core');
     foreach (Context::getModules() as $module) {
         if ($module->hasConfigSettings() && $module->isEnabled()) {
             $config_sections[self::CONFIGURATION_SECTION_MODULES][] = array('route' => array('configure_module', array('config_module' => $module->getName())), 'description' => Context::geti18n()->__($module->getConfigTitle()), 'icon' => $module->getName(), 'details' => Context::geti18n()->__($module->getConfigDescription()), 'module' => $module->getName());
         }
     }
     return $config_sections;
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:34,代码来源:Settings.php

示例2: runProjectWorkflowTable

 public function runProjectWorkflowTable(framework\Request $request)
 {
     $this->selected_project = entities\Project::getB2DBTable()->selectById($request['project_id']);
     if ($request->isPost()) {
         try {
             $workflow_scheme = entities\WorkflowScheme::getB2DBTable()->selectById($request['new_workflow']);
             return $this->renderJSON(array('content' => $this->getComponentHTML('projectworkflow_table', array('project' => $this->selected_project, 'new_workflow' => $workflow_scheme))));
         } catch (\Exception $e) {
             $this->getResponse()->setHTTPStatus(400);
             return $this->renderJSON(array('error' => framework\Context::geti18n()->__('This workflow scheme is not valid')));
         }
     }
 }
开发者ID:JonathanRH,项目名称:thebuggenie,代码行数:13,代码来源:Main.php

示例3: doAutoLogin

 public function doAutoLogin()
 {
     if ($this->getSetting('integrated_auth')) {
         if (isset($_SERVER[$this->getSetting('integrated_auth_header')])) {
             return $this->doLogin($_SERVER[$this->getSetting('integrated_auth_header')], 'a', 1);
         } else {
             throw new \Exception(framework\Context::geti18n()->__('HTTP integrated authentication is enabled but the HTTP header has not been provided by the web server.'));
         }
     } else {
         return true;
     }
 }
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:12,代码来源:Auth_ldap.php

示例4: componentLogin

 public function componentLogin()
 {
     $this->selected_tab = isset($this->section) ? $this->section : 'login';
     $this->options = $this->getParameterHolder();
     if (framework\Context::hasMessage('login_referer')) {
         $this->referer = htmlentities(framework\Context::getMessage('login_referer'), ENT_COMPAT, framework\Context::getI18n()->getCharset());
     } elseif (array_key_exists('HTTP_REFERER', $_SERVER)) {
         $this->referer = htmlentities($_SERVER['HTTP_REFERER'], ENT_COMPAT, framework\Context::getI18n()->getCharset());
     } else {
         $this->referer = framework\Context::getRouting()->generate('dashboard');
     }
     try {
         $this->loginintro = null;
         $this->registrationintro = null;
         $this->loginintro = \thebuggenie\modules\publish\entities\tables\Articles::getTable()->getArticleByName('LoginIntro');
         $this->registrationintro = \thebuggenie\modules\publish\entities\tables\Articles::getTable()->getArticleByName('RegistrationIntro');
     } catch (\Exception $e) {
     }
     if (framework\Settings::isLoginRequired()) {
         framework\Context::getResponse()->deleteCookie('tbg3_username');
         framework\Context::getResponse()->deleteCookie('tbg3_password');
         $this->error = framework\Context::geti18n()->__('You need to log in to access this site');
     } elseif (!framework\Context::getUser()->isAuthenticated()) {
         $this->error = framework\Context::geti18n()->__('Please log in');
     } else {
         //$this->error = framework\Context::geti18n()->__('Please log in');
     }
 }
开发者ID:founderio,项目名称:thebuggenie,代码行数:28,代码来源:Components.php

示例5: getAccountSettingsName

 public function getAccountSettingsName()
 {
     return framework\Context::geti18n()->__($this->_account_settings_name);
 }
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:4,代码来源:Module.php

示例6: runImportUsers

 /**
  * Import all valid users
  *
  * @param \thebuggenie\core\framework\Request $request
  */
 public function runImportUsers(framework\Request $request)
 {
     $validgroups = framework\Context::getModule('auth_ldap')->getSetting('groups');
     $base_dn = framework\Context::getModule('auth_ldap')->getSetting('b_dn');
     $dn_attr = framework\Context::getModule('auth_ldap')->getSetting('dn_attr');
     $username_attr = framework\Context::getModule('auth_ldap')->getSetting('u_attr');
     $fullname_attr = framework\Context::getModule('auth_ldap')->getSetting('f_attr');
     $buddyname_attr = framework\Context::getModule('auth_ldap')->getSetting('b_attr');
     $email_attr = framework\Context::getModule('auth_ldap')->getSetting('e_attr');
     $groups_members_attr = framework\Context::getModule('auth_ldap')->getSetting('g_attr');
     $user_class = framework\Context::getModule('auth_ldap')->getSetting('u_type');
     $group_class = framework\Context::getModule('auth_ldap')->getSetting('g_type');
     $users = array();
     $importcount = 0;
     $updatecount = 0;
     try {
         /*
          * Connect and bind to the control user
          */
         $connection = framework\Context::getModule('auth_ldap')->connect();
         framework\Context::getModule('auth_ldap')->bind($connection, framework\Context::getModule('auth_ldap')->getSetting('control_user'), framework\Context::getModule('auth_ldap')->getSetting('control_pass'));
         /*
          * Get a list of all users of a certain objectClass
          */
         $fields = array($fullname_attr, $buddyname_attr, $username_attr, $email_attr, 'cn', $dn_attr);
         $filter = '(objectClass=' . framework\Context::getModule('auth_ldap')->escape($user_class) . ')';
         $results = ldap_search($connection, $base_dn, $filter, $fields);
         if (!$results) {
             framework\Logging::log('failed to search for users: ' . ldap_error($connection), 'ldap', framework\Logging::LEVEL_FATAL);
             throw new \Exception(framework\Context::geti18n()->__('Search failed: ') . ldap_error($connection));
         }
         $data = ldap_get_entries($connection, $results);
         /*
          * For every user that exists, process it.
          */
         for ($i = 0; $i != $data['count']; $i++) {
             $user_dn = $data[$i][strtolower($dn_attr)][0];
             /*
              * If groups are specified, perform group restriction tests
              */
             if ($validgroups != '') {
                 /*
                  * We will repeat this for every group, but groups are supplied as a comma-separated list
                  */
                 if (strstr($validgroups, ',')) {
                     $groups = explode(',', $validgroups);
                 } else {
                     $groups = array();
                     $groups[] = $validgroups;
                 }
                 // Assumed we are initially banned
                 $allowed = false;
                 foreach ($groups as $group) {
                     // No need to carry on looking if we have access
                     if ($allowed == true) {
                         continue;
                     }
                     /*
                      * Find the group we are looking for, we search the entire directory
                      * We want to find 1 group, if we don't get 1, silently ignore this group.
                      */
                     $fields2 = array($groups_members_attr);
                     $filter2 = '(&(cn=' . framework\Context::getModule('auth_ldap')->escape($group) . ')(objectClass=' . framework\Context::getModule('auth_ldap')->escape($group_class) . '))';
                     $results2 = ldap_search($connection, $base_dn, $filter2, $fields2);
                     if (!$results2) {
                         framework\Logging::log('failed to search for user: ' . ldap_error($connection), 'ldap', framework\Logging::LEVEL_FATAL);
                         throw new \Exception(framework\Context::geti18n()->__('Search failed: ') . ldap_error($connection));
                     }
                     $data2 = ldap_get_entries($connection, $results2);
                     if ($data2['count'] != 1) {
                         continue;
                     }
                     /*
                      * Look through the group's member list. If we are found, grant access.
                      */
                     foreach ($data2[0][strtolower($groups_members_attr)] as $member) {
                         $member = preg_replace('/(?<=,) +(?=[a-zA-Z])/', '', $member);
                         $user_dn = preg_replace('/(?<=,) +(?=[a-zA-Z])/', '', $user_dn);
                         if (!is_numeric($member) && strtolower($member) == strtolower($user_dn)) {
                             $allowed = true;
                         }
                     }
                 }
                 if ($allowed == false) {
                     continue;
                 }
             }
             $users[$i] = array();
             /*
              * Set user's properties.
              * Realname is obtained from directory, if not found we set it to the username
              * Email is obtained from directory, if not found we set it to blank
              */
             if (!array_key_exists(strtolower($fullname_attr), $data[$i])) {
                 $users[$i]['realname'] = $data[$i]['cn'][0];
//.........这里部分代码省略.........
开发者ID:RTechSoft,项目名称:thebuggenie,代码行数:101,代码来源:Actions.php


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