From a8e8cf0295b1d218b817a8cab0b4837450ba4bf4 Mon Sep 17 00:00:00 2001 From: Fernando Ontiveros Date: Tue, 13 Nov 2012 13:48:16 -0400 Subject: [PATCH] SPEEDY adding the autloader feature in class.bootstrap.php --- gulliver/system/class.bootstrap.php | 28 ++++++++- gulliver/system/class.xmlform.php | 11 ++-- .../methods/dynaforms/dynaforms_Save.php | 2 - workflow/public_html/bootstrap.php | 58 +++++++++---------- 4 files changed, 62 insertions(+), 37 deletions(-) diff --git a/gulliver/system/class.bootstrap.php b/gulliver/system/class.bootstrap.php index 9a2681ac2..9efe7f423 100644 --- a/gulliver/system/class.bootstrap.php +++ b/gulliver/system/class.bootstrap.php @@ -8,10 +8,36 @@ class Bootstrap { + static $includeClassPaths = array(); + + protected $relativeIncludePaths = array(); + //below here only approved methods + /* the autoloader functions */ + + static function autoloadClass($class) + { + //error_log( "$class "); + $className = strtolower($class); + if (array_key_exists($className, BootStrap::$includeClassPaths)) { + require_once BootStrap::$includeClassPaths[$className]; + return true; + } else { + //print "$class "; //die; + //print_r ( debug_backtrace(false)); + } + return; + } + + public function registerClass($classname, $includeFile) + { + BootStrap::$includeClassPaths[strtolower($classname)] = $includeFile; + return; + } + /* - * this function still under revision + * these functions still under revision */ public function getSystemConfiguration ($globalIniFile = '', $wsIniFile = '', $wsName = '') { diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index d3f7f33d0..7c451cb7c 100755 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -522,7 +522,6 @@ class XmlForm_Field public function getAttributes () { $attributes = array (); - $json = new Services_JSON(); foreach ($this as $attribute => $value) { switch ($attribute) { case 'sql': @@ -540,7 +539,9 @@ class XmlForm_Field if (sizeof( $attributes ) < 1) { return '{}'; } - return $json->encode( $attributes ); + //$json = new Services_JSON(); + //return $json->encode( $attributes ); + return G::json_encode( $attributes ); } /** @@ -553,7 +554,6 @@ class XmlForm_Field public function getEvents () { $events = array (); - $json = new Services_JSON(); foreach ($this as $attribute => $value) { if (substr( $attribute, 0, 2 ) === 'on') { $events[$attribute] = $value; @@ -562,7 +562,9 @@ class XmlForm_Field if (sizeof( $events ) < 1) { return '{}'; } - return $json->encode( $events ); + //$json = new Services_JSON(); + //return $json->encode( $events ); + return G::json_encode( $events ); } /** @@ -1336,7 +1338,6 @@ class XmlForm_Field_Suggest extends XmlForm_Field_SimpleText //by neyek } $hash = str_rot13( base64_encode( $this->sql . '@|' . $this->sqlConnection ) ); - // $sOptions = 'script:"'.$this->ajaxServer.'?request=suggest&json=true&limit='.$this->maxresults.'&hash='.$hash.'&dependentFields='. $this->dependentFields .'&field=" + getField(\''. $this->name .'\').value + "&",'; $sSQL = $this->sql; $nCount = preg_match_all( '/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE ); diff --git a/workflow/engine/methods/dynaforms/dynaforms_Save.php b/workflow/engine/methods/dynaforms/dynaforms_Save.php index cbc1846b9..89dc6805c 100755 --- a/workflow/engine/methods/dynaforms/dynaforms_Save.php +++ b/workflow/engine/methods/dynaforms/dynaforms_Save.php @@ -30,8 +30,6 @@ if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) { require_once ('classes/model/Dynaform.php'); require_once ('classes/model/Content.php'); -$oJSON = new Services_JSON(); - if (isset( $_POST['function'] )) { $sfunction = $_POST['function']; } elseif (isset( $_POST['functions'] )) { diff --git a/workflow/public_html/bootstrap.php b/workflow/public_html/bootstrap.php index daa25dbcb..c99644570 100755 --- a/workflow/public_html/bootstrap.php +++ b/workflow/public_html/bootstrap.php @@ -1,6 +1,6 @@ call( $controllerAction ); } } else { // classic sysLogin interface - Bootstrap::LoadSystem( 'g'); - Bootstrap::LoadSystem( 'publisher' ); - Bootstrap::LoadSystem( 'xmlform' ); - Bootstrap::LoadSystem( 'form' ); - Bootstrap::LoadSystem( 'menu' ); require_once (PATH_METHODS . "login/sysLogin.php"); die(); } @@ -683,27 +704,6 @@ Bootstrap::LoadSystem( 'rbac' ); $RBAC = &RBAC::getSingleton( PATH_DATA, session_id() ); $RBAC->sSystem = 'PROCESSMAKER'; -Bootstrap::LoadSystem( 'g'); -Bootstrap::LoadSystem( 'publisher' ); -Bootstrap::LoadSystem( 'xmlDocument' ); -Bootstrap::LoadSystem( 'xmlform' ); -Bootstrap::LoadSystem( 'form' ); -Bootstrap::LoadSystem( 'menu' ); - -Bootstrap::LoadSystem( 'templatePower' ); - //Bootstrap::LoadSystem( 'xmlformExtension' ); - //Bootstrap::LoadSystem( "xmlMenu" ); - //Bootstrap::LoadSystem( 'dvEditor' ); - //Bootstrap::LoadSystem( 'httpProxyController' ); - //Bootstrap::LoadSystem( 'pmException' ); - -//Bootstrap::LoadSystem( 'dbconnection' ); -//Bootstrap::LoadSystem( 'dbsession' ); -//Bootstrap::LoadSystem( 'dbrecordset' ); -Bootstrap::LoadSystem( 'dbtable' ); -Bootstrap::LoadClass( 'system' ); - - // define and send Headers for all pages if (! defined( 'EXECUTE_BY_CRON' )) { header( "Expires: " . gmdate( "D, d M Y H:i:s", mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' ) ) ) . " GMT" );