Adding language settings to config.php so that people can control the language output...
[viewsvn.git] / includes / imaginary.php
1 <?php
2 /*=====================================================================*\
3 || ###################################################################
4 || # ViewSVN [#]version[#]
5 || # Copyright ©2002-[#]year[#] Blue Static
6 || #
7 || # This program is free software; you can redistribute it and/or modify
8 || # it under the terms of the GNU General Public License as published by
9 || # the Free Software Foundation; version [#]gpl[#] of the License.
10 || #
11 || # This program is distributed in the hope that it will be useful, but
12 || # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 || # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 || # more details.
15 || #
16 || # You should have received a copy of the GNU General Public License along
17 || # with this program; if not, write to the Free Software Foundation, Inc.,
18 || # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
19 || ###################################################################
20 \*=====================================================================*/
21
22 /**
23 * Mimics functions that will later become the language
24 * independence system and error system
25 *
26 * @pacakge ViewSVN
27 */
28
29 /**
30 * Imaginary class that does error reporting and language
31 * independence
32 *
33 * @package ViewSVN
34 * @version $Id$
35 */
36 class Imaginary
37 {
38 /**
39 * Mimics the error reporting function
40 *
41 * @access public
42 *
43 * @param string Error
44 *
45 * @return string Error
46 */
47 function error($error)
48 {
49 global $viewsvn;
50
51 // adapted from PEAR/PHP_Compat
52 if ($viewsvn->debug)
53 {
54 $backtrace = debug_backtrace();
55
56 $calls = array();
57 for ($i = 1; $i < sizeof($backtrace); $i++)
58 {
59 $call = $backtrace["$i"];
60
61 $function = (isset($call['class'])) ? $call['class'] . '.' . $call['function'] : $call['function'];
62
63 $params = '';
64 if (isset($call['args']))
65 {
66 $params = implode(', ', $call['args']);
67 }
68
69 $calls[] = sprintf('#%d : %s(%s) <strong>[%s:%s]</strong>', $i, $function, $params, $call['file'], $call['line']);
70 }
71
72 echo implode('<br />', $calls) . '<br />';
73 }
74
75 trigger_error($error, E_USER_ERROR);
76 }
77 }
78
79 /*=====================================================================*\
80 || ###################################################################
81 || # $HeadURL$
82 || # $Id$
83 || ###################################################################
84 \*=====================================================================*/
85 ?>