From: x2003bruneau Date: Mon, 16 Apr 2007 13:25:15 +0000 (+0000) Subject: Allow {include wiki=Xorg.Machin} in templates to include a wiki page X-Git-Tag: xorg/0.9.14~85 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=7a3f546bc4d1a0577f0ffbc2adf106ddab377749;p=platal.git Allow {include wiki=Xorg.Machin} in templates to include a wiki page git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1705 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/classes/platalpage.php b/classes/platalpage.php index 2550d62..096c39d 100644 --- a/classes/platalpage.php +++ b/classes/platalpage.php @@ -87,6 +87,7 @@ abstract class PlatalPage extends Smarty $this->register_prefilter('trimwhitespace'); $this->register_prefilter('form_force_encodings'); + $this->register_prefilter('wiki_include'); $this->assign('xorg_errors', $this->_errors); $this->assign('xorg_failure', $this->_failure); $this->assign('globals', $globals); @@ -331,6 +332,16 @@ function trimwhitespace($source, &$smarty) } // }}} +// {{{ function wiki_include + +function wiki_include($source, &$smarty) +{ + return preg_replace('/\{include( [^}]*)? wiki=([^} ]+)(.*?)\}/ui', + '{include\1 file="../spool/wiki.d/cache_\2.tpl"\3 included=1}', + $source); +} + +// }}} // {{{ function form_force_encodings($source, &$smarty) diff --git a/templates/emails/antispam.tpl b/templates/emails/antispam.tpl index 060ec90..a57bf27 100644 --- a/templates/emails/antispam.tpl +++ b/templates/emails/antispam.tpl @@ -20,7 +20,7 @@ {* *} {**************************************************************************} -{include file=../spool/wiki.d/cache_Xorg.Antispam.tpl part=1 included=1} +{include wiki=Xorg.Antispam part=1} {javascript name=ajax}