| @@ -1,7 +1,28 @@ | ||
| 1 | 1 | <?php namespace simplehtmldom; |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | + * Website: http://sourceforge.net/projects/simplehtmldom/ | |
| 5 | + * Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/) | |
| 6 | + * | |
| 7 | + * Licensed under The MIT License | |
| 8 | + * See the LICENSE file in the project root for more information. | |
| 9 | + * | |
| 10 | + * Authors: | |
| 11 | + * S.C. Chen | |
| 12 | + * John Schlick | |
| 13 | + * Rus Carroll | |
| 14 | + * logmanoriginal | |
| 15 | + * | |
| 16 | + * Contributors: | |
| 17 | + * Yousuke Kumakura | |
| 18 | + * Vadim Voituk | |
| 19 | + * Antcs | |
| 20 | + * | |
| 21 | + * Version $Rev$ | |
| 22 | + */ | |
| 23 | + | |
| 24 | +/** | |
| 4 | 25 | * Implements functions for debugging purposes. Debugging can be enabled and |
| 5 | 26 | * disabled on demand. Debug messages are send to error_log by default but it |
| 6 | 27 | * is also possible to register a custom debug handler. |
| 7 | 28 | */ |
| @@ -58,9 +79,9 @@ | ||
| 58 | 79 | */ |
| 59 | 80 | private static function log_trace($message, $backtrace) |
| 60 | 81 | { |
| 61 | 82 | $idx = 0; |
| 62 | - $debugmessage = ''; | |
| 83 | + $debugMessage = ''; | |
| 63 | 84 | |
| 64 | 85 | foreach($backtrace as $caller) |
| 65 | 86 | { |
| 66 | 87 | if (!isset($caller['file']) && !isset($caller['line'])) { |
| @@ -66,12 +87,12 @@ | ||
| 66 | 87 | if (!isset($caller['file']) && !isset($caller['line'])) { |
| 67 | 88 | break; // Unknown caller |
| 68 | 89 | } |
| 69 | 90 | |
| 70 | - $debugmessage .= ' [' . $caller['file'] . ':' . $caller['line']; | |
| 91 | + $debugMessage .= ' [' . $caller['file'] . ':' . $caller['line']; | |
| 71 | 92 | |
| 72 | 93 | if ($idx > 1) { // Do not include the call to Debug::log |
| 73 | - $debugmessage .= ' ' | |
| 94 | + $debugMessage .= ' ' | |
| 74 | 95 | . $caller['class'] |
| 75 | 96 | . $caller['type'] |
| 76 | 97 | . $caller['function'] |
| 77 | 98 | . '()'; |
| @@ -76,17 +97,19 @@ | ||
| 76 | 97 | . $caller['function'] |
| 77 | 98 | . '()'; |
| 78 | 99 | } |
| 79 | 100 | |
| 80 | - $debugmessage .= ']'; | |
| 101 | + $debugMessage .= ']'; | |
| 81 | 102 | |
| 82 | 103 | // Stop at the first caller that isn't part of simplehtmldom |
| 83 | 104 | if (!isset($caller['class']) || strpos($caller['class'], 'simplehtmldom\\') !== 0) { |
| 84 | 105 | break; |
| 85 | 106 | } |
| 107 | + | |
| 108 | + $idx++; | |
| 86 | 109 | } |
| 87 | 110 | |
| 88 | - $output = '[DEBUG] ' . trim($debugmessage) . ' "' . $message . '"'; | |
| 111 | + $output = '[DEBUG] ' . trim($debugMessage) . ' "' . $message . '"'; | |
| 89 | 112 | |
| 90 | 113 | if (is_null(self::$debugHandler)) { |
| 91 | 114 | error_log($output); |
| 92 | 115 | } else { |
| @@ -97,9 +120,9 @@ | ||
| 97 | 120 | /** |
| 98 | 121 | * Adds a debug message to error_log if debug mode is enabled. Does nothing |
| 99 | 122 | * if debug mode is disabled. |
| 100 | 123 | * |
| 101 | - * @param string $text The message to add to error_log | |
| 124 | + * @param string $message The message to add to error_log | |
| 102 | 125 | */ |
| 103 | 126 | public static function log($message) |
| 104 | 127 | { |
| 105 | 128 | if (!self::isEnabled()) return; |
| @@ -111,9 +134,9 @@ | ||
| 111 | 134 | /** |
| 112 | 135 | * Adds a debug message to error_log if debug mode is enabled. Does nothing |
| 113 | 136 | * if debug mode is disabled. Each message is logged only once. |
| 114 | 137 | * |
| 115 | - * @param string $text The message to add to error_log | |
| 138 | + * @param string $message The message to add to error_log | |
| 116 | 139 | */ |
| 117 | 140 | public static function log_once($message) |
| 118 | 141 | { |
| 119 | 142 | if (!self::isEnabled()) return; |