[ Index ] |
|
Code source de e107 0.7.8 |
1 <?php 2 /* 3 + ----------------------------------------------------------------------------+ 4 | e107 website system 5 | 6 | ©Steve Dunstan 2001-2002 7 | http://e107.org 8 | jalist@e107.org 9 | 10 | Released under the terms and conditions of the 11 | GNU General Public License (http://gnu.org). 12 | 13 | $Source: /cvsroot/e107/e107_0.7/e107_handlers/override_class.php,v $ 14 | $Revision: 1.6 $ 15 | $Date: 2006/10/06 23:43:03 $ 16 | $Author: mrpete $ 17 +----------------------------------------------------------------------------+ 18 */ 19 20 if (!defined('e107_INIT')) { exit; } 21 22 /* 23 * USAGE 24 * In user code, to override an existing function... 25 * 26 * $override->override_function('original_func_name','mynew_function_name',['optional_include_file_from_root']); 27 * 28 * In e107 code... 29 * if ($over_func_name = $override->override_check('original_func_name')) { 30 * $result=call_user_func($over_func_name, params...); 31 * } 32 * 33 */ 34 35 class override { 36 var $functions = array(); 37 var $includes = array(); 38 39 function override_function($override, $function, $include) { 40 if ($include) { 41 $this->includes[$override] = $include; 42 } 43 else if (isset($this->includes[$override])) { 44 unset($this->includes[$override]); 45 } 46 $this->functions[$override] = $function; 47 } 48 49 function override_check($override) { 50 if (isset($this->includes[$override])) { 51 if (file_exists($this->includes[$override])) { 52 include_once($this->includes[$override]); 53 } 54 if (function_exists($this->functions[$override])) { 55 return $this->functions[$override]; 56 } else { 57 return false; 58 } 59 } else { 60 return false; 61 } 62 } 63 } 64 65 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Apr 1 01:23:32 2007 | par Balluche grâce à PHPXref 0.7 |