@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | self::$cacheDuration = self::$devMode |
277 | 277 | ? self::DEVMODE_CACHE_DURATION |
278 | 278 | : self::$settings->metaCacheDuration ?? null; |
279 | - self::$cacheDuration = self::$cacheDuration === null ? null : (int)self::$cacheDuration; |
|
279 | + self::$cacheDuration = self::$cacheDuration === null ? null : (int) self::$cacheDuration; |
|
280 | 280 | self::$environment = EnvironmentHelper::determineEnvironment(); |
281 | 281 | MetaValueHelper::cache(); |
282 | 282 | // Version helpers |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | $lastSegment = end($segments); |
401 | 401 | $site = Craft::$app->getSites()->getSiteByHandle($lastSegment); |
402 | 402 | if ($site !== null) { |
403 | - $siteSuffix = '/' . $lastSegment; |
|
403 | + $siteSuffix = '/'.$lastSegment; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | /** @var User $currentUser */ |
@@ -409,31 +409,31 @@ discard block |
||
409 | 409 | if ($currentUser->can('seomatic:dashboard')) { |
410 | 410 | $subNavs['dashboard'] = [ |
411 | 411 | 'label' => Craft::t('seomatic', 'Dashboard'), |
412 | - 'url' => 'seomatic/dashboard' . $siteSuffix, |
|
412 | + 'url' => 'seomatic/dashboard'.$siteSuffix, |
|
413 | 413 | ]; |
414 | 414 | } |
415 | 415 | if ($currentUser->can('seomatic:global-meta')) { |
416 | 416 | $subNavs['global'] = [ |
417 | 417 | 'label' => Craft::t('seomatic', 'Global SEO'), |
418 | - 'url' => 'seomatic/global/general' . $siteSuffix, |
|
418 | + 'url' => 'seomatic/global/general'.$siteSuffix, |
|
419 | 419 | ]; |
420 | 420 | } |
421 | 421 | if ($currentUser->can('seomatic:content-meta')) { |
422 | 422 | $subNavs['content'] = [ |
423 | 423 | 'label' => Craft::t('seomatic', 'Content SEO'), |
424 | - 'url' => 'seomatic/content' . $siteSuffix, |
|
424 | + 'url' => 'seomatic/content'.$siteSuffix, |
|
425 | 425 | ]; |
426 | 426 | } |
427 | 427 | if ($currentUser->can('seomatic:site-settings')) { |
428 | 428 | $subNavs['site'] = [ |
429 | 429 | 'label' => Craft::t('seomatic', 'Site Settings'), |
430 | - 'url' => 'seomatic/site/identity' . $siteSuffix, |
|
430 | + 'url' => 'seomatic/site/identity'.$siteSuffix, |
|
431 | 431 | ]; |
432 | 432 | } |
433 | 433 | if ($currentUser->can('seomatic:tracking-scripts')) { |
434 | 434 | $subNavs['tracking'] = [ |
435 | 435 | 'label' => Craft::t('seomatic', 'Tracking Scripts'), |
436 | - 'url' => 'seomatic/tracking/gtag' . $siteSuffix, |
|
436 | + 'url' => 'seomatic/tracking/gtag'.$siteSuffix, |
|
437 | 437 | ]; |
438 | 438 | } |
439 | 439 | $editableSettings = true; |
@@ -628,14 +628,14 @@ discard block |
||
628 | 628 | $element = $e->sender; |
629 | 629 | if ($element->uri !== null) { |
630 | 630 | $e->previewTargets[] = [ |
631 | - 'label' => ' |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | // Output some info if this is a console app |
112 | 112 | if ($job && Craft::$app instanceof ConsoleApplication) { |
113 | - echo $job->description . PHP_EOL; |
|
113 | + echo $job->description.PHP_EOL; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | $lines = []; |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if ($multiSite) { |
138 | 138 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
139 | 139 | } |
140 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
140 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
141 | 141 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
142 | 142 | } |
143 | 143 | $urlsetLine .= '>'; |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | while ($currentElement < $totalElements) { |
173 | 173 | $elements = $paginator->getPageResults(); |
174 | 174 | if (Craft::$app instanceof ConsoleApplication) { |
175 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
176 | - . ' - elements: ' . $paginator->getTotalResults() |
|
175 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
176 | + . ' - elements: '.$paginator->getTotalResults() |
|
177 | 177 | . PHP_EOL; |
178 | 178 | } |
179 | 179 | /** @var Element $element */ |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | // Output some info if this is a console app |
187 | 187 | if (Craft::$app instanceof ConsoleApplication) { |
188 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
188 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | } |
234 | 234 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
235 | 235 | if ($url !== $canonicalUrl) { |
236 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
236 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
237 | 237 | continue; |
238 | 238 | } |
239 | 239 | } |
@@ -294,12 +294,12 @@ discard block |
||
294 | 294 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
295 | 295 | $lines[] = '<xhtml:link rel="alternate"' |
296 | 296 | . ' hreflang="x-default"' |
297 | - . ' href="' . Html::encode($altUrl) . '"' |
|
297 | + . ' href="'.Html::encode($altUrl).'"' |
|
298 | 298 | . ' />'; |
299 | 299 | } |
300 | 300 | $lines[] = '<xhtml:link rel="alternate"' |
301 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
302 | - . ' href="' . Html::encode($altUrl) . '"' |
|
301 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
302 | + . ' href="'.Html::encode($altUrl).'"' |
|
303 | 303 | . ' />'; |
304 | 304 | } |
305 | 305 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | } |
309 | 309 | } |
310 | 310 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
311 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
311 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
312 | 312 | $now = new DateTime(); |
313 | 313 | $interval = $now->diff($dateUpdated); |
314 | 314 | if ($interval->days <= 2) { |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | } |
319 | 319 | $lines[] = '<news:news>'; |
320 | 320 | $lines[] = '<news:publication>'; |
321 | - $lines[] = '<news:name>' . $metaBundle->metaSitemapVars->newsPublicationName . '</news:name>'; |
|
322 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
321 | + $lines[] = '<news:name>'.$metaBundle->metaSitemapVars->newsPublicationName.'</news:name>'; |
|
322 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
323 | 323 | $lines[] = '</news:publication>'; |
324 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
325 | - $lines[] = '<news:title>' . $element->title . '</news:title>'; |
|
324 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
325 | + $lines[] = '<news:title>'.$element->title.'</news:title>'; |
|
326 | 326 | $lines[] = '</news:news>'; |
327 | 327 | } |
328 | 328 | } |
@@ -420,11 +420,11 @@ discard block |
||
420 | 420 | $lines[] = '</urlset>'; |
421 | 421 | |
422 | 422 | $cache = Craft::$app->getCache(); |
423 | - $cacheKey = SitemapTemplate::CACHE_KEY . $groupId . $type . $handle . $siteId; |
|
423 | + $cacheKey = SitemapTemplate::CACHE_KEY.$groupId.$type.$handle.$siteId; |
|
424 | 424 | $dependency = new TagDependency([ |
425 | 425 | 'tags' => [ |
426 | 426 | SitemapTemplate::GLOBAL_SITEMAP_CACHE_TAG, |
427 | - SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
427 | + SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
428 | 428 | ], |
429 | 429 | ]); |
430 | 430 | $lines = implode('', $lines); |
@@ -437,10 +437,10 @@ discard block |
||
437 | 437 | $result = $cache->set($cacheKey, $lines, $cacheDuration, $dependency); |
438 | 438 | // Remove the queue job id from the cache too |
439 | 439 | $cache->delete($queueJobCacheKey); |
440 | - Craft::debug('Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey, __METHOD__); |
|
440 | + Craft::debug('Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey, __METHOD__); |
|
441 | 441 | // Output some info if this is a console app |
442 | 442 | if (Craft::$app instanceof ConsoleApplication) { |
443 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
443 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
444 | 444 | } |
445 | 445 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
446 | 446 | /** @var FastcgiCacheBust $plugin */ |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | */ |
557 | 557 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
558 | 558 | { |
559 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
559 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
560 | 560 | switch ($asset->kind) { |
561 | 561 | case 'image': |
562 | 562 | $lines[] = '<image:image>'; |
@@ -568,9 +568,9 @@ discard block |
||
568 | 568 | $fieldName = $row['field'] ?? ''; |
569 | 569 | $propName = $row['property'] ?? ''; |
570 | 570 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
571 | - $lines[] = '<image:' . $propName . '>'; |
|
571 | + $lines[] = '<image:'.$propName.'>'; |
|
572 | 572 | $lines[] = Html::encode($asset[$fieldName]); |
573 | - $lines[] = '</image:' . $propName . '>'; |
|
573 | + $lines[] = '</image:'.$propName.'>'; |
|
574 | 574 | } |
575 | 575 | } |
576 | 576 | $lines[] = '</image:image>'; |
@@ -586,9 +586,9 @@ discard block |
||
586 | 586 | $fieldName = $row['field'] ?? ''; |
587 | 587 | $propName = $row['property'] ?? ''; |
588 | 588 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
589 | - $lines[] = '<video:' . $propName . '>'; |
|
589 | + $lines[] = '<video:'.$propName.'>'; |
|
590 | 590 | $lines[] = Html::encode($asset[$fieldName]); |
591 | - $lines[] = '</video:' . $propName . '>'; |
|
591 | + $lines[] = '</video:'.$propName.'>'; |
|
592 | 592 | } |
593 | 593 | } |
594 | 594 | $lines[] = '</video:video>'; |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | */ |
605 | 605 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
606 | 606 | { |
607 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
607 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
608 | 608 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
609 | 609 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
610 | 610 | $lines[] = '<url>'; |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $siteUrl = MetaValue::parseString($siteUrl); |
47 | 47 | // Extract out just the path part |
48 | 48 | $parts = self::decomposeUrl($path); |
49 | - $path = $parts['path'] . $parts['suffix']; |
|
49 | + $path = $parts['path'].$parts['suffix']; |
|
50 | 50 | $url = self::mergeUrlWithPath($siteUrl, $path); |
51 | 51 | // Handle trailing slashes properly for generated URLs |
52 | 52 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
53 | 53 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
54 | - $url = rtrim($url, '/') . '/'; |
|
54 | + $url = rtrim($url, '/').'/'; |
|
55 | 55 | } |
56 | 56 | if (!$generalConfig->addTrailingSlashesToUrls) { |
57 | 57 | $url = rtrim($url, '/'); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); |
|
87 | + return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // Handle trailing slashes properly for generated URLs |
153 | 153 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
154 | 154 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
155 | - $url = rtrim($url, '/') . '/'; |
|
155 | + $url = rtrim($url, '/').'/'; |
|
156 | 156 | } |
157 | 157 | if (!$generalConfig->addTrailingSlashesToUrls) { |
158 | 158 | $url = rtrim($url, '/'); |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | $urlParts = parse_url($url); |
173 | 173 | $encodedUrl = ""; |
174 | 174 | if (isset($urlParts['scheme'])) { |
175 | - $encodedUrl .= $urlParts['scheme'] . '://'; |
|
175 | + $encodedUrl .= $urlParts['scheme'].'://'; |
|
176 | 176 | } |
177 | 177 | if (isset($urlParts['host'])) { |
178 | 178 | $encodedUrl .= $urlParts['host']; |
179 | 179 | } |
180 | 180 | if (isset($urlParts['port'])) { |
181 | - $encodedUrl .= ':' . $urlParts['port']; |
|
181 | + $encodedUrl .= ':'.$urlParts['port']; |
|
182 | 182 | } |
183 | 183 | if (isset($urlParts['path'])) { |
184 | 184 | $encodedUrl .= $urlParts['path']; |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | foreach ($query as $j => $value) { |
189 | 189 | $value = explode('=', $value, 2); |
190 | 190 | if (count($value) === 2) { |
191 | - $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]); |
|
191 | + $query[$j] = urlencode($value[0]).'='.urlencode($value[1]); |
|
192 | 192 | } else { |
193 | 193 | $query[$j] = urlencode($value[0]); |
194 | 194 | } |
195 | 195 | } |
196 | - $encodedUrl .= '?' . implode('&', $query); |
|
196 | + $encodedUrl .= '?'.implode('&', $query); |
|
197 | 197 | } |
198 | 198 | if (isset($urlParts['fragment'])) { |
199 | - $encodedUrl .= '#' . $urlParts['fragment']; |
|
199 | + $encodedUrl .= '#'.$urlParts['fragment']; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $encodedUrl; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | if ($siteId !== null) { |
237 | 237 | $site = $sites->getSiteById($siteId, true); |
238 | 238 | if (!$site) { |
239 | - throw new Exception('Invalid site ID: ' . $siteId); |
|
239 | + throw new Exception('Invalid site ID: '.$siteId); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | |
261 | 261 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
262 | 262 | $url_parts = parse_url($pathOrUrl); |
263 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
263 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
264 | 264 | $result['path'] = $url_parts['path'] ?? ''; |
265 | 265 | $result['suffix'] = ''; |
266 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
267 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
266 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
267 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
268 | 268 | } else { |
269 | 269 | $result['prefix'] = ''; |
270 | 270 | $result['path'] = $pathOrUrl; |