@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | */ |
21 | 21 | |
22 | 22 | return [ |
23 | - MetaTagContainer::CONTAINER_TYPE . TagService::GENERAL_HANDLE => [ |
|
23 | + MetaTagContainer::CONTAINER_TYPE.TagService::GENERAL_HANDLE => [ |
|
24 | 24 | 'name' => 'General', |
25 | 25 | 'description' => 'General Meta Tags', |
26 | 26 | 'handle' => TagService::GENERAL_HANDLE, |
27 | - 'class' => (string)MetaTagContainer::class, |
|
27 | + 'class' => (string) MetaTagContainer::class, |
|
28 | 28 | 'include' => true, |
29 | 29 | 'dependencies' => [ |
30 | 30 | ], |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | ], |
77 | 77 | ], |
78 | 78 | ], |
79 | - MetaTagContainer::CONTAINER_TYPE . TagService::FACEBOOK_HANDLE => [ |
|
79 | + MetaTagContainer::CONTAINER_TYPE.TagService::FACEBOOK_HANDLE => [ |
|
80 | 80 | 'name' => 'Facebook', |
81 | 81 | 'description' => 'Facebook OpenGraph Meta Tags', |
82 | 82 | 'handle' => TagService::FACEBOOK_HANDLE, |
83 | - 'class' => (string)MetaTagContainer::class, |
|
83 | + 'class' => (string) MetaTagContainer::class, |
|
84 | 84 | 'include' => true, |
85 | 85 | 'dependencies' => [ |
86 | 86 | ], |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | ], |
207 | 207 | ], |
208 | 208 | ], |
209 | - MetaTagContainer::CONTAINER_TYPE . TagService::TWITTER_HANDLE => [ |
|
209 | + MetaTagContainer::CONTAINER_TYPE.TagService::TWITTER_HANDLE => [ |
|
210 | 210 | 'name' => 'Twitter', |
211 | 211 | 'description' => 'Twitter Card Meta Tags', |
212 | 212 | 'handle' => TagService::TWITTER_HANDLE, |
213 | 213 | 'include' => true, |
214 | - 'class' => (string)MetaTagContainer::class, |
|
214 | + 'class' => (string) MetaTagContainer::class, |
|
215 | 215 | 'data' => [ |
216 | 216 | 'twitter:card' => [ |
217 | 217 | 'charset' => '', |
@@ -287,11 +287,11 @@ discard block |
||
287 | 287 | ], |
288 | 288 | ], |
289 | 289 | ], |
290 | - MetaTagContainer::CONTAINER_TYPE . TagService::MISC_HANDLE => [ |
|
290 | + MetaTagContainer::CONTAINER_TYPE.TagService::MISC_HANDLE => [ |
|
291 | 291 | 'name' => 'Miscellaneous', |
292 | 292 | 'description' => 'Miscellaneous Meta Tags', |
293 | 293 | 'handle' => TagService::MISC_HANDLE, |
294 | - 'class' => (string)MetaTagContainer::class, |
|
294 | + 'class' => (string) MetaTagContainer::class, |
|
295 | 295 | 'include' => true, |
296 | 296 | 'dependencies' => [ |
297 | 297 | ], |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | // Go from most specific type to least specific type |
95 | 95 | foreach (self::SCHEMA_TYPES as $schemaType) { |
96 | 96 | if (!empty($settings[$schemaType]) && ($settings[$schemaType] !== 'none')) { |
97 | - $result = $settings[$schemaType] . self::SCHEMA_PATH_DELIMITER . $result; |
|
97 | + $result = $settings[$schemaType].self::SCHEMA_PATH_DELIMITER.$result; |
|
98 | 98 | } |
99 | 99 | } |
100 | 100 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if (isset($result['schemaTypeDescription'])) { |
127 | 127 | $description = $result['schemaTypeDescription']; |
128 | 128 | $description = preg_replace("`\[\[([A-z]*)\]\]`", '[$1](https://schema.org/$1)', $description); |
129 | - $description = Markdown::process((string)$description); |
|
129 | + $description = Markdown::process((string) $description); |
|
130 | 130 | $description = str_replace(['<p>', '</p>', '\n'], ['', '', ' '], $description); |
131 | 131 | $result['schemaTypeDescription'] = $description; |
132 | 132 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $result = []; |
149 | 149 | while ($schemaType) { |
150 | - $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType; |
|
150 | + $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType; |
|
151 | 151 | if (class_exists($className)) { |
152 | 152 | try { |
153 | 153 | $classRef = new \ReflectionClass($className); |
@@ -254,15 +254,15 @@ discard block |
||
254 | 254 | $dependency = new TagDependency([ |
255 | 255 | 'tags' => [ |
256 | 256 | self::GLOBAL_SCHEMA_CACHE_TAG, |
257 | - self::SCHEMA_CACHE_TAG . 'schemaArray', |
|
257 | + self::SCHEMA_CACHE_TAG.'schemaArray', |
|
258 | 258 | ], |
259 | 259 | ]); |
260 | 260 | $cache = Craft::$app->getCache(); |
261 | 261 | $typesArray = $cache->getOrSet( |
262 | - self::CACHE_KEY . 'schemaArray', |
|
263 | - function () use ($path) { |
|
262 | + self::CACHE_KEY.'schemaArray', |
|
263 | + function() use ($path) { |
|
264 | 264 | Craft::info( |
265 | - 'schemaArray cache miss' . $path, |
|
265 | + 'schemaArray cache miss'.$path, |
|
266 | 266 | __METHOD__ |
267 | 267 | ); |
268 | 268 | $filePath = Craft::getAlias('@nystudio107/seomatic/resources/schema/tree.jsonld'); |
@@ -355,13 +355,13 @@ discard block |
||
355 | 355 | $dependency = new TagDependency([ |
356 | 356 | 'tags' => [ |
357 | 357 | self::GLOBAL_SCHEMA_CACHE_TAG, |
358 | - self::SCHEMA_CACHE_TAG . 'schemaTree', |
|
358 | + self::SCHEMA_CACHE_TAG.'schemaTree', |
|
359 | 359 | ], |
360 | 360 | ]); |
361 | 361 | $cache = Craft::$app->getCache(); |
362 | 362 | $typesArray = $cache->getOrSet( |
363 | - self::CACHE_KEY . 'schemaTree', |
|
364 | - function () { |
|
363 | + self::CACHE_KEY.'schemaTree', |
|
364 | + function() { |
|
365 | 365 | Craft::info( |
366 | 366 | 'schemaArray cache miss', |
367 | 367 | __METHOD__ |
@@ -396,11 +396,11 @@ discard block |
||
396 | 396 | foreach ($typesArray as $key => $value) { |
397 | 397 | $indent = html_entity_decode(str_repeat(' ', $indentLevel)); |
398 | 398 | if (\is_array($value)) { |
399 | - $result[$key] = $indent . $key; |
|
399 | + $result[$key] = $indent.$key; |
|
400 | 400 | $value = self::flattenSchemaArray($value, $indentLevel + self::MENU_INDENT_STEP); |
401 | 401 | $result = array_merge($result, $value); |
402 | 402 | } else { |
403 | - $result[$key] = $indent . $value; |
|
403 | + $result[$key] = $indent.$value; |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | $children = []; |
495 | 495 | $name = $typesArray['name']; |
496 | 496 | // Construct a path-based $id, excluding the top-level `Thing` schema |
497 | - $id = $name === 'Thing' ? '' : $path . self::SCHEMA_PATH_DELIMITER . $name; |
|
497 | + $id = $name === 'Thing' ? '' : $path.self::SCHEMA_PATH_DELIMITER.$name; |
|
498 | 498 | $id = ltrim($id, self::SCHEMA_PATH_DELIMITER); |
499 | 499 | // Make sure we have at most 3 specifiers in the schema path |
500 | 500 | $parts = explode(self::SCHEMA_PATH_DELIMITER, $id); |
@@ -521,12 +521,12 @@ discard block |
||
521 | 521 | $schemaPath = explode(self::SCHEMA_PATH_DELIMITER, $id); |
522 | 522 | // Use only the specific (last) type for now, rather than the complete path of types |
523 | 523 | $schemaPath = [end($schemaPath)]; |
524 | - if ((bool)array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
525 | - $name .= ' (' . Craft::t('seomatic', 'Google rich result') . ')'; |
|
524 | + if ((bool) array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
525 | + $name .= ' ('.Craft::t('seomatic', 'Google rich result').')'; |
|
526 | 526 | } |
527 | 527 | // Mark it as pending, if applicable |
528 | 528 | if (isset($typesArray['pending']) && $typesArray['pending']) { |
529 | - $name .= ' (' . Craft::t('seomatic', 'pending') . ')'; |
|
529 | + $name .= ' ('.Craft::t('seomatic', 'pending').')'; |
|
530 | 530 | } |
531 | 531 | $result['label'] = $name; |
532 | 532 | $result['id'] = $id; |
@@ -545,13 +545,13 @@ discard block |
||
545 | 545 | $dependency = new TagDependency([ |
546 | 546 | 'tags' => [ |
547 | 547 | self::GLOBAL_SCHEMA_CACHE_TAG, |
548 | - self::SCHEMA_CACHE_TAG . 'googleRichSnippets', |
|
548 | + self::SCHEMA_CACHE_TAG.'googleRichSnippets', |
|
549 | 549 | ], |
550 | 550 | ]); |
551 | 551 | $cache = Craft::$app->getCache(); |
552 | 552 | return $cache->getOrSet( |
553 | - self::CACHE_KEY . 'googleRichSnippets', |
|
554 | - function () { |
|
553 | + self::CACHE_KEY.'googleRichSnippets', |
|
554 | + function() { |
|
555 | 555 | Craft::info( |
556 | 556 | 'googleRichSnippets cache miss', |
557 | 557 | __METHOD__ |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $lastSegment = end($segments); |
344 | 344 | $site = Craft::$app->getSites()->getSiteByHandle($lastSegment); |
345 | 345 | if ($site !== null) { |
346 | - $siteSuffix = '/' . $lastSegment; |
|
346 | + $siteSuffix = '/'.$lastSegment; |
|
347 | 347 | } |
348 | 348 | } |
349 | 349 | $currentUser = Craft::$app->getUser()->getIdentity(); |
@@ -351,31 +351,31 @@ discard block |
||
351 | 351 | if ($currentUser->can('seomatic:dashboard')) { |
352 | 352 | $subNavs['dashboard'] = [ |
353 | 353 | 'label' => Craft::t('seomatic', 'Dashboard'), |
354 | - 'url' => 'seomatic/dashboard' . $siteSuffix, |
|
354 | + 'url' => 'seomatic/dashboard'.$siteSuffix, |
|
355 | 355 | ]; |
356 | 356 | } |
357 | 357 | if ($currentUser->can('seomatic:global-meta')) { |
358 | 358 | $subNavs['global'] = [ |
359 | 359 | 'label' => Craft::t('seomatic', 'Global SEO'), |
360 | - 'url' => 'seomatic/global/general' . $siteSuffix, |
|
360 | + 'url' => 'seomatic/global/general'.$siteSuffix, |
|
361 | 361 | ]; |
362 | 362 | } |
363 | 363 | if ($currentUser->can('seomatic:content-meta')) { |
364 | 364 | $subNavs['content'] = [ |
365 | 365 | 'label' => Craft::t('seomatic', 'Content SEO'), |
366 | - 'url' => 'seomatic/content' . $siteSuffix, |
|
366 | + 'url' => 'seomatic/content'.$siteSuffix, |
|
367 | 367 | ]; |
368 | 368 | } |
369 | 369 | if ($currentUser->can('seomatic:site-settings')) { |
370 | 370 | $subNavs['site'] = [ |
371 | 371 | 'label' => Craft::t('seomatic', 'Site Settings'), |
372 | - 'url' => 'seomatic/site/identity' . $siteSuffix, |
|
372 | + 'url' => 'seomatic/site/identity'.$siteSuffix, |
|
373 | 373 | ]; |
374 | 374 | } |
375 | 375 | if ($currentUser->can('seomatic:tracking-scripts')) { |
376 | 376 | $subNavs['tracking'] = [ |
377 | 377 | 'label' => Craft::t('seomatic', 'Tracking Scripts'), |
378 | - 'url' => 'seomatic/tracking/gtag' . $siteSuffix, |
|
378 | + 'url' => 'seomatic/tracking/gtag'.$siteSuffix, |
|
379 | 379 | ]; |
380 | 380 | } |
381 | 381 | $editableSettings = true; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | Event::on( |
421 | 421 | Plugins::class, |
422 | 422 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
423 | - function (PluginEvent $event) { |
|
423 | + function(PluginEvent $event) { |
|
424 | 424 | if ($event->plugin === $this) { |
425 | 425 | // Invalidate our caches after we've been installed |
426 | 426 | $this->clearAllCaches(); |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | Event::on( |
442 | 442 | ClearCaches::class, |
443 | 443 | ClearCaches::EVENT_REGISTER_CACHE_OPTIONS, |
444 | - function (RegisterCacheOptionsEvent $event) { |
|
444 | + function(RegisterCacheOptionsEvent $event) { |
|
445 | 445 | Craft::debug( |
446 | 446 | 'ClearCaches::EVENT_REGISTER_CACHE_OPTIONS', |
447 | 447 | __METHOD__ |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | Event::on( |
458 | 458 | Plugins::class, |
459 | 459 | Plugins::EVENT_BEFORE_SAVE_PLUGIN_SETTINGS, |
460 | - function (PluginEvent $event) { |
|
460 | + function(PluginEvent $event) { |
|
461 | 461 | if ($event->plugin === $this && !Craft::$app->getDb()->getSupportsMb4()) { |
462 | 462 | // For all the emojis |
463 | 463 | $settingsModel = $this->getSettings(); |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | Event::on( |
488 | 488 | Plugins::class, |
489 | 489 | Plugins::EVENT_AFTER_LOAD_PLUGINS, |
490 | - function () { |
|
490 | + function() { |
|
491 | 491 | // Delay registering SEO Elements to give other plugins a chance to load first |
492 | 492 | $this->seoElements->getAllSeoElementTypes(false); |
493 | 493 | // Delay installing GQL handlers to give other plugins a chance to register their own first |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | Event::on( |
509 | 509 | Fields::class, |
510 | 510 | Fields::EVENT_REGISTER_FIELD_TYPES, |
511 | - static function (RegisterComponentTypesEvent $event) { |
|
511 | + static function(RegisterComponentTypesEvent $event) { |
|
512 | 512 | $event->types[] = SeoSettingsField::class; |
513 | 513 | $event->types[] = Seomatic_MetaField::class; |
514 | 514 | } |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | Event::on( |
518 | 518 | Elements::class, |
519 | 519 | Elements::EVENT_AFTER_SAVE_ELEMENT, |
520 | - static function (ElementEvent $event) { |
|
520 | + static function(ElementEvent $event) { |
|
521 | 521 | Craft::debug( |
522 | 522 | 'Elements::EVENT_AFTER_SAVE_ELEMENT', |
523 | 523 | __METHOD__ |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | Event::on( |
538 | 538 | Elements::class, |
539 | 539 | Elements::EVENT_AFTER_DELETE_ELEMENT, |
540 | - static function (ElementEvent $event) { |
|
540 | + static function(ElementEvent $event) { |
|
541 | 541 | Craft::debug( |
542 | 542 | 'Elements::EVENT_AFTER_DELETE_ELEMENT', |
543 | 543 | __METHOD__ |
@@ -556,19 +556,19 @@ discard block |
||
556 | 556 | Event::on( |
557 | 557 | Entry::class, |
558 | 558 | Element::EVENT_REGISTER_PREVIEW_TARGETS, |
559 | - static function (RegisterPreviewTargetsEvent $e) { |
|
559 | + static function(RegisterPreviewTargetsEvent $e) { |
|
560 | 560 | /** @var Element $element */ |
561 | 561 | $element = $e->sender; |
562 | 562 | if ($element->uri !== null) { |
563 | 563 | $e->previewTargets[] = [ |
564 | - 'label' => ' |