Ejemplo n.º 1
0
 /**
  * Process the incoming Xajax request
  *
  * @return boolean
  */
 public function processRequest()
 {
     if (!$this->canProcessRequest()) {
         return false;
     }
     $aArgs = RequestManager::getInstance()->process();
     // Try to register an instance of the requested class, if it isn't yet
     if (!array_key_exists($this->sRequestedClass, $this->aCallableObjects)) {
         PluginManager::getInstance()->registerClass($this->sRequestedClass);
     }
     if (array_key_exists($this->sRequestedClass, $this->aCallableObjects)) {
         $xCallableObject = $this->aCallableObjects[$this->sRequestedClass];
         if ($xCallableObject->hasMethod($this->sRequestedMethod)) {
             $xCallableObject->call($this->sRequestedMethod, $aArgs);
             return true;
         }
     }
     // Unable to find the requested object or method
     throw new \Xajax\Exception\Error('errors.objects.invalid', array('class' => $this->sRequestedClass, 'method' => $this->sRequestedMethod));
 }
Ejemplo n.º 2
0
 private function __construct()
 {
     $this->aProcessingEvents = array();
     $sTranslationDir = realpath(__DIR__ . '/../translations');
     $sTemplateDir = realpath(__DIR__ . '/../templates');
     Utils\Container::getInstance()->init($sTranslationDir, $sTemplateDir);
     $this->xRequestManager = RequestManager::getInstance();
     $this->xResponseManager = ResponseManager::getInstance();
     $this->xPluginManager = PluginManager::getInstance();
     $this->setDefaultOptions();
     $this->aOptionMappings = array('language' => 'core.language', 'version' => 'core.version', 'characterEncoding' => 'core.encoding', 'decodeUTF8Input' => 'core.decode_utf8', 'requestURI' => 'core.request.uri', 'defaultMode' => 'core.request.mode', 'defaultMethod' => 'core.request.method', 'wrapperPrefix' => array('core.prefix.function', 'core.prefix.class'), 'eventPrefix' => 'core.prefix.event', 'timeout' => 'core.process.timeout', 'cleanBuffer' => 'core.process.clean_buffer', 'exitAllowed' => 'core.process.exit_after', 'errorHandler' => 'core.error.handle', 'logFile' => 'core.error.log_file', 'debug' => 'core.debug.on', 'verboseDebug' => 'core.debug.verbose', 'debugOutputID' => 'js.lib.output_id', 'responseQueueSize' => 'js.lib.queue_size', 'scriptLoadTimeout' => 'js.lib.load_timeout', 'waitCursor' => 'js.lib.show_cursor', 'statusMessages' => 'js.lib.show_status', 'javascript URI' => array('js.app.uri', 'js.lib.uri'), 'javascript Dir' => 'js.app.dir', 'deferScriptGeneration' => array('js.app.export', 'js.app.minify'), 'deferDirectory' => 'js.app.dir', 'scriptDefferal' => 'js.app.options');
 }
Ejemplo n.º 3
0
 /**
  * Process the incoming Xajax request
  *
  * @return boolean
  */
 public function processRequest()
 {
     if (!$this->canProcessRequest()) {
         return false;
     }
     $aArgs = RequestManager::getInstance()->process();
     if (array_key_exists($this->sRequestedFunction, $this->aFunctions)) {
         $this->aFunctions[$this->sRequestedFunction]->call($aArgs);
         return true;
     }
     // Unable to find the requested function
     throw new \Xajax\Exception\Error('errors.functions.invalid', array('name' => $this->sRequestedFunction));
 }
Ejemplo n.º 4
0
 /**
  * Used internally to generate the response headers
  *
  * @return void
  */
 public function sendHeaders()
 {
     $xRequestManager = RequestManager::getInstance();
     if ($xRequestManager->getRequestMethod() == Xajax::METHOD_GET) {
         header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
         header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
         header("Cache-Control: no-cache, must-revalidate");
         header("Pragma: no-cache");
     }
     $sCharacterSet = '';
     $sCharacterEncoding = trim($this->getOption('core.encoding'));
     if ($sCharacterEncoding && strlen($sCharacterEncoding) > 0) {
         $sCharacterSet = '; charset="' . trim($sCharacterEncoding) . '"';
     }
     header('content-type: ' . $this->sContentType . ' ' . $sCharacterSet);
 }