@@ -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 | // TODO: pending Commerce for Craft 3 |
@@ -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) { |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | case "RedactorI": |
| 224 | 224 | case "PreparseField_Preparse": |
| 225 | 225 | case "Categories": |
| 226 | - $result[$field->handle] = $field->name; |
|
| 226 | + $result[ $field->handle ] = $field->name; |
|
| 227 | 227 | break; |
| 228 | 228 | |
| 229 | 229 | case "Tags": |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $request = Craft::$app->getRequest(); |
| 272 | 272 | if ($request->getIsSiteRequest() && !$request->getIsConsoleRequest()) { |
| 273 | 273 | // If SEOmatic is installed, set the page title from it |
| 274 | - if (self::$seomaticPlugin && isset($context['seomaticMeta'])) { |
|
| 274 | + if (self::$seomaticPlugin && isset($context[ 'seomaticMeta' ])) { |
|
| 275 | 275 | // TODO: fix for SEOmatic |
| 276 | 276 | /* |
| 277 | 277 | $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 | } |
@@ -489,12 +489,12 @@ discard block |
||
| 489 | 489 | */ |
| 490 | 490 | private function gaParseCookie() |
| 491 | 491 | { |
| 492 | - if (isset($_COOKIE['_ga'])) { |
|
| 493 | - $parts = preg_split('[\.]', $_COOKIE["_ga"], 4); |
|
| 492 | + if (isset($_COOKIE[ '_ga' ])) { |
|
| 493 | + $parts = preg_split('[\.]', $_COOKIE[ "_ga" ], 4); |
|
| 494 | 494 | $cid = implode(array_slice($parts, 2), '.'); |
| 495 | 495 | } else { |
| 496 | - if (isset($_COOKIE['_ia']) && $_COOKIE['_ia'] != '') { |
|
| 497 | - $cid = $_COOKIE['_ia']; |
|
| 496 | + if (isset($_COOKIE[ '_ia' ]) && $_COOKIE[ '_ia' ] != '') { |
|
| 497 | + $cid = $_COOKIE[ '_ia' ]; |
|
| 498 | 498 | } else { |
| 499 | 499 | $cid = $this->gaGenUUID(); |
| 500 | 500 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function getProductDataFromProduct($productVariant = null) |
| 43 | 43 | { |
| 44 | - $result = []; |
|
| 44 | + $result = [ ]; |
|
| 45 | 45 | if ($productVariant) { |
| 46 | 46 | if (is_object($productVariant) && ($productVariant->getElementType() == "Commerce_Product" || is_a($productVariant, "Commerce\\Base\\Purchasable"))) { |
| 47 | 47 | $productType = property_exists($productVariant, "typeId") |
@@ -52,26 +52,26 @@ discard block |
||
| 52 | 52 | $productVariant = ArrayHelper::getFirstValue($productVariant->getVariants()); |
| 53 | 53 | $product = $productVariant->getProduct(); |
| 54 | 54 | if ($product) { |
| 55 | - $category = $product->getType()['name']; |
|
| 55 | + $category = $product->getType()[ 'name' ]; |
|
| 56 | 56 | $name = $product->title; |
| 57 | 57 | $variant = $productVariant->title; |
| 58 | 58 | } else { |
| 59 | - $category = $productVariant->getType()['name']; |
|
| 59 | + $category = $productVariant->getType()[ 'name' ]; |
|
| 60 | 60 | $name = $productVariant->title; |
| 61 | 61 | $variant = ""; |
| 62 | 62 | } |
| 63 | 63 | } else { |
| 64 | 64 | if (isset($productVariant->defaultVariantId)) { |
| 65 | 65 | $productVariant = craft()->commerce_variants->getVariantById($productVariant->defaultVariantId); |
| 66 | - $category = $productVariant->getProduct()->getType()['name']; |
|
| 66 | + $category = $productVariant->getProduct()->getType()[ 'name' ]; |
|
| 67 | 67 | $name = $productVariant->title; |
| 68 | 68 | $variant = ""; |
| 69 | 69 | } else { |
| 70 | 70 | if (isset($productVariant->product)) { |
| 71 | - $category = $productVariant->product->getType()['name']; |
|
| 71 | + $category = $productVariant->product->getType()[ 'name' ]; |
|
| 72 | 72 | $name = $productVariant->product->title; |
| 73 | 73 | } else { |
| 74 | - $category = $productVariant->getType()['name']; |
|
| 74 | + $category = $productVariant->getType()[ 'name' ]; |
|
| 75 | 75 | $name = $productVariant->title; |
| 76 | 76 | } |
| 77 | 77 | $variant = $productVariant->title; |
@@ -90,35 +90,35 @@ discard block |
||
| 90 | 90 | ]; |
| 91 | 91 | |
| 92 | 92 | if ($variant) { |
| 93 | - $productData['variant'] = $variant; |
|
| 93 | + $productData[ 'variant' ] = $variant; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $settings = craft()->plugins->getPlugin('instantanalytics')->getSettings(); |
| 97 | 97 | $isVariant = $productVariant->getElementType() == "Commerce_Variant"; |
| 98 | 98 | |
| 99 | - if (isset($settings) && isset($settings['productCategoryField']) && $settings['productCategoryField'] != "") { |
|
| 100 | - $productData['category'] = $this->_pullDataFromField( |
|
| 99 | + if (isset($settings) && isset($settings[ 'productCategoryField' ]) && $settings[ 'productCategoryField' ] != "") { |
|
| 100 | + $productData[ 'category' ] = $this->_pullDataFromField( |
|
| 101 | 101 | $productVariant, |
| 102 | - $settings['productCategoryField'] |
|
| 102 | + $settings[ 'productCategoryField' ] |
|
| 103 | 103 | ); |
| 104 | - if (empty($productData['category']) && $isVariant) { |
|
| 105 | - $productData['category'] = $this->_pullDataFromField( |
|
| 104 | + if (empty($productData[ 'category' ]) && $isVariant) { |
|
| 105 | + $productData[ 'category' ] = $this->_pullDataFromField( |
|
| 106 | 106 | $productVariant->product, |
| 107 | - $settings['productCategoryField'] |
|
| 107 | + $settings[ 'productCategoryField' ] |
|
| 108 | 108 | ); |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - if (isset($settings) && isset($settings['productBrandField']) && $settings['productBrandField'] != "") { |
|
| 113 | - $productData['brand'] = $this->_pullDataFromField( |
|
| 112 | + if (isset($settings) && isset($settings[ 'productBrandField' ]) && $settings[ 'productBrandField' ] != "") { |
|
| 113 | + $productData[ 'brand' ] = $this->_pullDataFromField( |
|
| 114 | 114 | $productVariant, |
| 115 | - $settings['productBrandField'], |
|
| 115 | + $settings[ 'productBrandField' ], |
|
| 116 | 116 | true |
| 117 | 117 | ); |
| 118 | - if (empty($productData['brand']) && $isVariant) { |
|
| 119 | - $productData['brand'] = $this->_pullDataFromField( |
|
| 118 | + if (empty($productData[ 'brand' ]) && $isVariant) { |
|
| 119 | + $productData[ 'brand' ] = $this->_pullDataFromField( |
|
| 120 | 120 | $productVariant, |
| 121 | - $settings['productBrandField'], |
|
| 121 | + $settings[ 'productBrandField' ], |
|
| 122 | 122 | true |
| 123 | 123 | ); |
| 124 | 124 | } |
@@ -152,12 +152,12 @@ discard block |
||
| 152 | 152 | $analytics->setProductImpressionListName($listName, $listIndex); |
| 153 | 153 | } |
| 154 | 154 | if ($index) { |
| 155 | - $productData['position'] = $index; |
|
| 155 | + $productData[ 'position' ] = $index; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | //Add the product to the hit to be sent |
| 159 | 159 | $analytics->addProductImpression($productData, $listIndex); |
| 160 | - InstantAnalyticsPlugin::log("addCommerceProductImpression for `" . $productData['sku'] . "` - `" . $productData['name'] . "` - `" . $productData['name'] . "` - `" . $index . "`", LogLevel::Info, false); |
|
| 160 | + InstantAnalyticsPlugin::log("addCommerceProductImpression for `" . $productData[ 'sku' ] . "` - `" . $productData[ 'name' ] . "` - `" . $productData[ 'name' ] . "` - `" . $index . "`", LogLevel::Info, false); |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | } /* -- addCommerceProductImpression */ |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | //Add the product to the hit to be sent |
| 183 | 183 | $analytics->addProduct($productData); |
| 184 | - InstantAnalyticsPlugin::log("addCommerceProductDetailView for `" . $productData['sku'] . "` - `" . $productData['name'] . "` - `" . $productData['name'] . "`", LogLevel::Info, false); |
|
| 184 | + InstantAnalyticsPlugin::log("addCommerceProductDetailView for `" . $productData[ 'sku' ] . "` - `" . $productData[ 'name' ] . "` - `" . $productData[ 'name' ] . "`", LogLevel::Info, false); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | } /* -- addCommerceProductDetailView */ |
@@ -238,33 +238,33 @@ discard block |
||
| 238 | 238 | $productVariant = $lineItem->purchasable->product; |
| 239 | 239 | if (!$lineItem->purchasable->product->type->hasVariants) { |
| 240 | 240 | //No variants (i.e. default variant) |
| 241 | - $productData['name'] = $lineItem->purchasable->title; |
|
| 242 | - $productData['category'] = $lineItem->purchasable->product->type['name']; |
|
| 241 | + $productData[ 'name' ] = $lineItem->purchasable->title; |
|
| 242 | + $productData[ 'category' ] = $lineItem->purchasable->product->type[ 'name' ]; |
|
| 243 | 243 | } else { |
| 244 | 244 | // Product with variants |
| 245 | - $productData['name'] = $lineItem->purchasable->product->title; |
|
| 246 | - $productData['category'] = $lineItem->purchasable->product->type['name']; |
|
| 247 | - $productData['variant'] = $lineItem->purchasable->title; |
|
| 245 | + $productData[ 'name' ] = $lineItem->purchasable->product->title; |
|
| 246 | + $productData[ 'category' ] = $lineItem->purchasable->product->type[ 'name' ]; |
|
| 247 | + $productData[ 'variant' ] = $lineItem->purchasable->title; |
|
| 248 | 248 | } |
| 249 | 249 | } else { |
| 250 | 250 | $productVariant = $lineItem->purchasable; |
| 251 | - $productData['name'] = $lineItem->purchasable->title; |
|
| 252 | - $productData['category'] = $lineItem->purchasable->type->name; |
|
| 251 | + $productData[ 'name' ] = $lineItem->purchasable->title; |
|
| 252 | + $productData[ 'category' ] = $lineItem->purchasable->type->name; |
|
| 253 | 253 | } |
| 254 | - $result = $productData['name']; |
|
| 254 | + $result = $productData[ 'name' ]; |
|
| 255 | 255 | if ($index) { |
| 256 | - $productData['position'] = $index; |
|
| 256 | + $productData[ 'position' ] = $index; |
|
| 257 | 257 | } |
| 258 | 258 | if ($listName) { |
| 259 | - $productData['list'] = $listName; |
|
| 259 | + $productData[ 'list' ] = $listName; |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | $settings = craft()->plugins->getPlugin('instantanalytics')->getSettings(); |
| 263 | - if (isset($settings) && isset($settings['productCategoryField']) && $settings['productCategoryField'] != "") { |
|
| 264 | - $productData['category'] = $this->_pullDataFromField($productVariant, $settings['productCategoryField']); |
|
| 263 | + if (isset($settings) && isset($settings[ 'productCategoryField' ]) && $settings[ 'productCategoryField' ] != "") { |
|
| 264 | + $productData[ 'category' ] = $this->_pullDataFromField($productVariant, $settings[ 'productCategoryField' ]); |
|
| 265 | 265 | } |
| 266 | - if (isset($settings) && isset($settings['productBrandField']) && $settings['productBrandField'] != "") { |
|
| 267 | - $productData['brand'] = $this->_pullDataFromField($productVariant, $settings['productBrandField']); |
|
| 266 | + if (isset($settings) && isset($settings[ 'productBrandField' ]) && $settings[ 'productBrandField' ] != "") { |
|
| 267 | + $productData[ 'brand' ] = $this->_pullDataFromField($productVariant, $settings[ 'productBrandField' ]); |
|
| 268 | 268 | } |
| 269 | 269 | //Add each product to the hit to be sent |
| 270 | 270 | $analytics->addProduct($productData); |
@@ -387,9 +387,9 @@ discard block |
||
| 387 | 387 | $result = ""; |
| 388 | 388 | if ($productVariant) { |
| 389 | 389 | if ($fieldHandle) { |
| 390 | - $srcField = $productVariant[$fieldHandle]; |
|
| 390 | + $srcField = $productVariant[ $fieldHandle ]; |
|
| 391 | 391 | if ($srcField == null) { |
| 392 | - $srcField = $productVariant->product->content->attributes[$fieldHandle]; |
|
| 392 | + $srcField = $productVariant->product->content->attributes[ $fieldHandle ]; |
|
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | if (isset($srcField->elementType)) { |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | break; |
| 405 | 405 | |
| 406 | 406 | case ElementType::Category: { |
| 407 | - $cats = []; |
|
| 407 | + $cats = [ ]; |
|
| 408 | 408 | if ($isBrand) { |
| 409 | 409 | // Because we can only have one brand, we'll get |
| 410 | 410 | // the very last category. This means if our |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | // not the parent. |
| 413 | 413 | /** @var CategoryModel $cat */ |
| 414 | 414 | foreach ($srcField as $cat) { |
| 415 | - $cats = [$cat->getTitle()]; |
|
| 415 | + $cats = [ $cat->getTitle() ]; |
|
| 416 | 416 | } |
| 417 | 417 | } else { |
| 418 | 418 | // For every category, show its ancestors |
@@ -423,7 +423,7 @@ discard block |
||
| 423 | 423 | while ($cat = $cat->getParent()) { |
| 424 | 424 | $name = $cat->getTitle() . "/" . $name; |
| 425 | 425 | } |
| 426 | - $cats[] = $name; |
|
| 426 | + $cats[ ] = $name; |
|
| 427 | 427 | } |
| 428 | 428 | } |
| 429 | 429 | // Join separate categories with a pipe. |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | public function getGlobals() |
| 47 | 47 | { |
| 48 | - $globals = []; |
|
| 48 | + $globals = [ ]; |
|
| 49 | 49 | $view = Craft::$app->getView(); |
| 50 | 50 | if ($view->getIsRenderingPageTemplate()) { |
| 51 | 51 | $request = Craft::$app->getRequest(); |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | public function getFilters() |
| 67 | 67 | { |
| 68 | 68 | return [ |
| 69 | - new \Twig_SimpleFilter('pageViewAnalytics', [$this, 'pageViewAnalytics']), |
|
| 70 | - new \Twig_SimpleFilter('eventAnalytics', [$this, 'eventAnalytics']), |
|
| 71 | - new \Twig_SimpleFilter('pageViewTrackingUrl', [$this, 'pageViewTrackingUrl']), |
|
| 72 | - new \Twig_SimpleFilter('eventTrackingUrl', [$this, 'eventTrackingUrl']), |
|
| 69 | + new \Twig_SimpleFilter('pageViewAnalytics', [ $this, 'pageViewAnalytics' ]), |
|
| 70 | + new \Twig_SimpleFilter('eventAnalytics', [ $this, 'eventAnalytics' ]), |
|
| 71 | + new \Twig_SimpleFilter('pageViewTrackingUrl', [ $this, 'pageViewTrackingUrl' ]), |
|
| 72 | + new \Twig_SimpleFilter('eventTrackingUrl', [ $this, 'eventTrackingUrl' ]), |
|
| 73 | 73 | ]; |
| 74 | 74 | } |
| 75 | 75 | |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | public function getFunctions() |
| 80 | 80 | { |
| 81 | 81 | return [ |
| 82 | - new \Twig_SimpleFunction('pageViewAnalytics', [$this, 'pageViewAnalytics']), |
|
| 83 | - new \Twig_SimpleFunction('eventAnalytics', [$this, 'eventAnalytics']), |
|
| 84 | - new \Twig_SimpleFunction('pageViewTrackingUrl', [$this, 'pageViewTrackingUrl']), |
|
| 85 | - new \Twig_SimpleFunction('eventTrackingUrl', [$this, 'eventTrackingUrl']), |
|
| 82 | + new \Twig_SimpleFunction('pageViewAnalytics', [ $this, 'pageViewAnalytics' ]), |
|
| 83 | + new \Twig_SimpleFunction('eventAnalytics', [ $this, 'eventAnalytics' ]), |
|
| 84 | + new \Twig_SimpleFunction('pageViewTrackingUrl', [ $this, 'pageViewTrackingUrl' ]), |
|
| 85 | + new \Twig_SimpleFunction('eventTrackingUrl', [ $this, 'eventTrackingUrl' ]), |
|
| 86 | 86 | ]; |
| 87 | 87 | } |
| 88 | 88 | |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | { |
| 61 | 61 | /** @var Settings $settings */ |
| 62 | 62 | $settings = InstantAnalytics::$plugin->getSettings(); |
| 63 | - $requestIp = $_SERVER['REMOTE_ADDR']; |
|
| 63 | + $requestIp = $_SERVER[ 'REMOTE_ADDR' ]; |
|
| 64 | 64 | if ($this->shouldSendAnalytics) { |
| 65 | 65 | try { |
| 66 | 66 | Craft::info( |