1: <?php
2:
3: require __DIR__ . '/SafeStream/SafeStream.php';
4:
5: Nette\Utils\SafeStream::register();
6:
7:
8: 9: 10: 11:
12:
13: if (!function_exists('dump')) {
14: 15: 16: 17:
18: function dump($var)
19: {
20: array_map('Tracy\Debugger::dump', func_get_args());
21: return $var;
22: }
23: }
24:
25: if (!function_exists('dumpe')) {
26: 27: 28: 29:
30: function dumpe($var)
31: {
32: array_map('Tracy\Debugger::dump', func_get_args());
33: exit;
34: }
35: }
36:
37: if (!function_exists('bdump')) {
38: 39: 40: 41:
42: function bdump($var)
43: {
44: call_user_func_array('Tracy\Debugger::barDump', func_get_args());
45: return $var;
46: }
47: }
48:
49:
50: spl_autoload_register(function ($type) {
51: if (strtolower(ltrim($type, '\\')) === 'nette\object') {
52: $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
53: $message = 'Replace deprecated Nette\Object with trait Nette\SmartObject'
54: . (isset($trace[1]['file']) ? ' in ' . $trace[1]['file'] . ':' . $trace[1]['line'] : '');
55:
56: if (PHP_VERSION_ID < 70200) {
57: trigger_error($message, E_USER_DEPRECATED);
58: class_alias('Nette\LegacyObject', 'Nette\Object');
59: } else {
60: throw new Exception($message);
61: }
62: }
63: });
64:
65:
66: 67: 68: 69:
70:
71: if (!function_exists('dlog')) {
72: 73: 74: 75:
76: function dlog($var = null)
77: {
78: trigger_error(__FUNCTION__ . '() is deprecated.', E_USER_DEPRECATED);
79: if (func_num_args() === 0) {
80: Tracy\Debugger::log(new Exception, 'dlog');
81: }
82: foreach (func_get_args() as $arg) {
83: Tracy\Debugger::log($arg, 'dlog');
84: }
85: return $var;
86: }
87: }
88:
89:
90: if (!function_exists('callback')) {
91: 92: 93: 94: 95: 96: 97:
98: function callback($callback, $m = null)
99: {
100: trigger_error(__FUNCTION__ . '() is deprecated; use native PHP callback.', E_USER_DEPRECATED);
101: return new Nette\Callback($callback, $m);
102: }
103: }
104: