[ Index ] |
|
Code source de CMS made simple 1.0.5 |
[Code source] [Imprimer] [Statistiques]
xajax.inc.php :: Main xajax class and setup file xajax version 0.2.4 copyright (c) 2005 by Jared White & J. Max Wilson http://www.xajaxproject.org
Copyright: | Copyright (c) 2005-2006 by Jared White & J. Max Wilson |
License: | http://www.gnu.org/copyleft/lesser.html#SEC3 LGPL License |
Version: | $Id$ |
Poids: | 1241 lignes (37 kb) |
Inclus ou requis: | 0 fois |
Référencé: | 0 fois |
Nécessite: | 0 fichiers |
xajax:: (42 méthodes):
xajax()
setRequestURI()
setWrapperPrefix()
debugOn()
debugOff()
statusMessagesOn()
statusMessagesOff()
waitCursorOn()
waitCursorOff()
exitAllowedOn()
exitAllowedOff()
errorHandlerOn()
errorHandlerOff()
setLogFile()
cleanBufferOn()
cleanBufferOff()
setCharEncoding()
decodeUTF8InputOn()
decodeUTF8InputOff()
outputEntitiesOn()
outputEntitiesOff()
registerFunction()
registerExternalFunction()
registerCatchAllFunction()
registerPreFunction()
canProcessRequests()
getRequestMode()
processRequests()
printJavascript()
getJavascript()
getJavascriptConfig()
getJavascriptInclude()
autoCompressJavascript()
_detectURI()
_isObjectCallback()
_isFunctionCallable()
_callFunction()
_wrap()
_xmlToArray()
_parseObjXml()
_decodeUTF8Data()
xajaxErrorHandler()
xajax($sRequestURI="",$sWrapperPrefix="xajax_",$sEncoding=XAJAX_DEFAULT_CHAR_ENCODING,$bDebug=false) X-Ref |
Constructor. You can set some extra xajax options right away or use individual methods later to set options. param: string defaults to the current browser URI param: string defaults to "xajax_"; param: string defaults to XAJAX_DEFAULT_CHAR_ENCODING defined above param: boolean defaults to false |
setRequestURI($sRequestURI) X-Ref |
Sets the URI to which requests will be made. <i>Usage:</i> <kbd>$xajax->setRequestURI("http://www.xajaxproject.org");</kbd> param: string the URI (can be absolute or relative) of the PHP script |
setWrapperPrefix($sPrefix) X-Ref |
Sets the prefix that will be appended to the Javascript wrapper functions (default is "xajax_"). param: string |
debugOn() X-Ref |
Enables debug messages for xajax. |
debugOff() X-Ref |
Disables debug messages for xajax (default behavior). |
statusMessagesOn() X-Ref |
Enables messages in the browser's status bar for xajax. |
statusMessagesOff() X-Ref |
Disables messages in the browser's status bar for xajax (default behavior). |
waitCursorOn() X-Ref |
Enables the wait cursor to be displayed in the browser (default behavior). |
waitCursorOff() X-Ref |
Disables the wait cursor to be displayed in the browser. |
exitAllowedOn() X-Ref |
Enables xajax to exit immediately after processing a request and sending the response back to the browser (default behavior). |
exitAllowedOff() X-Ref |
Disables xajax's default behavior of exiting immediately after processing a request and sending the response back to the browser. |
errorHandlerOn() X-Ref |
Turns on xajax's error handling system so that PHP errors that occur during a request are trapped and pushed to the browser in the form of a Javascript alert. |
errorHandlerOff() X-Ref |
Turns off xajax's error handling system (default behavior). |
setLogFile($sFilename) X-Ref |
Specifies a log file that will be written to by xajax during a request (used only by the error handling system at present). If you don't invoke this method, or you pass in "", then no log file will be written to. <i>Usage:</i> <kbd>$xajax->setLogFile("/xajax_logs/errors.log");</kbd> |
cleanBufferOn() X-Ref |
Causes xajax to clean out all output buffers before outputting a response (default behavior). |
cleanBufferOff() X-Ref |
Turns off xajax's output buffer cleaning. |
setCharEncoding($sEncoding) X-Ref |
Sets the character encoding for the HTTP output based on <kbd>$sEncoding</kbd>, which is a string containing the character encoding to use. You don't need to use this method normally, since the character encoding for the response gets set automatically based on the <kbd>XAJAX_DEFAULT_CHAR_ENCODING</kbd> constant. <i>Usage:</i> <kbd>$xajax->setCharEncoding("utf-8");</kbd> param: string the encoding type to use (utf-8, iso-8859-1, etc.) |
decodeUTF8InputOn() X-Ref |
Causes xajax to decode the input request args from UTF-8 to the current encoding if possible. Either the iconv or mb_string extension must be present for optimal functionality. |
decodeUTF8InputOff() X-Ref |
Turns off decoding the input request args from UTF-8 (default behavior). |
outputEntitiesOn() X-Ref |
Tells the response object to convert special characters to HTML entities automatically (only works if the mb_string extension is available). |
outputEntitiesOff() X-Ref |
Tells the response object to output special characters intact. (default behavior). |
registerFunction($mFunction,$sRequestType=XAJAX_POST) X-Ref |
Registers a PHP function or method to be callable through xajax in your Javascript. If you want to register a function, pass in the name of that function. If you want to register a static class method, pass in an array like so: <kbd>array("myFunctionName", "myClass", "myMethod")</kbd> For an object instance method, use an object variable for the second array element (and in PHP 4 make sure you put an & before the variable to pass the object by reference). Note: the function name is what you call via Javascript, so it can be anything as long as it doesn't conflict with any other registered function name. <i>Usage:</i> <kbd>$xajax->registerFunction("myFunction");</kbd> or: <kbd>$xajax->registerFunction(array("myFunctionName", &$myObject, "myMethod"));</kbd> param: mixed contains the function name or an object callback array param: mixed request type (XAJAX_GET/XAJAX_POST) that should be used |
registerExternalFunction($mFunction,$sIncludeFile,$sRequestType=XAJAX_POST) X-Ref |
Registers a PHP function to be callable through xajax which is located in some other file. If the function is requested the external file will be included to define the function before the function is called. <i>Usage:</i> <kbd>$xajax->registerExternalFunction("myFunction","myFunction.inc.php",XAJAX_POST);</kbd> param: string contains the function name or an object callback array param: string contains the path and filename of the include file param: mixed the RequestType (XAJAX_GET/XAJAX_POST) that should be used |
registerCatchAllFunction($mFunction) X-Ref |
Registers a PHP function to be called when xajax cannot find the function being called via Javascript. Because this is technically impossible when using "wrapped" functions, the catch-all feature is only useful when you're directly using the xajax.call() Javascript method. Use the catch-all feature when you want more dynamic ability to intercept unknown calls and handle them in a custom way. <i>Usage:</i> <kbd>$xajax->registerCatchAllFunction("myCatchAllFunction");</kbd> param: string contains the function name or an object callback array |
registerPreFunction($mFunction) X-Ref |
Registers a PHP function to be called before xajax calls the requested function. xajax will automatically add the request function's response to the pre-function's response to create a single response. Another feature is the ability to return not just a response, but an array with the first element being false (a boolean) and the second being the response. In this case, the pre-function's response will be returned to the browser without xajax calling the requested function. <i>Usage:</i> <kbd>$xajax->registerPreFunction("myPreFunction");</kbd> param: string contains the function name or an object callback array |
canProcessRequests() X-Ref |
Returns true if xajax can process the request, false if otherwise. You can use this to determine if xajax needs to process the request or not. return: boolean |
getRequestMode() X-Ref |
Returns the current request mode (XAJAX_GET or XAJAX_POST), or -1 if there is none. return: mixed |
processRequests() X-Ref |
This is the main communications engine of xajax. The engine handles all incoming xajax requests, calls the apporiate PHP functions (or class/object methods) and passes the XML responses back to the Javascript response handler. If your RequestURI is the same as your Web page then this function should be called before any headers or HTML has been sent. |
printJavascript($sJsURI="", $sJsFile=NULL) X-Ref |
Prints the xajax Javascript header and wrapper code into your page by printing the output of the getJavascript() method. It should only be called between the <pre><head> </head></pre> tags in your HTML page. Remember, if you only want to obtain the result of this function, use {@link xajax::getJavascript()} instead. <i>Usage:</i> <code> <head> ... < ?php $xajax->printJavascript(); ? > </code> param: string the relative address of the folder where xajax has been param: string the relative folder/file pair of the xajax Javascript |
getJavascript($sJsURI="", $sJsFile=NULL) X-Ref |
Returns the xajax Javascript code that should be added to your HTML page between the <kbd><head> </head></kbd> tags. <i>Usage:</i> <code> < ?php $xajaxJSHead = $xajax->getJavascript(); ? > <head> ... < ?php echo $xajaxJSHead; ? > </code> param: string the relative address of the folder where xajax has been param: string the relative folder/file pair of the xajax Javascript return: string |
getJavascriptConfig() X-Ref |
Returns a string containing inline Javascript that sets up the xajax runtime (typically called internally by xajax from get/printJavascript). return: string |
getJavascriptInclude($sJsURI="", $sJsFile=NULL) X-Ref |
Returns a string containing a Javascript include of the xajax.js file along with a check to see if the file loaded after six seconds (typically called internally by xajax from get/printJavascript). param: string the relative address of the folder where xajax has been param: string the relative folder/file pair of the xajax Javascript return: string |
autoCompressJavascript($sJsFullFilename=NULL) X-Ref |
This method can be used to create a new xajax.js file out of the xajax_uncompressed.js file (which will only happen if xajax.js doesn't already exist on the filesystem). param: string an optional argument containing the full server file path |
_detectURI() X-Ref |
Returns the current URL based upon the SERVER vars. return: string |
_isObjectCallback($sFunction) X-Ref |
Returns true if the function name is associated with an object callback, false if not. param: string the name of the function return: boolean |
_isFunctionCallable($sFunction) X-Ref |
Returns true if the function or object callback can be called, false if not. param: string the name of the function return: boolean |
_callFunction($sFunction, $aArgs) X-Ref |
Calls the function, class method, or object method with the supplied arguments. param: string the name of the function param: array arguments to pass to the function return: mixed the output of the called function or method |
_wrap($sFunction,$sRequestType=XAJAX_POST) X-Ref |
Generates the Javascript wrapper for the specified PHP function. param: string the name of the function param: mixed the request type return: string |
_xmlToArray($rootTag, $sXml) X-Ref |
Takes a string containing xajax xjxobj XML or xjxquery XML and builds an array representation of it to pass as an argument to the PHP function being called. param: string the root tag of the XML param: string XML to convert return: array |
_parseObjXml($rootTag) X-Ref |
A recursive function that generates an array from the contents of $this->aObjArray. param: string the root tag of the XML return: array |
_decodeUTF8Data($sData) X-Ref |
Decodes string data from UTF-8 to the current xajax encoding. param: string data to convert return: string converted data |
xajaxErrorHandler($errno, $errstr, $errfile, $errline) X-Ref |
This function is registered with PHP's set_error_handler() function if the xajax error handling system is turned on. |
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |