@@ -19,44 +19,44 @@ |
||
19 | 19 | */ |
20 | 20 | |
21 | 21 | return [ |
22 | - MetaTagContainer::CONTAINER_TYPE . TagService::GENERAL_HANDLE => [ |
|
22 | + MetaTagContainer::CONTAINER_TYPE.TagService::GENERAL_HANDLE => [ |
|
23 | 23 | 'name' => 'General', |
24 | 24 | 'description' => 'General Meta Tags', |
25 | 25 | 'handle' => TagService::GENERAL_HANDLE, |
26 | - 'class' => (string)MetaTagContainer::class, |
|
26 | + 'class' => (string) MetaTagContainer::class, |
|
27 | 27 | 'include' => true, |
28 | 28 | 'dependencies' => [ |
29 | 29 | ], |
30 | 30 | 'data' => [ |
31 | 31 | ], |
32 | 32 | ], |
33 | - MetaTagContainer::CONTAINER_TYPE . TagService::FACEBOOK_HANDLE => [ |
|
33 | + MetaTagContainer::CONTAINER_TYPE.TagService::FACEBOOK_HANDLE => [ |
|
34 | 34 | 'name' => 'Facebook', |
35 | 35 | 'description' => 'Facebook OpenGraph Meta Tags', |
36 | 36 | 'handle' => TagService::FACEBOOK_HANDLE, |
37 | - 'class' => (string)MetaTagContainer::class, |
|
37 | + 'class' => (string) MetaTagContainer::class, |
|
38 | 38 | 'include' => true, |
39 | 39 | 'dependencies' => [ |
40 | 40 | ], |
41 | 41 | 'data' => [ |
42 | 42 | ], |
43 | 43 | ], |
44 | - MetaTagContainer::CONTAINER_TYPE . TagService::TWITTER_HANDLE => [ |
|
44 | + MetaTagContainer::CONTAINER_TYPE.TagService::TWITTER_HANDLE => [ |
|
45 | 45 | 'name' => 'Twitter', |
46 | 46 | 'description' => 'Twitter Card Meta Tags', |
47 | 47 | 'handle' => TagService::TWITTER_HANDLE, |
48 | - 'class' => (string)MetaTagContainer::class, |
|
48 | + 'class' => (string) MetaTagContainer::class, |
|
49 | 49 | 'include' => true, |
50 | 50 | 'dependencies' => [ |
51 | 51 | ], |
52 | 52 | 'data' => [ |
53 | 53 | ], |
54 | 54 | ], |
55 | - MetaTagContainer::CONTAINER_TYPE . TagService::MISC_HANDLE => [ |
|
55 | + MetaTagContainer::CONTAINER_TYPE.TagService::MISC_HANDLE => [ |
|
56 | 56 | 'name' => 'Miscellaneous', |
57 | 57 | 'description' => 'Miscellaneous Meta Tags', |
58 | 58 | 'handle' => TagService::MISC_HANDLE, |
59 | - 'class' => (string)MetaTagContainer::class, |
|
59 | + 'class' => (string) MetaTagContainer::class, |
|
60 | 60 | 'include' => true, |
61 | 61 | 'dependencies' => [ |
62 | 62 | ], |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | // Get the page number of this request |
178 | 178 | $request = Craft::$app->getRequest(); |
179 | 179 | if (!$request->isConsoleRequest) { |
180 | - $this->paginationPage = (string)$request->pageNum; |
|
180 | + $this->paginationPage = (string) $request->pageNum; |
|
181 | 181 | } |
182 | 182 | } |
183 | 183 | |
@@ -253,10 +253,10 @@ discard block |
||
253 | 253 | $dependency = $this->containerDependency; |
254 | 254 | $uniqueKey = $dependency->tags[3] ?? self::GLOBALS_CACHE_KEY; |
255 | 255 | list($this->metaGlobalVars, $this->metaSiteVars) = Craft::$app->getCache()->getOrSet( |
256 | - self::GLOBALS_CACHE_KEY . $uniqueKey, |
|
256 | + self::GLOBALS_CACHE_KEY.$uniqueKey, |
|
257 | 257 | function() use ($uniqueKey) { |
258 | 258 | Craft::info( |
259 | - self::GLOBALS_CACHE_KEY . ' cache miss: ' . $uniqueKey, |
|
259 | + self::GLOBALS_CACHE_KEY.' cache miss: '.$uniqueKey, |
|
260 | 260 | __METHOD__ |
261 | 261 | ); |
262 | 262 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | ?? 1; |
377 | 377 | } |
378 | 378 | // Handle pagination |
379 | - $paginationPage = 'page' . $this->paginationPage; |
|
379 | + $paginationPage = 'page'.$this->paginationPage; |
|
380 | 380 | // Get the path for the current request |
381 | 381 | $request = Craft::$app->getRequest(); |
382 | 382 | $requestPath = '/'; |
@@ -392,21 +392,21 @@ discard block |
||
392 | 392 | } |
393 | 393 | } |
394 | 394 | // Get our cache key |
395 | - $cacheKey = $uri . $siteId . $paginationPage . $requestPath . $this->getAllowedUrlParams(); |
|
395 | + $cacheKey = $uri.$siteId.$paginationPage.$requestPath.$this->getAllowedUrlParams(); |
|
396 | 396 | // For requests with a status code of >= 400, use one cache key |
397 | 397 | if (!$request->isConsoleRequest) { |
398 | 398 | $response = Craft::$app->getResponse(); |
399 | 399 | if ($response->statusCode >= 400) { |
400 | - $cacheKey = $siteId . self::INVALID_RESPONSE_CACHE_KEY . $response->statusCode; |
|
400 | + $cacheKey = $siteId.self::INVALID_RESPONSE_CACHE_KEY.$response->statusCode; |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | // Load the meta containers |
404 | 404 | $dependency = new TagDependency([ |
405 | 405 | 'tags' => [ |
406 | 406 | self::GLOBAL_METACONTAINER_CACHE_TAG, |
407 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId, |
|
408 | - self::METACONTAINER_CACHE_TAG . $uri . $siteId, |
|
409 | - self::METACONTAINER_CACHE_TAG . $cacheKey, |
|
407 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId, |
|
408 | + self::METACONTAINER_CACHE_TAG.$uri.$siteId, |
|
409 | + self::METACONTAINER_CACHE_TAG.$cacheKey, |
|
410 | 410 | ], |
411 | 411 | ]); |
412 | 412 | $this->containerDependency = $dependency; |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | } else { |
424 | 424 | $cache = Craft::$app->getCache(); |
425 | 425 | list($this->metaGlobalVars, $this->metaSiteVars, $this->metaSitemapVars, $this->metaContainers) = $cache->getOrSet( |
426 | - self::CACHE_KEY . $cacheKey, |
|
426 | + self::CACHE_KEY.$cacheKey, |
|
427 | 427 | function() use ($uri, $siteId) { |
428 | 428 | Craft::info( |
429 | - 'Meta container cache miss: ' . $uri . '/' . $siteId, |
|
429 | + 'Meta container cache miss: '.$uri.'/'.$siteId, |
|
430 | 430 | __METHOD__ |
431 | 431 | ); |
432 | 432 | $this->loadGlobalMetaContainers($siteId); |
@@ -829,10 +829,10 @@ discard block |
||
829 | 829 | $cache = Craft::$app->getCache(); |
830 | 830 | TagDependency::invalidate( |
831 | 831 | $cache, |
832 | - self::METACONTAINER_CACHE_TAG . $metaBundleSourceId . $metaBundleSourceType . $siteId |
|
832 | + self::METACONTAINER_CACHE_TAG.$metaBundleSourceId.$metaBundleSourceType.$siteId |
|
833 | 833 | ); |
834 | 834 | Craft::info( |
835 | - 'Meta bundle cache cleared: ' . $metaBundleSourceId . ' / ' . $metaBundleSourceType . ' / ' . $siteId, |
|
835 | + 'Meta bundle cache cleared: '.$metaBundleSourceId.' / '.$metaBundleSourceType.' / '.$siteId, |
|
836 | 836 | __METHOD__ |
837 | 837 | ); |
838 | 838 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -859,9 +859,9 @@ discard block |
||
859 | 859 | if ($siteId === null) { |
860 | 860 | $siteId = Craft::$app->getSites()->currentSite->id ?? 1; |
861 | 861 | } |
862 | - TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG . $uri . $siteId); |
|
862 | + TagDependency::invalidate($cache, self::METACONTAINER_CACHE_TAG.$uri.$siteId); |
|
863 | 863 | Craft::info( |
864 | - 'Meta container cache cleared: ' . $uri . ' / ' . $siteId, |
|
864 | + 'Meta container cache cleared: '.$uri.' / '.$siteId, |
|
865 | 865 | __METHOD__ |
866 | 866 | ); |
867 | 867 | // Trigger an event to let other plugins/modules know we've cleared our caches |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | |
1003 | 1003 | // Handle re-creating the `mainEntityOfPage` so that the model injected into the |
1004 | 1004 | // templates has the appropriate attributes |
1005 | - $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE . JsonLdService::GENERAL_HANDLE; |
|
1005 | + $generalContainerKey = MetaJsonLdContainer::CONTAINER_TYPE.JsonLdService::GENERAL_HANDLE; |
|
1006 | 1006 | $generalContainer = $this->metaContainers[$generalContainerKey]; |
1007 | 1007 | if (($generalContainer !== null) && !empty($generalContainer->data['mainEntityOfPage'])) { |
1008 | 1008 | /** @var MetaJsonLd $jsonLdModel */ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Constants |
34 | 34 | // ========================================================================= |
35 | 35 | |
36 | - public const FRONTENDTEMPLATES_CONTAINER = Seomatic::SEOMATIC_HANDLE . EditableTemplate::TEMPLATE_TYPE; |
|
36 | + public const FRONTENDTEMPLATES_CONTAINER = Seomatic::SEOMATIC_HANDLE.EditableTemplate::TEMPLATE_TYPE; |
|
37 | 37 | |
38 | 38 | public const HUMANS_TXT_HANDLE = 'humans'; |
39 | 39 | public const ROBOTS_TXT_HANDLE = 'robots'; |
@@ -171,16 +171,16 @@ discard block |
||
171 | 171 | $dependency = new TagDependency([ |
172 | 172 | 'tags' => [ |
173 | 173 | self::GLOBAL_FRONTENDTEMPLATE_CACHE_TAG, |
174 | - self::FRONTENDTEMPLATE_CACHE_TAG . $template, |
|
175 | - self::FRONTENDTEMPLATE_CACHE_TAG . $template . $siteId, |
|
174 | + self::FRONTENDTEMPLATE_CACHE_TAG.$template, |
|
175 | + self::FRONTENDTEMPLATE_CACHE_TAG.$template.$siteId, |
|
176 | 176 | ], |
177 | 177 | ]); |
178 | 178 | $cache = Craft::$app->getCache(); |
179 | 179 | $html = $cache->getOrSet( |
180 | - self::CACHE_KEY . $template . $siteId, |
|
180 | + self::CACHE_KEY.$template.$siteId, |
|
181 | 181 | function() use ($template, $params) { |
182 | 182 | Craft::info( |
183 | - 'Frontend template cache miss: ' . $template, |
|
183 | + 'Frontend template cache miss: '.$template, |
|
184 | 184 | __METHOD__ |
185 | 185 | ); |
186 | 186 | $html = ''; |
@@ -251,9 +251,9 @@ discard block |
||
251 | 251 | public function invalidateFrontendTemplateCache(string $template) |
252 | 252 | { |
253 | 253 | $cache = Craft::$app->getCache(); |
254 | - TagDependency::invalidate($cache, self::FRONTENDTEMPLATE_CACHE_TAG . $template); |
|
254 | + TagDependency::invalidate($cache, self::FRONTENDTEMPLATE_CACHE_TAG.$template); |
|
255 | 255 | Craft::info( |
256 | - 'Frontend template cache cleared: ' . $template, |
|
256 | + 'Frontend template cache cleared: '.$template, |
|
257 | 257 | __METHOD__ |
258 | 258 | ); |
259 | 259 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | ->siteId($metaBundle->sourceSiteId) |
224 | 224 | ->limit($metaBundle->metaSitemapVars->sitemapLimit); |
225 | 225 | if (!empty($metaBundle->metaSitemapVars->structureDepth)) { |
226 | - $query->level('<=' . $metaBundle->metaSitemapVars->structureDepth); |
|
226 | + $query->level('<='.$metaBundle->metaSitemapVars->structureDepth); |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | return $query; |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
380 | 380 | [ |
381 | 381 | 'sourceId' => $sourceModel->id, |
382 | - 'sourceName' => (string)$sourceModel->name, |
|
382 | + 'sourceName' => (string) $sourceModel->name, |
|
383 | 383 | 'sourceHandle' => $sourceModel->handle, |
384 | 384 | ] |
385 | 385 | ); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | ->limit($metaBundle->metaSitemapVars->sitemapLimit); |
228 | 228 | if ($metaBundle->sourceType === 'structure' |
229 | 229 | && !empty($metaBundle->metaSitemapVars->structureDepth)) { |
230 | - $query->level('<=' . $metaBundle->metaSitemapVars->structureDepth); |
|
230 | + $query->level('<='.$metaBundle->metaSitemapVars->structureDepth); |
|
231 | 231 | } |
232 | 232 | |
233 | 233 | return $query; |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
395 | 395 | [ |
396 | 396 | 'sourceId' => $sourceModel->id, |
397 | - 'sourceName' => (string)$sourceModel->name, |
|
397 | + 'sourceName' => (string) $sourceModel->name, |
|
398 | 398 | 'sourceHandle' => $sourceModel->handle, |
399 | 399 | 'sourceType' => $sourceModel->type, |
400 | 400 | ] |
@@ -388,7 +388,7 @@ |
||
388 | 388 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
389 | 389 | [ |
390 | 390 | 'sourceId' => $sourceModel->id, |
391 | - 'sourceName' => (string)$sourceModel->name, |
|
391 | + 'sourceName' => (string) $sourceModel->name, |
|
392 | 392 | 'sourceHandle' => $sourceModel->handle, |
393 | 393 | ] |
394 | 394 | ); |
@@ -388,7 +388,7 @@ |
||
388 | 388 | ConfigHelper::getConfigFromFile(self::configFilePath()), |
389 | 389 | [ |
390 | 390 | 'sourceId' => $sourceModel->id, |
391 | - 'sourceName' => (string)$sourceModel->name, |
|
391 | + 'sourceName' => (string) $sourceModel->name, |
|
392 | 392 | 'sourceHandle' => $sourceModel->handle, |
393 | 393 | ] |
394 | 394 | ); |
@@ -502,8 +502,8 @@ |
||
502 | 502 | string $sourceBundleType, |
503 | 503 | string $sourceHandle, |
504 | 504 | string $siteHandle = null, |
505 | - $typeId = null, |
|
506 | - $loadFromSiteHandle = null, |
|
505 | + $typeId = null, |
|
506 | + $loadFromSiteHandle = null, |
|
507 | 507 | ): Response { |
508 | 508 | $variables = []; |
509 | 509 | // @TODO: Let people choose an entry/categorygroup/product as the preview |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | /** |
90 | 90 | * @inheritdoc |
91 | 91 | */ |
92 | - protected array|bool|int $allowAnonymous = [ |
|
92 | + protected array | bool | int $allowAnonymous = [ |
|
93 | 93 | ]; |
94 | 94 | |
95 | 95 | // Public Methods |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
133 | 133 | $variables['title'] = $templateTitle; |
134 | 134 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
135 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
135 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
136 | 136 | $variables['crumbs'] = [ |
137 | 137 | [ |
138 | 138 | 'label' => $pluginName, |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ], |
141 | 141 | [ |
142 | 142 | 'label' => $templateTitle, |
143 | - 'url' => UrlHelper::cpUrl('seomatic/dashboard' . $siteHandleUri), |
|
143 | + 'url' => UrlHelper::cpUrl('seomatic/dashboard'.$siteHandleUri), |
|
144 | 144 | ], |
145 | 145 | ]; |
146 | 146 | $variables['selectedSubnavItem'] = 'dashboard'; |
@@ -163,11 +163,11 @@ discard block |
||
163 | 163 | foreach ($variables['metaBundles'] as $metaBundle) { |
164 | 164 | $stat = 0; |
165 | 165 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
166 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
166 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
167 | 167 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
168 | 168 | $variables['contentSetupChecklist'][$setupField] = [ |
169 | 169 | 'label' => $setupLabel, |
170 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
170 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
171 | 171 | ]; |
172 | 172 | } |
173 | 173 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |
@@ -178,16 +178,16 @@ discard block |
||
178 | 178 | } |
179 | 179 | // Global SEO grades |
180 | 180 | Seomatic::$previewingMetaContainers = true; |
181 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int)$siteId); |
|
181 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle((int) $siteId); |
|
182 | 182 | Seomatic::$previewingMetaContainers = false; |
183 | 183 | if ($metaBundle !== null) { |
184 | 184 | $stat = 0; |
185 | 185 | $variables['globalSetupChecklist'] = []; |
186 | 186 | foreach (self::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
187 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
187 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
188 | 188 | $variables['globalSetupChecklist'][$setupField] = [ |
189 | 189 | 'label' => $setupLabel, |
190 | - 'value' => (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
190 | + 'value' => (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
191 | 191 | ]; |
192 | 192 | } |
193 | 193 | $stat = round(($stat / $numFields) * 100); |
@@ -197,17 +197,17 @@ discard block |
||
197 | 197 | $stat = 0; |
198 | 198 | $variables['siteSetupChecklist'] = []; |
199 | 199 | foreach (self::SITE_SETUP_FIELDS as $setupField => $setupLabel) { |
200 | - $stat += (int)!empty($metaBundle->metaSiteVars[$setupField]); |
|
200 | + $stat += (int) !empty($metaBundle->metaSiteVars[$setupField]); |
|
201 | 201 | $variables['siteSetupChecklist'][$setupField] = [ |
202 | 202 | 'label' => $setupLabel, |
203 | - 'value' => (int)!empty($metaBundle->metaSiteVars[$setupField]), |
|
203 | + 'value' => (int) !empty($metaBundle->metaSiteVars[$setupField]), |
|
204 | 204 | ]; |
205 | 205 | } |
206 | 206 | foreach (self::IDENTITY_SETUP_FIELDS as $setupField => $setupLabel) { |
207 | - $stat += (int)!empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
207 | + $stat += (int) !empty($metaBundle->metaSiteVars->identity[$setupField]); |
|
208 | 208 | $variables['siteSetupChecklist'][$setupField] = [ |
209 | 209 | 'label' => $setupLabel, |
210 | - 'value' => (int)!empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
210 | + 'value' => (int) !empty($metaBundle->metaSiteVars->identity[$setupField]), |
|
211 | 211 | ]; |
212 | 212 | } |
213 | 213 | $stat = round(($stat / $numFields) * 100); |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $variables['title'] = $templateTitle; |
256 | 256 | $variables['subSectionTitle'] = $subSectionTitle; |
257 | 257 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
258 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
258 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
259 | 259 | $variables['crumbs'] = [ |
260 | 260 | [ |
261 | 261 | 'label' => $pluginName, |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | ], |
264 | 264 | [ |
265 | 265 | 'label' => $templateTitle, |
266 | - 'url' => UrlHelper::cpUrl('seomatic/global/general' . $siteHandleUri), |
|
266 | + 'url' => UrlHelper::cpUrl('seomatic/global/general'.$siteHandleUri), |
|
267 | 267 | ], |
268 | 268 | [ |
269 | 269 | 'label' => $subSectionTitle, |
270 | - 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection . $siteHandleUri), |
|
270 | + 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection.$siteHandleUri), |
|
271 | 271 | ], |
272 | 272 | ]; |
273 | 273 | $variables['selectedSubnavItem'] = 'global'; |
@@ -275,14 +275,14 @@ discard block |
||
275 | 275 | $this->setGlobalFieldSourceVariables($variables); |
276 | 276 | // Enabled sites |
277 | 277 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
278 | - $variables['controllerHandle'] = 'global' . '/' . $subSection; |
|
278 | + $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
279 | 279 | $variables['currentSubSection'] = $subSection; |
280 | 280 | // Meta bundle settings |
281 | 281 | Seomatic::$previewingMetaContainers = true; |
282 | 282 | // Get the site to copy the settings from, if any |
283 | 283 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
284 | 284 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
285 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
285 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
286 | 286 | // Load the metabundle |
287 | 287 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
288 | 288 | if ($editedMetaBundle) { |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | // Preview the meta containers |
337 | 337 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
338 | 338 | MetaBundles::GLOBAL_META_BUNDLE, |
339 | - (int)$variables['currentSiteId'] |
|
339 | + (int) $variables['currentSiteId'] |
|
340 | 340 | ); |
341 | 341 | |
342 | 342 | $this->setCrumbVariables($variables); |
343 | 343 | |
344 | 344 | // Render the template |
345 | - return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
345 | + return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $variables['pluginName'] = Seomatic::$settings->pluginName; |
474 | 474 | $variables['title'] = $templateTitle; |
475 | 475 | $variables['docTitle'] = "{$pluginName} - {$templateTitle}"; |
476 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
476 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
477 | 477 | $variables['crumbs'] = [ |
478 | 478 | [ |
479 | 479 | 'label' => $pluginName, |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | ], |
482 | 482 | [ |
483 | 483 | 'label' => $templateTitle, |
484 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
484 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
485 | 485 | ], |
486 | 486 | ]; |
487 | 487 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | // Get the site to edit |
523 | 523 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
524 | 524 | if (is_string($typeId)) { |
525 | - $typeId = (int)$typeId; |
|
525 | + $typeId = (int) $typeId; |
|
526 | 526 | } |
527 | 527 | // Get the (entry) type menu |
528 | 528 | $typeMenu = []; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | $currentType = reset($typeMenu); |
537 | 537 | $variables['currentType'] = $typeMenu[$typeId] ?? $currentType; |
538 | 538 | $variables['currentTypeId'] = $typeId ?? key($typeMenu); |
539 | - $typeId = (int)$variables['currentTypeId']; |
|
539 | + $typeId = (int) $variables['currentTypeId']; |
|
540 | 540 | } |
541 | 541 | $pluginName = Seomatic::$settings->pluginName; |
542 | 542 | // Asset bundle |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | // Get the site to copy the settings from, if any |
558 | 558 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
559 | 559 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
560 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
560 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
561 | 561 | // Load the metabundle |
562 | 562 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
563 | 563 | $sourceBundleType, |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | $variables['title'] = $templateTitle; |
584 | 584 | $variables['subSectionTitle'] = $subSectionTitle; |
585 | 585 | $variables['docTitle'] = "{$pluginName} - Content SEO - {$templateTitle} - {$subSectionTitle}"; |
586 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
586 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
587 | 587 | $variables['siteHandleUri'] = $siteHandleUri; |
588 | 588 | $variables['crumbs'] = [ |
589 | 589 | [ |
@@ -592,10 +592,10 @@ discard block |
||
592 | 592 | ], |
593 | 593 | [ |
594 | 594 | 'label' => 'Content SEO', |
595 | - 'url' => UrlHelper::cpUrl('seomatic/content' . $siteHandleUri), |
|
595 | + 'url' => UrlHelper::cpUrl('seomatic/content'.$siteHandleUri), |
|
596 | 596 | ], |
597 | 597 | [ |
598 | - 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
598 | + 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
599 | 599 | 'url' => UrlHelper::cpUrl("seomatic/edit-content/{$subSection}/{$sourceBundleType}/{$sourceHandle}"), |
600 | 600 | ], |
601 | 601 | ]; |
@@ -626,13 +626,13 @@ discard block |
||
626 | 626 | // Preview the meta containers |
627 | 627 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
628 | 628 | $uri, |
629 | - (int)$variables['currentSiteId'], |
|
629 | + (int) $variables['currentSiteId'], |
|
630 | 630 | false, |
631 | 631 | false |
632 | 632 | ); |
633 | 633 | |
634 | 634 | // Render the template |
635 | - return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
635 | + return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
636 | 636 | } |
637 | 637 | |
638 | 638 | /** |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | $bundleSettings = $request->getParam('metaBundleSettings'); |
653 | 653 | $sitemapSettings = $request->getParam('metaSitemapVars'); |
654 | 654 | if (is_string($typeId)) { |
655 | - $typeId = (int)$typeId; |
|
655 | + $typeId = (int) $typeId; |
|
656 | 656 | } |
657 | 657 | // Set the element type in the template |
658 | 658 | $elementName = ''; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | if ($subSection === 'social') { |
718 | 718 | $subSectionSuffix = ' Media'; |
719 | 719 | } |
720 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
720 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
721 | 721 | // Asset bundle |
722 | 722 | try { |
723 | 723 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | $variables['title'] = $templateTitle; |
736 | 736 | $variables['subSectionTitle'] = $subSectionTitle; |
737 | 737 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
738 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
738 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
739 | 739 | $variables['crumbs'] = [ |
740 | 740 | [ |
741 | 741 | 'label' => $pluginName, |
@@ -743,11 +743,11 @@ discard block |
||
743 | 743 | ], |
744 | 744 | [ |
745 | 745 | 'label' => $templateTitle, |
746 | - 'url' => UrlHelper::cpUrl('seomatic/site/identity' . $siteHandleUri), |
|
746 | + 'url' => UrlHelper::cpUrl('seomatic/site/identity'.$siteHandleUri), |
|
747 | 747 | ], |
748 | 748 | [ |
749 | 749 | 'label' => $subSectionTitle, |
750 | - 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection . $siteHandleUri), |
|
750 | + 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection.$siteHandleUri), |
|
751 | 751 | ], |
752 | 752 | ]; |
753 | 753 | $variables['selectedSubnavItem'] = 'site'; |
@@ -755,14 +755,14 @@ discard block |
||
755 | 755 | |
756 | 756 | // Enabled sites |
757 | 757 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
758 | - $variables['controllerHandle'] = 'site' . '/' . $subSection; |
|
758 | + $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
759 | 759 | |
760 | 760 | // The site settings for the appropriate meta bundle |
761 | 761 | Seomatic::$previewingMetaContainers = true; |
762 | 762 | // Get the site to copy the settings from, if any |
763 | 763 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
764 | 764 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
765 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
765 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
766 | 766 | // Load the metabundle |
767 | 767 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
768 | 768 | Seomatic::$previewingMetaContainers = false; |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | $this->setCrumbVariables($variables); |
782 | 782 | |
783 | 783 | // Render the template |
784 | - return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
784 | + return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
785 | 785 | } |
786 | 786 | |
787 | 787 | /** |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
913 | 913 | // Enabled sites |
914 | 914 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
915 | - $variables['controllerHandle'] = 'tracking' . '/' . $subSection; |
|
915 | + $variables['controllerHandle'] = 'tracking'.'/'.$subSection; |
|
916 | 916 | $variables['currentSubSection'] = $subSection; |
917 | 917 | |
918 | 918 | // The script meta containers for the global meta bundle |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | // Get the site to copy the settings from, if any |
921 | 921 | $variables['loadFromSiteHandle'] = $loadFromSiteHandle; |
922 | 922 | $loadFromSiteId = $this->getSiteIdFromHandle($loadFromSiteHandle); |
923 | - $siteIdToLoad = $loadFromSiteHandle === null ? (int)$variables['currentSiteId'] : $loadFromSiteId; |
|
923 | + $siteIdToLoad = $loadFromSiteHandle === null ? (int) $variables['currentSiteId'] : $loadFromSiteId; |
|
924 | 924 | // Load the metabundle |
925 | 925 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteIdToLoad); |
926 | 926 | if ($editedMetaBundle) { |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | $variables['title'] = $templateTitle; |
961 | 961 | $variables['subSectionTitle'] = $subSectionTitle; |
962 | 962 | $variables['docTitle'] = "{$pluginName} - {$templateTitle} - {$subSectionTitle}"; |
963 | - $siteHandleUri = Craft::$app->isMultiSite ? '/' . $siteHandle : ''; |
|
963 | + $siteHandleUri = Craft::$app->isMultiSite ? '/'.$siteHandle : ''; |
|
964 | 964 | $variables['crumbs'] = [ |
965 | 965 | [ |
966 | 966 | 'label' => $pluginName, |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | ], |
973 | 973 | [ |
974 | 974 | 'label' => $subSectionTitle, |
975 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection . $siteHandleUri), |
|
975 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection.$siteHandleUri), |
|
976 | 976 | ], |
977 | 977 | ]; |
978 | 978 | $variables['selectedSubnavItem'] = 'tracking'; |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | if ($siteHandle !== null) { |
1111 | 1111 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
1112 | 1112 | if (!$site) { |
1113 | - throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
1113 | + throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
1114 | 1114 | } |
1115 | 1115 | $siteId = $site->id; |
1116 | 1116 | } else { |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | if (!empty($variables['enabledSiteIds'])) { |
1148 | 1148 | $siteId = reset($variables['enabledSiteIds']); |
1149 | 1149 | } else { |
1150 | - $this->requirePermission('editSite:' . $siteId); |
|
1150 | + $this->requirePermission('editSite:'.$siteId); |
|
1151 | 1151 | } |
1152 | 1152 | } |
1153 | 1153 | } |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | 'icon' => 'world', |
1219 | 1219 | 'label' => Craft::t( |
1220 | 1220 | 'site', |
1221 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1221 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1222 | 1222 | ), |
1223 | 1223 | 'menu' => [ |
1224 | 1224 | 'items' => $siteCrumbItems, |
@@ -1234,7 +1234,7 @@ discard block |
||
1234 | 1234 | 'icon' => 'world', |
1235 | 1235 | 'label' => Craft::t( |
1236 | 1236 | 'site', |
1237 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1237 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1238 | 1238 | ), |
1239 | 1239 | 'menu' => [ |
1240 | 1240 | 'items' => $siteCrumbItems, |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | } |
1246 | 1246 | $variables['sitesMenuLabel'] = Craft::t( |
1247 | 1247 | 'site', |
1248 | - $sites->getSiteById((int)$variables['currentSiteId'])->name |
|
1248 | + $sites->getSiteById((int) $variables['currentSiteId'])->name |
|
1249 | 1249 | ); |
1250 | 1250 | } else { |
1251 | 1251 | $variables['sitesMenuLabel'] = ''; |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | array &$variables, |
1311 | 1311 | ) { |
1312 | 1312 | $variables['textFieldSources'] = array_merge( |
1313 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields'], 'title' => 'Title'], |
|
1313 | + ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
1314 | 1314 | FieldHelper::fieldsOfTypeFromSource( |
1315 | 1315 | $sourceBundleType, |
1316 | 1316 | $sourceHandle, |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | ) |
1320 | 1320 | ); |
1321 | 1321 | $variables['assetFieldSources'] = array_merge( |
1322 | - ['entryGroup' => ['optgroup' => $groupName . ' Fields']], |
|
1322 | + ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
1323 | 1323 | FieldHelper::fieldsOfTypeFromSource( |
1324 | 1324 | $sourceBundleType, |
1325 | 1325 | $sourceHandle, |
@@ -66,8 +66,8 @@ |
||
66 | 66 | string $sort = 'sourceName|asc', |
67 | 67 | int $page = 1, |
68 | 68 | int $per_page = 20, |
69 | - $filter = '', |
|
70 | - $siteId = 0, |
|
69 | + $filter = '', |
|
70 | + $siteId = 0, |
|
71 | 71 | ): Response { |
72 | 72 | $data = []; |
73 | 73 | $sortField = 'sourceName'; |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | /** |
46 | 46 | * @inheritdoc |
47 | 47 | */ |
48 | - protected array|bool|int $allowAnonymous = [ |
|
48 | + protected array | bool | int $allowAnonymous = [ |
|
49 | 49 | ]; |
50 | 50 | |
51 | 51 | // Public Methods |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | // Query the db table |
100 | 100 | $offset = ($page - 1) * $per_page; |
101 | 101 | $currentSiteHandle = ''; |
102 | - if ((int)$siteId !== 0) { |
|
102 | + if ((int) $siteId !== 0) { |
|
103 | 103 | $site = Craft::$app->getSites()->getSiteById($siteId); |
104 | 104 | if ($site !== null) { |
105 | 105 | $currentSiteHandle = $site->handle; |
@@ -156,11 +156,11 @@ discard block |
||
156 | 156 | $numGrades = count(SettingsController::SETUP_GRADES); |
157 | 157 | $numFields = count(SettingsController::SEO_SETUP_FIELDS); |
158 | 158 | foreach (SettingsController::SEO_SETUP_FIELDS as $setupField => $setupLabel) { |
159 | - $stat += (int)!empty($metaBundle->metaGlobalVars[$setupField]); |
|
159 | + $stat += (int) !empty($metaBundle->metaGlobalVars[$setupField]); |
|
160 | 160 | $value = $variables['contentSetupChecklist'][$setupField]['value'] ?? 0; |
161 | 161 | $variables['contentSetupChecklist'][$setupField] = [ |
162 | 162 | 'label' => $setupLabel, |
163 | - 'value' => $value + (int)!empty($metaBundle->metaGlobalVars[$setupField]), |
|
163 | + 'value' => $value + (int) !empty($metaBundle->metaGlobalVars[$setupField]), |
|
164 | 164 | ]; |
165 | 165 | } |
166 | 166 | $stat = round($numGrades - (($stat * $numGrades) / $numFields)); |