本文整理汇总了PHP中Enlight_Event_EventArgs::getReturn方法的典型用法代码示例。如果您正苦于以下问题:PHP Enlight_Event_EventArgs::getReturn方法的具体用法?PHP Enlight_Event_EventArgs::getReturn怎么用?PHP Enlight_Event_EventArgs::getReturn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enlight_Event_EventArgs
的用法示例。
在下文中一共展示了Enlight_Event_EventArgs::getReturn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAddEncoder
/**
* Add our own encoder to the internal encoder collection
*
* @param Enlight_Event_EventArgs $args
* @return array|mixed
*/
public function onAddEncoder(Enlight_Event_EventArgs $args)
{
$this->registerMyComponents();
$hashes = $args->getReturn();
$hashes[] = new \Shopware\SwagMd5Reversed\Md5ReversedEncoder();
return $hashes;
}
示例2: onFilterRender
/**
* Plugin event method
*
* @param Enlight_Event_EventArgs $args
* @return mixed
*/
public function onFilterRender(Enlight_Event_EventArgs $args)
{
$request = $args->getSubject()->Action()->Request();
/** @var $response Enlight_Controller_Response_ResponseHttp */
$response = $args->getSubject()->Action()->Response();
$headers = $response->getHeaders();
foreach($headers as $header) {
if($header['name'] == 'Content-Type' && strpos($header['value'], 'application/javascript') === 0) {
$source = $args->getReturn();
$source = str_replace(array("\r\n", "\r"), "\n", $source);
$expressions = array(
// Remove comments
'#/\*.*?\*/#ms' => '',
'#^\s*//.*$#m' => '',
//'#\n\s+#ms' => '',
'#^\s+#ms' => '',
//'#\s+$#ms' => '',
);
$source = preg_replace(array_keys($expressions), array_values($expressions), $source);
return $source;
}
}
if ($request->getModuleName() !== 'frontend' && $request->getModuleName() !== 'widgets') {
return $args->getReturn();
}
return $this->filterSource($args->getReturn());
}
示例3: onFilterSql
public function onFilterSql(Enlight_Event_EventArgs $args)
{
$sql = $args->getReturn();
$newSql = 'attr20,';
for ($i = 21; $i <= 40; $i++) {
$newSql .= 'swag_attr' . $i . ',';
}
$sql = str_replace('attr20,', $newSql, $sql);
return $sql;
}
示例4: onFilterCollectors
public function onFilterCollectors(\Enlight_Event_EventArgs $arguments)
{
$collectors = $arguments->getReturn();
$utils = $arguments->get('utils');
foreach ($collectors as $key => $collector) {
if ($collector instanceof EventCollector) {
$collectors[$key] = new ClockworkEventCollector($arguments->get('eventManager'), $utils);
} elseif ($collector instanceof TemplateCollector) {
$collectors[$key] = new ClockworkTemplateCollector($this->container->get('template'), $utils, $this->container->get('kernel')->getRootDir());
}
}
return $collectors;
}
示例5: onBenchmarkEvent
/**
* @param \Enlight_Event_EventArgs $args
* @return mixed
*/
public function onBenchmarkEvent(\Enlight_Event_EventArgs $args)
{
$event = $args->getName();
if (!isset($this->results[$event])) {
$this->results[$event] = array(0 => true, 1 => 0, 2 => 0, 3 => microtime(true));
}
if (empty($this->results[$event][0])) {
$this->results[$event][0] = true;
$this->results[$event][1] -= memory_get_peak_usage(true);
$this->results[$event][2] -= microtime(true);
} else {
$this->results[$event][0] = false;
$this->results[$event][1] += memory_get_peak_usage(true);
$this->results[$event][2] += microtime(true);
}
return $args->getReturn();
}
示例6: handleElement
/**
* Provide the store data for the current store.
*
* @param \Enlight_Event_EventArgs $args
* @return array|mixed
*/
public function handleElement(\Enlight_Event_EventArgs $args)
{
/** @var $controller \Enlight_Controller_Action */
$controller = $args->get('subject');
/** @var CustomComponents $customComponents */
$customComponents = $controller->get('swag_dynamic_emotion.custom_components');
$element = $args->get('element');
$data = $args->getReturn();
$storeId = $controller->Request()->getParam('currentStore');
// just modify our own components
if (!$customComponents->isCustomComponents($element['component']['cls'])) {
return $data;
}
// if no $storeId is available (e.g. shopping world preview), get a fallback
$storeId = isset($storeId) ? $storeId : Shopware()->Db()->fetchOne('SELECT id FROM swag_store LIMIT 1');
// if still not available (e.g. no stores) - return
if (!$storeId) {
return $data;
}
/** @var ModelRepository $storeRepo */
$storeRepo = Shopware()->Models()->getRepository('Shopware\\CustomModels\\SwagDynamicEmotion\\Store');
return array_merge($data, ['store' => $storeRepo->find($storeId)]);
}
示例7: onFilterUrl
/**
* Complements the generated urls with scheme, host and basePath, if required.
*
* @param Enlight_Event_EventArgs $args
* @return string
*/
public function onFilterUrl(Enlight_Event_EventArgs $args)
{
/** @var $userParams array */
$userParams = $args->get('userParams');
/** @var $request Enlight_Controller_Request_RequestHttp */
$request = $args->get('subject')->Front()->Request();
/** @var $url string */
$url = $args->getReturn();
if (!empty($url) && ($url[0] === '/' || preg_match('|^[a-z]+://|', $url))) {
return $url;
}
$forceSecure = !empty($this->Config()->forceSecure) || !empty($userParams['forceSecure']);
$forceSecure = $forceSecure && !empty($this->Config()->enableSecure);
$forceAbsolute = !empty($this->Config()->forceAbsolute) || !empty($userParams['forceAbsolute']);
if ($forceAbsolute || $forceSecure) {
$prepend = $forceSecure ? 'https://' : 'http://';
if ($forceSecure) {
$prepend .= $this->Config()->get('secureHttpHost', $request->getHttpHost());
$prepend .= $this->Config()->get('secureBaseUrl', $request->getBaseUrl());
} else {
$prepend .= $this->Config()->get('httpHost', $request->getHttpHost());
$prepend .= $this->Config()->get('baseUrl', $request->getBaseUrl());
}
$url = $prepend . '/' . $url;
}
return $url;
}
示例8: insertOrderAttribute
/**
* Adds an Attribte to s_order for sepa
*
* @param Enlight_Event_EventArgs $args
* @return string
*/
public function insertOrderAttribute(Enlight_Event_EventArgs $args)
{
$subject = $args->getSubject();
if ($subject->sUserData['additional']['payment']['name'] === "paymilldebit") {
$sepaDays = (int) $this->Config()->get('paymillSepaDate');
if ($sepaDays < 0) {
$sepaDays = 0;
}
$timeStamp = strtotime("+" . $sepaDays . " DAYS");
$attributeSql = preg_replace('/attribute6/', 'attribute6, paymill_sepa_date', $args->getReturn());
$attributeSql = preg_replace('/\\)$/', ",{$timeStamp} )", $attributeSql);
$args->setReturn($attributeSql);
}
}
示例9: event_Shopware_Modules_Order_SaveOrderAttributes_FilterSQL
/**
* transfer attribute data from temp order to new finalized order, shopware doesn't do it automatically
* the temp order contains already the pushed transaction status data
*
* @param \Enlight_Event_EventArgs $args
* @return string
*/
public function event_Shopware_Modules_Order_SaveOrderAttributes_FilterSQL(\Enlight_Event_EventArgs $args)
{
$sql = $args->getReturn();
$sOrder = $args->getSubject();
$db = $sOrder->sSYSTEM->sDB_CONNECTION;
$helper = $this->Application()->PayoneMain()->getHelper();
//temporaryId
$tempId = $sOrder->sSYSTEM->sSESSION_ID;
$tempOrder = Shopware()->Models()->getRepository('Shopware\\Models\\Order\\Order')->findOneBy(array('temporaryId' => $tempId));
if (!$tempOrder) {
return;
}
$attributes = $helper->getOrCreateAttribute($tempOrder);
//inject insert SQL
$sql = str_replace("INSERT INTO s_order_attributes (", "INSERT INTO s_order_attributes " . "(mopt_payone_txid, mopt_payone_status, mopt_payone_sequencenumber, " . "mopt_payone_is_authorized, mopt_payone_is_finally_captured, mopt_payone_clearing_data, ", $sql);
$sql = str_replace(" VALUES (", " VALUES (" . $db->quote($attributes->getMoptPayoneTxid()) . ', ' . $db->quote($attributes->getMoptPayoneStatus()) . ', ' . $db->quote($attributes->getMoptPayoneSequencenumber()) . ', ' . $db->quote($attributes->getMoptPayoneIsAuthorized()) . ', ' . $db->quote($attributes->getMoptPayoneIsFinallyCaptured()) . ', ' . $db->quote($attributes->getMoptPayoneClearingData()) . ', ', $sql);
$args->setReturn($sql);
}
示例10: addPaymentClass
/**
* This method registers shopware's generic payment method handler
* and the debit payment method handler
*
* @param Enlight_Event_EventArgs $args
* @return array
*/
public function addPaymentClass(\Enlight_Event_EventArgs $args)
{
$dirs = $args->getReturn();
$this->Application()->Loader()->registerNamespace('ShopwarePlugin\\PaymentMethods\\Components', __DIR__ . '/Components/');
$dirs['debit'] = 'ShopwarePlugin\\PaymentMethods\\Components\\DebitPaymentMethod';
$dirs['sepa'] = 'ShopwarePlugin\\PaymentMethods\\Components\\SepaPaymentMethod';
$dirs['default'] = 'ShopwarePlugin\\PaymentMethods\\Components\\GenericPaymentMethod';
return $dirs;
}
示例11: onpaymentAction
public static function onpaymentAction(Enlight_Event_EventArgs $args) {
self::registerNamespace();
$caller = $args->getSubject();
$request = $args->getSubject()->Request();
if ($request->sViewport == 'checkout' && ($request->sAction == 'confirm' || $request->sAction == 'index' || $request->success == 'payment' || $request->sAction == 'payment')) {
// hier die extrabehandlung bei neuanmeldungen ...
if ($caller->View()->sRegisterFinished) {
$caller->View()->sFormData = array();
} else {
return;
} // nothing to do here
}
if (!$caller->View()->sFormData)
$caller->View()->sFormData = array ();
if (isset($_SESSION['addresscheck']) && $_SESSION['addresscheck'] != "VALID")
self::checkCustomerAddress($request);
// boni check
if ( !$_SESSION['boni_proved'])
$cScore = self::checkConsumerScore($request);
else
$cScore = $_SESSION['boni_proved'];
$allowedScores = array ("G" => array ("G", "Y", "R"), "Y" => array ("Y", "R"), "R" => array ("R"));
$ret = $args->getReturn();
$formData['payone_payId'] = self::getPaymentId();
// paypal
if (self::checkPaymentScore('paypal', $cScore, $allowedScores))
$formData['paypal'] = true;
// online pay
foreach (Shopware_Controllers_Backend_BuiswPaymentPayone::$directdebits as $creditcard) {
if (self::checkPaymentScore($creditcard['key'], $cScore, $allowedScores)) {
$formData['onlinepay'][] = $creditcard;
}
}
$formData['eps_values'] = Shopware_Controllers_Backend_BuiswPaymentPayone::$eps_values;
$formData['idl_values'] = Shopware_Controllers_Backend_BuiswPaymentPayone::$idl_values;
// invoice
if (self::checkPaymentScore("rechnung", $cScore, $allowedScores))
$formData['rechnung'] = true;
// direct debit
if (self::checkPaymentScore("lastschrift", $cScore, $allowedScores))
$formData['lastschrift'] = true;
// credit card
foreach (Shopware_Controllers_Backend_BuiswPaymentPayone::$creditcards as $creditcard)
if (self::checkPaymentScore($creditcard['key'], $cScore, $allowedScores))
$formData['creditcards'][] = $creditcard;
for ($month = 1; $month <= 12; $month++)
$formData['months'][str_pad($month, 2, '0', STR_PAD_LEFT)] = str_pad($month, 2, '0', STR_PAD_LEFT);
for ($i = 0; $i <= 10; $i++)
$formData['years'][(int) (date("Y") + $i) - 2000] = (int) date("Y") + $i;
// cash on delivery
if (self::checkPaymentScore('nachnahme', $cScore, $allowedScores))
$formData['nachnahme'] = true;
// prepayment
if (self::checkPaymentScore("vorkasse", $cScore, $allowedScores))
$formData['vorkasse'] = true;
$caller->View()->sFormData += $formData;
$caller->View()->sFormData += self::getUserSetting();
$tmp = array ('payone_radio_classes' => ($request->sViewport == 'checkout' || ($request->sViewport == 'register' && $request->sAction == 'saveRegister') ? 'auto_submit' : ''));
$caller->View()->sFormData += $tmp;
if ($_GET['PAYONEERROR']) {
$caller->View()->sErrorFlag = array (self::NAME);
$caller->View()->sErrorMessages = 'Fehler: ' . $_GET['PAYONEERROR'];
}
$view = $caller->View();
$view->addTemplateDir(dirname(__FILE__) . '/Views/');
$radioReplacement = '<input type="hidden" name="register[payment]" value="' . self::getPaymentId() . '">';
$pm = $view->sPaymentMeans ? $view->sPaymentMeans : $view->sPayments;
$payonePayment = self::multi_array_key_search(self::getPaymentId(), $pm, 'id');
// throws every other payment means out
$view->sPaymentMeans = array ($payonePayment);
if ($view->sPayments) {
$view->sPayments = array ($payonePayment);
$view->extendsBlock('frontend_checkout_payment_fieldset_input_radio', $radioReplacement);
} else
$view->extendsBlock('frontend_register_payment_fieldset_input_radio', $radioReplacement);
return true;
//.........这里部分代码省略.........
示例12: afterTopSellerSelected
/**
* Plugin event listener function which fired after the
* top seller data selected.
* This function is used in case that the shop owner configured the
* live refresh of the article data.
* The listener function registers an additional listener on the
* after_send_response event.
*
* @param Enlight_Event_EventArgs $arguments
* @return mixed
*/
public function afterTopSellerSelected(Enlight_Event_EventArgs $arguments)
{
if (Shopware()->Session()->Bot) {
return $arguments->getReturn();
}
$strategy = $this->Application()->Config()->get('topSellerRefreshStrategy', self::AGGREGATE_STRATEGY_LIVE);
if ($strategy !== self::AGGREGATE_STRATEGY_LIVE || !$this->isTopSellerActivated()) {
return $arguments->getReturn();
}
$this->TopSeller()->updateElapsedTopSeller(50);
return $arguments->getReturn();
}
示例13: filterPayments
/**
* Filters the shown Payments
* RatePAY-payments will be hidden, if one of the following requirement is not given
* - Delivery Address is not allowed to be not the same as billing address
* - The Customer must be over 18 years old
* - The Country must be germany or austria
* - The Currency must be EUR
*
* @param Enlight_Event_EventArgs $arguments
*
* @return array
*/
public function filterPayments(Enlight_Event_EventArgs $arguments)
{
$return = $arguments->getReturn();
$currency = Shopware()->Config()->get('currency');
$userId = Shopware()->Session()->sUserId;
if (empty($userId) || empty($currency)) {
return;
}
$user = Shopware()->Models()->find('Shopware\\Models\\Customer\\Customer', Shopware()->Session()->sUserId);
//get country of order
if (Shopware()->Session()->checkoutBillingAddressId > 0) {
// From Shopware 5.2 find current address information in default billing address
$addressModel = Shopware()->Models()->getRepository('Shopware\\Models\\Customer\\Address');
$customerAddressBilling = $addressModel->findOneBy(array('id' => Shopware()->Session()->checkoutBillingAddressId));
$countryBilling = $customerAddressBilling->getCountry();
if (Shopware()->Session()->checkoutShippingAddressId > 0 && Shopware()->Session()->checkoutShippingAddressId != Shopware()->Session()->checkoutBillingAddressId) {
$customerAddressShipping = $addressModel->findOneBy(array('id' => Shopware()->Session()->checkoutShippingAddressId));
$countryDelivery = $customerAddressShipping->getCountry();
} else {
$countryDelivery = $countryBilling;
}
} else {
$countryBilling = Shopware()->Models()->find('Shopware\\Models\\Country\\Country', $user->getBilling()->getCountryId());
if (!is_null($user->getShipping()) && $user->getBilling()->getCountryId() != $user->getShipping()->getCountryId()) {
$countryDelivery = Shopware()->Models()->find('Shopware\\Models\\Country\\Country', $user->getShipping()->getCountryId());
} else {
$countryDelivery = $countryBilling;
}
}
//get current shopId
$shopId = Shopware()->Shop()->getId();
$config = $this->getRatePayPluginConfigByCountry($shopId, $countryBilling);
$showRate = $config['rateStatus'] == 2 ? true : false;
$showDebit = $config['debitStatus'] == 2 ? true : false;
$showInvoice = $config['invoiceStatus'] == 2 ? true : false;
$validation = new Shopware_Plugins_Frontend_RpayRatePay_Component_Validation($config);
$validation->setAllowedCurrencies($config['currency']);
$validation->setAllowedCountriesBilling($config['country-code-billing']);
$validation->setAllowedCountriesDelivery($config['country-code-delivery']);
//check if payments are hidden by session (not in sandbox mode)
if ($validation->isRatepayHidden()) {
$showRate = false;
$showDebit = false;
$showInvoice = false;
}
//check if the country is allowed
if (!$validation->isCurrencyValid($currency)) {
$showRate = false;
$showDebit = false;
$showInvoice = false;
}
//check if the billing country is allowed
if (!$validation->isBillingCountryValid($countryBilling)) {
$showRate = false;
$showDebit = false;
$showInvoice = false;
}
//check if the delivery country is allowed
if (!$validation->isDeliveryCountryValid($countryDelivery)) {
$showRate = false;
$showDebit = false;
$showInvoice = false;
}
$limitInvoiceMin = $config['limit-invoice-min'];
$limitDebitMin = $config['limit-debit-min'];
$limitRateMin = $config['limit-rate-min'];
//check if it is a b2b transaction
if ($validation->isCompanyNameSet() || $validation->isUSTSet()) {
$showRate = $config['b2b-rate'] == 'yes' && $showRate ? true : false;
$showDebit = $config['b2b-debit'] == 'yes' && $showDebit ? true : false;
$showInvoice = $config['b2b-invoice'] == 'yes' && $showInvoice ? true : false;
$limitInvoiceMax = $config['limit-invoice-max-b2b'] > 0 ? $config['limit-invoice-max-b2b'] : $config['limit-invoice-max'];
$limitDebitMax = $config['limit-debit-max-b2b'] > 0 ? $config['limit-debit-max-b2b'] : $config['limit-debit-max'];
$limitRateMax = $config['limit-rate-max-b2b'] > 0 ? $config['limit-rate-max-b2b'] : $config['limit-rate-max'];
} else {
$limitInvoiceMax = $config['limit-invoice-max'];
$limitDebitMax = $config['limit-debit-max'];
$limitRateMax = $config['limit-rate-max'];
}
//check if there is an alternate delivery address
if (!$validation->isBillingAddressSameLikeShippingAddress()) {
$showRate = $config['address-rate'] == 'yes' && $showRate ? true : false;
$showDebit = $config['address-debit'] == 'yes' && $showDebit ? true : false;
$showInvoice = $config['address-invoice'] == 'yes' && $showInvoice ? true : false;
}
//check the limits
if (Shopware()->Modules()->Basket()) {
$basket = Shopware()->Modules()->Basket()->sGetAmount();
//.........这里部分代码省略.........
示例14: purchase
/**
* add purchase tracking
* @param Enlight_Event_EventArgs $arguments
* @return boolean
*/
public function purchase(Enlight_Event_EventArgs $arguments)
{
if ($this->Config()->get('boxalino_tracking_enabled')) {
$products = array();
foreach ($arguments->getDetails() as $detail) {
$products[] = array('product' => $detail['articleDetailId'], 'quantity' => $detail['quantity'], 'price' => $detail['priceNumeric']);
}
Shopware_Plugins_Frontend_Boxalino_EventReporter::reportPurchase($products, $arguments->getSubject()->sOrderNumber, $arguments->getSubject()->sAmount, Shopware()->Shop()->getCurrency());
}
return $arguments->getReturn();
}
示例15: afterTopSellerSelected
/**
* Plugin event listener function which fired after the
* top seller data selected.
* This function is used in case that the shop owner configured the
* live refresh of the article data.
* The listener function registers an additional listener on the
* after_send_response event.
*
* @param Enlight_Event_EventArgs $arguments
* @return mixed
*/
public function afterTopSellerSelected(Enlight_Event_EventArgs $arguments)
{
if (Shopware()->Session()->Bot) {
return $arguments->getReturn();
}
$strategy = $this->Application()->Config()->get('topSellerRefreshStrategy', self::AGGREGATE_STRATEGY_LIVE);
if ($strategy !== self::AGGREGATE_STRATEGY_LIVE || !$this->isTopSellerActivated()) {
return $arguments->getReturn();
}
if (Shopware()->Front()->returnResponse()) {
$this->TopSeller()->updateElapsedTopSeller(50);
} else {
$event = new Enlight_Event_EventHandler('Enlight_Controller_Front_AfterSendResponse', array($this, 'afterSendResponseOnTopSeller'));
Shopware()->Events()->registerListener($event);
}
return $arguments->getReturn();
}