All pastes #570035 Raw Edit

xajax registerCallableObject hac

public php v1 · immutable
·published 2007-06-16 15:06 UTC
rendered paste body
### xajax.inc.php###############################################function registerCallableObject($oObject,$sIncludeFile=false){		if ( is_string($oObject)) {			$this->aCallableObjects[$oObject] = array();		}		else {			trigger_error("The registerCallableObject method requires a string to be provided", E_USER_WARNING);		}		if ($sIncludeFile) {					if (is_readable($sIncludeFile)) {				$this->aCallableObjects[$oObject]['include'] = $sIncludeFile;			}			else {				trigger_error("The registerCallableObject method requires a readable file to be provided", E_USER_WARNING);			}		}}	### xajaxDefaultRequestProcessorPlugin.inc.php############################################### 		// A function was not found. Let's check callable objects 		if( ($p = strpos($sFunctionName,'_')) !== false) { 			$calledObj = substr($sFunctionName,0, $p)); 						if(isset($aCallableObjects[$calledObj])) {							$calledMethod = substr($sFunctionName,$p );				// Include any external dependencies associated with this object				if (isset($aCallableObjects[$calledObj]['include'])) {					ob_start();					include_once($aCallableObjects[$calledObj]['include']);					ob_end_clean();				}				if (class_exists($calledObj, false)) {					$aCalledObject = new $calledObj;					if (method_exists($aCalledObject, $calledMethod) || method_exists($aCalledObject, "__call")) {						// Attemping to call the object						$objTempResponse = call_user_func_array(array(&$aCalledObject, $calledMethod), $aArgs);						if (!$this->_objXajax->getFlag("allowAllResponseTypes") && !is_a($objTempResponse, 'xajaxResponse')) {							$this->_outputError("No xajaxResponse Was Returned By Method $sFunctionName of " . $calledObject);							return;						}						else if ($this->_objXajax->getFlag("allowAllResponseTypes") && !is_a($objTempResponse, 'xajaxResponse'))						{							print $objTempResponse;								exit;						}						if ($objTempResponse != $objResponse) {							// Load any previous response commands into the new response object							$objTempResponse->loadCommands($objResponse, true);						}						// We're successful; output the response now!						$this->_outputResponse($objTempResponse);						return;					}				}			}		}