first commit

This commit is contained in:
2024-12-12 15:33:18 +01:00
commit 2c8998663e
3360 changed files with 777573 additions and 0 deletions

View File

@@ -0,0 +1,229 @@
<?php
/*
File: xajaxCallableObject.inc.php
Contains the xajaxCallableObject class
Title: xajaxCallableObject class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxCallableObject.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajaxCallableObject
A class that stores a reference to an object whose methods can be called from
the client via a xajax request. <xajax> will call
<xajaxCallableObject->generateClientScript> so that stub functions can be
generated and sent to the browser.
*/
final class xajaxCallableObject
{
/*
Object: obj
A reference to the callable object.
*/
private $obj;
/*
Array: aConfiguration
An associative array that will contain configuration options for zero
or more of the objects methods. These configuration options will
define the call options for each request. The call options will be
passed to the client browser when the function stubs are generated.
*/
private $aConfiguration;
/*
Function: xajaxCallableObject
Constructs and initializes the <xajaxCallableObject>
obj - (object): The object to reference.
*/
public function __construct($obj)
{
$this->obj = $obj;
$this->aConfiguration = array();
}
/*
Function: getName
Returns the name of this callable object. This is typically the
class name of the object.
*/
public function getName()
{
return get_class($this->obj);
}
/*
Function: configure
Used to set configuration options / call options for each method.
sMethod - (string): The name of the method.
sName - (string): The name of the configuration option.
sValue - (string): The value to be set.
*/
public function configure($sMethod, $sName, $sValue)
{
$sMethod = strtolower($sMethod);
if (false == isset($this->aConfiguration[$sMethod]))
$this->aConfiguration[$sMethod] = array();
$this->aConfiguration[$sMethod][$sName] = $sValue;
}
/*
Function: generateRequests
Produces an array of <xajaxRequest> objects, one for each method
exposed by this callable object.
sXajaxPrefix - (string): The prefix to be prepended to the
javascript function names; this will correspond to the name
used for the function stubs that are generated by the
<xajaxCallableObject->generateClientScript> call.
*/
public function generateRequests($sXajaxPrefix)
{
$aRequests = array();
$sClass = get_class($this->obj);
foreach (get_class_methods($this->obj) as $sMethodName)
{
$bInclude = true;
// exclude magic __call, __construct, __destruct methods
if (2 < strlen($sMethodName))
if ("__" == substr($sMethodName, 0, 2))
$bInclude = false;
// exclude constructor
if ($sClass == $sMethodName)
$bInclude = false;
if ($bInclude)
$aRequests[strtolower($sMethodName)] =
new xajaxRequest("{$sXajaxPrefix}{$sClass}.{$sMethodName}");
}
return $aRequests;
}
/*
Function: generateClientScript
Called by <xajaxCallableObject->generateClientScript> while <xajax> is
generating the javascript to be sent to the browser.
sXajaxPrefix - (string): The prefix to be prepended to the
javascript function names.
*/
public function generateClientScript($sXajaxPrefix)
{
$sClass = get_class($this->obj);
echo "{$sXajaxPrefix}{$sClass} = {};\n";
foreach (get_class_methods($this->obj) as $sMethodName)
{
$bInclude = true;
// exclude magic __call, __construct, __destruct methods
if (2 < strlen($sMethodName))
if ("__" == substr($sMethodName, 0, 2))
$bInclude = false;
// exclude constructor
if ($sClass == $sMethodName)
$bInclude = false;
if ($bInclude)
{
echo "{$sXajaxPrefix}{$sClass}.{$sMethodName} = function() { ";
echo "return xajax.request( ";
echo "{ xjxcls: '{$sClass}', xjxmthd: '{$sMethodName}' }, ";
echo "{ parameters: arguments";
$sSeparator = ", ";
if (isset($this->aConfiguration['*']))
foreach ($this->aConfiguration['*'] as $sKey => $sValue)
echo "{$sSeparator}{$sKey}: {$sValue}";
if (isset($this->aConfiguration[strtolower($sMethodName)]))
foreach ($this->aConfiguration[strtolower($sMethodName)] as $sKey => $sValue)
echo "{$sSeparator}{$sKey}: {$sValue}";
echo " } ); ";
echo "};\n";
}
}
}
/*
Function: isClass
Determins if the specified class name matches the class name of the
object referenced by <xajaxCallableObject->obj>.
sClass - (string): The name of the class to check.
Returns:
boolean - True of the specified class name matches the class of
the object being referenced; false otherwise.
*/
public function isClass($sClass)
{
if (get_class($this->obj) === $sClass)
return true;
return false;
}
/*
Function: hasMethod
Determines if the specified method name is one of the methods of the
object referenced by <xajaxCallableObject->obj>.
sMethod - (object): The name of the method to check.
Returns:
boolean - True of the referenced object contains the specified method,
false otherwise.
*/
public function hasMethod($sMethod)
{
return method_exists($this->obj, $sMethod) || method_exists($this->obj, "__call");
}
/*
Function: call
Call the specified method of the object being referenced using the specified
array of arguments.
sMethod - (string): The name of the method to call.
aArgs - (array): The arguments to pass to the method.
*/
public function call($sMethod, $aArgs)
{
$objResponseManager = xajaxResponseManager::getInstance();
$objResponseManager->append(
call_user_func_array(
array($this->obj, $sMethod),
$aArgs
)
);
}
}

View File

@@ -0,0 +1,162 @@
<?php
/*
File: xajaxEvent.inc.php
Definition of the xajax Event object.
Title: xajaxEvent
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxEvent.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
// require_once is necessary here as the function plugin also includes this
//SkipAIO
require_once dirname(__FILE__) . '/xajaxUserFunction.inc.php';
//EndSkipAIO
/*
Class: xajaxEvent
A container class which holds a reference to handler functions and configuration
options associated with a registered event.
*/
final class xajaxEvent
{
/*
String: sName
The name of the event.
*/
private $sName;
/*
Array: aConfiguration
Configuration / call options to be used when initiating a xajax request
to trigger this event.
*/
private $aConfiguration;
/*
Array: aHandlers
A list of <xajaxUserFunction> objects associated with this registered
event. Each of these functions will be called when the event is triggered.
*/
private $aHandlers;
/*
Function: xajaxEvent
Construct and initialize this <xajaxEvent> object.
*/
public function __construct($sName)
{
$this->sName = $sName;
$this->aConfiguration = array();
$this->aHandlers = array();
}
/*
Function: getName
Returns the name of the event.
Returns:
string - the name of the event.
*/
public function getName()
{
return $this->sName;
}
/*
Function: configure
Sets/stores configuration options that will be used when generating
the client script that is sent to the browser.
*/
public function configure($sName, $mValue)
{
$this->aConfiguration[$sName] = $mValue;
}
/*
Function: addHandler
Adds a <xajaxUserFunction> object to the list of handlers that will
be fired when the event is triggered.
*/
public function addHandler($xuf)
{
$this->aHandlers[] = $xuf;
}
/*
Function: generateRequest
Generates a <xajaxRequest> object that corresponds to the
event so that the client script can easily invoke this event.
sXajaxPrefix - (string): The prefix that will be prepended to
the client script stub function associated with this event.
sEventPrefix - (string): The prefix prepended to the client script
function stub and <xajaxRequest> script.
*/
public function generateRequest($sXajaxPrefix, $sEventPrefix)
{
$sEvent = $this->sName;
return new xajaxRequest("{$sXajaxPrefix}{$sEventPrefix}{$sEvent}");
}
/*
Function: generateClientScript
Generates a block of javascript code that declares a stub function
that can be used to easily trigger the event from the browser.
*/
public function generateClientScript($sXajaxPrefix, $sEventPrefix)
{
$sMode = '';
$sMethod = '';
if (isset($this->aConfiguration['mode']))
$sMode = $this->aConfiguration['mode'];
if (isset($this->aConfiguration['method']))
$sMethod = $this->aConfiguration['method'];
if (0 < strlen($sMode))
$sMode = ", mode: '{$sMode}'";
if (0 < strlen($sMethod))
$sMethod = ", method: '{$sMethod}'";
$sEvent = $this->sName;
echo "{$sXajaxPrefix}{$sEventPrefix}{$sEvent} = function() { return xajax.request( { xjxevt: '{$sEvent}' }, { parameters: arguments{$sMode}{$sMethod} } ); };\n";
}
/*
Function: fire
Called by the <xajaxEventPlugin> when the event has been triggered.
*/
public function fire($aArgs)
{
$objResponseManager = xajaxResponseManager::getInstance();
foreach (array_keys($this->aHandlers) as $sKey)
$this->aHandlers[$sKey]->call($aArgs);
}
}

View File

@@ -0,0 +1,240 @@
<?php
/*
File: xajaxUserFunction.inc.php
Contains the xajaxUserFunction class
Title: xajaxUserFunction class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxUserFunction.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajaxUserFunction
Construct instances of this class to define functions that will be registered
with the <xajax> request processor. This class defines the parameters that
are needed for the definition of a xajax enabled function. While you can
still specify functions by name during registration, it is advised that you
convert to using this class when you wish to register external functions or
to specify call options as well.
*/
final class xajaxUserFunction
{
/*
String: sAlias
An alias to use for this function. This is useful when you want
to call the same xajax enabled function with a different set of
call options from what was already registered.
*/
private $sAlias;
/*
Object: uf
A string or array which defines the function to be registered.
*/
private $uf;
/*
String: sInclude
The path and file name of the include file that contains the function.
*/
private $sInclude;
/*
Array: aConfiguration
An associative array containing call options that will be sent to the
browser curing client script generation.
*/
private $aConfiguration;
/*
Function: xajaxUserFunction
Constructs and initializes the <xajaxUserFunction> object.
$uf - (mixed): A function specification in one of the following formats:
- a three element array:
(string) Alternate function name: when a method of a class has the same
name as another function in the system, you can provide an alias to
help avoid collisions.
(object or class name) Class: the name of the class or an instance of
the object which contains the function to be called.
(string) Method: the name of the method that will be called.
- a two element array:
(object or class name) Class: the name of the class or an instance of
the object which contains the function to be called.
(string) Method: the name of the method that will be called.
- a string:
the name of the function that is available at global scope (not in a
class.
$sInclude - deprecated syntax - use ->configure('include','/path/to/file'); instead
$sInclude - (string, optional): The path and file name of the include file
that contains the class or function to be called.
$aConfiguration - marked as deprecated - might become reactivated as argument #2
$aConfiguration - (array, optional): An associative array of call options
that will be used when sending the request from the client.
Examples:
$myFunction = array('alias', 'myClass', 'myMethod');
$myFunction = array('alias', &$myObject, 'myMethod');
$myFunction = array('myClass', 'myMethod');
$myFunction = array(&$myObject, 'myMethod');
$myFunction = 'myFunction';
$myUserFunction = new xajaxUserFunction($myFunction, 'myFile.inc.php', array(
'method' => 'get',
'mode' => 'synchronous'
));
$xajax->register(XAJAX_FUNCTION, $myUserFunction);
*/
public function xajaxUserFunction($uf) // /*deprecated parameters */ $sInclude=NULL, $aConfiguration=array())
{
$this->sAlias = '';
$this->uf = $uf;
$this->aConfiguration = array();
/*deprecated parameters */
// $this->sInclude = $sInclude;
// foreach ($aConfiguration as $sKey => $sValue)
// $this->configure($sKey, $sValue);
if (is_array($this->uf) && 2 < count($this->uf))
{
$this->sAlias = $this->uf[0];
$this->uf = array_slice($this->uf, 1);
}
//SkipDebug
if (is_array($this->uf) && 2 != count($this->uf))
trigger_error(
'Invalid function declaration for xajaxUserFunction.',
E_USER_ERROR
);
//EndSkipDebug
}
/*
Function: getName
Get the name of the function being referenced.
Returns:
string - the name of the function contained within this object.
*/
public function getName()
{
// Do not use sAlias here!
if (is_array($this->uf))
return $this->uf[1];
return $this->uf;
}
/*
Function: configure
Call this to set call options for this instance.
*/
public function configure($sName, $sValue)
{
if ('alias' == $sName)
$this->sAlias = $sValue;
if ('include' == $sName)
$this->sInclude = $sValue;
else
$this->aConfiguration[$sName] = $sValue;
}
/*
Function: generateRequest
Constructs and returns a <xajaxRequest> object which is capable
of generating the javascript call to invoke this xajax enabled
function.
*/
public function generateRequest($sXajaxPrefix)
{
$sAlias = $this->getName();
if (0 < strlen($this->sAlias))
$sAlias = $this->sAlias;
return new xajaxRequest("{$sXajaxPrefix}{$sAlias}");
}
/*
Function: generateClientScript
Called by the <xajaxPlugin> that is referencing this function
reference during the client script generation phase. This function
will generate the javascript function stub that is sent to the
browser on initial page load.
*/
public function generateClientScript($sXajaxPrefix)
{
$sFunction = $this->getName();
$sAlias = $sFunction;
if (0 < strlen($this->sAlias))
$sAlias = $this->sAlias;
echo "{$sXajaxPrefix}{$sAlias} = function() { ";
echo "return xajax.request( ";
echo "{ xjxfun: '{$sFunction}' }, ";
echo "{ parameters: arguments";
$sSeparator = ", ";
foreach ($this->aConfiguration as $sKey => $sValue)
echo "{$sSeparator}{$sKey}: {$sValue}";
echo " } ); ";
echo "};\n";
}
/*
Function: call
Called by the <xajaxPlugin> that references this function during the
request processing phase. This function will call the specified
function, including an external file if needed and passing along
the specified arguments.
*/
public function call($aArgs=array())
{
$objResponseManager = xajaxResponseManager::getInstance();
if (NULL != $this->sInclude)
{
ob_start();
require_once $this->sInclude;
$sOutput = ob_get_clean();
//SkipDebug
if (0 < strlen($sOutput))
{
$sOutput = 'From include file: ' . $this->sInclude . ' => ' . $sOutput;
$objResponseManager->debug($sOutput);
}
//EndSkipDebug
}
$mFunction = $this->uf;
$objResponseManager->append(call_user_func_array($mFunction, $aArgs));
}
}
?>

View File

@@ -0,0 +1,219 @@
<?php
/*
File: xajaxCallableObjectPlugin.inc.php
Contains the xajaxCallableObjectPlugin class
Title: xajaxCallableObjectPlugin class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxCallableObjectPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Constant: XAJAX_CALLABLE_OBJECT
Specifies that the item being registered via the <xajax->register> function is a
object who's methods will be callable from the browser.
*/
if (!defined ('XAJAX_CALLABLE_OBJECT')) define ('XAJAX_CALLABLE_OBJECT', 'callable object');
//SkipAIO
require dirname(__FILE__) . '/support/xajaxCallableObject.inc.php';
//EndSkipAIO
/*
Class: xajaxCallableObjectPlugin
*/
final class xajaxCallableObjectPlugin extends xajaxRequestPlugin
{
/*
Array: aCallableObjects
*/
private $aCallableObjects;
/*
String: sXajaxPrefix
*/
private $sXajaxPrefix;
/*
String: sDefer
*/
private $sDefer;
private $bDeferScriptGeneration;
/*
String: sRequestedClass
*/
private $sRequestedClass;
/*
String: sRequestedMethod
*/
private $sRequestedMethod;
/*
Function: xajaxCallableObjectPlugin
*/
public function __construct()
{
$this->aCallableObjects = array();
$this->sXajaxPrefix = 'xajax_';
$this->sDefer = '';
$this->bDeferScriptGeneration = false;
$this->sRequestedClass = NULL;
$this->sRequestedMethod = NULL;
if (!empty($_GET['xjxcls'])) $this->sRequestedClass = $_GET['xjxcls'];
if (!empty($_GET['xjxmthd'])) $this->sRequestedMethod = $_GET['xjxmthd'];
if (!empty($_POST['xjxcls'])) $this->sRequestedClass = $_POST['xjxcls'];
if (!empty($_POST['xjxmthd'])) $this->sRequestedMethod = $_POST['xjxmthd'];
}
/*
Function: configure
*/
public function configure($sName, $mValue)
{
if ('wrapperPrefix' == $sName) {
$this->sXajaxPrefix = $mValue;
} else if ('scriptDefferal' == $sName) {
if (true === $mValue) $this->sDefer = 'defer ';
else $this->sDefer = '';
} else if ('deferScriptGeneration' == $sName) {
if (true === $mValue || false === $mValue)
$this->bDeferScriptGeneration = $mValue;
else if ('deferred' === $mValue)
$this->bDeferScriptGeneration = $mValue;
}
}
/*
Function: register
*/
public function register($aArgs)
{
if (1 < count($aArgs))
{
$sType = $aArgs[0];
if (XAJAX_CALLABLE_OBJECT == $sType)
{
$xco = $aArgs[1];
//SkipDebug
if (false === is_object($xco))
{
trigger_error("To register a callable object, please provide an instance of the desired class.", E_USER_WARNING);
return false;
}
//EndSkipDebug
if (false === ($xco instanceof xajaxCallableObject))
$xco = new xajaxCallableObject($xco);
if (2 < count($aArgs))
if (is_array($aArgs[2]))
foreach ($aArgs[2] as $sKey => $aValue)
foreach ($aValue as $sName => $sValue)
$xco->configure($sKey, $sName, $sValue);
$this->aCallableObjects[] = $xco;
return $xco->generateRequests($this->sXajaxPrefix);
}
}
return false;
}
/*
Function: generateClientScript
*/
public function generateClientScript()
{
if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration)
{
if (0 < count($this->aCallableObjects))
{
$sCrLf = "\n";
echo $sCrLf;
echo '<';
echo 'script type="text/javascript" ';
echo $this->sDefer;
echo 'charset="UTF-8">';
echo $sCrLf;
echo '/* <';
echo '![CDATA[ */';
echo $sCrLf;
foreach(array_keys($this->aCallableObjects) as $sKey)
$this->aCallableObjects[$sKey]->generateClientScript($this->sXajaxPrefix);
echo '/* ]]> */';
echo $sCrLf;
echo '<';
echo '/script>';
echo $sCrLf;
}
}
}
/*
Function: canProcessRequest
*/
public function canProcessRequest()
{
if (NULL == $this->sRequestedClass)
return false;
if (NULL == $this->sRequestedMethod)
return false;
return true;
}
/*
Function: processRequest
*/
public function processRequest()
{
if (NULL == $this->sRequestedClass)
return false;
if (NULL == $this->sRequestedMethod)
return false;
$objArgumentManager = xajaxArgumentManager::getInstance();
$aArgs = $objArgumentManager->process();
foreach (array_keys($this->aCallableObjects) as $sKey)
{
$xco = $this->aCallableObjects[$sKey];
if ($xco->isClass($this->sRequestedClass))
{
if ($xco->hasMethod($this->sRequestedMethod))
{
$xco->call($this->sRequestedMethod, $aArgs);
return true;
}
}
}
return 'Invalid request for a callable object.';
}
}
$objPluginManager = xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new xajaxCallableObjectPlugin(), 102);

View File

@@ -0,0 +1,377 @@
<?php
/*
File: xajaxDefaultIncludePlugin.inc.php
Contains the default script include plugin class.
Title: xajax default script include plugin class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxDefaultIncludePlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajaxIncludeClientScript
Generates the SCRIPT tags necessary to 'include' the xajax javascript
library on the browser.
This is called when the page is first loaded.
*/
final class xajaxIncludeClientScriptPlugin extends xajaxRequestPlugin
{
private $sJsURI;
private $aJsFiles;
private $sDefer;
private $sRequestURI;
private $sStatusMessages;
private $sWaitCursor;
private $sVersion;
private $sDefaultMode;
private $sDefaultMethod;
private $bDebug;
private $bVerboseDebug;
private $nScriptLoadTimeout;
private $bUseUncompressedScripts;
private $bDeferScriptGeneration;
private $sLanguage;
private $nResponseQueueSize;
private $sDebugOutputID;
public function xajaxIncludeClientScriptPlugin()
{
$this->sJsURI = '';
$this->aJsFiles = array();
$this->sDefer = '';
$this->sRequestURI = '';
$this->sStatusMessages = 'false';
$this->sWaitCursor = 'true';
$this->sVersion = 'unknown';
$this->sDefaultMode = 'asynchronous';
$this->sDefaultMethod = 'POST'; // W3C: Method is case sensitive
$this->bDebug = false;
$this->bVerboseDebug = false;
$this->nScriptLoadTimeout = 2000;
$this->bUseUncompressedScripts = false;
$this->bDeferScriptGeneration = false;
$this->sLanguage = null;
$this->nResponseQueueSize = null;
$this->sDebugOutputID = null;
}
/*
Function: configure
*/
public function configure($sName, $mValue)
{
if ('javascript URI' == $sName) {
$this->sJsURI = $mValue;
} else if ("javascript files" == $sName) {
$this->aJsFiles = $mValue;
} else if ("scriptDefferal" == $sName) {
if (true === $mValue) $this->sDefer = "defer ";
else $this->sDefer = "";
} else if ("requestURI" == $sName) {
$this->sRequestURI = $mValue;
} else if ("statusMessages" == $sName) {
if (true === $mValue) $this->sStatusMessages = "true";
else $this->sStatusMessages = "false";
} else if ("waitCursor" == $sName) {
if (true === $mValue) $this->sWaitCursor = "true";
else $this->sWaitCursor = "false";
} else if ("version" == $sName) {
$this->sVersion = $mValue;
} else if ("defaultMode" == $sName) {
if ("asynchronous" == $mValue || "synchronous" == $mValue)
$this->sDefaultMode = $mValue;
} else if ("defaultMethod" == $sName) {
if ("POST" == $mValue || "GET" == $mValue) // W3C: Method is case sensitive
$this->sDefaultMethod = $mValue;
} else if ("debug" == $sName) {
if (true === $mValue || false === $mValue)
$this->bDebug = $mValue;
} else if ("verboseDebug" == $sName) {
if (true === $mValue || false === $mValue)
$this->bVerboseDebug = $mValue;
} else if ("scriptLoadTimeout" == $sName) {
$this->nScriptLoadTimeout = $mValue;
} else if ("useUncompressedScripts" == $sName) {
if (true === $mValue || false === $mValue)
$this->bUseUncompressedScripts = $mValue;
} else if ('deferScriptGeneration' == $sName) {
if (true === $mValue || false === $mValue)
$this->bDeferScriptGeneration = $mValue;
else if ('deferred' == $mValue)
$this->bDeferScriptGeneration = $mValue;
} else if ('language' == $sName) {
$this->sLanguage = $mValue;
} else if ('responseQueueSize' == $sName) {
$this->nResponseQueueSize = $mValue;
} else if ('debugOutputID' == $sName) {
$this->sDebugOutputID = $mValue;
}
}
/*
Function: generateClientScript
*/
public function generateClientScript()
{
if (false === $this->bDeferScriptGeneration)
{
$this->printJavascriptConfig();
$this->printJavascriptInclude();
}
else if (true === $this->bDeferScriptGeneration)
{
$this->printJavascriptInclude();
}
else if ('deferred' == $this->bDeferScriptGeneration)
{
$this->printJavascriptConfig();
}
}
/*
Function: getJavascriptConfig
Generates the xajax settings that will be used by the xajax javascript
library when making requests back to the server.
Returns:
string - The javascript code necessary to configure the settings on
the browser.
*/
public function getJavascriptConfig()
{
ob_start();
$this->printJavascriptConfig();
return ob_get_clean();
}
/*
Function: printJavascriptConfig
See <xajaxIncludeClientScriptPlugin::getJavascriptConfig>
*/
public function printJavascriptConfig()
{
$sCrLf = "\n";
$sJsURI = $this->sJsURI;
if ($sJsURI != '' && substr($sJsURI, -1) != '/')
$sJsURI .= '/';
echo $sCrLf;
echo '<';
echo 'script type="text/javascript" ';
echo $this->sDefer;
echo 'charset="UTF-8">';
echo $sCrLf;
echo '/* <';
echo '![CDATA[ */';
echo $sCrLf;
echo 'try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };';
echo $sCrLf;
echo 'xajax.config.requestURI = "';
echo $this->sRequestURI;
echo '";';
echo $sCrLf;
echo 'xajax.config.statusMessages = ';
echo $this->sStatusMessages;
echo ';';
echo $sCrLf;
echo 'xajax.config.waitCursor = ';
echo $this->sWaitCursor;
echo ';';
echo $sCrLf;
echo 'xajax.config.version = "';
echo $this->sVersion;
echo '";';
echo $sCrLf;
echo 'xajax.config.defaultMode = "';
echo $this->sDefaultMode;
echo '";';
echo $sCrLf;
echo 'xajax.config.defaultMethod = "';
echo $this->sDefaultMethod;
echo '";';
echo $sCrLf;
echo 'xajax.config.JavaScriptURI = "';
echo $this->sJsURI;
echo '";';
if (false === (null === $this->nResponseQueueSize))
{
echo $sCrLf;
echo 'xajax.config.responseQueueSize = ';
echo $this->nResponseQueueSize;
echo ';';
}
if (true === $this->bDebug)
{
if (false === (null === $this->sDebugOutputID))
{
echo $sCrLf;
echo 'xajax.debug = {};';
echo $sCrLf;
echo 'xajax.debug.outputID = "';
echo $this->sDebugOutputID;
echo '";';
}
}
echo $sCrLf;
echo '/* ]]> */';
echo $sCrLf;
echo '<';
echo '/script>';
echo $sCrLf;
}
/*
Function: getJavascriptInclude
Generates SCRIPT tags necessary to load the javascript libraries on
the browser.
sJsURI - (string): The relative or fully qualified PATH that will be
used to compose the URI to the specified javascript files.
aJsFiles - (array): List of javascript files to include.
Returns:
string - The SCRIPT tags that will cause the browser to load the
specified files.
*/
public function getJavascriptInclude()
{
ob_start();
$this->printJavascriptInclude();
return ob_get_clean();
}
/*
Function: printJavascriptInclude
See <xajaxIncludeClientScriptPlugin::getJavascriptInclude>
*/
public function printJavascriptInclude()
{
$aJsFiles = $this->aJsFiles;
$sJsURI = $this->sJsURI;
if (0 == count($aJsFiles)) {
$aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_core.js'), 'xajax');
if (true === $this->bDebug)
$aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_debug.js'), 'xajax.debug');
if (true === $this->bVerboseDebug)
$aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_verbose.js'), 'xajax.debug.verbose');
if (null !== $this->sLanguage)
$aJsFiles[] = array($this->_getScriptFilename('xajax_js/xajax_lang_' . $this->sLanguage . '.js'), 'xajax');
}
if ($sJsURI != '' && substr($sJsURI, -1) != '/')
$sJsURI .= '/';
$sCrLf = "\n";
foreach ($aJsFiles as $aJsFile) {
echo '<';
echo 'script type="text/javascript" src="';
echo $sJsURI;
echo $aJsFile[0];
echo '" ';
echo $this->sDefer;
echo 'charset="UTF-8"><';
echo '/script>';
echo $sCrLf;
}
if (0 < $this->nScriptLoadTimeout) {
foreach ($aJsFiles as $aJsFile) {
echo '<';
echo 'script type="text/javascript" ';
echo $this->sDefer;
echo 'charset="UTF-8">';
echo $sCrLf;
echo '/* <';
echo '![CDATA[ */';
echo $sCrLf;
echo 'window.setTimeout(';
echo $sCrLf;
echo ' function() {';
echo $sCrLf;
echo ' var scriptExists = false;';
echo $sCrLf;
echo ' try { if (';
echo $aJsFile[1];
echo '.isLoaded) scriptExists = true; }';
echo $sCrLf;
echo ' catch (e) {}';
echo $sCrLf;
echo ' if (!scriptExists) {';
echo $sCrLf;
echo ' alert("Error: the ';
echo $aJsFile[1];
echo ' Javascript component could not be included. Perhaps the URL is incorrect?\nURL: ';
echo $sJsURI;
echo $aJsFile[0];
echo '");';
echo $sCrLf;
echo ' }';
echo $sCrLf;
echo ' }, ';
echo $this->nScriptLoadTimeout;
echo ');';
echo $sCrLf;
echo '/* ]]> */';
echo $sCrLf;
echo '<';
echo '/script>';
echo $sCrLf;
}
}
}
/*
Function: _getScriptFilename
Returns the name of the script file, based on the current settings.
sFilename - (string): The base filename.
Returns:
string - The filename as it should be specified in the script tags
on the browser.
*/
private function _getScriptFilename($sFilename)
{
if ($this->bUseUncompressedScripts) {
return str_replace('.js', '_uncompressed.js', $sFilename);
}
return $sFilename;
}
}
/*
Register the xajaxIncludeClientScriptPlugin object with the xajaxPluginManager.
*/
$objPluginManager = xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new xajaxIncludeClientScriptPlugin(), 99);

View File

@@ -0,0 +1,231 @@
<?php
/*
File: xajaxEventPlugin.inc.php
Contains the xajaxEventPlugin class
Title: xajaxEventPlugin class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxEventPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2009 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Constant: XAJAX_EVENT
Specifies that the item being registered via the <xajax->register> function
is an event.
Constant: XAJAX_EVENT_HANDLER
Specifies that the item being registered via the <xajax->register> function
is an event handler.
*/
if (!defined ('XAJAX_EVENT')) define ('XAJAX_EVENT', 'xajax event');
if (!defined ('XAJAX_EVENT_HANDLER')) define ('XAJAX_EVENT_HANDLER', 'xajax event handler');
//SkipAIO
require dirname(__FILE__) . '/support/xajaxEvent.inc.php';
//EndSkipAIO
/*
Class: xajaxEventPlugin
Plugin that adds server side event handling capabilities to xajax. Events can
be registered, then event handlers attached.
*/
class xajaxEventPlugin extends xajaxRequestPlugin
{
/*
Array: aEvents
*/
var $aEvents;
/*
String: sXajaxPrefix
*/
var $sXajaxPrefix;
/*
String: sEventPrefix
*/
var $sEventPrefix;
/*
String: sDefer
*/
var $sDefer;
var $bDeferScriptGeneration;
/*
String: sRequestedEvent
*/
var $sRequestedEvent;
/*
Function: xajaxEventPlugin
*/
function xajaxEventPlugin()
{
$this->aEvents = array();
$this->sXajaxPrefix = 'xajax_';
$this->sEventPrefix = 'event_';
$this->sDefer = '';
$this->bDeferScriptGeneration = false;
$this->sRequestedEvent = NULL;
if (isset($_GET['xjxevt'])) $this->sRequestedEvent = $_GET['xjxevt'];
if (isset($_POST['xjxevt'])) $this->sRequestedEvent = $_POST['xjxevt'];
}
/*
Function: configure
*/
function configure($sName, $mValue)
{
if ('wrapperPrefix' == $sName) {
$this->sXajaxPrefix = $mValue;
} else if ('eventPrefix' == $sName) {
$this->sEventPrefix = $mValue;
} else if ('scriptDefferal' == $sName) {
if (true === $mValue) $this->sDefer = 'defer ';
else $this->sDefer = '';
} else if ('deferScriptGeneration' == $sName) {
if (true === $mValue || false === $mValue)
$this->bDeferScriptGeneration = $mValue;
else if ('deferred' === $mValue)
$this->bDeferScriptGeneration = $mValue;
}
}
/*
Function: register
$sType - (string): type of item being registered
$sEvent - (string): the name of the event
$ufHandler - (function name or reference): a reference to the user function to call
$aConfiguration - (array): an array containing configuration options
*/
function register($aArgs)
{
if (1 < count($aArgs))
{
$sType = $aArgs[0];
if (XAJAX_EVENT == $sType)
{
$sEvent = $aArgs[1];
if (false === isset($this->aEvents[$sEvent]))
{
$xe = new xajaxEvent($sEvent);
if (2 < count($aArgs))
if (is_array($aArgs[2]))
foreach ($aArgs[2] as $sKey => $sValue)
$xe->configure($sKey, $sValue);
$this->aEvents[$sEvent] =& $xe;
return $xe->generateRequest($this->sXajaxPrefix, $this->sEventPrefix);
}
}
if (XAJAX_EVENT_HANDLER == $sType)
{
$sEvent = $aArgs[1];
if (isset($this->aEvents[$sEvent]))
{
if (isset($aArgs[2]))
{
$xuf =& $aArgs[2];
if (false === ($xuf instanceof xajaxUserFunction))
$xuf = new xajaxUserFunction($xuf);
$objEvent =& $this->aEvents[$sEvent];
$objEvent->addHandler($xuf);
return true;
}
}
}
}
return false;
}
/*
Function: generateClientScript
*/
function generateClientScript()
{
if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration)
{
if (0 < count($this->aEvents))
{
echo "\n<script type='text/javascript' ";
echo $this->sDefer;
echo "charset='UTF-8'>\n";
echo "/* <![CDATA[ */\n";
foreach (array_keys($this->aEvents) as $sKey)
$this->aEvents[$sKey]->generateClientScript($this->sXajaxPrefix, $this->sEventPrefix);
echo "/* ]]> */\n";
echo "</script>\n";
}
}
}
/*
Function: canProcessRequest
*/
function canProcessRequest()
{
if (NULL == $this->sRequestedEvent)
return false;
return true;
}
/*
Function: processRequest
*/
function processRequest()
{
if (NULL == $this->sRequestedEvent)
return false;
$objArgumentManager =& xajaxArgumentManager::getInstance();
$aArgs = $objArgumentManager->process();
foreach (array_keys($this->aEvents) as $sKey)
{
$objEvent =& $this->aEvents[$sKey];
if ($objEvent->getName() == $this->sRequestedEvent)
{
$objEvent->fire($aArgs);
return true;
}
}
return 'Invalid event request received; no event was registered with this name.';
}
}
$objPluginManager =& xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new xajaxEventPlugin(), 103);

View File

@@ -0,0 +1,238 @@
<?php
/*
File: xajaxFunctionPlugin.inc.php
Contains the xajaxFunctionPlugin class
Title: xajaxFunctionPlugin class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxFunctionPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Constant: XAJAX_FUNCTION
Specifies that the item being registered via the <xajax->register> function
is a php function available at global scope, or a specific function from
an instance of an object.
*/
if (!defined ('XAJAX_FUNCTION')) define ('XAJAX_FUNCTION', 'function');
// require_once is necessary here as the xajaxEvent class will include this also
//SkipAIO
require_once dirname(__FILE__) . '/support/xajaxUserFunction.inc.php';
//EndSkipAIO
/*
Class: xajaxFunctionPlugin
*/
class xajaxFunctionPlugin extends xajaxRequestPlugin
{
/*
Array: aFunctions
An array of <xajaxUserFunction> object that are registered and
available via a <xajax.request> call.
*/
var $aFunctions;
/*
String: sXajaxPrefix
A configuration setting that is stored locally and used during
the client script generation phase.
*/
var $sXajaxPrefix;
/*
String: sDefer
Configuration option that can be used to request that the
javascript file is loaded after the page has been fully loaded.
*/
var $sDefer;
var $bDeferScriptGeneration;
/*
String: sRequestedFunction
This string is used to temporarily hold the name of the function
that is being requested (during the request processing phase).
Since canProcessRequest loads this value from the get or post
data, it is unnecessary to load it again.
*/
var $sRequestedFunction;
/*
Function: xajaxFunctionPlugin
Constructs and initializes the <xajaxFunctionPlugin>. The GET and POST
data is searched for xajax function call parameters. This will later
be used to determine if the request is for a registered function in
<xajaxFunctionPlugin->canProcessRequest>
*/
function xajaxFunctionPlugin()
{
$this->aFunctions = array();
$this->sXajaxPrefix = 'xajax_';
$this->sDefer = '';
$this->bDeferScriptGeneration = false;
$this->sRequestedFunction = NULL;
if (isset($_GET['xjxfun'])) $this->sRequestedFunction = $_GET['xjxfun'];
if (isset($_POST['xjxfun'])) $this->sRequestedFunction = $_POST['xjxfun'];
}
/*
Function: configure
Sets/stores configuration options used by this plugin.
*/
function configure($sName, $mValue)
{
if ('wrapperPrefix' == $sName) {
$this->sXajaxPrefix = $mValue;
} else if ('scriptDefferal' == $sName) {
if (true === $mValue) $this->sDefer = 'defer ';
else $this->sDefer = '';
} else if ('deferScriptGeneration' == $sName) {
if (true === $mValue || false === $mValue)
$this->bDeferScriptGeneration = $mValue;
else if ('deferred' === $mValue)
$this->bDeferScriptGeneration = $mValue;
}
}
/*
Function: register
Provides a mechanism for functions to be registered and made available to
the page via the javascript <xajax.request> call.
*/
function register($aArgs)
{
if (1 < count($aArgs))
{
$sType = $aArgs[0];
if (XAJAX_FUNCTION == $sType)
{
$xuf = $aArgs[1];
if (false === ($xuf instanceof xajaxUserFunction))
$xuf = new xajaxUserFunction($xuf);
if (2 < count($aArgs))
{
if (is_array($aArgs[2]))
{
foreach ($aArgs[2] as $sName => $sValue)
{
$xuf->configure($sName, $sValue);
}
} else {
$xuf->configure('include', $aArgs[2]);
}
}
$this->aFunctions[] = $xuf;
return $xuf->generateRequest($this->sXajaxPrefix);
}
}
return false;
}
/*
Function: generateClientScript
Called by the <xajaxPluginManager> during the client script generation
phase. This is used to generate a block of javascript code that will
contain function declarations that can be used on the browser through
javascript to initiate xajax requests.
*/
function generateClientScript()
{
if (false === $this->bDeferScriptGeneration || 'deferred' === $this->bDeferScriptGeneration)
{
if (0 < count($this->aFunctions))
{
echo "\n<script type='text/javascript' " . $this->sDefer . "charset='UTF-8'>\n";
echo "/* <![CDATA[ */\n";
foreach (array_keys($this->aFunctions) as $sKey)
$this->aFunctions[$sKey]->generateClientScript($this->sXajaxPrefix);
echo "/* ]]> */\n";
echo "</script>\n";
}
}
}
/*
Function: canProcessRequest
Determines whether or not the current request can be processed
by this plugin.
Returns:
boolean - True if the current request can be handled by this plugin;
false otherwise.
*/
function canProcessRequest()
{
if (NULL == $this->sRequestedFunction)
return false;
return true;
}
/*
Function: processRequest
Called by the <xajaxPluginManager> when a request needs to be
processed.
Returns:
mixed - True when the request has been processed successfully.
An error message when an error has occurred.
*/
function processRequest()
{
if (NULL == $this->sRequestedFunction)
return false;
$objArgumentManager = xajaxArgumentManager::getInstance();
$aArgs = $objArgumentManager->process();
foreach (array_keys($this->aFunctions) as $sKey)
{
$xuf = $this->aFunctions[$sKey];
if ($xuf->getName() == $this->sRequestedFunction)
{
$xuf->call($aArgs);
return true;
}
}
return 'Invalid function request received; no request processor found with this name.';
}
}
$objPluginManager = xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new xajaxFunctionPlugin(), 100);

View File

@@ -0,0 +1,266 @@
<?php
/*
File: xajaxScriptPlugin.inc.php
Contains the xajaxScriptPlugin class declaration.
Title: xajaxScriptPlugin class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxScriptPlugin.inc.php 362 2007-05-29 15:32:24Z calltoconstruct $
@copyright Copyright (c) 2005-2007 by Jared White & J. Max Wilson
@copyright Copyright (c) 2008-2010 by Joseph Woolley, Steffen Konerow, Jared White & J. Max Wilson
@license http://www.xajaxproject.org/bsd_license.txt BSD License
*/
/*
Class: xajaxScriptPlugin
Contains the code that can produce script and style data during deferred script
generation. This allows the xajax generated javascript and style sheet information
to be loaded via an external file reference instead of inlined into the page
source.
*/
class xajaxScriptPlugin extends xajaxRequestPlugin
{
/*
String: sRequest
*/
var $sRequest;
/*
String: sHash
*/
var $sHash;
/*
String: sRequestURI
*/
var $sRequestURI;
/*
Boolean: bDeferScriptGeneration
*/
var $bDeferScriptGeneration;
/*
Boolean: bValidateHash
*/
var $bValidateHash;
/*
Boolean: bWorking
*/
var $bWorking;
/*
Function: xajaxScriptPlugin
Construct and initialize the xajax script plugin object. During
initialization, this plugin will look for hash codes in the
GET data (parameters passed on the request URI) and store them
for later use.
*/
function xajaxScriptPlugin()
{
$this->sRequestURI = '';
$this->bDeferScriptGeneration = false;
$this->bValidateHash = true;
$this->bWorking = false;
$this->sRequest = '';
$this->sHash = null;
if (isset($_GET['xjxGenerateJavascript'])) {
$this->sRequest = 'script';
$this->sHash = $_GET['xjxGenerateJavascript'];
}
if (isset($_GET['xjxGenerateStyle'])) {
$this->sRequest = 'style';
$this->sHash = $_GET['xjxGenerateStyle'];
}
}
/*
Function: configure
Sets/stores configuration options used by this plugin. See also:
<xajax::configure>. This plugin will watch for and store the current
setting for the following configuration options:
- <requestURI> (string): The requestURI of the current script file.
- <deferScriptGeneration> (boolean): A flag that indicates whether
script deferral is in effect or not.
- <deferScriptValidateHash> (boolean): A flag that indicates whether
or not the script hash should be validated.
*/
function configure($sName, $mValue)
{
if ('requestURI' == $sName) {
$this->sRequestURI = $mValue;
} else if ('deferScriptGeneration' == $sName) {
if (true === $mValue || false === $mValue)
$this->bDeferScriptGeneration = $mValue;
} else if ('deferScriptValidateHash' == $sName) {
if (true === $mValue || false === $mValue)
$this->bValidateHash = $mValue;
}
}
/*
Function: generateClientScript
Called by the <xajaxPluginManager> when the text of the client script
(or style) declarations are needed.
This function will only output script or style information if the
request URI contained an appropriate hash code and script deferral
is in effect.
*/
function generateClientScript()
{
if ($this->bWorking)
return;
if (true === $this->bDeferScriptGeneration)
{
$this->bWorking = true;
$sQueryBase = '?';
if (0 < strpos($this->sRequestURI, '?'))
$sQueryBase = '&';
$aScripts = $this->_getSections('script');
if (0 < count($aScripts))
{
// echo "<!--" . print_r($aScripts, true) . "-->";
$sHash = md5(implode($aScripts));
$sQuery = $sQueryBase . "xjxGenerateJavascript=" . $sHash;
echo "\n<script type='text/javascript' src='" . $this->sRequestURI . $sQuery . "' charset='UTF-8'></script>\n";
}
$aStyles = $this->_getSections('style');
if (0 < count($aStyles))
{
// echo "<!--" . print_r($aStyles, true) . "-->";
$sHash = md5(implode($aStyles));
$sQuery = $sQueryBase . "xjxGenerateStyle=" . $sHash;
echo "\n<link href='" . $this->sRequestURI . $sQuery . "' rel='Stylesheet' />\n";
}
$this->bWorking = false;
}
}
/*
Function: canProcessRequest
Called by the <xajaxPluginManager> to determine if this plugin can
process the current request. This will return true when the
requestURI contains an appropriate hash code.
*/
function canProcessRequest()
{
return ('' != $this->sRequest);
}
function _getSections($sType)
{
$objPluginManager = xajaxPluginManager::getInstance();
$objPluginManager->configure('deferScriptGeneration', 'deferred');
$aSections = array();
// buffer output
ob_start();
$objPluginManager->generateClientScript();
$sScript = ob_get_clean();
// parse out blocks
$aParts = explode('</' . $sType . '>', $sScript);
foreach ($aParts as $sPart)
{
$aValues = explode('<' . $sType, $sPart, 2);
if (2 == count($aValues))
{
list($sJunk, $sPart) = $aValues;
$aValues = explode('>', $sPart, 2);
if (2 == count($aValues))
{
list($sJunk, $sPart) = $aValues;
if (0 < strlen($sPart))
$aSections[] = $sPart;
}
}
}
$objPluginManager->configure('deferScriptGeneration', $this->bDeferScriptGeneration);
return $aSections;
}
/*
Function: processRequest
Called by the <xajaxPluginManager> when the current request should be
processed. This plugin will generate the javascript or style sheet information
that would normally be output by the other xajax plugin objects, when script
deferral is in effect. If script deferral is disabled, this function returns
without performing any functions.
*/
function processRequest()
{
if ($this->canProcessRequest())
{
$aSections = $this->_getSections($this->sRequest);
// echo "<!--" . print_r($aSections, true) . "-->";
// validate the hash
$sHash = md5(implode($aSections));
if (false == $this->bValidateHash || $sHash == $this->sHash)
{
$sType = 'text/javascript';
if ('style' == $this->sRequest)
$sType = 'text/css';
$objResponse = new xajaxCustomResponse($sType);
foreach ($aSections as $sSection)
$objResponse->append($sSection . "\n");
$objResponseManager = xajaxResponseManager::getInstance();
$objResponseManager->append($objResponse);
header ('Expires: ' . gmdate('D, d M Y H:i:s', time() + (60*60*24)) . ' GMT');
return true;
}
return 'Invalid script or style request.';
trigger_error('Hash mismatch: ' . $this->sRequest . ': ' . $sHash . ' <==> ' . $this->sHash, E_USER_ERROR);
}
}
}
/*
Register the plugin with the xajax plugin manager.
*/
$objPluginManager = xajaxPluginManager::getInstance();
$objPluginManager->registerPlugin(new xajaxScriptPlugin(), 9999);