@@ -43,11 +43,11 @@ discard block |
||
| 43 | 43 | // Constants |
| 44 | 44 | // ========================================================================= |
| 45 | 45 | |
| 46 | - const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapIndexTemplate::TEMPLATE_TYPE; |
|
| 46 | + const SEOMATIC_SITEMAPINDEX_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapIndexTemplate::TEMPLATE_TYPE; |
|
| 47 | 47 | |
| 48 | - const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapTemplate::TEMPLATE_TYPE; |
|
| 48 | + const SEOMATIC_SITEMAP_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapTemplate::TEMPLATE_TYPE; |
|
| 49 | 49 | |
| 50 | - const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE . SitemapCustomTemplate::TEMPLATE_TYPE; |
|
| 50 | + const SEOMATIC_SITEMAPCUSTOM_CONTAINER = Seomatic::SEOMATIC_HANDLE.SitemapCustomTemplate::TEMPLATE_TYPE; |
|
| 51 | 51 | |
| 52 | 52 | const SEARCH_ENGINE_SUBMISSION_URLS = [ |
| 53 | 53 | ]; |
@@ -247,19 +247,19 @@ discard block |
||
| 247 | 247 | $siteId = $groupSiteIds[0]; |
| 248 | 248 | $sitemapIndexUrl = $this->sitemapIndexUrlForSiteId($siteId); |
| 249 | 249 | if (!empty($sitemapIndexUrl)) { |
| 250 | - $submissionUrl = $url . urlencode($sitemapIndexUrl); |
|
| 250 | + $submissionUrl = $url.urlencode($sitemapIndexUrl); |
|
| 251 | 251 | // create new guzzle client |
| 252 | 252 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
| 253 | 253 | // Submit the sitemap index to each search engine |
| 254 | 254 | try { |
| 255 | 255 | $guzzleClient->post($submissionUrl); |
| 256 | 256 | Craft::info( |
| 257 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
| 257 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
| 258 | 258 | __METHOD__ |
| 259 | 259 | ); |
| 260 | 260 | } catch (\Exception $e) { |
| 261 | 261 | Craft::error( |
| 262 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 262 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 263 | 263 | __METHOD__ |
| 264 | 264 | ); |
| 265 | 265 | } |
@@ -321,19 +321,19 @@ discard block |
||
| 321 | 321 | foreach ($searchEngineUrls as &$url) { |
| 322 | 322 | $sitemapUrl = $this->sitemapUrlForBundle($sourceBundleType, $sourceHandle, $sourceSiteId); |
| 323 | 323 | if (!empty($sitemapUrl)) { |
| 324 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
| 324 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
| 325 | 325 | // create new guzzle client |
| 326 | 326 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
| 327 | 327 | // Submit the sitemap index to each search engine |
| 328 | 328 | try { |
| 329 | 329 | $guzzleClient->post($submissionUrl); |
| 330 | 330 | Craft::info( |
| 331 | - 'Sitemap index submitted to: ' . $submissionUrl, |
|
| 331 | + 'Sitemap index submitted to: '.$submissionUrl, |
|
| 332 | 332 | __METHOD__ |
| 333 | 333 | ); |
| 334 | 334 | } catch (\Exception $e) { |
| 335 | 335 | Craft::error( |
| 336 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 336 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 337 | 337 | __METHOD__ |
| 338 | 338 | ); |
| 339 | 339 | } |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | . '-' |
| 375 | 375 | . $metaBundle->sourceSiteId |
| 376 | 376 | . '-sitemap' |
| 377 | - . (!empty($page) ? '-p' . $page : '') |
|
| 377 | + . (!empty($page) ? '-p'.$page : '') |
|
| 378 | 378 | . '.xml', |
| 379 | 379 | null, |
| 380 | 380 | null, |
@@ -403,19 +403,19 @@ discard block |
||
| 403 | 403 | foreach ($searchEngineUrls as &$url) { |
| 404 | 404 | $sitemapUrl = $this->sitemapCustomUrlForSiteId($siteId); |
| 405 | 405 | if (!empty($sitemapUrl)) { |
| 406 | - $submissionUrl = $url . urlencode($sitemapUrl); |
|
| 406 | + $submissionUrl = $url.urlencode($sitemapUrl); |
|
| 407 | 407 | // create new guzzle client |
| 408 | 408 | $guzzleClient = Craft::createGuzzleClient(['timeout' => 5, 'connect_timeout' => 5]); |
| 409 | 409 | // Submit the sitemap index to each search engine |
| 410 | 410 | try { |
| 411 | 411 | $guzzleClient->post($submissionUrl); |
| 412 | 412 | Craft::info( |
| 413 | - 'Sitemap Custom submitted to: ' . $submissionUrl, |
|
| 413 | + 'Sitemap Custom submitted to: '.$submissionUrl, |
|
| 414 | 414 | __METHOD__ |
| 415 | 415 | ); |
| 416 | 416 | } catch (\Exception $e) { |
| 417 | 417 | Craft::error( |
| 418 | - 'Error submitting sitemap index to: ' . $submissionUrl . ' - ' . $e->getMessage(), |
|
| 418 | + 'Error submitting sitemap index to: '.$submissionUrl.' - '.$e->getMessage(), |
|
| 419 | 419 | __METHOD__ |
| 420 | 420 | ); |
| 421 | 421 | } |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | foreach ($sites as $site) { |
| 496 | - $result .= 'sitemap: ' . $this->sitemapIndexUrlForSiteId($site->id) . PHP_EOL; |
|
| 496 | + $result .= 'sitemap: '.$this->sitemapIndexUrlForSiteId($site->id).PHP_EOL; |
|
| 497 | 497 | } |
| 498 | 498 | |
| 499 | 499 | return rtrim($result, PHP_EOL); |
@@ -524,9 +524,9 @@ discard block |
||
| 524 | 524 | { |
| 525 | 525 | // Always just invalidate the sitemap cache now, since we're doing paginated sitemaps |
| 526 | 526 | $cache = Craft::$app->getCache(); |
| 527 | - TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
| 527 | + TagDependency::invalidate($cache, SitemapTemplate::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
| 528 | 528 | Craft::info( |
| 529 | - 'Sitemap cache cleared: ' . $handle, |
|
| 529 | + 'Sitemap cache cleared: '.$handle, |
|
| 530 | 530 | __METHOD__ |
| 531 | 531 | ); |
| 532 | 532 | } |
@@ -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 | } |
@@ -509,8 +509,8 @@ discard block |
||
| 509 | 509 | string $sourceBundleType, |
| 510 | 510 | string $sourceHandle, |
| 511 | 511 | string $siteHandle = null, |
| 512 | - $typeId = null, |
|
| 513 | - $loadFromSiteHandle = null |
|
| 512 | + $typeId = null, |
|
| 513 | + $loadFromSiteHandle = null |
|
| 514 | 514 | ): Response { |
| 515 | 515 | $variables = []; |
| 516 | 516 | // @TODO: Let people choose an entry/categorygroup/product as the preview |
@@ -1226,7 +1226,7 @@ discard block |
||
| 1226 | 1226 | string $sourceHandle, |
| 1227 | 1227 | string $groupName, |
| 1228 | 1228 | array &$variables, |
| 1229 | - $typeId = null |
|
| 1229 | + $typeId = null |
|
| 1230 | 1230 | ) { |
| 1231 | 1231 | $variables['textFieldSources'] = array_merge( |
| 1232 | 1232 | ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
| 132 | 132 | $variables['title'] = $templateTitle; |
| 133 | 133 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
| 134 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 134 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 135 | 135 | $variables['crumbs'] = [ |
| 136 | 136 | [ |
| 137 | 137 | 'label' => $pluginName, |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ], |
| 140 | 140 | [ |
| 141 | 141 | 'label' => $templateTitle, |
| 142 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
| 142 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
| 143 | 143 | ], |
| 144 | 144 | ]; |
| 145 | 145 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -162,11 +162,11 @@ discard block |
||
| 162 | 162 | foreach ($variables['metaBundles'] as $metaBundle) { |
| 163 | 163 | $stat = 0; |
| 164 | 164 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
| 165 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 165 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 166 | 166 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
| 167 | 167 | $variables['contentSetupChecklist'][$setupField] = [ |
| 168 | 168 | 'label' => $setupLabel, |
| 169 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 169 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 170 | 170 | ]; |
| 171 | 171 | } |
| 172 | 172 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -177,16 +177,16 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | // Global SEO grades |
| 179 | 179 | Seomatic::$previewingMetaContainers = true; |
| 180 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
| 180 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
| 181 | 181 | Seomatic::$previewingMetaContainers = false; |
| 182 | 182 | if ($metaBundle !== null) { |
| 183 | 183 | $stat = 0; |
| 184 | 184 | $variables['globalSetupChecklist'] = []; |
| 185 | 185 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
| 186 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 186 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
| 187 | 187 | $variables['globalSetupChecklist'][$setupField] = [ |
| 188 | 188 | 'label' => $setupLabel, |
| 189 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 189 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
| 190 | 190 | ]; |
| 191 | 191 | } |
| 192 | 192 | $stat = round(($stat / $numFields) * 100); |
@@ -196,17 +196,17 @@ discard block |
||
| 196 | 196 | $stat = 0; |
| 197 | 197 | $variables['siteSetupChecklist'] = []; |
| 198 | 198 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
| 199 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
| 199 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
| 200 | 200 | $variables['siteSetupChecklist'][$setupField] = [ |
| 201 | 201 | 'label' => $setupLabel, |
| 202 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
| 202 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
| 203 | 203 | ]; |
| 204 | 204 | } |
| 205 | 205 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
| 206 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
| 206 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
| 207 | 207 | $variables['siteSetupChecklist'][$setupField] = [ |
| 208 | 208 | 'label' => $setupLabel, |
| 209 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
| 209 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
| 210 | 210 | ]; |
| 211 | 211 | } |
| 212 | 212 | $stat = round(($stat / $numFields) * 100); |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $variables['title'] = $templateTitle; |
| 254 | 254 | $variables['subSectionTitle'] = $subSectionTitle; |
| 255 | 255 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 256 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 256 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 257 | 257 | $variables['crumbs'] = [ |
| 258 | 258 | [ |
| 259 | 259 | 'label' => $pluginName, |
@@ -261,11 +261,11 @@ discard block |
||
| 261 | 261 | ], |
| 262 | 262 | [ |
| 263 | 263 | 'label' => $templateTitle, |
| 264 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
| 264 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
| 265 | 265 | ], |
| 266 | 266 | [ |
| 267 | 267 | 'label' => $subSectionTitle, |
| 268 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
| 268 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
| 269 | 269 | ], |
| 270 | 270 | ]; |
| 271 | 271 | $variables['selectedSubnavItem'] = 'global'; |
@@ -273,14 +273,14 @@ discard block |
||
| 273 | 273 | $this->setGlobalFieldSourceVariables($variables); |
| 274 | 274 | // Enabled sites |
| 275 | 275 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 276 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
| 276 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
| 277 | 277 | $variables['currentSubSection'] = $subSection; |
| 278 | 278 | // Meta bundle settings |
| 279 | 279 | Seomatic::$previewingMetaContainers = true; |
| 280 | 280 | // Get the site to copy the settings from, if any |
| 281 | 281 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 282 | 282 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 283 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 283 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 284 | 284 | // Load the metabundle |
| 285 | 285 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 286 | 286 | if ($editedMetaBundle) { |
@@ -334,11 +334,11 @@ discard block |
||
| 334 | 334 | // Preview the meta containers |
| 335 | 335 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 336 | 336 | MetaBundles::GLOBAL_META_BUNDLE, |
| 337 | - (int)$variables['currentSiteId'] |
|
| 337 | + (int) $variables['currentSiteId'] |
|
| 338 | 338 | ); |
| 339 | 339 | |
| 340 | 340 | // Render the template |
| 341 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
| 341 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
| 470 | 470 | $variables['title'] = $templateTitle; |
| 471 | 471 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
| 472 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 472 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 473 | 473 | $variables['crumbs'] = [ |
| 474 | 474 | [ |
| 475 | 475 | 'label' => $pluginName, |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | ], |
| 478 | 478 | [ |
| 479 | 479 | 'label' => $templateTitle, |
| 480 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
| 480 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
| 481 | 481 | ], |
| 482 | 482 | ]; |
| 483 | 483 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | // Get the site to edit |
| 518 | 518 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 519 | 519 | if (is_string($typeId)) { |
| 520 | - $typeId = (int)$typeId; |
|
| 520 | + $typeId = (int) $typeId; |
|
| 521 | 521 | } |
| 522 | 522 | if (empty($typeId)) { |
| 523 | 523 | $typeId = null; |
@@ -535,7 +535,7 @@ discard block |
||
| 535 | 535 | $currentType = reset($typeMenu); |
| 536 | 536 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
| 537 | 537 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
| 538 | - $typeId = (int)$variables['currentTypeId']; |
|
| 538 | + $typeId = (int) $variables['currentTypeId']; |
|
| 539 | 539 | } |
| 540 | 540 | // If there's only one EntryType, don't bother displaying the menu |
| 541 | 541 | if (count($typeMenu) === 1) { |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | // Get the site to copy the settings from, if any |
| 568 | 568 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 569 | 569 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 570 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 570 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 571 | 571 | // Load the metabundle |
| 572 | 572 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
| 573 | 573 | $sourceBundleType, |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $variables['title'] = $templateTitle; |
| 594 | 594 | $variables['subSectionTitle'] = $subSectionTitle; |
| 595 | 595 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
| 596 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 596 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 597 | 597 | $variables['siteHandleUri'] = $siteHandleUri; |
| 598 | 598 | $variables['crumbs'] = [ |
| 599 | 599 | [ |
@@ -602,10 +602,10 @@ discard block |
||
| 602 | 602 | ], |
| 603 | 603 | [ |
| 604 | 604 | 'label' => 'Content SEO', |
| 605 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
| 605 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
| 606 | 606 | ], |
| 607 | 607 | [ |
| 608 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
| 608 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
| 609 | 609 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
| 610 | 610 | ], |
| 611 | 611 | ]; |
@@ -635,13 +635,13 @@ discard block |
||
| 635 | 635 | // Preview the meta containers |
| 636 | 636 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 637 | 637 | $uri, |
| 638 | - (int)$variables['currentSiteId'], |
|
| 638 | + (int) $variables['currentSiteId'], |
|
| 639 | 639 | false, |
| 640 | 640 | false |
| 641 | 641 | ); |
| 642 | 642 | |
| 643 | 643 | // Render the template |
| 644 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
| 644 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
| 645 | 645 | } |
| 646 | 646 | |
| 647 | 647 | /** |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | $bundleSettings = $request->getParam('metaBundleSettings'); |
| 663 | 663 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
| 664 | 664 | if (is_string($typeId)) { |
| 665 | - $typeId = (int)$typeId; |
|
| 665 | + $typeId = (int) $typeId; |
|
| 666 | 666 | } |
| 667 | 667 | // Set the element type in the template |
| 668 | 668 | $elementName = ''; |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | if ($subSection === 'social') { |
| 734 | 734 | $subSectionSuffix = ' Media'; |
| 735 | 735 | } |
| 736 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
| 736 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
| 737 | 737 | // Asset bundle |
| 738 | 738 | try { |
| 739 | 739 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | $variables['title'] = $templateTitle; |
| 752 | 752 | $variables['subSectionTitle'] = $subSectionTitle; |
| 753 | 753 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 754 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 754 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 755 | 755 | $variables['crumbs'] = [ |
| 756 | 756 | [ |
| 757 | 757 | 'label' => $pluginName, |
@@ -759,11 +759,11 @@ discard block |
||
| 759 | 759 | ], |
| 760 | 760 | [ |
| 761 | 761 | 'label' => $templateTitle, |
| 762 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
| 762 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
| 763 | 763 | ], |
| 764 | 764 | [ |
| 765 | 765 | 'label' => $subSectionTitle, |
| 766 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
| 766 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
| 767 | 767 | ], |
| 768 | 768 | ]; |
| 769 | 769 | $variables['selectedSubnavItem'] = 'site'; |
@@ -771,14 +771,14 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | // Enabled sites |
| 773 | 773 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 774 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
| 774 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
| 775 | 775 | |
| 776 | 776 | // The site settings for the appropriate meta bundle |
| 777 | 777 | Seomatic::$previewingMetaContainers = true; |
| 778 | 778 | // Get the site to copy the settings from, if any |
| 779 | 779 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 780 | 780 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 781 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 781 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 782 | 782 | // Load the metabundle |
| 783 | 783 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 784 | 784 | Seomatic::$previewingMetaContainers = false; |
@@ -796,7 +796,7 @@ discard block |
||
| 796 | 796 | $variables['elementType'] = Asset::class; |
| 797 | 797 | |
| 798 | 798 | // Render the template |
| 799 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
| 799 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
| 800 | 800 | } |
| 801 | 801 | |
| 802 | 802 | /** |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 930 | 930 | // Enabled sites |
| 931 | 931 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 932 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
| 932 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
| 933 | 933 | $variables['currentSubSection'] = $subSection; |
| 934 | 934 | |
| 935 | 935 | // The script meta containers for the global meta bundle |
@@ -937,7 +937,7 @@ discard block |
||
| 937 | 937 | // Get the site to copy the settings from, if any |
| 938 | 938 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
| 939 | 939 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
| 940 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
| 940 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
| 941 | 941 | // Load the metabundle |
| 942 | 942 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
| 943 | 943 | if ($editedMetaBundle) { |
@@ -977,7 +977,7 @@ discard block |
||
| 977 | 977 | $variables['title'] = $templateTitle; |
| 978 | 978 | $variables['subSectionTitle'] = $subSectionTitle; |
| 979 | 979 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
| 980 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
| 980 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
| 981 | 981 | $variables['crumbs'] = [ |
| 982 | 982 | [ |
| 983 | 983 | 'label' => $pluginName, |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | ], |
| 990 | 990 | [ |
| 991 | 991 | 'label' => $subSectionTitle, |
| 992 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
| 992 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
| 993 | 993 | ], |
| 994 | 994 | ]; |
| 995 | 995 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | if ($siteHandle !== null) { |
| 1129 | 1129 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
| 1130 | 1130 | if (!$site) { |
| 1131 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
| 1131 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
| 1132 | 1132 | } |
| 1133 | 1133 | $siteId = $site->id; |
| 1134 | 1134 | } else { |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | if (!empty($variables['enabledSiteIds'])) { |
| 1165 | 1165 | $siteId = reset($variables['enabledSiteIds']); |
| 1166 | 1166 | } else { |
| 1167 | - $this->requirePermission('editSite:' . $siteId); |
|
| 1167 | + $this->requirePermission('editSite:'.$siteId); |
|
| 1168 | 1168 | } |
| 1169 | 1169 | } |
| 1170 | 1170 | } |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | if ($variables['showSites']) { |
| 1185 | 1185 | $variables['sitesMenuLabel'] = Craft::t( |
| 1186 | 1186 | 'site', |
| 1187 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
| 1187 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
| 1188 | 1188 | ); |
| 1189 | 1189 | } else { |
| 1190 | 1190 | $variables['sitesMenuLabel'] = ''; |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | $typeId = null |
| 1252 | 1252 | ) { |
| 1253 | 1253 | $variables['textFieldSources'] = array_merge( |
| 1254 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
| 1254 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 1255 | 1255 | FieldHelper::fieldsOfTypeFromSource( |
| 1256 | 1256 | $sourceBundleType, |
| 1257 | 1257 | $sourceHandle, |
@@ -1261,7 +1261,7 @@ discard block |
||
| 1261 | 1261 | ) |
| 1262 | 1262 | ); |
| 1263 | 1263 | $variables['assetFieldSources'] = array_merge( |
| 1264 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
| 1264 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 1265 | 1265 | FieldHelper::fieldsOfTypeFromSource( |
| 1266 | 1266 | $sourceBundleType, |
| 1267 | 1267 | $sourceHandle, |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | ->limit($metaBundle->metaSitemapVars->sitemapLimit); |
| 223 | 223 | if ($metaBundle->sourceType === 'structure' |
| 224 | 224 | && !empty($metaBundle->metaSitemapVars->structureDepth)) { |
| 225 | - $query->level($metaBundle->metaSitemapVars->structureDepth . '<='); |
|
| 225 | + $query->level($metaBundle->metaSitemapVars->structureDepth.'<='); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | return $query; |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | if (!empty($typeId)) { |
| 271 | 271 | $query |
| 272 | 272 | ->andWhere([ |
| 273 | - 'typeId' => (int)$typeId, |
|
| 273 | + 'typeId' => (int) $typeId, |
|
| 274 | 274 | ]); |
| 275 | 275 | } |
| 276 | 276 | $element = $query->one(); |
@@ -397,7 +397,7 @@ discard block |
||
| 397 | 397 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
| 398 | 398 | [ |
| 399 | 399 | 'sourceId' => $sourceModel->id, |
| 400 | - 'sourceName' => (string)$sourceModel->name, |
|
| 400 | + 'sourceName' => (string) $sourceModel->name, |
|
| 401 | 401 | 'sourceHandle' => $sourceModel->handle, |
| 402 | 402 | 'sourceType' => $sourceModel->type, |
| 403 | 403 | ] |
@@ -64,7 +64,7 @@ |
||
| 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 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if ($multiSite) { |
| 139 | 139 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
| 140 | 140 | } |
| 141 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 141 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 142 | 142 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
| 143 | 143 | } |
| 144 | 144 | $urlsetLine .= '>'; |
@@ -214,13 +214,13 @@ discard block |
||
| 214 | 214 | $paginator->getTotalPages(), |
| 215 | 215 | $paginator->getTotalResults()); |
| 216 | 216 | } |
| 217 | - echo $message . PHP_EOL; |
|
| 217 | + echo $message.PHP_EOL; |
|
| 218 | 218 | } |
| 219 | 219 | /** @var Element $element */ |
| 220 | 220 | foreach ($elements as $element) { |
| 221 | 221 | // Output some info if this is a console app |
| 222 | 222 | if (Craft::$app instanceof ConsoleApplication) { |
| 223 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
| 223 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | } |
| 269 | 269 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
| 270 | 270 | if ($url !== $canonicalUrl) { |
| 271 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
| 271 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
| 272 | 272 | continue; |
| 273 | 273 | } |
| 274 | 274 | } |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
| 330 | 330 | $lines[] = '<xhtml:link rel="alternate"' |
| 331 | 331 | . ' hreflang="x-default"' |
| 332 | - . ' href="' . self::encodeSitemapEntity($altUrl) . '"' |
|
| 332 | + . ' href="'.self::encodeSitemapEntity($altUrl).'"' |
|
| 333 | 333 | . ' />'; |
| 334 | 334 | } |
| 335 | 335 | $lines[] = '<xhtml:link rel="alternate"' |
| 336 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
| 337 | - . ' href="' . self::encodeSitemapEntity($altUrl) . '"' |
|
| 336 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
| 337 | + . ' href="'.self::encodeSitemapEntity($altUrl).'"' |
|
| 338 | 338 | . ' />'; |
| 339 | 339 | } |
| 340 | 340 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
| 346 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
| 346 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
| 347 | 347 | $now = new DateTime(); |
| 348 | 348 | $interval = $now->diff($dateUpdated); |
| 349 | 349 | if ($interval->days <= 2) { |
@@ -353,11 +353,11 @@ discard block |
||
| 353 | 353 | } |
| 354 | 354 | $lines[] = '<news:news>'; |
| 355 | 355 | $lines[] = '<news:publication>'; |
| 356 | - $lines[] = '<news:name>' . self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName) . '</news:name>'; |
|
| 357 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
| 356 | + $lines[] = '<news:name>'.self::encodeSitemapEntity($metaBundle->metaSitemapVars->newsPublicationName).'</news:name>'; |
|
| 357 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
| 358 | 358 | $lines[] = '</news:publication>'; |
| 359 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
| 360 | - $lines[] = '<news:title>' . self::encodeSitemapEntity($element->title) . '</news:title>'; |
|
| 359 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
| 360 | + $lines[] = '<news:title>'.self::encodeSitemapEntity($element->title).'</news:title>'; |
|
| 361 | 361 | $lines[] = '</news:news>'; |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | */ |
| 631 | 631 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 632 | 632 | { |
| 633 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 633 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 634 | 634 | switch ($asset->kind) { |
| 635 | 635 | case 'image': |
| 636 | 636 | $transform = Craft::$app->getAssetTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | $fieldName = $row['field'] ?? ''; |
| 644 | 644 | $propName = $row['property'] ?? ''; |
| 645 | 645 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 646 | - $lines[] = '<image:' . $propName . '>'; |
|
| 646 | + $lines[] = '<image:'.$propName.'>'; |
|
| 647 | 647 | $lines[] = self::encodeSitemapEntity($asset[$fieldName]); |
| 648 | - $lines[] = '</image:' . $propName . '>'; |
|
| 648 | + $lines[] = '</image:'.$propName.'>'; |
|
| 649 | 649 | } |
| 650 | 650 | } |
| 651 | 651 | $lines[] = '</image:image>'; |
@@ -661,9 +661,9 @@ discard block |
||
| 661 | 661 | $fieldName = $row['field'] ?? ''; |
| 662 | 662 | $propName = $row['property'] ?? ''; |
| 663 | 663 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
| 664 | - $lines[] = '<video:' . $propName . '>'; |
|
| 664 | + $lines[] = '<video:'.$propName.'>'; |
|
| 665 | 665 | $lines[] = self::encodeSitemapEntity($asset[$fieldName]); |
| 666 | - $lines[] = '</video:' . $propName . '>'; |
|
| 666 | + $lines[] = '</video:'.$propName.'>'; |
|
| 667 | 667 | } |
| 668 | 668 | } |
| 669 | 669 | $lines[] = '</video:video>'; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | */ |
| 680 | 680 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
| 681 | 681 | { |
| 682 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 682 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
| 683 | 683 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
| 684 | 684 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
| 685 | 685 | $lines[] = '<url>'; |
@@ -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 */ |