本文整理汇总了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类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: setNeverExpireBrowserCacheHeader
public function setNeverExpireBrowserCacheHeader(Mage_Core_Controller_Request_Http $httpRequest, Mage_Core_Controller_Response_Http $response)
{
if (!Mage::app()->useCache('config')) {
return $this;
}
if (!$httpRequest->has(self::FUZE_VALUE_CACHE_KEY)) {
Mage::log("MegaMenu cache problem: You cannot set never expire browser cache, because this http request has not been secured by the fuze url param.");
return $this;
}
$expires = gmdate('D, d M Y H:i:s \\G\\M\\T', time() + 3600 * self::HOURS_IN_BROWSER_CACHE);
$maxAge = self::HOURS_IN_BROWSER_CACHE * 3600;
$response->setHeader('Pragma', 'public', true);
$response->setHeader('Expires', $expires, true);
$response->setHeader('Cache-Control', "public, max-age={$maxAge}", true);
return $this;
}
开发者ID:creatuitydevelopers,项目名称:mega-menu,代码行数:16,代码来源:Cache.php
示例17: initFromRequest
/**
* @param Mage_Core_Controller_Request_Http $request
* @return string
* @throws Mage_Core_Exception
*/
public function initFromRequest(Mage_Core_Controller_Request_Http $request)
{
if ($request->getParam('expert_mode') == 'on') {
$cronExpression = $request->getParam('cron_expr');
return $cronExpression;
}
try {
// easy mapping
$params = $request->getParams();
$data = new Noovias_Cron_Data_CronExpression($params);
//
$cronExpression = $this->getGenerationService()->generateCronExprFromDataObject($data);
return $cronExpression;
} catch (Exception $e) {
throw new Mage_Core_Exception($e->getMessage());
}
}
开发者ID:praxigento,项目名称:mage_app_prxgt_store,代码行数:22,代码来源:InitCronExpression.php
示例18: login
/**
* Try to login user in admin
*
* @param string $username
* @param string $password
* @param Mage_Core_Controller_Request_Http $request
* @return Mage_Admin_Model_User|null
*/
public function login($username, $password, $request = null)
{
if (empty($username) || empty($password)) {
return;
}
$user = Mage::getModel('admin/user')->login($username, $password);
if ($user->getId() && $user->getIsActive() != '1') {
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Your Account has been deactivated.'));
$request->setParam('messageSent', true);
}
} elseif (!Mage::getModel('admin/user')->hasAssigned2Role($user->getId())) {
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Access Denied.'));
$request->setParam('messageSent', true);
}
} else {
if ($user->getId()) {
$session = Mage::getSingleton('admin/session');
$session->setIsFirstVisit(true);
$session->setUser($user);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
if ($request) {
header('Location: ' . $request->getRequestUri());
exit;
}
} else {
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Invalid Username or Password.'));
$request->setParam('messageSent', true);
}
}
}
return $user;
}
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:43,代码来源:Session.php
示例19: match
/**
* Modify request and set to no-route action
* If store is admin and specified different admin front name,
* change store to default (Possible when enabled Store Code in URL)
*
* @param Mage_Core_Controller_Request_Http $request
* @return boolean
*/
public function match(Mage_Core_Controller_Request_Http $request)
{
$noRoute = explode('/', Mage::app()->getStore()->getConfig('web/default/no_route'));
$moduleName = isset($noRoute[0]) ? $noRoute[0] : 'core';
$controllerName = isset($noRoute[1]) ? $noRoute[1] : 'index';
$actionName = isset($noRoute[2]) ? $noRoute[2] : 'index';
if (Mage::app()->getStore()->isAdmin()) {
$adminFrontName = (string) Mage::getConfig()->getNode('admin/routers/adminhtml/args/frontName');
if ($adminFrontName != $moduleName) {
$moduleName = 'core';
$controllerName = 'index';
$actionName = 'noRoute';
Mage::app()->setCurrentStore(Mage::app()->getDefaultStoreView());
}
}
$request->setModuleName($moduleName)->setControllerName($controllerName)->setActionName($actionName);
return $this->_controllerFactory->createController('Mage_Core_Controller_Varien_Action_Forward', array('request' => $request));
}
开发者ID:natxetee,项目名称:magento2,代码行数:26,代码来源:Default.php
示例20: initForward
/**
* Initializes forward data
*
* @see Mage_Core_Controller_Request_Http::initForward()
*/
public function initForward()
{
if (empty($this->_beforeForwardInfo)) {
parent::initForward();
$this->_beforeForwardInfo['route_name'] = $this->getRouteName();
return $this;
}
return parent::initForward();
}
开发者ID:tiagosampaio,项目名称:EcomDev_PHPUnit,代码行数:14,代码来源:Http.php
注:本文中的Mage_Core_Controller_Request_Http类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论