00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 include_once( "lib/ezutils/classes/ezdebug.php" );
00039
00040 class eZProcess
00041 {
00042 function eZProcess()
00043 {
00044 }
00045
00046 function run( $file, $Params = array(), $params_as_var = false )
00047 {
00048 if ( isset( $this ) and
00049 get_class( $this ) == "ezprocess" )
00050 $instance =& $this;
00051 else
00052 $instance =& eZProcess::instance();
00053 return $instance->runFile( $Params, $file, $params_as_var );
00054 }
00055
00056
00057
00058
00059 function &runFile( &$Params, $file, $params_as_var )
00060 {
00061 if ( $params_as_var )
00062 {
00063 foreach ( $Params as $key => $dummy )
00064 {
00065 if ( $key != "Params" and
00066 $key != "this" and
00067 $key != "file" and
00068 !is_numeric( $key ) )
00069 ${$key} =& $Params[$key];
00070 }
00071 }
00072
00073 if ( file_exists( $file ) )
00074 {
00075
00076 $includeResult = include( $file );
00077 if ( !isset( $Result ) and $includeResult != 1 )
00078 $Result = $includeResult;
00079 }
00080 else
00081 eZDebug::writeWarning( "PHP script $file does not exist, cannot run.",
00082 "eZProcess" );
00083 return $Result;
00084 }
00085
00086 function &instance()
00087 {
00088 $instance =& $GLOBALS["eZProcessInstance"];
00089 if ( get_class( $instance ) != "ezprocess" )
00090 {
00091 $instance = new eZProcess();
00092 }
00093 return $instance;
00094 }
00095 }
00096
00097 ?>