本文整理汇总了PHP中thebuggenie\core\framework\Context::getI18n方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::getI18n方法的具体用法?PHP Context::getI18n怎么用?PHP Context::getI18n使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类thebuggenie\core\framework\Context
的用法示例。
在下文中一共展示了Context::getI18n方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _populateAvailableActions
protected static function _populateAvailableActions()
{
if (self::$_available_actions === null) {
$initial_list = array('special' => array(), 'set' => array(), 'clear' => array());
$i18n = framework\Context::getI18n();
$initial_list['special'][self::ACTION_ASSIGN_ISSUE] = $i18n->__('Assign the issue to a user');
$initial_list['special'][self::ACTION_ASSIGN_ISSUE_SELF] = $i18n->__('Assign the issue to the current user');
$initial_list['special'][self::ACTION_CLEAR_DUPLICATE] = $i18n->__('Mark as not duplicate');
$initial_list['special'][self::ACTION_SET_DUPLICATE] = $i18n->__('Possibly mark as duplicate');
$initial_list['special'][self::ACTION_USER_START_WORKING] = $i18n->__('Start logging time');
$initial_list['special'][self::ACTION_USER_STOP_WORKING] = $i18n->__('Stop logging time and optionally add time spent');
$initial_list['clear'][self::ACTION_CLEAR_ASSIGNEE] = $i18n->__('Clear issue assignee');
$initial_list['clear'][self::ACTION_CLEAR_PRIORITY] = $i18n->__('Clear issue priority');
$initial_list['clear'][self::ACTION_CLEAR_PERCENT] = $i18n->__('Clear issue percent');
$initial_list['clear'][self::ACTION_CLEAR_REPRODUCABILITY] = $i18n->__('Clear issue reproducability');
$initial_list['clear'][self::ACTION_CLEAR_RESOLUTION] = $i18n->__('Clear issue resolution');
$initial_list['clear'][self::ACTION_CLEAR_MILESTONE] = $i18n->__('Clear issue milestone');
$initial_list['set'][self::ACTION_SET_PRIORITY] = $i18n->__('Set issue priority');
$initial_list['set'][self::ACTION_SET_PERCENT] = $i18n->__('Set issue percent');
$initial_list['set'][self::ACTION_SET_REPRODUCABILITY] = $i18n->__('Set issue reproducability');
$initial_list['set'][self::ACTION_SET_RESOLUTION] = $i18n->__('Set issue resolution');
$initial_list['set'][self::ACTION_SET_STATUS] = $i18n->__('Set issue status');
$initial_list['set'][self::ACTION_SET_MILESTONE] = $i18n->__('Set issue milestone');
foreach (CustomDatatype::getAll() as $key => $details) {
$initial_list['clear'][self::CUSTOMFIELD_CLEAR_PREFIX . $key] = $i18n->__('Clear issue field %key', array('%key' => $key));
$initial_list['set'][self::CUSTOMFIELD_SET_PREFIX . $key] = $i18n->__('Set issue field %key', array('%key' => $key));
}
$event = new \thebuggenie\core\framework\Event('core', 'WorkflowTransitionAction::getAvailableTransitionActions', null, array(), $initial_list);
$event->trigger();
self::$_available_actions = $event->getReturnList();
}
}
示例2: getAbbreviation
public function getAbbreviation()
{
if ($this->_abbreviation === null) {
$this->_abbreviation = mb_substr(framework\Context::getI18n()->__($this->getName()), 0, 1);
}
return $this->_abbreviation;
}
示例3: componentEditAgileBoard
public function componentEditAgileBoard()
{
$i18n = framework\Context::getI18n();
$this->autosearches = array(\thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES => $i18n->__('Project open issues (recommended)'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_OPEN_ISSUES_INCLUDING_SUBPROJECTS => $i18n->__('Project open issues (including subprojects)'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES => $i18n->__('Project closed issues'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_CLOSED_ISSUES_INCLUDING_SUBPROJECTS => $i18n->__('Project closed issues (including subprojects)'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_REPORTED_THIS_MONTH => $i18n->__('Project issues reported last month'), \thebuggenie\core\entities\SavedSearch::PREDEFINED_SEARCH_PROJECT_WISHLIST => $i18n->__('Project wishlist'));
$this->savedsearches = \thebuggenie\core\entities\tables\SavedSearches::getTable()->getAllSavedSearchesByUserIDAndPossiblyProjectID(framework\Context::getUser()->getID(), $this->board->getProject()->getID());
$this->issuetypes = $this->board->getProject()->getIssuetypeScheme()->getIssuetypes();
$this->swimlane_groups = array('priority' => $i18n->__('Issue priority'), 'severity' => $i18n->__('Issue severity'), 'category' => $i18n->__('Issue category'));
$this->priorities = \thebuggenie\core\entities\Priority::getAll();
$this->severities = \thebuggenie\core\entities\Severity::getAll();
$this->categories = \thebuggenie\core\entities\Category::getAll();
$fakecolumn = new entities\BoardColumn();
$fakecolumn->setBoard($this->board);
$this->fakecolumn = $fakecolumn;
}
示例4: preExecute
/**
* Pre-execute function
*
* @param framework\Request $request
* @param string $action
*/
public function preExecute(framework\Request $request, $action)
{
try {
if ($project_id = $request['project_id']) {
$this->selected_project = entities\Project::getB2DBTable()->selectById($project_id);
} elseif ($project_key = $request['project_key']) {
$this->selected_project = entities\Project::getByKey($project_key);
}
} catch (\Exception $e) {
}
if (!$this->selected_project instanceof entities\Project) {
return $this->return404(framework\Context::getI18n()->__('This project does not exist'));
}
framework\Context::setCurrentProject($this->selected_project);
$this->project_key = $this->selected_project->getKey();
}
示例5: componentLeftmenu
public function componentLeftmenu()
{
$config_sections = framework\Settings::getConfigSections(framework\Context::getI18n());
$breadcrumblinks = array();
foreach ($config_sections as $key => $sections) {
foreach ($sections as $section) {
if ($key == framework\Settings::CONFIGURATION_SECTION_MODULES) {
$url = is_array($section['route']) ? make_url($section['route'][0], $section['route'][1]) : make_url($section['route']);
$breadcrumblinks[] = array('url' => $url, 'title' => $section['description']);
} else {
$breadcrumblinks[] = array('url' => make_url($section['route']), 'title' => $section['description']);
}
}
}
$this->breadcrumblinks = $breadcrumblinks;
$this->config_sections = $config_sections;
if ($this->selected_section == framework\Settings::CONFIGURATION_SECTION_MODULES) {
if (framework\Context::getRouting()->getCurrentRouteName() == 'configure_modules') {
$this->selected_subsection = 'core';
} else {
$this->selected_subsection = framework\Context::getRequest()->getParameter('config_module');
}
}
}
示例6: make_url
<rss version="2.0">
<channel>
<title><?php
echo \thebuggenie\core\framework\Settings::getSiteHeaderName() . ' ~ ' . $searchtitle;
?>
</title>
<link><?php
echo make_url('home', array(), false);
?>
</link>
<description><?php
echo strip_tags(\thebuggenie\core\framework\Settings::getSiteHeaderName());
?>
</description>
<language><?php
echo mb_strtolower(str_replace('_', '-', \thebuggenie\core\framework\Context::getI18n()->getCurrentLanguage()));
?>
</language>
<image>
<?php
if (\thebuggenie\core\framework\Settings::isUsingCustomHeaderIcon() == '2') {
?>
<url><?php
echo \thebuggenie\core\framework\Settings::getHeaderIconURL();
?>
</url>
<?php
} elseif (\thebuggenie\core\framework\Settings::isUsingCustomHeaderIcon() == '1') {
?>
<url><?php
echo \thebuggenie\core\framework\Context::getUrlHost() . \thebuggenie\core\framework\Context::getWebroot() . 'header.png';
示例7: make_url
?>
</div>
</div>
<?php
if ($issue->isEditable() && $issue->canEditReproductionSteps()) {
?>
<div id="reproduction_steps_change" style="display: none;" class="editor_container">
<form id="reproduction_steps_form" action="<?php
echo make_url('issue_setfield', array('project_key' => $issue->getProject()->getKey(), 'issue_id' => $issue->getID(), 'field' => 'reproduction_steps'));
?>
" method="post" onSubmit="TBG.Issues.Field.set('<?php
echo make_url('issue_setfield', array('project_key' => $issue->getProject()->getKey(), 'issue_id' => $issue->getID(), 'field' => 'reproduction_steps'));
?>
', 'reproduction_steps'); return false;">
<?php
include_component('main/textarea', array('area_name' => 'value', 'target_type' => 'issue', 'target_id' => $issue->getID(), 'area_id' => 'reproduction_steps_form_value', 'syntax' => \thebuggenie\core\framework\Settings::getSyntaxClass($issue->getReproductionStepsSyntax()), 'height' => '250px', 'width' => '100%', 'value' => htmlentities($issue->getReproductionSteps(), ENT_COMPAT, \thebuggenie\core\framework\Context::getI18n()->getCharset())));
?>
<div class="textarea_save_container">
<?php
echo __('%cancel or %save', array('%save' => '<input class="button button-silver" type="submit" value="' . __('Save') . '">', '%cancel' => javascript_link_tag(__('Cancel'), array('onclick' => "\$('reproduction_steps_change').hide();" . ($issue->getReproductionSteps() != '' ? "\$('reproduction_steps_name').show();" : "\$('no_reproduction_steps').show();") . "return false;"))));
?>
</div>
</form>
<?php
echo image_tag('spinning_16.gif', array('style' => 'display: none; float: left; margin-right: 5px;', 'id' => 'reproduction_steps_spinning'));
?>
<div id="reproduction_steps_change_error" class="error_message" style="display: none;"></div>
</div>
<?php
}
?>
示例8: runMilestone
/**
* Milestone actions
*
* @Route(url="/milestone/:milestone_id/*")
*
* @param \thebuggenie\core\framework\Request $request
*/
public function runMilestone(framework\Request $request)
{
$milestone_id = $request['milestone_id'] ? $request['milestone_id'] : null;
$milestone = new \thebuggenie\core\entities\Milestone($milestone_id);
try {
if (!$this->getUser()->canManageProject($this->selected_project) || !$this->getUser()->canManageProjectReleases($this->selected_project)) {
throw new \Exception($this->getI18n()->__("You don't have access to modify milestones"));
}
switch (true) {
case $request->isDelete():
$milestone->delete();
$no_milestone = new \thebuggenie\core\entities\Milestone(0);
$no_milestone->setProject($milestone->getProject());
return $this->renderJSON(array('issue_count' => $no_milestone->countIssues(), 'hours' => $no_milestone->getHoursEstimated(), 'points' => $no_milestone->getPointsEstimated()));
case $request->isPost():
$this->_saveMilestoneDetails($request, $milestone);
$board = entities\tables\AgileBoards::getTable()->selectById($request['board_id']);
if ($request->hasParameter('issues') && $request['include_selected_issues']) {
\thebuggenie\core\entities\tables\Issues::getTable()->assignMilestoneIDbyIssueIDs($milestone->getID(), $request['issues']);
}
$message = framework\Context::getI18n()->__('Milestone saved');
return $this->renderJSON(array('message' => $message, 'component' => $this->getComponentHTML('agile/milestonebox', array('milestone' => $milestone, 'board' => $board)), 'milestone_id' => $milestone->getID()));
default:
return $this->renderJSON(array('content' => framework\Action::returnComponentHTML('agile/milestonebox', array('milestone' => $milestone)), 'milestone_id' => $milestone->getID(), 'milestone_name' => $milestone->getName(), 'milestone_order' => array_keys($milestone->getProject()->getMilestonesForRoadmap())));
}
} catch (\Exception $e) {
$this->getResponse()->setHttpStatus(400);
return $this->renderJSON(array('error' => $e->getMessage()));
}
}
示例9: connect
/**
* Create an imap connection for this account
*/
public function connect()
{
if ($this->_connection === null) {
$options = array();
if ($this->usesPlaintextAuthentication()) {
$options['DISABLE_AUTHENTICATOR'] = 'GSSAPI';
}
$this->_connection = imap_open($this->getConnectionString(), $this->getUsername(), $this->getPassword(), 0, 0, $options);
}
if (!is_resource($this->_connection)) {
$error = imap_last_error();
$error = $error === false ? \thebuggenie\core\framework\Context::getI18n()->__('No error message provided') : $error;
throw new \Exception(\thebuggenie\core\framework\Context::getI18n()->__('Could not connect to the specified email server(%connection_string): %error_message', array('%connection_string' => $this->getConnectionString(), '%error_message' => $error)));
}
}
示例10: setValuesFromRequest
public function setValuesFromRequest(\thebuggenie\core\framework\Request $request)
{
if ($request->hasParameter('predefined_search')) {
$this->setPredefinedVariables($request['predefined_search']);
} else {
$this->_templatename = $request->hasParameter('template') && self::isTemplateValid($request['template']) ? $request['template'] : 'results_normal';
$this->_templateparameter = $request['template_parameter'];
$this->_issues_per_page = $request->getParameter('issues_per_page', 50);
$this->_offset = $request->getParameter('offset', 0);
if ($request['quicksearch']) {
$this->setSortFields(array(tables\Issues::LAST_UPDATED => 'asc'));
}
$this->_filters = SearchFilter::getFromRequest($request, $this);
$this->_applies_to_project = framework\Context::getCurrentProject();
$this->_columns = $request->getParameter('columns');
$this->_sortfields = $request->getParameter('sortfields');
$this->_groupby = $request['groupby'];
$this->_grouporder = $request->getParameter('grouporder', 'asc');
if (in_array($this->_templatename, array('results_userpain_singlepainthreshold', 'results_userpain_totalpainthreshold'))) {
$this->_searchtitle = framework\Context::getI18n()->__('Showing "bug report" issues sorted by user pain, threshold set at %threshold', array('%threshold' => $this->_templateparameter));
$this->_issues_per_page = 0;
$this->_groupby = 'user_pain';
$this->_grouporder = 'desc';
$this->_filters['issuetype'] = SearchFilter::createFilter('issuetype', array('operator' => '=', 'value' => join(',', tables\IssueTypes::getTable()->getBugReportTypeIDs())));
} elseif ($this->_templatename == 'results_votes') {
$this->_searchtitle = framework\Context::getI18n()->__('Showing issues ordered by number of votes');
$this->_issues_per_page = $request->getParameter('issues_per_page', 100);
$this->_groupby = 'votes';
$this->_grouporder = 'desc';
}
}
$this->_setupGenericFilters();
}
示例11: make_url
</ul>
<?php
if ($tbg_user->canSearchForIssues()) {
?>
<form accept-charset="<?php
echo \thebuggenie\core\framework\Context::getI18n()->getCharset();
?>
" action="<?php
echo \thebuggenie\core\framework\Context::isProjectContext() ? make_url('search', array('project_key' => \thebuggenie\core\framework\Context::getCurrentProject()->getKey())) : make_url('search');
?>
" method="get" name="quicksearchform" id="quicksearchform">
<div style="width: auto; padding: 0; position: relative;" id="quicksearch_container">
<input type="hidden" name="fs[text][o]" value="=">
<?php
echo image_tag('spinning_16.gif', array('id' => 'quicksearch_indicator', 'style' => 'display: none;'));
?>
<input type="search" name="fs[text][v]" accesskey="f" id="searchfor" placeholder="<?php
echo __('Search for anything here');
?>
"><div id="searchfor_autocomplete_choices" class="autocomplete rounded_box"></div>
<input type="submit" class="button-blue" id="quicksearch_submit" value="<?php
echo \thebuggenie\core\framework\Context::getI18n()->__('Find');
?>
">
</div>
</form>
<?php
}
?>
</nav>
示例12: array
<?php
\thebuggenie\core\framework\Context::getI18n()->setCharset('utf-8');
setlocale(LC_ALL, array('en_US@euro', 'en_US', 'en'));
示例13: doSave
public function doSave($options = array(), $reason = null)
{
if (tables\Articles::getTable()->doesNameConflictExist($this->_name, $this->_id, framework\Context::getScope()->getID())) {
if (!array_key_exists('overwrite', $options) || !$options['overwrite']) {
throw new \Exception(framework\Context::getI18n()->__('Another article with this name already exists'));
}
}
$user_id = framework\Context::getUser() instanceof User ? framework\Context::getUser()->getID() : 0;
if (!isset($options['revert']) || !$options['revert']) {
$revision = tables\ArticleHistory::getTable()->addArticleHistory($this->_name, $this->_old_content, $this->_content, $user_id, $reason);
} else {
$revision = null;
}
tables\ArticleLinks::getTable()->deleteLinksByArticle($this->_name);
ArticleCategories::getTable()->deleteCategoriesByArticle($this->_name);
if ($this->getArticleType() == self::TYPE_MANUAL && isset($options['article_prev_name']) && $this->_name != $options['article_prev_name']) {
$manual_articles = Articles::getTable()->getManualSidebarArticles(framework\Context::getCurrentProject(), $options['article_prev_name']);
foreach ($manual_articles as $manual_article) {
$manual_article->setName(str_replace($options['article_prev_name'], $this->_name, $manual_article->getName()));
$manual_article->doSave();
}
}
$this->save();
$this->_old_content = $this->_content;
if (mb_substr($this->getContent(), 0, 10) == "#REDIRECT ") {
$content = explode("\n", $this->getContent());
preg_match('/(\\[\\[([^\\]]*?)\\]\\])$/im', mb_substr(array_shift($content), 10), $matches);
if (count($matches) == 3) {
return;
}
}
list($links, $categories) = $this->_retrieveLinksAndCategoriesFromContent($options);
foreach ($links as $link => $occurrences) {
tables\ArticleLinks::getTable()->addArticleLink($this->_name, $link);
}
foreach ($categories as $category => $occurrences) {
ArticleCategories::getTable()->addArticleCategory($this->_name, $category, $this->isCategory());
}
$this->_history = null;
\thebuggenie\core\framework\Event::createNew('core', 'thebuggenie\\modules\\publish\\entities\\Article::doSave', $this, compact('reason', 'revision', 'user_id'))->trigger();
return true;
}
示例14: _parse_internallink
protected function _parse_internallink($matches)
{
$href = html_entity_decode($matches[4], ENT_QUOTES, 'UTF-8');
if (isset($matches[6]) && $matches[6]) {
$title = $matches[6];
} else {
$title = $href;
if (isset($matches[7]) && $matches[7]) {
$title .= $matches[7];
}
}
$namespace = $matches[3];
if (mb_strtolower($namespace) == 'category') {
if (mb_substr($matches[2], 0, 1) != ':') {
$this->addCategorizer($href);
return '';
}
}
if (mb_strtolower($namespace) == 'wikipedia') {
if (framework\Context::isCLI()) {
return $href;
}
$options = explode('|', $title);
$title = (array_key_exists(5, $matches) && mb_strpos($matches[5], '|') !== false ? '' : $namespace . ':') . array_pop($options);
return link_tag('http://en.wikipedia.org/wiki/' . $href, $title);
}
if (preg_match("/embed(\\s+url\\=)?/", mb_strtolower($namespace)) || preg_match("/embed((:)?|(\\s+url\\=)?)/", mb_strtolower($matches[0]))) {
if (framework\Context::isCLI()) {
return $href;
}
// if the name space is null more than likely the user is
// using embed url= format without the http:// in front of the URL
// and the href tag will contain "embed url=" and it must be removed
if ($namespace == null) {
$href = preg_replace("/embed(\\s+)url=/", "", $href);
}
// if the href is empty or set to 'embed' then stop processing
// an empty embed tag was entered '[[embed]]'
if ($href == 'embed' || $href == null) {
return;
}
$options = explode('|', $title);
// Default values
$width = 500;
$height = 400;
$type = 'iframe';
// if the link is a youtube link prepare it for embedding
if (tbg_youtube_link($href)) {
$href = tbg_youtube_prepare_link($href);
}
// check to see if any size options exist
if (array_key_exists(0, $options)) {
$settings = $options[0];
// if width exists override default setting
if (preg_match_all("/width=(\\d+)/", $settings, $width_matches)) {
if (!empty($width_matches)) {
$width = $width_matches[1][0];
}
}
// if height exists override default setting
if (preg_match_all("/height=(\\d+)/", $settings, $height_matches)) {
if (!empty($height_matches)) {
$height = $height_matches[1][0];
}
}
// if type exists override default setting
if (preg_match_all("/type=(iframe|object)/", $settings, $type_matches)) {
if (!empty($type_matches)) {
$type = $type_matches[1][0];
}
}
}
if ($type == 'object') {
$code = object_tag($href, $width, $height);
} else {
$code = iframe_tag($href, $width, $height);
}
return $code;
}
if (in_array(mb_strtolower($namespace), array('image', 'file'))) {
$retval = $namespace . ':' . $href;
if (!framework\Context::isCLI()) {
$options = explode('|', $title);
$filename = $href;
$issuemode = (bool) (isset($this->options['issue']) && $this->options['issue'] instanceof \thebuggenie\core\entities\Issue);
$articlemode = (bool) (isset($this->options['article']) && $this->options['article'] instanceof Article);
$file = null;
$file_link = $filename;
$caption = $filename;
if ($issuemode) {
$file = $this->options['issue']->getFileByFilename($filename);
} elseif ($articlemode) {
$file = $this->options['article']->getFileByFilename($filename);
}
if ($file instanceof \thebuggenie\core\entities\File) {
$caption = !empty($options) ? array_pop($options) : htmlentities($file->getDescription(), ENT_COMPAT, framework\Context::getI18n()->getCharset());
$caption = $caption != '' ? $caption : htmlentities($file->getOriginalFilename(), ENT_COMPAT, framework\Context::getI18n()->getCharset());
$file_link = make_url('showfile', array('id' => $file->getID()));
} else {
$caption = !empty($options) ? array_pop($options) : false;
//.........这里部分代码省略.........
示例15: __sanitize_string
/**
* Sanitize a string
*
* @param string $string The string to sanitize
*
* @return string the sanitized string
*/
protected function __sanitize_string($string)
{
try {
$charset = class_exists('\\thebuggenie\\core\\framework\\Context') ? Context::getI18n()->getCharset() : 'utf-8';
} catch (\Exception $e) {
$charset = 'utf-8';
}
return htmlspecialchars($string, ENT_QUOTES, $charset);
}