@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function add($metaItem, string $handle = self::GENERAL_HANDLE) |
77 | 77 | { |
78 | - $key = MetaLinkContainer::CONTAINER_TYPE . $handle; |
|
78 | + $key = MetaLinkContainer::CONTAINER_TYPE.$handle; |
|
79 | 79 | Seomatic::$plugin->metaContainers->addToMetaContainer($metaItem, $key); |
80 | 80 | |
81 | 81 | /** @var MetaLink $metaItem */ |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | public function container(string $handle = self::GENERAL_HANDLE) |
101 | 101 | { |
102 | - $key = MetaLinkContainer::CONTAINER_TYPE . $handle; |
|
102 | + $key = MetaLinkContainer::CONTAINER_TYPE.$handle; |
|
103 | 103 | |
104 | 104 | return Seomatic::$plugin->metaContainers->getMetaContainer($key); |
105 | 105 | } |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | // Constants |
43 | 43 | // ========================================================================= |
44 | 44 | |
45 | - const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapIndexTemplate::TEMPLATE_TYPE; |
|
45 | + const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapIndexTemplate::TEMPLATE_TYPE; |
|
46 | 46 | |
47 | - const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapTemplate::TEMPLATE_TYPE; |
|
47 | + const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapTemplate::TEMPLATE_TYPE; |
|
48 | 48 | |
49 | - const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapCustomTemplate::TEMPLATE_TYPE; |
|
49 | + const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapCustomTemplate::TEMPLATE_TYPE; |
|
50 | 50 | |
51 | 51 | const SEARCH_ENGINE_SUBMISSION_URLS = [ |
52 | 52 | 'google' => 'https://www.google.com/ping?sitemap=', |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | Event::on( |
92 | 92 | UrlManager::class, |
93 | 93 | UrlManager::EVENT_REGISTER_SITE_URL_RULES, |
94 | - function (RegisterUrlRulesEvent $event) { |
|
94 | + function(RegisterUrlRulesEvent $event) { |
|
95 | 95 | Craft::debug( |
96 | 96 | 'UrlManager::EVENT_REGISTER_SITE_URL_RULES', |
97 | 97 | __METHOD__ |
@@ -244,19 +244,19 @@ discard block |
||
244 | 244 | $siteId = $groupSiteIds[0]; |
245 | 245 | $sitemapIndexUrl = $this->sitemapIndexUrlForSiteId($siteId); |
246 | 246 | if (!empty($sitemapIndexUrl)) { |
247 | - $submissionUrl = $url . urlencode($sitemapIndexUrl); |
|
247 | + $submissionUrl = $url.urlencode($sitemapIndexUrl); |
|
248 | 248 | // create new guzzle client |
249 | 249 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 120, 'connect_timeout' => 120]); |
250 | 250 | // Submit the sitemap index to each search engine |
251 | 251 | try { |
252 | 252 | $guzzleClient->post($submissionUrl); |
253 | 253 | Craft::info( |
254 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
254 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
255 | 255 | __METHOD__ |
256 | 256 | ); |
257 | 257 | } catch (\Exception $e) { |
258 | 258 | Craft::error( |
259 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
259 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
260 | 260 | __METHOD__ |
261 | 261 | ); |
262 | 262 | } |
@@ -316,19 +316,19 @@ discard block |
||
316 | 316 | foreach ($searchEngineUrls as &$url) { |
317 | 317 | $sitemapUrl = $this->sitemapUrlForBundle($sourceBundleType, $sourceHandle, $sourceSiteId); |
318 | 318 | if (!empty($sitemapUrl)) { |
319 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
319 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
320 | 320 | // create new guzzle client |
321 | 321 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 120, 'connect_timeout' => 120]); |
322 | 322 | // Submit the sitemap index to each search engine |
323 | 323 | try { |
324 | 324 | $guzzleClient->post($submissionUrl); |
325 | 325 | Craft::info( |
326 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
326 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
327 | 327 | __METHOD__ |
328 | 328 | ); |
329 | 329 | } catch (\Exception $e) { |
330 | 330 | Craft::error( |
331 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
331 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
332 | 332 | __METHOD__ |
333 | 333 | ); |
334 | 334 | } |
@@ -394,19 +394,19 @@ discard block |
||
394 | 394 | foreach ($searchEngineUrls as &$url) { |
395 | 395 | $sitemapUrl = $this->sitemapCustomUrlForSiteId($siteId); |
396 | 396 | if (!empty($sitemapUrl)) { |
397 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
397 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
398 | 398 | // create new guzzle client |
399 | 399 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 120, 'connect_timeout' => 120]); |
400 | 400 | // Submit the sitemap index to each search engine |
401 | 401 | try { |
402 | 402 | $guzzleClient->post($submissionUrl); |
403 | 403 | Craft::info( |
404 | - 'Sitemap Custom submitted to: ' . $submissionUrl, |
|
404 | + 'Sitemap Custom submitted to: '.$submissionUrl, |
|
405 | 405 | __METHOD__ |
406 | 406 | ); |
407 | 407 | } catch (\Exception $e) { |
408 | 408 | Craft::error( |
409 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
409 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
410 | 410 | __METHOD__ |
411 | 411 | ); |
412 | 412 | } |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | } |
485 | 485 | |
486 | 486 | foreach ($sites as $site) { |
487 | - $result .= 'sitemap: ' . $this->sitemapIndexUrlForSiteId($site->id) . PHP_EOL; |
|
487 | + $result .= 'sitemap: '.$this->sitemapIndexUrlForSiteId($site->id).PHP_EOL; |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | return rtrim($result, PHP_EOL); |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | // Since we want a stale-while-revalidate pattern, only invalidate the cache if we're asked to |
517 | 517 | if ($invalidateCache) { |
518 | 518 | $cache = Craft::$app->getCache(); |
519 | - TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
519 | + TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
520 | 520 | Craft::info( |
521 | - 'Sitemap cache cleared: ' . $handle, |
|
521 | + 'Sitemap cache cleared: '.$handle, |
|
522 | 522 | __METHOD__ |
523 | 523 | ); |
524 | 524 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | Event::on( |
105 | 105 | ProductTypes::class, |
106 | 106 | ProductTypes::EVENT_AFTER_SAVE_PRODUCTTYPE, |
107 | - function (ProductTypeEvent $event) { |
|
107 | + function(ProductTypeEvent $event) { |
|
108 | 108 | Craft::debug( |
109 | 109 | 'ProductTypes::EVENT_AFTER_SAVE_PRODUCTTYPE', |
110 | 110 | __METHOD__ |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | Event::on( |
120 | 120 | ProductTypes::class, |
121 | 121 | ProductTypes::EVENT_AFTER_SAVE_PRODUCTTYPE, |
122 | - static function (ProductTypeEvent $event) { |
|
122 | + static function(ProductTypeEvent $event) { |
|
123 | 123 | Craft::debug( |
124 | 124 | 'ProductTypes::EVENT_AFTER_SAVE_PRODUCTTYPE', |
125 | 125 | __METHOD__ |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | // Commerce Product Types sidebar |
176 | 176 | $commerce = CommercePlugin::getInstance(); |
177 | 177 | if ($commerce !== null) { |
178 | - Seomatic::$view->hook('cp.commerce.product.edit.details', static function (&$context) { |
|
178 | + Seomatic::$view->hook('cp.commerce.product.edit.details', static function(&$context) { |
|
179 | 179 | $html = ''; |
180 | 180 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
181 | 181 | /** @var $product Product */ |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
383 | 383 | [ |
384 | 384 | 'sourceId' => $sourceModel->id, |
385 | - 'sourceName' => (string)$sourceModel->name, |
|
385 | + 'sourceName' => (string) $sourceModel->name, |
|
386 | 386 | 'sourceHandle' => $sourceModel->handle, |
387 | 387 | ] |
388 | 388 | ); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function actionGenerate() |
76 | 76 | { |
77 | - echo 'Generating sitemap' . PHP_EOL; |
|
77 | + echo 'Generating sitemap'.PHP_EOL; |
|
78 | 78 | if ($this->siteId !== null) { |
79 | 79 | $siteIds[] = $this->siteId; |
80 | 80 | } else { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ]); |
117 | 117 | } |
118 | 118 | |
119 | - echo '---' . PHP_EOL; |
|
119 | + echo '---'.PHP_EOL; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | self::$cacheDuration = self::$devMode |
270 | 270 | ? self::DEVMODE_CACHE_DURATION |
271 | 271 | : self::$settings->metaCacheDuration ?? null; |
272 | - self::$cacheDuration = self::$cacheDuration === null ? null : (int)self::$cacheDuration; |
|
272 | + self::$cacheDuration = self::$cacheDuration === null ? null : (int) self::$cacheDuration; |
|
273 | 273 | self::$environment = EnvironmentHelper::determineEnvironment(); |
274 | 274 | MetaValueHelper::cache(); |
275 | 275 | // Version helpers |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | Event::on( |
345 | 345 | Plugins::class, |
346 | 346 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
347 | - function (PluginEvent $event) { |
|
347 | + function(PluginEvent $event) { |
|
348 | 348 | if ($event->plugin === $this) { |
349 | 349 | // Invalidate our caches after we've been installed |
350 | 350 | $this->clearAllCaches(); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | Event::on( |
366 | 366 | ClearCaches::class, |
367 | 367 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, |
368 | - function (RegisterCacheOptionsEvent $event) { |
|
368 | + function(RegisterCacheOptionsEvent $event) { |
|
369 | 369 | Craft::debug( |
370 | 370 | 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', |
371 | 371 | __METHOD__ |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | Event::on( |
382 | 382 | Plugins::class, |
383 | 383 | Plugins::EVENT_BEFORE_SAVE_PLUGIN_SETTINGS, |
384 | - function (PluginEvent $event) { |
|
384 | + function(PluginEvent $event) { |
|
385 | 385 | if ($event->plugin === $this && !Craft::$app->getDb()->getSupportsMb4()) { |
386 | 386 | // For all the emojis |
387 | 387 | $settingsModel = $this->getSettings(); |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | Event::on( |
435 | 435 | Plugins::class, |
436 | 436 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
437 | - function () { |
|
437 | + function() { |
|
438 | 438 | // Delay registering SEO Elements to give other plugins a chance to load first |
439 | 439 | $this->seoElements->getAllSeoElementTypes(false); |
440 | 440 | // Delay installing GQL handlers to give other plugins a chance to register their own first |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | Event::on( |
456 | 456 | Fields::class, |
457 | 457 | Fields::EVENT_REGISTER_FIELD_TYPES, |
458 | - function (RegisterComponentTypesEvent $event) { |
|
458 | + function(RegisterComponentTypesEvent $event) { |
|
459 | 459 | $event->types[] = SeoSettingsField::class; |
460 | 460 | $event->types[] = Seomatic_MetaField::class; |
461 | 461 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | Event::on( |
465 | 465 | Elements::class, |
466 | 466 | Elements::EVENT_AFTER_SAVE_ELEMENT, |
467 | - function (ElementEvent $event) { |
|
467 | + function(ElementEvent $event) { |
|
468 | 468 | Craft::debug( |
469 | 469 | 'Elements::EVENT_AFTER_SAVE_ELEMENT', |
470 | 470 | __METHOD__ |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | Event::on( |
485 | 485 | Elements::class, |
486 | 486 | Elements::EVENT_AFTER_DELETE_ELEMENT, |
487 | - function (ElementEvent $event) { |
|
487 | + function(ElementEvent $event) { |
|
488 | 488 | Craft::debug( |
489 | 489 | 'Elements::EVENT_AFTER_DELETE_ELEMENT', |
490 | 490 | __METHOD__ |
@@ -503,19 +503,19 @@ discard block |
||
503 | 503 | Event::on( |
504 | 504 | Entry::class, |
505 | 505 | Entry::EVENT_REGISTER_PREVIEW_TARGETS, |
506 | - function (RegisterPreviewTargetsEvent $e) { |
|
506 | + function(RegisterPreviewTargetsEvent $e) { |
|
507 | 507 | /** @var Element $element */ |
508 | 508 | $element = $e->sender; |
509 | 509 | if ($element->uri !== null) { |
510 | 510 | $e->previewTargets[] = [ |
511 | - 'label' => ' |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | $cache = Craft::$app->getCache(); |
151 | - $uniqueKey = $groupId . $type . $handle . $siteId; |
|
152 | - $cacheKey = self::CACHE_KEY . $uniqueKey; |
|
153 | - $queueJobCacheKey = self::QUEUE_JOB_CACHE_KEY . $uniqueKey; |
|
151 | + $uniqueKey = $groupId.$type.$handle.$siteId; |
|
152 | + $cacheKey = self::CACHE_KEY.$uniqueKey; |
|
153 | + $queueJobCacheKey = self::QUEUE_JOB_CACHE_KEY.$uniqueKey; |
|
154 | 154 | $result = $cache->get($cacheKey); |
155 | 155 | // If the sitemap isn't cached, start a job to create it |
156 | 156 | // Even if it is cached, if $throwException === false we should regenerate it, as it is part of |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $dependency = new TagDependency([ |
190 | 190 | 'tags' => [ |
191 | 191 | self::GLOBAL_SITEMAP_CACHE_TAG, |
192 | - self::CACHE_KEY . $uniqueKey, |
|
192 | + self::CACHE_KEY.$uniqueKey, |
|
193 | 193 | ], |
194 | 194 | ]); |
195 | 195 | $cache->set($queueJobCacheKey, $jobId, $cacheDuration, $dependency); |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | // Return an empty XML document |
222 | 222 | $lines[] = '<?xml version="1.0" encoding="UTF-8"?>'; |
223 | 223 | $lines[] = '<?xml-stylesheet type="text/xsl" href="sitemap-empty.xsl"?>'; |
224 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'This sitemap has not been generated yet.') . ' -->'; |
|
225 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'If you are seeing this in local dev or an') . ' -->'; |
|
226 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'environment with `devMode` on, caches only') . ' -->'; |
|
227 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'last for 30 seconds in local dev, so it is') . ' -->'; |
|
228 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'normal for the sitemap to not be cached.') . ' -->'; |
|
224 | + $lines[] = '<!-- '.Craft::t('seomatic', 'This sitemap has not been generated yet.').' -->'; |
|
225 | + $lines[] = '<!-- '.Craft::t('seomatic', 'If you are seeing this in local dev or an').' -->'; |
|
226 | + $lines[] = '<!-- '.Craft::t('seomatic', 'environment with `devMode` on, caches only').' -->'; |
|
227 | + $lines[] = '<!-- '.Craft::t('seomatic', 'last for 30 seconds in local dev, so it is').' -->'; |
|
228 | + $lines[] = '<!-- '.Craft::t('seomatic', 'normal for the sitemap to not be cached.').' -->'; |
|
229 | 229 | $lines[] = '<urlset>'; |
230 | 230 | $lines[] = '</urlset>'; |
231 | 231 | } |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | public function invalidateCache(string $handle, int $siteId) |
247 | 247 | { |
248 | 248 | $cache = Craft::$app->getCache(); |
249 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
249 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
250 | 250 | Craft::info( |
251 | - 'Sitemap cache cleared: ' . $handle, |
|
251 | + 'Sitemap cache cleared: '.$handle, |
|
252 | 252 | __METHOD__ |
253 | 253 | ); |
254 | 254 | } |
@@ -100,7 +100,7 @@ |
||
100 | 100 | // Craft adds the `tokenParam` URL param back in via UrlHelper, strip it again |
101 | 101 | if (Seomatic::$plugin->metaContainers->paginationPage === '1') { |
102 | 102 | $token = Craft::$app->getConfig()->getGeneral()->tokenParam; |
103 | - $url = preg_replace('~([?&])' . $token . '=[^&]*~', '$1', $url); |
|
103 | + $url = preg_replace('~([?&])'.$token.'=[^&]*~', '$1', $url); |
|
104 | 104 | $url = rtrim($url, '?&'); |
105 | 105 | $url = str_replace(['&&', '?&'], ['&', '?'], $url); |
106 | 106 | $data['href'] = $url; |
@@ -265,7 +265,7 @@ |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | if (empty($html) && !empty($this->templatePath)) { |
268 | - $html = '/* ' . $this->name . Craft::t('seomatic', ' script did not render') . ' */' . PHP_EOL; |
|
268 | + $html = '/* '.$this->name.Craft::t('seomatic', ' script did not render').' */'.PHP_EOL; |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | return $html; |