2006-07-30 12:24:03 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
/**
|
|
|
|
* Overload abstraction interface. Merges differences between PHP4 and 5.
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
2007-02-02 10:39:45 +00:00
|
|
|
* CakePHP(tm) : Rapid Development Framework <http://www.cakephp.org/>
|
|
|
|
* Copyright 2005-2007, Cake Software Foundation, Inc.
|
2006-07-30 12:24:03 +00:00
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
|
|
|
*
|
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
|
|
|
*
|
|
|
|
* @filesource
|
2007-02-02 10:39:45 +00:00
|
|
|
* @copyright Copyright 2005-2007, Cake Software Foundation, Inc.
|
|
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project
|
2006-07-30 12:24:03 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs
|
2007-02-02 10:39:45 +00:00
|
|
|
* @since CakePHP(tm) v 1.2
|
2006-07-30 12:24:03 +00:00
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* Overloadable class selector
|
|
|
|
*
|
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Load the interface class based on the version of PHP.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
class Overloadable extends Object {
|
|
|
|
|
|
|
|
function __construct() {
|
|
|
|
$this->overload();
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
function overload() {
|
|
|
|
if (function_exists('overload')) {
|
|
|
|
if (func_num_args() > 0) {
|
|
|
|
foreach (func_get_args() as $class) {
|
|
|
|
if (is_object($class)) {
|
|
|
|
overload(get_class($class));
|
|
|
|
} elseif (is_string($class)) {
|
|
|
|
overload($class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
overload(get_class($this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function __call($method, $params, &$return) {
|
2006-12-26 16:17:37 +00:00
|
|
|
if(!method_exists($this, 'call__')) {
|
|
|
|
trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
|
2006-11-25 08:19:51 +00:00
|
|
|
}
|
2006-12-26 16:17:37 +00:00
|
|
|
$return = $this->call__($method, $params);
|
2006-07-30 12:24:03 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Overloadable::overload('Overloadable');
|
|
|
|
|
2006-11-25 08:19:51 +00:00
|
|
|
class Overloadable2 extends Object {
|
|
|
|
|
|
|
|
function __construct() {
|
|
|
|
$this->overload();
|
|
|
|
parent::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
function overload() {
|
|
|
|
if (function_exists('overload')) {
|
|
|
|
if (func_num_args() > 0) {
|
|
|
|
foreach (func_get_args() as $class) {
|
|
|
|
if (is_object($class)) {
|
|
|
|
overload(get_class($class));
|
|
|
|
} elseif (is_string($class)) {
|
|
|
|
overload($class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
overload(get_class($this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function __call($method, $params, &$return) {
|
2006-12-26 16:17:37 +00:00
|
|
|
if(!method_exists($this, 'call__')) {
|
|
|
|
trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
|
2006-11-25 08:19:51 +00:00
|
|
|
}
|
2006-12-26 16:17:37 +00:00
|
|
|
$return = $this->call__($method, $params);
|
2006-11-25 08:19:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function __get($name, &$value) {
|
2006-12-26 16:17:37 +00:00
|
|
|
$value = $this->get__($name);
|
2006-11-25 08:19:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
function __set($name, $value) {
|
2006-12-26 16:17:37 +00:00
|
|
|
$this->set__($name, $value);
|
2006-11-25 08:19:51 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Overloadable::overload('Overloadable2');
|
|
|
|
|
2006-07-30 12:24:03 +00:00
|
|
|
?>
|