cvs: pear /File_IMC/File IMC.php
| From: | Paul Jones | Date: | Thu, 13 Nov 2003 15:06:09 +0000 |
| Subject: | cvs: pear /File_IMC/File IMC.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-14246@lists.php.net to get a copy of this message | ||
pmjones Thu Nov 13 10:06:09 2003 EDT
Modified files:
/pear/File_IMC/File IMC.php
Log:
parse() and build() were not taking the base path into account; added a
$basepath=dirname(__FILE__) to the filename. also, parse() and build() now retrun references to the
created object, not a copy; you should call (e.g.) $parse =& File_IMC::parse('vCard')
now (instead of just '=').
Index: pear/File_IMC/File/IMC.php
diff -u pear/File_IMC/File/IMC.php:1.5 pear/File_IMC/File/IMC.php:1.6
--- pear/File_IMC/File/IMC.php:1.5 Thu Nov 13 09:58:05 2003
+++ pear/File_IMC/File/IMC.php Thu Nov 13 10:06:08 2003
@@ -17,7 +17,7 @@
// | Marshall Roch <mroch@php.net> |
// +----------------------------------------------------------------------+
//
-// $Id: IMC.php,v 1.5 2003/11/13 14:58:05 pmjones Exp $
+// $Id: IMC.php,v 1.6 2003/11/13 15:06:08 pmjones Exp $
/**
@@ -113,8 +113,8 @@
* The only difference is that this package uses a factory pattern:
*
* <code>
-* $parse = File_IMC::parse('vCard');
-* $build = File_IMC::build('vCard', '3.0');
+* $parse =& File_IMC::parse('vCard');
+* $build =& File_IMC::build('vCard', '3.0');
* </code>
* instead of
* <code>
@@ -147,11 +147,12 @@
* @return object
*/
- function build($format, $version = null)
+ function &build($format, $version = null)
{
- $filename = 'File/IMC/Build/'. $format . '.php';
+ $basepath = dirname(__FILE__);
+ $filename = $basepath . '/IMC/Build/'. $format . '.php';
$classname = 'File_IMC_Build_'. $format;
-
+
if (!file_exists($filename)) {
return File_IMC::raiseError(
'No builder driver found for format: ' . $format,
@@ -190,11 +191,12 @@
*
*/
- function parse($format)
+ function &parse($format)
{
- $filename = 'File/IMC/Parse/'. $format . '.php';
+ $basepath = dirname(__FILE__);
+ $filename = $basepath . '/IMC/Parse/'. $format . '.php';
$classname = 'File_IMC_Parse_'. $format;
-
+
if (!file_exists($filename)) {
return File_IMC::raiseError(
'No builder driver exists for format: ' . $format,