App.object
上传用户:xiao730204
上传日期:2007-01-04
资源大小:141k
文件大小:2k
- <?php
- class App extends BaseObject {
- var $app_name;
- var $app_description;
- var $handlers;
- var $define_id_prefix;
- var $handler_file;
- var $handler_file_loaded;
- var $default_handler;
- var $globals_needed;
- Function App( $app_name, $app_desc ) {
- $this->BaseObject( 'App' );
- $this->app_name = $app_name;
- $this->app_description = $app_desc;
- $this->handlers = Array();
- $this->globals_needed = Array();
- $this->default_handler = '';
- $this->handler_file = '';
- $this->handler_file_loaded = 0;
- }
- Function AddHandler( $handler_obj ) {
- if ( is_object( $handler_obj ) ) {
- $this->handlers[ $handler_obj->handler_name ] = $handler_obj;
- }
- }
- Function AddDefaultHandler( $handler_obj ) {
- if ( is_object( $handler_obj ) ) {
- $this->default_handler = $handler_obj;
- }
- }
- Function Handle( $my_var = '') {
- //echo( '<!-- APP HANDLE CALLED : ' . $my_var . ' --> ' . "n" );
- $obj_ref = '';
- if (
- isset( $this->handler_file ) &&
- $this->handler_file_loaded == 0 &&
- file_exists( $this->handler_file ) ) {
- include( $this->handler_file );
- $this->handler_file_loaded = 1;
- }
- //echo( $this->app_name . '::Handle : ' . $my_var );
- $obj_ref = $this->handlers[ $my_var ] ;
- if ( ! is_object( $obj_ref ) ) {
- if ( is_object( $this->default_handler ) ) {
- //echo( 'Trig default handler : ' . $my_var );
- $this->default_handler->Handle(
- 'DEFAULT', $this->globals_needed
- );
- }
- return 0;
- }
- $obj_ref->Handle( $my_var, $this->globals_needed );
- return 0;
- }
- Function GenerateHandle( $handle_name ) {
- return $this->app_name . '_' . $handle_name;
- }
- }
- ?>