Revision: 148
http://cs-webapplibs.svn.sourceforge.net/cs-webapplibs/?rev=148&view=rev
Author: crazedsanity
Date: 2009-09-09 15:30:37 +0000 (Wed, 09 Sep 2009)
Log Message:
-----------
Default to the first section found for cs_siteConfig{}'s main section.
/cs_siteConfig.class.php:
* __construct():
-- ARG CHANGE: DEFAULT VALUE MODIFIED: #2 ($section=null FROM
$section='MAIN').
-- if the section isn't passed, assume the first tag found under the
root element contains the main configuration.
Modified Paths:
--------------
trunk/0.3/cs_siteConfig.class.php
Modified: trunk/0.3/cs_siteConfig.class.php
===================================================================
--- trunk/0.3/cs_siteConfig.class.php 2009-09-08 14:24:15 UTC (rev 147)
+++ trunk/0.3/cs_siteConfig.class.php 2009-09-09 15:30:37 UTC (rev 148)
@@ -73,7 +73,7 @@
* @return NULL (PASS) object successfully created
* @return exception (FAIL) failed to create object (see exception message)
*/
- public function __construct($configFileLocation, $section='MAIN', $setVarPrefix=null) {
+ public function __construct($configFileLocation, $section=null, $setVarPrefix=null) {
$section = strtoupper($section);
$this->setVarPrefix=$setVarPrefix;
@@ -101,6 +101,13 @@
throw new exception(__METHOD__ .": invalid configuration file (". $configFileLocation .")");
}
+ if(is_null($section) || !strlen($section)) {
+ $myData = $this->xmlReader->get_path($this->xmlReader->get_root_element());
+ unset($myData['type'], $myData['attributes']);
+ $myData = array_keys($myData);
+ $section = $myData[0];
+ }
+
if(strlen($section)) {
try {
$this->parse_config();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|