legacy.inc 999 B

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