inspect.php 978 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Inspect View
  4. *
  5. * Inspect global variables of Elgg
  6. */
  7. $inspect_type = get_input('inspect_type');
  8. $method = 'get' . str_replace(' ', '', $inspect_type);
  9. $view_name = "admin/develop_tools/inspect/" . strtolower(str_replace(' ', '', $inspect_type));
  10. $inspector = new \Elgg\Debug\Inspector();
  11. if (!elgg_view_exists($view_name) || !method_exists($inspector, $method)) {
  12. forward('admin', '404');
  13. }
  14. switch ($inspect_type) {
  15. case 'Views':
  16. $viewtypes = $inspector->getViewtypes();
  17. $viewtype = get_input('type', 'default');
  18. if (!in_array($viewtype, $viewtypes)) {
  19. forward('admin', '404');
  20. }
  21. $data = $inspector->getViews($viewtype);
  22. $page = elgg_view($view_name, array(
  23. "data" => $data,
  24. "viewtypes" => $viewtypes,
  25. "viewtype" => $viewtype,
  26. ));
  27. break;
  28. default:
  29. $data = $inspector->$method();
  30. $page = elgg_view($view_name, array(
  31. "data" => $data,
  32. ));
  33. break;
  34. }
  35. echo '<p>' . elgg_echo('developers:inspect:help') . '</p>';
  36. echo $page;