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 class Overloadable extends Object {
00034
00035
00036
00037
00038
00039 function __construct() {
00040 $this->overload();
00041 parent::__construct();
00042 }
00043
00044
00045
00046
00047
00048 function overload() {
00049 if (function_exists('overload')) {
00050 if (func_num_args() > 0) {
00051 foreach (func_get_args() as $class) {
00052 if (is_object($class)) {
00053 overload(get_class($class));
00054 } elseif (is_string($class)) {
00055 overload($class);
00056 }
00057 }
00058 } else {
00059 overload(get_class($this));
00060 }
00061 }
00062 }
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 function __call($method, $params, &$return) {
00074 if (!method_exists($this, 'call__')) {
00075 trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
00076 }
00077 $return = $this->call__($method, $params);
00078 return true;
00079 }
00080 }
00081 Overloadable::overload('Overloadable');
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 class Overloadable2 extends Object {
00092
00093
00094
00095
00096
00097 function __construct() {
00098 $this->overload();
00099 parent::__construct();
00100 }
00101
00102
00103
00104
00105
00106 function overload() {
00107 if (function_exists('overload')) {
00108 if (func_num_args() > 0) {
00109 foreach (func_get_args() as $class) {
00110 if (is_object($class)) {
00111 overload(get_class($class));
00112 } elseif (is_string($class)) {
00113 overload($class);
00114 }
00115 }
00116 } else {
00117 overload(get_class($this));
00118 }
00119 }
00120 }
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130 function __call($method, $params, &$return) {
00131 if (!method_exists($this, 'call__')) {
00132 trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
00133 }
00134 $return = $this->call__($method, $params);
00135 return true;
00136 }
00137
00138
00139
00140
00141
00142
00143
00144
00145 function __get($name, &$value) {
00146 $value = $this->get__($name);
00147 return true;
00148 }
00149
00150
00151
00152
00153
00154
00155
00156
00157 function __set($name, $value) {
00158 $this->set__($name, $value);
00159 return true;
00160 }
00161 }
00162 Overloadable::overload('Overloadable2');
00163
00164 ?>