Esempio n. 1
0
 /**
  * @param Mage_Core_Controller_Request_Http $request
  *
  * @return string $query
  */
 private function getSearchQuery(Mage_Core_Controller_Request_Http $request)
 {
     $maxQueryLength = (int) Mage::getStoreConfig('catalog/search/max_query_length') > 0 ? (int) Mage::getStoreConfig('catalog/search/max_query_length') : 128;
     $query = preg_replace('/(\\W|html|php)+/', ' ', $request->getRequestString());
     if (count($request->getQuery()) > 0) {
         $query .= implode(' ', $request->getQuery());
     }
     return substr($query, 0, $maxQueryLength);
 }
Esempio n. 2
0
 /**
  * @return array
  */
 public function getQueryParams()
 {
     if (is_null($this->_queryParams)) {
         $query = $this->_request->getQuery();
         foreach ($this->_clearParams as $param) {
             if (array_key_exists($param, $query)) {
                 unset($query[$param]);
             }
         }
         foreach ($this->getFilterableAttributes() as $attribute) {
             if (isset($query[$attribute->getAttributeCode()])) {
                 unset($query[$attribute->getAttributeCode()]);
             }
         }
         $this->_queryParams = $query;
     }
     return $this->_queryParams;
 }
Esempio n. 3
0
 /**
  * Constructor
  *
  * @param array $args
  */
 public function __construct(array $args = array())
 {
     $this->_categoryResource = isset($args['resource']) ? $args['resource'] : Mage::getResourceSingleton('enterprise_catalog/category');
     $this->_request = !empty($args['request']) ? $args['request'] : Mage::app()->getFrontController()->getRequest();
     $this->_response = !empty($args['response']) ? $args['response'] : Mage::app()->getFrontController()->getResponse();
     $this->_storeId = isset($args['storeId']) ? $args['storeId'] : Mage::app()->getStore()->getId();
     $fromStore = $this->_request->getQuery('___from_store');
     $this->_prevStoreId = isset($args['prevStoreId']) ? $args['prevStoreId'] : (!empty($fromStore) ? Mage::app()->getStore($fromStore)->getId() : $this->_storeId);
     $this->_config = isset($args['config']) ? $args['config'] : Mage::app()->getConfig();
     $this->_seoSuffix = (string) $this->_config->getNode(Mage_Catalog_Helper_Category::XML_PATH_CATEGORY_URL_SUFFIX, 'store', (int) $this->_prevStoreId);
     $this->_newStoreSeoSuffix = (string) $this->_config->getNode(Mage_Catalog_Helper_Category::XML_PATH_CATEGORY_URL_SUFFIX, 'store', (int) $this->_storeId);
     if (isset($args['baseUrl'])) {
         $this->_baseUrl = $args['baseUrl'];
     }
 }
Esempio n. 4
0
 /**
  * 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;
 }