1: <?php
2:
3: 4: 5: 6:
7:
8: namespace Nette\Diagnostics;
9:
10: use Nette;
11: use Tracy;
12:
13:
14: 15: 16:
17: class Helpers extends Tracy\Helpers
18: {
19:
20: 21: 22: 23:
24: public static function editorLink($file, $line = NULL)
25: {
26: if (Debugger::$editor && is_file($file)) {
27: $dir = dirname(strtr($file, '/', DIRECTORY_SEPARATOR));
28: $base = isset($_SERVER['SCRIPT_FILENAME']) ? dirname(dirname(strtr($_SERVER['SCRIPT_FILENAME'], '/', DIRECTORY_SEPARATOR))) : dirname($dir);
29: if (substr($dir, 0, strlen($base)) === $base) {
30: $dir = '...' . substr($dir, strlen($base));
31: }
32: return Nette\Utils\Html::el('a')
33: ->href(strtr(Debugger::$editor, array('%file' => rawurlencode($file), '%line' => $line)))
34: ->title("$file:$line")
35: ->setHtml(htmlSpecialChars(rtrim($dir, DIRECTORY_SEPARATOR), ENT_IGNORE) . DIRECTORY_SEPARATOR . '<b>' . htmlSpecialChars(basename($file), ENT_IGNORE) . '</b>' . ($line ? ":$line" : ''));
36: } else {
37: return Nette\Utils\Html::el('span')->setText($file . ($line ? ":$line" : ''));
38: }
39: }
40:
41: public static function htmlDump($var)
42: {
43: trigger_error(__METHOD__ . '() is deprecated; use Tracy\Dumper::toHtml() instead.', E_USER_DEPRECATED);
44: return Tracy\Dumper::toHtml($var);
45: }
46:
47: public static function clickableDump($var)
48: {
49: trigger_error(__METHOD__ . '() is deprecated; use Tracy\Dumper::toHtml() instead.', E_USER_DEPRECATED);
50: return Tracy\Dumper::toHtml($var);
51: }
52:
53: public static function textDump($var)
54: {
55: trigger_error(__METHOD__ . '() is deprecated; use Tracy\Dumper::toText() instead.', E_USER_DEPRECATED);
56: return Tracy\Dumper::toText($var);
57: }
58:
59: }
60: