AppHandler.object
上传用户:xiao730204
上传日期:2007-01-04
资源大小:141k
文件大小:2k
- <?php
- class AppHandler extends BaseObject {
- var $handler_name;
- var $function_action;
- var $include_action;
- var $globals_needed;
- var $autoload;
- var $autoload_file;
- Function AppHandler(
- $handler_name = '', $include_action = '',
- $globals_needed = '', $function_action = '',
- $autoload = '', $autoload_file = '' ) {
- $this->BaseObject( 'AppHandler' );
- $this->handler_name = $handler_name;
- $this->include_action = $include_action;
- $this->globals_needed = $globals_needed;
- $this->function_action = $function_action;
- $this->autoload = $autoload;
- $this->autoload_file = $autoload_file;
- }
- Function Handle( $my_var = '', $other_globals = '') {
- /*
- Load the prereqs first prefer the autoload file
- over the autoload calls themselves =)
- */
- if ( isset( $this->autoload_file ) &&
- file_exists( $this->autoload_file ) ) {
- include( $this->autoload_file );
- } else {
- if ( is_array( $this->autoload ) ) {
- for( $i = 0; $i < count( $this->autoload ); $i++ ) {
- AutoLoad( $this->autoload[ $i ] );
- }
- }
- }
- /* Include in the globals needed */
- if ( is_array( $other_globals ) ) {
- for( $i = 0; $i < count( $other_globals ); $i++ ) {
- $var_name = $other_globals[ $i ];
- $temp_script .= ' global $' . $var_name . '; ';
- }
- }
- if ( is_array( $this->globals_needed ) ) {
- for( $i = 0; $i < count( $this->globals_needed ); $i++ ) {
- $var_name = $this->globals_needed[ $i ];
- $temp_script .= ' global $' . $var_name . '; ';
- }
- }
- if ( isset( $this->function_action ) && $this->function_action != '') {
- $temp_script .= $this->function_action . '( "' . $my_var . '" );';
- }
- //echo( $this->include_action );
- if ( file_exists( $this->include_action ) ) {
- $temp_script .= 'include( "' . $this->include_action . '" );';
- }
- //echo( $temp_script );
- eval( $temp_script );
- }
- }
- ?>