Exemple #1
0
 public function dispatchLoopShutdown()
 {
     if (!Pimcore_Tool::isHtmlResponse($this->getResponse())) {
         return;
     }
     if ($this->enabled && Pimcore_Google_Analytics::isConfigured()) {
         // analytics
         include_once "simple_html_dom.php";
         $body = $this->getResponse()->getBody();
         // search for the end <head> tag, and insert the google analytics code before
         // this method is much faster than using simple_html_dom and uses less memory
         $headEndPosition = strpos($body, "</head>");
         if ($headEndPosition !== false) {
             $body = substr_replace($body, Pimcore_Google_Analytics::getCode() . "</head>", $headEndPosition, 7);
         }
         // website optimizer
         if ($this->document) {
             $top = Pimcore_Google_Analytics::getOptimizerTop($this->document);
             $bottom = Pimcore_Google_Analytics::getOptimizerBottom($this->document);
             $conversion = Pimcore_Google_Analytics::getOptimizerConversion($this->document);
             if ($top || $bottom || $conversion) {
                 $html = str_get_html($body);
                 if ($html) {
                     $body = $html->find("body", 0);
                     if ($top && $bottom) {
                         $body->innertext = $top . $body->innertext . $bottom;
                     } else {
                         if ($conversion) {
                             $body->innertext = $body->innertext . $conversion;
                         } else {
                             if ($bottom) {
                                 $body->innertext = $body->innertext . $bottom;
                             }
                         }
                     }
                     $body = $html->save();
                 }
             }
         }
         $this->getResponse()->setBody($body);
     }
 }
Exemple #2
0
?>
,
            welcomescreen: <?php 
echo $this->config->general->welcomescreen ? "true" : "false";
?>
,
            debug: <?php 
echo Pimcore::inDebugMode() ? "true" : "false";
?>
,
            devmode: <?php 
echo PIMCORE_DEVMODE ? "true" : "false";
?>
,
            google_analytics_enabled: <?php 
echo Zend_Json::encode((bool) Pimcore_Google_Analytics::isConfigured());
?>
,
            google_analytics_advanced: <?php 
echo Zend_Json::encode((bool) Pimcore_Google_Analytics::getSiteConfig()->advanced);
?>
,
            google_webmastertools_enabled: <?php 
echo Zend_Json::encode((bool) Pimcore_Google_Webmastertools::isConfigured());
?>
,
            customviews: <?php 
echo Zend_Json::encode($this->customview_config);
?>
,
            language: '<?php