本文整理汇总了PHP中Zend_Controller_Request_Abstract::isXmlHttpRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Abstract::isXmlHttpRequest方法的具体用法?PHP Zend_Controller_Request_Abstract::isXmlHttpRequest怎么用?PHP Zend_Controller_Request_Abstract::isXmlHttpRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Abstract
的用法示例。
在下文中一共展示了Zend_Controller_Request_Abstract::isXmlHttpRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if ($request->isXmlHttpRequest()) {
return;
}
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$isAllowed = false;
if (Zend_Auth::getInstance()->hasIdentity()) {
$user = Zend_Auth::getInstance()->getIdentity();
require_once APPLICATION_PATH . '/modules/core/services/Acl.php';
$acl = Core_Services_Acl::getInstance();
if (in_array(strtolower($module . '_' . $controller . '_' . $action), array('default_index_index', 'identity_account_logout'))) {
$isAllowed = true;
} else {
$isAllowed = $acl->isUserOrRoleAllowed($user, $module, $controller, $action);
}
}
if (!$isAllowed) {
if (Zend_Auth::getInstance()->hasIdentity()) {
$forwardAction = 'deny';
} else {
$forwardAction = 'login';
}
$sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$sReturn = base64_encode($sReturn);
$request->setModuleName('core')->setControllerName('Auth')->setActionName($forwardAction)->setParam('returnUrl', $sReturn)->setDispatched(true);
}
}
示例2: _checkSkipAcl
protected function _checkSkipAcl(Zend_Controller_Request_Abstract $request, $type)
{
// verificação de requisicao - Caso ajax, verifica se a action é delete, senao, SKIP nele.
if ($request->isXmlHttpRequest() && !in_array($request->getActionName(), $this->_arrAjaxNotSkip)) {
return TRUE;
}
$configs = Zend_Registry::get('configs');
$skip = $configs['security']['skip'][$type];
$result = FALSE;
$result = in_array($request->getActionName(), $skip);
foreach ($skip as $routers) {
$route = explode('/', $routers);
switch (count($route)) {
case 1:
// action
$result = in_array($request->getActionName(), $skip);
break;
case 2:
// controller/action
$result = in_array($request->getControllerName() . '/' . $request->getActionName(), $skip);
break;
case 3:
// module/controller/action
$result = in_array($request->getModuleName() . '/' . $request->getControllerName() . '/' . $request->getActionName(), $skip);
break;
}
if ($result) {
return TRUE;
}
}
return $result;
}
示例3: routeShutdown
public function routeShutdown(Zend_Controller_Request_Abstract $request)
{
if (in_array(System_String::StrToLower($request->getControllerName()), array('admin', 'panel')) && false == $request->isXmlHttpRequest() && false == $request->getParam('direct')) {
$redirector = new Zend_Controller_Action_Helper_Redirector();
$redirector->gotoUrlAndExit('#' . $this->_view->baseUrl() . $this->_view->currentUrl());
}
}
示例4: __construct
/**
* Class constructor
*
*
* @param Zend_Controller_Request_Abstract $request
* @param Zend_Controller_Response_Abstract $response
* @param array $invokeArgs Any additional invocation arguments
* @return void
*/
public function __construct(\Zend_Controller_Request_Abstract $request, \Zend_Controller_Response_Abstract $response, array $invokeArgs = array())
{
if ($request->isXmlHttpRequest()) {
$response->setHeader('content-type', 'application/x-www-form-urlencoded; charset=iso-8859-1', true);
}
parent::__construct($request, $response, $invokeArgs);
}
示例5: postDispatch
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMvcInstance();
// the name "maintenanceMode" is also referred to in the Admin_MaintenanceController,
// so if you change the filename, it needs to be changed there too
$maintenanceModeFileName = 'maintenanceMode';
$register = new Ot_Config_Register();
$identity = Zend_Auth::getInstance()->getIdentity();
$role = empty($identity->role) ? $register->defaultRole->getValue() : $identity->role;
if (isset($identity->masquerading) && $identity->masquerading == true && isset($identity->realAccount) && !is_null($identity->realAccount) && isset($identity->realAccount->role)) {
$role = $identity->realAccount->role;
}
$acl = Zend_Registry::get('acl');
$view = $layout->getView();
$viewRenderer = Zend_Controller_Action_HelperBroker::getExistingHelper('ViewRenderer');
if (is_file(APPLICATION_PATH . '/../overrides/' . $maintenanceModeFileName) && (!$request->isXmlHttpRequest() && !$viewRenderer->getNeverRender())) {
if (!$acl->isAllowed($role, 'ot_maintenance', 'index')) {
if (!($request->getModuleName() == 'ot' && $request->getControllerName() == 'login' && $request->getActionName() == 'index')) {
$response = $this->getResponse();
$layout->disableLayout();
$response->setBody($view->maintenanceMode()->publicLayout());
}
} else {
$response = $this->getResponse();
// there's no point in setting text here if it's a redirect
if ($response->isRedirect()) {
$response->setBody('');
} else {
$response->setBody($view->maintenanceMode()->header() . $response->getBody());
}
}
}
}
示例6: routeStartup
/**
*
* Zend Framework provided front controller hook
* Here used to intercept XmlHttpRequests sent off for javascript error logging
*/
public function routeStartup(Zend_Controller_Request_Abstract $request)
{
if ($request->__get('monitori') == 'x' && $request->isXmlHttpRequest()) {
$monitor = Zend_Registry::get('monitor');
$message = "A javascript error was detected.\n" . "================================\n" . "Message: " . $_POST['message'] . ";\n" . "Uri: " . $_POST['errorUrl'] . ";\n" . "Line: " . $_POST['errorLine'] . ";\n" . ";";
$monitor->writeLog($message, 4, 'javascript-error');
}
}
示例7: postDispatch
/**
* @todo: This has nothing to do with the langselector, so maybe move it to its own plugin
*
*/
public function postDispatch(Zend_Controller_Request_Abstract $request)
{
// Don't save ajax call url's as the last request
if (!$request->isXmlHttpRequest()) {
$lastRequest = Zend_Controller_Action_HelperBroker::getStaticHelper('lastRequest');
$lastRequest->saveRequestUri($request->getRequestUri());
}
}
示例8: deleteAction
/**
* deleteAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function deleteAction()
{
$this->core->logger->debug('core->controllers->FolderController->deleteAction()');
$this->getModelFolders();
if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
$this->objModelFolders->deleteFolderNode($this->objRequest->getParam("id"));
$this->view->blnShowFormAlert = true;
}
$this->renderScript('folder/form.phtml');
}
示例9: deleteAction
/**
* deleteAction
* @author Cornelius Hansjakob <cha@massiveart.com>
* @version 1.0
*/
public function deleteAction()
{
$this->core->logger->debug('properties->controllers->CategoryController->deleteAction()');
$this->getModelCategories();
if ($this->objRequest->isPost() && $this->objRequest->isXmlHttpRequest()) {
$this->objModelCategories->deleteCategoryNode($this->objRequest->getParam("id"));
$this->view->blnShowFormAlert = true;
}
$this->renderScript('category/form.phtml');
}
示例10: dispatchLoopStartup
public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
{
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->init();
if (!$request->isXmlHttpRequest()) {
// set up variables that the view may want to know
$viewRenderer->view->module = $request->getModuleName();
$viewRenderer->view->controller = $request->getControllerName();
$viewRenderer->view->action = $request->getActionName();
}
}
示例11: preDispatch
/**
*
*/
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$module = $request->getModuleName();
$controller = $request->getControllerName();
$action = $request->getActionName();
$front = Zend_Controller_Front::getInstance();
$logger = $front->getParam('bootstrap')->getResource('logger');
$logger->setEventItem('http', $request->isXmlHttpRequest() ? 'AJAX' : $request->getMethod());
$logger->setEventItem('module', $module);
$logger->setEventItem('controller', $controller);
$logger->setEventItem('action', $action);
}
示例12: routeStartup
/**
* Called before Zend_Controller_Front begins evaluating the
* request against its routes.
*
* @param AbstractRequest $request
* @return void
*/
public function routeStartup(AbstractRequest $request)
{
if (!$request instanceof HttpRequest) {
return;
}
if ($request->getQuery('monitor') === 'x' && $request->isXmlHttpRequest()) {
$message = "A javascript error was detected.\n" . "================================\n" . 'Message: ' . $request->getPost('message', '') . "\n" . 'URI: ' . $request->getPost('errorUrl', 'unknown') . "\n" . 'Line: ' . $request->getPost('errorLine', 'unknown') . "\n";
Zend_Registry::get('monitor')->writeLog($message, Zend_Log::WARN, 'javascript-error');
// Immediately return empty response
$this->getResponse()->setBody('')->sendResponse();
exit;
}
}
示例13: deleteAction
/**
* deleteAction
* @author Daniel Rotter <daniel.rotter@massiveart.com>
* @version 1.0
*/
public function deleteAction()
{
$this->core->logger->debug('widgets->blog->CommentController->deleteAction');
$this->_helper->viewRenderer->setNoRender();
try {
if ($this->objRequest->getPost() && $this->objRequest->isXmlHttpRequest()) {
$this->getModelBlogEntryComment()->deleteBlogEntryComment($this->objRequest->getParam('id'));
}
} catch (Exception $exc) {
$this->core->logger->err($exc);
exit;
}
}
示例14: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Controller_Action_HelperBroker::getStaticHelper('Layout');
$view = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->view;
$layout->setLayout('solo');
if ($request->isXmlHttpRequest()) {
$layout->disableLayout();
}
if ($request->getParam('layout')) {
$layout->setLayout($request->getParam('layout'));
}
$view->theme = Tri_Config::get('tri_theme');
$view->appCharset = Tri_Config::get('tri_app_charset');
}
示例15: preDispatch
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
// Get the view renderer
$viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
$viewRenderer->initView();
if ($request->getParam('isAdmin') && !$request->isXmlHttpRequest() && Zend_Auth::getInstance()->hasIdentity()) {
$this->_acl = Zend_Controller_Action_HelperBroker::getStaticHelper('BuildAcl')->direct();
$this->_adminNav = Zend_Controller_Action_HelperBroker::getStaticHelper('AdminNav')->direct();
$viewRenderer->view->navigation($this->_adminNav)->setAcl($this->_acl)->setRole(Zend_Auth::getInstance()->getIdentity()->role);
}
// Check if we are in the public module
if ($request->getModuleName() == 'public' || $request->getParam('public')) {
$viewRenderer->view->navigation($this->_publicNav);
}
}