SPEEDY adding the autloader feature in class.bootstrap.php
This commit is contained in:
@@ -8,10 +8,36 @@
|
|||||||
|
|
||||||
class Bootstrap
|
class Bootstrap
|
||||||
{
|
{
|
||||||
|
static $includeClassPaths = array();
|
||||||
|
|
||||||
|
protected $relativeIncludePaths = array();
|
||||||
|
|
||||||
//below here only approved methods
|
//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 = '')
|
public function getSystemConfiguration ($globalIniFile = '', $wsIniFile = '', $wsName = '')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -522,7 +522,6 @@ class XmlForm_Field
|
|||||||
public function getAttributes ()
|
public function getAttributes ()
|
||||||
{
|
{
|
||||||
$attributes = array ();
|
$attributes = array ();
|
||||||
$json = new Services_JSON();
|
|
||||||
foreach ($this as $attribute => $value) {
|
foreach ($this as $attribute => $value) {
|
||||||
switch ($attribute) {
|
switch ($attribute) {
|
||||||
case 'sql':
|
case 'sql':
|
||||||
@@ -540,7 +539,9 @@ class XmlForm_Field
|
|||||||
if (sizeof( $attributes ) < 1) {
|
if (sizeof( $attributes ) < 1) {
|
||||||
return '{}';
|
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 ()
|
public function getEvents ()
|
||||||
{
|
{
|
||||||
$events = array ();
|
$events = array ();
|
||||||
$json = new Services_JSON();
|
|
||||||
foreach ($this as $attribute => $value) {
|
foreach ($this as $attribute => $value) {
|
||||||
if (substr( $attribute, 0, 2 ) === 'on') {
|
if (substr( $attribute, 0, 2 ) === 'on') {
|
||||||
$events[$attribute] = $value;
|
$events[$attribute] = $value;
|
||||||
@@ -562,7 +562,9 @@ class XmlForm_Field
|
|||||||
if (sizeof( $events ) < 1) {
|
if (sizeof( $events ) < 1) {
|
||||||
return '{}';
|
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 ) );
|
$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;
|
$sSQL = $this->sql;
|
||||||
$nCount = preg_match_all( '/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
$nCount = preg_match_all( '/\@(?:([\@\%\#\!Qq])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*?)*)\))/', $sSQL, $match, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE );
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
|
|||||||
require_once ('classes/model/Dynaform.php');
|
require_once ('classes/model/Dynaform.php');
|
||||||
require_once ('classes/model/Content.php');
|
require_once ('classes/model/Content.php');
|
||||||
|
|
||||||
$oJSON = new Services_JSON();
|
|
||||||
|
|
||||||
if (isset( $_POST['function'] )) {
|
if (isset( $_POST['function'] )) {
|
||||||
$sfunction = $_POST['function'];
|
$sfunction = $_POST['function'];
|
||||||
} elseif (isset( $_POST['functions'] )) {
|
} elseif (isset( $_POST['functions'] )) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* sysGeneric.php
|
* Bootstrap.php
|
||||||
*
|
*
|
||||||
* ProcessMaker Open Source Edition
|
* ProcessMaker Open Source Edition
|
||||||
* Copyright (C) 2004 - 2008 Colosa Inc.
|
* Copyright (C) 2004 - 2008 Colosa Inc.
|
||||||
@@ -375,13 +375,39 @@ Bootstrap::LoadThirdParty( 'smarty/libs', 'Smarty.class' );
|
|||||||
//Bootstrap::LoadSystem( 'httpProxyController' );
|
//Bootstrap::LoadSystem( 'httpProxyController' );
|
||||||
//Bootstrap::LoadSystem( 'pmException' );
|
//Bootstrap::LoadSystem( 'pmException' );
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//testing the autoloader feature
|
||||||
|
spl_autoload_register(array(Bootstrap, 'autoloadClass'));
|
||||||
|
Bootstrap::registerClass('headPublisher', PATH_GULLIVER . "class.headPublisher.php");
|
||||||
|
Bootstrap::registerClass('G', PATH_GULLIVER . "class.g.php");
|
||||||
|
Bootstrap::registerClass('publisher', PATH_GULLIVER . "class.publisher.php");
|
||||||
|
Bootstrap::registerClass('xmlform', PATH_GULLIVER . "class.xmlform.php");
|
||||||
|
Bootstrap::registerClass('XmlForm_Field', PATH_GULLIVER . "class.xmlform.php");
|
||||||
|
Bootstrap::registerClass('xmlformExtension', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
|
Bootstrap::registerClass('form', PATH_GULLIVER . "class.form.php");
|
||||||
|
Bootstrap::registerClass('menu', PATH_GULLIVER . "class.menu.php");
|
||||||
|
Bootstrap::registerClass('Xml_Document', PATH_GULLIVER . "class.xmlDocument.php");
|
||||||
|
Bootstrap::registerClass('DBSession', PATH_GULLIVER . "class.dbsession.php");
|
||||||
|
Bootstrap::registerClass('DBConnection', PATH_GULLIVER . "class.dbconnection.php");
|
||||||
|
Bootstrap::registerClass('DBRecordset', PATH_GULLIVER . "class.dbrecordset.php");
|
||||||
|
Bootstrap::registerClass('DBTable', PATH_GULLIVER . "class.dbtable.php");
|
||||||
|
Bootstrap::registerClass('xmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||||
|
Bootstrap::registerClass('XmlForm_Field_XmlMenu', PATH_GULLIVER . "class.xmlMenu.php");
|
||||||
|
Bootstrap::registerClass('XmlForm_Field_HTML', PATH_GULLIVER . "class.dvEditor.php");
|
||||||
|
Bootstrap::registerClass('Controller', PATH_GULLIVER . "class.controller.php");
|
||||||
|
Bootstrap::registerClass('HttpProxyController', PATH_GULLIVER . "class.httpProxyController.php");
|
||||||
|
Bootstrap::registerClass('templatePower', PATH_GULLIVER . "class.templatePower.php");
|
||||||
|
Bootstrap::registerClass('XmlForm_Field_SimpleText', PATH_GULLIVER . "class.xmlformExtension.php");
|
||||||
|
Bootstrap::registerClass('System', PATH_HOME . "engine/classes/class.system.php");
|
||||||
|
|
||||||
|
//Bootstrap::LoadSystem( 'pmException' );
|
||||||
|
|
||||||
// Create headPublisher singleton
|
// Create headPublisher singleton
|
||||||
Bootstrap::LoadSystem( 'headPublisher' );
|
//Bootstrap::LoadSystem( 'headPublisher' );
|
||||||
$oHeadPublisher = & headPublisher::getSingleton();
|
$oHeadPublisher = & headPublisher::getSingleton();
|
||||||
|
|
||||||
// Installer, redirect to install if we don't have a valid shared data folder
|
// Installer, redirect to install if we don't have a valid shared data folder
|
||||||
if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
|
if (! defined( 'PATH_DATA' ) || ! file_exists( PATH_DATA )) {
|
||||||
|
|
||||||
// new installer, extjs based
|
// new installer, extjs based
|
||||||
define( 'PATH_DATA', PATH_C );
|
define( 'PATH_DATA', PATH_C );
|
||||||
require_once (PATH_CONTROLLERS . 'installer.php');
|
require_once (PATH_CONTROLLERS . 'installer.php');
|
||||||
@@ -460,11 +486,6 @@ if (defined( 'SYS_TEMP' ) && SYS_TEMP != '') {
|
|||||||
$controller->call( $controllerAction );
|
$controller->call( $controllerAction );
|
||||||
}
|
}
|
||||||
} else { // classic sysLogin interface
|
} 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");
|
require_once (PATH_METHODS . "login/sysLogin.php");
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
@@ -683,27 +704,6 @@ Bootstrap::LoadSystem( 'rbac' );
|
|||||||
$RBAC = &RBAC::getSingleton( PATH_DATA, session_id() );
|
$RBAC = &RBAC::getSingleton( PATH_DATA, session_id() );
|
||||||
$RBAC->sSystem = 'PROCESSMAKER';
|
$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
|
// define and send Headers for all pages
|
||||||
if (! defined( 'EXECUTE_BY_CRON' )) {
|
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" );
|
header( "Expires: " . gmdate( "D, d M Y H:i:s", mktime( 0, 0, 0, date( 'm' ), date( 'd' ) - 1, date( 'Y' ) ) ) . " GMT" );
|
||||||
|
|||||||
Reference in New Issue
Block a user