[Cs-content-commits] SF.net SVN: cs-content:[421] trunk/1.0/cs_siteConfig.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2009-08-06 19:38:55
|
Revision: 421 http://cs-content.svn.sourceforge.net/cs-content/?rev=421&view=rev Author: crazedsanity Date: 2009-08-06 19:38:47 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Allow prefixes to be automatically set when defining constants. cs_siteConfig.class.php: * parse_config(): -- add "isset()" for attribute checks to avoid PHP warnings -- when SETCONSTANT is an attribute, check if SETCONSTANTPREFIX is there so either a specific prefix can be set, or the section's name can be used as the prefix (separated by a "-"). -- NOTE::: when using a specific prefix, it is NOT uppercased. 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-08-06 17:05:18 UTC (rev 420) +++ trunk/1.0/cs_siteConfig.class.php 2009-08-06 19:38:47 UTC (rev 421) @@ -216,7 +216,7 @@ $itemValue = $this->gfObj->mini_parser($itemValue, $parseThis, '{', '}'); } - if($attribs['CLEANPATH']) { + if(isset($attribs['CLEANPATH'])) { $itemValue = $this->fs->resolve_path_with_dots($itemValue); } @@ -225,10 +225,20 @@ $data[$section][$itemName]['value'] = $itemValue; $setVarIndex = $this->setVarPrefix . $itemName; - if($attribs['SETGLOBAL']) { + if(isset($attribs['SETGLOBAL'])) { $GLOBALS[$setVarIndex] = $itemValue; } - if($attribs['SETCONSTANT']) { + if(isset($attribs['SETCONSTANT'])) { + if(isset($attribs['SETCONSTANTPREFIX'])) { + //did they give a specific prefix, or just a number/true? + if(strlen($attribs['SETCONSTANTPREFIX']) == 1) { + $setVarIndex = $section ."-". $setVarIndex; + } + else { + //use the prefix they gave. + $setVarIndex = $attribs['SETCONSTANTPREFIX'] ."-". $setVarIndex; + } + } define($setVarIndex, $itemValue); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |