@@ -140,10 +140,10 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | $cache = Craft::$app->getCache(); |
| 143 | - $pageCacheSuffix = 's' . (int)$metaBundle->metaSitemapVars->sitemapPageSize . 'p' . $page; |
|
| 143 | + $pageCacheSuffix = 's'.(int) $metaBundle->metaSitemapVars->sitemapPageSize.'p'.$page; |
|
| 144 | 144 | |
| 145 | - $uniqueKey = $groupId . $type . $handle . $siteId . $pageCacheSuffix; |
|
| 146 | - $cacheKey = self::CACHE_KEY . $uniqueKey; |
|
| 145 | + $uniqueKey = $groupId.$type.$handle.$siteId.$pageCacheSuffix; |
|
| 146 | + $cacheKey = self::CACHE_KEY.$uniqueKey; |
|
| 147 | 147 | $result = $cache->get($cacheKey); |
| 148 | 148 | |
| 149 | 149 | // If the sitemap isn't cached, render it immediately |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | $dependency = new TagDependency([ |
| 161 | 161 | 'tags' => [ |
| 162 | 162 | self::GLOBAL_SITEMAP_CACHE_TAG, |
| 163 | - self::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
| 164 | - self::SITEMAP_CACHE_TAG . $handle . $siteId . $pageCacheSuffix, |
|
| 163 | + self::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
| 164 | + self::SITEMAP_CACHE_TAG.$handle.$siteId.$pageCacheSuffix, |
|
| 165 | 165 | ], |
| 166 | 166 | ]); |
| 167 | 167 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // Output some info if this is a console app |
| 175 | 175 | if (Craft::$app instanceof ConsoleApplication) { |
| 176 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
| 176 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | } |
| 188 | 188 | } else { |
| 189 | 189 | if (Craft::$app instanceof ConsoleApplication) { |
| 190 | - echo 'Found in cache' . PHP_EOL; |
|
| 190 | + echo 'Found in cache'.PHP_EOL; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | |
@@ -203,9 +203,9 @@ discard block |
||
| 203 | 203 | public function invalidateCache(string $handle, int $siteId) |
| 204 | 204 | { |
| 205 | 205 | $cache = Craft::$app->getCache(); |
| 206 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
| 206 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
| 207 | 207 | Craft::info( |
| 208 | - 'Sitemap cache cleared: ' . $handle, |
|
| 208 | + 'Sitemap cache cleared: '.$handle, |
|
| 209 | 209 | __METHOD__ |
| 210 | 210 | ); |
| 211 | 211 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | ->limit($metaBundle->metaSitemapVars->sitemapLimit); |
| 224 | 224 | if ($metaBundle->sourceType === 'structure' |
| 225 | 225 | && !empty($metaBundle->metaSitemapVars->structureDepth)) { |
| 226 | - $query->level('<=' . $metaBundle->metaSitemapVars->structureDepth); |
|
| 226 | + $query->level('<='.$metaBundle->metaSitemapVars->structureDepth); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | return $query; |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | if (!empty($typeId)) { |
| 272 | 272 | $query |
| 273 | 273 | ->andWhere([ |
| 274 | - 'typeId' => (int)$typeId, |
|
| 274 | + 'typeId' => (int) $typeId, |
|
| 275 | 275 | ]); |
| 276 | 276 | } |
| 277 | 277 | $element = $query->one(); |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
| 399 | 399 | [ |
| 400 | 400 | 'sourceId' => $sourceModel->id, |
| 401 | - 'sourceName' => (string)$sourceModel->name, |
|
| 401 | + 'sourceName' => (string) $sourceModel->name, |
|
| 402 | 402 | 'sourceHandle' => $sourceModel->handle, |
| 403 | 403 | 'sourceType' => $sourceModel->type, |
| 404 | 404 | ] |
@@ -508,8 +508,8 @@ discard block |
||
| 508 | 508 | string $sourceBundleType, |
| 509 | 509 | string $sourceHandle, |
| 510 | 510 | string $siteHandle = null, |
| 511 | - $typeId = null, |
|
| 512 | - $loadFromSiteHandle = null, |
|
| 511 | + $typeId = null, |
|
| 512 | + $loadFromSiteHandle = null, |
|
| 513 | 513 | ): Response { |
| 514 | 514 | $variables = []; |
| 515 | 515 | // @TODO: Let people choose an entry/categorygroup/product as the preview |
@@ -1222,7 +1222,7 @@ discard block |
||
| 1222 | 1222 | string $sourceHandle, |
| 1223 | 1223 | string $groupName, |
| 1224 | 1224 | array &$variables, |
| 1225 | - $typeId = null, |
|
| 1225 | + $typeId = null, |
|
| 1226 | 1226 | ) { |
| 1227 | 1227 | $variables['textFieldSources'] = array_merge( |
| 1228 | 1228 | ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * @inheritdoc |
| 91 | 91 | */ |
| 92 | - protected array|bool|int $allowAnonymous = [ |
|
| 92 | + protected array | bool | int $allowAnonymous = [ |
|
| 93 | 93 | ]; |
| 94 | 94 | |
| 95 | 95 | // Public Methods |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
| 134 | 134 | $variables['title'] = $templateTitle; |
| 135 | 135 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
| 136 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 136 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 137 | 137 | $variables['crumbs'] = [ |
| 138 | 138 | [ |
| 139 | 139 | 'label' => $pluginName, |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | ], |
| 142 | 142 | [ |
| 143 | 143 | 'label' => $templateTitle, |
| 144 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
| 144 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
| 145 | 145 | ], |
| 146 | 146 | ]; |
| 147 | 147 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -164,11 +164,11 @@ discard block |
||
| 164 | 164 | foreach ($variables['metaBundles'] as $metaBundle) { |
| 165 | 165 | $stat = 0; |
| 166 | 166 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
| 167 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 167 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 168 | 168 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
| 169 | 169 | $variables['contentSetupChecklist'][$setupField] = [ |
| 170 | 170 | 'label' => $setupLabel, |
| 171 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 171 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 172 | 172 | ]; |
| 173 | 173 | } |
| 174 | 174 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -179,16 +179,16 @@ discard block |
||
| 179 | 179 | } |
| 180 | 180 | // Global SEO grades |
| 181 | 181 | Seomatic::$previewingMetaContainers = true; |
| 182 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
| 182 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
| 183 | 183 | Seomatic::$previewingMetaContainers = false; |
| 184 | 184 | if ($metaBundle !== null) { |
| 185 | 185 | $stat = 0; |
| 186 | 186 | $variables['globalSetupChecklist'] = []; |
| 187 | 187 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
| 188 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 188 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 189 | 189 | $variables['globalSetupChecklist'][$setupField] = [ |
| 190 | 190 | 'label' => $setupLabel, |
| 191 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 191 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 192 | 192 | ]; |
| 193 | 193 | } |
| 194 | 194 | $stat = round(($stat / $numFields) * 100); |
@@ -198,17 +198,17 @@ discard block |
||
| 198 | 198 | $stat = 0; |
| 199 | 199 | $variables['siteSetupChecklist'] = []; |
| 200 | 200 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
| 201 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
| 201 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
| 202 | 202 | $variables['siteSetupChecklist'][$setupField] = [ |
| 203 | 203 | 'label' => $setupLabel, |
| 204 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
| 204 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
| 205 | 205 | ]; |
| 206 | 206 | } |
| 207 | 207 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
| 208 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
| 208 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
| 209 | 209 | $variables['siteSetupChecklist'][$setupField] = [ |
| 210 | 210 | 'label' => $setupLabel, |
| 211 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
| 211 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
| 212 | 212 | ]; |
| 213 | 213 | } |
| 214 | 214 | $stat = round(($stat / $numFields) * 100); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $variables['title'] = $templateTitle; |
| 257 | 257 | $variables['subSectionTitle'] = $subSectionTitle; |
| 258 | 258 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 259 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 259 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 260 | 260 | $variables['crumbs'] = [ |
| 261 | 261 | [ |
| 262 | 262 | 'label' => $pluginName, |
@@ -264,11 +264,11 @@ discard block |
||
| 264 | 264 | ], |
| 265 | 265 | [ |
| 266 | 266 | 'label' => $templateTitle, |
| 267 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
| 267 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
| 268 | 268 | ], |
| 269 | 269 | [ |
| 270 | 270 | 'label' => $subSectionTitle, |
| 271 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
| 271 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
| 272 | 272 | ], |
| 273 | 273 | ]; |
| 274 | 274 | $variables['selectedSubnavItem'] = 'global'; |
@@ -276,14 +276,14 @@ discard block |
||
| 276 | 276 | $this->setGlobalFieldSourceVariables($variables); |
| 277 | 277 | // Enabled sites |
| 278 | 278 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 279 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
| 279 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
| 280 | 280 | $variables['currentSubSection'] = $subSection; |
| 281 | 281 | // Meta bundle settings |
| 282 | 282 | Seomatic::$previewingMetaContainers = true; |
| 283 | 283 | // Get the site to copy the settings from, if any |
| 284 | 284 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 285 | 285 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 286 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 286 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 287 | 287 | // Load the metabundle |
| 288 | 288 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 289 | 289 | if ($editedMetaBundle) { |
@@ -338,11 +338,11 @@ discard block |
||
| 338 | 338 | // Preview the meta containers |
| 339 | 339 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 340 | 340 | MetaBundles::GLOBAL_META_BUNDLE, |
| 341 | - (int)$variables['currentSiteId'] |
|
| 341 | + (int) $variables['currentSiteId'] |
|
| 342 | 342 | ); |
| 343 | 343 | |
| 344 | 344 | // Render the template |
| 345 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
| 345 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | /** |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
| 475 | 475 | $variables['title'] = $templateTitle; |
| 476 | 476 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
| 477 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 477 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 478 | 478 | $variables['crumbs'] = [ |
| 479 | 479 | [ |
| 480 | 480 | 'label' => $pluginName, |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | ], |
| 483 | 483 | [ |
| 484 | 484 | 'label' => $templateTitle, |
| 485 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
| 485 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
| 486 | 486 | ], |
| 487 | 487 | ]; |
| 488 | 488 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | $siteHandle = $this->getCpSiteHandle($siteHandle); |
| 524 | 524 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 525 | 525 | if (is_string($typeId)) { |
| 526 | - $typeId = (int)$typeId; |
|
| 526 | + $typeId = (int) $typeId; |
|
| 527 | 527 | } |
| 528 | 528 | if (empty($typeId)) { |
| 529 | 529 | $typeId = null; |
@@ -541,7 +541,7 @@ discard block |
||
| 541 | 541 | $currentType = reset($typeMenu); |
| 542 | 542 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
| 543 | 543 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
| 544 | - $typeId = (int)$variables['currentTypeId']; |
|
| 544 | + $typeId = (int) $variables['currentTypeId']; |
|
| 545 | 545 | } |
| 546 | 546 | // If there's only one EntryType, don't bother displaying the menu |
| 547 | 547 | if (count($typeMenu) === 1) { |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | // Get the site to copy the settings from, if any |
| 574 | 574 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 575 | 575 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 576 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 576 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 577 | 577 | // Load the metabundle |
| 578 | 578 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
| 579 | 579 | $sourceBundleType, |
@@ -599,7 +599,7 @@ discard block |
||
| 599 | 599 | $variables['title'] = $templateTitle; |
| 600 | 600 | $variables['subSectionTitle'] = $subSectionTitle; |
| 601 | 601 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
| 602 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 602 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 603 | 603 | $variables['siteHandleUri'] = $siteHandleUri; |
| 604 | 604 | $variables['crumbs'] = [ |
| 605 | 605 | [ |
@@ -608,10 +608,10 @@ discard block |
||
| 608 | 608 | ], |
| 609 | 609 | [ |
| 610 | 610 | 'label' => 'Content SEO', |
| 611 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
| 611 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
| 612 | 612 | ], |
| 613 | 613 | [ |
| 614 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
| 614 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
| 615 | 615 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
| 616 | 616 | ], |
| 617 | 617 | ]; |
@@ -642,13 +642,13 @@ discard block |
||
| 642 | 642 | // Preview the meta containers |
| 643 | 643 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 644 | 644 | $uri, |
| 645 | - (int)$variables['currentSiteId'], |
|
| 645 | + (int) $variables['currentSiteId'], |
|
| 646 | 646 | false, |
| 647 | 647 | false |
| 648 | 648 | ); |
| 649 | 649 | |
| 650 | 650 | // Render the template |
| 651 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
| 651 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
| 652 | 652 | } |
| 653 | 653 | |
| 654 | 654 | /** |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | $bundleSettings = $request->getParam('metaBundleSettings'); |
| 670 | 670 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
| 671 | 671 | if (is_string($typeId)) { |
| 672 | - $typeId = (int)$typeId; |
|
| 672 | + $typeId = (int) $typeId; |
|
| 673 | 673 | } |
| 674 | 674 | // Set the element type in the template |
| 675 | 675 | $elementName = ''; |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | if ($subSection === 'social') { |
| 742 | 742 | $subSectionSuffix = ' Media'; |
| 743 | 743 | } |
| 744 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
| 744 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
| 745 | 745 | // Asset bundle |
| 746 | 746 | try { |
| 747 | 747 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | $variables['title'] = $templateTitle; |
| 760 | 760 | $variables['subSectionTitle'] = $subSectionTitle; |
| 761 | 761 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 762 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 762 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 763 | 763 | $variables['crumbs'] = [ |
| 764 | 764 | [ |
| 765 | 765 | 'label' => $pluginName, |
@@ -767,11 +767,11 @@ discard block |
||
| 767 | 767 | ], |
| 768 | 768 | [ |
| 769 | 769 | 'label' => $templateTitle, |
| 770 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
| 770 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
| 771 | 771 | ], |
| 772 | 772 | [ |
| 773 | 773 | 'label' => $subSectionTitle, |
| 774 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
| 774 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
| 775 | 775 | ], |
| 776 | 776 | ]; |
| 777 | 777 | $variables['selectedSubnavItem'] = 'site'; |
@@ -779,14 +779,14 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | // Enabled sites |
| 781 | 781 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 782 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
| 782 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
| 783 | 783 | |
| 784 | 784 | // The site settings for the appropriate meta bundle |
| 785 | 785 | Seomatic::$previewingMetaContainers = true; |
| 786 | 786 | // Get the site to copy the settings from, if any |
| 787 | 787 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 788 | 788 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 789 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 789 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 790 | 790 | // Load the metabundle |
| 791 | 791 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 792 | 792 | Seomatic::$previewingMetaContainers = false; |
@@ -805,7 +805,7 @@ discard block |
||
| 805 | 805 | $variables['assetVolumeSources'] = AssetHelper::getAssetInputSources(); |
| 806 | 806 | |
| 807 | 807 | // Render the template |
| 808 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
| 808 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
| 809 | 809 | } |
| 810 | 810 | |
| 811 | 811 | /** |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 938 | 938 | // Enabled sites |
| 939 | 939 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 940 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
| 940 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
| 941 | 941 | $variables['currentSubSection'] = $subSection; |
| 942 | 942 | |
| 943 | 943 | // The script meta containers for the global meta bundle |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | // Get the site to copy the settings from, if any |
| 946 | 946 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 947 | 947 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 948 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 948 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 949 | 949 | // Load the metabundle |
| 950 | 950 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 951 | 951 | if ($editedMetaBundle) { |
@@ -985,7 +985,7 @@ discard block |
||
| 985 | 985 | $variables['title'] = $templateTitle; |
| 986 | 986 | $variables['subSectionTitle'] = $subSectionTitle; |
| 987 | 987 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 988 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 988 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 989 | 989 | $variables['crumbs'] = [ |
| 990 | 990 | [ |
| 991 | 991 | 'label' => $pluginName, |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | ], |
| 998 | 998 | [ |
| 999 | 999 | 'label' => $subSectionTitle, |
| 1000 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
| 1000 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
| 1001 | 1001 | ], |
| 1002 | 1002 | ]; |
| 1003 | 1003 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | if ($siteHandle !== null) { |
| 1151 | 1151 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
| 1152 | 1152 | if (!$site) { |
| 1153 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
| 1153 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
| 1154 | 1154 | } |
| 1155 | 1155 | $siteId = $site->id; |
| 1156 | 1156 | } else { |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | if (!empty($variables['enabledSiteIds'])) { |
| 1188 | 1188 | $siteId = reset($variables['enabledSiteIds']); |
| 1189 | 1189 | } else { |
| 1190 | - $this->requirePermission('editSite:' . $siteId); |
|
| 1190 | + $this->requirePermission('editSite:'.$siteId); |
|
| 1191 | 1191 | } |
| 1192 | 1192 | } |
| 1193 | 1193 | } |
@@ -1207,7 +1207,7 @@ discard block |
||
| 1207 | 1207 | if ($variables['showSites']) { |
| 1208 | 1208 | $variables['sitesMenuLabel'] = Craft::t( |
| 1209 | 1209 | 'site', |
| 1210 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
| 1210 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
| 1211 | 1211 | ); |
| 1212 | 1212 | } else { |
| 1213 | 1213 | $variables['sitesMenuLabel'] = ''; |
@@ -1274,7 +1274,7 @@ discard block |
||
| 1274 | 1274 | $typeId = null, |
| 1275 | 1275 | ) { |
| 1276 | 1276 | $variables['textFieldSources'] = array_merge( |
| 1277 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
| 1277 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 1278 | 1278 | FieldHelper::fieldsOfTypeFromSource( |
| 1279 | 1279 | $sourceBundleType, |
| 1280 | 1280 | $sourceHandle, |
@@ -1284,7 +1284,7 @@ discard block |
||
| 1284 | 1284 | ) |
| 1285 | 1285 | ); |
| 1286 | 1286 | $variables['assetFieldSources'] = array_merge( |
| 1287 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
| 1287 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 1288 | 1288 | FieldHelper::fieldsOfTypeFromSource( |
| 1289 | 1289 | $sourceBundleType, |
| 1290 | 1290 | $sourceHandle, |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * @var bool|array |
| 42 | 42 | */ |
| 43 | - protected array|bool|int $allowAnonymous = [ |
|
| 43 | + protected array | bool | int $allowAnonymous = [ |
|
| 44 | 44 | ]; |
| 45 | 45 | |
| 46 | 46 | // Public Methods |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function actionGenerate() |
| 66 | 66 | { |
| 67 | - echo 'This CLI command is no longer needed because of the paginated sitemap generation' . PHP_EOL; |
|
| 67 | + echo 'This CLI command is no longer needed because of the paginated sitemap generation'.PHP_EOL; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // Protected Methods |
@@ -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, '/'); |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | public static function mergeUrlWithPath(string $url, string $path): string |
| 74 | 74 | { |
| 75 | 75 | $overlap = 0; |
| 76 | - $url = rtrim($url, '/') . '/'; |
|
| 77 | - $path = '/' . ltrim($path, '/'); |
|
| 76 | + $url = rtrim($url, '/').'/'; |
|
| 77 | + $path = '/'.ltrim($path, '/'); |
|
| 78 | 78 | $urlOffset = strlen($url); |
| 79 | 79 | $pathLength = strlen($path); |
| 80 | 80 | $pathOffset = 0; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); |
|
| 89 | + return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/'); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // Handle trailing slashes properly for generated URLs |
| 159 | 159 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
| 160 | 160 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
| 161 | - $url = rtrim($url, '/') . '/'; |
|
| 161 | + $url = rtrim($url, '/').'/'; |
|
| 162 | 162 | } |
| 163 | 163 | if (!$generalConfig->addTrailingSlashesToUrls && (!$preserveTrailingSlash || self::urlIsSiteIndex($url))) { |
| 164 | 164 | $url = rtrim($url, '/'); |
@@ -178,13 +178,13 @@ discard block |
||
| 178 | 178 | $urlParts = parse_url($url); |
| 179 | 179 | $encodedUrl = ""; |
| 180 | 180 | if (isset($urlParts['scheme'])) { |
| 181 | - $encodedUrl .= $urlParts['scheme'] . '://'; |
|
| 181 | + $encodedUrl .= $urlParts['scheme'].'://'; |
|
| 182 | 182 | } |
| 183 | 183 | if (isset($urlParts['host'])) { |
| 184 | 184 | $encodedUrl .= $urlParts['host']; |
| 185 | 185 | } |
| 186 | 186 | if (isset($urlParts['port'])) { |
| 187 | - $encodedUrl .= ':' . $urlParts['port']; |
|
| 187 | + $encodedUrl .= ':'.$urlParts['port']; |
|
| 188 | 188 | } |
| 189 | 189 | if (isset($urlParts['path'])) { |
| 190 | 190 | $encodedUrl .= $urlParts['path']; |
@@ -194,15 +194,15 @@ discard block |
||
| 194 | 194 | foreach ($query as $j => $value) { |
| 195 | 195 | $value = explode('=', $value, 2); |
| 196 | 196 | if (count($value) === 2) { |
| 197 | - $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]); |
|
| 197 | + $query[$j] = urlencode($value[0]).'='.urlencode($value[1]); |
|
| 198 | 198 | } else { |
| 199 | 199 | $query[$j] = urlencode($value[0]); |
| 200 | 200 | } |
| 201 | 201 | } |
| 202 | - $encodedUrl .= '?' . implode('&', $query); |
|
| 202 | + $encodedUrl .= '?'.implode('&', $query); |
|
| 203 | 203 | } |
| 204 | 204 | if (isset($urlParts['fragment'])) { |
| 205 | - $encodedUrl .= '#' . $urlParts['fragment']; |
|
| 205 | + $encodedUrl .= '#'.$urlParts['fragment']; |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | return $encodedUrl; |
@@ -234,10 +234,10 @@ discard block |
||
| 234 | 234 | $sitePath = parse_url(self::siteUrl('/', null, null, $site->id), PHP_URL_PATH); |
| 235 | 235 | if (!empty($sitePath)) { |
| 236 | 236 | // Normalizes a URI path by trimming leading/ trailing slashes and removing double slashes |
| 237 | - $sitePath = '/' . preg_replace('/\/\/+/', '/', trim($sitePath, '/')); |
|
| 237 | + $sitePath = '/'.preg_replace('/\/\/+/', '/', trim($sitePath, '/')); |
|
| 238 | 238 | } |
| 239 | 239 | // Normalizes a URI path by trimming leading/ trailing slashes and removing double slashes |
| 240 | - $url = '/' . preg_replace('/\/\/+/', '/', trim($url, '/')); |
|
| 240 | + $url = '/'.preg_replace('/\/\/+/', '/', trim($url, '/')); |
|
| 241 | 241 | // See if this url ends with a site prefix, and thus is a site index |
| 242 | 242 | if (str_ends_with($url, $sitePath)) { |
| 243 | 243 | $result = true; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | if ($siteId !== null) { |
| 271 | 271 | $site = $sites->getSiteById($siteId, true); |
| 272 | 272 | if (!$site) { |
| 273 | - throw new Exception('Invalid site ID: ' . $siteId); |
|
| 273 | + throw new Exception('Invalid site ID: '.$siteId); |
|
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | |
| 316 | 316 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
| 317 | 317 | $url_parts = parse_url($pathOrUrl); |
| 318 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
| 318 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
| 319 | 319 | $result['path'] = $url_parts['path'] ?? ''; |
| 320 | 320 | $result['suffix'] = ''; |
| 321 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
| 322 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
| 321 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
| 322 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
| 323 | 323 | } else { |
| 324 | 324 | $result['prefix'] = ''; |
| 325 | 325 | $result['path'] = $pathOrUrl; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | { |
| 88 | 88 | if ($pageInfo !== null && $pageInfo->currentPage !== null) { |
| 89 | 89 | // Let the meta containers know that this page is paginated |
| 90 | - Seomatic::$plugin->metaContainers->paginationPage = (string)$pageInfo->currentPage; |
|
| 90 | + Seomatic::$plugin->metaContainers->paginationPage = (string) $pageInfo->currentPage; |
|
| 91 | 91 | // See if we should strip the query params |
| 92 | 92 | $stripQueryParams = true; |
| 93 | 93 | $pageTrigger = Craft::$app->getConfig()->getGeneral()->pageTrigger; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if (is_array($content)) { |
| 171 | 171 | $headerValue = ''; |
| 172 | 172 | foreach ($content as $contentVal) { |
| 173 | - $headerValue .= ($contentVal . ','); |
|
| 173 | + $headerValue .= ($contentVal.','); |
|
| 174 | 174 | } |
| 175 | 175 | $headerValue = rtrim($headerValue, ','); |
| 176 | 176 | } else { |
@@ -190,12 +190,12 @@ discard block |
||
| 190 | 190 | $headerValue = ''; |
| 191 | 191 | foreach ($href as $hrefVal) { |
| 192 | 192 | $hrefVal = UrlHelper::encodeUrl($hrefVal); |
| 193 | - $headerValue .= ('<' . $hrefVal . '>' . ','); |
|
| 193 | + $headerValue .= ('<'.$hrefVal.'>'.','); |
|
| 194 | 194 | } |
| 195 | 195 | $headerValue = rtrim($headerValue, ','); |
| 196 | 196 | } else { |
| 197 | 197 | $href = UrlHelper::encodeUrl($href); |
| 198 | - $headerValue = '<' . $href . '>'; |
|
| 198 | + $headerValue = '<'.$href.'>'; |
|
| 199 | 199 | } |
| 200 | 200 | $headerValue .= "; rel='canonical'"; |
| 201 | 201 | $response->headers->add('Link', $headerValue); |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | if (is_array($content)) { |
| 212 | 212 | $headerValue = ''; |
| 213 | 213 | foreach ($content as $contentVal) { |
| 214 | - $headerValue .= ($contentVal . ','); |
|
| 214 | + $headerValue .= ($contentVal.','); |
|
| 215 | 215 | } |
| 216 | 216 | $headerValue = rtrim($headerValue, ','); |
| 217 | 217 | } else { |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | } |
| 626 | 626 | } |
| 627 | 627 | // Never include the URL if the element isn't enabled for the site |
| 628 | - if (isset($element->enabledForSite) && !(bool)$element->enabledForSite) { |
|
| 628 | + if (isset($element->enabledForSite) && !(bool) $element->enabledForSite) { |
|
| 629 | 629 | $includeUrl = false; |
| 630 | 630 | } |
| 631 | 631 | } else { |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | if (isset($value[$day][$time]) |
| 834 | 834 | && ($date = DateTimeHelper::toDateTime($value[$day][$time])) !== false |
| 835 | 835 | ) { |
| 836 | - $normalized[$day][$time] = (array)($date); |
|
| 836 | + $normalized[$day][$time] = (array) ($date); |
|
| 837 | 837 | } else { |
| 838 | 838 | $normalized[$day][$time] = null; |
| 839 | 839 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | // Get the page number of this request |
| 183 | 183 | $request = Craft::$app->getRequest(); |
| 184 | 184 | if (!$request->isConsoleRequest) { |
| 185 | - $this->paginationPage = (string)$request->pageNum; |
|
| 185 | + $this->paginationPage = (string) $request->pageNum; |
|
| 186 | 186 | } |
| 187 | 187 | } |
| 188 | 188 | |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | $dependency = $this->containerDependency; |
| 252 | 252 | $uniqueKey = $dependency->tags[3] ?? self::GLOBALS_CACHE_KEY; |
| 253 | 253 | list($this->metaGlobalVars, $this->metaSiteVars) = Craft::$app->getCache()->getOrSet( |
| 254 | - self::GLOBALS_CACHE_KEY . $uniqueKey, |
|
| 254 | + self::GLOBALS_CACHE_KEY.$uniqueKey, |
|
| 255 | 255 | function() use ($uniqueKey) { |
| 256 | 256 | Craft::info( |
| 257 | - self::GLOBALS_CACHE_KEY . ' cache miss: ' . $uniqueKey, |
|
| 257 | + self::GLOBALS_CACHE_KEY.' cache miss: '.$uniqueKey, |
|
| 258 | 258 | __METHOD__ |
| 259 | 259 | ); |
| 260 | 260 | |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | ?? 1; |
| 381 | 381 | } |
| 382 | 382 | // Handle pagination |
| 383 | - $paginationPage = 'page' . $this->paginationPage; |
|
| 383 | + $paginationPage = 'page'.$this->paginationPage; |
|
| 384 | 384 | // Get the path for the current request |
| 385 | 385 | $request = Craft::$app->getRequest(); |
| 386 | 386 | $requestPath = '/'; |
@@ -405,22 +405,22 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | // Get our cache key |
| 408 | - $cacheKey = $uri . $siteId . $paginationPage . $requestPath . $this->getAllowedUrlParams() . $token; |
|
| 408 | + $cacheKey = $uri.$siteId.$paginationPage.$requestPath.$this->getAllowedUrlParams().$token; |
|
| 409 | 409 | // For requests with a status code of >= 400, use one cache key |
| 410 | 410 | if (!$request->isConsoleRequest) { |
| 411 | 411 | $response = Craft::$app->getResponse(); |
| 412 | 412 | if ($response->statusCode >= 400) { |
| 413 | - $cacheKey = $siteId . self::INVALID_RESPONSE_CACHE_KEY . $response->statusCode; |
|
| 413 | + $cacheKey = $siteId.self::INVALID_RESPONSE_CACHE_KEY.$response->statusCode; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | // Load the meta containers |
| 417 | 417 | $dependency = new TagDependency([ |
| 418 | 418 | 'tags' => [ |
| 419 | 419 | self::GLOBAL_METACONTAINER_CACHE_TAG, |
| 420 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
| 421 | - self::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
| 422 | - self::METACONTAINER_CACHE_TAG . $cacheKey, |
|
| 423 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType, |
|
| 420 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
| 421 | + self::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 422 | + self::METACONTAINER_CACHE_TAG.$cacheKey, |
|
| 423 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType, |
|
| 424 | 424 | ], |
| 425 | 425 | ]); |
| 426 | 426 | $this->containerDependency = $dependency; |
@@ -437,10 +437,10 @@ discard block |
||
| 437 | 437 | } else { |
| 438 | 438 | $cache = Craft::$app->getCache(); |
| 439 | 439 | list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet( |
| 440 | - self::CACHE_KEY . $cacheKey, |
|
| 440 | + self::CACHE_KEY.$cacheKey, |
|
| 441 | 441 | function() use ($uri, $siteId) { |
| 442 | 442 | Craft::info( |
| 443 | - 'Meta container cache miss: ' . $uri . '/' . $siteId, |
|
| 443 | + 'Meta container cache miss: '.$uri.'/'.$siteId, |
|
| 444 | 444 | __METHOD__ |
| 445 | 445 | ); |
| 446 | 446 | $this->loadGlobalMetaContainers($siteId); |
@@ -841,10 +841,10 @@ discard block |
||
| 841 | 841 | $cache = Craft::$app->getCache(); |
| 842 | 842 | TagDependency::invalidate( |
| 843 | 843 | $cache, |
| 844 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId |
|
| 844 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId |
|
| 845 | 845 | ); |
| 846 | 846 | Craft::info( |
| 847 | - 'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId, |
|
| 847 | + 'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId, |
|
| 848 | 848 | __METHOD__ |
| 849 | 849 | ); |
| 850 | 850 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -871,9 +871,9 @@ discard block |
||
| 871 | 871 | if ($siteId === null) { |
| 872 | 872 | $siteId = Craft::$app->getSites()->currentSite->id ?? 1; |
| 873 | 873 | } |
| 874 | - TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId); |
|
| 874 | + TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId); |
|
| 875 | 875 | Craft::info( |
| 876 | - 'Meta container cache cleared: ' . $uri . ' / ' . $siteId, |
|
| 876 | + 'Meta container cache cleared: '.$uri.' / '.$siteId, |
|
| 877 | 877 | __METHOD__ |
| 878 | 878 | ); |
| 879 | 879 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | // Handle re-creating the `mainEntityOfPage` so that the model injected into the |
| 1018 | 1018 | // templates has the appropriate attributes |
| 1019 | - $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE; |
|
| 1019 | + $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE; |
|
| 1020 | 1020 | $generalContainer = $this->metaContainers[$generalContainerKey]; |
| 1021 | 1021 | if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) { |
| 1022 | 1022 | /** @var MetaJsonLd $jsonLdModel */ |
@@ -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 .= '>'; |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | $paginator->getTotalPages(), |
| 214 | 214 | $paginator->getTotalResults()); |
| 215 | 215 | } |
| 216 | - echo $message . PHP_EOL; |
|
| 216 | + echo $message.PHP_EOL; |
|
| 217 | 217 | } |
| 218 | 218 | /** @var Element $element */ |
| 219 | 219 | foreach ($elements as $element) { |
| 220 | 220 | // Output some info if this is a console app |
| 221 | 221 | if (Craft::$app instanceof ConsoleApplication) { |
| 222 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
| 222 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | } |
| 265 | 265 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 266 | 266 | if ($url !== $canonicalUrl) { |
| 267 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 267 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 268 | 268 | continue; |
| 269 | 269 | } |
| 270 | 270 | } |
@@ -322,12 +322,12 @@ discard block |
||
| 322 | 322 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
| 323 | 323 | $lines[] = '<xhtml:link rel="alternate"' |
| 324 | 324 | . ' hreflang="x-default"' |
| 325 | - . ' href="' . self::encodeSitemapEntity($altUrl) . '"' |
|
| 325 | + . ' href="'.self::encodeSitemapEntity($altUrl).'"' |
|
| 326 | 326 | . ' />'; |
| 327 | 327 | } |
| 328 | 328 | $lines[] = '<xhtml:link rel="alternate"' |
| 329 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
| 330 | - . ' href="' . self::encodeSitemapEntity($altUrl) . '"' |
|
| 329 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
| 330 | + . ' href="'.self::encodeSitemapEntity($altUrl).'"' |
|
| 331 | 331 | . ' />'; |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
| 339 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 339 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 340 | 340 | $now = new DateTime(); |
| 341 | 341 | $interval = $now->diff($dateUpdated); |
| 342 | 342 | if ($interval->days <= 2) { |
@@ -346,11 +346,11 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | $lines[] = '<news:news>'; |
| 348 | 348 | $lines[] = '<news:publication>'; |
| 349 | - $lines[] = '<news:name>' . self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName) . '</news:name>'; |
|
| 350 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
| 349 | + $lines[] = '<news:name>'.self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName).'</news:name>'; |
|
| 350 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
| 351 | 351 | $lines[] = '</news:publication>'; |
| 352 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
| 353 | - $lines[] = '<news:title>' . self::encodeSitemapEntity($element->title) . '</news:title>'; |
|
| 352 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
| 353 | + $lines[] = '<news:title>'.self::encodeSitemapEntity($element->title).'</news:title>'; |
|
| 354 | 354 | $lines[] = '</news:news>'; |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | $attributes = array_intersect_key( |
| 573 | 573 | $attributes, |
| 574 | - array_flip((array)$seoSettingsField->sitemapEnabledFields) |
|
| 574 | + array_flip((array) $seoSettingsField->sitemapEnabledFields) |
|
| 575 | 575 | ); |
| 576 | 576 | $attributes = array_filter( |
| 577 | 577 | $attributes, |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | */ |
| 604 | 604 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 605 | 605 | { |
| 606 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 606 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 607 | 607 | switch ($asset->kind) { |
| 608 | 608 | case 'image': |
| 609 | 609 | $transform = Craft::$app->getImageTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | $fieldName = $row['field'] ?? ''; |
| 617 | 617 | $propName = $row['property'] ?? ''; |
| 618 | 618 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 619 | - $lines[] = '<image:' . $propName . '>'; |
|
| 619 | + $lines[] = '<image:'.$propName.'>'; |
|
| 620 | 620 | $lines[] = self::encodeSitemapEntity($asset[$fieldName]); |
| 621 | - $lines[] = '</image:' . $propName . '>'; |
|
| 621 | + $lines[] = '</image:'.$propName.'>'; |
|
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | 624 | $lines[] = '</image:image>'; |
@@ -634,9 +634,9 @@ discard block |
||
| 634 | 634 | $fieldName = $row['field'] ?? ''; |
| 635 | 635 | $propName = $row['property'] ?? ''; |
| 636 | 636 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 637 | - $lines[] = '<video:' . $propName . '>'; |
|
| 637 | + $lines[] = '<video:'.$propName.'>'; |
|
| 638 | 638 | $lines[] = self::encodeSitemapEntity($asset[$fieldName]); |
| 639 | - $lines[] = '</video:' . $propName . '>'; |
|
| 639 | + $lines[] = '</video:'.$propName.'>'; |
|
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | $lines[] = '</video:video>'; |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | */ |
| 653 | 653 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 654 | 654 | { |
| 655 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 655 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 656 | 656 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 657 | 657 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
| 658 | 658 | $lines[] = '<url>'; |
@@ -90,25 +90,25 @@ |
||
| 90 | 90 | } |
| 91 | 91 | // Get our cache key |
| 92 | 92 | $asArrayKey = $asArray ? 'true' : 'false'; |
| 93 | - $cacheKey = $uri . $siteId . implode($containerKeys) . $asArrayKey . Seomatic::$environment . $token; |
|
| 93 | + $cacheKey = $uri.$siteId.implode($containerKeys).$asArrayKey.Seomatic::$environment.$token; |
|
| 94 | 94 | // Load the meta containers |
| 95 | 95 | $dependency = new TagDependency([ |
| 96 | 96 | 'tags' => [ |
| 97 | 97 | $metaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
| 98 | - $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType . $siteId, |
|
| 99 | - $metaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
| 100 | - $metaContainers::METACONTAINER_CACHE_TAG . $cacheKey, |
|
| 101 | - $metaContainers::METACONTAINER_CACHE_TAG . $sourceId . $sourceBundleType, |
|
| 98 | + $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType.$siteId, |
|
| 99 | + $metaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
| 100 | + $metaContainers::METACONTAINER_CACHE_TAG.$cacheKey, |
|
| 101 | + $metaContainers::METACONTAINER_CACHE_TAG.$sourceId.$sourceBundleType, |
|
| 102 | 102 | ], |
| 103 | 103 | ]); |
| 104 | 104 | |
| 105 | 105 | $cache = Craft::$app->getCache(); |
| 106 | 106 | $result = $cache->getOrSet( |
| 107 | - self::CACHE_KEY . $cacheKey, |
|
| 107 | + self::CACHE_KEY.$cacheKey, |
|
| 108 | 108 | function() use ($uri, $siteId, $containerKeys, $asArray) { |
| 109 | 109 | $result = []; |
| 110 | 110 | Craft::info( |
| 111 | - 'Meta controller container cache miss: ' . $uri . '/' . $siteId, |
|
| 111 | + 'Meta controller container cache miss: '.$uri.'/'.$siteId, |
|
| 112 | 112 | __METHOD__ |
| 113 | 113 | ); |
| 114 | 114 | // Load the meta containers and parse our globals |