cvs: pear /Config/Config/Container Apache.php

From: Date: Tue, 17 Dec 2002 15:54:54 +0000
Subject: cvs: pear /Config/Config/Container Apache.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7915@lists.php.net to get a copy of this message
mansion Tue Dec 17 10:54:54 2002 EDT Modified files: /pear/Config/Config/Container Apache.php Log: Add reference to config object as parameter because of :: Index: pear/Config/Config/Container/Apache.php diff -u pear/Config/Config/Container/Apache.php:1.3 pear/Config/Config/Container/Apache.php:1.4 --- pear/Config/Config/Container/Apache.php:1.3 Wed Nov 27 12:04:06 2002 +++ pear/Config/Config/Container/Apache.php Tue Dec 17 10:54:50 2002 @@ -15,7 +15,7 @@ // | Author: Bertrand Mansion <bmansion@mamasam.com> | // +----------------------------------------------------------------------+ // -// $Id: Apache.php,v 1.3 2002/11/27 17:04:06 mansion Exp $ +// $Id: Apache.php,v 1.4 2002/12/17 15:54:50 mansion Exp $ require_once('Config.php'); @@ -34,7 +34,7 @@ * @param string $datasrc path to the configuration file * @return mixed returns a PEAR_ERROR, if error occurs or true if ok */ - function &parseDatasrc($datasrc) + function &parseDatasrc($datasrc, &$obj) { if (!is_readable($datasrc)) { return PEAR::raiseError("Datasource file cannot be read.", null, PEAR_ERROR_RETURN); @@ -42,7 +42,7 @@ $lines = file($datasrc); $n = 0; $lastline = ''; - $sections[0] =& $this->container; + $sections[0] =& $obj->container; foreach ($lines as $line) { $n++; if (preg_match('/^\s*[^#](.*)\s*\\$/', $line, $match)) { @@ -91,11 +91,11 @@ * @access public * @return string */ - function toString($configType = 'apache') + function toString($configType = 'apache', $options = array(), &$obj) { static $deep = -1; $ident = ''; - if (!$this->isRoot()) { + if (!$obj->isRoot()) { // no indent for root $deep++; $ident = str_repeat(' ', $deep); @@ -103,36 +103,36 @@ if (!isset($string)) { $string = ''; } - switch ($this->type) { + switch ($obj->type) { case 'blank': $string = "\n"; break; case 'comment': - $string = $ident.'# '.$this->content."\n"; + $string = $ident.'# '.$obj->content."\n"; break; case 'directive': - $string = $ident.$this->name.' '.$this->content."\n"; + $string = $ident.$obj->name.' '.$obj->content."\n"; break; case 'section': - if (!$this->isRoot()) { - $string = $ident.'<'.$this->name; - $string .= ($this->content != '') ? ' '.$this->content.'>' : ' >'; + if (!$obj->isRoot()) { + $string = $ident.'<'.$obj->name; + $string .= ($obj->content != '') ? ' '.$obj->content.'>' : ' >'; $string .= "\n"; } - if (count($this->children) > 0) { - for ($i = 0; $i < count($this->children); $i++) { - $string .= $this->children[$i]->toString($configType); + if (count($obj->children) > 0) { + for ($i = 0; $i < count($obj->children); $i++) { + $string .= $obj->children[$i]->toString($configType, $options); } } - if (!$this->isRoot()) { + if (!$obj->isRoot()) { // object is not root - $string .= $ident.'</'.$this->name.">\n"; + $string .= $ident.'</'.$obj->name.">\n"; } break; default: $string = ''; } - if (!$this->isRoot()) { + if (!$obj->isRoot()) { $deep--; } return $string;

« previous php.pear.cvs (#7915) next »