@@ -117,17 +117,17 @@ discard block |
||
117 | 117 | case 'week': case 'month': |
118 | 118 | $value = $request->all()["value"]; |
119 | 119 | $range = array( |
120 | - 'start' => $value["y2"].'-'.$value["m2"].'-'.$value["d2"], |
|
121 | - 'end' => $value["y1"].'-'.$value["m1"].'-'.$value["d1"] |
|
120 | + 'start' => $value["y2"] . '-' . $value["m2"] . '-' . $value["d2"], |
|
121 | + 'end' => $value["y1"] . '-' . $value["m1"] . '-' . $value["d1"] |
|
122 | 122 | ); |
123 | - $imgDate = $range['start'].','.$range['end']; |
|
123 | + $imgDate = $range['start'] . ',' . $range['end']; |
|
124 | 124 | break; |
125 | 125 | case 'day': |
126 | - if($date == 'today'){ |
|
127 | - $imgDate = date('Y-m-d').",".date('Y-m-d', strtotime(date('Y-m-d')." +2 day")); |
|
126 | + if ($date == 'today') { |
|
127 | + $imgDate = date('Y-m-d') . "," . date('Y-m-d', strtotime(date('Y-m-d') . " +2 day")); |
|
128 | 128 | } |
129 | - if($date == 'yesterday'){ |
|
130 | - $imgDate = date('Y-m-d').",".date('Y-m-d', strtotime(date('Y-m-d')." +2 day")); |
|
129 | + if ($date == 'yesterday') { |
|
130 | + $imgDate = date('Y-m-d') . "," . date('Y-m-d', strtotime(date('Y-m-d') . " +2 day")); |
|
131 | 131 | } |
132 | 132 | break; |
133 | 133 | } |
@@ -146,15 +146,15 @@ discard block |
||
146 | 146 | ->getResponse(); |
147 | 147 | |
148 | 148 | return response()->json([ |
149 | - 'visitimg'=> $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&segment=&showtitle=1&random=6179&columns=nb_visits%2Cnb_uniq_visitors&token_auth='.$this->authToken, |
|
150 | - 'avgvisitimg'=> $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&showtitle=1&random=6179&columns=avg_time_on_site&token_auth='.$this->authToken, |
|
151 | - 'bouncerateimg'=> $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=bounce_rate&token_auth='.$this->authToken, |
|
152 | - 'actions_per_visit_img'=> $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=nb_actions_per_visit&token_auth='.$this->authToken, |
|
153 | - 'pageviewimg' => $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=nb_pageviews%2Cnb_uniq_pageviews&token_auth='.$this->authToken, |
|
154 | - 'searchesandkeywordsimg' => $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=nb_searches%2Cnb_keywords&token_auth='.$this->authToken, |
|
155 | - 'downloadsimg' => $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=nb_downloads%2Cnb_uniq_downloads&token_auth='.$this->authToken, |
|
156 | - 'outlinksimg' => $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=nb_outlinks%2Cnb_uniq_outlinks&token_auth='.$this->authToken, |
|
157 | - 'maxactionsimg' => $matomoUrl.'/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite='.$this->siteId.'&period='.$period.'&date='.$imgDate.'&columns=max_actions&token_auth='.$this->authToken, |
|
149 | + 'visitimg'=> $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&segment=&showtitle=1&random=6179&columns=nb_visits%2Cnb_uniq_visitors&token_auth=' . $this->authToken, |
|
150 | + 'avgvisitimg'=> $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&showtitle=1&random=6179&columns=avg_time_on_site&token_auth=' . $this->authToken, |
|
151 | + 'bouncerateimg'=> $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=bounce_rate&token_auth=' . $this->authToken, |
|
152 | + 'actions_per_visit_img'=> $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=nb_actions_per_visit&token_auth=' . $this->authToken, |
|
153 | + 'pageviewimg' => $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=nb_pageviews%2Cnb_uniq_pageviews&token_auth=' . $this->authToken, |
|
154 | + 'searchesandkeywordsimg' => $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=nb_searches%2Cnb_keywords&token_auth=' . $this->authToken, |
|
155 | + 'downloadsimg' => $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=nb_downloads%2Cnb_uniq_downloads&token_auth=' . $this->authToken, |
|
156 | + 'outlinksimg' => $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=nb_outlinks%2Cnb_uniq_outlinks&token_auth=' . $this->authToken, |
|
157 | + 'maxactionsimg' => $matomoUrl . '/index.php?forceView=1&viewDataTable=sparkline&module=API&action=get&idSite=' . $this->siteId . '&period=' . $period . '&date=' . $imgDate . '&columns=max_actions&token_auth=' . $this->authToken, |
|
158 | 158 | 'data'=> $data |
159 | 159 | ]); |
160 | 160 | } |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $date = strtolower($data["range"]); |
189 | 189 | $period = 'day'; |
190 | 190 | |
191 | - if(!isset($data["y2"],$data["m2"],$data["d2"])){ |
|
191 | + if (!isset($data["y2"], $data["m2"], $data["d2"])) { |
|
192 | 192 | return $periodCheck ? $period : $date; |
193 | 193 | } |
194 | 194 | |
195 | 195 | $range = array( |
196 | - 'start' => $data["y2"].'-'.$data["m2"].'-'.$data["d2"], |
|
197 | - 'end' => $data["y1"].'-'.$data["m1"].'-'.$data["d1"] |
|
196 | + 'start' => $data["y2"] . '-' . $data["m2"] . '-' . $data["d2"], |
|
197 | + 'end' => $data["y1"] . '-' . $data["m1"] . '-' . $data["d1"] |
|
198 | 198 | ); |
199 | 199 | |
200 | 200 | $now = Carbon::now(); |
@@ -206,19 +206,19 @@ discard block |
||
206 | 206 | $diffStartToEnd = $start->diffInDays($end); //difference in days between start date and end date |
207 | 207 | |
208 | 208 | |
209 | - if($diffStartToEnd == 6){ |
|
209 | + if ($diffStartToEnd == 6) { |
|
210 | 210 | $period = 'week'; |
211 | 211 | $date = 'last7'; |
212 | 212 | } |
213 | 213 | |
214 | - if($diffStartToEnd == 29){ |
|
214 | + if ($diffStartToEnd == 29) { |
|
215 | 215 | $period = 'month'; |
216 | 216 | $date = 'last30'; |
217 | 217 | } |
218 | 218 | |
219 | 219 | if ($difference > 0) { |
220 | 220 | $period = 'range'; |
221 | - $date = $range['start'].','.$range['end']; |
|
221 | + $date = $range['start'] . ',' . $range['end']; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | return $periodCheck ? $period : $date; |