jasteele123

concrete5 tools/dump.php

Oct 16th, 2012
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php /* tools/dump.php - only usable by Super User */
  2. defined('C5_EXECUTE') or die(_('Access Denied.'));
  3. $u = new User();
  4. if(!$u->isSuperUser()) { die(_('Access Denied.')); }
  5.  
  6. function dump($val, $title='') {
  7.     echo '<pre>'. ($title ? '<strong>'. $title. '</strong>: ' : ''). print_r($val, 1). '</pre>';
  8. }
  9.  
  10. function dump_methods($obj, $title='') {
  11.     if(is_object($obj)) {
  12.         $reflect = new ReflectionClass($obj);
  13.         $methods = $reflect->getMethods();
  14.         dump($methods, $title);
  15.     }
  16. }
  17.  
  18. /**
  19.  * Called like this:
  20.  
  21. include 'tools/dump.php';
  22. dump($survey, '$survey Object';
  23. dump_methods($survey, '$survey Methods');
  24.  
  25. */
  26. ?>
Add Comment
Please, Sign In to add comment