コード例 #1
0
ファイル: CallableObject.php プロジェクト: lagdo/xajax-core
 /**
  * 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));
 }
コード例 #2
0
ファイル: Xajax.php プロジェクト: lagdo/xajax-core
 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');
 }
コード例 #3
0
ファイル: start.php プロジェクト: lagdo/xajax-core
/**
 * start.php - 
 *
 * This file is automatically loaded by the Composer autoloader
 *
 * The Xajax global functions are defined here, and the library is initialised.
 *
 * @package xajax-core
 * @author Thierry Feuzeu <*****@*****.**>
 * @copyright 2016 Thierry Feuzeu <*****@*****.**>
 * @license https://opensource.org/licenses/BSD-2-Clause BSD 2-Clause License
 * @link https://github.com/lagdo/xajax-core
 */
/**
 * Translate a text to the selected language
 *
 * @param string        $sText                The text to translate
 * @param array            $aPlaceHolders        The placeholders in the text
 * @param string        $sLanguage            The language to translate to
 *
 * @return string
 */
function xajax_trans($sText, array $aPlaceHolders = array(), $sLanguage = null)
{
    return \Xajax\Utils\Container::getInstance()->getTranslator()->trans($sText, $aPlaceHolders, $sLanguage);
}
/*
 * Load the Xajax request plugins
 */
\Xajax\Plugin\Manager::getInstance()->loadPlugins();
コード例 #4
0
ファイル: Response.php プロジェクト: lagdo/xajax-core
 /**
  * Provides access to registered response plugins
  *
  * Pass the plugin name as the first argument and the plugin object will be returned.
  * You can then access the methods of the plugin directly.
  *
  * @param string        $sName                The name of the plugin
  *
  * @return \Xajax\Plugin\Response
  */
 public function plugin($sName)
 {
     $xPlugin = PluginManager::getInstance()->getResponsePlugin($sName);
     if (!$xPlugin) {
         return false;
     }
     $xPlugin->setResponse($this);
     return $xPlugin;
 }