@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | /** |
| 112 | 112 | * @inheritdoc |
| 113 | 113 | */ |
| 114 | - public static function dbType(): array|string|null |
|
| 114 | + public static function dbType(): array | string | null |
|
| 115 | 115 | { |
| 116 | 116 | return Schema::TYPE_TEXT; |
| 117 | 117 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | } |
| 240 | 240 | // Handle the mainEntityOfPage |
| 241 | 241 | $mainEntity = ''; |
| 242 | - if (in_array('mainEntityOfPage', (array)$this->generalEnabledFields, false) && |
|
| 242 | + if (in_array('mainEntityOfPage', (array) $this->generalEnabledFields, false) && |
|
| 243 | 243 | !empty($config['metaBundleSettings'])) { |
| 244 | 244 | $mainEntity = SchemaHelper::getSpecificEntityType($config['metaBundleSettings'], true); |
| 245 | 245 | } |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | if ($element !== null && $element->uri !== null) { |
| 394 | 394 | $siteId = $element->siteId; |
| 395 | 395 | $uri = $element->uri; |
| 396 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
| 396 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
| 397 | 397 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
| 398 | 398 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
| 399 | 399 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -404,14 +404,14 @@ discard block |
||
| 404 | 404 | $dependency = new TagDependency([ |
| 405 | 405 | 'tags' => [ |
| 406 | 406 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
| 407 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
| 408 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
| 407 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
| 408 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 409 | 409 | ], |
| 410 | 410 | ]); |
| 411 | 411 | $cache = Craft::$app->getCache(); |
| 412 | 412 | $cacheDuration = null; |
| 413 | 413 | $html = $cache->getOrSet( |
| 414 | - self::CACHE_KEY . $cacheKey, |
|
| 414 | + self::CACHE_KEY.$cacheKey, |
|
| 415 | 415 | function() use ($uri, $siteId, $element) { |
| 416 | 416 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true); |
| 417 | 417 | $variables = [ |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | array &$variables, |
| 454 | 454 | ) { |
| 455 | 455 | $variables['textFieldSources'] = array_merge( |
| 456 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
| 456 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 457 | 457 | FieldHelper::fieldsOfTypeFromElement( |
| 458 | 458 | $element, |
| 459 | 459 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | ) |
| 462 | 462 | ); |
| 463 | 463 | $variables['assetFieldSources'] = array_merge( |
| 464 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
| 464 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 465 | 465 | FieldHelper::fieldsOfTypeFromElement( |
| 466 | 466 | $element, |
| 467 | 467 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | /** |
| 67 | 67 | * @inheritdoc |
| 68 | 68 | */ |
| 69 | - public static function dbType(): array|string|null |
|
| 69 | + public static function dbType(): array | string | null |
|
| 70 | 70 | { |
| 71 | 71 | return Schema::TYPE_TEXT; |
| 72 | 72 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $foundFields = []; |
| 117 | 117 | if (!empty(self::FIELD_CLASSES[$fieldClassKey])) { |
| 118 | 118 | // Cache me if you can |
| 119 | - $memoKey = $fieldClassKey . $layout->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 119 | + $memoKey = $fieldClassKey.$layout->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 120 | 120 | if (!empty(self::$fieldsOfTypeFromLayoutCache[$memoKey])) { |
| 121 | 121 | return self::$fieldsOfTypeFromLayoutCache[$memoKey]; |
| 122 | 122 | } |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | $prefix = $global->handle; |
| 236 | 236 | $fields = array_combine( |
| 237 | 237 | array_map(function($key) use ($prefix) { |
| 238 | - return $prefix . '.' . $key; |
|
| 238 | + return $prefix.'.'.$key; |
|
| 239 | 239 | }, array_keys($fields)), |
| 240 | 240 | $fields |
| 241 | 241 | ); |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | if ($matrixEntryTypeModel) { |
| 312 | 312 | // Cache me if you can |
| 313 | - $memoKey = $fieldType . $matrixEntry->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 313 | + $memoKey = $fieldType.$matrixEntry->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 314 | 314 | if (!empty(self::$matrixFieldsOfTypeCache[$memoKey])) { |
| 315 | 315 | return self::$matrixFieldsOfTypeCache[$memoKey]; |
| 316 | 316 | } |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | $layout = $neoBlock->getFieldLayout(); |
| 350 | 350 | if ($layout) { |
| 351 | 351 | // Cache me if you can |
| 352 | - $memoKey = $fieldType . $neoBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 352 | + $memoKey = $fieldType.$neoBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 353 | 353 | if (!empty(self::$neoFieldsOfTypeCache[$memoKey])) { |
| 354 | 354 | return self::$neoFieldsOfTypeCache[$memoKey]; |
| 355 | 355 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | |
| 110 | 110 | // Output some info if this is a console app |
| 111 | 111 | if ($job && Craft::$app instanceof ConsoleApplication) { |
| 112 | - echo $job->description . PHP_EOL; |
|
| 112 | + echo $job->description.PHP_EOL; |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $lines = []; |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ($multiSite) { |
| 137 | 137 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
| 138 | 138 | } |
| 139 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 139 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 140 | 140 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
| 141 | 141 | } |
| 142 | 142 | $urlsetLine .= '>'; |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | while ($currentElement < $totalElements) { |
| 172 | 172 | $elements = $paginator->getPageResults(); |
| 173 | 173 | if (Craft::$app instanceof ConsoleApplication) { |
| 174 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
| 175 | - . ' - elements: ' . $paginator->getTotalResults() |
|
| 174 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
| 175 | + . ' - elements: '.$paginator->getTotalResults() |
|
| 176 | 176 | . PHP_EOL; |
| 177 | 177 | } |
| 178 | 178 | /** @var Element $element */ |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | // Output some info if this is a console app |
| 186 | 186 | if (Craft::$app instanceof ConsoleApplication) { |
| 187 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
| 187 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 231 | 231 | if ($url !== $canonicalUrl) { |
| 232 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 232 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 233 | 233 | continue; |
| 234 | 234 | } |
| 235 | 235 | } |
@@ -287,12 +287,12 @@ discard block |
||
| 287 | 287 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
| 288 | 288 | $lines[] = '<xhtml:link rel="alternate"' |
| 289 | 289 | . ' hreflang="x-default"' |
| 290 | - . ' href="' . Html::encode($altUrl) . '"' |
|
| 290 | + . ' href="'.Html::encode($altUrl).'"' |
|
| 291 | 291 | . ' />'; |
| 292 | 292 | } |
| 293 | 293 | $lines[] = '<xhtml:link rel="alternate"' |
| 294 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
| 295 | - . ' href="' . Html::encode($altUrl) . '"' |
|
| 294 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
| 295 | + . ' href="'.Html::encode($altUrl).'"' |
|
| 296 | 296 | . ' />'; |
| 297 | 297 | } |
| 298 | 298 | } |
@@ -388,11 +388,11 @@ discard block |
||
| 388 | 388 | $lines[] = '</urlset>'; |
| 389 | 389 | |
| 390 | 390 | $cache = Craft::$app->getCache(); |
| 391 | - $cacheKey = SitemapTemplate::CACHE_KEY . $groupId . $type . $handle . $siteId; |
|
| 391 | + $cacheKey = SitemapTemplate::CACHE_KEY.$groupId.$type.$handle.$siteId; |
|
| 392 | 392 | $dependency = new TagDependency([ |
| 393 | 393 | 'tags' => [ |
| 394 | 394 | SitemapTemplate::GLOBAL_SITEMAP_CACHE_TAG, |
| 395 | - SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
| 395 | + SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
| 396 | 396 | ], |
| 397 | 397 | ]); |
| 398 | 398 | $lines = implode('', $lines); |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | $result = $cache->set($cacheKey, $lines, $cacheDuration, $dependency); |
| 406 | 406 | // Remove the queue job id from the cache too |
| 407 | 407 | $cache->delete($queueJobCacheKey); |
| 408 | - Craft::debug('Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey, __METHOD__); |
|
| 408 | + Craft::debug('Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey, __METHOD__); |
|
| 409 | 409 | // Output some info if this is a console app |
| 410 | 410 | if (Craft::$app instanceof ConsoleApplication) { |
| 411 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
| 411 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
| 412 | 412 | } |
| 413 | 413 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
| 414 | 414 | /** @var ?FastcgiCacheBust $plugin */ |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | |
| 493 | 493 | $attributes = array_intersect_key( |
| 494 | 494 | $attributes, |
| 495 | - array_flip((array)$seoSettingsField->sitemapEnabledFields) |
|
| 495 | + array_flip((array) $seoSettingsField->sitemapEnabledFields) |
|
| 496 | 496 | ); |
| 497 | 497 | $attributes = array_filter( |
| 498 | 498 | $attributes, |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | */ |
| 525 | 525 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 526 | 526 | { |
| 527 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 527 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 528 | 528 | switch ($asset->kind) { |
| 529 | 529 | case 'image': |
| 530 | 530 | $transform = Craft::$app->getImageTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -537,9 +537,9 @@ discard block |
||
| 537 | 537 | $fieldName = $row['field'] ?? ''; |
| 538 | 538 | $propName = $row['property'] ?? ''; |
| 539 | 539 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 540 | - $lines[] = '<image:' . $propName . '>'; |
|
| 540 | + $lines[] = '<image:'.$propName.'>'; |
|
| 541 | 541 | $lines[] = Html::encode($asset[$fieldName]); |
| 542 | - $lines[] = '</image:' . $propName . '>'; |
|
| 542 | + $lines[] = '</image:'.$propName.'>'; |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | 545 | $lines[] = '</image:image>'; |
@@ -555,9 +555,9 @@ discard block |
||
| 555 | 555 | $fieldName = $row['field'] ?? ''; |
| 556 | 556 | $propName = $row['property'] ?? ''; |
| 557 | 557 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 558 | - $lines[] = '<video:' . $propName . '>'; |
|
| 558 | + $lines[] = '<video:'.$propName.'>'; |
|
| 559 | 559 | $lines[] = Html::encode($asset[$fieldName]); |
| 560 | - $lines[] = '</video:' . $propName . '>'; |
|
| 560 | + $lines[] = '</video:'.$propName.'>'; |
|
| 561 | 561 | } |
| 562 | 562 | } |
| 563 | 563 | $lines[] = '</video:video>'; |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | */ |
| 574 | 574 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 575 | 575 | { |
| 576 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 576 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 577 | 577 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 578 | 578 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
| 579 | 579 | $lines[] = '<url>'; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if (!empty($string)) { |
| 72 | 72 | $string = HtmlPurifier::process($string, ['HTML.Allowed' => '']); |
| 73 | 73 | $string = html_entity_decode($string, ENT_NOQUOTES, 'UTF-8'); |
| 74 | - $result = (string)Stringy::create($string)->truncate($length, $substring); |
|
| 74 | + $result = (string) Stringy::create($string)->truncate($length, $substring); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | return $result; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if (!empty($string)) { |
| 97 | 97 | $string = HtmlPurifier::process($string, ['HTML.Allowed' => '']); |
| 98 | 98 | $string = html_entity_decode($string, ENT_NOQUOTES, 'UTF-8'); |
| 99 | - $result = (string)Stringy::create($string)->safeTruncate($length, $substring); |
|
| 99 | + $result = (string) Stringy::create($string)->safeTruncate($length, $substring); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | return $result; |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | $result = self::smartStripTags(Doxter::$plugin->getService()->parseMarkdown($field->getRaw())); |
| 128 | 128 | } else { |
| 129 | 129 | if (self::isArrayLike($field)) { |
| 130 | - $result = self::smartStripTags((string)$field[0]); |
|
| 130 | + $result = self::smartStripTags((string) $field[0]); |
|
| 131 | 131 | } else { |
| 132 | - $result = self::smartStripTags((string)$field); |
|
| 132 | + $result = self::smartStripTags((string) $field); |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $tags = $tags->all(); |
| 157 | 157 | } |
| 158 | 158 | foreach ($tags as $tag) { |
| 159 | - $result .= $tag->title . ', '; |
|
| 159 | + $result .= $tag->title.', '; |
|
| 160 | 160 | } |
| 161 | 161 | $result = rtrim($result, ', '); |
| 162 | 162 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | foreach ($fieldClasses as $fieldClassKey) { |
| 199 | 199 | if ($field instanceof $fieldClassKey) { |
| 200 | 200 | if ($field->handle === $fieldHandle || empty($fieldHandle)) { |
| 201 | - $result .= self::extractTextFromField($block[$field->handle]) . ' '; |
|
| 201 | + $result .= self::extractTextFromField($block[$field->handle]).' '; |
|
| 202 | 202 | } |
| 203 | 203 | } |
| 204 | 204 | } |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | foreach ($fieldClasses as $fieldClassKey) { |
| 241 | 241 | if ($field instanceof $fieldClassKey) { |
| 242 | 242 | if ($field->handle === $fieldHandle || empty($fieldHandle)) { |
| 243 | - $result .= self::extractTextFromField($block[$field->handle]) . ' '; |
|
| 243 | + $result .= self::extractTextFromField($block[$field->handle]).' '; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | } |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $str = html_entity_decode($str, ENT_NOQUOTES, 'UTF-8'); |
| 340 | 340 | $str = rawurldecode($str); |
| 341 | 341 | // Remove any linebreaks |
| 342 | - $str = (string)preg_replace("/\r|\n/", "", $str); |
|
| 342 | + $str = (string) preg_replace("/\r|\n/", "", $str); |
|
| 343 | 343 | $str = HtmlPurifier::process($str, ['HTML.Allowed' => '']); |
| 344 | 344 | $str = html_entity_decode($str, ENT_NOQUOTES, 'UTF-8'); |
| 345 | 345 | // Remove any embedded Twig code |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $language = 'English'; |
| 431 | 431 | } |
| 432 | 432 | |
| 433 | - $className = 'PhpScience\\TextRank\\Tool\\StopWords\\' . ucfirst($language); |
|
| 433 | + $className = 'PhpScience\\TextRank\\Tool\\StopWords\\'.ucfirst($language); |
|
| 434 | 434 | if (class_exists($className)) { |
| 435 | 435 | $stopWords = new $className(); |
| 436 | 436 | } |