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


PHP TBGContext::loadLibrary方法代码示例

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


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

示例1: getArticleLinkTag

 public function getArticleLinkTag($matches)
 {
     $article_name = $matches[0];
     if (TBGTextParser::getCurrentParser() instanceof TBGTextParser) {
         TBGTextParser::getCurrentParser()->addInternalLinkOccurrence($article_name);
     }
     $article_name = $this->getSpacedName($matches[0]);
     if (!TBGContext::isCLI()) {
         TBGContext::loadLibrary('ui');
         return link_tag(make_url('publish_article', array('article_name' => $matches[0])), $article_name);
     } else {
         return $matches[0];
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:14,代码来源:TBGPublish.class.php

示例2: runTransitionIssues

 public function runTransitionIssues(TBGRequest $request)
 {
     try {
         try {
             $transition = TBGContext::factory()->TBGWorkflowTransition($request['transition_id']);
         } catch (Exception $e) {
             $this->getResponse()->setHttpStatus(400);
             return $this->renderJSON(array('error' => $this->getI18n()->__('This is not a valid transition')));
         }
         $issue_ids = $request['issue_ids'];
         $status = null;
         $closed = false;
         foreach ($issue_ids as $issue_id) {
             $issue = TBGContext::factory()->TBGIssue($issue_id);
             if (!$issue->isWorkflowTransitionsAvailable() || !$transition->validateFromRequest($request)) {
                 $this->getResponse()->setHttpStatus(400);
                 return $this->renderJSON(array('error' => TBGContext::getI18n()->__('The transition could not be applied to issue %issue_number because of %errors', array('%issue_number' => $issue->getFormattedIssueNo(), '%errors' => join(', ', $transition->getValidationErrors())))));
             }
             try {
                 $transition->transitionIssueToOutgoingStepFromRequest($issue, $request);
             } catch (Exception $e) {
                 $this->getResponse()->setHttpStatus(400);
                 TBGLogging::log(TBGLogging::LEVEL_WARNING, 'Transition ' . $transition->getID() . ' failed for issue ' . $issue_id);
                 TBGLogging::log(TBGLogging::LEVEL_WARNING, $e->getMessage());
                 return $this->renderJSON(array('error' => $this->getI18n()->__('The transition failed because of an error in the workflow. Check your workflow configuration.')));
             }
             if ($status === null) {
                 $status = $issue->getStatus();
             }
             $closed = $issue->isClosed();
         }
         TBGContext::loadLibrary('common');
         $options = array('issue_ids' => array_keys($issue_ids), 'last_updated' => tbg_formatTime(time(), 20), 'closed' => $closed);
         $options['status'] = array('color' => $status->getColor(), 'name' => $status->getName(), 'id' => $status->getID());
         if ($request->hasParameter('milestone_id')) {
             $milestone = new TBGMilestone($request['milestone_id']);
             $options['milestone_id'] = $milestone->getID();
             $options['milestone_name'] = $milestone->getName();
         }
         foreach (array('resolution', 'priority', 'category', 'severity') as $item) {
             $class = "TBG" . ucfirst($item);
             if ($request->hasParameter($item . '_id')) {
                 if ($item_id = $request[$item . '_id']) {
                     $itemobject = new $class($item_id);
                     $itemname = $itemobject->getName();
                 } else {
                     $item_id = 0;
                     $itemname = '-';
                 }
                 $options[$item] = array('name' => $itemname, 'id' => $item_id);
             } else {
                 $method = 'get' . ucfirst($item);
                 $itemname = $issue->{$method}() instanceof $class ? $issue->{$method}()->getName() : '-';
                 $item_id = $issue->{$method}() instanceof $class ? $issue->{$method}()->getID() : 0;
                 $options[$item] = array('name' => $itemname, 'id' => $item_id);
             }
         }
         return $this->renderJSON($options);
     } catch (Exception $e) {
         $this->getResponse()->setHttpStatus(400);
         TBGLogging::log(TBGLogging::LEVEL_WARNING, 'Transition ' . $transition->getID() . ' failed for issue ' . $issue_id);
         TBGLogging::log(TBGLogging::LEVEL_WARNING, $e->getMessage());
         return $this->renderJSON(array('error' => $this->getI18n()->__('An error occured when trying to apply the transition')));
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:65,代码来源:actions.class.php

示例3: getDateString

 public function getDateString()
 {
     TBGContext::loadLibrary('common');
     $i18n = TBGContext::getI18n();
     if ($this->hasStartingDate() && $this->hasScheduledDate()) {
         if ($this->getStartingDate() < NOW && $this->getScheduledDate() < NOW) {
             return $i18n->__('%milestone_name (started %start_date - ended %end_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true), '%end_date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         } elseif ($this->getStartingDate() < NOW && $this->getScheduledDate() > NOW) {
             return $i18n->__('%milestone_name (started %start_date - ends %end_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true), '%end_date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         } elseif ($this->getStartingDate() > NOW) {
             return $i18n->__('%milestone_name (starts %start_date - ended %end_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true), '%end_date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         }
     } elseif ($this->hasStartingDate()) {
         if ($this->getStartingDate() < NOW) {
             return $i18n->__('%milestone_name (started %start_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true)));
         } else {
             return $i18n->__('%milestone_name (starts %start_date)', array('%milestone_name' => '', '%start_date' => tbg_formatTime($this->getStartingDate(), 23, true, true)));
         }
     } elseif ($this->hasScheduledDate()) {
         if ($this->getScheduledDate() < NOW) {
             return $i18n->__('%milestone_name (released: %date)', array('%milestone_name' => '', '%date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         } else {
             return $i18n->__('%milestone_name (will be released: %date)', array('%milestone_name' => '', '%date' => tbg_formatTime($this->getScheduledDate(), 23, true, true)));
         }
     } elseif ($this->hasReachedDate()) {
         return $i18n->__('%milestone_name (reached: %date)', array('%milestone_name' => '', '%date' => tbg_formatTime($this->getReachedDate(), 23, true, true)));
     }
     return $i18n->__('Not scheduled');
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:29,代码来源:TBGMilestone.class.php

示例4: _parseText

 protected function _parseText($options = array())
 {
     TBGContext::loadLibrary('common');
     self::$current_parser = $this;
     $this->list_level_types = array();
     $this->list_level = 0;
     $this->deflist = false;
     $this->ignore_newline = false;
     $output = "";
     $text = $this->text;
     $text = preg_replace_callback('/<nowiki>(.+?)<\\/nowiki>(?!<\\/nowiki>)/ism', array($this, "_parse_save_nowiki"), $text);
     $text = preg_replace_callback('/<source((?:\\s+[^\\s]+=".*")*)>\\s*?(.+)\\s*?<\\/source>/ismU', array($this, "_parse_save_code"), $text);
     // Thanks to Mike Smith (scgtrp) for the above regexp
     $text = tbg_decodeUTF8($text, true);
     $text = preg_replace('/&lt;((\\/)?u|(\\/)?strike|br|code)&gt;/ism', '<\\1>', $text);
     $lines = explode("\n", $text);
     foreach ($lines as $line) {
         if (substr($line, -1) == "\r") {
             $line = substr($line, 0, -1);
         }
         $output .= $this->_parse_line($line, $options);
     }
     $this->nowikis = array_reverse($this->nowikis);
     $this->codeblocks = array_reverse($this->codeblocks);
     $this->elinks = array_reverse($this->elinks);
     if (!array_key_exists('ignore_toc', $options)) {
         $output = preg_replace_callback('/\\{\\{TOC\\}\\}/', array($this, "_parse_add_toc"), $output);
     }
     $output = preg_replace_callback('/\\|\\|\\|NOWIKI\\|\\|\\|/i', array($this, "_parse_restore_nowiki"), $output);
     if (!isset($options['no_code_highlighting'])) {
         $output = preg_replace_callback('/\\|\\|\\|CODE\\|\\|\\|/Ui', array($this, "_parse_restore_code"), $output);
     }
     $output = preg_replace_callback('/~~~ILINK~~~/i', array($this, "_parse_restore_ilink"), $output);
     $output = preg_replace_callback('/~~~ELINK~~~/i', array($this, "_parse_restore_elink"), $output);
     self::$current_parser = null;
     return $output;
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:37,代码来源:TBGTextParser.class.php

示例5: postConfigSettings

 public function postConfigSettings(TBGRequest $request)
 {
     TBGContext::loadLibrary('common');
     $settings = array('smtp_host', 'smtp_port', 'smtp_user', 'timeout', 'mail_type', 'enable_outgoing_notifications', 'smtp_pwd', 'headcharset', 'from_name', 'from_addr', 'ehlo', 'use_queue', 'no_dash_f');
     foreach ($settings as $setting) {
         if ($request->getParameter($setting) !== null || ($setting = 'no_dash_f')) {
             $value = $request->getParameter($setting);
             $dns_regex = '(\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b|(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\]))';
             $mail_regex = '(?:[a-z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*|"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*")@';
             switch ($setting) {
                 case 'smtp_host':
                     if ($request->getParameter('mail_type') == TBGMailer::MAIL_TYPE_B2M && !tbg_check_syntax($value, "MAILSERVER")) {
                         throw new Exception(TBGContext::getI18n()->__('Please provide a valid setting for SMTP server address'));
                     }
                     break;
                 case 'from_addr':
                     if (!tbg_check_syntax($value, "EMAIL")) {
                         throw new Exception(TBGContext::getI18n()->__('Please provide a valid setting for email "from"-address'));
                     }
                     break;
                 case 'timeout':
                     if ($request->getParameter('mail_type') == TBGMailer::MAIL_TYPE_B2M && !is_numeric($value) || $value < 0) {
                         throw new Exception(TBGContext::getI18n()->__('Please provide a valid setting for SMTP server timeout'));
                     }
                     break;
                 case 'smtp_port':
                     if ($request->getParameter('mail_type') == TBGMailer::MAIL_TYPE_B2M && !is_numeric($value) || $value < 1) {
                         throw new Exception(TBGContext::getI18n()->__('Please provide a valid setting for SMTP server port'));
                     }
                     break;
                 case 'headcharset':
                     // list of supported character sets based on PHP doc : http://www.php.net/manual/en/function.htmlentities.php
                     if (!tbg_check_syntax($value, "CHARSET")) {
                         throw new Exception(TBGContext::getI18n()->__('Please provide a valid setting for email header charset'));
                     }
                     break;
                 case 'no_dash_f':
                     $value = (int) $request->getParameter($setting, 0);
                     break;
             }
             $this->saveSetting($setting, $value);
         }
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:44,代码来源:TBGMailing.class.php

示例6: link_tag

<?php

TBGContext::loadLibrary('ui');
?>
<div class="rounded_box round_canhover lightgrey projectbox" style="margin: 10px 0px 10px 0px; width: 690px;">
	<div style="padding: 3px; font-size: 14px;">
		<strong><?php 
echo link_tag(make_url('project_dashboard', array('project_key' => $project->getKey())), $project->getName());
?>
</strong>&nbsp;(<?php 
echo $project->getKey();
?>
)
		<?php 
if ($project->usePrefix()) {
    ?>
			&nbsp;-&nbsp;<i><?php 
    echo $project->getPrefix();
    ?>
</i>
		<?php 
}
?>
	</div>
	<table cellpadding=0 cellspacing=0 style="width: 680px; table-layout: auto;">
	<tr>
	<td style="padding-left: 3px; width: 80px;"><b><?php 
echo __('Owner: %user_or_team%', array('%user_or_team%' => ''));
?>
</b></td>
	<td style="padding-left: 3px; width: auto;">
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:31,代码来源:_projectbox.inc.php

示例7: presentTemplate

 /**
  * Present a template
  * @param string $template_file
  * @param array $params
  */
 public static function presentTemplate($template_file, $params = array())
 {
     TBGLogging::log("configuring template variables for template {$template_file}");
     foreach ($params as $key => $val) {
         ${$key} = $val;
     }
     if (array_key_exists('key', $params)) {
         $key = $params['key'];
     }
     if (array_key_exists('val', $params)) {
         $val = $params['val'];
     }
     /**
      * @global TBGRequest The request object
      */
     $tbg_request = TBGContext::getRequest();
     /**
      * @global TBGResponse The response object
      */
     $tbg_response = TBGContext::getResponse();
     /**
      * @global TBGRequest The request object
      */
     $tbg_routing = TBGContext::getRouting();
     /**
      * @global TBGUser The user object
      */
     $tbg_user = TBGContext::getUser();
     TBGContext::loadLibrary('common');
     TBGContext::loadLibrary('ui');
     TBGLogging::log('rendering template output');
     require $template_file;
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:38,代码来源:TBGActionComponent.class.php

示例8: runSettings

 /**
  * Configure general and server settings
  * 
  * @param TBGRequest $request The request object
  */
 public function runSettings(TBGRequest $request)
 {
     if (TBGContext::getRequest()->isMethod(TBGRequest::POST)) {
         $this->forward403unless($this->access_level == TBGSettings::ACCESS_FULL);
         $settings = array(TBGSettings::SETTING_THEME_NAME, TBGSettings::SETTING_ALLOW_USER_THEMES, TBGSettings::SETTING_ONLINESTATE, TBGSettings::SETTING_ENABLE_GRAVATARS, TBGSettings::SETTING_OFFLINESTATE, TBGSettings::SETTING_AWAYSTATE, TBGSettings::SETTING_AWAYSTATE, TBGSettings::SETTING_IS_SINGLE_PROJECT_TRACKER, TBGSettings::SETTING_REQUIRE_LOGIN, TBGSettings::SETTING_ALLOW_REGISTRATION, TBGSettings::SETTING_USER_GROUP, TBGSettings::SETTING_RETURN_FROM_LOGIN, TBGSettings::SETTING_RETURN_FROM_LOGOUT, TBGSettings::SETTING_IS_PERMISSIVE_MODE, TBGSettings::SETTING_REGISTRATION_DOMAIN_WHITELIST, TBGSettings::SETTING_SHOW_PROJECTS_OVERVIEW, TBGSettings::SETTING_KEEP_COMMENT_TRAIL_CLEAN, TBGSettings::SETTING_TBG_NAME, TBGSettings::SETTING_TBG_TAGLINE, TBGSettings::SETTING_DEFAULT_CHARSET, TBGSettings::SETTING_DEFAULT_LANGUAGE, TBGSettings::SETTING_SERVER_TIMEZONE, TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_LANGUAGE, TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL, TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_NUMBERING, TBGSettings::SETTING_HEADER_ICON_TYPE, TBGSettings::SETTING_FAVICON_TYPE, TBGSettings::SETTING_HEADER_ICON_URL, TBGSettings::SETTING_FAVICON_URL, TBGSettings::SETTING_PREVIEW_COMMENT_IMAGES, TBGSettings::SETTING_HEADER_LINK);
         foreach ($settings as $setting) {
             if (TBGContext::getRequest()->getParameter($setting) !== null) {
                 $value = TBGContext::getRequest()->getParameter($setting);
                 switch ($setting) {
                     case TBGSettings::SETTING_TBG_NAME:
                     case TBGSettings::SETTING_TBG_TAGLINE:
                         $value = TBGContext::getRequest()->getParameter($setting, null, false);
                         break;
                     case TBGSettings::SETTING_SYNTAX_HIGHLIGHT_DEFAULT_INTERVAL:
                         if (!is_numeric($value) || $value < 1) {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('Please provide a valid setting for highlighting interval')));
                         }
                         break;
                     case TBGSettings::SETTING_DEFAULT_CHARSET:
                         TBGContext::loadLibrary('common');
                         if ($value && !tbg_check_syntax($value, "CHARSET")) {
                             $this->getResponse()->setHttpStatus(400);
                             return $this->renderJSON(array('failed' => true, 'error' => TBGContext::getI18n()->__('Please provide a valid setting for charset')));
                         }
                         break;
                 }
                 TBGSettings::saveSetting($setting, $value);
             }
         }
         return $this->renderJSON(array('failed' => false, 'title' => TBGContext::getI18n()->__('All settings saved')));
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:38,代码来源:actions.class.php

示例9: runEditArticle

 /**
  * Show an article
  *
  * @param TBGRequest $request
  */
 public function runEditArticle(TBGRequest $request)
 {
     $article_name = $this->article instanceof TBGWikiArticle ? $this->article->getName() : $request->getParameter('article_name');
     if (!TBGContext::getModule('publish')->canUserEditArticle($article_name)) {
         TBGContext::setMessage('publish_article_error', TBGContext::getI18n()->__('You do not have permission to edit this article'));
         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $article_name)));
     }
     if ($request->isMethod(TBGRequest::POST)) {
         if ($request->hasParameter('new_article_name') && $request->getParameter('new_article_name') != '') {
             if ($request->hasParameter('change_reason') && trim($request->getParameter('change_reason')) != '') {
                 try {
                     if ($request->getParameter('article_id')) {
                         if (($article = PublishFactory::article($request->getParameter('article_id'))) && $article instanceof TBGWikiArticle) {
                             if ($article->getLastUpdatedDate() != $request->getParameter('last_modified')) {
                                 $this->error = TBGContext::getI18n()->__('The file has been modified since you last opened it');
                             } else {
                                 try {
                                     $article->setName($request->getParameter('new_article_name'));
                                     $article->setContent($request->getRawParameter('new_article_content'));
                                     if ($request->getParameter('preview')) {
                                         $this->article = $article;
                                     } else {
                                         $article->doSave(array(), $request->getParameter('change_reason'));
                                         TBGContext::setMessage('publish_article_message', TBGContext::getI18n()->__('The article was saved'));
                                         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $article->getName())));
                                     }
                                 } catch (Exception $e) {
                                     $this->error = $e->getMessage();
                                 }
                             }
                         }
                     }
                 } catch (Exception $e) {
                 }
                 if (($article = TBGWikiArticle::getByName($request->getParameter('new_article_name'))) && $article instanceof TBGWikiArticle && $article->getID() != $request->getParameter('article_id')) {
                     $this->error = TBGContext::getI18n()->__('An article with that name already exists. Please choose a different article name');
                 } elseif (!$article instanceof TBGWikiArticle) {
                     if ($request->getParameter('preview')) {
                         $article = new TBGWikiArticle();
                         $article->setContent($request->getRawParameter('new_article_content'));
                         $article->setName($request->getParameter('new_article_name'));
                         $this->article = $article;
                     } else {
                         $article_id = TBGWikiArticle::createNew($request->getParameter('new_article_name'), $request->getRawParameter('new_article_content', ''), true);
                         $this->forward(TBGContext::getRouting()->generate('publish_article', array('article_name' => $request->getParameter('new_article_name'))));
                     }
                 }
             } else {
                 $this->error = TBGContext::getI18n()->__('You have to provide a reason for the changes');
             }
         } else {
             $this->error = TBGContext::getI18n()->__('You need to specify the article name');
         }
     }
     $this->preview = (bool) $request->getParameter('preview');
     $this->article_title = null;
     $this->article_content = null;
     $this->article_intro = null;
     $this->change_reason = null;
     if ($this->article instanceof TBGWikiArticle) {
         $this->article_title = $this->article->getTitle();
         $this->article_content = $this->article->getContent();
         if ($request->isMethod(TBGRequest::POST)) {
             if ($request->hasParameter('new_article_name')) {
                 $this->article_title = $request->getParameter('new_article_name');
             }
             if ($request->hasParameter('new_article_content')) {
                 $this->article_content = $request->getRawParameter('new_article_content');
             }
             if ($request->hasParameter('change_reason')) {
                 $this->change_reason = $request->getParameter('change_reason');
             }
         }
     } else {
         if ($request->hasParameter('new_article_content')) {
             $this->article_content = $request->getRawParameter('new_article_content');
         }
         TBGContext::loadLibrary('publish');
         $this->article_title = str_replace(array(':', '_'), array(' ', ' '), get_spaced_name($this->article_name));
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:86,代码来源:actions.class.php

示例10: do_execute

 public function do_execute()
 {
     $this->cliEcho('Showing detailed information about ');
     $this->cliEcho($this->getProvidedArgument('project_key'), 'green');
     $this->cliEcho(' issue ');
     $print_issue_number = $this->getProvidedArgument('issue_number');
     if (is_numeric($print_issue_number)) {
         $print_issue_number = '#' . $print_issue_number;
     }
     $this->cliEcho($print_issue_number, 'yellow');
     $this->cliEcho(' on ');
     $this->cliEcho($this->_getCurrentRemoteServer(), 'white', 'bold');
     $this->cliEcho("\n");
     $url_options = array('project_key' => $this->project_key, 'issue_no' => $this->issue_number, 'format' => 'json');
     $this->cliEcho("\n");
     $issue = $this->getRemoteResponse($this->getRemoteURL('viewissue', $url_options));
     TBGContext::loadLibrary('common');
     $this->cliEcho($print_issue_number, 'green', 'bold');
     $this->cliEcho(" - ");
     $state = $issue->state == TBGIssue::STATE_OPEN ? 'OPEN' : 'CLOSED';
     $this->cliEcho("[{$state}] ", 'cyan');
     $this->cliEcho($issue->title, 'white', 'bold');
     $this->cliEcho("\n");
     $this->cliEcho("State: ", 'white', 'bold');
     $this->cliEcho($state);
     $this->cliEcho("\n");
     $this->cliEcho("Posted: ", 'white', 'bold');
     $this->cliEcho(tbg_formatTime($issue->created_at, 21) . ' (' . $issue->created_at . ')');
     $this->cliEcho("\n");
     $this->cliEcho("Posted by: ", 'white', 'bold');
     if ($issue->posted_by) {
         $this->cliEcho($issue->posted_by->name);
     } else {
         $this->cliEcho('-');
     }
     $this->cliEcho("\n");
     $this->cliEcho("Updated: ", 'white', 'bold');
     $this->cliEcho(tbg_formatTime($issue->updated_at, 21) . ' (' . $issue->updated_at . ')');
     $this->cliEcho("\n");
     $this->cliEcho("Assigned to: ", 'white', 'bold');
     if ($issue->assignee) {
         $this->cliEcho($issue->assignee->name);
     } else {
         $this->cliEcho('-');
     }
     $this->cliEcho("\n");
     $this->cliEcho("Status: ", 'white', 'bold');
     if ($issue->status) {
         $this->cliEcho($issue->status->name);
     } else {
         $this->cliEcho('-');
     }
     $this->cliEcho("\n");
     foreach ($issue->visible_fields as $field => $details) {
         $name = ucfirst(str_replace('_', ' ', $field));
         $this->cliEcho("{$name}: ", 'white', 'bold');
         if ($issue->{$field}) {
             if ($field == 'estimated_time' || $field == 'spent_time') {
                 if (isset($issue->{$field}->points)) {
                     $this->cliEcho($issue->{$field}->points . 'p, ' . $issue->{$field}->hours . 'h, ' . $issue->{$field}->days . 'd, ' . $issue->{$field}->weeks . 'w, ' . $issue->{$field}->months . 'mo');
                 } else {
                     $this->cliEcho('-');
                 }
             } else {
                 if (is_object($issue->{$field})) {
                     $this->cliEcho($issue->{$field}->name);
                 } else {
                     $this->cliEcho($issue->{$field});
                 }
             }
         } else {
             $this->cliEcho('-');
         }
         $this->cliEcho("\n");
     }
     if ($this->getProvidedArgument('include_comments', 'no') == 'yes') {
         $this->cliEcho("\n");
         $this->cliEcho("Comments: \n", 'white', 'bold');
         if (count($issue->comments) > 0) {
             foreach ($issue->comments as $comment) {
                 if ($comment->system_comment && $this->getProvidedArgument('include_system_comments', 'no') != 'yes') {
                     continue;
                 }
                 $this->cliEcho('Comment #' . $comment->comment_number, 'yellow', 'bold');
                 $this->cliEcho("\n");
                 $this->cliEcho('Posted by: ', 'white', 'bold');
                 if ($comment->posted_by) {
                     $this->cliEcho($comment->posted_by->name);
                 } else {
                     $this->cliEcho("Unknown user");
                 }
                 $this->cliEcho("\n");
                 $this->cliEcho('Posted: ', 'white', 'bold');
                 $this->cliEcho(tbg_formatTime($comment->created_at, 21) . ' (' . $comment->created_at . ')');
                 $this->cliEcho("\n");
                 $this->cliEcho('Comment: ', 'white', 'bold');
                 $this->cliEcho($comment->content);
                 $this->cliEcho("\n");
                 $this->cliEcho('----------', 'white', 'bold');
                 $this->cliEcho("\n\n");
//.........这里部分代码省略.........
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:101,代码来源:CliRemoteShowIssue.class.php

示例11: _parseText

 protected function _parseText($options = array())
 {
     $options = array_merge($options, $this->options);
     TBGContext::loadLibrary('common');
     $output = "";
     $text = $this->text;
     if (!isset($this->options['plain'])) {
         $this->list_level_types = array();
         $this->list_level = 0;
         $this->deflist = false;
         $this->ignore_newline = false;
         $text = preg_replace_callback('/<(nowiki|pre)>(.*)<\\/(\\1)>(?!<\\/(\\1)>)/ismU', array($this, "_parse_save_nowiki"), $text);
         $text = preg_replace_callback('/[\\{]{3,3}([\\d|\\w|\\|]*)[\\}]{3,3}/ismU', array($this, "_parse_insert_variables"), $text);
         $text = preg_replace_callback('/(?<!\\{)[\\{]{2,2}([^{^}.]*)[\\}]{2,2}(?!\\})/ismU', array($this, "_parse_insert_template"), $text);
         if (isset($this->options['included'])) {
             $text = preg_replace_callback('/<noinclude>(.+?)<\\/noinclude>(?!<\\/noinclude>)/ism', array($this, "_parse_remove_noinclude"), $text);
             $text = preg_replace_callback('/<includeonly>(.+?)<\\/includeonly>(?!<\\/includeonly>)/ism', array($this, "_parse_preserve_includeonly"), $text);
             return $text;
         }
         if (!isset($this->options['included'])) {
             $text = preg_replace_callback('/<includeonly>(.+?)<\\/includeonly>(?!<\\/includeonly>)/ism', array($this, "_parse_remove_includeonly"), $text);
             $text = preg_replace_callback('/<noinclude>(.+?)<\\/noinclude>(?!<\\/noinclude>)/ism', array($this, "_parse_preserve_noinclude"), $text);
         }
         $text = preg_replace_callback('/<source((?:\\s+[^\\s]+=".*")*)>\\s*?(.+)\\s*?<\\/source>/ismU', array($this, "_parse_save_code"), $text);
         // Thanks to Mike Smith (scgtrp) for the above regexp
         $text = tbg_decodeUTF8($text, true);
         $text = preg_replace_callback('/&lt;(strike|u|pre|tt|s|del|ins|u|blockquote|div|span|font)(\\s.*)?&gt;(.*)&lt;\\/(\\1)&gt;/ismU', array($this, '_parse_allowed_tags'), $text);
         $text = str_replace('&lt;br&gt;', '<br>', $text);
         $lines = explode("\n", $text);
         foreach ($lines as $line) {
             if (mb_substr($line, -1) == "\r") {
                 $line = mb_substr($line, 0, -1);
             }
             $output .= $this->_parse_line($line, $options);
         }
         // Check if we need to close any tags in case the list items, etc were the last line
         if ($this->list_level > 0) {
             $output .= $this->_parse_list(false, true);
         }
         if ($this->deflist) {
             $output .= $this->_parse_definitionlist(false, true);
         }
         if ($this->preformat) {
             $output .= $this->_parse_preformat(false, true);
         }
         if ($this->quote) {
             $output .= $this->_parse_quote(false, true);
         }
         $this->nowikis = array_reverse($this->nowikis);
         $this->codeblocks = array_reverse($this->codeblocks);
         $this->elinks = array_reverse($this->elinks);
         if (!array_key_exists('ignore_toc', $options)) {
             $output = preg_replace_callback('/\\{\\{TOC\\}\\}/', array($this, "_parse_add_toc"), $output);
         } else {
             $output = str_replace('{{TOC}}', '', $output);
         }
         $output = preg_replace_callback('/~~~NOWIKI~~~/i', array($this, "_parse_restore_nowiki"), $output);
         if (!isset($options['no_code_highlighting'])) {
             $output = preg_replace_callback('/~~~CODE~~~/Ui', array($this, "_parse_restore_code"), $output);
         }
         $output = preg_replace_callback('/~~~ILINK~~~/i', array($this, "_parse_restore_ilink"), $output);
         $output = preg_replace_callback('/~~~ELINK~~~/i', array($this, "_parse_restore_elink"), $output);
     } else {
         $text = nl2br(tbg_decodeUTF8($text, true));
         $text = preg_replace_callback(self::getIssueRegex(), array($this, '_parse_issuelink'), $text);
         $text = preg_replace_callback(self::getMentionsRegex(), array($this, '_parse_mention'), $text);
         $output = $text;
     }
     return $output;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:70,代码来源:TBGTextParser.class.php

示例12: getDateString

 public function getDateString()
 {
     TBGContext::loadLibrary('common');
     $i18n = TBGContext::getI18n();
     if ($this->hasStartingDate() && $this->hasScheduledDate()) {
         if ($this->getStartingDate() < time() && $this->getScheduledDate() < time()) {
             return $i18n->__('%milestone_name% (started %start_date% - ended %end_date%)', array('%milestone_name%' => '', '%start_date%' => tbg_formatTime($this->getStartingDate(), 23), '%end_date%' => tbg_formatTime($this->getScheduledDate(), 23)));
         } elseif ($this->getStartingDate() < time() && $this->getScheduledDate() > time()) {
             return $i18n->__('%milestone_name% (started %start_date% - ends %end_date%)', array('%milestone_name%' => '', '%start_date%' => tbg_formatTime($this->getStartingDate(), 23), '%end_date%' => tbg_formatTime($this->getScheduledDate(), 23)));
         } elseif ($this->getStartingDate() > time()) {
             return $i18n->__('%milestone_name% (starts %start_date% - ended %end_date%)', array('%milestone_name%' => '', '%start_date%' => tbg_formatTime($this->getStartingDate(), 23), '%end_date%' => tbg_formatTime($this->getScheduledDate(), 23)));
         }
     } elseif ($this->hasStartingDate()) {
         if ($this->getStartingDate() < time()) {
             return $i18n->__('%milestone_name% (started %start_date%)', array('%milestone_name%' => '', '%start_date%' => tbg_formatTime($this->getStartingDate(), 23)));
         } else {
             return $i18n->__('%milestone_name% (starts %start_date%)', array('%milestone_name%' => '', '%start_date%' => tbg_formatTime($this->getStartingDate(), 23)));
         }
     } elseif ($this->hasScheduledDate()) {
         if ($this->getScheduledDate() < time()) {
             return $i18n->__('%milestone_name% (released: %date%)', array('%milestone_name%' => '', '%date%' => tbg_formatTime($this->getScheduledDate(), 23)));
         } else {
             return $i18n->__('%milestone_name% (will be released: %date%)', array('%milestone_name%' => '', '%date%' => tbg_formatTime($this->getScheduledDate(), 23)));
         }
     } elseif ($this->hasReachedDate()) {
         return $i18n->__('%milestone_name% (reached: %date%)', array('%milestone_name%' => '', '%date%' => tbg_formatTime($this->getReachedDate(), 23)));
     }
     return $i18n->__('In progress');
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:29,代码来源:TBGMilestone.class.php

示例13: getArticleLinkTag

 public function getArticleLinkTag($matches, $parser)
 {
     $article_link = $matches[0];
     $parser->addInternalLinkOccurrence($article_link);
     $article_name = $this->getSpacedName($matches[0]);
     if (!TBGContext::isCLI()) {
         TBGContext::loadLibrary('ui');
         return link_tag(make_url('publish_article', array('article_name' => $matches[0])), $article_name);
     } else {
         return $matches[0];
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:12,代码来源:TBGPublish.class.php

示例14: runBulkUpdateIssues

 public function runBulkUpdateIssues(TBGRequest $request)
 {
     $issue_ids = $request['issue_ids'];
     $options = array('issue_ids' => array_values($issue_ids));
     TBGContext::loadLibrary('common');
     $options['last_updated'] = tbg_formatTime(time(), 20);
     if (!empty($issue_ids)) {
         $options['bulk_action'] = $request['bulk_action'];
         switch ($request['bulk_action']) {
             case 'assign_milestone':
                 $milestone = null;
                 if ($request['milestone'] == 'new') {
                     $milestone = new TBGMilestone();
                     $milestone->setProject(TBGContext::getCurrentProject());
                     $milestone->setName($request['milestone_name']);
                     $milestone->save();
                     $options['milestone_url'] = TBGContext::getRouting()->generate('project_planning_milestone', array('project_key' => $milestone->getProject()->getKey(), 'milestone_id' => $milestone->getID()));
                 } elseif ($request['milestone']) {
                     $milestone = new TBGMilestone($request['milestone']);
                 }
                 $milestone_id = $milestone instanceof TBGMilestone ? $milestone->getID() : null;
                 foreach (array_keys($issue_ids) as $issue_id) {
                     if (is_numeric($issue_id)) {
                         $issue = new TBGIssue($issue_id);
                         $issue->setMilestone($milestone_id);
                         $issue->save();
                     }
                 }
                 $options['milestone_id'] = $milestone_id;
                 $options['milestone_name'] = $milestone_id ? $milestone->getName() : '-';
                 break;
             case 'set_status':
                 if (is_numeric($request['status'])) {
                     $status = new TBGStatus($request['status']);
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new TBGIssue($issue_id);
                             $issue->setStatus($status->getID());
                             $issue->save();
                         }
                     }
                     $options['status'] = array('color' => $status->getColor(), 'name' => $status->getName(), 'id' => $status->getID());
                 }
                 break;
             case 'set_severity':
                 if (is_numeric($request['severity'])) {
                     $severity = $request['severity'] ? new TBGSeverity($request['severity']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new TBGIssue($issue_id);
                             $severity_id = $severity instanceof TBGSeverity ? $severity->getID() : 0;
                             $issue->setSeverity($severity_id);
                             $issue->save();
                         }
                     }
                     $options['severity'] = array('name' => $severity instanceof TBGSeverity ? $severity->getName() : '-', 'id' => $severity instanceof TBGSeverity ? $severity->getID() : 0);
                 }
                 break;
             case 'set_resolution':
                 if (is_numeric($request['resolution'])) {
                     $resolution = $request['resolution'] ? new TBGResolution($request['resolution']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new TBGIssue($issue_id);
                             $resolution_id = $resolution instanceof TBGResolution ? $resolution->getID() : 0;
                             $issue->setResolution($resolution_id);
                             $issue->save();
                         }
                     }
                     $options['resolution'] = array('name' => $resolution instanceof TBGResolution ? $resolution->getName() : '-', 'id' => $resolution instanceof TBGResolution ? $resolution->getID() : 0);
                 }
                 break;
             case 'set_priority':
                 if (is_numeric($request['priority'])) {
                     $priority = $request['priority'] ? new TBGPriority($request['priority']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new TBGIssue($issue_id);
                             $priority_id = $priority instanceof TBGPriority ? $priority->getID() : 0;
                             $issue->setPriority($priority_id);
                             $issue->save();
                         }
                     }
                     $options['priority'] = array('name' => $priority instanceof TBGPriority ? $priority->getName() : '-', 'id' => $priority instanceof TBGPriority ? $priority->getID() : 0);
                 }
                 break;
             case 'set_category':
                 if (is_numeric($request['category'])) {
                     $category = $request['category'] ? new TBGCategory($request['category']) : null;
                     foreach (array_keys($issue_ids) as $issue_id) {
                         if (is_numeric($issue_id)) {
                             $issue = new TBGIssue($issue_id);
                             $category_id = $category instanceof TBGCategory ? $category->getID() : 0;
                             $issue->setCategory($category_id);
                             $issue->save();
                         }
                     }
                     $options['category'] = array('name' => $category instanceof TBGCategory ? $category->getName() : '-', 'id' => $category instanceof TBGCategory ? $category->getID() : 0);
                 }
                 break;
//.........这里部分代码省略.........
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:actions.class.php

示例15: runCaptcha

 /**
  * Generate captcha picture
  * 
  * @param TBGRequest $request The request object
  * @global array $_SESSION['activation_number'] The session captcha activation number
  */
 public function runCaptcha(TBGRequest $request)
 {
     TBGContext::loadLibrary('ui');
     if (!function_exists('imagecreatetruecolor')) {
         return $this->return404();
     }
     $this->getResponse()->setContentType('image/png');
     $this->getResponse()->setDecoration(TBGResponse::DECORATE_NONE);
     $chain = str_split($_SESSION['activation_number'], 1);
     $size = getimagesize(THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'iconsets' . DS . TBGSettings::getIconsetName() . DS . 'numbers/0.png');
     $captcha = imagecreatetruecolor($size[0] * sizeof($chain), $size[1]);
     foreach ($chain as $n => $number) {
         $pic = imagecreatefrompng(THEBUGGENIE_PATH . THEBUGGENIE_PUBLIC_FOLDER_NAME . DS . 'iconsets' . DS . TBGSettings::getIconsetName() . DS . 'numbers/' . $number . '.png');
         imagecopymerge($captcha, $pic, $size[0] * $n, 0, 0, 0, imagesx($pic), imagesy($pic), 100);
         imagedestroy($pic);
     }
     imagepng($captcha);
     imagedestroy($captcha);
     return true;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:26,代码来源:actions.class.php


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