changing component checks for callbacks from is_callable to method_exists

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7074 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-05-31 09:24:42 +00:00
parent 7ed4665318
commit 1aa6e5c4f4

View file

@ -70,7 +70,7 @@ class Component extends Object {
*/ */
function initialize(&$controller) { function initialize(&$controller) {
foreach ($this->__loaded as $name => $component) { foreach ($this->__loaded as $name => $component) {
if (is_callable(array($component, 'initialize')) && $component->enabled === true) { if (method_exists($component,'initialize') && $component->enabled === true) {
$component->initialize($controller); $component->initialize($controller);
} }
} }
@ -83,7 +83,7 @@ class Component extends Object {
*/ */
function startup(&$controller) { function startup(&$controller) {
foreach ($this->__loaded as $name => $component) { foreach ($this->__loaded as $name => $component) {
if (is_callable(array($component, 'startup')) && $component->enabled === true) { if (method_exists($component,'startup') && $component->enabled === true) {
$component->startup($controller); $component->startup($controller);
} }
} }
@ -96,7 +96,7 @@ class Component extends Object {
*/ */
function beforeRender(&$controller) { function beforeRender(&$controller) {
foreach ($this->__loaded as $name => $component) { foreach ($this->__loaded as $name => $component) {
if (is_callable(array($component, 'beforeRender')) && $component->enabled === true) { if (method_exists($component,'beforeRender') && $component->enabled === true) {
$component->beforeRender($controller); $component->beforeRender($controller);
} }
} }
@ -110,7 +110,7 @@ class Component extends Object {
function beforeRedirect(&$controller, $url, $status = null, $exit = true) { function beforeRedirect(&$controller, $url, $status = null, $exit = true) {
$response = array(); $response = array();
foreach ($this->__loaded as $name => $component) { foreach ($this->__loaded as $name => $component) {
if (is_callable(array($component, 'beforeRender')) && $component->enabled === true) { if (method_exists($component,'beforeRedirect') && $component->enabled === true) {
$resp = $component->beforeRedirect($controller, $url, $status, $exit); $resp = $component->beforeRedirect($controller, $url, $status, $exit);
if ($resp === false) { if ($resp === false) {
return false; return false;
@ -128,7 +128,7 @@ class Component extends Object {
*/ */
function shutdown(&$controller) { function shutdown(&$controller) {
foreach ($this->__loaded as $name => $component) { foreach ($this->__loaded as $name => $component) {
if (is_callable(array($component, 'shutdown')) && $component->enabled === true) { if (method_exists($component,'shutdown') && $component->enabled === true) {
$component->shutdown($controller); $component->shutdown($controller);
} }
} }