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


PHP YDDebugUtil::debug方法代码示例

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


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

示例1: finish

 /**
  *	This is the function we use for finishing the request.
  *
  *	@internal
  */
 function finish()
 {
     // Mark that the request is processed
     define('YD_REQ_PROCESSED', 1);
     // Stop the timer
     $elapsed = $GLOBALS['timer']->getElapsed();
     // Total size of include files
     $includeFiles = get_included_files();
     // Calculate the total size
     $includeFilesSize = 0;
     $includeFilesWithSize = array();
     foreach ($includeFiles as $key => $includeFile) {
         $includeFilesSize += filesize($includeFile);
         $includeFilesWithSize[filesize($includeFile)] = realpath($includeFile);
     }
     $includeFilesSize = YDStringUtil::formatFileSize($includeFilesSize);
     // Sort the list of include files by file size
     krsort($includeFilesWithSize);
     // Convert to a string
     $includeFiles = array();
     foreach ($includeFilesWithSize as $size => $file) {
         array_push($includeFiles, YDStringUtil::formatFileSize($size) . "\t  " . $file);
     }
     // Show debugging info if needed
     if (YD_DEBUG == 1) {
         // Create the debug messages
         $debug = "\n\n";
         $debug .= 'Processing time: ' . $elapsed . ' ms' . "\n\n";
         $debug .= 'Total size include files: ' . $includeFilesSize . "\n\n";
         $debug .= 'Included files: ' . "\n\n\t" . implode("\n\t", $includeFiles) . "\n\n";
         // If there is a database instance
         $debug .= 'Number of SQL queries: ' . sizeof($GLOBALS['YD_SQL_QUERY']) . "\n\n";
         // Add the queries if any
         if (sizeof($GLOBALS['YD_SQL_QUERY']) > 0) {
             $debug .= 'Executed SQL queries: ' . "\n\n";
             foreach ($GLOBALS['YD_SQL_QUERY'] as $key => $query) {
                 $debug .= "\t" . ($key + 1) . ': ' . trim($query) . "\n\n";
             }
         }
         // Output the debug message
         YDDebugUtil::debug($debug);
     } else {
         // Short version
         echo "\n" . '<!-- ' . $elapsed . ' ms / ' . $includeFilesSize . ' -->';
     }
     // Stop the execution of the request
     die;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:53,代码来源:YDExecutor.php

示例2: findSql

 /**
  *  This function execute the SQL statement passed and adds it's
  *  results to the object.
  *
  *  @param $sql      The SQL statement.
  *  @param $slices   (optional) The slices of the query.
  *
  *  @returns  The number of records found.
  */
 function findSql($sql, $slices = array())
 {
     YDDebugUtil::debug(YDStringUtil::removeWhiteSpace($sql));
     $fetch = YDConfig::get('YD_DB_FETCHTYPE');
     YDConfig::set('YD_DB_FETCHTYPE', YD_DB_FETCH_NUM);
     $results = $this->_db->getRecords($sql);
     YDConfig::set('YD_DB_FETCHTYPE', $fetch);
     if (!sizeof($slices)) {
         $slices = array(0 => '');
     }
     reset($slices);
     $var = current($slices);
     while ($var !== false) {
         $curr_pos = key($slices);
         $next = next($slices);
         $next_pos = $next ? key($slices) : false;
         if (!$var) {
             $obj =& $this;
         } else {
             $obj =& $this->{$var};
         }
         $obj->resetResults();
         $obj->_count = $results ? sizeof($results) : 0;
         $select = $obj->_query->select;
         foreach ($results as $result) {
             if (!$next_pos) {
                 $next_pos = sizeof($result);
             }
             $length = $next_pos - $curr_pos;
             $res = array_slice($result, $curr_pos, $length);
             $new_res = array();
             for ($i = 0; $i < sizeof($res); $i++) {
                 $new_res[$select[$i]['alias']] = $res[$i];
             }
             $obj->_results[] = $new_res;
         }
         $obj->resetQuery();
         if ($obj->_count >= 1) {
             $obj->setValues($obj->_results[0]);
         }
         $var = current($slices);
     }
     return $this->_count;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:53,代码来源:YDDatabaseObject.php

示例3: delete

 /**
  *  This function executes an DELETE query based on the values of the object
  *  or any condition set by addWhere and addOrder.
  *
  *  @returns  The number of rows affected.
  */
 function delete()
 {
     $this->__sql->setAction('DELETE');
     $this->__sql->resetFrom();
     $this->__sql->addTable($this->getTable());
     $this->_prepareQuery($this, true);
     $where = $this->__sql->getWhere(false);
     $order = $this->__sql->getOrder();
     $this->resetQuery();
     YDDebugUtil::debug('YDDatabaseObject ' . $this->getClassName() . YDDebugUtil::r_dump($this->getValues()));
     // Not secure if no conditions...
     if (!strlen(trim($where)) && !YDConfig::get('YD_DATABASEOBJECT_DELETE')) {
         trigger_error('YDDatabaseObject delete - ' . $this->getClassName() . ' - 
                             Your DELETE query has no conditions and will not be executed.', YD_NOTICE);
         return;
     }
     $result = $this->__db->executeDelete($this->getTable(), $where . $order);
     $this->__count = (int) $result;
     YDDebugUtil::debug(end($GLOBALS['YD_SQL_QUERY']));
     return $this->__count;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:27,代码来源:YDDatabaseObject.php

示例4: toArray

 /**
  *	This function will return the form as an array.
  *
  *	@returns	The form as an array.
  */
 function toArray()
 {
     // Start with an empty array
     $form = array();
     // Add the list of attributes
     $attribs = array('name' => $this->_name, 'id' => $this->_name, 'method' => strtoupper($this->_method), 'action' => $this->_action, 'target' => $this->_target);
     $attribs = array_merge($this->_attributes, $attribs);
     $form['attribs'] = $this->_convertToHtmlAttrib($attribs);
     $form['tag'] = '<form' . $form['attribs'] . '>';
     $form['requirednote'] = $this->_requiredNote;
     // Add the errors
     $form['errors'] = $this->_errors;
     // Loop over the list of elements
     foreach ($this->_elements as $name => $element) {
         // Update the value
         $element->_value = $this->getValue($name);
         // Add the form element
         $form[$name] = $element->toArray();
         // Add errors if any
         if (array_key_exists($name, $this->_errors)) {
             $form[$name]['error'] = $this->_errors[$name];
         } else {
             $form[$name]['error'] = '';
         }
         // Check if the field is required
         if (array_key_exists($name, $this->_rules)) {
             $form[$name]['required'] = true;
         } else {
             $form[$name]['required'] = false;
         }
     }
     // If debugging, show contents
     if (YD_DEBUG) {
         YDDebugUtil::debug(YDDebugUtil::r_dump($form));
     }
     // Return the form array
     return $form;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:43,代码来源:YDForm.php

示例5: finish

 /**
  *	This is the function we use for finishing the request.
  *
  *	@internal
  */
 function finish()
 {
     // Mark that the request is processed
     define('YD_REQ_PROCESSED', 1);
     // Stop the timer
     $GLOBALS['timer']->finish();
     // Output visible debug info as a comment
     if (YDConfig::get('YD_DEBUG') == 1) {
         // Total size of include files
         $includeFiles = get_included_files();
         // Calculate the total size
         $includeFilesSize = 0;
         $includeFilesWithSize = array();
         foreach ($includeFiles as $key => $includeFile) {
             if (is_file($includeFile)) {
                 $includeFilesSize += filesize($includeFile);
                 $includeFilesWithSize[filesize($includeFile)] = realpath($includeFile);
             }
         }
         $includeFilesSize = YDStringUtil::formatFileSize($includeFilesSize);
         // Sort the list of include files by file size
         krsort($includeFilesWithSize);
         // Convert to a string
         $includeFiles = array();
         foreach ($includeFilesWithSize as $size => $file) {
             array_push($includeFiles, YDStringUtil::formatFileSize($size) . "\t  " . realpath($file));
         }
         // Create the debug messages
         $debug = YD_CRLF . YD_CRLF . YD_FW_NAMEVERS . ' DEBUG INFORMATION ' . YD_CRLF . YD_CRLF;
         // Create the timings report
         $debug .= 'PROCESSING TIME:' . YD_CRLF . YD_CRLF;
         $debug .= "    Elapsed\t  Diff\t  Marker" . YD_CRLF;
         $timings = $GLOBALS['timer']->getReport();
         foreach ($timings as $timing) {
             $debug .= "    " . $timing[0] . ' ms' . "\t  " . $timing[1] . ' ms' . "\t  " . $timing[2] . YD_CRLF;
         }
         $debug .= YD_CRLF;
         // Create the include file details
         $debug .= 'INCLUDED FILES (' . sizeof($includeFiles) . ' files - ' . $includeFilesSize . ')' . YD_CRLF . YD_CRLF;
         $debug .= "    " . implode("\n    ", $includeFiles) . YD_CRLF . YD_CRLF;
         // Add the queries if any
         if (sizeof($GLOBALS['YD_SQL_QUERY']) > 0) {
             $debug .= 'EXECUTED SQL QUERIES (' . sizeof($GLOBALS['YD_SQL_QUERY']) . ' queries)' . YD_CRLF . YD_CRLF;
             foreach ($GLOBALS['YD_SQL_QUERY'] as $key => $query) {
                 $debug .= "    " . '---- SQL QUERY ' . ($key + 1) . ' ----' . YD_CRLF;
                 foreach (explode(YD_CRLF, trim($query['trace'])) as $line) {
                     $debug .= "    " . rtrim($line) . YD_CRLF;
                 }
                 $debug .= YD_CRLF . "    SQL Query:" . YD_CRLF;
                 foreach (explode(YD_CRLF, trim($query['sql'])) as $line) {
                     $debug .= "        " . rtrim($line) . YD_CRLF;
                 }
                 $debug .= YD_CRLF . "    Query Time: " . $query['time'] . ' ms' . YD_CRLF;
                 $debug .= YD_CRLF;
             }
         }
         // Output the debug message
         YDDebugUtil::debug($debug);
     }
     // Output visible debug info
     if (YDConfig::get('YD_DEBUG') == 2) {
         // Total size of include files
         $includeFiles = get_included_files();
         // Calculate the total size
         $includeFilesSize = 0;
         $includeFilesWithSize = array();
         foreach ($includeFiles as $key => $includeFile) {
             if (is_file($includeFile)) {
                 $includeFilesSize += filesize($includeFile);
                 $includeFilesWithSize[filesize($includeFile)] = realpath($includeFile);
             }
         }
         $includeFilesSize = YDStringUtil::formatFileSize($includeFilesSize);
         // Sort the list of include files by file size
         krsort($includeFilesWithSize);
         // Get the timing report
         $timings = $GLOBALS['timer']->getReport();
         // The font to use for the debug output
         $font = ' style="font-family: Arial, Helvetica, sans-serif; text-align: left; vertical-align: top;"';
         // Include the needed libraries
         $debug = '';
         // Create the output
         $debug .= '<br clear="all"/><hr size="1"/>';
         $debug .= '<p ' . $font . '><b>' . YD_FW_NAMEVERS . ' Debug Information</b></p>';
         // Add the processing time
         $debug .= '<p ' . $font . '><i>Processing time</i></p>';
         $debug .= '<dd><p><table width="90%" border="1" cellspacing="0" cellpadding="2">';
         $debug .= sprintf('<tr><th %s>Elapsed</th><th %s>Diff</th><th %s>Marker</th></tr>', $font, $font, $font);
         foreach ($timings as $timing) {
             $debug .= sprintf('<tr><td %s>%s ms</td><td %s>%s ms</td><td %s>%s</td></tr>', $font, $timing[0], $font, $timing[1], $font, $timing[2]);
         }
         $debug .= '</table></p></dd>';
         // Add the included files
         $debug .= '<p ' . $font . '><i>Included files (' . $includeFilesSize . ')</i></p>';
         $debug .= '<dd><p><table width="90%" border="1" cellspacing="0" cellpadding="2">';
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:101,代码来源:YDF2_init.php

示例6: finish

 /**
  *	This is the function we use for finishing the request.
  *
  *	@internal
  */
 function finish()
 {
     // Mark that the request is processed
     define('YD_REQ_PROCESSED', 1);
     // Stop the timer
     $GLOBALS['timer']->finish();
     // Show debugging info if needed
     if (YDConfig::get('YD_DEBUG') == 1 || YDConfig::get('YD_DEBUG') == 2) {
         // Total size of include files
         $includeFiles = get_included_files();
         // Calculate the total size
         $includeFilesSize = 0;
         $includeFilesWithSize = array();
         foreach ($includeFiles as $key => $includeFile) {
             $includeFilesSize += filesize($includeFile);
             $includeFilesWithSize[filesize($includeFile)] = realpath($includeFile);
         }
         $includeFilesSize = YDStringUtil::formatFileSize($includeFilesSize);
         // Sort the list of include files by file size
         krsort($includeFilesWithSize);
         // Convert to a string
         $includeFiles = array();
         foreach ($includeFilesWithSize as $size => $file) {
             array_push($includeFiles, YDStringUtil::formatFileSize($size) . "\t  " . realpath($file));
         }
         // Create the debug messages
         $debug = YD_CRLF . YD_CRLF;
         // Create the timings report
         $debug .= 'Processing time(s):' . YD_CRLF . YD_CRLF;
         $debug .= "\tElapsed\t  Diff\t  Marker" . YD_CRLF;
         $timings = $GLOBALS['timer']->getReport();
         foreach ($timings as $timing) {
             $debug .= "\t" . $timing[0] . ' ms' . "\t  " . $timing[1] . ' ms' . "\t  " . $timing[2] . YD_CRLF;
         }
         $debug .= YD_CRLF;
         // Create the include file details
         $debug .= 'Total size include files: ' . $includeFilesSize . YD_CRLF . YD_CRLF;
         $debug .= 'Included files: ' . YD_CRLF . YD_CRLF . "\t" . implode("\n\t", $includeFiles) . YD_CRLF . YD_CRLF;
         // Create the list of include directories
         $debug .= 'Includes search path:' . YD_CRLF . YD_CRLF;
         foreach (explode(YD_PATHDELIM, ini_get('include_path')) as $path) {
             if (realpath($path)) {
                 $debug .= "\t" . realpath($path) . YD_CRLF;
             } else {
                 $debug .= "\t" . $path . YD_CRLF;
             }
         }
         $debug .= YD_CRLF;
         // If there is a database instance
         $debug .= 'Number of SQL queries: ' . sizeof($GLOBALS['YD_SQL_QUERY']) . YD_CRLF . YD_CRLF;
         // Add the queries if any
         if (sizeof($GLOBALS['YD_SQL_QUERY']) > 0) {
             $debug .= 'Executed SQL queries: ' . YD_CRLF . YD_CRLF;
             foreach ($GLOBALS['YD_SQL_QUERY'] as $key => $query) {
                 $debug .= "\t" . ($key + 1) . ': ' . trim($query) . YD_CRLF . YD_CRLF;
             }
         }
         // Output the debug message
         YDDebugUtil::debug($debug);
     }
     // Add the elapsed time
     $elapsed = $elapsed = $GLOBALS['timer']->getElapsed();
     echo YD_CRLF . '<!-- ' . $elapsed . ' ms -->';
     // Stop the execution of the request
     die;
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:71,代码来源:YDF2_process.php

示例7: debug

 function debug($action, $before)
 {
     YDDebugUtil::debug('This was generated by the callback "debug" ' . ($before ? 'before' : 'after') . ' action "' . $action . '" was executed.');
 }
开发者ID:BackupTheBerlios,项目名称:ydframework-svn,代码行数:4,代码来源:group.php


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