@@ -238,10 +238,10 @@ |
||
238 | 238 | } |
239 | 239 | // Make sure these are strings |
240 | 240 | if (!empty($this->facebookProfileId)) { |
241 | - $this->facebookProfileId = (string)$this->facebookProfileId; |
|
241 | + $this->facebookProfileId = (string) $this->facebookProfileId; |
|
242 | 242 | } |
243 | 243 | if (!empty($this->facebookAppId)) { |
244 | - $this->facebookAppId = (string)$this->facebookAppId; |
|
244 | + $this->facebookAppId = (string) $this->facebookAppId; |
|
245 | 245 | } |
246 | 246 | // Identity |
247 | 247 | if (is_array($this->identity)) { |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $siteUrl = MetaValue::parseString($siteUrl); |
47 | 47 | // Extract out just the path part |
48 | 48 | $parts = self::decomposeUrl($path); |
49 | - $path = $parts['path'] . $parts['suffix']; |
|
49 | + $path = $parts['path'].$parts['suffix']; |
|
50 | 50 | $url = self::mergeUrlWithPath($siteUrl, $path); |
51 | 51 | // Handle trailing slashes properly for generated URLs |
52 | 52 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
53 | 53 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
54 | - $url = rtrim($url, '/') . '/'; |
|
54 | + $url = rtrim($url, '/').'/'; |
|
55 | 55 | } |
56 | 56 | if (!$generalConfig->addTrailingSlashesToUrls) { |
57 | 57 | $url = rtrim($url, '/'); |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
87 | - return rtrim($url, '/') . '/' . ltrim(substr($path, $overlap), '/'); |
|
87 | + return rtrim($url, '/').'/'.ltrim(substr($path, $overlap), '/'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // Handle trailing slashes properly for generated URLs |
153 | 153 | $generalConfig = Craft::$app->getConfig()->getGeneral(); |
154 | 154 | if ($generalConfig->addTrailingSlashesToUrls && !preg_match('/(.+\?.*)|(\.[^\/]+$)/', $url)) { |
155 | - $url = rtrim($url, '/') . '/'; |
|
155 | + $url = rtrim($url, '/').'/'; |
|
156 | 156 | } |
157 | 157 | if (!$generalConfig->addTrailingSlashesToUrls) { |
158 | 158 | $url = rtrim($url, '/'); |
@@ -172,13 +172,13 @@ discard block |
||
172 | 172 | $urlParts = parse_url($url); |
173 | 173 | $encodedUrl = ""; |
174 | 174 | if (isset($urlParts['scheme'])) { |
175 | - $encodedUrl .= $urlParts['scheme'] . '://'; |
|
175 | + $encodedUrl .= $urlParts['scheme'].'://'; |
|
176 | 176 | } |
177 | 177 | if (isset($urlParts['host'])) { |
178 | 178 | $encodedUrl .= $urlParts['host']; |
179 | 179 | } |
180 | 180 | if (isset($urlParts['port'])) { |
181 | - $encodedUrl .= ':' . $urlParts['port']; |
|
181 | + $encodedUrl .= ':'.$urlParts['port']; |
|
182 | 182 | } |
183 | 183 | if (isset($urlParts['path'])) { |
184 | 184 | $encodedUrl .= $urlParts['path']; |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | foreach ($query as $j => $value) { |
189 | 189 | $value = explode('=', $value, 2); |
190 | 190 | if (count($value) === 2) { |
191 | - $query[$j] = urlencode($value[0]) . '=' . urlencode($value[1]); |
|
191 | + $query[$j] = urlencode($value[0]).'='.urlencode($value[1]); |
|
192 | 192 | } else { |
193 | 193 | $query[$j] = urlencode($value[0]); |
194 | 194 | } |
195 | 195 | } |
196 | - $encodedUrl .= '?' . implode('&', $query); |
|
196 | + $encodedUrl .= '?'.implode('&', $query); |
|
197 | 197 | } |
198 | 198 | if (isset($urlParts['fragment'])) { |
199 | - $encodedUrl .= '#' . $urlParts['fragment']; |
|
199 | + $encodedUrl .= '#'.$urlParts['fragment']; |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | return $encodedUrl; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | if ($siteId !== null) { |
237 | 237 | $site = $sites->getSiteById($siteId, true); |
238 | 238 | if (!$site) { |
239 | - throw new Exception('Invalid site ID: ' . $siteId); |
|
239 | + throw new Exception('Invalid site ID: '.$siteId); |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
@@ -260,11 +260,11 @@ discard block |
||
260 | 260 | |
261 | 261 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
262 | 262 | $url_parts = parse_url($pathOrUrl); |
263 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
263 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
264 | 264 | $result['path'] = $url_parts['path'] ?? ''; |
265 | 265 | $result['suffix'] = ''; |
266 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
267 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
266 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
267 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
268 | 268 | } else { |
269 | 269 | $result['prefix'] = ''; |
270 | 270 | $result['path'] = $pathOrUrl; |
@@ -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 | // Get the (entry) type menu |
523 | 523 | $typeMenu = []; |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $currentType = reset($typeMenu); |
532 | 532 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
533 | 533 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
534 | - $typeId = (int)$variables['currentTypeId']; |
|
534 | + $typeId = (int) $variables['currentTypeId']; |
|
535 | 535 | } |
536 | 536 | $pluginName = Seomatic::$settings->pluginName; |
537 | 537 | // Asset bundle |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | // Get the site to copy the settings from, if any |
553 | 553 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
554 | 554 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
555 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
555 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
556 | 556 | // Load the metabundle |
557 | 557 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
558 | 558 | $sourceBundleType, |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | $variables['title'] = $templateTitle; |
579 | 579 | $variables['subSectionTitle'] = $subSectionTitle; |
580 | 580 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
581 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
581 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
582 | 582 | $variables['siteHandleUri'] = $siteHandleUri; |
583 | 583 | $variables['crumbs'] = [ |
584 | 584 | [ |
@@ -587,10 +587,10 @@ discard block |
||
587 | 587 | ], |
588 | 588 | [ |
589 | 589 | 'label' => 'Content SEO', |
590 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
590 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
591 | 591 | ], |
592 | 592 | [ |
593 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
593 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
594 | 594 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
595 | 595 | ], |
596 | 596 | ]; |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | // Preview the meta containers |
621 | 621 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
622 | 622 | $uri, |
623 | - (int)$variables['currentSiteId'], |
|
623 | + (int) $variables['currentSiteId'], |
|
624 | 624 | false, |
625 | 625 | false |
626 | 626 | ); |
627 | 627 | |
628 | 628 | // Render the template |
629 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
629 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
630 | 630 | } |
631 | 631 | |
632 | 632 | /** |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | $bundleSettings = $request->getParam('metaBundleSettings'); |
647 | 647 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
648 | 648 | if (is_string($typeId)) { |
649 | - $typeId = (int)$typeId; |
|
649 | + $typeId = (int) $typeId; |
|
650 | 650 | } |
651 | 651 | // Set the element type in the template |
652 | 652 | $elementName = ''; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | if ($subSection === 'social') { |
712 | 712 | $subSectionSuffix = ' Media'; |
713 | 713 | } |
714 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
714 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
715 | 715 | // Asset bundle |
716 | 716 | try { |
717 | 717 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | $variables['title'] = $templateTitle; |
730 | 730 | $variables['subSectionTitle'] = $subSectionTitle; |
731 | 731 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
732 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
732 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
733 | 733 | $variables['crumbs'] = [ |
734 | 734 | [ |
735 | 735 | 'label' => $pluginName, |
@@ -737,11 +737,11 @@ discard block |
||
737 | 737 | ], |
738 | 738 | [ |
739 | 739 | 'label' => $templateTitle, |
740 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
740 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
741 | 741 | ], |
742 | 742 | [ |
743 | 743 | 'label' => $subSectionTitle, |
744 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
744 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
745 | 745 | ], |
746 | 746 | ]; |
747 | 747 | $variables['selectedSubnavItem'] = 'site'; |
@@ -749,14 +749,14 @@ discard block |
||
749 | 749 | |
750 | 750 | // Enabled sites |
751 | 751 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
752 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
752 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
753 | 753 | |
754 | 754 | // The site settings for the appropriate meta bundle |
755 | 755 | Seomatic::$previewingMetaContainers = true; |
756 | 756 | // Get the site to copy the settings from, if any |
757 | 757 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
758 | 758 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
759 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
759 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
760 | 760 | // Load the metabundle |
761 | 761 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
762 | 762 | Seomatic::$previewingMetaContainers = false; |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $variables['elementType'] = Asset::class; |
775 | 775 | |
776 | 776 | // Render the template |
777 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
777 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
906 | 906 | // Enabled sites |
907 | 907 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
908 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
908 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
909 | 909 | $variables['currentSubSection'] = $subSection; |
910 | 910 | |
911 | 911 | // The script meta containers for the global meta bundle |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | // Get the site to copy the settings from, if any |
914 | 914 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
915 | 915 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
916 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
916 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
917 | 917 | // Load the metabundle |
918 | 918 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
919 | 919 | if ($editedMetaBundle) { |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $variables['title'] = $templateTitle; |
954 | 954 | $variables['subSectionTitle'] = $subSectionTitle; |
955 | 955 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
956 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
956 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
957 | 957 | $variables['crumbs'] = [ |
958 | 958 | [ |
959 | 959 | 'label' => $pluginName, |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | ], |
966 | 966 | [ |
967 | 967 | 'label' => $subSectionTitle, |
968 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
968 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
969 | 969 | ], |
970 | 970 | ]; |
971 | 971 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | if ($siteHandle !== null) { |
1105 | 1105 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
1106 | 1106 | if (!$site) { |
1107 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
1107 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
1108 | 1108 | } |
1109 | 1109 | $siteId = $site->id; |
1110 | 1110 | } else { |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | if (!empty($variables['enabledSiteIds'])) { |
1141 | 1141 | $siteId = reset($variables['enabledSiteIds']); |
1142 | 1142 | } else { |
1143 | - $this->requirePermission('editSite:' . $siteId); |
|
1143 | + $this->requirePermission('editSite:'.$siteId); |
|
1144 | 1144 | } |
1145 | 1145 | } |
1146 | 1146 | } |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | if ($variables['showSites']) { |
1161 | 1161 | $variables['sitesMenuLabel'] = Craft::t( |
1162 | 1162 | 'site', |
1163 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1163 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1164 | 1164 | ); |
1165 | 1165 | } else { |
1166 | 1166 | $variables['sitesMenuLabel'] = ''; |
@@ -1225,7 +1225,7 @@ discard block |
||
1225 | 1225 | array &$variables |
1226 | 1226 | ) { |
1227 | 1227 | $variables['textFieldSources'] = array_merge( |
1228 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
1228 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
1229 | 1229 | FieldHelper::fieldsOfTypeFromSource( |
1230 | 1230 | $sourceBundleType, |
1231 | 1231 | $sourceHandle, |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | ) |
1235 | 1235 | ); |
1236 | 1236 | $variables['assetFieldSources'] = array_merge( |
1237 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
1237 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
1238 | 1238 | FieldHelper::fieldsOfTypeFromSource( |
1239 | 1239 | $sourceBundleType, |
1240 | 1240 | $sourceHandle, |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | if ($element !== null && $element->uri !== null) { |
377 | 377 | $siteId = $element->siteId; |
378 | 378 | $uri = $element->uri; |
379 | - $cacheKey = self::CACHE_KEY . $uri . $siteId . $this->elementDisplayPreviewType; |
|
379 | + $cacheKey = self::CACHE_KEY.$uri.$siteId.$this->elementDisplayPreviewType; |
|
380 | 380 | $metaBundleSourceType = Seomatic::$plugin->seoElements->getMetaBundleTypeFromElement($element); |
381 | 381 | $seoElement = Seomatic::$plugin->seoElements->getSeoElementByMetaBundleType($metaBundleSourceType); |
382 | 382 | $metaBundleSourceType = SeoEntry::getMetaBundleType(); |
@@ -387,14 +387,14 @@ discard block |
||
387 | 387 | $dependency = new TagDependency([ |
388 | 388 | 'tags' => [ |
389 | 389 | MetaContainers::GLOBAL_METACONTAINER_CACHE_TAG, |
390 | - MetaContainers::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
391 | - MetaContainers::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
390 | + MetaContainers::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
391 | + MetaContainers::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
392 | 392 | ], |
393 | 393 | ]); |
394 | 394 | $cache = Craft::$app->getCache(); |
395 | 395 | $cacheDuration = null; |
396 | 396 | $html = $cache->getOrSet( |
397 | - self::CACHE_KEY . $cacheKey, |
|
397 | + self::CACHE_KEY.$cacheKey, |
|
398 | 398 | function() use ($uri, $siteId, $element) { |
399 | 399 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true, true, $element); |
400 | 400 | $variables = [ |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | array &$variables |
437 | 437 | ) { |
438 | 438 | $variables['textFieldSources'] = array_merge( |
439 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
439 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
440 | 440 | FieldHelper::fieldsOfTypeFromElement( |
441 | 441 | $element, |
442 | 442 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | ) |
445 | 445 | ); |
446 | 446 | $variables['assetFieldSources'] = array_merge( |
447 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
447 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
448 | 448 | FieldHelper::fieldsOfTypeFromElement( |
449 | 449 | $element, |
450 | 450 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | public function actionGenerate() |
70 | 70 | { |
71 | - echo 'Generating sitemap' . PHP_EOL; |
|
71 | + echo 'Generating sitemap'.PHP_EOL; |
|
72 | 72 | if ($this->siteId !== null) { |
73 | 73 | $siteIds[] = $this->siteId; |
74 | 74 | } else { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $sitemap = SitemapTemplate::create(); |
116 | 116 | if ($site) { |
117 | 117 | for ($pageNum = 1; $pageNum <= $pageCount; $pageNum++) { |
118 | - echo sprintf('Generating page %d of %d' . PHP_EOL, $pageNum, $pageCount); |
|
118 | + echo sprintf('Generating page %d of %d'.PHP_EOL, $pageNum, $pageCount); |
|
119 | 119 | $sitemap->render([ |
120 | 120 | 'groupId' => $site->groupId, |
121 | 121 | 'siteId' => $metaBundle->sourceSiteId, |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | // Generate the sitemap so it is in the cache |
128 | 128 | } |
129 | 129 | |
130 | - echo '---' . PHP_EOL; |
|
130 | + echo '---'.PHP_EOL; |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | if ($multiSite) { |
121 | 121 | $urlsetLine .= ' xmlns:xhtml="http://www.w3.org/1999/xhtml"'; |
122 | 122 | } |
123 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
123 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
124 | 124 | $urlsetLine .= ' xmlns:news="http://www.google.com/schemas/sitemap-news/0.9"'; |
125 | 125 | } |
126 | 126 | $urlsetLine .= '>'; |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $paginator->getTotalPages(), |
189 | 189 | $paginator->getTotalResults()); |
190 | 190 | } |
191 | - echo $message . PHP_EOL; |
|
191 | + echo $message.PHP_EOL; |
|
192 | 192 | } |
193 | 193 | /** @var Element $element */ |
194 | 194 | foreach ($elements as $element) { |
195 | 195 | // Output some info if this is a console app |
196 | 196 | if (Craft::$app instanceof ConsoleApplication) { |
197 | - echo "Processing element {$currentElement}/{$totalElements} - {$element->title}" . PHP_EOL; |
|
197 | + echo "Processing element {$currentElement}/{$totalElements} - {$element->title}".PHP_EOL; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | $metaBundle->metaSitemapVars->setAttributes($stashedSitemapAttrs, false); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | } |
243 | 243 | $canonicalUrl = UrlHelper::absoluteUrlWithProtocol($canonicalUrl); |
244 | 244 | if ($url !== $canonicalUrl) { |
245 | - Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - " . $metaBundle->metaGlobalVars->canonicalUrl . " - " . $element->uri); |
|
245 | + Craft::info("Excluding URL: {$url} from the sitemap because it does not match the Canonical URL: {$canonicalUrl} - ".$metaBundle->metaGlobalVars->canonicalUrl." - ".$element->uri); |
|
246 | 246 | continue; |
247 | 247 | } |
248 | 248 | } |
@@ -303,12 +303,12 @@ discard block |
||
303 | 303 | if ($primarySiteId === $altSourceSiteId && Seomatic::$settings->addXDefaultHrefLang) { |
304 | 304 | $lines[] = '<xhtml:link rel="alternate"' |
305 | 305 | . ' hreflang="x-default"' |
306 | - . ' href="' . Html::encode($altUrl) . '"' |
|
306 | + . ' href="'.Html::encode($altUrl).'"' |
|
307 | 307 | . ' />'; |
308 | 308 | } |
309 | 309 | $lines[] = '<xhtml:link rel="alternate"' |
310 | - . ' hreflang="' . $altSiteSettings['language'] . '"' |
|
311 | - . ' href="' . Html::encode($altUrl) . '"' |
|
310 | + . ' hreflang="'.$altSiteSettings['language'].'"' |
|
311 | + . ' href="'.Html::encode($altUrl).'"' |
|
312 | 312 | . ' />'; |
313 | 313 | } |
314 | 314 | } |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | } |
318 | 318 | } |
319 | 319 | // Handle news sitemaps https://developers.google.com/search/docs/crawling-indexing/sitemaps/news-sitemap |
320 | - if ((bool)$metaBundle->metaSitemapVars->newsSitemap) { |
|
320 | + if ((bool) $metaBundle->metaSitemapVars->newsSitemap) { |
|
321 | 321 | $now = new DateTime(); |
322 | 322 | $interval = $now->diff($dateUpdated); |
323 | 323 | if ($interval->days <= 2) { |
@@ -327,11 +327,11 @@ discard block |
||
327 | 327 | } |
328 | 328 | $lines[] = '<news:news>'; |
329 | 329 | $lines[] = '<news:publication>'; |
330 | - $lines[] = '<news:name>' . $metaBundle->metaSitemapVars->newsPublicationName . '</news:name>'; |
|
331 | - $lines[] = '<news:language>' . $language . '</news:language>'; |
|
330 | + $lines[] = '<news:name>'.$metaBundle->metaSitemapVars->newsPublicationName.'</news:name>'; |
|
331 | + $lines[] = '<news:language>'.$language.'</news:language>'; |
|
332 | 332 | $lines[] = '</news:publication>'; |
333 | - $lines[] = '<news:publication_date>' . $dateUpdated->format(DateTime::W3C) . '</news:publication_date>'; |
|
334 | - $lines[] = '<news:title>' . $element->title . '</news:title>'; |
|
333 | + $lines[] = '<news:publication_date>'.$dateUpdated->format(DateTime::W3C).'</news:publication_date>'; |
|
334 | + $lines[] = '<news:title>'.$element->title.'</news:title>'; |
|
335 | 335 | $lines[] = '</news:news>'; |
336 | 336 | } |
337 | 337 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | */ |
548 | 548 | protected static function assetSitemapItem(Asset $asset, MetaBundle $metaBundle, array &$lines) |
549 | 549 | { |
550 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
550 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
551 | 551 | switch ($asset->kind) { |
552 | 552 | case 'image': |
553 | 553 | $transform = Craft::$app->getAssetTransforms()->getTransformByHandle($metaBundle->metaSitemapVars->sitemapAssetTransform ?? ''); |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | $fieldName = $row['field'] ?? ''; |
561 | 561 | $propName = $row['property'] ?? ''; |
562 | 562 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
563 | - $lines[] = '<image:' . $propName . '>'; |
|
563 | + $lines[] = '<image:'.$propName.'>'; |
|
564 | 564 | $lines[] = Html::encode($asset[$fieldName]); |
565 | - $lines[] = '</image:' . $propName . '>'; |
|
565 | + $lines[] = '</image:'.$propName.'>'; |
|
566 | 566 | } |
567 | 567 | } |
568 | 568 | $lines[] = '</image:image>'; |
@@ -578,9 +578,9 @@ discard block |
||
578 | 578 | $fieldName = $row['field'] ?? ''; |
579 | 579 | $propName = $row['property'] ?? ''; |
580 | 580 | if (!empty($fieldName) && !empty($asset[$fieldName]) && !empty($propName)) { |
581 | - $lines[] = '<video:' . $propName . '>'; |
|
581 | + $lines[] = '<video:'.$propName.'>'; |
|
582 | 582 | $lines[] = Html::encode($asset[$fieldName]); |
583 | - $lines[] = '</video:' . $propName . '>'; |
|
583 | + $lines[] = '</video:'.$propName.'>'; |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | $lines[] = '</video:video>'; |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | protected static function assetFilesSitemapLink(Asset $asset, MetaBundle $metaBundle, array &$lines) |
598 | 598 | { |
599 | - if ((bool)$asset->enabledForSite && $asset->getUrl() !== null) { |
|
599 | + if ((bool) $asset->enabledForSite && $asset->getUrl() !== null) { |
|
600 | 600 | if (in_array($asset->kind, SitemapTemplate::FILE_TYPES, false)) { |
601 | 601 | $dateUpdated = $asset->dateUpdated ?? $asset->dateCreated ?? new DateTime(); |
602 | 602 | $lines[] = '<url>'; |
@@ -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 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | self::$cacheDuration = self::$devMode |
277 | 277 | ? self::DEVMODE_CACHE_DURATION |
278 | 278 | : self::$settings->metaCacheDuration ?? null; |
279 | - self::$cacheDuration = self::$cacheDuration === null ? null : (int)self::$cacheDuration; |
|
279 | + self::$cacheDuration = self::$cacheDuration === null ? null : (int) self::$cacheDuration; |
|
280 | 280 | self::$environment = EnvironmentHelper::determineEnvironment(); |
281 | 281 | MetaValueHelper::cache(); |
282 | 282 | // Version helpers |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | $lastSegment = end($segments); |
399 | 399 | $site = Craft::$app->getSites()->getSiteByHandle($lastSegment); |
400 | 400 | if ($site !== null) { |
401 | - $siteSuffix = '/' . $lastSegment; |
|
401 | + $siteSuffix = '/'.$lastSegment; |
|
402 | 402 | } |
403 | 403 | } |
404 | 404 | /** @var User $currentUser */ |
@@ -407,31 +407,31 @@ discard block |
||
407 | 407 | if ($currentUser->can('seomatic:dashboard')) { |
408 | 408 | $subNavs['dashboard'] = [ |
409 | 409 | 'label' => Craft::t('seomatic', 'Dashboard'), |
410 | - 'url' => 'seomatic/dashboard' . $siteSuffix, |
|
410 | + 'url' => 'seomatic/dashboard'.$siteSuffix, |
|
411 | 411 | ]; |
412 | 412 | } |
413 | 413 | if ($currentUser->can('seomatic:global-meta')) { |
414 | 414 | $subNavs['global'] = [ |
415 | 415 | 'label' => Craft::t('seomatic', 'Global SEO'), |
416 | - 'url' => 'seomatic/global/general' . $siteSuffix, |
|
416 | + 'url' => 'seomatic/global/general'.$siteSuffix, |
|
417 | 417 | ]; |
418 | 418 | } |
419 | 419 | if ($currentUser->can('seomatic:content-meta')) { |
420 | 420 | $subNavs['content'] = [ |
421 | 421 | 'label' => Craft::t('seomatic', 'Content SEO'), |
422 | - 'url' => 'seomatic/content' . $siteSuffix, |
|
422 | + 'url' => 'seomatic/content'.$siteSuffix, |
|
423 | 423 | ]; |
424 | 424 | } |
425 | 425 | if ($currentUser->can('seomatic:site-settings')) { |
426 | 426 | $subNavs['site'] = [ |
427 | 427 | 'label' => Craft::t('seomatic', 'Site Settings'), |
428 | - 'url' => 'seomatic/site/identity' . $siteSuffix, |
|
428 | + 'url' => 'seomatic/site/identity'.$siteSuffix, |
|
429 | 429 | ]; |
430 | 430 | } |
431 | 431 | if ($currentUser->can('seomatic:tracking-scripts')) { |
432 | 432 | $subNavs['tracking'] = [ |
433 | 433 | 'label' => Craft::t('seomatic', 'Tracking Scripts'), |
434 | - 'url' => 'seomatic/tracking/gtag' . $siteSuffix, |
|
434 | + 'url' => 'seomatic/tracking/gtag'.$siteSuffix, |
|
435 | 435 | ]; |
436 | 436 | } |
437 | 437 | $editableSettings = true; |
@@ -626,14 +626,14 @@ discard block |
||
626 | 626 | $element = $e->sender; |
627 | 627 | if ($element->uri !== null) { |
628 | 628 | $e->previewTargets[] = [ |
629 | - 'label' => ' |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | $cache = Craft::$app->getCache(); |
152 | - $pageCacheSuffix = 's' . (int)$metaBundle->metaSitemapVars->sitemapPageSize . 'p' . $page; |
|
152 | + $pageCacheSuffix = 's'.(int) $metaBundle->metaSitemapVars->sitemapPageSize.'p'.$page; |
|
153 | 153 | |
154 | - $uniqueKey = $groupId . $type . $handle . $siteId . $pageCacheSuffix; |
|
155 | - $cacheKey = self::CACHE_KEY . $uniqueKey; |
|
154 | + $uniqueKey = $groupId.$type.$handle.$siteId.$pageCacheSuffix; |
|
155 | + $cacheKey = self::CACHE_KEY.$uniqueKey; |
|
156 | 156 | $result = $cache->get($cacheKey); |
157 | 157 | |
158 | 158 | // If the sitemap isn't cached, start a job to create it |
@@ -171,8 +171,8 @@ discard block |
||
171 | 171 | $dependency = new TagDependency([ |
172 | 172 | 'tags' => [ |
173 | 173 | self::GLOBAL_SITEMAP_CACHE_TAG, |
174 | - self::SITEMAP_CACHE_TAG . $handle . $siteId, |
|
175 | - self::SITEMAP_CACHE_TAG . $handle . $siteId . $pageCacheSuffix, |
|
174 | + self::SITEMAP_CACHE_TAG.$handle.$siteId, |
|
175 | + self::SITEMAP_CACHE_TAG.$handle.$siteId.$pageCacheSuffix, |
|
176 | 176 | ], |
177 | 177 | ]); |
178 | 178 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | // Output some info if this is a console app |
186 | 186 | if (Craft::$app instanceof ConsoleApplication) { |
187 | - echo 'Sitemap cache result: ' . print_r($result, true) . ' for cache key: ' . $cacheKey . PHP_EOL; |
|
187 | + echo 'Sitemap cache result: '.print_r($result, true).' for cache key: '.$cacheKey.PHP_EOL; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | // If the FastCGI Cache Bust plugin is installed, clear its caches too |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | // Return an empty XML document |
213 | 213 | $lines[] = '<?xml version="1.0" encoding="UTF-8"?>'; |
214 | 214 | $lines[] = '<?xml-stylesheet type="text/xsl" href="sitemap-empty.xsl"?>'; |
215 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'This sitemap has not been generated yet.') . ' -->'; |
|
216 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'If you are seeing this in local dev or an') . ' -->'; |
|
217 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'environment with `devMode` on, caches only') . ' -->'; |
|
218 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'last for 30 seconds in local dev, so it is') . ' -->'; |
|
219 | - $lines[] = '<!-- ' . Craft::t('seomatic', 'normal for the sitemap to not be cached.') . ' -->'; |
|
215 | + $lines[] = '<!-- '.Craft::t('seomatic', 'This sitemap has not been generated yet.').' -->'; |
|
216 | + $lines[] = '<!-- '.Craft::t('seomatic', 'If you are seeing this in local dev or an').' -->'; |
|
217 | + $lines[] = '<!-- '.Craft::t('seomatic', 'environment with `devMode` on, caches only').' -->'; |
|
218 | + $lines[] = '<!-- '.Craft::t('seomatic', 'last for 30 seconds in local dev, so it is').' -->'; |
|
219 | + $lines[] = '<!-- '.Craft::t('seomatic', 'normal for the sitemap to not be cached.').' -->'; |
|
220 | 220 | $lines[] = '<urlset>'; |
221 | 221 | $lines[] = '</urlset>'; |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | return $lines; |
226 | 226 | } else { |
227 | 227 | if (Craft::$app instanceof ConsoleApplication) { |
228 | - echo 'Found in cache' . PHP_EOL; |
|
228 | + echo 'Found in cache'.PHP_EOL; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
@@ -241,9 +241,9 @@ discard block |
||
241 | 241 | public function invalidateCache(string $handle, int $siteId) |
242 | 242 | { |
243 | 243 | $cache = Craft::$app->getCache(); |
244 | - TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG . $handle . $siteId); |
|
244 | + TagDependency::invalidate($cache, self::SITEMAP_CACHE_TAG.$handle.$siteId); |
|
245 | 245 | Craft::info( |
246 | - 'Sitemap cache cleared: ' . $handle, |
|
246 | + 'Sitemap cache cleared: '.$handle, |
|
247 | 247 | __METHOD__ |
248 | 248 | ); |
249 | 249 | } |