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


PHP TBGContext::isDebugMode方法代码示例

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


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

示例1: log

 /**
  * Log a message to the logger
  *
  * @param string $message The message to log
  * @param string $category[optional] The message category (default "main")
  * @param integer $level[optional] The loglevel
  */
 public static function log($message, $category = 'main', $level = 1)
 {
     if (!self::$_logging_enabled) {
         return false;
     }
     if (self::$_loglevel > $level) {
         return false;
     }
     if (self::$_cli_log_to_screen_in_debug_mode && TBGContext::isCLI() && TBGContext::isDebugMode() && class_exists('TBGCliCommand')) {
         TBGCliCommand::cli_echo(mb_strtoupper(self::getLevelName($level)), 'white', 'bold');
         TBGCliCommand::cli_echo(" [{$category}] ", 'green', 'bold');
         TBGCliCommand::cli_echo("{$message}\n");
     }
     if (self::$_logonajaxcalls || TBGContext::getRequest()->isAjaxCall()) {
         if (self::$_logfile !== null) {
             file_put_contents(self::$_logfile, mb_strtoupper(self::getLevelName($level)) . " [{$category}] {$message}\n", FILE_APPEND);
         }
         $time_msg = TBGContext::isDebugMode() ? ($load_time = TBGContext::getLoadtime()) >= 1 ? round($load_time, 2) . ' seconds' : round($load_time * 1000, 3) . ' ms' : '';
         self::$_entries[] = array('category' => $category, 'time' => $time_msg, 'message' => $message, 'level' => $level);
         self::$_categorized_entries[$category][] = array('time' => $time_msg, 'message' => $message, 'level' => $level);
     }
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:29,代码来源:TBGLogging.class.php

示例2: array

}
?>
										</div>
									</div>
									<?php 
TBGEvent::createNew('core', 'after_header_userinfo')->trigger();
?>
								</div>
							</td>
						</tr>
					</table>
					<?php 
require THEBUGGENIE_CORE_PATH . 'templates/submenu.inc.php';
?>
					<?php 
if (!TBGContext::isDebugMode()) {
    ?>
						<div class="rounded_box iceblue borderless infobox" style="margin: 5px; display: none;" id="firebug_warning">
							<div style="padding: 5px;">
								<?php 
    echo image_tag('icon_info_big.png', array('style' => 'float: left; margin: 5px 5px 0 0;'));
    ?>
								<div>
									<div class="header"><?php 
    echo __("Cool - you're using Firebug, too - so do we!");
    ?>
</div>
									<div class="content">
										<?php 
    echo __("As you probably know, Firebug has awesome monitoring and profiling features, which in turn means The Bug Genie will probably be a bit slow if you have Firebug enabled with it.");
    ?>
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:31,代码来源:header.inc.php

示例3: foreach

        ?>
]</strong> <span style="color: #555; font-size: 10px; font-style: italic;"><?php 
        echo $entry['time'];
        ?>
</span>&nbsp;&nbsp;<?php 
        echo $entry['message'];
        ?>
</div>
				<?php 
    }
    ?>
			<?php 
}
?>
			<?php 
if (class_exists("\\b2db\\Core") && TBGContext::isDebugMode() && (!isset($exception) || !$exception instanceof TBGComposerException)) {
    ?>
				<h3>SQL queries:</h3>
					<ol>
					<?php 
    foreach (\b2db\Core::getSQLHits() as $details) {
        ?>
						<li>
							<span class="faded_out dark small"><b>[<?php 
        echo $details['time'] >= 1 ? round($details['time'], 2) . ' seconds' : round($details['time'] * 1000, 1) . 'ms';
        ?>
]</b></span>
							from <b><?php 
        echo $details['filename'];
        ?>
, line <?php 
开发者ID:oparoz,项目名称:thebuggenie,代码行数:31,代码来源:error.php

示例4: __

<br>
		<a href="http://www.opensource.org/licenses/mozilla1.1.php"><?php 
echo __('Read the license (MPL 1.1 only)');
?>
</a>
	<?php 
if ($tbg_user->canAccessConfigurationPage()) {
    ?>
        | <b><?php 
    echo link_tag(make_url('configure'), __('Configure %thebuggenie_name', array('%thebuggenie_name' => TBGSettings::getTBGname())));
    ?>
</b>
	<?php 
}
?>
	<?php 
if (TBGContext::isDebugMode() && TBGLogging::isEnabled()) {
    ?>
		<div id="tbg___DEBUGINFO___" style="position: fixed; bottom: 0; left: 0; z-index: 100; display: none; width: 100%;">
		</div>
		<?php 
    echo image_tag('spinning_16.gif', array('style' => 'position: fixed; bottom: 5px; right: 23px;', 'id' => 'tbg___DEBUGINFO___indicator'));
    ?>
		<?php 
    echo image_tag('debug_show.png', array('style' => 'position: fixed; bottom: 5px; right: 3px; cursor: pointer;', 'onclick' => "\$('tbg___DEBUGINFO___').toggle();", 'title' => 'Show debug bar'));
    ?>
	<?php 
}
?>
</footer>
开发者ID:oparoz,项目名称:thebuggenie,代码行数:30,代码来源:footer.inc.php

示例5: runGetBackdropPartial


//.........这里部分代码省略.........
                     $options['item_name'] = $details['description'];
                     $options['access_level'] = $request['access_level'];
                 }
                 break;
             case 'issuefield_permissions':
                 $options['item_key'] = $request['item_key'];
                 if ($details = TBGContext::getPermissionDetails($options['item_key'])) {
                     $template_name = 'configuration/issuefieldpermissions';
                     $options['item_name'] = $details['description'];
                     $options['item_id'] = $request['item_id'];
                     $options['access_level'] = $request['access_level'];
                 } else {
                     die('fu');
                 }
                 break;
             case 'site_icons':
                 $template_name = 'configuration/siteicons';
                 break;
             case 'project_config':
                 $template_name = 'project/projectconfig_container';
                 $project = TBGContext::factory()->TBGProject($request['project_id']);
                 $options['project'] = $project;
                 $options['section'] = $request->getParameter('section', 'info');
                 if ($request->hasParameter('edition_id')) {
                     $edition = TBGContext::factory()->TBGEdition($request['edition_id']);
                     $options['edition'] = $edition;
                     $options['selected_section'] = $request->getParameter('section', 'general');
                 }
                 break;
             case 'issue_add_item':
                 $issue = TBGContext::factory()->TBGIssue($request['issue_id']);
                 $template_name = 'main/issueadditem';
                 break;
             case 'client_users':
                 $options['client'] = TBGContext::factory()->TBGClient($request['client_id']);
                 $template_name = 'main/clientusers';
                 break;
             case 'dashboard_config':
                 $template_name = 'main/dashboardconfig';
                 $options['tid'] = $request['tid'];
                 $options['target_type'] = $request['target_type'];
                 $options['previous_route'] = $request['previous_route'];
                 $options['mandatory'] = true;
                 break;
             case 'archived_projects':
                 $template_name = 'main/archivedprojects';
                 $options['mandatory'] = true;
                 break;
             case 'team_archived_projects':
                 $template_name = 'main/archivedprojects';
                 $options['target'] = 'team';
                 $options['id'] = $request['tid'];
                 $options['mandatory'] = true;
                 break;
             case 'client_archived_projects':
                 $template_name = 'main/archivedprojects';
                 $options['target'] = 'client';
                 $options['id'] = $request['cid'];
                 $options['mandatory'] = true;
                 break;
             case 'project_archived_projects':
                 $template_name = 'main/archivedprojects';
                 $options['target'] = 'project';
                 $options['id'] = $request['pid'];
                 $options['mandatory'] = true;
                 break;
             case 'bulk_workflow':
                 $template_name = 'search/bulkworkflow';
                 $options['issue_ids'] = $request['issue_ids'];
                 break;
             case 'confirm_username':
                 $template_name = 'main/confirmusername';
                 $options['username'] = $request['username'];
                 break;
             case 'userscopes':
                 if (!TBGContext::getScope()->isDefault()) {
                     throw new Exception($this->getI18n()->__('This is not allowed outside the default scope'));
                 }
                 $template_name = 'configuration/userscopes';
                 $options['user'] = new TBGUser((int) $request['user_id']);
                 break;
             default:
                 $event = new TBGEvent('core', 'get_backdrop_partial', $request['key']);
                 $event->triggerUntilProcessed();
                 $options = $event->getReturnList();
                 $template_name = $event->getReturnValue();
         }
         if ($template_name !== null) {
             return $this->renderJSON(array('content' => $this->getComponentHTML($template_name, $options)));
         }
     } catch (Exception $e) {
         $this->getResponse()->cleanBuffer();
         $this->getResponse()->setHttpStatus(400);
         return $this->renderJSON(array('error' => TBGContext::getI18n()->__('An error occured: %error_message', array('%error_message' => $e->getMessage()))));
     }
     $this->getResponse()->cleanBuffer();
     $this->getResponse()->setHttpStatus(400);
     $error = TBGContext::isDebugMode() ? TBGContext::getI18n()->__('Invalid template or parameter') : $this->getI18n()->__('Could not show the requested popup');
     return $this->renderJSON(array('error' => $error));
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:101,代码来源:actions.class.php

示例6: tbg_exception


//.........这里部分代码省略.........
                    TBGCliCommand::cli_echo($details['filename'], 'blue');
                    TBGCliCommand::cli_echo(", line ");
                    TBGCliCommand::cli_echo($details['line'], 'white', 'bold');
                    TBGCliCommand::cli_echo(":\n");
                    TBGCliCommand::cli_echo("{$details['sql']}\n");
                }
                echo "\n";
            } catch (Exception $e) {
                TBGCliCommand::cli_echo("Could not generate query list (there may be no database connection)", "red", "bold");
            }
        }
        echo "\n";
        die;
    }
    echo "\n\t\t<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n\t\t<html>\n\t\t<head>\n\t\t<style>\n\t\tbody { background-color: #DFDFDF; font-family: \"Droid Sans\", \"Trebuchet MS\", \"Liberation Sans\", \"Nimbus Sans L\", \"Luxi Sans\", Verdana, sans-serif; font-size: 13px; }\n\t\th1 { margin: 5px 0 0 0; font-size: 19px; }\n\t\th2 { margin: 0 0 15px 0; font-size: 16px; }\n\t\th3 { margin: 15px 0 0 0; font-size: 14px; }\n\t\tinput[type=\"text\"], input[type=\"password\"] { float: left; margin-right: 15px; }\n\t\tlabel { float: left; font-weight: bold; margin-right: 5px; display: block; width: 150px; }\n\t\tlabel span { font-weight: normal; color: #888; }\n\t\t.rounded_box {background: transparent; margin:0px;}\n\t\t.rounded_box h4 { margin-bottom: 0px; margin-top: 7px; font-size: 14px; }\n\t\t.xtop, .xbottom {display:block; background:transparent; font-size:1px;}\n\t\t.xb1, .xb2, .xb3, .xb4 {display:block; overflow:hidden;}\n\t\t.xb1, .xb2, .xb3 {height:1px;}\n\t\t.xb2, .xb3, .xb4 {background:#F9F9F9; border-left:1px solid #CCC; border-right:1px solid #CCC;}\n\t\t.xb1 {margin:0 5px; background:#CCC;}\n\t\t.xb2 {margin:0 3px; border-width:0 2px;}\n\t\t.xb3 {margin:0 2px;}\n\t\t.xb4 {height:2px; margin:0 1px;}\n\t\t.xboxcontent {display:block; background:#F9F9F9; border:0 solid #CCC; border-width:0 1px; padding: 0 5px 0 5px;}\n\t\t.xboxcontent table td.description { padding: 3px 3px 3px 0;}\n\t\t.white .xb2, .white .xb3, .white .xb4 { background: #FFF; border-color: #CCC; }\n\t\t.white .xb1 { background: #CCC; }\n\t\t.white .xboxcontent { background: #FFF; border-color: #CCC; }\n\t\tpre { overflow: scroll; padding: 5px; }\n\t\t</style>\n\t\t<!--[if IE]>\n\t\t<style>\n\t\tbody { background-color: #DFDFDF; font-family: sans-serif; font-size: 13px; }\n\t\t</style>\n\t\t<![endif]-->\n\t\t</head>\n\t\t<body>\n\t\t<div class=\"rounded_box white\" style=\"margin: 30px auto 0 auto; width: 700px;\">\n\t\t\t<b class=\"xtop\"><b class=\"xb1\"></b><b class=\"xb2\"></b><b class=\"xb3\"></b><b class=\"xb4\"></b></b>\n\t\t\t<div class=\"xboxcontent\" style=\"vertical-align: middle; padding: 10px 10px 10px 15px;\">\n\t\t\t<img style=\"float: left; margin-right: 10px;\" src=\"" . TBGContext::getTBGPath() . "header.png\"><h1>An error occured in The Bug Genie</h1>";
    echo "<h2>{$title}</h2>";
    $report_description = null;
    if ($exception instanceof Exception) {
        if ($exception instanceof TBGActionNotFoundException) {
            echo "<h3>Could not find the specified action</h3>";
            $report_description = "Could not find the specified action";
        } elseif ($exception instanceof TBGTemplateNotFoundException) {
            echo "<h3>Could not find the template file for the specified action</h3>";
            $report_description = "Could not find the template file for the specified action";
        } elseif ($exception instanceof B2DBException) {
            echo "<h3>An exception was thrown in the B2DB framework</h3>";
            $report_description = "An exception was thrown in the B2DB framework";
        } else {
            echo "<h3>An unhandled exception occurred:</h3>";
            $report_description = "An unhandled exception occurred";
        }
        $report_description .= "\n" . $exception->getMessage();
        echo "<i>" . $exception->getMessage() . "</i><br>";
        if (class_exists("TBGContext") && TBGContext::isDebugMode()) {
            echo "<h3>Stack trace:</h3>\n\t\t\t\t\t<ul>";
            //echo '<pre>';var_dump($exception->getTrace());die();
            foreach ($exception->getTrace() as $trace_element) {
                echo '<li>';
                if (array_key_exists('class', $trace_element)) {
                    echo '<strong>' . $trace_element['class'] . $trace_element['type'] . $trace_element['function'] . '()</strong><br>';
                } elseif (array_key_exists('function', $trace_element)) {
                    if (!in_array($trace_element['function'], array('tbg_error_handler', 'tbg_exception'))) {
                        echo '<strong>' . $trace_element['function'] . '()</strong><br>';
                    }
                } else {
                    echo '<strong>unknown function</strong><br>';
                }
                if (array_key_exists('file', $trace_element)) {
                    echo '<span style="color: #55F;">' . $trace_element['file'] . '</span>, line ' . $trace_element['line'];
                } else {
                    echo '<span style="color: #C95;">unknown file</span>';
                }
                echo '</li>';
            }
            echo "</ul>";
        }
    } else {
        echo '<h3>';
        if ($exception['code'] == 8) {
            echo 'The following notice has stopped further execution:';
            $report_description = 'The following notice has stopped further execution: ';
        } else {
            echo 'The following error occured:';
            $report_description = 'The following error occured: ';
        }
        echo '</h3>';
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:67,代码来源:tbg_engine.inc.php

示例7: includeTemplate

 /**
  * Include a template from a module
  *
  * @param string $template
  * @param array $params
  */
 public static function includeTemplate($template, $params = array())
 {
     $debug = TBGContext::isDebugMode();
     if ($debug) {
         $time = explode(' ', microtime());
         $pretime = $time[1] + $time[0];
     }
     $template_name = self::getFinalTemplateName($template);
     self::presentTemplate($template_name, $params);
     if ($debug) {
         $time = explode(' ', microtime());
         $posttime = $time[1] + $time[0];
         TBGContext::visitPartial($template, $posttime - $pretime);
     }
 }
开发者ID:ronaldbroens,项目名称:thebuggenie,代码行数:21,代码来源:TBGActionComponent.class.php

示例8: ajaxResponseText

 public function ajaxResponseText($code, $error)
 {
     if (TBGContext::isDebugMode()) {
         return true;
     }
     $this->cleanBuffer();
     $this->setContentType('application/json');
     $this->setHttpStatus($code);
     $this->renderHeaders();
     echo json_encode(array('error' => $error));
     die;
 }
开发者ID:oparoz,项目名称:thebuggenie,代码行数:12,代码来源:TBGResponse.class.php


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