summaryrefslogtreecommitdiff
path: root/inc/common.php
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2010-03-10 10:41:32 +0100
committerAdrian Lang <lang@cosmocode.de>2010-03-10 10:53:49 +0100
commitfe17917e7668864526ec0f0ae65dd0787831d8a4 (patch)
tree667b9cf4605536b83b1949bd2f4d105f38c78176 /inc/common.php
parent8d67c48ac883f874037848be833920f4a6426995 (diff)
downloadrpg-fe17917e7668864526ec0f0ae65dd0787831d8a4.tar.gz
rpg-fe17917e7668864526ec0f0ae65dd0787831d8a4.tar.bz2
Move & rename HTML_PAGE_FROMTEMPLATE to common.php
The new COMMON_PAGE_FROMTEMPLATE is triggered by pageTemplate AFTER the template has been read but before performing the template replacements.
Diffstat (limited to 'inc/common.php')
-rw-r--r--inc/common.php17
1 files changed, 12 insertions, 5 deletions
diff --git a/inc/common.php b/inc/common.php
index 0d5efbee9..6601ae478 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -809,14 +809,16 @@ function rawWiki($id,$rev=''){
/**
* Returns the pagetemplate contents for the ID's namespace
*
+ * @triggers COMMON_PAGE_FROMTEMPLATE
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function pageTemplate($data){
- $id = $data[0];
+function pageTemplate($id){
global $conf;
- $path = dirname(wikiFN($id));
+ if (is_array($id)) $id = $id[0];
+ $path = dirname(wikiFN($id));
+ $tpl = '';
if(@file_exists($path.'/_template.txt')){
$tpl = io_readFile($path.'/_template.txt');
}else{
@@ -830,15 +832,20 @@ function pageTemplate($data){
$path = substr($path, 0, strrpos($path, '/'));
}
}
- return isset($tpl) ? parsePageTemplate($tpl, $id) : '';
+ $data = compact('tpl', 'id');
+ trigger_event('COMMON_PAGE_FROMTEMPLATE', $data, 'parsePageTemplate', true);
+ return $data['tpl'];
}
/**
* Performs common page template replacements
+ * This is the default action for COMMON_PAGE_FROMTEMPLATE
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function parsePageTemplate($tpl, $id) {
+function parsePageTemplate($data) {
+ extract($data);
+
global $USERINFO;
global $conf;