当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Controller_Request_Http类代码示例

本文整理汇总了PHP中Mage_Core_Controller_Request_Http的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http类的具体用法?PHP Mage_Core_Controller_Request_Http怎么用?PHP Mage_Core_Controller_Request_Http使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Core_Controller_Request_Http类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testIsAllowed

 /**
  * @dataProvider dataProviderIsAllowed
  * @param string $config
  * @param string $module
  * @param string $controller
  * @param string $action
  * @param array  $issuersWithJobs
  * @param bool   $isAllowed
  * @param string $urn
  */
 public function testIsAllowed($config, $module, $controller, $action, $issuersWithJobs, $isAllowed, $urn = '')
 {
     $configMock = $this->getMock('Mage_Core_Model_Config', array('getNode'));
     $configMock->expects($this->any())->method('getNode')->with($this->equalTo('default/xcom/initializer_acl'))->will($this->returnValue(new Varien_Simplexml_Element($config)));
     $request = new Mage_Core_Controller_Request_Http();
     $request->setControllerModule($module)->setControllerName($controller)->setActionName($action);
     $request->setRequestUri($urn)->setPathInfo();
     $fabricHelper = $this->mockHelper('xcom_xfabric', array('getNodeByXpath'));
     $fabricHelper->expects($this->any())->method('getNodeByXpath')->will($this->returnValue(1));
     $jobResource = $this->mockResource('xcom_initializer/job', array('hasJobsLeft', 'isDataCollected'));
     $jobResource->expects($this->any())->method('isDataCollected')->will($this->returnValue(empty($issuersWithJobs)));
     if (empty($issuersWithJobs)) {
         $jobResource->expects($this->never())->method('hasJobsLeft');
     } else {
         $i = 1;
         foreach (array('xcom_mapping', 'xcom_other') as $issuer) {
             $jobResource->expects($this->at($i))->method('hasJobsLeft')->with($this->equalTo($issuer))->will($this->returnValue((int) in_array($issuer, $issuersWithJobs)));
             $i++;
         }
     }
     Mage::setConfigMock($configMock);
     $result = $this->_object->isAllowed($request);
     Mage::setUseMockConfig(false);
     $this->assertEquals($isAllowed, $result);
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:35,代码来源:InitializerTest.php

示例2: getCurrentUnSecureUrl

 /**
  * 
  * @param Mage_Core_Controller_Request_Http $request
  * @return string
  */
 public function getCurrentUnSecureUrl($request)
 {
     if ($alias = $request->getAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS)) {
         return Mage::getBaseUrl('link', false) . ltrim($alias, '/');
     }
     return Mage::getBaseUrl('link', false) . ltrim($request->getPathInfo(), '/');
 }
开发者ID:steffen-wirth,项目名称:Loewenstark_Seo,代码行数:12,代码来源:Secure.php

示例3: construct

 public function construct(Mage_Core_Controller_Request_Http $request)
 {
     $this->request = $request;
     if ($request->getPost('message')) {
         $this->msg = unserialize($this->AC_decode_base64($request->getPost('message')));
     }
 }
开发者ID:xiaoguizhidao,项目名称:storebaby.it,代码行数:7,代码来源:API.php

示例4: process

 /**
  * Perform an export according to the given request.
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @param Mage_Core_Controller_Response_Http $response
  * @throws Exception
  */
 public function process(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response)
 {
     // In case store is part of URL path use it to choose config.
     $store = $request->get('store');
     if ($store) {
         $store = Mage::app()->getStore($store);
     }
     $apiConfigCharset = Mage::getStoreConfig("api/config/charset", $store);
     $start_date = strtotime($request->getParam('start_date'));
     $end_date = strtotime($request->getParam('end_date'));
     if (!$start_date || !$end_date) {
         throw new Exception('Start and end dates are required', 400);
     }
     $page = (int) $request->getParam('page');
     /* @var $orders Mage_Sales_Model_Mysql4_Order_Collection */
     $orders = Mage::getResourceModel('sales/order_collection');
     // might use 'created_at' attribute instead
     $orders->addAttributeToFilter('updated_at', array('from' => date('Y-m-d H:i:s', $start_date), 'to' => date('Y-m-d H:i:s', $end_date)));
     if ($store) {
         $orders->addAttributeToFilter('store_id', $store->getId());
     }
     if ($page > 0) {
         $orders->setPage($page, $this->_getExportPageSize());
     }
     $xml = new XMLWriter();
     $xml->openMemory();
     $xml->startDocument('1.0', $apiConfigCharset);
     $this->_writeOrders($orders, $xml, $store ? $store->getId() : 0);
     $xml->endDocument();
     $response->clearHeaders()->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)->setBody($xml->outputMemory(true));
 }
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:38,代码来源:Export.php

示例5: isApiKeyValid

 /**
  * @param Mage_Core_Controller_Request_Http $request
  *
  * @return bool
  */
 public function isApiKeyValid(Mage_Core_Controller_Request_Http $request)
 {
     $apiKeyName = $this->getApiKeyName();
     $postApiKey = $request->getParam($apiKeyName, NULL);
     $key = $this->getApiKey();
     return !empty($key) && $key === $postApiKey;
 }
开发者ID:brandontamm,项目名称:Magento-OpCache,代码行数:12,代码来源:Data.php

示例6: match

 /**
  * Validate and Match Cms Page and modify request
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @return bool
  *
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function match(Mage_Core_Controller_Request_Http $request)
 {
     if (!Mage::isInstalled()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('install'))->sendResponse();
         exit;
     }
     $identifier = trim($request->getPathInfo(), '/');
     $condition = new Varien_Object(array('identifier' => $identifier, 'continue' => true));
     $this->_eventManager->dispatch('cms_controller_router_match_before', array('router' => $this, 'condition' => $condition));
     $identifier = $condition->getIdentifier();
     if ($condition->getRedirectUrl()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect($condition->getRedirectUrl())->sendResponse();
         $request->setDispatched(true);
         return $this->_controllerFactory->createController('Mage_Core_Controller_Varien_Action_Redirect', array('request' => $request));
     }
     if (!$condition->getContinue()) {
         return null;
     }
     $page = Mage::getModel('Mage_Cms_Model_Page');
     $pageId = $page->checkIdentifier($identifier, Mage::app()->getStore()->getId());
     if (!$pageId) {
         return null;
     }
     $request->setModuleName('cms')->setControllerName('page')->setActionName('view')->setParam('page_id', $pageId);
     $request->setAlias(Mage_Core_Model_Url_Rewrite::REWRITE_REQUEST_PATH_ALIAS, $identifier);
     return $this->_controllerFactory->createController('Mage_Core_Controller_Varien_Action_Forward', array('request' => $request));
 }
开发者ID:natxetee,项目名称:magento2,代码行数:35,代码来源:Router.php

示例7: setUp

 protected function setUp()
 {
     $this->_layout = $this->getMockBuilder('Mage_Core_Model_Layout')->disableOriginalConstructor()->setMethods(array('helper', 'getChildBlock', 'getChildName'))->getMock();
     $this->_request = $this->getMockBuilder('Mage_Core_Controller_Request_Http')->disableOriginalConstructor()->setMethods(array('getParam'))->getMock();
     $this->_request->expects($this->any())->method('getParam')->with('user_id')->will($this->returnValue(1));
     $helper = new Magento_Test_Helper_ObjectManager($this);
     $this->_block = $helper->getBlock('Mage_Webapi_Block_Adminhtml_User_Edit', array('urlBuilder' => $this->getMockBuilder('Mage_Backend_Model_Url')->disableOriginalConstructor()->getMock(), 'layout' => $this->_layout, 'request' => $this->_request));
 }
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: testMatch

 /**
  * @magentoAppIsolation enabled
  */
 public function testMatch()
 {
     $request = new Mage_Core_Controller_Request_Http();
     //Open Node
     $request->setPathInfo('parent_node');
     $controller = $this->_model->match($request);
     $this->assertInstanceOf('Mage_Core_Controller_Varien_Action_Redirect', $controller);
 }
开发者ID:,项目名称:,代码行数:11,代码来源:

示例9: getSearchQuery

 /**
  * @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);
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:14,代码来源:Route.php

示例10: getCookiePath

 public function getCookiePath()
 {
     $path = Mage::getStoreConfig('web/cookie/cookie_path');
     if (empty($path)) {
         $request = new Mage_Core_Controller_Request_Http();
         $path = $request->getBasePath();
     }
     return $path;
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:9,代码来源:Cookie.php

示例11: setPageFromRequest

 /**
  * Read settings
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @return $this
  */
 public function setPageFromRequest(Mage_Core_Controller_Request_Http $request)
 {
     $this->_currentPage = max(1, $request->getParam('page'));
     $limit = $request->getParam('limit', null);
     if ($limit !== null) {
         $this->_pageSize = (int) $limit;
     }
     return $this;
 }
开发者ID:giuseppemorelli,项目名称:IntegerNet_AttributeOptionPager,代码行数:15,代码来源:Pager.php

示例12: process

 /**
  * Perform a notify using POSTed data.
  *
  * See Auctane API specification.
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @throws Exception
  */
 public function process(Mage_Core_Controller_Request_Http $request)
 {
     // Raw XML is POSTed to this stream
     $xml = simplexml_load_file('php://input');
     // load some objects
     $order = $this->_getOrder($xml->OrderNumber);
     $qtys = $this->_getOrderItemQtys(@$xml->Items, $order);
     $shipment = $this->_getOrderShipment($order, $qtys);
     // this is where tracking is actually added
     $track = Mage::getModel('sales/order_shipment_track')->setNumber($xml->TrackingNumber)->setCarrierCode($xml->Carrier)->setTitle($xml->Service);
     $shipment->addTrack($track);
     // 'NotifyCustomer' must be "true" or "yes" to trigger an email
     $notify = filter_var(@$xml->NotifyCustomer, FILTER_VALIDATE_BOOLEAN);
     $capture = filter_var($request->getParam('capture'), FILTER_VALIDATE_BOOLEAN);
     if ($capture && $order->canInvoice()) {
         $invoice = $order->prepareInvoice($qtys);
         $invoice->setRequestedCaptureCase($invoice->canCapture() ? 'online' : 'offline')->register()->addComment($this->_getInvoiceComment(), $notify)->sendEmail($notify);
         // always send to store manager, and optionally notify customer too
         $order->setIsInProcess(true);
         // updates status on save
     }
     // Internal notes are only visible to admin
     if (@$xml->InternalNotes) {
         $shipment->addComment($xml->InternalNotes);
     }
     // Customer notes have 'Visible On Frontend' set
     if ($notify) {
         // if no NotesToCustomer then comment is empty string
         $shipment->sendEmail(true, (string) @$xml->NotesToCustomer)->setEmailSent(true);
     }
     if (@$xml->NotesToCustomer) {
         $shipment->addComment($xml->NotesToCustomer, $notify, true);
     }
     $transaction = Mage::getModel('core/resource_transaction');
     $transaction->addObject($shipment)->addObject($track);
     if (isset($invoice)) {
         // order has been captured, therefore has been modified
         $transaction->addObject($invoice)->addObject($order);
     }
     $transaction->save();
     if ($order->canInvoice() && !$order->canShip()) {
         // then silently invoice if order is shipped to move status to "Complete")
         $invoice = $order->prepareInvoice();
         $invoice->setRequestedCaptureCase($invoice->canCapture() ? 'online' : 'offline')->register()->addComment($this->_getInvoiceComment(), false)->sendEmail(false);
         // always send to store manager, and optionally notify customer too
         $order->setIsInProcess(true);
         // updates status on save
         $transaction = Mage::getModel('core/resource_transaction');
         if (isset($invoice)) {
             // order has been captured, therefore has been modified
             $transaction->addObject($invoice)->addObject($order);
         }
         $transaction->save();
     }
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:63,代码来源:Shipnotify.php

示例13: _parseInRoleUsersFilter

 /**
  * Parse $_inRoleUsersFilter value from request
  *
  * @param Mage_Core_Controller_Request_Http $request
  * @param Mage_Backend_Helper_Data $backendHelper
  * @return int
  */
 protected function _parseInRoleUsersFilter(Mage_Core_Controller_Request_Http $request, Mage_Backend_Helper_Data $backendHelper)
 {
     $result = self::IN_ROLE_USERS_ANY;
     $filter = $backendHelper->prepareFilterString($request->getParam('filter', ''));
     if (isset($filter[self::IN_ROLE_USERS_PARAMETER])) {
         $result = $filter[self::IN_ROLE_USERS_PARAMETER] ? self::IN_ROLE_USERS_YES : self::IN_ROLE_USERS_NO;
     } elseif (!$request->isAjax()) {
         $result = self::IN_ROLE_USERS_YES;
     }
     return $result;
 }
开发者ID:,项目名称:,代码行数:18,代码来源:

示例14: _mockModel

 protected function _mockModel()
 {
     $methods = array('getRequest');
     $formMock = $this->getMock('Xcom_Mapping_Block_Adminhtml_Attribute_Value_Form_Mock', $methods, array(), '', false);
     $request = new Mage_Core_Controller_Request_Http();
     $request->setParam('attribute_id', 1);
     $request->setParam('target_attribute_id', 1);
     $request->setParam('target_attribute_set_id', 1);
     $formMock->expects($this->any())->method('getRequest')->will($this->returnValue(3));
     $this->_object = $formMock;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:11,代码来源:FormTest.php

示例15: decode

 public function decode($encodedParameters, $version)
 {
     // The !empty() ensures that rows without a version number can be
     // executed (not without any risk).
     if (!empty($version) && $this->_getVersion() != $version) {
         throw new Exception(sprintf("Can't decode the Action encoded with %s Tracker v %s; current System Config Tracker is v %s ", $this->_code, $version, $this->_getVersion()));
     }
     $parameters = $this->_decodeParams($encodedParameters);
     $request = new Mage_Core_Controller_Request_Http();
     $request->setPost($parameters);
     $request->setQuery($parameters);
     // @todo $_FILE?
     return $request;
 }
开发者ID:ngreimel,项目名称:mageploy,代码行数:14,代码来源:Config.php


注:本文中的Mage_Core_Controller_Request_Http类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。