<?php
/*
File: xajaxResponse.inc.php
Contains the response class.
Title: xajax response class
Please see <copyright.inc.php> for a detailed description, copyright
and license information.
*/
/*
@package xajax
@version $Id: xajaxResponse.inc.php 361 2007-05-24 12:48:14Z 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: xajaxResponse
Collect commands to be sent back to the browser in response to a xajax
request. Commands are encoded and packaged in a format that is acceptable
to the response handler from the javascript library running on the client
side.
Common commands include:
- <xajaxResponse->assign>: Assign a value to an elements property.
- <xajaxResponse->append>: Append a value on to an elements property.
- <xajaxResponse->script>: Execute a portion of javascript code.
- <xajaxResponse->call>: Execute an existing javascript function.
- <xajaxResponse->alert>: Display an alert dialog to the user.
Elements are identified by the value of the HTML id attribute. If you do
not see your updates occuring on the browser side, ensure that you are
using the correct id in your response.
*/
class xajaxResponse
{
/*
Array: aCommands
Stores the commands that will be sent to the browser in the response.
*/
public $aCommands;
/*
String: sCharacterEncoding
The name of the encoding method you wish to use when dealing with
special characters. See <xajax->setEncoding> for more information.
*/
private $sCharacterEncoding;
/*
Boolean: bOutputEntities
Convert special characters to the HTML equivellent. See also
<xajax->bOutputEntities> and <xajax->configure>.
*/
private $bOutputEntities;
/*
Mixed: returnValue
A string, array or integer value to be returned to the caller when
using 'synchronous' mode requests. See <xajax->setMode> for details.
*/
private $returnValue;
/*
Object: objPluginManager
A reference to the global plugin manager.
*/
private $objPluginManager;
// sorry but this config is static atm
private $sContentType = 'application/json'; //'text/xml';
/*
Constructor: xajaxResponse
Create and initialize a xajaxResponse object.
*/
public function __construct()
{
//SkipDebug
if (0 < func_num_args()) {
$objLanguageManager = xajaxLanguageManager::getInstance();
trigger_error(
$objLanguageManager->getText('XJXRSP:EDERR:01')
, E_USER_ERROR
);
}
//EndSkipDebug
$this->aCommands = array();
$objResponseManager = xajaxResponseManager::getInstance();
$this->sCharacterEncoding = $objResponseManager->getCharacterEncoding();
$this->bOutputEntities = $objResponseManager->getOutputEntities();
$this->setResponseType($objResponseManager->getConfiguration('responseType'));
$this->objPluginManager = xajaxPluginManager::getInstance();
}
function getResponseType()
{
return $this->sResponseType;
}
function setResponseType($sResponseType) {
if (NULL == $sResponseType) return;
$this->sResponseType = $sResponseType ;
if ('XML' == $sResponseType) {
$this->setContentType('text/xml');
}
elseif ('JSON' == $sResponseType) {
$this->setContentType('application/json');
}
}
/*
Function: setCharacterEncoding
Overrides the default character encoding (or the one specified in the
constructor) to the specified character encoding.
Parameters:
sCharacterEncoding - (string): The encoding method to use for this response.
See also, <xajaxResponse->xajaxResponse>()
Returns:
object - The xajaxResponse object.
*/
public function setCharacterEncoding($sCharacterEncoding)
{
$this->sCharacterEncoding = $sCharacterEncoding;
return $this;
}
/*
Function: setOutputEntities
Convert special characters to their HTML equivellent automatically
(only works if the mb_string extension is available).
Parameters:
bOption - (boolean): Convert special characters
Returns:
object - The xajaxResponse object.
*/
public function setOutputEntities($bOutputEntities)
{
$this->bOutputEntities = (boolean)$bOutputEntities;
return $this;
}
/*
Function: plugin
Provides access to registered response plugins. If you are using PHP
4 or 5, pass the plugin name as the first argument, the plugin method
name as the second argument and subsequent arguments (if any) to be
passed along to the plugin.
Optionally, if you use PHP 5, you can pass just the plugin name as the
first argument and the plugin object will be returned. You can then
access the methods of the plugin directly.
Parameters:
sName - (string): Name of the plugin.
sFunction - (string, optional): The name of the method to call.
arg1...argn - (mixed, optional): Additional arguments to pass on to
the plugin function.
Returns:
object - The plugin specified by sName.
*/
public function plugin()
{
$aArgs = func_get_args();
$nArgs = func_num_args();
//SkipDebug
if (false == (0 < $nArgs)) {
$objLanguageManager = xajaxLanguageManager::getInstance();
trigger_error(
$objLanguageManager->getText('XJXRSP:MPERR:01')
, E_USER_ERROR
);
}
//EndSkipDebug
$sName = array_shift($aArgs);
$objPlugin = $this->objPluginManager->getResponsePlugin($sName);
if (false === $objPlugin)
{
$bReturn = false;
return $bReturn;
}
$objPlugin->setResponse($this);
if (0 < count($aArgs))
{
$sMethod = array_shift($aArgs);
$aFunction = array($objPlugin, $sMethod);
call_user_func_array($aFunction, $aArgs);
}
return $objPlugin;
}
/*
Function: __get
Magic function for PHP 5. Used to permit plugins to be called as if they
where native members of the xajaxResponse instance.
Parameters:
sPluginName - (string): The name of the plugin.
Returns:
object - The plugin specified by sPluginName.
*/
public function __get($sPluginName)
{
$objPlugin = $this->plugin($sPluginName);
return $objPlugin;
}
/*
Function: confirmCommands
Response command that prompts user with [ok] [cancel] style
message box. If the user clicks cancel, the specified
number of response commands following this one, will be
skipped.
Parameters:
iCmdNumber - (integer): The number of commands to skip upon cancel.
sMessage - (string): The message to display to the user.
Returns:
object : The xajaxResponse object.
*/
public function confirmCommands($iCmdNumber, $sMessage)
{
return $this->addCommand(
array(
'cmd'=>'cc',
'id'=>$iCmdNumber
),
$sMessage
);
}
/*
Function: assign
Response command indicating that the specified value should be
assigned to the given element's attribute.
Parameters:
sTarget - (string): The id of the html element on the browser.
sAttribute - (string): The property to be assigned.
sData - (string): The value to be assigned to the property.
Returns:
object : The <xajaxResponse> object.
*/
public function assign($sTarget,$sAttribute,$sData)
{
return $this->addCommand(
array(
'cmd'=>'as',
'id'=>$sTarget,
'prop'=>$sAttribute
),
$sData
);
}
/*
Function: append
Response command that indicates the specified data should be appended
to the given element's property.
Parameters:
sTarget - (string): The id of the element to be updated.
sAttribute - (string): The name of
没有合适的资源?快使用搜索试试~ 我知道了~
xajax-0.6-beta1.zip_xajax comet
共84个文件
php:53个
js:28个
bak:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 23 浏览量
2022-09-24
02:35:37
上传
评论
收藏 215KB ZIP 举报
温馨提示
Xajax是一个开源的 PHP 类库 它能够让你黏合HTML、CSS、JavaScript和PHP,轻而易举的开发功能强大、基于WEB的AJAX应用软件.
资源推荐
资源详情
资源评论
收起资源包目录
xajax-0.6-beta1.zip (84个子文件)
xajax_core
xajaxCompress.inc.php 4KB
xajaxLanguageManager.inc.php 7KB
plugin_layer
xajaxScriptPlugin.inc.php 7KB
xajaxEventPlugin.inc.php 5KB
xajaxDefaultIncludePlugin.inc.php 10KB
support
xajaxEvent.inc.php 4KB
xajaxUserFunction.inc.php 7KB
xajaxCallableObject.inc.php 6KB
xajaxCallableObjectPlugin.inc.php 5KB
xajaxFunctionPlugin.inc.php 6KB
xajaxResponse.inc.php 47KB
xajaxRequest.inc.php 9KB
xajaxResponseManager.inc.php 7KB
xajax.inc.php 30KB
xajax_lang_de.inc.php 5KB
xajaxArgumentManager.inc.php 8KB
xajaxControl.inc.php 20KB
xajaxPlugin.inc.php 5KB
xajaxPluginManager.inc.php 9KB
xajax_lang_nl.inc.php 5KB
xajax_js
xajax_lang_es_uncompressed.js 3KB
xajax_lang_es.js 3KB
xajax_lang_nl.js 3KB
xajax_lang_bg_uncompressed.js 4KB
xajax_verbose_uncompressed.js 4KB
xajax_core.js 41KB
xajax_debug.js 25KB
xajax_lang_tr_uncompressed.js 3KB
xajax_lang_bg.js 4KB
xajax_lang_fr_uncompressed.js 3KB
xajax_debug_uncompressed.js 25KB
JSON.js 3KB
xajax_lang_fr.js 3KB
JSON_uncompressed.js 17KB
xajax_lang_tr.js 3KB
xajax_lang_de_uncompressed.js 3KB
xajax_lang_nl_uncompressed.js 3KB
xajax_core_uncompressed.js 91KB
xajax_verbose.js 2KB
xajax_lang_de.js 3KB
copyright.inc.php 1KB
tests
myExternalFunction.js 143B
index.php 3KB
changeEventTest.php 1KB
HTTPStatusTest.php 2KB
catchAllFunctionTest.php 3KB
fluentInterfaceTest.php 1KB
nonXajaxResponseTest.php 3KB
registerExternalFunctionTest.php 1KB
performance.php 6KB
eventHandlerTest.php 2KB
formSubmissionTest.php 6KB
xajaxResponseTest.php 2KB
disabledFormElementsTest.php 1KB
customResponseClassTest.php 4KB
largeResponseTest.php 1KB
preFunctionTest.php 4KB
basicPluginTest.php 2KB
phpWhitespaceTest.php 1KB
callTechniquesTest.php 6KB
myExternalFunction.php 612B
includeExternalScriptTest.php 1KB
charEncodingTest.php 5KB
callScriptTest.php 2KB
searchReplaceTest.php 3KB
registerObjectTest.php 5KB
xajax_error_log.log 2KB
createFormInputTest.php 5KB
redirectTest.php 1KB
errorHandlingTest.php 3KB
xajax_plugins
response
swfupload
swfupload.inc.php 3KB
swfupload.js 22KB
swfupload.swf 12KB
swfupload.xajax_uncompressed.js 29KB
swfupload_uncompressed.js 36KB
swfupload.xajax.js 16KB
tableUpdater.js 21KB
comet
comet.js 9KB
comet.inc.php 6KB
comet_uncompressed.js.bak 14KB
comet_uncompressed.js 14KB
xajaxCometFunction.inc.php 6KB
googleMap.inc.php 2KB
tableUpdater.inc.php 4KB
request
共 84 条
- 1
资源评论
邓凌佳
- 粉丝: 65
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功