本文整理汇总了PHP中Enlight_Event_EventArgs::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Enlight_Event_EventArgs::get方法的具体用法?PHP Enlight_Event_EventArgs::get怎么用?PHP Enlight_Event_EventArgs::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enlight_Event_EventArgs
的用法示例。
在下文中一共展示了Enlight_Event_EventArgs::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onMyCustomRule
/**
* @param Enlight_Event_EventArgs $args
* @return bool
*/
public function onMyCustomRule(Enlight_Event_EventArgs $args)
{
$rule = $args->get('rule');
$user = $args->get('user');
$basket = $args->get('basket');
$value = $args->get('value');
if ($basket['AmountNumeric'] > $value) {
return true;
// it's a risky customer
}
return false;
}
示例2: 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;
}
示例3: onSecureCheckoutConfirmPostDispatch
public function onSecureCheckoutConfirmPostDispatch(Enlight_Event_EventArgs $arguments)
{
$controller = $arguments->get('subject');
$view = $controller->View();
$view->addTemplateDir($this->Path() . '/Views');
$view->assign('number', $this->Config()->get('number'));
}
示例4: createS3Adapter
/**
* Creates adapter instance
*
* @param Enlight_Event_EventArgs $args
* @return AdapterInterface
*/
public function createS3Adapter(Enlight_Event_EventArgs $args)
{
$defaultConfig = ['key' => '', 'secret' => '', 'region' => '', 'version' => 'latest', 'bucket' => '', 'prefix' => ''];
$config = array_merge($defaultConfig, $args->get('config'));
$client = S3Client::factory(['credentials' => ['key' => $config['key'], 'secret' => $config['secret']], 'region' => $config['region'], 'version' => $config['version']]);
return new AwsS3Adapter($client, $config['bucket'], $config['prefix']);
}
示例5: onPreDispatch
/**
* Called from the event manager before the dispatch process.
* Parse the json input data, when it was activated.
*
* @param Enlight_Event_EventArgs $args
* @return bool
*/
public function onPreDispatch(Enlight_Event_EventArgs $args)
{
/** @var $subject Enlight_Controller_Action */
$subject = $args->get('subject');
$request = $subject->Request();
// Parses the json input data, if the content type is correct
if ($this->parseInput === true && ($contentType = $request->getHeader('Content-Type')) !== false && strpos($contentType, 'application/json') === 0 && ($input = file_get_contents('php://input')) !== false) {
$input = Zend_Json::decode($input);
foreach ((array) $input as $key => $value) {
if ($value !== null) {
$request->setPost($key, $value);
}
}
}
// Parse the json Params
if (count($this->parseParams)) {
foreach ($this->parseParams as $Param) {
if (($value = $request->getParam($Param)) !== null) {
$value = Zend_Json::decode($value);
$request->setParam($Param, $value);
}
}
}
// Rests the configuration for the next dispatch
$this->parseInput = false;
$this->parseParams = array();
}
示例6: onPostDispatch
/**
* Called from the Event Manager after the dispatch process
*
* @param Enlight_Event_EventArgs $args
* @return bool
*/
public function onPostDispatch(Enlight_Event_EventArgs $args)
{
/** @var $subject Enlight_Controller_Action */
$subject = $args->get('subject');
$response = $subject->Response();
$request = $subject->Request();
if (!$request->isDispatched()) {
return;
}
// If the attribute padding is a boolean true
if ($this->padding === true) {
$this->padding = $request->getParam('callback');
$this->padding = preg_replace('#[^0-9a-z_]+#i', '', (string) $this->padding);
}
// decide if we should render the data or the whole page
if ($this->renderer === true) {
$content = $subject->View()->getAssign();
} elseif (!empty($this->padding)) {
$content = $response->getBody();
} else {
return;
}
// Convert content to json
$content = $this->convertToJson($content);
if (!empty($this->padding)) {
$response->setHeader('Content-type', 'text/javascript', true);
$response->setBody($this->addPadding($content, $this->padding));
} elseif ($this->renderer === true) {
$response->setHeader('Content-type', 'application/json', true);
$response->setBody($content);
}
$this->padding = null;
$this->encoding = 'UTF-8';
$this->renderer = null;
}
示例7: onFrontendPostDispatch
public function onFrontendPostDispatch(Enlight_Event_EventArgs $args)
{
$controller = $args->get('subject');
$view = $controller->View();
$view->addTemplateDir(__DIR__ . '/Views');
$view->assign('facebookLink', $this->Config()->get('facebook-link'));
$view->assign('twitterLink', $this->Config()->get('twitter-link'));
$view->assign('emailLink', $this->Config()->get('email-link'));
}
示例8: onFrontendPostDispatch
public function onFrontendPostDispatch(Enlight_Event_EventArgs $args)
{
/** @var \Enlight_Controller_Action $controller */
$controller = $args->get('subject');
$view = $controller->View();
$view->addTemplateDir(__DIR__ . '/Views');
$view->assign('sloganSize', $this->Config()->get('font-size'));
$view->assign('italic', $this->Config()->get('italic'));
$view->assign('slogan', $this->getSlogan());
}
示例9: 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)]);
}
示例10: onShopwareStartDispatch
public function onShopwareStartDispatch(Enlight_Event_EventArgs $args)
{
/** @var \Enlight_Controller_Front $subject */
$subject = $args->get('subject');
if ($subject->getParam('noErrorHandler')) {
$requestUri = $subject->Request()->getRequestUri();
if (file_exists($this->Path() . 'vendor/autoload.php')) {
require_once $this->Path() . 'vendor/autoload.php';
}
$whoops = new Run();
if ($subject->Request()->isXmlHttpRequest() || strstr($requestUri, '/backend') || strstr($requestUri, '/ajax')) {
$whoops->pushHandler(new JsonResponseHandler());
} else {
$whoops->pushHandler(new PrettyPageHandler());
}
$whoops->register();
restore_error_handler();
}
}
示例11: onDispatch
/**
* @param \Enlight_Event_EventArgs $args
* @throws \Exception
*/
public function onDispatch(\Enlight_Event_EventArgs $args)
{
/**@var $controller \Enlight_Controller_Action*/
$controller = $args->get('subject');
if (!$controller->View()) {
return;
}
/**@var $shop Shop*/
$shop = $this->container->get('shop');
if ($shop->getTemplate()->getVersion() < 3) {
return;
}
$templateManager = $this->container->get('template');
$themeSettings = $templateManager->getTemplateVars('theme');
if (!empty($themeSettings)) {
return;
}
$inheritance = $this->container->get('theme_inheritance');
$config = $inheritance->buildConfig($shop->getTemplate(), $shop, false);
$templateManager->addPluginsDir($inheritance->getSmartyDirectories($shop->getTemplate()));
$templateManager->assign('theme', $config);
}
示例12: createSftpAdapter
/**
* Creates adapter instance
*
* @param Enlight_Event_EventArgs $args
* @return AdapterInterface
*/
public function createSftpAdapter(Enlight_Event_EventArgs $args)
{
$defaultConfig = ['host' => '', 'port' => 22, 'username' => '', 'password' => '', 'privateKey' => '', 'root' => '', 'timeout' => 10];
$config = array_merge($defaultConfig, $args->get('config'));
return new SftpAdapter(['host' => $config['host'], 'port' => $config['port'], 'username' => $config['username'], 'password' => $config['password'], 'privateKey' => $config['privateKey'], 'root' => $config['root'], 'timeout' => $config['timeout']]);
}
示例13: validatePaymentContextData
public function validatePaymentContextData(Enlight_Event_EventArgs $args)
{
$context = $args->get('context');
$this->assertInternalType('array', $context['sPaymentTable']);
$this->assertCount(0, $context['sPaymentTable']);
}
示例14: onOrderModelPostPersist
/**
* Stores the id of the created order into the plenty_order table
*
* @param Enlight_Event_EventArgs $arguments
* @return boolean
*/
public function onOrderModelPostPersist(Enlight_Event_EventArgs $arguments)
{
$model = $arguments->get('entity');
$orderId = $model->getId();
Shopware()->Db()->query('
INSERT INTO plenty_order
SET shopwareId = ?
', array($orderId));
return true;
}
示例15: onUpdateSessionId
/**
* updates the session ID, if it changed
*
* @param \Enlight_Event_EventArgs $args
*/
public function onUpdateSessionId(\Enlight_Event_EventArgs $args)
{
$this->sessionId = $args->get('newSessionId');
}