本文整理匯總了PHP中Zend_Controller_Request_Http::isXmlHttpRequest方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Controller_Request_Http::isXmlHttpRequest方法的具體用法?PHP Zend_Controller_Request_Http::isXmlHttpRequest怎麽用?PHP Zend_Controller_Request_Http::isXmlHttpRequest使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::isXmlHttpRequest方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: nopageAction
public function nopageAction()
{
$http = new Zend_Controller_Request_Http();
if ($http->isXmlHttpRequest()) {
$this->view->noLayout = true;
}
}
示例2: canUpdateSessionActivity
/**
* Can this controller update the session activity? Returns false by default for AJAX requests.
* Override this in specific controllers if you want action-specific behaviour.
*
* @param string $controllerName
* @param string $action
* @param string $newState
*
* @return boolean
*/
public function canUpdateSessionActivity($controllerName, $action, &$newState)
{
// don't update session activity for an AJAX request
if ($this->_request->isXmlHttpRequest()) {
return false;
}
return true;
}
示例3: init
public function init()
{
$http = new Zend_Controller_Request_Http();
if ($http->isXmlHttpRequest()) {
$this->view->noLayout = true;
}
/* Initialize action controller here */
/*
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('view', 'html')
->addActionContext('form', 'html')
->addActionContext('process', 'json')
->initContext();
*/
$this->_db = Zend_Registry::get('db');
$this->_user = Zend_Registry::get('user');
$this->_db_user = new Database_User($this->_db);
}
示例4: init
public function init()
{
$request = new Zend_Controller_Request_Http();
if (!$request->isXmlHttpRequest()) {
$options = $this->getOptions();
if (isset($options['url']) && $options['url'] !== null && $options['url'] != '') {
try {
try {
if (($application = dirname($_SERVER['DOCUMENT_ROOT'])) !== null) {
$applicationDirectories = split(DIRECTORY_SEPARATOR, $application);
$application = array_pop($applicationDirectories);
}
} catch (Exception $exception) {
$application = '';
}
$client = new Zend_Http_Client($options['url'], array('maxredirects' => 0, 'timeout' => 3));
$client->setParameterPost(array('application' => $application, 'host' => gethostname(), 'data' => $_SERVER, 'message' => 'Page request', 'ipaddress' => $this->_getIP()))->request('POST');
} catch (Exception $exception) {
}
}
}
}
示例5: testIsXmlHttpRequest
public function testIsXmlHttpRequest()
{
$this->assertFalse($this->_request->isXmlHttpRequest());
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
$this->assertTrue($this->_request->isXmlHttpRequest());
}
示例6: _assertIsAjax
/**
* Determines whether the given request is an ajax request
*
* @param HttpRequest $request
* @return boolean
*/
protected function _assertIsAjax(HttpRequest $request)
{
return $request->isXmlHttpRequest();
}
示例7: trackableRequest
/**
* Validate that we want to track the request
*
* @return Boolean
*/
private function trackableRequest()
{
// Decide whether or not we should track Ajax Requests
if ($this->_ajax == 0) {
$request = new Zend_Controller_Request_Http();
if ($request->isXmlHttpRequest()) {
return false;
}
}
// Now we are going to verify the user didn't just reload the page or click the same link.
// No reason to track page reloads.
if ($this->_currentUrl == $this->_namespace->history[0]) {
return false;
}
//@todo Setup check for a 404 error so we don't track bad requests.
return true;
}
示例8: _go
/**
* _forward
*
* @param mixed $action Action name
* @param string $controller Controller name
* @param string $module Module name
* @param mixed $params Parameters
* @access private
* @return void
*/
protected function _go($action, $controller = null, $module = null, $params = null)
{
if ($this->_request->isXmlHttpRequest()) {
return;
}
parent::_forward($action, $controller, $module, $params);
return;
}