当前位置: 首页>>代码示例>>PHP>>正文


PHP Enlight_Event_EventArgs::getSubject方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: onLoadArticle

 public function onLoadArticle(Enlight_Event_EventArgs $args)
 {
     $request = $args->getSubject()->Request();
     $view = $args->getSubject()->View();
     if ($request->getActionName() != "load") {
         return;
     }
     $view->addTemplateDir($this->Path() . 'Views/');
     $view->extendsTemplate('backend/swag_additional_attributes/article/model/attribute.js');
 }
开发者ID:zirkeldesign,项目名称:SwagAdditionalAttributes,代码行数:10,代码来源:Bootstrap.php

示例6: 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;
     }
     $shop = Shopware()->Shop();
     $view->Controller = $args->getSubject()->Request()->getControllerName();
     $view->Shopware = Shopware();
     if (!$shop->get('esi')) {
         $view->sBasketQuantity = Shopware()->Modules()->Basket()->sCountBasket();
         $view->sBasketAmount = $this->getBasketAmount();
         $view->sNotesQuantity = Shopware()->Modules()->Basket()->sCountNotes();
         $view->sUserLoggedIn = Shopware()->Modules()->Admin()->sCheckUser();
         $categoryContent = $view->sCategoryContent;
         $topSellerActive = $this->Application()->Config()->get('topSellerActive', true);
         if (!empty($categoryContent) && $categoryContent['level'] <= 2 && $topSellerActive) {
             $view->sCharts = Shopware()->Modules()->Articles()->sGetArticleCharts($categoryContent['id']);
         }
         if (!empty($view->sCompareShow)) {
             $view->sComparisons = Shopware()->Modules()->Articles()->sGetComparisons();
         }
         if (!empty($view->sLastArticlesShow)) {
             $view->sLastArticles = Shopware()->Modules()->Articles()->sGetLastArticles();
         }
         if (!empty($view->sCloudShow)) {
             $view->sCloud = Shopware()->Modules()->Marketing()->sBuildTagCloud();
         }
         if (empty($view->sBlog) && $view->Controller == "index") {
             $view->sBlog = $this->getBlog();
         }
         $view->sLanguages = $this->getLanguages();
         $view->sCurrencies = $this->getCurrencies();
     } else {
         $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);
     if (!Shopware()->Shop()->get('esi')) {
         $view->sCampaigns = $this->getCampaigns($view->sCategoryCurrent);
     }
     $view->sShopname = Shopware()->Config()->shopName;
 }
开发者ID:ClaudioThomas,项目名称:shopware-4,代码行数:62,代码来源:Bootstrap.php

示例7: piPaymorrowSaveNewUserdata

/**
 * Saves userdata from payment field
 *
 * @param    Enlight_Event_EventArgs $piPaymorrowArgs    Arguments
 */
function piPaymorrowSaveNewUserdata(Enlight_Event_EventArgs $piPaymorrowArgs)
{
	$piPaymorrowView = $piPaymorrowArgs->getSubject()->View();
	$piPaymorrowResponse = $piPaymorrowArgs->getSubject()->Response();
	$piPaymorrowGetPost = $piPaymorrowArgs->getSubject()->Request()->getPost();
        $piPaymorrowUserdata = array();
	$piPaymorrowUserdata = $piPaymorrowArgs->getSubject()->View()->sUserData;
        $piPaymorrowInvoiceId = "";
        $piPaymorrowBirthday = "";
	if ($piPaymorrowGetPost['pi_Paymorrow_saveBirthday']) {
            $piPaymorrowInvoiceId = piPaymorrowGetInvoicePaymentId();
	}
	else {
            $piPaymorrowInvoiceId = piPaymorrowGetRatePaymentId();
	}
	if ($piPaymorrowGetPost['register']['personal']['phone']) {
            $sql = "UPDATE s_user_billingaddress SET phone= ? WHERE ID= ?";
            Shopware()->Db()->query($sql, array($piPaymorrowGetPost['register']['personal']['phone'], (int)$piPaymorrowUserdata['billingaddress']['id']));
	}
	if ($piPaymorrowGetPost['register']['personal']['birthday_rate']) {
            $piPaymorrowBirthday = $piPaymorrowGetPost['register']['personal']['birthyear_rate'] . "-"
                    . $piPaymorrowGetPost['register']['personal']['birthmonth_rate'] . "-"
                    . $piPaymorrowGetPost['register']['personal']['birthday_rate'];
	}
	else {
            $piPaymorrowBirthday = $piPaymorrowGetPost['register']['personal']['birthyear'] . "-"
                    . $piPaymorrowGetPost['register']['personal']['birthmonth'] . "-"
                    . $piPaymorrowGetPost['register']['personal']['birthday'];
	}
	if ($piPaymorrowUserdata["billingaddress"]["birthday"] == "0000-00-00") {
            $sql = "UPDATE s_user_billingaddress SET birthday= ? WHERE id= ?";
		Shopware()->Db()->query($sql, array($piPaymorrowBirthday, (int)$piPaymorrowUserdata['billingaddress']['id']));
		$piPaymorrowView->pi_Paymorrow_birthdayflag = true;
	}
        $sql = "SELECT birthday FROM s_user_billingaddress WHERE id= ?";
	$piPaymorrowNewBirthday = Shopware()->Db()->fetchOne($sql, array((int)$piPaymorrowUserdata['billingaddress']['id']));
        $sql = "SELECT phone FROM s_user_billingaddress WHERE id= ?";
	$piPaymorrowNewphone = Shopware()->Db()->fetchOne($sql, array((int)$piPaymorrowUserdata['billingaddress']['id']));
	if ($piPaymorrowNewBirthday != "0000-00-00" && $piPaymorrowNewphone && !$piPaymorrowUserdata["billingaddress"]["company"] 
            && !$piPaymorrowUserdata["shippingaddress"]["company"]
        ) {
            $sql = "UPDATE s_user SET paymentID = ? WHERE id = ?";
            Shopware()->Db()->query($sql, array((int)$piPaymorrowInvoiceId,(int)$piPaymorrowUserdata['billingaddress']['userID']));
	}
	else {
		$piPaymorrowHeader = $piPaymorrowResponse->getHeaders();
		$piPaymorrowUrl = $piPaymorrowHeader[1][value];
		$piPaymorrowNewUrl = str_replace("/sViewport,account/success,payment", "/sViewport,account/sAction,payment", $piPaymorrowUrl);
		$piPaymorrowNewUrl = str_replace("/sViewport,checkout/success,payment", "/sViewport,account/sAction,payment/sTarget,checkout", $piPaymorrowNewUrl);
		$piPaymorrowResponse->setHeader('Location', $piPaymorrowNewUrl, 2);
	}
}
开发者ID:nhp,项目名称:shopware-4,代码行数:57,代码来源:paymorrow_functions.php

示例8: onPostDispatch

 /**
  * Define template and variables
  * @param Enlight_Event_EventArgs $args
  */
 public function onPostDispatch(Enlight_Event_EventArgs $args)
 {
     $request = $args->getSubject()->Request();
     $response = $args->getSubject()->Response();
     $view = $args->getSubject()->View();
     $config = Shopware()->Plugins()->Frontend()->SwagPiwik()->Config();
     if (!$request->isDispatched() || $response->isException() || $request->getModuleName() != 'frontend' || !$view->hasTemplate()) {
         return;
     }
     $view->SwagPiwik = $config;
     $view->addTemplateDir($this->Path() . 'Views/');
     $args->getSubject()->View()->extendsTemplate('frontend/plugins/swag_piwik/index.tpl');
 }
开发者ID:zirkeldesign,项目名称:SwagPiwik,代码行数:17,代码来源:Bootstrap.php

示例9: convertAjaxSearch

 public function convertAjaxSearch(\Enlight_Event_EventArgs $args)
 {
     /**@var $shop Shop */
     $shop = $this->container->get('shop');
     if ($shop->getTemplate()->getVersion() >= 3) {
         return;
     }
     $data = $args->getSubject()->View()->getAssign();
     foreach ($data['sSearchResults']['sResults'] as &$article) {
         $article['thumbNails'] = $article['image']['src'];
         $article['image'] = $article['image']['src'][1];
     }
     $args->getSubject()->View()->assign($data);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:14,代码来源:LegacySearchSubscriber.php

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: onPostDispatch

 /**
  * @param Enlight_Event_EventArgs $args
  * @return mixed
  */
 public function onPostDispatch(Enlight_Event_EventArgs $args)
 {
     $view = $args->getSubject()->View();
     $request = $args->getSubject()->Request();
     $response = $args->getSubject()->Response();
     if (!$request->isDispatched() || $response->isException() || $request->getModuleName() != 'frontend') {
         return;
     }
     $config = $this->Config();
     if (empty($config->show)) {
         return;
     }
     if (strpos($config->controller, $request->getControllerName()) !== false) {
         $view->sCloudShow = true;
     }
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:20,代码来源:Bootstrap.php

示例15: 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


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