]> _ Git - cubeextranet.git/commitdiff
fix #2154 @0:05
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 24 Jul 2018 11:10:29 +0000 (11:10 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 24 Jul 2018 11:10:29 +0000 (11:10 +0000)
inc/ws/Util/html5/master/class.ws.html5.seo.php

index 56e60160b8721a7ad2509300327e50fba477df8b..4f7c724242ef1e2d8e181a40972e1761cfdbbfab 100644 (file)
@@ -29,11 +29,7 @@ class wsHTML5Seo
                        $p->ua = '';\r
                        if ($this->compiler->book->parametres->googleAnalytics != '') {\r
                                $codes = explode(',', $this->compiler->book->parametres->googleAnalytics);\r
-                               $p->ua .= "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" . $codes[0] . "\"></script>\n\t<script>\n\t\twindow.dataLayer = window.dataLayer || [];\n\t\tfunction gtag(){dataLayer.push(arguments);}\n\t\tgtag('js', new Date());\n\t";\r
-                               foreach ($codes as $code) {\r
-                                       $p->ua .= "\tgtag('config', '" . $code . "');\n\t";\r
-                               }\r
-                               $p->ua .= "</script>";\r
+                               $p->ua .= "<script async src=\"https://www.googletagmanager.com/gtag/js?id=" . $codes[0] . "\"></script><script>window.dataLayer = window.dataLayer || [];function gtag(){dataLayer.push(arguments);}</script>";\r
                        }\r
                        if ($this->compiler->book->parametres->googleAnalyticsCustom != '') {\r
                                $p->ua .= $this->compiler->book->parametres->googleAnalyticsCustom;\r
@@ -86,7 +82,9 @@ class wsHTML5Seo
                }\r
 \r
                $res = trim(file_get_contents(wsDocument::getDir($infos['document_id']) . $prefix . 'h' . $infos['document_page'] . '.txt'));\r
-               $res = preg_replace('|\<\/div\>$|', '', $res);\r
+               if (strpos($res, '<div>') !== 0) {\r
+                       $res = preg_replace('|\<\/div\>$|', '', $res);\r
+               }\r
 \r
                return $res;\r
        }\r