mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
issue 2596
git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@11775 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
fcee2600f1
commit
026d616377
2 changed files with 18 additions and 3 deletions
|
|
@ -21,6 +21,11 @@ class Context {
|
|||
* @var string GET|POST|XMLRPC
|
||||
*/
|
||||
var $request_method = 'GET';
|
||||
/**
|
||||
* js callback function name.
|
||||
* @var string
|
||||
*/
|
||||
var $js_callback_func = '';
|
||||
/**
|
||||
* Response method.If it's not set, it follows request method.
|
||||
* @var string HTML|XMLRPC
|
||||
|
|
@ -823,12 +828,12 @@ class Context {
|
|||
function setRequestMethod($type='') {
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
|
||||
$xe_js_callback = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
|
||||
$self->js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback'];
|
||||
|
||||
($type && $self->request_method=$type) or
|
||||
(strpos($_SERVER['CONTENT_TYPE'],'json') && $self->request_method='JSON') or
|
||||
($GLOBALS['HTTP_RAW_POST_DATA'] && $self->request_method='XMLRPC') or
|
||||
($xe_js_callback && $self->request_method='JS_CALLBACK') or
|
||||
($self->js_callback_func && $self->request_method='JS_CALLBACK') or
|
||||
($self->request_method = $_SERVER['REQUEST_METHOD']);
|
||||
}
|
||||
|
||||
|
|
@ -1020,6 +1025,16 @@ class Context {
|
|||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return js callback func.
|
||||
* @return string callback func.
|
||||
*/
|
||||
function getJSCallbackFunc()
|
||||
{
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
return $self->js_callback_func;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make URL with args_list upon request URL
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ class JSCallbackDisplayHandler{
|
|||
$variables['error'] = $oModule->getError();
|
||||
$variables['message'] = $oModule->getMessage();
|
||||
$json = str_replace(array("\r\n","\n","\t"),array('\n','\n','\t'),json_encode2($variables));
|
||||
$output = sprintf('<script>%s(%s);</script>', Context::get('xe_js_callback'), $json);
|
||||
$output = sprintf('<script>%s(%s);</script>', Context::getJSCallbackFunc(), $json);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue