}
/**
- * Adds all of the built-in Horde_View_Helpers to this instance
- *
- * @todo We'll come up with a lazy-load strategy in the future.
- */
- public function addBuiltinHelpers()
- {
- $dir = dirname(__FILE__) . '/Helper';
- foreach (new DirectoryIterator($dir) as $f) {
- if ($f->isFile()) {
- $helper = str_replace('.php', '', $f->getFilename());
- if ($helper != 'Base') {
- $this->addHelper($helper);
- }
- }
- }
- }
-
- /**
* Adds to the stack of helpers in LIFO order.
*
* @param Horde_View_Helper $helper The helper instance to add. If this is a
<?php
/**
* Copyright 2007-2008 Maintainable Software, LLC
- * Copyright 2006-2010 The Horde Project (http://www.horde.org/)
+ * Copyright 2006-2009 The Horde Project (http://www.horde.org/)
*
* @author Mike Naberezny <mike@maintainable.com>
* @author Derek DeVries <derek@maintainable.com>
}
/**
+ * Pretty exception dumper.
+ *
+ * Inspired by:
+ * http://www.sitepoint.com/blogs/2006/04/04/pretty-blue-screen/ and
+ * http://www.sitepoint.com/blogs/2006/08/12/pimpin-harrys-pretty-bluescreen/.
+ *
+ * Also see for future ideas:
+ * http://mikenaberezny.com/archives/55
+ *
+ * @param Exception $e
+ */
+ public function dump(Exception $e)
+ {
+ $input = array(
+ 'type' => get_class($e),
+ 'code' => $e->getCode(),
+ 'message' => $e->getMessage(),
+ 'line' => $e->getLine(),
+ 'file' => $e->getFile(),
+ 'trace' => $e->getTrace(),
+ );
+
+ // Store previous output.
+ $previous_output = ob_get_contents();
+
+ $desc = $input['type'] . ' making ' . $_SERVER['REQUEST_METHOD'] . ' request to ' . $_SERVER['REQUEST_URI'];
+ return $this->render('_dump.html.php');
+ }
+
+ /**
* Returns formatted output from var_dump().
*
* Buffers the var_dump output for a variable and applies some
* @param mixed $var variable to dump
* @return string formatted results of var_dump()
*/
- private function _fetch($var)
+ protected function _fetch($var)
{
ob_start();
var_dump($var);
return $output;
}
+ protected function _sub($f)
+ {
+ $loc = '';
+ if (isset($f['class'])) {
+ $loc .= $f['class'] . $f['type'];
+ }
+ if (isset($f['function'])) {
+ $loc .= $f['function'];
+ }
+ if (!empty($loc)) {
+ $loc = htmlspecialchars($loc);
+ $loc = "<strong>$loc</strong>";
+ }
+ return $loc;
+ }
+
+ protected function _clean($line)
+ {
+ $l = trim(strip_tags($line));
+ return $l ? $l : ' ';
+ }
+
+ protected function _parms($f)
+ {
+ if (isset($f['function'])) {
+ try {
+ if (isset($f['class'])) {
+ $r = new ReflectionMethod($f['class'] . '::' . $f['function']);
+ } else {
+ $r = new ReflectionFunction($f['function']);
+ }
+ return $r->getParameters();
+ } catch(Exception $e) {}
+ }
+ return array();
+ }
+
+ protected function _src2lines($file)
+ {
+ $src = nl2br(highlight_file($file, true));
+ return explode('<br />', $src);
+ }
}