/** * @static * @return AJXP_ShutdownScheduler */ public static function getInstance() { if (self::$instance == null) { self::$instance = new AJXP_ShutdownScheduler(); } return self::$instance; }
/** * Applies a callback node * @static * @param DOMElement|Array $callback The DOM Node or directly an array of attributes * @param String $actionName * @param Array $httpVars * @param Array $fileVars * @param null $variableArgs * @param bool $defer * @throws AJXP_Exception* @internal param \DOMXPath $xPath * @return mixed */ private static function applyCallback($callback, &$actionName, &$httpVars, &$fileVars, &$variableArgs = null, $defer = false) { //Processing if (is_array($callback)) { $plugId = $callback["pluginId"]; $methodName = $callback["methodName"]; } else { $plugId = $callback->getAttribute("pluginId"); $methodName = $callback->getAttribute("methodName"); } $plugInstance = AJXP_PluginsService::findPluginById($plugId); //return call_user_func(array($plugInstance, $methodName), $actionName, $httpVars, $fileVars); // Do not use call_user_func, it cannot pass parameters by reference. if (method_exists($plugInstance, $methodName)) { if ($variableArgs == null) { return $plugInstance->{$methodName}($actionName, $httpVars, $fileVars); } else { if ($defer == true) { AJXP_ShutdownScheduler::getInstance()->registerShutdownEventArray(array($plugInstance, $methodName), $variableArgs); } else { call_user_func_array(array($plugInstance, $methodName), $variableArgs); } } } else { throw new AJXP_Exception("Cannot find method {$methodName} for plugin {$plugId}!"); } }