]> _ Git - cubeextranet.git/commitdiff
wip #4978 @0.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 21 Dec 2021 20:01:00 +0000 (20:01 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 21 Dec 2021 20:01:00 +0000 (20:01 +0000)
composer.json
inc/ws/Controlleur/class.ws.maintenance.php
inc/ws/Controlleur/class.ws.stats.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index f8bb31ba3a0fc9caec9e8b4543c758e5aa71068f..04d2d8a5521460979360d38a292c40880efa2cf4 100644 (file)
@@ -1,9 +1,22 @@
 {\r
+  "name": "fluidbook\/workshop",\r
+  "description": "Fluidbook Workshop",\r
+  "type": "project",\r
+  "license": "proprietary",\r
+  "minimum-stability": "dev",\r
+  "repositories": [\r
+    {\r
+      "type": "composer",\r
+      "url": "https://composer.cubedesigners.com/"\r
+    }\r
+  ],\r
+\r
   "require": {\r
     "php": ">=7.2",\r
     "php-mime-mail-parser/php-mime-mail-parser": "2.11.1",\r
     "jaybizzle/crawler-detect": "^1.2",\r
     "ext-mbstring": "*",\r
-    "ext-simplexml": "*"\r
+    "ext-simplexml": "*",\r
+    "cubist/matomo": "dev-master"\r
   }\r
 }\r
index 1bece9913428599d551c76bf3f758609c66f6a8d..8509a64c318c4a2809ed5a36b75a4738f85c6d12 100644 (file)
@@ -1803,6 +1803,16 @@ class wsMaintenance
         exit;
     }
 
+    public static function matomo()
+    {
+        try {
+            $reporting = new \Cubist\Matomo\Reporting('https://v3.stats.fluidbook.com/', 'ebe362f44c01bda1ddedb75d7726ff78');
+            print_r($reporting->createSiteIfNotExistsOrReturnId('Fluidbook Y', 'https://fluidbook.y'));
+        } catch (Exception $e) {
+            print_r($e);
+        }
+    }
+
 }
 
 
index 5b60b58f3f0393116b3df7c6dbc1a977675e2256..b40ed146043dcf2ea30099495c883e4115f28ec8 100644 (file)
@@ -417,8 +417,8 @@ class wsStats
         $class = array('liste', 'max');\r
 \r
         $lines[] = array($date_creation, date(__('d-m-Y'), $book->date));\r
-        $lines[] = array(__('Nombre de lieux de visite'), $stats['places']);\r
-        $lines[] = array(__('Nombre de visiteurs uniques'), $stats['visitors']);\r
+//        $lines[] = array(__('Nombre de lieux de visite'), $stats['places']);\r
+//        $lines[] = array(__('Nombre de visiteurs uniques'), $stats['visitors']);\r
         $lines[] = array(__('Nombre de visites'), $stats['visits']);\r
         $lines[] = array(__('Nombre de pages vues'), $stats['pages']);\r
         if ($afriend) {\r
@@ -572,7 +572,7 @@ class wsStats
         $title = '';\r
 \r
         $colsTitles = array(__('Période'), /*__('Lieux de visite'),*/\r
-            __('Visiteurs uniques'), __('Visites'), __('Pages vues'));\r
+            /*__('Visiteurs uniques'),*/ __('Visites'), __('Pages vues'));\r
         if ($afriend) {\r
             $colsTitles[] = __('Liens envoyés');\r
         }\r
@@ -663,7 +663,7 @@ class wsStats
 \r
         $line[] = '<a href="' . $url . '">' . $date . '</a>';\r
         //$line[] = $stats['places'];\r
-        $line[] = $stats['visitors'];\r
+        //$line[] = $stats['visitors'];\r
         $line[] = $stats['visits'];\r
         $line[] = $stats['pages'];\r
         if ($afriend) {\r
@@ -689,20 +689,20 @@ class wsStats
     public static function detailJour($book, $annee, $mois, $stats)\r
     {\r
         $colsTitles = array(__('Jour'), /*__('Lieux de visite'),*/\r
-            __('Visiteurs uniques'), __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
+            /*__('Visiteurs uniques'),*/ __('Visites'), __('Pages vues'), __('Liens cliqués'));\r
         $lines = array();\r
         $xlines = array();\r
 \r
         foreach ($stats->days->day as $day) {\r
             $lines[] = array(strftime('%A %d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)),\r
                 // $day['places'],\r
-                $day['visitors'],\r
+                //$day['visitors'],\r
                 $day['visits'],\r
                 $day['views'],\r
                 $day['links']);\r
             $xlines[] = array(strftime('%d', mktime(0, 0, 0, $mois, (string)$day['day'], $annee)),\r
                 //$day['places'],\r
-                $day['visitors'],\r
+                //$day['visitors'],\r
                 $day['visits'],\r
                 $day['views'],\r
                 $day['links']);\r
@@ -812,7 +812,7 @@ class wsStats
 \r
     public static function detailOrigine($book, $stats)\r
     {\r
-        $colsTitles = array(__('Pays'), __('Visiteurs'));\r
+        $colsTitles = array(__('Pays'), __('Visits'));\r
         $lines = array();\r
         $xlines = array();\r
         $i = 0;\r
@@ -894,9 +894,9 @@ class wsStats
             $c3 = imagecolorallocatealpha($im, 194, 211, 19, 32);\r
             $hv = $h * ($maxv / $max);\r
             $mhv = $y0 - $hv - 6;\r
-            imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
-            imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
-            $c3 = imagecolorallocate($im, 194, 211, 19);\r
+//            imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
+//            imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
+//            $c3 = imagecolorallocate($im, 194, 211, 19);\r
             foreach ($months as $m => $t) {\r
                 if (isset($s[$t])) {\r
                     $x0 += 15;\r
@@ -909,8 +909,8 @@ class wsStats
                     imagefilledrectangle($im, $x0 + 40, $y0 - $hb, $x0, $y0, $c2);\r
                     imagerectangle($im, $x0 + 40, $y0 - $hb, $x0, $y0, $c0);\r
                     $x0 += 5;\r
-                    imagefilledrectangle($im, $x0 + 40, $y0 - $hv, $x0, $y0, $c3);\r
-                    imagerectangle($im, $x0 + 40, $y0 - $hv, $x0, $y0, $c0);\r
+//                    imagefilledrectangle($im, $x0 + 40, $y0 - $hv, $x0, $y0, $c3);\r
+//                    imagerectangle($im, $x0 + 40, $y0 - $hv, $x0, $y0, $c0);\r
                     $i++;\r
                     $x0 += 50;\r
                 } else {\r
@@ -923,7 +923,7 @@ class wsStats
         }\r
         $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
         $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00;">' . $maxb . '</div>';\r
-        $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+       // $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
         $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
         $res .= '<table style="width:944px;max-width:944px;table-layout:fixed;" class="echelle"><tr>';\r
         foreach ($months as $m => $t) {\r
@@ -934,7 +934,7 @@ class wsStats
         $res .= '<table class="legende" style="margin-top:10px;margin-bottom:10px;"><tr>';\r
         $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
         $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
-        $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
+        //$res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
         $res .= '</tr></table></div>';\r
         return $res;\r
     }\r
@@ -998,9 +998,9 @@ class wsStats
             $c3 = imagecolorallocatealpha($im, 194, 211, 19, 32);\r
             $hv = $h * ($maxv / $max);\r
             $mhv = $y0 - $hv - 6;\r
-            imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
-            imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
-            $c3 = imagecolorallocate($im, 194, 211, 19);\r
+//            imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
+//            imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
+//            $c3 = imagecolorallocate($im, 194, 211, 19);\r
             foreach ($s as $t) {\r
                 $x0 -= 15;\r
                 $hp = $h * ($t['page'] / $max) - 2;\r
@@ -1012,18 +1012,17 @@ class wsStats
                 imagefilledrectangle($im, $x0 - 40, $y0 - $hb, $x0, $y0, $c2);\r
                 imagerectangle($im, $x0 - 40, $y0 - $hb, $x0, $y0, $c0);\r
                 $x0 -= 5;\r
-                imagefilledrectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c3);\r
-                imagerectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c0);\r
+//                imagefilledrectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c3);\r
+//                imagerectangle($im, $x0 - 40, $y0 - $hv, $x0, $y0, $c0);\r
                 $i++;\r
                 $x0 -= 50;\r
             }\r
-\r
             imageline($im, 0, $y0, 944, $y0, $c0);\r
             imagepng($im, $img);\r
         }\r
         $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
         $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00">' . $maxb . '</div>';\r
-        $res .= '<div  class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+        //$res .= '<div  class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
         $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
         $s = array_reverse(array_pad($s, 12, false), true);\r
         $res .= '<table style="width:944px;max-width:944px;" class="echelle"><tr>';\r
@@ -1039,7 +1038,7 @@ class wsStats
         $res .= '<table class="legende"><tr>';\r
         $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
         $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
-        $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
+       // $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
         $res .= '</tr></table></div>';\r
         return $res;\r
     }\r
@@ -1099,9 +1098,9 @@ class wsStats
             $c3 = imagecolorallocatealpha($im, 194, 211, 19, 32);\r
             $hv = $h * ($maxv / $max);\r
             $mhv = $y0 - $hv - 6;\r
-            imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
-            imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
-            $c3 = imagecolorallocate($im, 194, 211, 19);\r
+//            imagesetstyle($im, array($c3, $c3, $c3, $c3, $c3, $trans, $trans, $trans, $trans));\r
+//            imageline($im, 0, $y0 - $hv, 944, $y0 - $hv, IMG_COLOR_STYLED);\r
+//            $c3 = imagecolorallocate($im, 194, 211, 19);\r
             foreach ($days as $d => $t) {\r
                 if (isset($s[$t])) {\r
                     $x0 += $space;\r
@@ -1114,8 +1113,8 @@ class wsStats
                     imagefilledrectangle($im, $x0 + 14, $y0 - $hb, $x0, $y0, $c2);\r
                     imagerectangle($im, $x0 + 14, $y0 - $hb, $x0, $y0, $c0);\r
                     $x0 += 3;\r
-                    imagefilledrectangle($im, $x0 + 14, $y0 - $hv, $x0, $y0, $c3);\r
-                    imagerectangle($im, $x0 + 14, $y0 - $hv, $x0, $y0, $c0);\r
+//                    imagefilledrectangle($im, $x0 + 14, $y0 - $hv, $x0, $y0, $c3);\r
+//                    imagerectangle($im, $x0 + 14, $y0 - $hv, $x0, $y0, $c0);\r
                     $i++;\r
                     $x0 += 14 + $space;\r
                 } else {\r
@@ -1128,7 +1127,7 @@ class wsStats
         }\r
         $res = '<div class="graphStats"><div class="graph-note" style="top:' . $mhp . 'px;color:#514e49;">' . $maxpages . '</div>';\r
         $res .= '<div class="graph-note" style="top:' . $mhb . 'px;color:#f54d00;">' . $maxb . '</div>';\r
-        $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
+      //  $res .= '<div class="graph-note" style="top:' . $mhv . 'px;color:#c2d313;">' . $maxv . '</div>';\r
         $res .= '<div class="graph-container" style="background:url(' . $imgw . ')"></div>';\r
         $res .= '<table style="width:944px;max-width:944px;margin:0px;table-layout:fixed;" class="echelle"><tr>';\r
         foreach ($days as $d => $t) {\r
@@ -1140,7 +1139,7 @@ class wsStats
         $res .= '<table style="margin-top:10px;margin-bottom:10px;" class="legende"><tr>';\r
         $res .= '<td style="width:12px;background:#514e49;height:12px;"></td><td style="width:10px;"></td><td>' . __('Pages vues') . '</td><td style="width:10px;"></td>';\r
         $res .= '<td style="width:12px;background:#f54d00;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visites') . '</td><td style="width:10px;"></td>';\r
-        $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
+      //  $res .= '<td style="width:12px;background:#c2d313;height:12px;"></td><td style="width:10px;"></td><td>' . __('Visiteurs uniques') . '</td><td style="width:10px;"></td>';\r
         $res .= '</tr></table></div>';\r
         return $res;\r
     }\r
@@ -1149,4 +1148,11 @@ class wsStats
     {\r
         `/home/stats/www/FWStats.sh /home/stats/www onlybook=$id`;\r
     }\r
+\r
+    /**\r
+     * @return \Cubist\Matomo\Reporting\r
+     */\r
+    public static function getMatomoAPI(){\r
+        return new \Cubist\Matomo\Reporting('https://v3.stats.fluidbook.com/','ebe362f44c01bda1ddedb75d7726ff78');\r
+    }\r
 }
\ No newline at end of file
index 2bf4d4dd69edbfed8a8f43bf587c8d6300d8f5a7..da68ae6640656556b26ca1ea98e835557c32857b 100644 (file)
@@ -984,6 +984,13 @@ class wsHTML5Compiler
     protected function writeStats()
     {
         global $core;
+
+        if ($this->book->parametres->stats) {
+            $this->book->parametres->statsMatomo = wsStats::getMatomoAPI()->createSiteIfNotExistsOrReturnId('Fluidbook #' . $this->book_id, 'https://' . $this->book_id . '.fluidbook');
+        } else {
+            $this->book->parametres->statsMatomo = false;
+        }
+
         if ($this->book->parametres->tagcommander_id) {
             $id = $this->book->parametres->tagcommander_id;
             if (!$this->book->parametres->tagcommander_prod) {
@@ -1521,6 +1528,9 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
         $svg = str_replace('$bookmark-color', wsHTML5::colorToCSS($this->theme->parametres->bookmarkBackgroundColor), $svg);
         $res = [];
         $xml = simplexml_load_string($svg);
+        if (!$xml) {
+            return $res;
+        }
         $xml->registerXPathNamespace('svg', 'http://www.w3.org/2000/svg');
         foreach ($xml->xpath('//svg:symbol') as $item) {
             $res[(string)$item['id']] = $item->asXML();