@@ -67,7 +67,7 @@ |
||
| 67 | 67 | // Set the property |
| 68 | 68 | $value = $args[0]; |
| 69 | 69 | if (is_object($value) && $value instanceof Markup) { |
| 70 | - $value = (string)$value; |
|
| 70 | + $value = (string) $value; |
|
| 71 | 71 | } |
| 72 | 72 | $property->setValue($this, $value); |
| 73 | 73 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | // Add a URL to the schema.org type if this is a MetaJsonLD object |
| 163 | 163 | if ($isMetaJsonLdModel) { |
| 164 | 164 | /** @var MetaJsonLd $this */ |
| 165 | - $extraInfo = ' for http://schema.org/' . $this->type; |
|
| 165 | + $extraInfo = ' for http://schema.org/'.$this->type; |
|
| 166 | 166 | } |
| 167 | 167 | $errorMsg = |
| 168 | 168 | Craft::t('seomatic', 'Scenario: "') |
@@ -173,10 +173,10 @@ discard block |
||
| 173 | 173 | . print_r($this->render(), true); |
| 174 | 174 | Craft::info($errorMsg, __METHOD__); |
| 175 | 175 | foreach ($this->errors as $param => $errors) { |
| 176 | - $errorMsg = Craft::t('seomatic', $errorLabel) . $param; |
|
| 176 | + $errorMsg = Craft::t('seomatic', $errorLabel).$param; |
|
| 177 | 177 | /** @var array $errors */ |
| 178 | 178 | foreach ($errors as $error) { |
| 179 | - $errorMsg .= ' -> ' . $error; |
|
| 179 | + $errorMsg .= ' -> '.$error; |
|
| 180 | 180 | // Change the error level depending on the error message if this is a MetaJsonLD object |
| 181 | 181 | if ($isMetaJsonLdModel) { |
| 182 | 182 | if (strpos($error, 'recommended') !== false) { |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | - Craft::info(strtoupper($logLevel) . ' - ' . $errorMsg, __METHOD__); |
|
| 192 | + Craft::info(strtoupper($logLevel).' - '.$errorMsg, __METHOD__); |
|
| 193 | 193 | // Extra debugging info for MetaJsonLd objects |
| 194 | 194 | if ($isMetaJsonLdModel) { |
| 195 | 195 | /** @var MetaJsonLd $className */ |
| 196 | 196 | $className = get_class($this); |
| 197 | 197 | if (!empty($className->schemaPropertyDescriptions[$param])) { |
| 198 | - $errorMsg = Craft::t('seomatic', $errorLabel) . $param; |
|
| 199 | - $errorMsg .= ' -> ' . $className->schemaPropertyDescriptions[$param]; |
|
| 198 | + $errorMsg = Craft::t('seomatic', $errorLabel).$param; |
|
| 199 | + $errorMsg .= ' -> '.$className->schemaPropertyDescriptions[$param]; |
|
| 200 | 200 | Craft::info($errorMsg, __METHOD__); |
| 201 | 201 | } |
| 202 | 202 | } |
@@ -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)) { |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | // Go from most specific type to least specific type |
| 101 | 101 | foreach (self::SCHEMA_TYPES as $schemaType) { |
| 102 | 102 | if (!empty($settings[$schemaType]) && ($settings[$schemaType] !== 'none')) { |
| 103 | - $result = $settings[$schemaType] . self::SCHEMA_PATH_DELIMITER . $result; |
|
| 103 | + $result = $settings[$schemaType].self::SCHEMA_PATH_DELIMITER.$result; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | if (isset($result['schemaTypeDescription'])) { |
| 132 | 132 | $description = $result['schemaTypeDescription']; |
| 133 | 133 | $description = preg_replace("`\[\[([A-z]*)\]\]`", '[$1](https://schema.org/$1)', $description); |
| 134 | - $description = Markdown::process((string)$description); |
|
| 134 | + $description = Markdown::process((string) $description); |
|
| 135 | 135 | $description = str_replace(['<p>', '</p>', '\n'], ['', '', ' '], $description); |
| 136 | 136 | $result['schemaTypeDescription'] = $description; |
| 137 | 137 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | { |
| 152 | 152 | $result = []; |
| 153 | 153 | while ($schemaType) { |
| 154 | - $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType; |
|
| 154 | + $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType; |
|
| 155 | 155 | if (class_exists($className)) { |
| 156 | 156 | $classRef = new ReflectionClass($className); |
| 157 | 157 | $staticProps = $classRef->getStaticProperties(); |
@@ -248,15 +248,15 @@ discard block |
||
| 248 | 248 | $dependency = new TagDependency([ |
| 249 | 249 | 'tags' => [ |
| 250 | 250 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 251 | - self::SCHEMA_CACHE_TAG . 'schemaArray', |
|
| 251 | + self::SCHEMA_CACHE_TAG.'schemaArray', |
|
| 252 | 252 | ], |
| 253 | 253 | ]); |
| 254 | 254 | $cache = Craft::$app->getCache(); |
| 255 | 255 | $typesArray = $cache->getOrSet( |
| 256 | - self::CACHE_KEY . 'schemaArray', |
|
| 256 | + self::CACHE_KEY.'schemaArray', |
|
| 257 | 257 | function() use ($path) { |
| 258 | 258 | Craft::info( |
| 259 | - 'schemaArray cache miss' . $path, |
|
| 259 | + 'schemaArray cache miss'.$path, |
|
| 260 | 260 | __METHOD__ |
| 261 | 261 | ); |
| 262 | 262 | $filePath = Craft::getAlias('@nystudio107/seomatic/resources/schema/tree.jsonld'); |
@@ -321,12 +321,12 @@ discard block |
||
| 321 | 321 | $dependency = new TagDependency([ |
| 322 | 322 | 'tags' => [ |
| 323 | 323 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 324 | - self::SCHEMA_CACHE_TAG . 'schemaTree', |
|
| 324 | + self::SCHEMA_CACHE_TAG.'schemaTree', |
|
| 325 | 325 | ], |
| 326 | 326 | ]); |
| 327 | 327 | $cache = Craft::$app->getCache(); |
| 328 | 328 | $typesArray = $cache->getOrSet( |
| 329 | - self::CACHE_KEY . 'schemaTree', |
|
| 329 | + self::CACHE_KEY.'schemaTree', |
|
| 330 | 330 | function() { |
| 331 | 331 | Craft::info( |
| 332 | 332 | 'schemaArray cache miss', |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | foreach ($typesArray as $key => $value) { |
| 391 | 391 | $indent = html_entity_decode(str_repeat(' ', $indentLevel)); |
| 392 | 392 | if (is_array($value)) { |
| 393 | - $result[$key] = $indent . $key; |
|
| 393 | + $result[$key] = $indent.$key; |
|
| 394 | 394 | $value = self::flattenSchemaArray($value, $indentLevel + self::MENU_INDENT_STEP); |
| 395 | 395 | $result = array_merge($result, $value); |
| 396 | 396 | } else { |
| 397 | - $result[$key] = $indent . $value; |
|
| 397 | + $result[$key] = $indent.$value; |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | $children = []; |
| 489 | 489 | $name = $typesArray['name']; |
| 490 | 490 | // Construct a path-based $id, excluding the top-level `Thing` schema |
| 491 | - $id = $name === 'Thing' ? '' : $path . self::SCHEMA_PATH_DELIMITER . $name; |
|
| 491 | + $id = $name === 'Thing' ? '' : $path.self::SCHEMA_PATH_DELIMITER.$name; |
|
| 492 | 492 | $id = ltrim($id, self::SCHEMA_PATH_DELIMITER); |
| 493 | 493 | // Make sure we have at most 3 specifiers in the schema path |
| 494 | 494 | $parts = explode(self::SCHEMA_PATH_DELIMITER, $id); |
@@ -515,12 +515,12 @@ discard block |
||
| 515 | 515 | $schemaPath = explode(self::SCHEMA_PATH_DELIMITER, $id); |
| 516 | 516 | // Use only the specific (last) type for now, rather than the complete path of types |
| 517 | 517 | $schemaPath = [end($schemaPath)]; |
| 518 | - if ((bool)array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
| 519 | - $name .= ' (' . Craft::t('seomatic', 'Google rich result') . ')'; |
|
| 518 | + if ((bool) array_intersect($schemaPath, array_keys($googleRichSnippetTypes))) { |
|
| 519 | + $name .= ' ('.Craft::t('seomatic', 'Google rich result').')'; |
|
| 520 | 520 | } |
| 521 | 521 | // Mark it as pending, if applicable |
| 522 | 522 | if (isset($typesArray['pending']) && $typesArray['pending']) { |
| 523 | - $name .= ' (' . Craft::t('seomatic', 'pending') . ')'; |
|
| 523 | + $name .= ' ('.Craft::t('seomatic', 'pending').')'; |
|
| 524 | 524 | } |
| 525 | 525 | $result['label'] = $name; |
| 526 | 526 | $result['id'] = $id; |
@@ -539,12 +539,12 @@ discard block |
||
| 539 | 539 | $dependency = new TagDependency([ |
| 540 | 540 | 'tags' => [ |
| 541 | 541 | self::GLOBAL_SCHEMA_CACHE_TAG, |
| 542 | - self::SCHEMA_CACHE_TAG . 'googleRichSnippets', |
|
| 542 | + self::SCHEMA_CACHE_TAG.'googleRichSnippets', |
|
| 543 | 543 | ], |
| 544 | 544 | ]); |
| 545 | 545 | $cache = Craft::$app->getCache(); |
| 546 | 546 | return $cache->getOrSet( |
| 547 | - self::CACHE_KEY . 'googleRichSnippets', |
|
| 547 | + self::CACHE_KEY.'googleRichSnippets', |
|
| 548 | 548 | function() { |
| 549 | 549 | Craft::info( |
| 550 | 550 | '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 . '.collect()[0]' |
|
| 185 | - . ', ' . $transformName |
|
| 186 | - . ', ' . $siteId |
|
| 187 | - . ', ' . $transformMode |
|
| 184 | + . $objectPrefix.$elementName.$seoSourceField.'.collect()[0]' |
|
| 185 | + . ', '.$transformName |
|
| 186 | + . ', '.$siteId |
|
| 187 | + . ', '.$transformMode |
|
| 188 | 188 | . ') }}'; |
| 189 | 189 | $globalsSettings[$fieldNameWidth] = '{{ seomatic.helper.socialTransformWidth(' |
| 190 | - . $objectPrefix . $elementName . $seoSourceField . '.collect()[0]' |
|
| 191 | - . ', ' . $transformName |
|
| 192 | - . ', ' . $siteId |
|
| 193 | - . ', ' . $transformMode |
|
| 190 | + . $objectPrefix.$elementName.$seoSourceField.'.collect()[0]' |
|
| 191 | + . ', '.$transformName |
|
| 192 | + . ', '.$siteId |
|
| 193 | + . ', '.$transformMode |
|
| 194 | 194 | . ') }}'; |
| 195 | 195 | $globalsSettings[$fieldNameHeight] = '{{ seomatic.helper.socialTransformHeight(' |
| 196 | - . $objectPrefix . $elementName . $seoSourceField . '.collect()[0]' |
|
| 197 | - . ', ' . $transformName |
|
| 198 | - . ', ' . $siteId |
|
| 199 | - . ', ' . $transformMode |
|
| 196 | + . $objectPrefix.$elementName.$seoSourceField.'.collect()[0]' |
|
| 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 . '.collect()[0]' |
|
| 237 | - . ', ' . $transformName |
|
| 238 | - . ', ' . $siteId |
|
| 239 | - . ', ' . $transformMode |
|
| 236 | + . $objectPrefix.$elementName.$sourceField.'.collect()[0]' |
|
| 237 | + . ', '.$transformName |
|
| 238 | + . ', '.$siteId |
|
| 239 | + . ', '.$transformMode |
|
| 240 | 240 | . ') }}'; |
| 241 | 241 | $globalsSettings[$fieldNameWidth] = '{{ seomatic.helper.socialTransformWidth(' |
| 242 | - . $objectPrefix . $elementName . $sourceField . '.collect()[0]' |
|
| 243 | - . ', ' . $transformName |
|
| 244 | - . ', ' . $siteId |
|
| 245 | - . ', ' . $transformMode |
|
| 242 | + . $objectPrefix.$elementName.$sourceField.'.collect()[0]' |
|
| 243 | + . ', '.$transformName |
|
| 244 | + . ', '.$siteId |
|
| 245 | + . ', '.$transformMode |
|
| 246 | 246 | . ') }}'; |
| 247 | 247 | $globalsSettings[$fieldNameHeight] = '{{ seomatic.helper.socialTransformHeight(' |
| 248 | - . $objectPrefix . $elementName . $sourceField . '.collect()[0]' |
|
| 249 | - . ', ' . $transformName |
|
| 250 | - . ', ' . $siteId |
|
| 251 | - . ', ' . $transformMode |
|
| 248 | + . $objectPrefix.$elementName.$sourceField.'.collect()[0]' |
|
| 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 . '.collect()[0].url' |
|
| 288 | + . $elementName.$sourceField.'.collect()[0].url' |
|
| 289 | 289 | . ' }}'; |
| 290 | 290 | $globalsSettings[$fieldNameWidth] = '{{ ' |
| 291 | - . $elementName . $sourceField . '.collect()[0].width' |
|
| 291 | + . $elementName.$sourceField.'.collect()[0].width' |
|
| 292 | 292 | . ' }}'; |
| 293 | 293 | $globalsSettings[$fieldNameHeight] = '{{ ' |
| 294 | - . $elementName . $sourceField . '.collect()[0].height' |
|
| 294 | + . $elementName.$sourceField.'.collect()[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 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | * @param MetaBundle $metaBundle |
| 194 | 194 | * @param bool $forceUpdate |
| 195 | 195 | */ |
| 196 | - public function syncBundleWithConfig(MetaBundle &$metaBundle, bool $forceUpdate = false) |
|
| 196 | + public function syncBundleWithConfig(MetaBundle & $metaBundle, bool $forceUpdate = false) |
|
| 197 | 197 | { |
| 198 | 198 | $prevMetaBundle = $metaBundle; |
| 199 | 199 | $config = []; |
@@ -274,8 +274,8 @@ discard block |
||
| 274 | 274 | */ |
| 275 | 275 | public function updateMetaBundle(MetaBundle $metaBundle, int $siteId) |
| 276 | 276 | { |
| 277 | - $metaBundle->sourceName = (string)$metaBundle->sourceName; |
|
| 278 | - $metaBundle->sourceTemplate = (string)$metaBundle->sourceTemplate; |
|
| 277 | + $metaBundle->sourceName = (string) $metaBundle->sourceName; |
|
| 278 | + $metaBundle->sourceTemplate = (string) $metaBundle->sourceTemplate; |
|
| 279 | 279 | // Make sure it validates |
| 280 | 280 | if ($metaBundle->validate(null, true)) { |
| 281 | 281 | // Save it out to a record |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | 'sourceSiteId' => $siteId, |
| 286 | 286 | ]; |
| 287 | 287 | if ($metaBundle->typeId !== null) { |
| 288 | - $metaBundle->typeId = (int)$metaBundle->typeId; |
|
| 288 | + $metaBundle->typeId = (int) $metaBundle->typeId; |
|
| 289 | 289 | } |
| 290 | 290 | if (!empty($metaBundle->typeId)) { |
| 291 | 291 | $params['typeId'] = $metaBundle->typeId; |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | // The issue was that the containers were getting saved to the db with a hard-coded setting in them, because they'd |
| 303 | 303 | // been set that way by the environment, whereas to be changeable via the GUI, it needs to be set to {seomatic.meta.robots} |
| 304 | 304 | /** @var RobotsTag|null $robotsTag */ |
| 305 | - $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE . TagService::GENERAL_HANDLE]->data['robots'] ?? null; |
|
| 305 | + $robotsTag = $metaBundle->metaContainers[MetaTagContainer::CONTAINER_TYPE.TagService::GENERAL_HANDLE]->data['robots'] ?? null; |
|
| 306 | 306 | if (!empty($robotsTag)) { |
| 307 | 307 | $robotsTag->content = $robotsTag->environment['live']['content'] ?? '{{ seomatic.meta.robots }}'; |
| 308 | 308 | } |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $metaBundleDefaults = ArrayHelper::merge( |
| 381 | 381 | $seoElement::metaBundleConfig($sourceModel), |
| 382 | 382 | [ |
| 383 | - 'sourceTemplate' => (string)$siteSetting->template, |
|
| 383 | + 'sourceTemplate' => (string) $siteSetting->template, |
|
| 384 | 384 | 'sourceSiteId' => $siteSetting->siteId, |
| 385 | 385 | 'sourceAltSiteSettings' => $siteSettingsArray, |
| 386 | 386 | 'sourceDateUpdated' => $dateUpdated, |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | public function getMetaBundleBySourceHandle(string $sourceBundleType, string $sourceHandle, int $sourceSiteId, $typeId = null) |
| 429 | 429 | { |
| 430 | 430 | $metaBundle = null; |
| 431 | - $typeId = (int)$typeId; |
|
| 431 | + $typeId = (int) $typeId; |
|
| 432 | 432 | // See if we have the meta bundle cached |
| 433 | 433 | if (!empty($this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId])) { |
| 434 | 434 | $id = $this->metaBundlesBySourceHandle[$sourceBundleType][$sourceHandle][$sourceSiteId][$typeId]; |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | /** @var Section|CategoryGroup|ProductType $sourceModel */ |
| 516 | 516 | $sourceModel = $seoElement::sourceModelFromId($sourceId); |
| 517 | 517 | if ($sourceModel !== null) { |
| 518 | - $metaBundle->sourceName = (string)$sourceModel->name; |
|
| 518 | + $metaBundle->sourceName = (string) $sourceModel->name; |
|
| 519 | 519 | $metaBundle->sourceHandle = $sourceModel->handle; |
| 520 | 520 | } |
| 521 | 521 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | public function getMetaBundleBySourceId(string $sourceBundleType, int $sourceId, ?int $sourceSiteId, $typeId = null) |
| 557 | 557 | { |
| 558 | 558 | $metaBundle = null; |
| 559 | - $typeId = (int)$typeId; |
|
| 559 | + $typeId = (int) $typeId; |
|
| 560 | 560 | // See if we have the meta bundle cached |
| 561 | 561 | if (!empty($this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId])) { |
| 562 | 562 | $id = $this->metaBundlesBySourceId[$sourceBundleType][$sourceId][$sourceSiteId][$typeId]; |
@@ -748,7 +748,7 @@ discard block |
||
| 748 | 748 | ->from(['{{%seomatic_metabundles}}']) |
| 749 | 749 | ->where(['=', 'sourceBundleType', $seoElement::META_BUNDLE_TYPE]); |
| 750 | 750 | |
| 751 | - if ((int)$sourceSiteId !== 0) { |
|
| 751 | + if ((int) $sourceSiteId !== 0) { |
|
| 752 | 752 | $subQuery->andWhere(['sourceSiteId' => $sourceSiteId]); |
| 753 | 753 | } |
| 754 | 754 | if ($filter !== '') { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | public function getContentMetaBundleForElement(Element $element) |
| 786 | 786 | { |
| 787 | 787 | $source = $this->getMetaSourceFromElement($element); |
| 788 | - $key = implode(".", $source) . '.' . $element->siteId; |
|
| 788 | + $key = implode(".", $source).'.'.$element->siteId; |
|
| 789 | 789 | |
| 790 | 790 | if (empty($this->elementContentMetaBundles[$key])) { |
| 791 | 791 | $this->elementContentMetaBundles[$key] = $this->getMetaBundleBySourceId($source[1], $source[0], $element->siteId, $source[4]); |
@@ -807,10 +807,10 @@ discard block |
||
| 807 | 807 | $seoSettingsField = Craft::$app->getFields()->getFieldByHandle($fieldHandle); |
| 808 | 808 | if ($seoSettingsField) { |
| 809 | 809 | $seoSettingsEnabledFields = array_flip(array_merge( |
| 810 | - (array)$seoSettingsField->generalEnabledFields, |
|
| 811 | - (array)$seoSettingsField->twitterEnabledFields, |
|
| 812 | - (array)$seoSettingsField->facebookEnabledFields, |
|
| 813 | - (array)$seoSettingsField->sitemapEnabledFields |
|
| 810 | + (array) $seoSettingsField->generalEnabledFields, |
|
| 811 | + (array) $seoSettingsField->twitterEnabledFields, |
|
| 812 | + (array) $seoSettingsField->facebookEnabledFields, |
|
| 813 | + (array) $seoSettingsField->sitemapEnabledFields |
|
| 814 | 814 | )); |
| 815 | 815 | // Always include some fields, as they are calculated even if not explicitly included |
| 816 | 816 | $seoSettingsEnabledFields = array_merge( |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | |
| 839 | 839 | |
| 840 | 840 | // Handle the mainEntityOfPage |
| 841 | - if (!in_array('mainEntityOfPage', (array)$seoSettingsField->generalEnabledFields, false)) { |
|
| 841 | + if (!in_array('mainEntityOfPage', (array) $seoSettingsField->generalEnabledFields, false)) { |
|
| 842 | 842 | $metaBundle->metaGlobalVars->mainEntityOfPage = ''; |
| 843 | 843 | } |
| 844 | 844 | // metaSiteVars |
@@ -208,7 +208,7 @@ |
||
| 208 | 208 | * 'default' => 'http://example.com/', |
| 209 | 209 | * 'spanish' => 'http://example.com/es/', |
| 210 | 210 | * ], */ |
| 211 | - public string|array $siteUrlOverride = ''; |
|
| 211 | + public string | array $siteUrlOverride = ''; |
|
| 212 | 212 | |
| 213 | 213 | /** |
| 214 | 214 | * @var int|null |
@@ -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; |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | // so we can't extract it from the passed in $config |
| 64 | 64 | $majorVersion = '5'; |
| 65 | 65 | // Dev server container name & port are based on the major version of this plugin |
| 66 | - $devPort = 3000 + (int)$majorVersion; |
|
| 67 | - $versionName = 'v' . $majorVersion; |
|
| 66 | + $devPort = 3000 + (int) $majorVersion; |
|
| 67 | + $versionName = 'v'.$majorVersion; |
|
| 68 | 68 | return [ |
| 69 | 69 | 'components' => [ |
| 70 | 70 | 'frontendTemplates' => FrontendTemplatesService::class, |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | 'assetClass' => SeomaticAsset::class, |
| 84 | 84 | 'checkDevServer' => true, |
| 85 | 85 | 'class' => VitePluginService::class, |
| 86 | - 'devServerInternal' => 'http://craft-seomatic-' . $versionName . '-buildchain-dev:' . $devPort, |
|
| 87 | - 'devServerPublic' => 'http://localhost:' . $devPort, |
|
| 86 | + 'devServerInternal' => 'http://craft-seomatic-'.$versionName.'-buildchain-dev:'.$devPort, |
|
| 87 | + 'devServerPublic' => 'http://localhost:'.$devPort, |
|
| 88 | 88 | 'errorEntry' => 'src/js/seomatic.js', |
| 89 | 89 | 'useDevServer' => true, |
| 90 | 90 | ], |