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


PHP TBGContext::geti18n方法代码示例

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


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

示例1: getConfigSections

 public static function getConfigSections($i18n)
 {
     $config_sections = array('general' => array(), self::CONFIGURATION_SECTION_MODULES => array());
     if (TBGContext::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_PERMISSIONS] = array('route' => 'configure_permissions', 'description' => $i18n->__('Permissions'), 'icon' => 'permissions', 'details' => $i18n->__('Configure permissions in this section'));
     $config_sections['general'][self::CONFIGURATION_SECTION_ROLES] = array('route' => 'configure_roles', 'description' => $i18n->__('Roles'), 'icon' => 'roles', 'details' => $i18n->__('Configure roles (permission templates) 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 (TBGContext::getScope()->isUploadsEnabled()) {
         $config_sections['general'][self::CONFIGURATION_SECTION_UPLOADS] = array('route' => 'configure_files', 'description' => $i18n->__('Uploads & 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' => 'configure_import', '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 & clients'), 'icon' => 'users', 'details' => $i18n->__('Manage users, user teams and clients from this section.'));
     $config_sections[self::CONFIGURATION_SECTION_MODULES][] = array('route' => 'configure_modules', 'description' => $i18n->__('Module settings'), 'icon' => 'modules', 'details' => $i18n->__('Manage Bug Genie extensions from this section. New modules are installed from here.'), 'module' => 'core');
     foreach (TBGContext::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' => TBGContext::geti18n()->__($module->getConfigTitle()), 'icon' => $module->getName(), 'details' => TBGContext::geti18n()->__($module->getConfigDescription()), 'module' => $module->getName());
         }
     }
     return $config_sections;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:27,代码来源:TBGSettings.class.php

示例2: runImportUsers

 /**
  * Import all valid users
  * 
  * @param TBGRequest $request
  */
 public function runImportUsers(TBGRequest $request)
 {
     $validgroups = TBGContext::getModule('auth_ldap')->getSetting('groups');
     $base_dn = TBGContext::getModule('auth_ldap')->getSetting('b_dn');
     $dn_attr = TBGContext::getModule('auth_ldap')->getSetting('dn_attr');
     $username_attr = TBGContext::getModule('auth_ldap')->getSetting('u_attr');
     $fullname_attr = TBGContext::getModule('auth_ldap')->getSetting('f_attr');
     $buddyname_attr = TBGContext::getModule('auth_ldap')->getSetting('b_attr');
     $email_attr = TBGContext::getModule('auth_ldap')->getSetting('e_attr');
     $groups_members_attr = TBGContext::getModule('auth_ldap')->getSetting('g_attr');
     $user_class = TBGContext::getModule('auth_ldap')->getSetting('u_type');
     $group_class = TBGContext::getModule('auth_ldap')->getSetting('g_type');
     $users = array();
     $importcount = 0;
     $updatecount = 0;
     try {
         /*
          * Connect and bind to the control user
          */
         $connection = TBGContext::getModule('auth_ldap')->connect();
         TBGContext::getModule('auth_ldap')->bind($connection, TBGContext::getModule('auth_ldap')->getSetting('control_user'), TBGContext::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=' . TBGLDAPAuthentication::getModule()->escape($user_class) . ')';
         $results = ldap_search($connection, $base_dn, $filter, $fields);
         if (!$results) {
             TBGLogging::log('failed to search for users: ' . ldap_error($connection), 'ldap', TBGLogging::LEVEL_FATAL);
             throw new Exception(TBGContext::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=' . TBGLDAPAuthentication::getModule()->escape($group) . ')(objectClass=' . TBGLDAPAuthentication::getModule()->escape($group_class) . '))';
                     $results2 = ldap_search($connection, $base_dn, $filter2, $fields2);
                     if (!$results2) {
                         TBGLogging::log('failed to search for user: ' . ldap_error($connection), 'ldap', TBGLogging::LEVEL_FATAL);
                         throw new Exception(TBGContext::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:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:actions.class.php

示例3: runProjectWorkflowTable

 public function runProjectWorkflowTable(TBGRequest $request)
 {
     $this->selected_project = TBGContext::factory()->TBGProject($request['project_id']);
     if ($request->isPost()) {
         try {
             $workflow_scheme = TBGContext::factory()->TBGWorkflowScheme($request['new_workflow']);
             return $this->renderJSON(array('content' => $this->getTemplateHtml('projectworkflow_table', array('project' => $this->selected_project, 'new_workflow' => $workflow_scheme))));
         } catch (Exception $e) {
             $this->getResponse()->setHTTPStatus(400);
             return $this->renderJSON(array('error' => TBGContext::geti18n()->__('This workflow scheme is not valid')));
         }
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:13,代码来源:actions.class.php

示例4: componentLogin

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

示例5: go

 /**
  * Launches the MVC framework
  */
 public static function go()
 {
     TBGLogging::log('Dispatching');
     try {
         if (($route = self::getRouting()->getRouteFromUrl(self::getRequest()->getParameter('url', null, false))) || self::isInstallmode()) {
             if (self::isUpgrademode()) {
                 $route = array('module' => 'installation', 'action' => 'upgrade');
             } elseif (self::isInstallmode()) {
                 $route = array('module' => 'installation', 'action' => 'installIntro');
             }
             if (is_dir(THEBUGGENIE_MODULES_PATH . $route['module'])) {
                 if (!file_exists(THEBUGGENIE_MODULES_PATH . $route['module'] . DS . 'classes' . DS . 'actions.class.php')) {
                     throw new TBGActionNotFoundException('The ' . $route['module'] . ' module is missing the classes/actions.class.php file, containing all the module actions');
                 }
                 if (!class_exists($route['module'] . 'Actions') && !class_exists($route['module'] . 'ActionComponents')) {
                     self::addAutoloaderClassPath(THEBUGGENIE_MODULES_PATH . $route['module'] . DS . 'classes' . DS);
                 }
             } else {
                 throw new Exception('Cannot load the ' . $route['module'] . ' module');
             }
             // Set up the action object
             // Construct the action class and method name, including any pre- action(s)
             $actionClassName = $route['module'] . 'Actions';
             $actionObject = new $actionClassName();
             $moduleName = $route['module'];
             $moduleMethod = $route['action'];
         } else {
             //					self::setupI18n();
             require THEBUGGENIE_MODULES_PATH . 'main' . DS . 'classes' . DS . 'actions.class.php';
             $actionObject = new mainActions();
             $moduleName = 'main';
             $moduleMethod = 'notFound';
             //					self::performAction($actionObject, 'main', 'notFound');
             //					if (self::isDebugMode()) self::generateDebugInfo();
         }
         self::$_action = $actionObject;
         if (!self::isInstallmode()) {
             self::initializeUser();
         }
         self::setupI18n();
         if (self::$_redirect_login == 'login') {
             TBGLogging::log('An error occurred setting up the user object, redirecting to login', 'main', TBGLogging::LEVEL_NOTICE);
             if (self::getRouting()->getCurrentRouteName() != 'login') {
                 TBGContext::setMessage('login_message_err', TBGContext::geti18n()->__('Please log in'));
             }
             self::getResponse()->headerRedirect(self::getRouting()->generate('login_page'), 403);
         }
         if (self::$_redirect_login == 'elevated_login') {
             TBGLogging::log('Elevated permissions required', 'main', TBGLogging::LEVEL_NOTICE);
             if (self::getRouting()->getCurrentRouteName() != 'elevated_login') {
                 TBGContext::setMessage('elevated_login_message_err', TBGContext::geti18n()->__('Please re-enter your password to continue'));
             }
             if (!class_exists('mainActions')) {
                 require THEBUGGENIE_MODULES_PATH . 'main' . DS . 'classes' . DS . 'actions.class.php';
             }
             $actionObject = new mainActions();
             $moduleName = 'main';
             $moduleMethod = 'elevatedLogin';
         }
         if (self::performAction($actionObject, $moduleName, $moduleMethod)) {
             if (self::isDebugMode()) {
                 self::generateDebugInfo();
             }
             if (\b2db\Core::isInitialized()) {
                 \b2db\Core::closeDBLink();
             }
             return true;
         }
     } catch (TBGTemplateNotFoundException $e) {
         \b2db\Core::closeDBLink();
         //header("HTTP/1.0 404 Not Found", true, 404);
         throw $e;
     } catch (TBGActionNotFoundException $e) {
         \b2db\Core::closeDBLink();
         header("HTTP/1.0 404 Not Found", true, 404);
         throw $e;
     } catch (TBGCSRFFailureException $e) {
         \b2db\Core::closeDBLink();
         if (self::isDebugMode()) {
             self::generateDebugInfo();
         }
         self::getResponse()->setHttpStatus(301);
         $message = $e->getMessage();
         if (self::getRequest()->getRequestedFormat() == 'json') {
             self::getResponse()->setContentType('application/json');
             $message = json_encode(array('message' => $message));
         }
         self::getResponse()->renderHeaders();
         echo $message;
     } catch (Exception $e) {
         \b2db\Core::closeDBLink();
         //header("HTTP/1.0 404 Not Found", true, 404);
         throw $e;
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:98,代码来源:TBGContext.class.php

示例6: 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(TBGContext::geti18n()->__('HTTP integrated authentication is enabled but the HTTP header has not been provided by the web server.'));
         }
     } else {
         return true;
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:12,代码来源:TBGLDAPAuthentication.class.php

示例7: getAccountSettingsName

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

示例8: _construct

 /**
  * Class constructor
  *
  * @param B2DBRow $row
  */
 public function _construct(B2DBRow $row, $foreign_key = null)
 {
     //$this->_populateCustomfields();
     $this->_mergeChangedProperties();
     if ($this->isDeleted()) {
         throw new Exception(TBGContext::geti18n()->__('This issue has been deleted'));
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:13,代码来源:TBGIssue.class.php


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