本文整理汇总了PHP中Zend_Controller_Request_Http::isSecure方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::isSecure方法的具体用法?PHP Zend_Controller_Request_Http::isSecure怎么用?PHP Zend_Controller_Request_Http::isSecure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::isSecure方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isValid
/**
* See if the request the proper security
*
* @param Zend_Controller_Request_Http $request The request to check
* @return boolean
*/
public function isValid($request)
{
if (!$request->isSecure()) {
$this->_error(self::NOT_SECURE);
return false;
}
return true;
}
示例2: match
/**
* Overrides match to detect port
*
* @param Zend_Controller_Request_Http $request
* @return array|false
*/
public function match($request)
{
if ($this->hasPort()) {
// Check that the port matches the route port
$host = $request->getHttpHost();
if (preg_match(self::PORT_REGEXP, $host, $m)) {
$port = (int) $m[1];
} else {
// Assign a default port according to the scheme
$port = $request->isSecure() ? 443 : 80;
}
if ($port !== (int) $this->getPort()) {
return false;
}
}
// Default match
return parent::match($request);
}
示例3: getRequestPaths
/**
* Gets the request paths from the specified request object.
*
* @param Zend_Controller_Request_Http $request
*
* @return array Keys: basePath, host, protocol, fullBasePath, requestUri
*/
public static function getRequestPaths(Zend_Controller_Request_Http $request)
{
$basePath = $request->getBasePath();
if ($basePath === '' || substr($basePath, -1) != '/') {
$basePath .= '/';
}
$host = $request->getServer('HTTP_HOST');
if (!$host) {
$host = $request->getServer('SERVER_NAME');
$serverPort = intval($request->getServer('SERVER_PORT'));
if ($serverPort && $serverPort != 80 && $serverPort != 443) {
$host .= ':' . $serverPort;
}
}
$protocol = $request->isSecure() ? 'https' : 'http';
$requestUri = $request->getRequestUri();
return array('basePath' => $basePath, 'host' => $host, 'protocol' => $protocol, 'fullBasePath' => $protocol . '://' . $host . $basePath, 'requestUri' => $requestUri, 'fullUri' => $protocol . '://' . $host . $requestUri);
}
示例4: _initZendX
protected function _initZendX()
{
$view = new Zend_View();
$website = Zend_Registry::get('website');
$misc = Zend_Registry::get('misc');
$url = preg_replace('~^https?://~', '', $website['url']);
$request = new Zend_Controller_Request_Http();
$protocol = $request->getScheme();
$view->addHelperPath('ZendX/JQuery/View/Helper/', 'ZendX_JQuery_View_Helper');
if ($misc['jquery'] == 'local') {
$view->jQuery()->setLocalPath($protocol . '://' . $url . 'system/js/external/jquery/jquery.js');
} else {
$view->jQuery()->setCdnSsl($request->isSecure())->setVersion($misc['jqversion']);
}
if ($misc['jqueryui'] == 'local') {
$view->jQuery()->setUiLocalPath($protocol . '://' . $url . 'system/js/external/jquery/jquery-ui.js');
} else {
$view->jQuery()->setUiVersion($misc['jquversion']);
}
$viewRenderer = new Zend_Controller_Action_Helper_ViewRenderer($view);
Zend_Controller_Action_HelperBroker::addHelper($viewRenderer);
}
示例5: _checkShouldBeSecure
/**
* Check that request uses https protocol if it should.
* Function redirects user to correct URL if needed.
*
* @param Zend_Controller_Request_Http $request
* @param string $path
* @return void
*/
protected function _checkShouldBeSecure(Zend_Controller_Request_Http $request, $path = '')
{
if (!Mage::isInstalled() || $request->getPost()) {
return;
}
if ($this->_shouldBeSecure($path) && !$request->isSecure()) {
$url = $this->_getCurrentSecureUrl($request);
if ($this->_shouldRedirectToSecure()) {
$url = Mage::getSingleton('Mage_Core_Model_Url')->getRedirectUrl($url);
}
Mage::app()->getFrontController()->getResponse()->setRedirect($url)->sendResponse();
exit;
}
}