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