本文整理汇总了PHP中DataManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP DataManager::getInstance方法的具体用法?PHP DataManager::getInstance怎么用?PHP DataManager::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager::getInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processRequest
public function processRequest(MMapRequest $request, MMapResponse $response)
{
ob_start('mb_output_handler');
MMapManager::startSession();
//check if the session has expired
MMapManager::checkSessionExpiration();
$return = null;
$dataManager = DataManager::getInstance();
$POST = $request->getPOST();
$params = array();
if (isset($POST['params'])) {
$params = $dataManager->doInput($POST['params']);
} else {
if ($request->issetGET('params')) {
$params = $request->getGET('params');
}
}
$return = array();
foreach ($params as $call) {
$call[2] = json_encode($call[2]);
$_POST['params'] = $call[2];
$request->setPost('params', $call[2]);
$_GET['message'] = $call[1];
$request->setGET('message', $call[1]);
$_GET['checknum'] = $call[0];
$request->setGET('checknum', $call[0]);
MMapMsg::getInstance()->processRequest($request, $response);
MMapManager::getInstance()->doResponse($response);
$response->clear();
$content = ob_get_contents();
ob_clean();
$return[] = $content;
}
$response->setBodyRenderer(new DataManagerBodyRenderer($return));
}
示例2: processRequest
public function processRequest(MMapRequest $request, MMapResponse $response)
{
ob_start('mb_output_handler');
MMapManager::startSession();
//check if the session has expired
MMapManager::checkSessionExpiration();
$return = null;
$dataManager = DataManager::getInstance();
// restore current process using checknum
$myProcManager = ProcManager::getInstance();
$myProcess = $myProcManager->getProcessByChecknum($request->getGET('checknum'));
$myProcManager->setCurrentProcess($myProcess);
$appDesc = new EyeMobileApplicationDescriptor($myProcess->getName());
$POST = $request->getPOST();
$params = array();
if (isset($POST['params'])) {
$params = $dataManager->doInput($POST['params']);
} else {
if ($request->issetGET('params')) {
$params = $request->getGET('params');
}
}
$methodName = $request->getGET('message');
// calling an ExecModule
if (strpos($methodName, '__') === 0) {
$moduleName = explode('_', substr($methodName, 2));
$methodName = $moduleName[1];
//ex: "FileChooser"
$moduleName = $moduleName[0];
//ex: "browsePath"
$return = call_user_func_array(array($appDesc->getApplicationClassName(), '__callModule'), array($moduleName, $methodName, $params));
} else {
if ($appDesc->isJavascriptOnlyApplication()) {
$return = call_user_func(array('EyeosJavascriptApplicationExecutable', $methodName), $params);
} else {
if (method_exists($appDesc->getApplicationClassName(), $methodName)) {
$return = call_user_func(array($appDesc->getApplicationClassName(), $methodName), $params);
} else {
//If no function is present, call the NOT mobile function
MMapMsg::getInstance()->processRequest($request, $response);
return;
}
// try {
// $return = call_user_func(array($appDesc->getApplicationClassName(), $methodName), $params);
// } catch (Exception $e) {
// //If no function is present, call the NOT mobile function
// MMapMsg::getInstance()->processRequest($request, $response);
// return;
// }
}
}
if ($response->getBodyRenderer() === null && $response->getBody() == '') {
$response->setBodyRenderer(new DataManagerBodyRenderer($return));
}
}
示例3: processRequest
public function processRequest(MMapRequest $request, MMapResponse $response)
{
ob_start('mb_output_handler');
MMapManager::startSession();
//check if the session has expired
MMapManager::checkSessionExpiration();
$return = null;
$dataManager = DataManager::getInstance();
// restore current process using checknum
$myProcManager = ProcManager::getInstance();
$myProcess = $myProcManager->getProcessByChecknum($request->getGET('checknum'));
$myProcManager->setCurrentProcess($myProcess);
$appDesc = new EyeosApplicationDescriptor($myProcess->getName());
$POST = $request->getPOST();
$params = array();
if (isset($POST['params'])) {
$params = $dataManager->doInput($POST['params']);
} else {
if ($request->issetGET('params')) {
$params = $request->getGET('params');
}
}
$methodName = $request->getGET('message');
// calling an ExecModule
if (strpos($methodName, '__') === 0) {
$moduleName = explode('_', substr($methodName, 2));
$methodName = $moduleName[1];
//ex: "FileChooser"
$moduleName = $moduleName[0];
//ex: "browsePath"
$return = call_user_func_array(array($appDesc->getApplicationClassName(), '__callModule'), array($moduleName, $methodName, $params));
} else {
if ($appDesc->isJavascriptOnlyApplication()) {
$return = call_user_func(array('EyeosJavascriptApplicationExecutable', $methodName), $params);
} else {
$return = call_user_func(array($appDesc->getApplicationClassName(), $methodName), $params);
}
}
//try to force mime type. If there is a previous mime type defined at application level
//this have no effect
if (!headers_sent()) {
$response->getHeaders()->append('Content-type:text/plain');
}
if ($response->getBodyRenderer() === null && $response->getBody() == '') {
$response->setBodyRenderer(new DataManagerBodyRenderer($return));
}
}
示例4: processRequest
public function processRequest(MMapRequest $request, MMapResponse $response)
{
ob_start('mb_output_handler');
$return = null;
$dataManager = DataManager::getInstance();
$POST = $request->getPOST();
$params = array();
if (isset($POST['params'])) {
$params = $dataManager->doInput($POST['params']);
} else {
if ($request->issetGET('params')) {
$params = $request->getGET('params');
}
}
//login in the system and get a valid login context
$subject = new Subject();
$loginContext = new LoginContext('eyeos-login', $subject);
$cred = new EyeosPasswordCredential();
$cred->setUsername($_REQUEST['username']);
$cred->setPassword($_REQUEST['password'], true);
$subject->getPrivateCredentials()->append($cred);
$loginContext->login();
//now create fake process called api
Kernel::enterSystemMode();
$appProcess = new Process('api');
$appProcess->setPid('31337');
$mem = MemoryManager::getInstance();
$processTable = $mem->get('processTable', array());
$processTable[31337] = $appProcess;
$mem->set('processTable', $processTable);
$appProcess->setLoginContext($loginContext);
ProcManager::getInstance()->setCurrentProcess($appProcess);
kernel::exitSystemMode();
$return = call_user_func_array(array('EyeosApplicationExecutable', '__callModule'), array($request->getPOST('module'), $request->getPOST('name'), $params));
//try to force mime type. If there is a previous mime type defined at application level
//this have no effect
if (!headers_sent()) {
$response->getHeaders()->append('Content-type:text/plain');
}
if ($response->getBodyRenderer() === null && $response->getBody() == '') {
$response->setBodyRenderer(new DataManagerBodyRenderer($return));
}
}
示例5: getRenderedBody
public function getRenderedBody()
{
return DataManager::getInstance()->doOutput($this->getBodyData());
}
示例6: initFromRequest
public function initFromRequest(MMapRequest $request)
{
$this->setRequest($request);
$get = $request->getGET();
$this->setApplicationDescriptor(new EyeMobileApplicationDescriptor($get['getApplication']));
if (isset($get['includeBody'])) {
$this->setIncludeBody($get['includeBody']);
}
if (isset($get['args'])) {
$args = DataManager::getInstance()->doInput($get['args']);
if (is_array($args)) {
$this->setArgs(new ArrayList($args));
} else {
Logger::getLogger('system.services.MMap.AppDroidExecutionContext')->warn('Argument in URL is not an array, ignoring. (Given value: ' . $args . ')');
}
}
}