[Cs-content-commits] SF.net SVN: cs-content:[362] trunk/1.0/cs_siteConfig.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-02-09 20:13:06
|
Revision: 362 http://cs-content.svn.sourceforge.net/cs-content/?rev=362&view=rev Author: crazedsanity Date: 2009-02-09 20:13:02 +0000 (Mon, 09 Feb 2009) Log Message: ----------- Automatically strip leading slashes from vars in config. /cs_siteConfig.class.php: * parse_config(): -- replace "{/" with "{" so replacements still work -- change multiple slashes into single slashes immediately instead of after parsing -- added comments about what the code means & why. Modified Paths: -------------- trunk/1.0/cs_siteConfig.class.php Modified: trunk/1.0/cs_siteConfig.class.php =================================================================== --- trunk/1.0/cs_siteConfig.class.php 2009-02-06 20:40:44 UTC (rev 361) +++ trunk/1.0/cs_siteConfig.class.php 2009-02-09 20:13:02 UTC (rev 362) @@ -180,9 +180,18 @@ $itemValue = $itemValue['value']; if(preg_match("/{/", $itemValue)) { $origVal = $itemValue; + + //remove double-slashes (//) + $itemValue = preg_replace('/[\/]{2,}/', '\/', $itemValue); + + //remove leading slash for string replaces (i.e. "{/MAIN/SITE_ROOT}" becomes "{MAIN/SITE_ROOT}") + $itemValue = preg_replace('/{\//', '{', $itemValue); + + //replace special vars. $itemValue = $this->gfObj->mini_parser($itemValue, $specialVars, '{', '}'); + + //replace internal vars. $itemValue = $this->gfObj->mini_parser($itemValue, $parseThis, '{', '}'); - $itemValue = preg_replace("/[\/]{2,}/", "/", $itemValue); } if($attribs['CLEANPATH']) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |