本文整理汇总了PHP中debug类的典型用法代码示例。如果您正苦于以下问题:PHP debug类的具体用法?PHP debug怎么用?PHP debug使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了debug类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HarmoniRepositoryManager
/**
* Constructor
* @param array $configuration An array of the configuration options
* nessisary to load this manager. To use the a specific manager store, a
* store data source must be configured as noted in the class of said
* manager store.
* manager.
* @access public
*/
function HarmoniRepositoryManager($configuration = NULL)
{
// Define the type to use as a key for Identifying repositories
$this->repositoryKeyType = new HarmoniType("Repository", "edu.middlebury.harmoni", "Repository", "Nodes with this type are by definition Repositories.");
// Cache any created repositories so that we can pass out references to them.
$this->_createdRepositories = array();
$schemaMgr = Services::getService("SchemaManager");
$ids = Services::getService("Id");
$recordStructureId = $ids->getId("edu.middlebury.harmoni.repository.asset_content");
$recordDesc = "A RecordStructure for the generic content of an asset.";
if (!$schemaMgr->schemaExists($recordStructureId->getIdString())) {
// Create the Schema
$schema = new Schema($recordStructureId->getIdString(), "Repository Asset Content", 1, $recordDesc);
$schema->addField(new SchemaField("Content", "Content", "blob", "The binary content of the Asset"));
$schemaMgr->synchronize($schema);
// The SchemaManager only allows you to use Schemas created by it for use with Records.
$schema = $schemaMgr->getSchemaByID($recordStructureId->getIdString());
debug::output("RecordStructure is being created from Schema with Id: '" . $schema->getID() . "'");
$nullRepositoryId = $ids->getId('null');
$this->_createdRecordStructures[$schema->getID()] = new HarmoniRecordStructure($this, $schema, $nullRepositoryId);
// Add the parts to the schema
// $partStructureType = new Type("Repository", "edu.middlebury.harmoni", "Blob", "");
// $this->_createdRecordStructures[$schema->getID()]->createPartStructure(
// "Content",
// "The binary content of the Asset",
// $partStructureType,
// FALSE,
// FALSE,
// FALSE,
// $ids->getId("edu.middlebury.harmoni.repository.asset_content.Content")
// );
}
}
示例2: debug_action
function debug_action($action, $parm1 = '', $parm2 = '', $parm3 = '')
{
static $debug;
if ($action == 'init') {
$debug = new debug($parm1);
} elseif ($action == 'time') {
$debug->settime($parm1);
} elseif ($action == 'message') {
$debug->setmessage($parm1, $parm2, $parm3);
} elseif ($action == 'report') {
$debug->report();
}
}
示例3: display
/**
* 引用模板
* @param $template 模板
* @param $cacheTime 是否使用静态缓存,等于0时不使用,大于0时为缓存时间
* @param $cacheKey 静态缓存KEY
*/
public function display($template, $cacheTime = false, $cacheKey = false)
{
$path['template_c'] = $this->get_path($template, 'view_c');
$path['template'] = $this->get_path($template);
//当缓存时间未设置时,将自动获取配置中的缓存时间
$cache = $cacheTime ? intval($cacheTime) : Config::template('view_cache_time');
$kVar = empty($cacheKey) ? null : $cacheKey;
if (file_exists($path['template'])) {
//如果已编译模板的不存在或者模板修改时间大于已编译模板的时间将重新编译
if (!file_exists($path['template_c']) || filemtime($path['template']) > filemtime($path['template_c'])) {
$this->write($path['template_c'], $this->template_parse(file_get_contents($path['template'])));
}
if ($cache > 0 && Config::template('view_cache')) {
if (!Cache::is_cache($this->get_temp_name($template, $cacheKey), Config::template('view_cache_dir'))) {
self::cache_compile($path['template_c'], $cacheKey);
debug::add('写入缓存\'<strong>' . $template . $kVar . '</strong>\'缓存时间:' . $cache . '秒。');
} elseif (Cache::time($this->get_temp_name($template, $cacheKey), Config::config('view_cache_dir')) + $cache > time() && filemtime($path['template']) < Cache::time($this->get_temp_name($template, $cacheKey), Config::config('view_cache_dir'))) {
echo Cache::get($this->get_temp_name($template, $cacheKey), Config::config('view_cache_dir'));
debug::add('读取缓存\'<strong>' . $template . '[' . $kVar . ']' . '</strong>缓存时间:' . $cache . '秒。');
} else {
self::cache_compile($path['template_c'], $cacheKey);
debug::add('更新缓存\'<strong>' . $template . '[' . $kVar . ']' . '</strong>缓存时间:' . $cache . '秒。');
}
} else {
foreach ($this->var as $k => $v) {
${$k} = $v;
}
include $path['template_c'];
//echo htmlspecialchars($this->template_parse(file_get_contents($path['template'])));
debug::add('使用模板\'<strong>' . $template . '</strong>\'未使用缓存。');
}
} else {
debug::add('模板<strong>' . $path['template'] . '</strong>不存在。');
}
}
示例4: write
function write($log_file_data, $string)
{
$log_dir = $log_file_data[0];
$log_name = $log_file_data[1];
$file_name = $log_dir . $log_name;
if (!is_dir($log_dir)) {
fs::mkdir($log_dir, 0775, true);
}
$oldumask = @umask(0);
$file_existed = @file_exists($file_name);
$log_file = @fopen($file_name, 'a');
if ($log_file) {
$time = strftime("%b %d %Y %H:%M:%S", strtotime('now'));
$notice = '[ ' . $time . " ]\n";
$user =& user::instance();
if (($user_id = $user->get_id()) != DEFAULT_USER_ID) {
$notice .= '[ ' . $user_id . ' ] [ ' . $user->get_login() . ' ] [ ' . $user->get_email() . ' ] ';
}
$notice .= '[' . sys::client_ip() . '] [' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . "]\n" . $string . "\n\n";
@fwrite($log_file, $notice);
@fclose($log_file);
if (!$file_existed) {
@chmod($file_name, 0664);
}
@umask($oldumask);
$result = true;
} else {
@umask($oldumask);
$result = false;
debug::write_error("Cannot open log file '{$file_name}' for writing\n" . "The web server must be allowed to modify the file.\n" . "File logging for '{$file_name}' is disabled.", __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, false);
}
return $result;
}
示例5: init
public static function init()
{
/*
* Zuordnung der Prozessart
* -> Unterscheidung zwischen CLI-
* und Browser-Aufruf
*/
self::$proc = "browser";
if (defined('STDIN')) {
self::$proc = "cli";
}
self::$config_file = ROOT_DIR . "etc/config.php";
if (!file_exists(self::$config_file)) {
throw new Exception("Konfigurations-Datei " . self::$config_file . " nicht gefunden!");
} else {
require_once self::$config_file;
}
/*
* Zuordnung der Konfigurations-Werte
*/
self::$debug = $debug;
self::$debug_file = $debug_file;
self::$web_root = $web_root;
self::$db_host = $db_host;
self::$db_name = $db_name;
self::$db_user = $db_user;
self::$db_pass = $db_pass;
debug::init();
// debug::add_info("(" . __FILE__ . ")<b>" . __CLASS__ . "</b>::" . __FUNCTION__ . "(): Konfigurations-Datei eingelesen.");
}
示例6: generate_contents
function generate_contents(&$code)
{
parent::generate_contents($code);
if (isset($this->attributes['navigator'])) {
if ($navigator =& $this->parent->find_child($this->attributes['navigator'])) {
$limit = $code->get_temp_variable();
$code->write_php('$' . $limit . '= ' . $navigator->get_component_ref_code() . '->get_items_per_page();');
$code->write_php($this->get_component_ref_code() . '->set_parameter("limit", $' . $limit . ');');
$code->write_php('if(isset($_GET["page_' . $navigator->get_server_id() . '"])){');
$code->write_php($this->get_component_ref_code() . '->set_parameter("offset", ($_GET["page_' . $navigator->get_server_id() . '"]-1)*$' . $limit . ');');
$code->write_php('}');
}
}
$targets = explode(',', $this->attributes['target']);
foreach ($targets as $target) {
if ($target_component =& $this->parent->find_child(trim($target))) {
$code->write_php($target_component->get_component_ref_code() . '->register_dataset(' . $this->get_component_ref_code() . '->get_dataset());');
} else {
debug::write_error('component target not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('target' => $target));
}
}
if (isset($this->attributes['navigator']) && $navigator) {
$code->write_php($navigator->get_component_ref_code() . '->set_total_items(' . $this->get_component_ref_code() . '->get_total_count());');
}
}
示例7: _valid_perform
function _valid_perform(&$request, &$response)
{
$data = $this->dataspace->export();
$request->set_status(REQUEST_STATUS_FAILURE);
if($request->has_attribute('popup'))
$response->write(close_popup_response($request));
if(!isset($data['ids']) || !is_array($data['ids']))
return;
$objects = $this->_get_objects_to_delete(array_keys($data['ids']));
foreach($objects as $id => $item)
{
if($item['delete_status'] !== 0 )
continue;
$site_object =& wrap_with_site_object($item);
if(!$site_object->delete())
{
debug :: write_error("object couldn't be deleted",
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array('node_id' => $id));
return;
}
}
$request->set_status(REQUEST_STATUS_SUCCESS);
$response->write(close_popup_response($request));
}
示例8: run
function run(&$filter_chain, &$request, &$response)
{
debug::add_timing_point('authentication filter started');
if (!($object_data = fetch_requested_object($request))) {
if (!($node = map_request_to_node($request))) {
if (defined('ERROR_DOCUMENT_404')) {
$response->redirect(ERROR_DOCUMENT_404);
} else {
$response->header("HTTP/1.1 404 Not found");
}
return;
}
$response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
return;
}
$object =& wrap_with_site_object($object_data);
$site_object_controller =& $object->get_controller();
if (($action = $site_object_controller->determine_action($request)) === false) {
debug::write_error('"' . $action . '" action not found', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__);
if (defined('ERROR_DOCUMENT_404')) {
$response->redirect(ERROR_DOCUMENT_404);
} else {
$response->header("HTTP/1.1 404 Not found");
}
debug::add_timing_point('authentication filter finished');
$filter_chain->next();
return;
}
$actions = $object->get_attribute('actions');
if (!isset($actions[$action])) {
$response->redirect('/root/login?redirect=' . urlencode($_SERVER['REQUEST_URI']));
}
debug::add_timing_point('authentication filter finished');
$filter_chain->next();
}
示例9: _update_media_record
function _update_media_record($id, $tmp_file_path, $file_name, $mime_type)
{
if (!file_exists($tmp_file_path)) {
debug::write_error('file doesnt exist', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('tmp' => $tmp_file_path));
return false;
}
if (function_exists('md5_file')) {
$etag = md5_file($tmp_file_path);
} else {
$fd = fopen($data['tmp_name'], 'rb');
$contents = fread($fd, filesize($tmp_file_path));
fclose($fd);
$etag = md5($contents);
}
if (!is_dir(MEDIA_DIR)) {
dir::mkdir(MEDIA_DIR, 777, true);
}
if (!copy($tmp_file_path, MEDIA_DIR . $id . '.media')) {
debug::write_error('temporary file copy failed', __FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__, array('src' => $tmp_file_path, 'dst' => MEDIA_DIR . $id . '.media'));
return false;
}
$media_db_table = db_table_factory::instance('media');
$media_db_table->update_by_id($id, array('file_name' => $file_name, 'mime_type' => $mime_type, 'size' => filesize($tmp_file_path), 'etag' => $etag));
return true;
}
示例10: error
function error($description, $error_place='', $params=array())
{
if(isset($GLOBALS['error_recursion']) && $GLOBALS['error_recursion'])
die();
$GLOBALS['error_recursion'] = true;
if(defined('DEVELOPER_ENVIROMENT'))
{
trigger_error('error', E_USER_WARNING);
echo( $description . '<br>' . $error_place . '<br><pre>');
print_r($params);
echo('</pre>');
}
$description = $description . "\n\nback trace:\n" . get_trace_back();
rollback_user_transaction();
debug :: set_message_output(DEBUG_OUTPUT_MESSAGE_STORE | DEBUG_OUTPUT_MESSAGE_SEND);
debug :: write_error($description, $error_place, $params);
if (debug :: is_console_enabled())
{
debug :: write_error($description, $error_place, $params);
echo debug :: parse_console();
}
ob_end_flush();
exit;
}
示例11: _displayBrowse
function _displayBrowse($path, &$root_group, &$current_group)
{
if ($root_group != $current_group) {
echo '<p><a href="' . $this->getBaseURL() . '?browse=' . $path . '/..">Back</a></p>';
}
if (is_a($current_group, 'LimbGroupTest')) {
$group_tests = $current_group->getTestCasesHandles();
} else {
$group_tests = array();
}
$buffer = "<br><a href='" . $this->getBaseURL() . "?perform={$path}&back=1'>Run all tests from this group</a>\n";
$buffer .= "<p>Available test groups in '" . $current_group->getLabel() . "':</p>\n";
if (sizeof($group_tests)) {
$buffer .= "<ul>";
foreach ($group_tests as $index => $group_test) {
resolve_handle($group_test);
if (!is_a($group_test, 'LimbGroupTest')) {
$buffer .= "<li><a href='" . $this->getBaseURL() . "?perform={$path}/{$index}'>P</a> " . $group_test->getLabel() . "</li>\n";
} else {
$buffer .= "<li><a href='" . $this->getBaseURL() . "?perform={$path}/{$index}'>P</a> <a href='" . $this->getBaseURL() . "?browse={$path}/{$index}'>B</a> " . $group_test->getLabel() . "</li>\n";
}
}
$buffer .= "</ul>\n";
} else {
$buffer .= "<p>No groups available.</p> \n";
}
echo $buffer;
echo debug::parse_html_console();
}
示例12: save
public function save()
{
$db = database::get_instance();
if (count($this->changed_entries) > 0) {
$tmp = array();
$bool = false;
foreach ($this->changed_entries as $name) {
if ($name == "table") {
continue;
}
if ($name == "{$this->table}_id") {
$bool = true;
}
$value = $this->entries[$name] === 'NULL' || $this->entries[$name] === null ? "NULL" : "'" . $db->escape($this->entries[$name]) . "'";
$tmp[] = "`{$name}` = {$value}";
}
if ($bool == false && isset($this->entries["{$this->table}_id"])) {
$tmp[] = "`{$this->table}_id` = '" . $db->escape($this->entries["{$this->table}_id"]) . "'";
}
$sql = "INSERT INTO `{$this->table}` SET " . implode(",", $tmp) . " ON DUPLICATE\n\t\t\t\t\t\t\tKEY UPDATE " . implode(",", $tmp) . ";";
debug::add_info("(" . __FILE__ . ")<b>" . __CLASS__ . "</b>::" . __FUNCTION__ . "(): \$sql:<br /><pre>{$sql}</pre>");
$result = $db->query($sql);
if (!isset($this->entries["{$this->table}_id"])) {
$this->entries["{$this->table}_id"] = $db->insert_id();
}
$this->reset();
}
return;
}
示例13: clearfieldcache
function clearfieldcache($showoutput = false)
{
$fieldsToClear = array();
$fieldsForEach = Config::inst()->get("MenuCache", "fields");
foreach ($fieldsForEach as $key => $field) {
$fieldName = self::field_maker($key);
$fieldsToClear[] = "\"" . $fieldName . "\" = ''";
}
if (count($fieldsToClear)) {
$tablesForEach = Config::inst()->get("MenuCache", "tables_to_clear");
foreach ($tablesForEach as $table) {
$msg = '';
$sql = "UPDATE \"" . $table . "\" SET " . implode(", ", $fieldsToClear);
if (Controller::curr()->getRequest()->param("ID") == "days" && ($days = intval(Controller::curr()->getRequest()->param("OtherID")))) {
$sql .= ' WHERE \\"LastEdited\\" > ( NOW() - INTERVAL ' . $days . ' DAY )';
$msg .= ', created before the last ' . $days . ' days';
} elseif (Controller::curr()->getRequest()->param("ID") == "thispage") {
$sql .= " WHERE \"" . $table . "\".\"ID\" = " . $this->owner->ID;
$msg .= ', for page with ID = ' . $this->owner->ID;
}
if ($showoutput) {
DB::alteration_message("Deleting cached data from {$table}, " . $msg);
debug::show($sql);
}
DB::query($sql);
}
}
return array();
}
示例14: post
/**
* Nutzer einloggen und Session erzeugen
*
* @return Array Nutzer oder Fehler
*/
public function post()
{
$data = $this->getData();
if (!is_array($data)) {
return $this->error(500);
}
$loginData = array('username' => $data['username'], 'uident_text' => $data['password'], 'status' => 'login');
// PID-Check (bbt-user sollen getrennt sein)
$GLOBALS['user']->checkPid = true;
$GLOBALS['user']->checkPid_value = $this->getConfigOption('userPID');
debug::log('user checkpid: ' . $GLOBALS['user']->checkPid);
$info = $GLOBALS['user']->getAuthInfoArray();
debug::log($info);
$user = $GLOBALS['user']->fetchUserRecord($info['db_user'], $loginData['username']);
if (isset($user) && $user != '') {
// User gefunden, jetzt noch Zugangspasswort prüfen
$authBase = new tx_saltedpasswords_sv1();
$ok = $authBase->compareUident($user, $loginData);
if ($ok) {
$GLOBALS['user']->createUserSession($user);
$data = array('Name' => $user['name'], 'Logo' => $user['tx_webetatext_logo'], 'Verified' => $user['tx_webetatext_verified']);
$this->userLogo($data['Logo']);
return $this->success($data);
}
return $this->error(401, 'Authentication failed');
}
return $this->error(401, 'User not found');
}
示例15: resolveApplications
public function resolveApplications()
{
$configs = $this->app['liby.app'];
foreach ((array) $configs as $name => $callable) {
if (!class_exists($callable)) {
throw new \InvalidArgumentException(sprintf('Given class "%s"do not exist!', $callable));
}
$this->configure[$name] = new $callable();
if ($this->configure[$name] instanceof Configure) {
$configure = $this->configure;
$this->parseAppConfigs($this->configure[$name]);
$appConnect = $this;
$this->acme[$name] = function ($name) use($configure, $appConnect) {
$configure[$name]->connect($appConnect->app);
// [Required]
// Set route into application
$configure[$name]->getService();
$configure[$name]->getRoute();
};
} else {
throw new \InvalidArgumentException(sprintf('Given "%s" must by instances of "Liby\\Service\\Interfaces\\Configure"!', $callable));
}
}
\debug::info('Liby execute configs: ', $this->configure);
}