diff options
-rw-r--r-- | utils/modules.php | 11 | ||||
-rw-r--r-- | utils/modules/events.php (renamed from utils/events.php) | 26 | ||||
-rw-r--r-- | utils/modules/news.php (renamed from utils/news.php) | 2 | ||||
-rw-r--r-- | utils/pages.php | 11 |
4 files changed, 28 insertions, 22 deletions
diff --git a/utils/modules.php b/utils/modules.php index 6983d6b..62e64d3 100644 --- a/utils/modules.php +++ b/utils/modules.php @@ -1,8 +1,10 @@ <?php +$MODULES_DIR = $UTIL_DIR . "/modules"; + // Module includes -include_once($UTIL_DIR . "/news.php"); -include_once($UTIL_DIR . "/events.php"); +include_once($MODULES_DIR . "/news.php"); +include_once($MODULES_DIR . "/events.php"); $modules = array(); @@ -10,7 +12,6 @@ $newsmodule = new News($DATA_DIR . "/news.xml"); $eventsmodule = new Events($DATA_DIR . "/events.xml"); $modules["news"] = $newsmodule; -$modules["events_coming"] = $eventsmodule; -$modules["events_old"] = $eventsmodule; +$modules["events"] = $eventsmodule; -?>
\ No newline at end of file +?> diff --git a/utils/events.php b/utils/modules/events.php index 2257e33..339102e 100644 --- a/utils/events.php +++ b/utils/modules/events.php @@ -1,6 +1,6 @@ <?php -include_once("convert.php"); +include_once($UTIL_DIR . "/convert.php"); class Event { public $title; @@ -37,17 +37,19 @@ class Events { private $file; private $events = array(); - public function run($module) + public function run($params) { - switch($module) { - case "events_coming": - return $this->showcoming(-1); - break; - - case "events_old": - default: - return $this->showold(-1); - break; + foreach($params as $param) { + switch($param) { + case "coming": + return $this->showcoming(-1); + break; + + case "old": + default: + return $this->showold(-1); + break; + } } } @@ -148,4 +150,4 @@ class Events { } -?>
\ No newline at end of file +?> diff --git a/utils/news.php b/utils/modules/news.php index 0493804..22de6a0 100644 --- a/utils/news.php +++ b/utils/modules/news.php @@ -1,6 +1,6 @@ <?php -include_once("convert.php"); +include_once($UTIL_DIR . "/convert.php"); class NewsEntry { public $title; diff --git a/utils/pages.php b/utils/pages.php index 60156b8..0ab52a8 100644 --- a/utils/pages.php +++ b/utils/pages.php @@ -23,12 +23,15 @@ class Page { $str = Markdown($this->content); - if(preg_match_all("/\[\[([a-zA-Z0-9_]+)\]\]/", $str, $res)) { + if(preg_match_all("/\[\[([\?,a-zA-Z0-9_]+)\]\]/", $str, $res)) { $modulecodes = array_unique($res[1]); foreach($modulecodes as $modulecode) { - if($modules[$modulecode]) { - $modulestr = $modules[$modulecode]->run($modulecode); + $m = explode("?", $modulecode); + $module = $m[0]; + $params = explode(",", $m[1]); + if($modules[$module]) { + $modulestr = $modules[$module]->run($params); } else { $modulestr = "<p><strong>CMS ERROR: Could not find module: [[" . $modulecode . "]]</strong></p>"; } @@ -98,4 +101,4 @@ class Pages { } } -?>
\ No newline at end of file +?> |