1: <?php
2:
3: function rulesList() {
4: global $_zp_conf_vars;
5: list($pluginDefinitions, $rules) = getRules();
6: $definitions = $pluginDefinitions;
7: $list = array();
8: $break = false;
9:
10: foreach ($rules as $rule) {
11: if ($rule = trim($rule)) {
12: if ($rule{0} == '#') {
13: if (trim(ltrim($rule, '#')) == 'Quick links') {
14: foreach ($pluginDefinitions as $def => $v) {
15: $list[] = array('Define ', $def, $v);
16: }
17: }
18: if ($break) {
19: $list[] = $break;
20: } else {
21: $break = array(' ', '', ' ');
22: }
23: $list[] = array($rule, '', ' ');
24: } else {
25: if (preg_match('~^rewriterule~i', $rule)) {
26:
27: $rule = strtr($rule, $definitions);
28: preg_match('~^rewriterule\s+(.*?)\s+(.*?)\s*\[(.*)\]$~i', $rule, $matches);
29: if (array_key_exists(1, $matches)) {
30: $parts = preg_split('`\s+`', $rule);
31: $part1 = $parts[1];
32: $parts = array_slice($parts, 2);
33: $list[] = array('rewriterule', $part1, implode(' ', $parts));
34: } else {
35: $list[] = array(gettext('Error processing rewrite rule:'), '', $rule);
36: }
37: } else {
38: if (preg_match('~define\s+(.*?)\s*\=\>\s*(.*)$~i', $rule, $matches)) {
39:
40: eval('$definitions[$matches[1]] = ' . $matches[2] . ';');
41: $list[] = array('Define', $matches[1], $definitions[$matches[1]]);
42: }
43: }
44: }
45: }
46: }
47: return $list;
48: }
49:
50: ?>