@@ -92,7 +92,7 @@ |
||
| 92 | 92 | |
| 93 | 93 | $pluginSettings = Analytics::$plugin->getSettings(); |
| 94 | 94 | |
| 95 | - if($pluginSettings->forceConnect === true) { |
|
| 95 | + if ($pluginSettings->forceConnect === true) { |
|
| 96 | 96 | $pluginSettings->forceConnect = false; |
| 97 | 97 | Craft::$app->getPlugins()->savePluginSettings(Analytics::$plugin, $pluginSettings->getAttributes()); |
| 98 | 98 | } |
@@ -54,8 +54,7 @@ |
||
| 54 | 54 | Analytics::$plugin->cache->delete(['accountExplorerData']); |
| 55 | 55 | |
| 56 | 56 | Craft::$app->getSession()->setNotice(Craft::t('analytics', "Disconnected from Google Analytics.")); |
| 57 | - } |
|
| 58 | - else |
|
| 57 | + } else |
|
| 59 | 58 | { |
| 60 | 59 | Craft::$app->getSession()->setError(Craft::t('analytics', "Couldn’t disconnect from Google Analytics")); |
| 61 | 60 | } |
@@ -45,13 +45,13 @@ |
||
| 45 | 45 | */ |
| 46 | 46 | public function actionRealtimeWidget() |
| 47 | 47 | { |
| 48 | - if(Analytics::$plugin->getSettings()->demoMode) { |
|
| 48 | + if (Analytics::$plugin->getSettings()->demoMode) { |
|
| 49 | 49 | $activeUsers = random_int(0, 20); |
| 50 | 50 | $pageviews = [ |
| 51 | 51 | 'rows' => [] |
| 52 | 52 | ]; |
| 53 | 53 | |
| 54 | - for($i = 0; $i <= 30; $i++) { |
|
| 54 | + for ($i = 0; $i <= 30; $i++) { |
|
| 55 | 55 | $pageviews['rows'][] = [$i, random_int(0, 20)]; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $accounts = $apiAccounts->toSimpleObject()->items; |
| 51 | 51 | |
| 52 | 52 | // Properties |
| 53 | - $apiProperties = Plugin::$plugin->getApis()->getAnalytics()->getService()->management_webproperties->listManagementWebproperties('~all');; |
|
| 53 | + $apiProperties = Plugin::$plugin->getApis()->getAnalytics()->getService()->management_webproperties->listManagementWebproperties('~all'); ; |
|
| 54 | 54 | $properties = $apiProperties->toSimpleObject()->items; |
| 55 | 55 | |
| 56 | 56 | // Views |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | $reportsResponse = $this->getReportingReports($criterias); |
| 67 | 67 | |
| 68 | 68 | if ($toArray) { |
| 69 | - $reportsResponseArray = (array)$reportsResponse->toSimpleObject(); |
|
| 69 | + $reportsResponseArray = (array) $reportsResponse->toSimpleObject(); |
|
| 70 | 70 | |
| 71 | 71 | return $reportsResponseArray['reports']; |
| 72 | 72 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | { |
| 111 | 111 | $request = new Google_Service_AnalyticsReporting_ReportRequest(); |
| 112 | 112 | |
| 113 | - if($criteria->gaViewId) { |
|
| 113 | + if ($criteria->gaViewId) { |
|
| 114 | 114 | $request->setViewId('ga:'.$criteria->gaViewId); |
| 115 | 115 | } else { |
| 116 | 116 | if ($criteria->viewId) { |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | if ($criteria->pageToken) { |
| 151 | 151 | $pageToken = $criteria->pageToken; |
| 152 | 152 | |
| 153 | - if(is_int($pageToken)) { |
|
| 153 | + if (is_int($pageToken)) { |
|
| 154 | 154 | $pageToken = (string) $pageToken; |
| 155 | 155 | } |
| 156 | 156 | |
@@ -165,15 +165,15 @@ discard block |
||
| 165 | 165 | $request->setFiltersExpression($criteria->filtersExpression); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - if($criteria->includeEmptyRows) { |
|
| 168 | + if ($criteria->includeEmptyRows) { |
|
| 169 | 169 | $request->setIncludeEmptyRows($criteria->includeEmptyRows); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - if($criteria->hideTotals) { |
|
| 172 | + if ($criteria->hideTotals) { |
|
| 173 | 173 | $request->setHideTotals($criteria->hideTotals); |
| 174 | 174 | } |
| 175 | 175 | |
| 176 | - if($criteria->hideValueRanges) { |
|
| 176 | + if ($criteria->hideValueRanges) { |
|
| 177 | 177 | $request->setHideValueRanges($criteria->hideValueRanges); |
| 178 | 178 | } |
| 179 | 179 | |
@@ -112,7 +112,7 @@ |
||
| 112 | 112 | $response['report'] = Analytics::$plugin->getApis()->getAnalyticsReporting()->getReport($this, $toArray); |
| 113 | 113 | $response['success'] = true; |
| 114 | 114 | } |
| 115 | - catch(\Exception $e) |
|
| 115 | + catch (\Exception $e) |
|
| 116 | 116 | { |
| 117 | 117 | $response['error'] = true; |
| 118 | 118 | $response['errorMessage'] = $e->getMessage(); |
@@ -111,8 +111,7 @@ |
||
| 111 | 111 | { |
| 112 | 112 | $response['report'] = Analytics::$plugin->getApis()->getAnalyticsReporting()->getReport($this, $toArray); |
| 113 | 113 | $response['success'] = true; |
| 114 | - } |
|
| 115 | - catch(\Exception $e) |
|
| 114 | + } catch(\Exception $e) |
|
| 116 | 115 | { |
| 117 | 116 | $response['error'] = true; |
| 118 | 117 | $response['errorMessage'] = $e->getMessage(); |