@@ -107,23 +107,23 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | $items = Analytics::$plugin->getApis()->getAnalytics()->getColumns(); |
| 109 | 109 | |
| 110 | - if($items) |
|
| 110 | + if ($items) |
|
| 111 | 111 | { |
| 112 | - foreach($items as $item) |
|
| 112 | + foreach ($items as $item) |
|
| 113 | 113 | { |
| 114 | - if($item->attributes['status'] == 'DEPRECATED') |
|
| 114 | + if ($item->attributes['status'] == 'DEPRECATED') |
|
| 115 | 115 | { |
| 116 | 116 | continue; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - if($item->attributes['addedInApiVersion'] > $this->addedInApiVersion) |
|
| 119 | + if ($item->attributes['addedInApiVersion'] > $this->addedInApiVersion) |
|
| 120 | 120 | { |
| 121 | 121 | continue; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - if(isset($item->attributes['minTemplateIndex'])) |
|
| 124 | + if (isset($item->attributes['minTemplateIndex'])) |
|
| 125 | 125 | { |
| 126 | - for($i = $item->attributes['minTemplateIndex']; $i <= $item->attributes['maxTemplateIndex']; $i++) |
|
| 126 | + for ($i = $item->attributes['minTemplateIndex']; $i <= $item->attributes['maxTemplateIndex']; $i++) |
|
| 127 | 127 | { |
| 128 | 128 | $column = []; |
| 129 | 129 | $column['id'] = str_replace('XX', $i, $item->id); |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | $column['group'] = $item->attributes['group']; |
| 168 | 168 | $column['status'] = $item->attributes['status']; |
| 169 | 169 | |
| 170 | - if(isset($item->attributes['allowInSegments'])) |
|
| 170 | + if (isset($item->attributes['allowInSegments'])) |
|
| 171 | 171 | { |
| 172 | 172 | $column['allowInSegments'] = $item->attributes['allowInSegments']; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if(isset($item->attributes['addedInApiVersion'])) |
|
| 175 | + if (isset($item->attributes['addedInApiVersion'])) |
|
| 176 | 176 | { |
| 177 | 177 | $column['addedInApiVersion'] = $item->attributes['addedInApiVersion']; |
| 178 | 178 | } |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | try { |
| 192 | 192 | $token = Analytics::$plugin->oauth->getToken(); |
| 193 | 193 | |
| 194 | - if($isOauthProviderConfigured && $token) { |
|
| 194 | + if ($isOauthProviderConfigured && $token) { |
|
| 195 | 195 | $variables['isConnected'] = true; |
| 196 | 196 | $variables['reportingViews'] = Analytics::$plugin->getViews()->getViews(); |
| 197 | 197 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $isOauthProviderConfigured = Analytics::$plugin->getAnalytics()->isOauthProviderConfigured(); |
| 247 | 247 | |
| 248 | - if($isOauthProviderConfigured) { |
|
| 248 | + if ($isOauthProviderConfigured) { |
|
| 249 | 249 | $errors = []; |
| 250 | 250 | |
| 251 | 251 | try { |
@@ -386,19 +386,19 @@ discard block |
||
| 386 | 386 | |
| 387 | 387 | $accountExplorerData = Analytics::$plugin->getApis()->getAnalytics()->getAccountExplorerData(); |
| 388 | 388 | |
| 389 | - foreach($accountExplorerData['accounts'] as $dataAccount) { |
|
| 390 | - if($dataAccount['id'] == $reportingView->gaAccountId) { |
|
| 389 | + foreach ($accountExplorerData['accounts'] as $dataAccount) { |
|
| 390 | + if ($dataAccount['id'] == $reportingView->gaAccountId) { |
|
| 391 | 391 | $reportingView->gaAccountName = $dataAccount['name']; |
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
| 395 | - foreach($accountExplorerData['properties'] as $dataProperty) { |
|
| 396 | - if($dataProperty['id'] == $reportingView->gaPropertyId) { |
|
| 395 | + foreach ($accountExplorerData['properties'] as $dataProperty) { |
|
| 396 | + if ($dataProperty['id'] == $reportingView->gaPropertyId) { |
|
| 397 | 397 | $reportingView->gaPropertyName = $dataProperty['name']; |
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | - foreach($accountExplorerData['views'] as $dataView) { |
|
| 401 | - if($dataView['id'] == $reportingView->gaViewId) { |
|
| 400 | + foreach ($accountExplorerData['views'] as $dataView) { |
|
| 401 | + if ($dataView['id'] == $reportingView->gaViewId) { |
|
| 402 | 402 | $reportingView->gaViewName = $dataView['name']; |
| 403 | 403 | $reportingView->gaViewCurrency = $dataView['currency']; |
| 404 | 404 | } |
@@ -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 | } |
@@ -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(); |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | Analytics::$plugin->cache->set($cacheId, $response, $cacheDuration); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - return (array)$response; |
|
| 53 | + return (array) $response; |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |