本文整理汇总了PHP中Zend_Controller_Request_Http::getQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::getQuery方法的具体用法?PHP Zend_Controller_Request_Http::getQuery怎么用?PHP Zend_Controller_Request_Http::getQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::getQuery方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matchForwardShort
/**
* @return bool
*/
protected function matchForwardShort()
{
$pageId = $this->request->getPathInfo();
$pageId = $this->getUrlHelper()->checkRemoveSuffix($pageId);
$pageId = trim($pageId, '/');
$p = strrpos($pageId, '/');
if ($p) {
$cat = substr($pageId, 0, $p);
$params = substr($pageId, $p);
} else {
$cat = '';
$params = $pageId;
}
/** @var Amasty_Shopby_Model_Url_Parser $shortParser */
$shortParser = Mage::getModel('amshopby/url_parser');
$query = $shortParser->parseParams($params);
if ($query === false) {
return false;
}
$query = array_merge($this->request->getQuery(), $query);
$this->request->setQuery($query);
if (strlen($cat)) {
// normal category
try {
$this->forwardCategory($cat);
} catch (Mage_Core_Controller_Varien_Exception $e) {
return false;
}
} else {
// root category
$this->forwardShopby();
}
return true;
}
示例2: matchForwardShort
/**
* @return bool
*/
protected function matchForwardShort()
{
$pageId = $this->request->getPathInfo();
$pageId = $this->getUrlHelper()->checkRemoveSuffix($pageId);
$pageId = trim($pageId, '/');
$p = strrpos($pageId, '/');
if ($p) {
$cat = substr($pageId, 0, $p);
$params = substr($pageId, $p);
} else {
$cat = '';
$params = $pageId;
}
/** @var Amasty_Shopby_Model_Url_Parser $shortParser */
$shortParser = Mage::getModel('amshopby/url_parser');
$queryDelta = $shortParser->parseParams($params);
if (is_array($queryDelta)) {
$query = $this->request->getQuery();
$query = array_merge($query, $queryDelta);
$this->request->setQuery($query);
if (strlen($cat)) {
// normal category
$result = $this->forwardCategory($cat);
} else {
// root category
$this->forwardShopby();
$result = true;
}
return $result;
}
return false;
}
示例3: getRequestParameters
public function getRequestParameters()
{
if ($this->request->isPost()) {
return $this->request->getPost();
} else {
return $this->request->getQuery();
}
}
示例4: testSetRequestUri
public function testSetRequestUri()
{
$this->_request->setRequestUri('/archives/past/4?set=this&unset=that');
$this->assertEquals('/archives/past/4?set=this&unset=that', $this->_request->getRequestUri());
$this->assertEquals('this', $this->_request->getQuery('set'));
$this->assertEquals('that', $this->_request->getQuery('unset'));
}
示例5: _rewriteDb
/**
* Implement logic of custom rewrites
*
* @return bool
*/
protected function _rewriteDb()
{
if (null === $this->_rewrite->getStoreId() || false === $this->_rewrite->getStoreId()) {
$this->_rewrite->setStoreId($this->_app->getStore()->getId());
}
$requestCases = $this->_getRequestCases();
$this->_rewrite->loadByRequestPath($requestCases);
$fromStore = $this->_request->getQuery('___from_store');
if (!$this->_rewrite->getId() && $fromStore) {
$stores = $this->_app->getStores(false, true);
if (!empty($stores[$fromStore])) {
/** @var $store Mage_Core_Model_Store */
$store = $stores[$fromStore];
$fromStoreId = $store->getId();
} else {
return false;
}
$this->_rewrite->setStoreId($fromStoreId)->loadByRequestPath($requestCases);
if (!$this->_rewrite->getId()) {
return false;
}
// Load rewrite by id_path
$currentStore = $this->_app->getStore();
$this->_rewrite->setStoreId($currentStore->getId())->loadByIdPath($this->_rewrite->getIdPath());
$this->_setStoreCodeCookie($currentStore->getCode());
$targetUrl = $currentStore->getBaseUrl() . $this->_rewrite->getRequestPath();
$this->_sendRedirectHeaders($targetUrl, true);
}
if (!$this->_rewrite->getId()) {
return false;
}
$this->_request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $this->_rewrite->getRequestPath());
$this->_processRedirectOptions();
return true;
}
示例6: getPaginator
/**
* Возвращает массив опций для построения постраничной навигации
* Необходимо дергать сразу после выполнения SQL-запроса с SQL_CAL_FOUND_ROWS
*
* @param array $options - Массив опций
*
* @return object
*/
function getPaginator($options = array())
{
$Paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Null($this->_db->fetchOne('SELECT FOUND_ROWS()')));
$Paginator->setItemCountPerPage(isset($options['perpage']) ? $options['perpage'] : $this->getPerPage());
if (isset($options['widgetid'])) {
$Paginator->setCurrentPageNumber($this->getCurrentPage($options['widgetid']));
} else {
$Paginator->setCurrentPageNumber($this->getCurrentPage());
}
$out = $Paginator->getPages();
$pageidentity = $this->getPageIdentity();
// Кроме стандартных параметров Zend_Paginator::getPages() возвращаем доп. параметры
// Полный путь без GET-запроса
$UrlInfo = parse_url($this->_request->getRequestUri());
$out->ClearUrl = $UrlInfo['path'];
// Обрабатываем GET-запрос
$query = $this->_request->getQuery();
if (isset($query[$pageidentity])) {
unset($query[$pageidentity]);
}
if (isset($query['widget'])) {
unset($query['widget']);
}
// Строим строку выражения
if (!empty($query)) {
$out->Query = http_build_query($query);
}
// Фактически, ссылку на первую страницу (без page и widget)
$out->FullUrl = isset($out->Query) ? $out->ClearUrl . '?' . $out->Query : $out->ClearUrl;
// Добавляем к выражению Id виджета
$widget = isset($options['widgetid']) ? 'widget=' . (int) $options['widgetid'] . '&' : '';
// Полную ссылку к которой в конце надо только добавить номер страницы
$out->PageUrl = isset($out->Query) ? $out->FullUrl . '&' . $widget . $pageidentity . '=' : $out->FullUrl . '?' . $widget . $pageidentity . '=';
return $out;
}
示例7: getQuery
/**
* @access public
* @param string $key Key to search for in $_GET
* @param mixed $default Default value if $key is not found in $_GET
* @param integer $filter Filter definition
* @param array $options Filter configuration
* @return mixed
*/
public function getQuery($key = null, $default = null, $filter = null, array $options = null)
{
$value = parent::getQuery($key, $default);
if ($filter !== null || $options !== null) {
$value = $this->_filter($value, $default, $filter, $options);
}
return $value;
}
示例8: getRedirectUrl
/**
* Redirect to startup page after logging in if request contains any params (except security key)
*
* @param Mage_Admin_Model_User $user
* @param Zend_Controller_Request_Http $request
* @param string|null $alternativeUrl
* @return null|string
*/
public function getRedirectUrl(Mage_Admin_Model_User $user, Zend_Controller_Request_Http $request = null, $alternativeUrl = null)
{
if (empty($request)) {
return;
}
$countRequiredParams = $this->_urlModel->useSecretKey() && $request->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME) ? 1 : 0;
$countGetParams = count($request->getUserParams()) + count($request->getQuery());
return $countGetParams > $countRequiredParams ? $this->_urlModel->getUrl($user->getStartupPageUrl()) : $alternativeUrl;
}
示例9: canProcessRequest
/**
* Do basic validation for request to be cached
*
* @param Zend_Controller_Request_Http $request
* @return bool
*/
public function canProcessRequest(Zend_Controller_Request_Http $request)
{
$res = $this->isAllowed();
$res = $res && Mage::app()->useCache('full_page');
if ($request->getParam('no_cache')) {
$res = false;
}
if ($res) {
$maxDepth = Mage::getStoreConfig(self::XML_PATH_ALLOWED_DEPTH);
$queryParams = $request->getQuery();
unset($queryParams[Enterprise_PageCache_Model_Cache::REQUEST_MESSAGE_GET_PARAM]);
$res = count($queryParams) <= $maxDepth;
}
if ($res) {
$multicurrency = Mage::getStoreConfig(self::XML_PATH_CACHE_MULTICURRENCY);
if (!$multicurrency && !empty($_COOKIE['currency'])) {
$res = false;
}
}
return $res;
}
示例10: _getRequestParamsString
/**
*
* @param Zend_Controller_Request_Http $request
* @return string
*/
protected function _getRequestParamsString(Zend_Controller_Request_Http $request)
{
$allRequestParameters = $request->getQuery();
return count($allRequestParameters) ? http_build_query($allRequestParameters) : '';
}
示例11: _fetchProtocolParamsFromQuery
/**
* Retrieve protocol parameters from query string
*
* @return Mage_Oauth_Model_Server
*/
protected function _fetchProtocolParamsFromQuery()
{
foreach ($this->_request->getQuery() as $queryParamName => $queryParamValue) {
if ($this->_isProtocolParameter($queryParamName)) {
$this->_protocolParams[$queryParamName] = $queryParamValue;
}
}
return $this;
}
示例12: getCurrentPage
/**
* 获取当前页页码
*
* @return integer
*/
public function getCurrentPage()
{
if (null === $this->_currentPage) {
$request = new Zend_Controller_Request_Http();
$currentPage = $request->getQuery($this->getUriSegment());
$this->setCurrentPage($currentPage);
}
return $this->_currentPage;
}
示例13: buildUrl
/**
* Builds a new URL using an existing $request.
*
* @param string $scheme http or https
* @param string $hostname
* @param string $baseUrl
* @param Zend_Controller_Request_Http $request
* @return string
*/
private function buildUrl($scheme, $hostname, $baseUrl, Zend_Controller_Request_Http $request)
{
$url = sprintf('%s://%s%s%s', $scheme, $hostname, $baseUrl, $request->getPathInfo());
$query = $request->getQuery();
if (!empty($query)) {
$url .= '?' . http_build_query($query);
}
return $url;
}
示例14: getQuery
public function getQuery($k = null, $default = null)
{
if (in_array('vars', $this->getParamSources())) {
if (!$this->isGet()) {
return $k === null ? array() : null;
}
if ($k === null) {
return $this->_vars;
} else {
return isset($this->_vars[$k]) ? $this->_vars[$k] : $default;
}
} else {
return parent::getQuery($k, $default);
}
}