Linux multi-monitor fullscreen support
[ryzomcore.git] / web / public_php / webtt / cake / libs / overloadable_php4.php
blob894265ca96256d2330cf260e587cad1f9ba20d9a
1 <?php
2 /**
3 * Overload abstraction interface. Merges differences between PHP4 and 5.
5 * PHP versions 4 and 5
7 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
8 * Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
10 * Licensed under The MIT License
11 * Redistributions of files must retain the above copyright notice.
13 * @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
14 * @link http://cakephp.org CakePHP(tm) Project
15 * @package cake
16 * @subpackage cake.cake.libs
17 * @since CakePHP(tm) v 1.2
18 * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
21 /**
22 * Overloadable class selector
24 * Load the interface class based on the version of PHP.
26 * @package cake
27 * @subpackage cake.cake.libs
29 class Overloadable extends Object {
31 /**
32 * Constructor.
34 * @access private
36 function __construct() {
37 $this->overload();
38 parent::__construct();
41 /**
42 * Overload implementation.
44 * @access public
46 function overload() {
47 if (function_exists('overload')) {
48 if (func_num_args() > 0) {
49 foreach (func_get_args() as $class) {
50 if (is_object($class)) {
51 overload(get_class($class));
52 } elseif (is_string($class)) {
53 overload($class);
56 } else {
57 overload(get_class($this));
62 /**
63 * Magic method handler.
65 * @param string $method Method name
66 * @param array $params Parameters to send to method
67 * @param mixed $return Where to store return value from method
68 * @return boolean Success
69 * @access private
71 function __call($method, $params, &$return) {
72 if (!method_exists($this, 'call__')) {
73 trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
75 $return = $this->call__($method, $params);
76 return true;
79 Overloadable::overload('Overloadable');
81 /**
82 * Overloadable2 class selector
84 * Load the interface class based on the version of PHP.
86 * @package cake
87 * @subpackage cake.cake.libs
89 class Overloadable2 extends Object {
91 /**
92 * Constructor
94 * @access private
96 function __construct() {
97 $this->overload();
98 parent::__construct();
102 * Overload implementation.
104 * @access public
106 function overload() {
107 if (function_exists('overload')) {
108 if (func_num_args() > 0) {
109 foreach (func_get_args() as $class) {
110 if (is_object($class)) {
111 overload(get_class($class));
112 } elseif (is_string($class)) {
113 overload($class);
116 } else {
117 overload(get_class($this));
123 * Magic method handler.
125 * @param string $method Method name
126 * @param array $params Parameters to send to method
127 * @param mixed $return Where to store return value from method
128 * @return boolean Success
129 * @access private
131 function __call($method, $params, &$return) {
132 if (!method_exists($this, 'call__')) {
133 trigger_error(sprintf(__('Magic method handler call__ not defined in %s', true), get_class($this)), E_USER_ERROR);
135 $return = $this->call__($method, $params);
136 return true;
140 * Getter.
142 * @param mixed $name What to get
143 * @param mixed $value Where to store returned value
144 * @return boolean Success
145 * @access private
147 function __get($name, &$value) {
148 $value = $this->get__($name);
149 return true;
153 * Setter.
155 * @param mixed $name What to set
156 * @param mixed $value Value to set
157 * @return boolean Success
158 * @access private
160 function __set($name, $value) {
161 $this->set__($name, $value);
162 return true;
165 Overloadable::overload('Overloadable2');