@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function getFilename(int $groupId): string |
| 119 | 119 | { |
| 120 | - return 'sitemaps-' . $groupId . '-sitemap.xml'; |
|
| 120 | + return 'sitemaps-'.$groupId.'-sitemap.xml'; |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | /** |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | ], |
| 151 | 151 | ]); |
| 152 | 152 | |
| 153 | - return $cache->getOrSet(self::CACHE_KEY . $groupId . '.' . $siteId, function () use ($groupSiteIds, $siteId) { |
|
| 153 | + return $cache->getOrSet(self::CACHE_KEY.$groupId.'.'.$siteId, function() use ($groupSiteIds, $siteId) { |
|
| 154 | 154 | Craft::info( |
| 155 | 155 | 'Sitemap index cache miss', |
| 156 | 156 | __METHOD__ |
@@ -225,10 +225,10 @@ |
||
| 225 | 225 | } |
| 226 | 226 | // Make sure these are strings |
| 227 | 227 | if (!empty($this->facebookProfileId)) { |
| 228 | - $this->facebookProfileId = (string)$this->facebookProfileId; |
|
| 228 | + $this->facebookProfileId = (string) $this->facebookProfileId; |
|
| 229 | 229 | } |
| 230 | 230 | if (!empty($this->facebookAppId)) { |
| 231 | - $this->facebookAppId = (string)$this->facebookAppId; |
|
| 231 | + $this->facebookAppId = (string) $this->facebookAppId; |
|
| 232 | 232 | } |
| 233 | 233 | // Identity |
| 234 | 234 | if ($this->identity !== null && is_array($this->identity)) { |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $suffix = ''; |
| 126 | 126 | break; |
| 127 | 127 | } |
| 128 | - $lengthAdjust = mb_strlen($prefix . $suffix); |
|
| 128 | + $lengthAdjust = mb_strlen($prefix.$suffix); |
|
| 129 | 129 | // Truncate the twitter:title tag content |
| 130 | 130 | $truncLen = Seomatic::$settings->maxTitleLength - $lengthAdjust; |
| 131 | 131 | if ($truncLen < 0) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | '…' |
| 139 | 139 | ); |
| 140 | 140 | } |
| 141 | - $data['content'] = $prefix . $data['content'] . $suffix; |
|
| 141 | + $data['content'] = $prefix.$data['content'].$suffix; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | return $shouldRender; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $suffix = ''; |
| 126 | 126 | break; |
| 127 | 127 | } |
| 128 | - $lengthAdjust = mb_strlen($prefix . $suffix); |
|
| 128 | + $lengthAdjust = mb_strlen($prefix.$suffix); |
|
| 129 | 129 | // Truncate the og:title tag content |
| 130 | 130 | $truncLen = Seomatic::$settings->maxTitleLength - $lengthAdjust; |
| 131 | 131 | if ($truncLen < 0) { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | '…' |
| 139 | 139 | ); |
| 140 | 140 | } |
| 141 | - $data['content'] = $prefix . $data['content'] . $suffix; |
|
| 141 | + $data['content'] = $prefix.$data['content'].$suffix; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | return $shouldRender; |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | break; |
| 144 | 144 | } |
| 145 | 145 | // Handle the case of empty titles |
| 146 | - if ($prefix === (' ' . $separator . ' ')) { |
|
| 146 | + if ($prefix === (' '.$separator.' ')) { |
|
| 147 | 147 | $prefix = ''; |
| 148 | 148 | } |
| 149 | - if ($suffix === (' ' . $separator)) { |
|
| 149 | + if ($suffix === (' '.$separator)) { |
|
| 150 | 150 | $suffix = ''; |
| 151 | 151 | } |
| 152 | 152 | // Remove potential double spaces |
| 153 | 153 | $prefix = preg_replace('/\s+/', ' ', $prefix); |
| 154 | 154 | $suffix = preg_replace('/\s+/', ' ', $suffix); |
| 155 | - $lengthAdjust = mb_strlen($prefix . $suffix); |
|
| 155 | + $lengthAdjust = mb_strlen($prefix.$suffix); |
|
| 156 | 156 | // Parse the data |
| 157 | 157 | $scenario = $this->scenario; |
| 158 | 158 | $this->setScenario('render'); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | '…' |
| 172 | 172 | ); |
| 173 | 173 | } |
| 174 | - $data = $prefix . $data . $suffix; |
|
| 174 | + $data = $prefix.$data.$suffix; |
|
| 175 | 175 | } else { |
| 176 | 176 | // If no title is provided, just use the site name |
| 177 | 177 | $data = MetaValueHelper::parseString($this->siteName); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $data = trim($data); |
| 181 | 181 | // devMode |
| 182 | 182 | if (Seomatic::$devMode) { |
| 183 | - $data = Seomatic::$settings->devModeTitlePrefix . $data; |
|
| 183 | + $data = Seomatic::$settings->devModeTitlePrefix.$data; |
|
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param MetaBundle $metaBundle |
| 179 | 179 | * @param bool $forceUpdate |
| 180 | 180 | */ |
| 181 | - public function syncBundleWithConfig(MetaBundle &$metaBundle, bool $forceUpdate = false) |
|
| 181 | + public function syncBundleWithConfig(MetaBundle & $metaBundle, bool $forceUpdate = false) |
|
| 182 | 182 | { |
| 183 | 183 | $prevMetaBundle = $metaBundle; |
| 184 | 184 | $config = []; |
@@ -259,8 +259,8 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function updateMetaBundle(MetaBundle $metaBundle, int $siteId) |
| 261 | 261 | { |
| 262 | - $metaBundle->sourceName = (string)$metaBundle->sourceName; |
|
| 263 | - $metaBundle->sourceTemplate = (string)$metaBundle->sourceTemplate; |
|
| 262 | + $metaBundle->sourceName = (string) $metaBundle->sourceName; |
|
| 263 | + $metaBundle->sourceTemplate = (string) $metaBundle->sourceTemplate; |
|
| 264 | 264 | // Make sure it validates |
| 265 | 265 | if ($metaBundle->validate(null, true)) { |
| 266 | 266 | // Save it out to a record |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | 'sourceSiteId' => $siteId, |
| 271 | 271 | ]; |
| 272 | 272 | if ($metaBundle->typeId !== null) { |
| 273 | - $metaBundle->typeId = (int)$metaBundle->typeId; |
|
| 273 | + $metaBundle->typeId = (int) $metaBundle->typeId; |
|
| 274 | 274 | } |
| 275 | 275 | if (!empty($metaBundle->typeId)) { |
| 276 | 276 | $params['typeId'] = $metaBundle->typeId; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | // @TODO remove this hack that doesn't allow environment-transformed settings to be saved in a meta bundle with a proper system to address it |
| 287 | 287 | // The issue was that the containers were getting saved to the db with a hard-coded setting in them, because they'd |
| 288 | 288 | // been set that way by the environment, whereas to be changeable via the GUI, it needs to be set to {seomatic.meta.robots} |
| 289 | - $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE . TagService::GENERAL_HANDLE]->data['robots'] ?? null; |
|
| 289 | + $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE.TagService::GENERAL_HANDLE]->data['robots'] ?? null; |
|
| 290 | 290 | if (!empty($robotsTag)) { |
| 291 | 291 | $robotsTag->content = $robotsTag->environment['live']['content'] ?? '{{ seomatic.meta.robots }}'; |
| 292 | 292 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | $metaBundleDefaults = ArrayHelper::merge( |
| 369 | 369 | $seoElement::metaBundleConfig($sourceModel), |
| 370 | 370 | [ |
| 371 | - 'sourceTemplate' => (string)$siteSetting->template, |
|
| 371 | + 'sourceTemplate' => (string) $siteSetting->template, |
|
| 372 | 372 | 'sourceSiteId' => $siteSetting->siteId, |
| 373 | 373 | 'sourceAltSiteSettings' => $siteSettingsArray, |
| 374 | 374 | 'sourceDateUpdated' => $dateUpdated, |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | public function getMetaBundleBySourceHandle(string $sourceBundleType, string $sourceHandle, int $sourceSiteId, $typeId = null) |
| 417 | 417 | { |
| 418 | 418 | $metaBundle = null; |
| 419 | - $typeId = (int)$typeId; |
|
| 419 | + $typeId = (int) $typeId; |
|
| 420 | 420 | // See if we have the meta bundle cached |
| 421 | 421 | if (!empty($this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId])) { |
| 422 | 422 | $id = $this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId]; |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | /** @var Section|CategoryGroup|ProductType $sourceModel */ |
| 504 | 504 | $sourceModel = $seoElement::sourceModelFromId($sourceId); |
| 505 | 505 | if ($sourceModel !== null) { |
| 506 | - $metaBundle->sourceName = (string)$sourceModel->name; |
|
| 506 | + $metaBundle->sourceName = (string) $sourceModel->name; |
|
| 507 | 507 | $metaBundle->sourceHandle = $sourceModel->handle; |
| 508 | 508 | } |
| 509 | 509 | } |
@@ -544,7 +544,7 @@ discard block |
||
| 544 | 544 | public function getMetaBundleBySourceId(string $sourceBundleType, int $sourceId, int $sourceSiteId, $typeId = null) |
| 545 | 545 | { |
| 546 | 546 | $metaBundle = null; |
| 547 | - $typeId = (int)$typeId; |
|
| 547 | + $typeId = (int) $typeId; |
|
| 548 | 548 | // See if we have the meta bundle cached |
| 549 | 549 | if (!empty($this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId])) { |
| 550 | 550 | $id = $this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId]; |
@@ -739,7 +739,7 @@ discard block |
||
| 739 | 739 | ->from(['{{%seomatic_metabundles}}']) |
| 740 | 740 | ->where(['=', 'sourceBundleType', $seoElement::META_BUNDLE_TYPE]); |
| 741 | 741 | |
| 742 | - if ((int)$sourceSiteId !== 0) { |
|
| 742 | + if ((int) $sourceSiteId !== 0) { |
|
| 743 | 743 | $subQuery->andWhere(['sourceSiteId' => $sourceSiteId]); |
| 744 | 744 | } |
| 745 | 745 | if ($filter !== '') { |
@@ -776,7 +776,7 @@ discard block |
||
| 776 | 776 | public function getContentMetaBundleForElement(Element $element) |
| 777 | 777 | { |
| 778 | 778 | $source = $this->getMetaSourceFromElement($element); |
| 779 | - $key = implode(".", $source) . '.' . $element->siteId; |
|
| 779 | + $key = implode(".", $source).'.'.$element->siteId; |
|
| 780 | 780 | |
| 781 | 781 | if (empty($this->elementContentMetaBundles[$key])) { |
| 782 | 782 | $this->elementContentMetaBundles[$key] = $this->getMetaBundleBySourceId($source[1], $source[0], $element->siteId, $source[4]); |
@@ -798,10 +798,10 @@ discard block |
||
| 798 | 798 | $seoSettingsField = Craft::$app->getFields()->getFieldByHandle($fieldHandle); |
| 799 | 799 | if ($seoSettingsField) { |
| 800 | 800 | $seoSettingsEnabledFields = array_flip(array_merge( |
| 801 | - (array)$seoSettingsField->generalEnabledFields, |
|
| 802 | - (array)$seoSettingsField->twitterEnabledFields, |
|
| 803 | - (array)$seoSettingsField->facebookEnabledFields, |
|
| 804 | - (array)$seoSettingsField->sitemapEnabledFields |
|
| 801 | + (array) $seoSettingsField->generalEnabledFields, |
|
| 802 | + (array) $seoSettingsField->twitterEnabledFields, |
|
| 803 | + (array) $seoSettingsField->facebookEnabledFields, |
|
| 804 | + (array) $seoSettingsField->sitemapEnabledFields |
|
| 805 | 805 | )); |
| 806 | 806 | // Always include some fields, as they are calculated even if not explicitly included |
| 807 | 807 | $seoSettingsEnabledFields = array_merge( |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | |
| 830 | 830 | |
| 831 | 831 | // Handle the mainEntityOfPage |
| 832 | - if (!in_array('mainEntityOfPage', (array)$seoSettingsField->generalEnabledFields, false)) { |
|
| 832 | + if (!in_array('mainEntityOfPage', (array) $seoSettingsField->generalEnabledFields, false)) { |
|
| 833 | 833 | $metaBundle->metaGlobalVars->mainEntityOfPage = ''; |
| 834 | 834 | } |
| 835 | 835 | // metaSiteVars |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | /** |
| 161 | 161 | * @inheritdoc |
| 162 | 162 | */ |
| 163 | - public function getContentColumnType(): array|string |
|
| 163 | + public function getContentColumnType(): array | string |
|
| 164 | 164 | { |
| 165 | 165 | return Schema::TYPE_TEXT; |
| 166 | 166 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | } |
| 232 | 232 | // Handle the mainEntityOfPage |
| 233 | 233 | $mainEntity = ''; |
| 234 | - if (in_array('mainEntityOfPage', (array)$this->generalEnabledFields, false) && |
|
| 234 | + if (in_array('mainEntityOfPage', (array) $this->generalEnabledFields, false) && |
|
| 235 | 235 | !empty($config['metaBundleSettings'])) { |
| 236 | 236 | $mainEntity = SchemaHelper::getSpecificEntityType($config['metaBundleSettings'], true); |
| 237 | 237 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $value = StringHelper::encodeMb4($value); |
| 262 | 262 | } |
| 263 | 263 | if (is_array($value)) { |
| 264 | - array_walk_recursive($value, function (&$arrayValue, $arrayKey) { |
|
| 264 | + array_walk_recursive($value, function(&$arrayValue, $arrayKey) { |
|
| 265 | 265 | if ($arrayValue !== null && is_string($arrayValue)) { |
| 266 | 266 | $arrayValue = StringHelper::encodeMb4($arrayValue); |
| 267 | 267 | } |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | if ($element !== null && $element->uri !== null) { |
| 398 | 398 | $siteId = $element->siteId; |
| 399 | 399 | $uri = $element->uri; |
| 400 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
| 400 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
| 401 | 401 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
| 402 | 402 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
| 403 | 403 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -408,15 +408,15 @@ discard block |
||
| 408 | 408 | $dependency = new TagDependency([ |
| 409 | 409 | 'tags' => [ |
| 410 | 410 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
| 411 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
| 412 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
| 411 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
| 412 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 413 | 413 | ], |
| 414 | 414 | ]); |
| 415 | 415 | $cache = Craft::$app->getCache(); |
| 416 | 416 | $cacheDuration = null; |
| 417 | 417 | $html = $cache->getOrSet( |
| 418 | - self::CACHE_KEY . $cacheKey, |
|
| 419 | - function () use ($uri, $siteId, $element) { |
|
| 418 | + self::CACHE_KEY.$cacheKey, |
|
| 419 | + function() use ($uri, $siteId, $element) { |
|
| 420 | 420 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true); |
| 421 | 421 | $variables = [ |
| 422 | 422 | 'previewTypes' => [ |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | ) |
| 459 | 459 | { |
| 460 | 460 | $variables['textFieldSources'] = array_merge( |
| 461 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
| 461 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 462 | 462 | FieldHelper::fieldsOfTypeFromElement( |
| 463 | 463 | $element, |
| 464 | 464 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | ) |
| 467 | 467 | ); |
| 468 | 468 | $variables['assetFieldSources'] = array_merge( |
| 469 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
| 469 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 470 | 470 | FieldHelper::fieldsOfTypeFromElement( |
| 471 | 471 | $element, |
| 472 | 472 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // Output some info if this is a console app |
| 81 | 81 | if ($job && Craft::$app instanceof ConsoleApplication) { |
| 82 | - echo $job->description . PHP_EOL; |
|
| 82 | + echo $job->description.PHP_EOL; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $lines = []; |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | while ($currentElement < $totalElements) { |
| 140 | 140 | $elements = $paginator->getPageResults(); |
| 141 | 141 | if (Craft::$app instanceof ConsoleApplication) { |
| 142 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
| 143 | - . ' - elements: ' . $paginator->getTotalResults() |
|
| 142 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
| 143 | + . ' - elements: '.$paginator->getTotalResults() |
|
| 144 | 144 | . PHP_EOL; |
| 145 | 145 | } |
| 146 | 146 | /** @var ElementInterface $element */ |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | // Output some info if this is a console app |
| 154 | 154 | if (Craft::$app instanceof ConsoleApplication) { |
| 155 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
| 155 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 191 | 191 | if ($url !== $canonicalUrl) { |
| 192 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 192 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 193 | 193 | continue; |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -241,12 +241,12 @@ discard block |
||
| 241 | 241 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
| 242 | 242 | $lines[] = '<xhtml:link rel="alternate"' |
| 243 | 243 | . ' hreflang="x-default"' |
| 244 | - . ' href="' . Html::encode($altUrl) . '"' |
|
| 244 | + . ' href="'.Html::encode($altUrl).'"' |
|
| 245 | 245 | . ' />'; |
| 246 | 246 | } |
| 247 | 247 | $lines[] = '<xhtml:link rel="alternate"' |
| 248 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
| 249 | - . ' href="' . Html::encode($altUrl) . '"' |
|
| 248 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
| 249 | + . ' href="'.Html::encode($altUrl).'"' |
|
| 250 | 250 | . ' />'; |
| 251 | 251 | } |
| 252 | 252 | } |
@@ -346,11 +346,11 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | $cache = Craft::$app->getCache(); |
| 349 | - $cacheKey = SitemapTemplate::CACHE_KEY . $groupId . $type . $handle . $siteId; |
|
| 349 | + $cacheKey = SitemapTemplate::CACHE_KEY.$groupId.$type.$handle.$siteId; |
|
| 350 | 350 | $dependency = new TagDependency([ |
| 351 | 351 | 'tags' => [ |
| 352 | 352 | SitemapTemplate::GLOBAL_SITEMAP_CACHE_TAG, |
| 353 | - SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
| 353 | + SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
| 354 | 354 | ], |
| 355 | 355 | ]); |
| 356 | 356 | $lines = implode('', $lines); |
@@ -363,10 +363,10 @@ discard block |
||
| 363 | 363 | $result = $cache->set($cacheKey, $lines, $cacheDuration, $dependency); |
| 364 | 364 | // Remove the queue job id from the cache too |
| 365 | 365 | $cache->delete($queueJobCacheKey); |
| 366 | - Craft::debug('Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey, __METHOD__); |
|
| 366 | + Craft::debug('Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey, __METHOD__); |
|
| 367 | 367 | // Output some info if this is a console app |
| 368 | 368 | if (Craft::$app instanceof ConsoleApplication) { |
| 369 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
| 369 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
| 370 | 370 | } |
| 371 | 371 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
| 372 | 372 | $plugin = Craft::$app->getPlugins()->getPlugin('fastcgi-cache-bust'); |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | $attributes = \array_intersect_key( |
| 448 | 448 | $attributes, |
| 449 | - array_flip((array)$seoSettingsField->sitemapEnabledFields) |
|
| 449 | + array_flip((array) $seoSettingsField->sitemapEnabledFields) |
|
| 450 | 450 | ); |
| 451 | 451 | $attributes = array_filter( |
| 452 | 452 | $attributes, |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 480 | 480 | { |
| 481 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 481 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 482 | 482 | switch ($asset->kind) { |
| 483 | 483 | case 'image': |
| 484 | 484 | $lines[] = '<image:image>'; |
@@ -490,9 +490,9 @@ discard block |
||
| 490 | 490 | $fieldName = $row['field'] ?? ''; |
| 491 | 491 | $propName = $row['property'] ?? ''; |
| 492 | 492 | if (!empty($asset[$fieldName]) && !empty($propName)) { |
| 493 | - $lines[] = '<image:' . $propName . '>'; |
|
| 493 | + $lines[] = '<image:'.$propName.'>'; |
|
| 494 | 494 | $lines[] = Html::encode($asset[$fieldName]); |
| 495 | - $lines[] = '</image:' . $propName . '>'; |
|
| 495 | + $lines[] = '</image:'.$propName.'>'; |
|
| 496 | 496 | } |
| 497 | 497 | } |
| 498 | 498 | $lines[] = '</image:image>'; |
@@ -508,9 +508,9 @@ discard block |
||
| 508 | 508 | $fieldName = $row['field'] ?? ''; |
| 509 | 509 | $propName = $row['property'] ?? ''; |
| 510 | 510 | if (!empty($asset[$fieldName]) && !empty($propName)) { |
| 511 | - $lines[] = '<video:' . $propName . '>'; |
|
| 511 | + $lines[] = '<video:'.$propName.'>'; |
|
| 512 | 512 | $lines[] = Html::encode($asset[$fieldName]); |
| 513 | - $lines[] = '</video:' . $propName . '>'; |
|
| 513 | + $lines[] = '</video:'.$propName.'>'; |
|
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | $lines[] = '</video:video>'; |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | */ |
| 527 | 527 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 528 | 528 | { |
| 529 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 529 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 530 | 530 | if (\in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 531 | 531 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new \DateTime; |
| 532 | 532 | $lines[] = '<url>'; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | Event::on( |
| 109 | 109 | Sections::class, |
| 110 | 110 | Sections::EVENT_AFTER_SAVE_SECTION, |
| 111 | - function (SectionEvent $event) { |
|
| 111 | + function(SectionEvent $event) { |
|
| 112 | 112 | Craft::debug( |
| 113 | 113 | 'Sections::EVENT_AFTER_SAVE_SECTION', |
| 114 | 114 | __METHOD__ |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | Event::on( |
| 120 | 120 | Sections::class, |
| 121 | 121 | Sections::EVENT_AFTER_DELETE_SECTION, |
| 122 | - function (SectionEvent $event) { |
|
| 122 | + function(SectionEvent $event) { |
|
| 123 | 123 | Craft::debug( |
| 124 | 124 | 'Sections::EVENT_AFTER_DELETE_SECTION', |
| 125 | 125 | __METHOD__ |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | Event::on( |
| 135 | 135 | Sections::class, |
| 136 | 136 | Sections::EVENT_AFTER_SAVE_SECTION, |
| 137 | - function (SectionEvent $event) { |
|
| 137 | + function(SectionEvent $event) { |
|
| 138 | 138 | Craft::debug( |
| 139 | 139 | 'Sections::EVENT_AFTER_SAVE_SECTION', |
| 140 | 140 | __METHOD__ |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | Event::on( |
| 158 | 158 | Sections::class, |
| 159 | 159 | Sections::EVENT_AFTER_DELETE_SECTION, |
| 160 | - function (SectionEvent $event) { |
|
| 160 | + function(SectionEvent $event) { |
|
| 161 | 161 | Craft::debug( |
| 162 | 162 | 'Sections::EVENT_AFTER_DELETE_SECTION', |
| 163 | 163 | __METHOD__ |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | Event::on( |
| 187 | 187 | Entry::class, |
| 188 | 188 | Entry::EVENT_DEFINE_SIDEBAR_HTML, |
| 189 | - static function (DefineHtmlEvent $event) { |
|
| 189 | + static function(DefineHtmlEvent $event) { |
|
| 190 | 190 | Craft::debug( |
| 191 | 191 | 'Entry::EVENT_DEFINE_SIDEBAR_HTML', |
| 192 | 192 | __METHOD__ |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | ->limit($metaBundle->metaSitemapVars->sitemapLimit); |
| 228 | 228 | if ($metaBundle->sourceType === 'structure' |
| 229 | 229 | && !empty($metaBundle->metaSitemapVars->structureDepth)) { |
| 230 | - $query->level('<=' . $metaBundle->metaSitemapVars->structureDepth); |
|
| 230 | + $query->level('<='.$metaBundle->metaSitemapVars->structureDepth); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | return $query; |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
| 396 | 396 | [ |
| 397 | 397 | 'sourceId' => $sourceModel->id, |
| 398 | - 'sourceName' => (string)$sourceModel->name, |
|
| 398 | + 'sourceName' => (string) $sourceModel->name, |
|
| 399 | 399 | 'sourceHandle' => $sourceModel->handle, |
| 400 | 400 | 'sourceType' => $sourceModel->type, |
| 401 | 401 | ] |