cvs: pear /DB_DataObject DataObject.php /DB_DataObject/DataObject Generator.php

From: Date: Sun, 18 Jan 2004 02:48:40 +0000
Subject: cvs: pear /DB_DataObject DataObject.php /DB_DataObject/DataObject Generator.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-15749@lists.php.net to get a copy of this message
alan_k Sat Jan 17 21:48:40 2004 EDT Modified files: /pear/DB_DataObject DataObject.php /pear/DB_DataObject/DataObject Generator.php Log: fix bug #595 - replace non letters with underscore.. Index: pear/DB_DataObject/DataObject.php diff -u pear/DB_DataObject/DataObject.php:1.190 pear/DB_DataObject/DataObject.php:1.191 --- pear/DB_DataObject/DataObject.php:1.190 Sat Jan 17 21:27:06 2004 +++ pear/DB_DataObject/DataObject.php Sat Jan 17 21:48:39 2004 @@ -20,7 +20,7 @@ * @package DB_DataObject * @category DB * - * $Id: DataObject.php,v 1.190 2004/01/18 02:27:06 alan_k Exp $ + * $Id: DataObject.php,v 1.191 2004/01/18 02:48:39 alan_k Exp $ */ /* ===================================================================================== @@ -1986,7 +1986,7 @@ if (empty($_DB_DATAOBJECT['CONFIG'])) { DB_DataObject::_loadConfig(); } - $class = $_DB_DATAOBJECT['CONFIG']['class_prefix'] . ucfirst($table); + $class = $_DB_DATAOBJECT['CONFIG']['class_prefix'] . preg_replace('/[^A-Z]/i','_',ucfirst($table)); $class = (class_exists($class)) ? $class : DB_DataObject::_autoloadClass($class); return $class; } @@ -2016,7 +2016,7 @@ if (empty($_DB_DATAOBJECT['CONFIG'])) { DB_DataObject::_loadConfig(); } - $class = $_DB_DATAOBJECT['CONFIG']['class_prefix'] . ucfirst($table); + $class = $_DB_DATAOBJECT['CONFIG']['class_prefix'] . preg_replace('/[^A-Z]/i','_',ucfirst($table)); $class = (class_exists($class)) ? $class : DB_DataObject::_autoloadClass($class); @@ -2063,7 +2063,7 @@ return false; } - $file = $_DB_DATAOBJECT['CONFIG']['class_location'].'/'.ucfirst($table).".php"; + $file = $_DB_DATAOBJECT['CONFIG']['class_location'].'/'.preg_replace('/[^A-Z]/i','_',ucfirst($table)).".php"; if (!file_exists($file)) { DB_DataObject::raiseError( Index: pear/DB_DataObject/DataObject/Generator.php diff -u pear/DB_DataObject/DataObject/Generator.php:1.45 pear/DB_DataObject/DataObject/Generator.php:1.46 --- pear/DB_DataObject/DataObject/Generator.php:1.45 Sat Jan 17 21:27:07 2004 +++ pear/DB_DataObject/DataObject/Generator.php Sat Jan 17 21:48:40 2004 @@ -14,7 +14,7 @@ // +----------------------------------------------------------------------+ // | Author: Alan Knowles <alan@akbkhome.com> // +----------------------------------------------------------------------+ -// $Id: Generator.php,v 1.45 2004/01/18 02:27:07 alan_k Exp $ +// $Id: Generator.php,v 1.46 2004/01/18 02:48:40 alan_k Exp $ /** * Generation tools for DB_DataObject @@ -375,7 +375,7 @@ */ function generateClasses() { - echo "Generating Class files: \n"; + //echo "Generating Class files: \n"; $options = &PEAR::getStaticProperty('DB_DataObject','options'); $base = $options['class_location']; if (!file_exists($base)) @@ -387,14 +387,13 @@ } foreach($this->tables as $this->table) { - $this->_classInclude = str_replace('_','/',$class_prefix)."/" .ucfirst($this->table); - $this->classname = $class_prefix.ucfirst($this->table); + $this->classname = $class_prefix.preg_replace('/[^A-Z]/i','_',ucfirst($this->table)); $i = ''; - $outfilename = "{$base}/".ucfirst($this->table).".php"; + $outfilename = "{$base}/".preg_replace('/[^A-Z]/i','_',ucfirst($this->table)).".php"; if (file_exists($outfilename)) $i = implode('',file($outfilename)); $out = $this->_generateClassTable($i); - echo "writing $this->classname\n"; + //echo "writing $this->classname\n"; $fh = fopen($outfilename, "w"); fputs($fh,$out); fclose($fh); @@ -598,8 +597,7 @@ } - $this->_classInclude = ''; - $classname = $this->classname = $class_prefix.ucfirst($this->table); + $classname = $this->classname = $class_prefix.preg_replace('/[^A-Z]/i','_',ucfirst($this->table)); $out = $this->_generateClassTable(); //echo $out;

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