• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Enlight_Event_EventArgs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: extendExtJS

 public function extendExtJS(\Enlight_Event_EventArgs $arguments)
 {
     /** @var \Enlight_View_Default $view */
     $view = $arguments->getSubject()->View();
     $view->addTemplateDir($this->getPath() . '/Views/');
     $view->extendsTemplate('backend/swag_attribute/Shopware.attribute.Form.js');
 }
开发者ID:janbuecker,项目名称:devdocs,代码行数:7,代码来源:SwagAttribute.php


示例2: init

 /**
  * Initialize important variables
  * @param Enlight_Event_EventArgs $arguments
  */
 protected function init(Enlight_Event_EventArgs $arguments)
 {
     $this->controller = $arguments->getSubject();
     $this->request = $this->controller->Request();
     $this->view = $this->controller->View();
     $this->helper->setRequest($this->request);
 }
开发者ID:boxalino,项目名称:plugin-shopware,代码行数:11,代码来源:Interceptor.php


示例3: onPostDispatch

 /**
  * Event listener method
  *
  * Read the last article in defined controllers
  * Saves the last article in detail controller
  *
  * @param Enlight_Event_EventArgs $args
  */
 public function onPostDispatch(Enlight_Event_EventArgs $args)
 {
     $request = $args->getSubject()->Request();
     $response = $args->getSubject()->Response();
     $view = $args->getSubject()->View();
     if (!$request->isDispatched() || $response->isException() || $request->getModuleName() != 'frontend' || !$view->hasTemplate()) {
         return;
     }
     $config = $this->Config();
     if ($request->getControllerName() == 'detail' && !Shopware()->Session()->Bot && Shopware()->Shop()->getTemplate()->getVersion() == 1) {
         $this->setLastArticleById($view->sArticle["articleID"]);
     }
     if (rand(0, 100) === 0) {
         $time = $config->time > 0 ? (int) $config->time : 15;
         $sql = '
             DELETE FROM s_emarketing_lastarticles
             WHERE time < DATE_SUB(CONCAT(CURDATE(), ?), INTERVAL ? DAY)
         ';
         Shopware()->Db()->query($sql, array(' 00:00:00', $time));
         Shopware()->Events()->notify('Shopware_Plugins_LastArticles_ResetLastArticles', array('subject' => $this));
     }
     if (empty($config->show)) {
         return;
     }
     if (!empty($config->controller) && strpos($config->controller, $request->getControllerName()) === false) {
         return;
     }
     $view->assign('sLastArticlesShow', true);
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:37,代码来源:Bootstrap.php


示例4: onPostDispatchFrontend

 public function onPostDispatchFrontend(Enlight_Event_EventArgs $arguments)
 {
     /**@var $controller Shopware_Controllers_Frontend_Index*/
     $controller = $arguments->getSubject();
     /**
      * @var $request Zend_Controller_Request_Http
      */
     $request = $controller->Request();
     /**
      * @var $response Zend_Controller_Response_Http
      */
     $response = $controller->Response();
     /**
      * @var $view Enlight_View_Default
      */
     $view = $controller->View();
     //Check if there is a template and if an exception has occured
     if (!$request->isDispatched() || $response->isException() || $request->getModuleName() != 'frontend' || !$arguments->getSubject()->View()->hasTemplate()) {
         return;
     }
     //Add our plugin template directory to load our slogan extension.
     $view->addTemplateDir($this->Path() . 'Views/');
     $view->extendsTemplate('frontend/index/footer-navigation.tpl');
     for ($i = 1; $i < 5; $i++) {
         $contentShow = "pprContentShow{$i}";
         $contentColumn = "pprContentColumn{$i}";
         $view->assign("show{$i}", $this->Config()->{$contentShow});
         $view->assign("column{$i}", $this->Config()->{$contentColumn});
     }
 }
开发者ID:Paike,项目名称:sw5-ppr-edit-footer,代码行数:30,代码来源:Bootstrap.php


示例5: 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());
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:37,代码来源:Bootstrap.php


示例6: 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;
 }
开发者ID:shobcheye,项目名称:devdocs,代码行数:13,代码来源:Bootstrap.php


示例7: 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;
 }
开发者ID:nhp,项目名称:shopware-4,代码行数:41,代码来源:Bootstrap.php


示例8: 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'));
 }
开发者ID:kayyyy,项目名称:HostiConditions,代码行数:7,代码来源:Bootstrap.php


示例9: onAfterRegisterShop

 /**
  * @param \Enlight_Event_EventArgs $args
  */
 public function onAfterRegisterShop(\Enlight_Event_EventArgs $args)
 {
     /** @var $container Container */
     $container = $args->getSubject();
     /** @var $router \Shopware\Components\Routing\RouterInterface  */
     $router = $container->get('router');
     /** @var $shop \Shopware\Models\Shop\Shop */
     $shop = $container->get('shop');
     /** @var $config \Shopware_Components_Config */
     $config = $container->get('config');
     // Register the shop (we're to soon)
     $config->setShop($shop);
     $context = $router->getContext();
     $newContext = Context::createFromShop($shop, $config);
     // Reuse the host
     if ($newContext->getHost() === null) {
         $newContext->setHost($context->getHost());
         $newContext->setBaseUrl($context->getBaseUrl());
         // Reuse https
         if (!$newContext->isSecure()) {
             $newContext->setSecure($context->isSecure());
             $newContext->setSecureBaseUrl($context->getSecureBaseUrl());
         }
     }
     // Reuse the global params like controller and action
     $globalParams = $context->getGlobalParams();
     $newContext->setGlobalParams($globalParams);
     $router->setContext($newContext);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:32,代码来源:Router.php


示例10: onPostDispatchIndexController

 public function onPostDispatchIndexController(Enlight_Event_EventArgs $arguments)
 {
     $controller = $arguments->getSubject();
     $view = $controller->View();
     $view->addTemplateDir($this->Path() . 'Views/');
     $shopLang = Shopware()->Front()->Request()->getCookie('shopLang');
     //        $ip = $_SERVER['REMOTE_ADDR'];
     $ip = '195.149.248.130';
     //BG
     //        $ip = '194.50.69.124'; //DE
     //        $ip = '211.156.198.82'; //CN
     $gi = geoip_open(__DIR__ . '/GeoIp/db/GeoIP.dat', GEOIP_STANDARD);
     $countryCode = geoip_country_code_by_addr($gi, $ip);
     geoip_close($gi);
     if ($shopLang != strtolower($countryCode)) {
         $shopLang = strtolower($countryCode);
         Shopware()->Front()->Response()->setCookie('shopLang', $shopLang, 0);
         $builder = Shopware()->Container()->get('dbal_connection')->createQueryBuilder();
         $shopId = $builder->select('scs.id')->from('s_core_locales', 'scl')->innerJoin('scl', 's_core_shops', 'scs', 'scl.id = scs.locale_id')->where('scl.locale LIKE ?')->setParameter(0, $shopLang . '%')->execute()->fetch();
         if ($shopId) {
             $view->extendsTemplate('frontend/index/change_shop.tpl');
             $view->assign(array('shopId' => $shopId['id']));
         }
     }
 }
开发者ID:dnhsoft,项目名称:swApacheGeoIP,代码行数:25,代码来源:Bootstrap.php


示例11: 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']);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:13,代码来源:Bootstrap.php


示例12: testOnFilterCollectors

 public function testOnFilterCollectors()
 {
     $container = Shopware()->Container();
     $debug = $this->getDebugClass();
     $eventManager = $container->get('events');
     $utils = new Utils();
     $arguments = new \Enlight_Event_EventArgs(['utils' => $utils, 'eventManager' => $eventManager]);
     $arguments->setReturn([]);
     $collectors = $debug->onFilterCollectors($arguments);
     $this->assertCount(count($arguments->getReturn()), $collectors);
     $arguments->setReturn([new EventCollector($eventManager, $utils)]);
     $collectors = $debug->onFilterCollectors($arguments);
     $this->assertCount(count($arguments->getReturn()), $collectors);
     $this->assertInstanceOf('\\Shopware\\Plugins\\ShopwareClockwork\\Clockwork\\Components\\Collector\\EventCollector', $collectors[0]);
     $arguments->setReturn([new TemplateCollector($container->get('template'), $utils, $container->get('kernel')->getRootDir())]);
     $collectors = $debug->onFilterCollectors($arguments);
     $this->assertCount(count($arguments->getReturn()), $collectors);
     $this->assertInstanceOf('\\Shopware\\Plugins\\ShopwareClockwork\\Clockwork\\Components\\Collector\\TemplateCollector', $collectors[0]);
     $arguments->setReturn([new EventCollector($eventManager, $utils), new TemplateCollector($container->get('template'), $utils, $container->get('kernel')->getRootDir())]);
     $collectors = $debug->onFilterCollectors($arguments);
     $this->assertCount(count($arguments->getReturn()), $collectors);
     $this->assertInstanceOf('\\Shopware\\Plugins\\ShopwareClockwork\\Clockwork\\Components\\Collector\\EventCollector', $collectors[0]);
     $this->assertInstanceOf('\\Shopware\\Plugins\\ShopwareClockwork\\Clockwork\\Components\\Collector\\TemplateCollector', $collectors[1]);
     $info = [1, 2, 3];
     $arguments->setReturn($info);
     $collectors = $debug->onFilterCollectors($arguments);
     $this->assertCount(count($arguments->getReturn()), $collectors);
     $this->assertSame($info, $collectors);
 }
开发者ID:wesolowski,项目名称:shopware-clockwork,代码行数:29,代码来源:DebugTest.php


示例13: onPostDispatch

 /**
  * Event listener method
  *
  * Read base controller data
  *
  * @param Enlight_Event_EventArgs $args
  */
 public function onPostDispatch(Enlight_Event_EventArgs $args)
 {
     $request = $args->getSubject()->Request();
     $response = $args->getSubject()->Response();
     $view = $args->getSubject()->View();
     if (!$request->isDispatched() || $response->isException() || $request->getModuleName() != 'frontend' || !$view->hasTemplate()) {
         return;
     }
     $view->baseUrl = $request->getBaseUrl() . $request->getPathInfo();
     $shop = Shopware()->Shop();
     $view->Controller = $args->getSubject()->Request()->getControllerName();
     $view->Shopware = Shopware();
     $view->sBasketQuantity = $view->sBasketQuantity ?: 0;
     $view->sBasketAmount = $view->sBasketAmount ?: 0;
     $view->sNotesQuantity = $view->sNotesQuantity ?: 0;
     $view->sUserLoggedIn = $view->sUserLoggedIn ?: false;
     $view->Shop = $shop;
     $view->Locale = $shop->getLocale()->getLocale();
     $view->sCategoryStart = $shop->getCategory()->getId();
     $view->sCategoryCurrent = $this->getCategoryCurrent($view->sCategoryStart);
     $view->sCategories = $this->getCategories($view->sCategoryCurrent);
     $view->sMainCategories = $view->sCategories;
     $view->sOutputNet = Shopware()->Session()->sOutputNet;
     $activePage = isset($view->sCustomPage['id']) ? $view->sCustomPage['id'] : null;
     $view->sMenu = $this->getMenu($shop->getId(), $activePage);
     $view->sShopname = Shopware()->Config()->shopName;
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:34,代码来源:Bootstrap.php


示例14: 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();
 }
开发者ID:nvdnkpr,项目名称:Enlight,代码行数:34,代码来源:Bootstrap.php


示例15: onDispatchEvent

 /**
  * Listener method for the Enlight_Controller_Front_PostDispatch event.
  *
  * @param   Enlight_Event_EventArgs $args
  * @return  void
  */
 public function onDispatchEvent(Enlight_Event_EventArgs $args)
 {
     if (!$args->getResponse()->isException()) {
         return;
     }
     $exception = $args->getResponse()->getException();
     $this->handleException($exception[0]);
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:14,代码来源:Bootstrap.php


示例16: onPreDispatchBackendMail

 /**
  * adds the Views folder to the template directory to provide the rating images for the e-mail templates
  *
  * @param \Enlight_Event_EventArgs $args
  */
 public function onPreDispatchBackendMail(\Enlight_Event_EventArgs $args)
 {
     /* @var \Enlight_Controller_Action $subject */
     $subject = $args->getSubject();
     if ($subject->Request()->getActionName() != 'sendTestmail') {
         return;
     }
     $this->template->addTemplateDir($this->bootstrapPath . 'Views/');
 }
开发者ID:Goucher,项目名称:shopware,代码行数:14,代码来源:Email.php


示例17: 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'));
 }
开发者ID:8mylezOrganization,项目名称:shopware-8mzSocialLinksFooter,代码行数:9,代码来源:Bootstrap.php


示例18: 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;
 }
开发者ID:zirkeldesign,项目名称:SwagAdditionalAttributes,代码行数:10,代码来源:Bootstrap.php


示例19: 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());
 }
开发者ID:shobcheye,项目名称:devdocs,代码行数:10,代码来源:Bootstrap.php


示例20: onGetCustomSortControllerPath

 /**
  * This function is responsible to resolve the backend / frontend controller path.
  *
  * @param  \Enlight_Event_EventArgs $args
  * @return string
  */
 public function onGetCustomSortControllerPath(\Enlight_Event_EventArgs $args)
 {
     $this->templateManager->addTemplateDir($this->bootstrapPath . 'Views/');
     switch ($args->getName()) {
         case 'Enlight_Controller_Dispatcher_ControllerPath_Backend_CustomSort':
             return $this->bootstrapPath . 'Controllers/Backend/CustomSort.php';
         case 'Enlight_Controller_Dispatcher_ControllerPath_Widgets_CustomSort':
             return $this->bootstrapPath . 'Controllers/Widgets/CustomSort.php';
     }
 }
开发者ID:zirkeldesign,项目名称:SwagCustomSort,代码行数:16,代码来源:ControllerPath.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP EnmasseHelper类代码示例发布时间:2022-05-23
下一篇:
PHP Engine_Form类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap