legacy.inc 925 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * Legacy state manager for Panels.
  4. *
  5. * Checks all possible ways (using discovery of patterned method names) in which
  6. * Panels may need to operate in legacy mode,
  7. * sets variables as appropriate, and returns an informational
  8. *
  9. */
  10. class PanelsLegacyState {
  11. var $legacy = NULL;
  12. function t() {
  13. $func = get_t();
  14. $args = func_get_args();
  15. return call_user_func_array($func, $args);
  16. }
  17. function getStatus() {
  18. if (!isset($this->legacy)) {
  19. $this->determineStatus();
  20. }
  21. return $this->legacy;
  22. }
  23. /**
  24. * Run all compatibility checks.
  25. */
  26. function determineStatus() {
  27. $this->legacy = array();
  28. foreach(get_class_methods($this) as $method) {
  29. if (strtolower(substr($method, 0, 5)) == 'check') {
  30. $this->legacy[$method] = $this->$method();
  31. }
  32. }
  33. $this->legacy = array_filter($this->legacy);
  34. }
  35. // At this time there are no legacy checks.
  36. }