@@ -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 */ |
@@ -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 | ); |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | // Go from most specific type to least specific type |
| 100 | 100 | foreach (self::SCHEMA_TYPES as $schemaType) { |
| 101 | 101 | if (!empty($settings[$schemaType]) && ($settings[$schemaType] !== 'none')) { |
| 102 | - $result = $settings[$schemaType] . self::SCHEMA_PATH_DELIMITER . $result; |
|
| 102 | + $result = $settings[$schemaType].self::SCHEMA_PATH_DELIMITER.$result; |
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | if (isset($result['schemaTypeDescription'])) { |
| 125 | 125 | $description = $result['schemaTypeDescription']; |
| 126 | 126 | $description = preg_replace("`\[\[([A-z]*)\]\]`", '[$1](https://schema.org/$1)', $description); |
| 127 | - $description = Markdown::process((string)$description); |
|
| 127 | + $description = Markdown::process((string) $description); |
|
| 128 | 128 | $description = str_replace(['<p>', '</p>', '\n'], ['', '', ' '], $description); |
| 129 | 129 | $result['schemaTypeDescription'] = $description; |
| 130 | 130 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | $result = []; |
| 145 | 145 | while ($schemaType) { |
| 146 | - $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType; |
|
| 146 | + $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType; |
|
| 147 | 147 | if (class_exists($className)) { |
| 148 | 148 | $classRef = new ReflectionClass($className); |
| 149 | 149 | $staticProps = $classRef->getStaticProperties(); |
@@ -242,15 +242,15 @@ discard block |
||
| 242 | 242 | $dependency = new TagDependency([ |
| 243 | 243 | 'tags' => [ |
| 244 | 244 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 245 | - self::SCHEMA_CACHE_TAG . 'schemaArray', |
|
| 245 | + self::SCHEMA_CACHE_TAG.'schemaArray', |
|
| 246 | 246 | ], |
| 247 | 247 | ]); |
| 248 | 248 | $cache = Craft::$app->getCache(); |
| 249 | 249 | $typesArray = $cache->getOrSet( |
| 250 | - self::CACHE_KEY . 'schemaArray', |
|
| 250 | + self::CACHE_KEY.'schemaArray', |
|
| 251 | 251 | function() use ($path) { |
| 252 | 252 | Craft::info( |
| 253 | - 'schemaArray cache miss: ' . $path, |
|
| 253 | + 'schemaArray cache miss: '.$path, |
|
| 254 | 254 | __METHOD__ |
| 255 | 255 | ); |
| 256 | 256 | $filePath = Craft::getAlias('@nystudio107/seomatic/resources/schema/tree.jsonld'); |
@@ -315,12 +315,12 @@ discard block |
||
| 315 | 315 | $dependency = new TagDependency([ |
| 316 | 316 | 'tags' => [ |
| 317 | 317 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 318 | - self::SCHEMA_CACHE_TAG . 'schemaTree', |
|
| 318 | + self::SCHEMA_CACHE_TAG.'schemaTree', |
|
| 319 | 319 | ], |
| 320 | 320 | ]); |
| 321 | 321 | $cache = Craft::$app->getCache(); |
| 322 | 322 | $typesArray = $cache->getOrSet( |
| 323 | - self::CACHE_KEY . 'schemaTree', |
|
| 323 | + self::CACHE_KEY.'schemaTree', |
|
| 324 | 324 | function() { |
| 325 | 325 | Craft::info( |
| 326 | 326 | 'schemaTree cache miss', |
@@ -384,11 +384,11 @@ discard block |
||
| 384 | 384 | foreach ($typesArray as $key => $value) { |
| 385 | 385 | $indent = html_entity_decode(str_repeat(' ', $indentLevel)); |
| 386 | 386 | if (is_array($value)) { |
| 387 | - $result[$key] = $indent . $key; |
|
| 387 | + $result[$key] = $indent.$key; |
|
| 388 | 388 | $value = self::flattenSchemaArray($value, $indentLevel + self::MENU_INDENT_STEP); |
| 389 | 389 | $result = array_merge($result, $value); |
| 390 | 390 | } else { |
| 391 | - $result[$key] = $indent . $value; |
|
| 391 | + $result[$key] = $indent.$value; |
|
| 392 | 392 | } |
| 393 | 393 | } |
| 394 | 394 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | $children = []; |
| 483 | 483 | $name = $typesArray['name']; |
| 484 | 484 | // Construct a path-based $id, excluding the top-level `Thing` schema |
| 485 | - $id = $name === 'Thing' ? '' : $path . self::SCHEMA_PATH_DELIMITER . $name; |
|
| 485 | + $id = $name === 'Thing' ? '' : $path.self::SCHEMA_PATH_DELIMITER.$name; |
|
| 486 | 486 | $id = ltrim($id, self::SCHEMA_PATH_DELIMITER); |
| 487 | 487 | // Make sure we have at most 3 specifiers in the schema path |
| 488 | 488 | $parts = explode(self::SCHEMA_PATH_DELIMITER, $id); |
@@ -509,12 +509,12 @@ discard block |
||
| 509 | 509 | $schemaPath = explode(self::SCHEMA_PATH_DELIMITER, $id); |
| 510 | 510 | // Use only the specific (last) type for now, rather than the complete path of types |
| 511 | 511 | $schemaPath = [end($schemaPath)]; |
| 512 | - if ((bool)array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
| 513 | - $name .= ' (' . Craft::t('seomatic', 'Google rich result') . ')'; |
|
| 512 | + if ((bool) array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
| 513 | + $name .= ' ('.Craft::t('seomatic', 'Google rich result').')'; |
|
| 514 | 514 | } |
| 515 | 515 | // Mark it as pending, if applicable |
| 516 | 516 | if (isset($typesArray['pending']) && $typesArray['pending']) { |
| 517 | - $name .= ' (' . Craft::t('seomatic', 'pending') . ')'; |
|
| 517 | + $name .= ' ('.Craft::t('seomatic', 'pending').')'; |
|
| 518 | 518 | } |
| 519 | 519 | $result['label'] = $name; |
| 520 | 520 | $result['id'] = $id; |
@@ -533,12 +533,12 @@ discard block |
||
| 533 | 533 | $dependency = new TagDependency([ |
| 534 | 534 | 'tags' => [ |
| 535 | 535 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 536 | - self::SCHEMA_CACHE_TAG . 'googleRichSnippets', |
|
| 536 | + self::SCHEMA_CACHE_TAG.'googleRichSnippets', |
|
| 537 | 537 | ], |
| 538 | 538 | ]); |
| 539 | 539 | $cache = Craft::$app->getCache(); |
| 540 | 540 | return $cache->getOrSet( |
| 541 | - self::CACHE_KEY . 'googleRichSnippets', |
|
| 541 | + self::CACHE_KEY.'googleRichSnippets', |
|
| 542 | 542 | function() { |
| 543 | 543 | Craft::info( |
| 544 | 544 | 'googleRichSnippets cache miss', |
@@ -65,19 +65,19 @@ discard block |
||
| 65 | 65 | } |
| 66 | 66 | foreach (self::PULL_TEXT_FIELDS as $fields) { |
| 67 | 67 | $fieldName = $fields['fieldName']; |
| 68 | - $source = $bundleSettings[$fieldName . 'Source'] ?? ''; |
|
| 69 | - $sourceField = $bundleSettings[$fieldName . 'Field'] ?? ''; |
|
| 68 | + $source = $bundleSettings[$fieldName.'Source'] ?? ''; |
|
| 69 | + $sourceField = $bundleSettings[$fieldName.'Field'] ?? ''; |
|
| 70 | 70 | if (!empty($source)) { |
| 71 | 71 | $seoField = $fields['seoField']; |
| 72 | 72 | switch ($source) { |
| 73 | 73 | case 'sameAsSeo': |
| 74 | 74 | $globalsSettings[$fieldName] = |
| 75 | - '{{ seomatic.meta.' . $seoField . ' }}'; |
|
| 75 | + '{{ seomatic.meta.'.$seoField.' }}'; |
|
| 76 | 76 | break; |
| 77 | 77 | |
| 78 | 78 | case 'sameAsSiteTwitter': |
| 79 | 79 | $globalsSettings[$fieldName] = |
| 80 | - '{{ seomatic.site.' . $seoField . ' }}'; |
|
| 80 | + '{{ seomatic.site.'.$seoField.' }}'; |
|
| 81 | 81 | break; |
| 82 | 82 | |
| 83 | 83 | case 'sameAsGlobal': |
@@ -88,28 +88,28 @@ discard block |
||
| 88 | 88 | case 'fromField': |
| 89 | 89 | $globalsSettings[$fieldName] = |
| 90 | 90 | '{{ seomatic.helper.extractTextFromField(' |
| 91 | - . $objectPrefix . $elementName . $sourceField |
|
| 91 | + . $objectPrefix.$elementName.$sourceField |
|
| 92 | 92 | . ') }}'; |
| 93 | 93 | break; |
| 94 | 94 | |
| 95 | 95 | case 'fromUserField': |
| 96 | 96 | $globalsSettings[$fieldName] = |
| 97 | 97 | '{{ seomatic.helper.extractTextFromField(' |
| 98 | - . $objectPrefix . $elementName . 'author.' . $sourceField |
|
| 98 | + . $objectPrefix.$elementName.'author.'.$sourceField |
|
| 99 | 99 | . ') }}'; |
| 100 | 100 | break; |
| 101 | 101 | |
| 102 | 102 | case 'summaryFromField': |
| 103 | 103 | $globalsSettings[$fieldName] = |
| 104 | 104 | '{{ seomatic.helper.extractSummary(seomatic.helper.extractTextFromField(' |
| 105 | - . $objectPrefix . $elementName . $sourceField |
|
| 105 | + . $objectPrefix.$elementName.$sourceField |
|
| 106 | 106 | . ')) }}'; |
| 107 | 107 | break; |
| 108 | 108 | |
| 109 | 109 | case 'keywordsFromField': |
| 110 | 110 | $globalsSettings[$fieldName] = |
| 111 | 111 | '{{ seomatic.helper.extractKeywords(seomatic.helper.extractTextFromField(' |
| 112 | - . $objectPrefix . $elementName . $sourceField |
|
| 112 | + . $objectPrefix.$elementName.$sourceField |
|
| 113 | 113 | . ')) }}'; |
| 114 | 114 | break; |
| 115 | 115 | |
@@ -140,25 +140,25 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | foreach (self::PULL_ASSET_FIELDS as $fields) { |
| 142 | 142 | $fieldName = $fields['fieldName']; |
| 143 | - $fieldNameWidth = $fields['fieldName'] . 'Width'; |
|
| 144 | - $fieldNameHeight = $fields['fieldName'] . 'Height'; |
|
| 145 | - $source = $bundleSettings[$fieldName . 'Source'] ?? ''; |
|
| 146 | - $ids = $bundleSettings[$fieldName . 'Ids'] ?? []; |
|
| 147 | - $sourceField = $bundleSettings[$fieldName . 'Field'] ?? ''; |
|
| 143 | + $fieldNameWidth = $fields['fieldName'].'Width'; |
|
| 144 | + $fieldNameHeight = $fields['fieldName'].'Height'; |
|
| 145 | + $source = $bundleSettings[$fieldName.'Source'] ?? ''; |
|
| 146 | + $ids = $bundleSettings[$fieldName.'Ids'] ?? []; |
|
| 147 | + $sourceField = $bundleSettings[$fieldName.'Field'] ?? ''; |
|
| 148 | 148 | if (!empty($source)) { |
| 149 | - $transformImage = $bundleSettings[$fieldName . 'Transform'] ?? true; |
|
| 149 | + $transformImage = $bundleSettings[$fieldName.'Transform'] ?? true; |
|
| 150 | 150 | $seoField = $fields['seoField']; |
| 151 | 151 | $tranformModeField = $fields['transformModeField']; |
| 152 | 152 | $transformMode = $bundleSettings[$tranformModeField] ?? 'crop'; |
| 153 | 153 | if (empty($transformMode)) { |
| 154 | 154 | $transformMode = 'crop'; |
| 155 | 155 | } |
| 156 | - $seoFieldWidth = $fields['seoField'] . 'Width'; |
|
| 157 | - $seoFieldHeight = $fields['seoField'] . 'Height'; |
|
| 156 | + $seoFieldWidth = $fields['seoField'].'Width'; |
|
| 157 | + $seoFieldHeight = $fields['seoField'].'Height'; |
|
| 158 | 158 | $transformName = $fields['transformName']; |
| 159 | 159 | // Quote all the things here for clarity |
| 160 | - $transformName = '"' . $transformName . '"'; |
|
| 161 | - $transformMode = '"' . $transformMode . '"'; |
|
| 160 | + $transformName = '"'.$transformName.'"'; |
|
| 161 | + $transformMode = '"'.$transformMode.'"'; |
|
| 162 | 162 | // Special-case Twitter transforms |
| 163 | 163 | if ($fieldName === 'twitterImage') { |
| 164 | 164 | $transformName = 'seomatic.helper.twitterTransform()'; |
@@ -173,30 +173,30 @@ discard block |
||
| 173 | 173 | if ($transformImage) { |
| 174 | 174 | switch ($source) { |
| 175 | 175 | case 'sameAsSeo': |
| 176 | - $seoSource = $bundleSettings[$seoField . 'Source'] ?? ''; |
|
| 177 | - $seoIds = $bundleSettings[$seoField . 'Ids'] ?? []; |
|
| 178 | - $seoSourceField = $bundleSettings[$seoField . 'Field'] ?? ''; |
|
| 176 | + $seoSource = $bundleSettings[$seoField.'Source'] ?? ''; |
|
| 177 | + $seoIds = $bundleSettings[$seoField.'Ids'] ?? []; |
|
| 178 | + $seoSourceField = $bundleSettings[$seoField.'Field'] ?? ''; |
|
| 179 | 179 | if (!empty($seoSource)) { |
| 180 | 180 | switch ($seoSource) { |
| 181 | 181 | case 'fromField': |
| 182 | 182 | if (!empty($seoSourceField)) { |
| 183 | 183 | $globalsSettings[$fieldName] = '{{ seomatic.helper.socialTransform(' |
| 184 | - . $objectPrefix . $elementName . $seoSourceField |
|
| 185 | - . ', ' . $transformName |
|
| 186 | - . ', ' . $siteId |
|
| 187 | - . ', ' . $transformMode |
|
| 184 | + . $objectPrefix.$elementName.$seoSourceField |
|
| 185 | + . ', '.$transformName |
|
| 186 | + . ', '.$siteId |
|
| 187 | + . ', '.$transformMode |
|
| 188 | 188 | . ') }}'; |
| 189 | 189 | $globalsSettings[$fieldNameWidth] = '{{ seomatic.helper.socialTransformWidth(' |
| 190 | - . $objectPrefix . $elementName . $seoSourceField |
|
| 191 | - . ', ' . $transformName |
|
| 192 | - . ', ' . $siteId |
|
| 193 | - . ', ' . $transformMode |
|
| 190 | + . $objectPrefix.$elementName.$seoSourceField |
|
| 191 | + . ', '.$transformName |
|
| 192 | + . ', '.$siteId |
|
| 193 | + . ', '.$transformMode |
|
| 194 | 194 | . ') }}'; |
| 195 | 195 | $globalsSettings[$fieldNameHeight] = '{{ seomatic.helper.socialTransformHeight(' |
| 196 | - . $objectPrefix . $elementName . $seoSourceField |
|
| 197 | - . ', ' . $transformName |
|
| 198 | - . ', ' . $siteId |
|
| 199 | - . ', ' . $transformMode |
|
| 196 | + . $objectPrefix.$elementName.$seoSourceField |
|
| 197 | + . ', '.$transformName |
|
| 198 | + . ', '.$siteId |
|
| 199 | + . ', '.$transformMode |
|
| 200 | 200 | . ') }}'; |
| 201 | 201 | } |
| 202 | 202 | break; |
@@ -204,28 +204,28 @@ discard block |
||
| 204 | 204 | if (!empty($seoIds)) { |
| 205 | 205 | $globalsSettings[$fieldName] = '{{ seomatic.helper.socialTransform(' |
| 206 | 206 | . $seoIds[0] |
| 207 | - . ', ' . $transformName |
|
| 208 | - . ', ' . $siteId |
|
| 209 | - . ', ' . $transformMode |
|
| 207 | + . ', '.$transformName |
|
| 208 | + . ', '.$siteId |
|
| 209 | + . ', '.$transformMode |
|
| 210 | 210 | . ') }}'; |
| 211 | 211 | $globalsSettings[$fieldNameWidth] = '{{ seomatic.helper.socialTransformWidth(' |
| 212 | 212 | . $seoIds[0] |
| 213 | - . ', ' . $transformName |
|
| 214 | - . ', ' . $siteId |
|
| 215 | - . ', ' . $transformMode |
|
| 213 | + . ', '.$transformName |
|
| 214 | + . ', '.$siteId |
|
| 215 | + . ', '.$transformMode |
|
| 216 | 216 | . ') }}'; |
| 217 | 217 | $globalsSettings[$fieldNameHeight] = '{{ seomatic.helper.socialTransformHeight(' |
| 218 | 218 | . $seoIds[0] |
| 219 | - . ', ' . $transformName |
|
| 220 | - . ', ' . $siteId |
|
| 221 | - . ', ' . $transformMode |
|
| 219 | + . ', '.$transformName |
|
| 220 | + . ', '.$siteId |
|
| 221 | + . ', '.$transformMode |
|
| 222 | 222 | . ') }}'; |
| 223 | 223 | } |
| 224 | 224 | break; |
| 225 | 225 | default: |
| 226 | - $globalsSettings[$fieldName] = '{{ seomatic.meta.' . $seoField . ' }}'; |
|
| 227 | - $globalsSettings[$fieldNameWidth] = '{{ seomatic.meta.' . $seoFieldWidth . ' }}'; |
|
| 228 | - $globalsSettings[$fieldNameHeight] = '{{ seomatic.meta.' . $seoFieldHeight . ' }}'; |
|
| 226 | + $globalsSettings[$fieldName] = '{{ seomatic.meta.'.$seoField.' }}'; |
|
| 227 | + $globalsSettings[$fieldNameWidth] = '{{ seomatic.meta.'.$seoFieldWidth.' }}'; |
|
| 228 | + $globalsSettings[$fieldNameHeight] = '{{ seomatic.meta.'.$seoFieldHeight.' }}'; |
|
| 229 | 229 | break; |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -233,22 +233,22 @@ discard block |
||
| 233 | 233 | case 'fromField': |
| 234 | 234 | if (!empty($sourceField)) { |
| 235 | 235 | $globalsSettings[$fieldName] = '{{ seomatic.helper.socialTransform(' |
| 236 | - . $objectPrefix . $elementName . $sourceField |
|
| 237 | - . ', ' . $transformName |
|
| 238 | - . ', ' . $siteId |
|
| 239 | - . ', ' . $transformMode |
|
| 236 | + . $objectPrefix.$elementName.$sourceField |
|
| 237 | + . ', '.$transformName |
|
| 238 | + . ', '.$siteId |
|
| 239 | + . ', '.$transformMode |
|
| 240 | 240 | . ') }}'; |
| 241 | 241 | $globalsSettings[$fieldNameWidth] = '{{ seomatic.helper.socialTransformWidth(' |
| 242 | - . $objectPrefix . $elementName . $sourceField |
|
| 243 | - . ', ' . $transformName |
|
| 244 | - . ', ' . $siteId |
|
| 245 | - . ', ' . $transformMode |
|
| 242 | + . $objectPrefix.$elementName.$sourceField |
|
| 243 | + . ', '.$transformName |
|
| 244 | + . ', '.$siteId |
|
| 245 | + . ', '.$transformMode |
|
| 246 | 246 | . ') }}'; |
| 247 | 247 | $globalsSettings[$fieldNameHeight] = '{{ seomatic.helper.socialTransformHeight(' |
| 248 | - . $objectPrefix . $elementName . $sourceField |
|
| 249 | - . ', ' . $transformName |
|
| 250 | - . ', ' . $siteId |
|
| 251 | - . ', ' . $transformMode |
|
| 248 | + . $objectPrefix.$elementName.$sourceField |
|
| 249 | + . ', '.$transformName |
|
| 250 | + . ', '.$siteId |
|
| 251 | + . ', '.$transformMode |
|
| 252 | 252 | . ') }}'; |
| 253 | 253 | } |
| 254 | 254 | break; |
@@ -256,21 +256,21 @@ discard block |
||
| 256 | 256 | if (!empty($ids)) { |
| 257 | 257 | $globalsSettings[$fieldName] = '{{ seomatic.helper.socialTransform(' |
| 258 | 258 | . $ids[0] |
| 259 | - . ', ' . $transformName |
|
| 260 | - . ', ' . $siteId |
|
| 261 | - . ', ' . $transformMode |
|
| 259 | + . ', '.$transformName |
|
| 260 | + . ', '.$siteId |
|
| 261 | + . ', '.$transformMode |
|
| 262 | 262 | . ') }}'; |
| 263 | 263 | $globalsSettings[$fieldNameWidth] = '{{ seomatic.helper.socialTransformWidth(' |
| 264 | 264 | . $ids[0] |
| 265 | - . ', ' . $transformName |
|
| 266 | - . ', ' . $siteId |
|
| 267 | - . ', ' . $transformMode |
|
| 265 | + . ', '.$transformName |
|
| 266 | + . ', '.$siteId |
|
| 267 | + . ', '.$transformMode |
|
| 268 | 268 | . ') }}'; |
| 269 | 269 | $globalsSettings[$fieldNameHeight] = '{{ seomatic.helper.socialTransformHeight(' |
| 270 | 270 | . $ids[0] |
| 271 | - . ', ' . $transformName |
|
| 272 | - . ', ' . $siteId |
|
| 273 | - . ', ' . $transformMode |
|
| 271 | + . ', '.$transformName |
|
| 272 | + . ', '.$siteId |
|
| 273 | + . ', '.$transformMode |
|
| 274 | 274 | . ') }}'; |
| 275 | 275 | } |
| 276 | 276 | break; |
@@ -278,20 +278,20 @@ discard block |
||
| 278 | 278 | } else { |
| 279 | 279 | switch ($source) { |
| 280 | 280 | case 'sameAsSeo': |
| 281 | - $globalsSettings[$fieldName] = '{{ seomatic.meta.' . $seoField . ' }}'; |
|
| 282 | - $globalsSettings[$fieldNameWidth] = '{{ seomatic.meta.' . $seoFieldWidth . ' }}'; |
|
| 283 | - $globalsSettings[$fieldNameHeight] = '{{ seomatic.meta.' . $seoFieldHeight . ' }}'; |
|
| 281 | + $globalsSettings[$fieldName] = '{{ seomatic.meta.'.$seoField.' }}'; |
|
| 282 | + $globalsSettings[$fieldNameWidth] = '{{ seomatic.meta.'.$seoFieldWidth.' }}'; |
|
| 283 | + $globalsSettings[$fieldNameHeight] = '{{ seomatic.meta.'.$seoFieldHeight.' }}'; |
|
| 284 | 284 | break; |
| 285 | 285 | case 'fromField': |
| 286 | 286 | if (!empty($sourceField)) { |
| 287 | 287 | $globalsSettings[$fieldName] = '{{ ' |
| 288 | - . $elementName . $sourceField . '[0].url' |
|
| 288 | + . $elementName.$sourceField.'[0].url' |
|
| 289 | 289 | . ' }}'; |
| 290 | 290 | $globalsSettings[$fieldNameWidth] = '{{ ' |
| 291 | - . $elementName . $sourceField . '[0].width' |
|
| 291 | + . $elementName.$sourceField.'[0].width' |
|
| 292 | 292 | . ' }}'; |
| 293 | 293 | $globalsSettings[$fieldNameHeight] = '{{ ' |
| 294 | - . $elementName . $sourceField . '[0].height' |
|
| 294 | + . $elementName.$sourceField.'[0].height' |
|
| 295 | 295 | . ' }}'; |
| 296 | 296 | } |
| 297 | 297 | break; |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | if (!empty($ids)) { |
| 300 | 300 | $globalsSettings[$fieldName] = '{{ craft.app.assets.assetById(' |
| 301 | 301 | . $ids[0] |
| 302 | - . ', ' . $siteId . ').url }}'; |
|
| 302 | + . ', '.$siteId.').url }}'; |
|
| 303 | 303 | $globalsSettings[$fieldNameWidth] = '{{ craft.app.assets.assetById(' |
| 304 | 304 | . $ids[0] |
| 305 | - . ', ' . $siteId . ').width }}'; |
|
| 305 | + . ', '.$siteId.').width }}'; |
|
| 306 | 306 | $globalsSettings[$fieldNameHeight] = '{{ craft.app.assets.assetById(' |
| 307 | 307 | . $ids[0] |
| 308 | - . ', ' . $siteId . ').height }}'; |
|
| 308 | + . ', '.$siteId.').height }}'; |
|
| 309 | 309 | } |
| 310 | 310 | break; |
| 311 | 311 | } |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | if ($width === null) { |
| 198 | 198 | $width = ''; |
| 199 | 199 | } |
| 200 | - $width = (string)$width; |
|
| 200 | + $width = (string) $width; |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | return $width; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | if ($height === null) { |
| 230 | 230 | $height = ''; |
| 231 | 231 | } |
| 232 | - $height = (string)$height; |
|
| 232 | + $height = (string) $height; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | return $height; |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | if (is_array($assetIds)) { |
| 252 | 252 | foreach ($assetIds as $assetId) { |
| 253 | 253 | if (!empty($assetId)) { |
| 254 | - $assets[] = $elements->getElementById((int)$assetId, Asset::class, $siteId); |
|
| 254 | + $assets[] = $elements->getElementById((int) $assetId, Asset::class, $siteId); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | } else { |
| 258 | 258 | $assetId = $assetIds; |
| 259 | - $assets[] = $elements->getElementById((int)$assetId, Asset::class, $siteId); |
|
| 259 | + $assets[] = $elements->getElementById((int) $assetId, Asset::class, $siteId); |
|
| 260 | 260 | } |
| 261 | 261 | } |
| 262 | 262 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | return $asset->one(); |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - $resolvedAssetId = (int)$asset; |
|
| 295 | + $resolvedAssetId = (int) $asset; |
|
| 296 | 296 | $resolvedSiteId = $siteId ?? 0; |
| 297 | 297 | if (isset(self::$cachedAssetsElements[$resolvedAssetId][$resolvedSiteId])) { |
| 298 | 298 | return self::$cachedAssetsElements[$resolvedAssetId][$resolvedSiteId]; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $foundFields = []; |
| 126 | 126 | if (!empty(self::FIELD_CLASSES[$fieldClassKey])) { |
| 127 | 127 | // Cache me if you can |
| 128 | - $memoKey = $fieldClassKey . $layout->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 128 | + $memoKey = $fieldClassKey.$layout->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 129 | 129 | if (!empty(self::$fieldsOfTypeFromLayoutCache[$memoKey])) { |
| 130 | 130 | return self::$fieldsOfTypeFromLayoutCache[$memoKey]; |
| 131 | 131 | } |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $prefix = $global->handle; |
| 243 | 243 | $fields = array_combine( |
| 244 | 244 | array_map(function($key) use ($prefix) { |
| 245 | - return $prefix . '.' . $key; |
|
| 245 | + return $prefix.'.'.$key; |
|
| 246 | 246 | }, array_keys($fields)), |
| 247 | 247 | $fields |
| 248 | 248 | ); |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | } |
| 317 | 317 | if ($matrixBlockTypeModel) { |
| 318 | 318 | // Cache me if you can |
| 319 | - $memoKey = $fieldType . $matrixBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 319 | + $memoKey = $fieldType.$matrixBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 320 | 320 | if (!empty(self::$matrixFieldsOfTypeCache[$memoKey])) { |
| 321 | 321 | return self::$matrixFieldsOfTypeCache[$memoKey]; |
| 322 | 322 | } |
@@ -355,7 +355,7 @@ discard block |
||
| 355 | 355 | $layout = $neoBlock->getFieldLayout(); |
| 356 | 356 | if ($layout) { |
| 357 | 357 | // Cache me if you can |
| 358 | - $memoKey = $fieldType . $neoBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 358 | + $memoKey = $fieldType.$neoBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 359 | 359 | if (!empty(self::$neoFieldsOfTypeCache[$memoKey])) { |
| 360 | 360 | return self::$neoFieldsOfTypeCache[$memoKey]; |
| 361 | 361 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | } |
| 399 | 399 | if ($superTableBlockTypeModel) { |
| 400 | 400 | // Cache me if you can |
| 401 | - $memoKey = $fieldType . $superTableBlock->id . ($keysOnly ? 'keys' : 'nokeys'); |
|
| 401 | + $memoKey = $fieldType.$superTableBlock->id.($keysOnly ? 'keys' : 'nokeys'); |
|
| 402 | 402 | if (!empty(self::$superTableFieldsOfTypeCache[$memoKey])) { |
| 403 | 403 | return self::$superTableFieldsOfTypeCache[$memoKey]; |
| 404 | 404 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | } elseif ($json === null || $json === '') { |
| 56 | 56 | return null; |
| 57 | 57 | } |
| 58 | - $decode = json_decode((string)$json, $asArray, 512, JSON_BIGINT_AS_STRING); |
|
| 58 | + $decode = json_decode((string) $json, $asArray, 512, JSON_BIGINT_AS_STRING); |
|
| 59 | 59 | static::handleJsonError(json_last_error()); |
| 60 | 60 | |
| 61 | 61 | return $decode; |