[geeklog-hg] geeklog: Clear out any unused staticpage template variables (if ...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Fri Jun 28 11:48:21 EDT 2013


changeset 9146:a7f5ea25dc40
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/a7f5ea25dc40
user: Tom <websitemaster at cogeco.net>
date: Fri Jun 28 11:40:19 2013 -0400
description:
Clear out any unused staticpage template variables (if using another staticpage as a template). Template variable must follow format {templatevariable} for this to work.

diffstat:

 plugins/staticpages/services.inc.php |  3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diffs (13 lines):

diff -r 85690eec1d00 -r a7f5ea25dc40 plugins/staticpages/services.inc.php
--- a/plugins/staticpages/services.inc.php	Fri Jun 28 09:32:09 2013 -0400
+++ b/plugins/staticpages/services.inc.php	Fri Jun 28 11:40:19 2013 -0400
@@ -751,6 +751,9 @@
             
                 if (PLG_invokeService('staticpages', 'get', $args, $retval, $svc_msg) == PLG_RET_OK) {
                     $retval['sp_content'] = str_replace(array_keys($tag), array_values($tag), $retval['sp_content']);
+                    // Remove any unknown staticpage template variables as long as they use the curly brackets ie {templatevariable}
+                    // If template variable format is different then any unused ones will display
+                    $retval['sp_content'] = preg_replace('/{[^ \t\r\n}]+}/', '', $retval['sp_content']);
                     
                     $output['sp_content'] = $retval['sp_content'];
                 }



More information about the geeklog-cvs mailing list