@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $commerceFields = array_merge($commerceFields, $variantFields); |
| 181 | 181 | } |
| 182 | 182 | } |
| 183 | - */ |
|
| 183 | + */ |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | * TODO: fix for SEOmatic |
| 276 | 276 | $seomaticMeta = $context['seomaticMeta']; |
| 277 | 277 | $analytics->setDocumentTitle($seomaticMeta['seoTitle']); |
| 278 | - */ |
|
| 278 | + */ |
|
| 279 | 279 | } |
| 280 | 280 | $this->sendPageView(); |
| 281 | 281 | } |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | // Add in our Twig extensions |
| 84 | 84 | $view->registerTwigExtension(new InstantAnalyticsTwigExtension()); |
| 85 | 85 | // Install our template hook |
| 86 | - $view->hook('iaSendPageView', [$this, 'iaSendPageView']); |
|
| 86 | + $view->hook('iaSendPageView', [ $this, 'iaSendPageView' ]); |
|
| 87 | 87 | // Determine if Craft Commerce is installed & enabled |
| 88 | 88 | self::$commercePlugin = Craft::$app->getPlugins()->getPlugin('commerce'); |
| 89 | 89 | // Determine if SEOmatic is installed & enabled |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | Event::on( |
| 93 | 93 | CraftVariable::class, |
| 94 | 94 | CraftVariable::EVENT_INIT, |
| 95 | - function (Event $event) { |
|
| 95 | + function(Event $event) { |
|
| 96 | 96 | /** @var CraftVariable $variable */ |
| 97 | 97 | $variable = $event->sender; |
| 98 | 98 | $variable->set('instantAnalytics', InstantAnalyticsVariable::class); |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | Event::on( |
| 104 | 104 | Plugins::class, |
| 105 | 105 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
| 106 | - function (PluginEvent $event) { |
|
| 106 | + function(PluginEvent $event) { |
|
| 107 | 107 | if ($event->plugin === $this) { |
| 108 | 108 | $request = Craft::$app->getRequest(); |
| 109 | 109 | if (($request->isCpRequest) && (!$request->isConsoleRequest)) { |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | Event::on( |
| 120 | 120 | View::class, |
| 121 | 121 | View::EVENT_BEFORE_RENDER_PAGE_TEMPLATE, |
| 122 | - function (TemplateEvent $event) { |
|
| 122 | + function(TemplateEvent $event) { |
|
| 123 | 123 | self::$currentTemplate = $event->template; |
| 124 | 124 | } |
| 125 | 125 | ); |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | Event::on( |
| 128 | 128 | View::class, |
| 129 | 129 | View::EVENT_AFTER_RENDER_PAGE_TEMPLATE, |
| 130 | - function (TemplateEvent $event) { |
|
| 130 | + function(TemplateEvent $event) { |
|
| 131 | 131 | $settings = InstantAnalytics::$plugin->getSettings(); |
| 132 | 132 | if ($settings->autoSendPageView) { |
| 133 | 133 | $this->sendPageView(); |
@@ -138,10 +138,10 @@ discard block |
||
| 138 | 138 | Event::on( |
| 139 | 139 | UrlManager::class, |
| 140 | 140 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
| 141 | - function (RegisterUrlRulesEvent $event) { |
|
| 142 | - $event->rules['instantanalytics/pageViewTrack/<filename:[-\w\.*]+>?'] = |
|
| 141 | + function(RegisterUrlRulesEvent $event) { |
|
| 142 | + $event->rules[ 'instantanalytics/pageViewTrack/<filename:[-\w\.*]+>?' ] = |
|
| 143 | 143 | 'instant-analytics/track/track-page-view-url'; |
| 144 | - $event->rules['instantanalytics/eventTrack/<filename:[-\w\.*]+>?'] = |
|
| 144 | + $event->rules[ 'instantanalytics/eventTrack/<filename:[-\w\.*]+>?' ] = |
|
| 145 | 145 | 'instant-analytics/track/track-event-url'; |
| 146 | 146 | } |
| 147 | 147 | ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | Craft::t( |
| 156 | 156 | 'instant-analytics', |
| 157 | 157 | '{name} plugin loaded', |
| 158 | - ['name' => $this->name] |
|
| 158 | + [ 'name' => $this->name ] |
|
| 159 | 159 | ), |
| 160 | 160 | __METHOD__ |
| 161 | 161 | ); |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | */ |
| 167 | 167 | public function settingsHtml() |
| 168 | 168 | { |
| 169 | - $commerceFields = []; |
|
| 169 | + $commerceFields = [ ]; |
|
| 170 | 170 | |
| 171 | 171 | if (self::$commercePlugin) { |
| 172 | 172 | /** |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | */ |
| 213 | 213 | private function getPullFieldsFromLayoutId(int $layoutId) |
| 214 | 214 | { |
| 215 | - $result = ['' => "none"]; |
|
| 215 | + $result = [ '' => "none" ]; |
|
| 216 | 216 | $fieldLayout = Craft::$app->getFields()->getLayoutById($layoutId); |
| 217 | 217 | $fieldLayoutFields = $fieldLayout->getFields(); |
| 218 | 218 | foreach ($fieldLayoutFields as $fieldLayoutField) { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | case "RichText": |
| 223 | 223 | case "RedactorI": |
| 224 | 224 | case "Categories": |
| 225 | - $result[$field->handle] = $field->name; |
|
| 225 | + $result[ $field->handle ] = $field->name; |
|
| 226 | 226 | break; |
| 227 | 227 | |
| 228 | 228 | case "Tags": |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $request = Craft::$app->getRequest(); |
| 271 | 271 | if ($request->getIsSiteRequest() && !$request->getIsConsoleRequest()) { |
| 272 | 272 | // If SEOmatic is installed, set the page title from it |
| 273 | - if (self::$seomaticPlugin && isset($context['seomaticMeta'])) { |
|
| 273 | + if (self::$seomaticPlugin && isset($context[ 'seomaticMeta' ])) { |
|
| 274 | 274 | /** |
| 275 | 275 | * TODO: fix for SEOmatic |
| 276 | 276 | $seomaticMeta = $context['seomaticMeta']; |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | // Check the $_SERVER[] super-global exclusions |
| 268 | 268 | if (isset($settings->serverExcludes) && is_array($settings->serverExcludes)) { |
| 269 | 269 | foreach ($settings->serverExcludes as $match => $matchArray) { |
| 270 | - if (isset($_SERVER[$match])) { |
|
| 270 | + if (isset($_SERVER[ $match ])) { |
|
| 271 | 271 | foreach ($matchArray as $matchItem) { |
| 272 | - if (preg_match($matchItem, $_SERVER[$match])) { |
|
| 272 | + if (preg_match($matchItem, $_SERVER[ $match ])) { |
|
| 273 | 273 | if ($settings->logExcludedAnalytics) { |
| 274 | 274 | Craft::info( |
| 275 | 275 | "Analytics excluded for: " . $requestIp . " due to: `serverExcludes`", |
@@ -351,13 +351,13 @@ discard block |
||
| 351 | 351 | // We want to send just a path to GA for page views |
| 352 | 352 | if (UrlHelper::isAbsoluteUrl($url)) { |
| 353 | 353 | $urlParts = parse_url($url); |
| 354 | - if (isset($urlParts['path'])) { |
|
| 355 | - $url = $urlParts['path']; |
|
| 354 | + if (isset($urlParts[ 'path' ])) { |
|
| 355 | + $url = $urlParts[ 'path' ]; |
|
| 356 | 356 | } else { |
| 357 | 357 | $url = "/"; |
| 358 | 358 | } |
| 359 | - if (isset($urlParts['query'])) { |
|
| 360 | - $url = $url."?".$urlParts['query']; |
|
| 359 | + if (isset($urlParts[ 'query' ])) { |
|
| 360 | + $url = $url . "?" . $urlParts[ 'query' ]; |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | |
@@ -471,8 +471,8 @@ discard block |
||
| 471 | 471 | private function getGclid() |
| 472 | 472 | { |
| 473 | 473 | $gclid = ""; |
| 474 | - if (isset($_GET['gclid'])) { |
|
| 475 | - $gclid = $_GET['gclid']; |
|
| 474 | + if (isset($_GET[ 'gclid' ])) { |
|
| 475 | + $gclid = $_GET[ 'gclid' ]; |
|
| 476 | 476 | if (!empty($gclid)) { |
| 477 | 477 | setcookie("gclid", $gclid, time() + (10 * 365 * 24 * 60 * 60), "/"); |
| 478 | 478 | } |
@@ -490,14 +490,14 @@ discard block |
||
| 490 | 490 | private function gaParseCookie() |
| 491 | 491 | { |
| 492 | 492 | $cid = ''; |
| 493 | - if (isset($_COOKIE['_ga'])) { |
|
| 494 | - $parts = preg_split('[\.]', $_COOKIE["_ga"], 4); |
|
| 493 | + if (isset($_COOKIE[ '_ga' ])) { |
|
| 494 | + $parts = preg_split('[\.]', $_COOKIE[ "_ga" ], 4); |
|
| 495 | 495 | if ($parts !== false) { |
| 496 | 496 | $cid = implode('.', array_slice($parts, 2)); |
| 497 | 497 | } |
| 498 | 498 | } else { |
| 499 | - if (isset($_COOKIE['_ia']) && $_COOKIE['_ia'] != '') { |
|
| 500 | - $cid = $_COOKIE['_ia']; |
|
| 499 | + if (isset($_COOKIE[ '_ia' ]) && $_COOKIE[ '_ia' ] != '') { |
|
| 500 | + $cid = $_COOKIE[ '_ia' ]; |
|
| 501 | 501 | } else { |
| 502 | 502 | $cid = $this->gaGenUUID(); |
| 503 | 503 | } |