public function onDispatchLoopShutdown(\Enlight_Event_EventArgs $args) { if (!$this->container->has('profileId')) { return; } if (!$this->container->has('front')) { return; } /** @var \Enlight_Controller_Response_ResponseHttp $response */ $response = $args->get('response'); $profileTemplate = []; $profileTemplate['renderedTemplates'] = $this->renderedTemplates; $profileTemplate['blockCalls'] = $this->blockCalls; $profileTemplate['templateCalls'] = $this->templateCalls; $profileTemplate['renderTime'] = $this->renderTime; $profileData = $this->container->get('shyim_profiler.collector')->collectInformation($this->container->get('profileController')); $profileData['template'] = array_merge($profileData['template'], $profileTemplate); $profileData['mails'] = $this->mails; $this->container->get('shyim_profiler.collector')->saveCollectInformation($this->container->get('profileId'), $profileData); $view = $this->container->get('template'); $view->assign('sProfiler', $profileData); $view->assign('sProfilerCollectors', $this->container->get('shyim_profiler.collector')->getCollectors()); $view->assign('sProfilerID', $this->container->get('profileId')); $view->assign('sProfilerTime', round(microtime(true) - STARTTIME, 3)); $view->addTemplateDir($this->container->getParameter('shyim_profiler.plugin_dir') . '/Resources/views/'); $profileTemplate = $view->fetch('@Profiler/index.tpl'); $content = $response->getBody(); $content = str_replace('</body>', $profileTemplate . '</body>', $content); $response->setBody($content); }
public function onDispatchLoopShutdown(\Enlight_Event_EventArgs $args) { if (empty($this->profileId) || !$this->container->has('front')) { return; } $profileTemplate = []; $profileTemplate['renderedTemplates'] = $this->renderedTemplates; $profileTemplate['blockCalls'] = $this->blockCalls; $profileTemplate['templateCalls'] = $this->templateCalls; $profileTemplate['renderTime'] = $this->renderTime; $profileData = $this->container->get('shyim_profiler.collector')->collectInformation($this->profileController); $profileData['template'] = array_merge($profileData['template'], $profileTemplate); $profileData['mails'] = $this->mails; $isIPWhitelisted = in_array(Shopware()->Front()->Request()->getClientIp(), explode("\n", $this->pluginConfig['whitelistIP'])); if (empty($this->pluginConfig['whitelistIP']) || $this->pluginConfig['whitelistIPProfile'] == 1 || $isIPWhitelisted) { $this->container->get('shyim_profiler.collector')->saveCollectInformation($this->profileId, $profileData, $this->profileController->Request()->getModuleName() == 'widgets'); } if ($this->profileController->Request()->getModuleName() == 'frontend' && (empty($this->pluginConfig['whitelistIP']) || $isIPWhitelisted)) { $view = $this->container->get('template'); $view->assign('sProfiler', $profileData); $view->assign('sProfilerCollectors', $this->container->get('shyim_profiler.collector')->getCollectors()); $view->assign('sProfilerID', $this->profileId); $view->assign('sProfilerTime', round(microtime(true) - STARTTIME, 3)); $view->addTemplateDir($this->container->getParameter('shyim_profiler.plugin_dir') . '/Resources/views/'); $profileTemplate = $view->fetch('@Profiler/index.tpl'); /** @var \Enlight_Controller_Response_ResponseHttp $response */ $response = $args->get('response'); $content = $response->getBody(); $content = str_replace('</body>', $profileTemplate . '</body>', $content); $response->setBody($content); } }
/** * Checks if the given resource name is already registered. If not the resource is loaded. * * @param string $name * @return bool */ public function hasResource($name) { return $this->container->has($name); }
/** * @param Container $container * @param \Zend_Locale $locale * * @return \Zend_Currency */ public function factory(Container $container, \Zend_Locale $locale) { $currency = 'EUR'; if ($container->has('Shop')) { $currency = $container->get('Shop')->getCurrency()->getCurrency(); } return new \Zend_Currency($currency, $locale); }
/** * @param Container $container * @return \Zend_Locale */ public function factory(Container $container) { $locale = 'de_DE'; if ($container->has('Shop')) { $locale = $container->get('Shop')->getLocale()->getLocale(); } return new \Zend_Locale($locale); }