deprecated-1.12.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * Registers a function to handle templates.
  4. *
  5. * Alternative template handlers can be registered to handle
  6. * all output functions. By default, {@link elgg_view()} will
  7. * simply include the view file. If an alternate template handler
  8. * is registered, the view name and passed $vars will be passed to the
  9. * registered function, which is then responsible for generating and returning
  10. * output.
  11. *
  12. * Template handlers need to accept two arguments: string $view_name and array
  13. * $vars.
  14. *
  15. * @warning This is experimental.
  16. *
  17. * @param string $function_name The name of the function to pass to.
  18. *
  19. * @return bool
  20. * @see elgg_view()
  21. * @deprecated 1.12
  22. */
  23. function set_template_handler($function_name) {
  24. elgg_deprecated_notice("Support for custom template handlers will end soon.", "1.12");
  25. global $CONFIG;
  26. if (is_callable($function_name)) {
  27. $CONFIG->template_handler = $function_name;
  28. return true;
  29. }
  30. return false;
  31. }
  32. /**
  33. * Get the views/ directory in which the view might (or might not) be found
  34. *
  35. * E.g. elgg_get_view_location('foo.css') might return "/path/to/mod/example/views/" but the view file
  36. * itself may be at "default/foo.css" or "default/foo.css.php" within that. The function might return the core
  37. * views/ directory if it doesn't know anything about the view.
  38. *
  39. * @warning This doesn't check if the file exists, but only
  40. * constructs (or extracts) the path and returns it.
  41. *
  42. * @param string $view The view.
  43. * @param string $viewtype The viewtype
  44. *
  45. * @return string
  46. * @deprecated 1.12 This function is going away in 2.0.
  47. */
  48. function elgg_get_view_location($view, $viewtype = '') {
  49. elgg_deprecated_notice(__FUNCTION__ . " is going away in 2.0.", "1.12");
  50. return _elgg_services()->views->getViewLocation($view, $viewtype);
  51. }