diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index 5d3f2e143a1..7e9eebf118c 100644 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -37,7 +37,7 @@ require_once($path."../../htdocs/master.inc.php"); // After this $db is a defined handler to database. // Main -$version='1.34'; +$version='3.2'; @set_time_limit(0); $error=0; @@ -127,13 +127,13 @@ else // Define working variables $table=strtolower($table); -$tablenollx=preg_replace('/llx_/i','',$table); -$classname=ucfirst($tablenollx); -$classmin=strtolower($classname); +$tablenoprefix=preg_replace('/'.preg_quote(MAIN_DB_PREFIX).'/i','',$table); +$classname=preg_replace('/_/','',ucfirst($tablenoprefix)); +$classmin=preg_replace('/_/','',strtolower($classname)); // Read skeleton_class.class.php file -$skeletonfile='skeleton_class.class.php'; +$skeletonfile=$path.'skeleton_class.class.php'; $sourcecontent=file_get_contents($skeletonfile); if (! $sourcecontent) { @@ -159,7 +159,7 @@ $targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent); $targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent); // Substitute table name -$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenollx, $targetcontent); +$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent); // Substitute declaration parameters $varprop="\n"; @@ -366,7 +366,7 @@ else $error++; //-------------------------------- // Read skeleton_script.php file -$skeletonfile='skeleton_script.php'; +$skeletonfile=$path.'skeleton_script.php'; $sourcecontent=file_get_contents($skeletonfile); if (! $sourcecontent) { @@ -393,7 +393,7 @@ $targetcontent=preg_replace('/\s*\/\/\.\.\./', '', $targetcontent); $targetcontent=preg_replace('/Put here some comments/','Initialy built by build_class_from_table on '.strftime('%Y-%m-%d %H:%M',mktime()), $targetcontent); // Substitute table name -$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenollx, $targetcontent); +$targetcontent=preg_replace('/MAIN_DB_PREFIX."mytable/', 'MAIN_DB_PREFIX."'.$tablenoprefix, $targetcontent); // Build file $fp=fopen($outfile,"w"); @@ -407,6 +407,6 @@ else $error++; // -------------------- END OF BUILD_CLASS_FROM_TABLE SCRIPT -------------------- -print "You must rename files by removing the 'out.' prefix in their name.\n"; +print "You can now rename generated files by removing the 'out.' prefix in their name and store them in a directory of your choice.\n"; return $error; ?> diff --git a/dev/skeletons/skeleton_class.class.php b/dev/skeletons/skeleton_class.class.php index 6fb509bfc51..e93cea119ff 100644 --- a/dev/skeletons/skeleton_class.class.php +++ b/dev/skeletons/skeleton_class.class.php @@ -20,8 +20,7 @@ * \file dev/skeletons/skeleton_class.class.php * \ingroup mymodule othermodule1 othermodule2 * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) - * \author Put author name here - * \remarks Put here some comments + * Put here some comments */ // Put here all includes required by your class file @@ -33,7 +32,6 @@ /** * \class Skeleton_Class * \brief Put here description of your class - * \remarks Put here some comments */ class Skeleton_Class // extends CommonObject { diff --git a/dev/skeletons/skeleton_page.php b/dev/skeletons/skeleton_page.php index cb3ceda938b..4c9a22b1ecf 100644 --- a/dev/skeletons/skeleton_page.php +++ b/dev/skeletons/skeleton_page.php @@ -20,8 +20,7 @@ * \file dev/skeletons/skeleton_page.php * \ingroup mymodule othermodule1 othermodule2 * \brief This file is an example of a php page - * \author Put author name here - * \remarks Put here some comments + * Put here some comments */ //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); diff --git a/dev/skeletons/skeleton_script.php b/dev/skeletons/skeleton_script.php index 0b9fa343d63..0a0e8ecca04 100644 --- a/dev/skeletons/skeleton_script.php +++ b/dev/skeletons/skeleton_script.php @@ -21,8 +21,7 @@ * \file dev/skeletons/skeleton_script.php * \ingroup mymodule othermodule1 othermodule2 * \brief This file is an example for a command line script - * \author Put author name here - * \remarks Put here some comments + * Put here some comments */ $sapi_type = php_sapi_name();