本文整理汇总了PHP中Enlight_Event_EventArgs::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP Enlight_Event_EventArgs::getRequest方法的具体用法?PHP Enlight_Event_EventArgs::getRequest怎么用?PHP Enlight_Event_EventArgs::getRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enlight_Event_EventArgs
的用法示例。
在下文中一共展示了Enlight_Event_EventArgs::getRequest方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onRoute
/**
* Event listener method
*
* @param Enlight_Event_EventArgs $args
*/
public static function onRoute(Enlight_Event_EventArgs $args)
{
$request = $args->getRequest();
$url = $request->getPathInfo();
$url = trim($url, '/');
if(empty($url)) {
return;
}
$query = array();
if(preg_match('#.*?_(detail)_([0-9]+)(?:_([0-9]+))?_?(?:SESS\-(.*?))?.html#', $url, $match)) {
$query['sViewport'] = $match[1];
$query['sArticle'] = $match[2];
$query['sCategory'] = $match[3];
$query['sCoreId'] = $match[4];
} elseif(preg_match('#.*?_(cat)_([0-9]+)(?:_([0-9]+))?_?(?:SESS\-(.*?))?.html#', $url, $match)) {
$query['sViewport'] = $match[1];
$query['sCategory'] = $match[2];
$query['sPage'] = $match[3];
$query['sCoreId'] = $match[4];
} elseif(preg_match('#.*?_(campaign)_([0-9]+)_?(?:SESS\-(.*?))?.html#', $url, $match)) {
$query['sViewport'] = $match[1];
$query['sCampaign'] = $match[2];
$query['sCoreId'] = $match[4];
} elseif(preg_match('#unternehmen/.*?_(custom)_([0-9]+)_?([0-9]+)?_?(?:SESS\-(.*?))?.html#', $url, $match)) {
$query['sViewport'] = $match[1];
$query['sCustom'] = $match[2];
$query['sCoreId'] = $match[4];
if(!empty($match[3])) {
$query['sId'] = $match[3];
}
} elseif(preg_match('#Artikelindex.*_(.*).html#', $url, $match)) {
$query['sViewport'] = 'search';
$query['sSearchMode'] = 'bychar';
$query['sSearchChar'] = $match[1];
$query['sSearchText'] = 'Artikelindex-'.$match[1];
} elseif(preg_match('#Supplier-(.*)_(.*).html#', $url, $match)) {
$query['sViewport'] = 'search';
$query['sSearchMode'] = 'supplier';
$query['sSearch'] = $match[2];
$query['sSearchText'] = $match[1];
} else {
foreach(explode('/', $url) as $part) {
$part = explode(',', $part);
if(!empty($part[0]) && !empty($part[1])) {
$query[$part[0]] = $part[1];
}
}
}
if(!empty($query) && !empty($query['sViewport'])) {
$request->setParam('rewriteOld', true);
return $query;
} else {
return;
}
}
示例2: onPostDispatchConfig
/**
* @param Enlight_Event_EventArgs $arguments
*/
public function onPostDispatchConfig(Enlight_Event_EventArgs $arguments)
{
/* @var Enlight_View_Default $view */
$view = $arguments->getSubject()->View();
//if the controller action name equals "load" we have to load all application components.
if ($arguments->getRequest()->getActionName() === 'load') {
$view->addTemplateDir($this->Path() . 'Views/');
$view->extendsTemplate('backend/config/view/form/document_paypal_plus.js');
}
}
示例3: onBackendCustomerPostDispatch
/**
* Called when the BackendCustomerPostDispatch Event is triggered
*
* @param Enlight_Event_EventArgs $args
*/
public function onBackendCustomerPostDispatch(Enlight_Event_EventArgs $args)
{
/**@var $view Enlight_View_Default*/
$view = $args->getSubject()->View();
// Add template directory
$args->getSubject()->View()->addTemplateDir($this->Path() . 'Views/');
//if the controller action name equals "load" we have to load all application components
if ($args->getRequest()->getActionName() === 'load') {
$view->extendsTemplate('backend/customer/model/customer_preferences/attribute.js');
$view->extendsTemplate('backend/customer/model/customer_preferences/list.js');
$view->extendsTemplate('backend/customer/view/list/customer_preferences/list.js');
$view->extendsTemplate('backend/customer/view/detail/customer_preferences/window.js');
$view->extendsTemplate('backend/boxalino_export/view/main/window.js');
//if the controller action name equals "index" we have to extend the backend customer application
if ($args->getRequest()->getActionName() === 'index') {
$view->extendsTemplate('backend/customer/customer_preferences_app.js');
$view->extendsTemplate('backend/boxalino_export/boxalino_export_app.js');
}
}
}
示例4: onBackendCustomerPostDispatch
/**
* Called when the BackendCustomerPostDispatch Event is triggered
*
* @param Enlight_Event_EventArgs $args
*/
public function onBackendCustomerPostDispatch(Enlight_Event_EventArgs $args)
{
/**@var $view Enlight_View_Default */
$view = $args->getSubject()->View();
//if the controller action name equals "load" we have to load all application components
if ($args->getRequest()->getActionName() === 'load') {
$view->addTemplateDir($this->Path() . 'Views/emotion/');
$view->extendsTemplate('backend/customer/payment_methods/controller/detail.js');
$view->extendsTemplate('backend/customer/payment_methods/view/detail/payment_methods.js');
}
}
示例5: onPreDispatch
public static function onPreDispatch(Enlight_Event_EventArgs $args)
{
$request = $args->getSubject()->Request();
if ($request->getModuleName() && $request->getModuleName() != 'frontend') {
return;
}
switch ($request->getControllerName()) {
case 'shopware.php':
case 'sViewport,sale':
$url = $args->getRequest()->getPathInfo();
$url = trim($url, '/');
foreach (explode('/', $url) as $part) {
$part = explode(',', $part);
if (!empty($part[0]) && !empty($part[1])) {
$request->setParam($part[0], $part[1]);
}
}
if ($request->getParam('sAction') && $request->getParam('sAction') == 'doSale') {
$request->setControllerName('checkout')->setActionName('finish')->setDispatched(false);
} else {
$request->setControllerName('checkout')->setActionName('confirm')->setDispatched(false);
}
break;
case 'cat':
$request->setControllerName('listing')->setDispatched(false);
break;
case 'captcha':
$request->setModuleName('widgets')->setControllerName('captcha')->setDispatched(false);
break;
case 'password':
case 'login':
case 'logout':
$request->setActionName($request->getParam('sViewport'));
case 'admin':
$request->setControllerName('account')->setDispatched(false);
break;
case 'registerFC':
case 'register1':
case 'register2':
case 'register2shipping':
case 'register3':
$request->setControllerName('register')->setDispatched(false);
break;
case 'sale':
if ($request->getParam('sAction') && $request->getParam('sAction') == 'doSale') {
$request->setControllerName('checkout')->setActionName('finish')->setDispatched(false);
} else {
$request->setControllerName('checkout')->setActionName('confirm')->setDispatched(false);
}
break;
case 'sViewport,basket':
case 'basket':
$request->setControllerName('checkout')->setActionName('cart')->setDispatched(false);
break;
case 'searchFuzzy':
$request->setControllerName('search')->setActionName('index')->setDispatched(false);
break;
case 'newsletterListing':
$request->setControllerName('newsletter')->setActionName('listing')->setDispatched(false);
break;
case 'support':
$request->setControllerName('forms')->setActionName('index')->setDispatched(false);
break;
case 'ticketdirect':
$request->setControllerName('ticket')->setActionName('direct')->setDispatched(false);
break;
default:
break;
}
}
示例6: loadArticleBackendModule
/**
* This method loads the new backend article-module.
* This is necessary to extend the default article-module.
*
* @param Enlight_Event_EventArgs $args
* @return bool success
*/
public function loadArticleBackendModule(Enlight_Event_EventArgs $args)
{
$this->Application()->Snippets()->addConfigDir($this->Path() . 'Snippets/');
$this->registerMyTemplateDir(true);
if ($args->getRequest()->getActionName() === 'load') {
$args->getSubject()->View()->extendsTemplate('backend/article/view/accessory/detail/window.js');
}
if ($args->getRequest()->getActionName() === 'index') {
$args->getSubject()->View()->extendsTemplate('backend/article/accessory_app.js');
}
}
示例7: onStartDispatch
/**
* On Route add user-agent and remote-address to log component
*
* @param Enlight_Event_EventArgs $args
*/
public function onStartDispatch(Enlight_Event_EventArgs $args)
{
/** @var $request Enlight_Controller_Request_RequestHttp */
$request = $args->getRequest();
if (($site = $request->getParam('__site')) !== null) {
/** @var $siteManager Enlight_Components_Site_Manager */
$siteManager = $this->Application()->Sites();
$site = $siteManager->findOneBy('id', $site);
/** @var $log Enlight_Components_Session_Namespace */
$session = $this->Application()->Session();
$session->Site = $session;
} else {
/** @var $site Enlight_Components_Site */
$site = $this->Application()->Site();
}
if (($locale = $request->getParam('__locale')) !== null) {
$site->setLocale($locale);
}
if (($currency = $request->getParam('__currency')) !== null) {
$site->setCurrency($currency);
}
}
示例8: onRoute
/**
* Routes the path information, if the router symfony match it.
*
* @param Enlight_Event_EventArgs $args
* @return array|null
*/
public function onRoute(Enlight_Event_EventArgs $args)
{
/** @var $request Enlight_Controller_Request_RequestHttp */
$request = $args->getRequest();
/** @var $routes Symfony\Component\Routing\RouteCollection */
$routes = $this->Application()->SymfonyRoutes();
$context = $this->getRequestContext($request);
$matcher = new UrlMatcher($routes, $context);
try {
return $matcher->match($request->getPathInfo());
} catch (ResourceNotFoundException $e) {
return null;
}
}
示例9: extendOrderDetailView
/**
* extends the Orderdetailview
*
* @param Enlight_Event_EventArgs $arguments
*/
public function extendOrderDetailView(Enlight_Event_EventArgs $arguments)
{
$arguments->getSubject()->View()->addTemplateDir($this->Path() . 'Views/backend/rpay_ratepay_orderdetail/');
if ($arguments->getRequest()->getActionName() === 'load') {
$arguments->getSubject()->View()->extendsTemplate('backend/order/view/detail/ratepaydetailorder.js');
}
if ($arguments->getRequest()->getActionName() === 'index') {
$arguments->getSubject()->View()->extendsTemplate('backend/order/ratepayapp.js');
}
}
示例10: onGetOrderControllerPreDispatch
/**
* Cancels payment slip before order is deleted.
*
* @param Enlight_Event_EventArgs $args
*/
public function onGetOrderControllerPreDispatch(Enlight_Event_EventArgs $args)
{
if ($args->getRequest()->getActionName() === 'delete') {
$id = $args->getSubject()->Request()->getParam('id', null);
$order = Shopware()->Models()->getRepository('Shopware\\Models\\Order\\Order')->find($id);
if ($order->getPayment()->getName() === 'barzahlen') {
$transactionId = $order->getTransactionId();
$cancel = new Barzahlen_Request_Cancel($transactionId);
$config = $this->Config();
$shopId = $config->barzahlenShopId;
$paymentKey = $config->barzahlenPaymentKey;
$sandbox = $config->barzahlenSandbox;
$api = new Barzahlen_Api($shopId, $paymentKey, $sandbox);
$api->setDebug($config->barzahlenDebug, self::LOGFILE);
try {
$api->handleRequest($cancel);
} catch (Exception $e) {
$this->_logError($e);
}
}
}
}
示例11: onPostDispatchPaymentPaypal
/**
* @param Enlight_Event_EventArgs $args
*/
public function onPostDispatchPaymentPaypal(Enlight_Event_EventArgs $args)
{
/* @var Enlight_View_Default $view */
$view = $args->getSubject()->View();
if ($args->getRequest()->getActionName() === 'getList') {
$orders = $view->getAssign('data');
$orderNumbers = array_map(function ($order) {
return $order['orderNumber'];
}, $orders);
$payPalPlusPuiOrderNumbers = $this->getPuiOrderNumbers($orderNumbers);
foreach ($orders as &$order) {
if (in_array($order['orderNumber'], $payPalPlusPuiOrderNumbers)) {
$order['paymentDescription'] = $order['paymentDescription'] . ' Plus (R)';
}
}
$view->assign('data', $orders);
}
}
示例12: onPostDispatch
/**
* Listener method for the Enlight_Controller_Front_PostDispatch event.
*
* @param Enlight_Event_EventArgs $args
* @return void
*/
public function onPostDispatch(Enlight_Event_EventArgs $args)
{
$this->handleError($args->getSubject(), $args->getRequest());
}
示例13: onCheckoutConfirm
/**
* Eventhandler for checkout confirmation.
* Displays any error messages stored in the session
*
* @param Enlight_Event_EventArgs $arguments
*/
public function onCheckoutConfirm(Enlight_Event_EventArgs $arguments)
{
$params = $arguments->getRequest()->getParams();
if ($arguments->getRequest()->getControllerName() !== 'account' || $arguments->getRequest()->getActionName() !== 'payment' || $params["errorMessage"] != 1) {
return;
} else {
$helper = new Shopware_Plugins_Frontend_SofortPayment_Components_Helpers_Helper();
$view = $arguments->getSubject()->View();
$helper->event()->displayErrors($view);
}
}