cvs: pear /Config/Config/Container phpIniFile.php
| From: | Alan Knowles | Date: | Tue, 18 Jun 2002 06:47:41 +0000 |
| Subject: | cvs: pear /Config/Config/Container phpIniFile.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-4668@lists.php.net to get a copy of this message | ||
alan_k Tue Jun 18 02:47:41 2002 EDT
Modified files:
/pear/Config/Config/Container phpIniFile.php
Log:
coding standards complience, added realm feature - this may be usefull for IniFile as well?
Index: pear/Config/Config/Container/phpIniFile.php
diff -u pear/Config/Config/Container/phpIniFile.php:1.2
pear/Config/Config/Container/phpIniFile.php:1.3
--- pear/Config/Config/Container/phpIniFile.php:1.2 Sun Jun 16 11:25:34 2002
+++ pear/Config/Config/Container/phpIniFile.php Tue Jun 18 02:47:41 2002
@@ -15,7 +15,7 @@
// | Authors: Alan Knowles <alan@akbkhome.com> |
// +----------------------------------------------------------------------+
//
-// $Id: phpIniFile.php,v 1.2 2002/06/16 15:25:34 alan_k Exp $
+// $Id: phpIniFile.php,v 1.3 2002/06/18 06:47:41 alan_k Exp $
require_once( "Config/Container.php" ) ;
@@ -30,7 +30,7 @@
*
* @author Alan Knowles <alan@akbkhome.com>
* @access public
-* @version $Id: phpIniFile.php,v 1.2 2002/06/16 15:25:34 alan_k Exp $
+* @version $Id: phpIniFile.php,v 1.3 2002/06/18 06:47:41 alan_k Exp $
* @package Config
*/
@@ -48,7 +48,7 @@
*
* The Data Source can be a string with the file or a array of strings with the files to read,
* so datasrc requires a existing file.
-* The feature-array have to contain the comment char array("cc" => Comment char)
+* The feature-array has to contain the realm (default = '/') eg. array("realm"
=> '/base/of/config/')
*
* @access public
* @param string $datasrc Name of the datasource to parse
@@ -56,7 +56,7 @@
* @return mixed returns a PEAR_ERROR, if error occurs
*/
-function parseInput( $datasrc = "", $feature = array( "cc" => ";")
)
+function parseInput( $datasrc = "", $feature = array( "realm" =>
"/") )
{
// Checking if $datasrc is a array, then call parseInput with
@@ -75,16 +75,16 @@
$this -> datasrc = $datasrc ;
$this -> feature = $feature ;
- if( !file_exists( $datasrc ) )
+ if( !file_exists( $datasrc ) ) {
return new PEAR_Error( "File '".$datasrc."' doesn't
exists!", 31, PEAR_ERROR_RETURN, null, null );
-
+ }
$array = parse_ini_file($datasrc,TRUE);
- if (!$array)
+ if (!$array) {
return new PEAR_Error( "File '".$datasrc."' does not contain
configuration data", 31, PEAR_ERROR_RETURN, null, null );
-
+ }
foreach($array as $block => $items) {
if (!$items) continue;
- $this->data['/'.$block] = $items;
+ $this->data[$feature['realm'].$block] = $items;
}