@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | case self::CONFIG_DEPENDENCY: |
| 54 | 54 | foreach ($keys as $key) { |
| 55 | 55 | // If any value is in the $config[$key] it validates |
| 56 | - if (!empty($config[$key])) { |
|
| 56 | + if (!empty($config[ $key ])) { |
|
| 57 | 57 | $validates = true; |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | case self::SITE_DEPENDENCY: |
| 63 | 63 | foreach ($keys as $key) { |
| 64 | 64 | // If any value is in the $site[$key] it validates |
| 65 | - if (!empty($site[$key])) { |
|
| 65 | + if (!empty($site[ $key ])) { |
|
| 66 | 66 | $validates = true; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | case self::META_DEPENDENCY: |
| 72 | 72 | foreach ($keys as $key) { |
| 73 | 73 | // If any value is in the $meta[$key] it validates |
| 74 | - if (!empty($meta[$key])) { |
|
| 74 | + if (!empty($meta[ $key ])) { |
|
| 75 | 75 | $validates = true; |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $array = self::changeKey($array, 'type', '@type'); |
| 90 | 90 | if ($depth > 1) { |
| 91 | 91 | foreach (self::IGNORE_ATTRIBUTES as $attribute) { |
| 92 | - unset($array[$attribute]); |
|
| 92 | + unset($array[ $attribute ]); |
|
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | MetaValueHelper::parseArray($array); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | return $array; |
| 113 | 113 | } |
| 114 | 114 | $keys = array_keys($array); |
| 115 | - $keys[array_search($oldKey, $keys)] = $newKey; |
|
| 115 | + $keys[ array_search($oldKey, $keys) ] = $newKey; |
|
| 116 | 116 | |
| 117 | 117 | return array_combine($keys, $array); |
| 118 | 118 | } |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | FieldLayout $layout, |
| 78 | 78 | bool $keysOnly = true |
| 79 | 79 | ): array { |
| 80 | - $foundFields = []; |
|
| 81 | - if (!empty(self::FIELD_CLASSES[$fieldClassKey])) { |
|
| 82 | - $fieldClasses = self::FIELD_CLASSES[$fieldClassKey]; |
|
| 80 | + $foundFields = [ ]; |
|
| 81 | + if (!empty(self::FIELD_CLASSES[ $fieldClassKey ])) { |
|
| 82 | + $fieldClasses = self::FIELD_CLASSES[ $fieldClassKey ]; |
|
| 83 | 83 | $fields = $layout->getFields(); |
| 84 | 84 | /** @var $field BaseField */ |
| 85 | 85 | foreach ($fields as $field) { |
| 86 | 86 | foreach ($fieldClasses as $fieldClassKey) { |
| 87 | 87 | if ($field instanceof $fieldClassKey) { |
| 88 | - $foundFields[$field->handle] = $field->name; |
|
| 88 | + $foundFields[ $field->handle ] = $field->name; |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | public static function fieldsOfTypeFromAssetVolumes(string $fieldClassKey, bool $keysOnly = true): array |
| 148 | 148 | { |
| 149 | - $foundFields = []; |
|
| 149 | + $foundFields = [ ]; |
|
| 150 | 150 | $volumes = Craft::$app->getVolumes()->getAllVolumes(); |
| 151 | 151 | foreach ($volumes as $volume) { |
| 152 | 152 | /** @var Volume $volume */ |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public static function fieldsOfTypeFromGlobals(string $fieldClassKey, bool $keysOnly = true): array |
| 179 | 179 | { |
| 180 | - $foundFields = []; |
|
| 180 | + $foundFields = [ ]; |
|
| 181 | 181 | $globals = Craft::$app->getGlobals()->getAllSets(); |
| 182 | 182 | foreach ($globals as $global) { |
| 183 | 183 | $layout = $global->getFieldLayout(); |
@@ -186,8 +186,8 @@ discard block |
||
| 186 | 186 | // Prefix the keys with the global set name |
| 187 | 187 | $prefix = $global->handle; |
| 188 | 188 | $fields = array_combine( |
| 189 | - array_map(function ($key) use ($prefix) { |
|
| 190 | - return $prefix.'.'.$key; |
|
| 189 | + array_map(function($key) use ($prefix) { |
|
| 190 | + return $prefix . '.' . $key; |
|
| 191 | 191 | }, array_keys($fields)), |
| 192 | 192 | $fields |
| 193 | 193 | ); |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | string $fieldClassKey, |
| 220 | 220 | bool $keysOnly = true |
| 221 | 221 | ): array { |
| 222 | - $foundFields = []; |
|
| 223 | - $layouts = []; |
|
| 222 | + $foundFields = [ ]; |
|
| 223 | + $layouts = [ ]; |
|
| 224 | 224 | // Get the layouts |
| 225 | 225 | switch ($sourceBundleType) { |
| 226 | 226 | case MetaBundles::GLOBAL_META_BUNDLE: |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | case MetaBundles::SECTION_META_BUNDLE: |
| 230 | 230 | $entryTypes = Craft::$app->getSections()->getSectionByHandle($sourceHandle)->getEntryTypes(); |
| 231 | 231 | foreach ($entryTypes as $entryType) { |
| 232 | - $layouts[] = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId); |
|
| 232 | + $layouts[ ] = Craft::$app->getFields()->getLayoutById($entryType->fieldLayoutId); |
|
| 233 | 233 | } |
| 234 | 234 | break; |
| 235 | 235 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $layoutId = null; |
| 241 | 241 | } |
| 242 | 242 | if ($layoutId) { |
| 243 | - $layouts[] = Craft::$app->getFields()->getLayoutById($layoutId); |
|
| 243 | + $layouts[ ] = Craft::$app->getFields()->getLayoutById($layoutId); |
|
| 244 | 244 | } |
| 245 | 245 | break; |
| 246 | 246 | // @TODO: handle commerce products |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | public static function matrixFieldsOfType(MatrixBlock $matrixBlock, string $fieldType, bool $keysOnly = true): array |
| 269 | 269 | { |
| 270 | - $foundFields = []; |
|
| 270 | + $foundFields = [ ]; |
|
| 271 | 271 | |
| 272 | 272 | try { |
| 273 | 273 | $matrixBlockTypeModel = $matrixBlock->getType(); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | /** @var $field BaseField */ |
| 280 | 280 | foreach ($fields as $field) { |
| 281 | 281 | if ($field instanceof $fieldType) { |
| 282 | - $foundFields[$field->handle] = $field->name; |
|
| 282 | + $foundFields[ $field->handle ] = $field->name; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | { |
| 83 | 83 | foreach ($metaArray as $key => $value) { |
| 84 | 84 | if ($value != null) { |
| 85 | - $metaArray[$key] = self::parseString($value); |
|
| 85 | + $metaArray[ $key ] = self::parseString($value); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | $metaArray = array_filter($metaArray); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | if ($reflector) { |
| 139 | 139 | $matchedElementType = strtolower($reflector->getShortName()); |
| 140 | - self::$templateObjectVars[$matchedElementType] = $element; |
|
| 140 | + self::$templateObjectVars[ $matchedElementType ] = $element; |
|
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | 143 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $metaValue = Craft::t( |
| 182 | 182 | 'seomatic', |
| 183 | 183 | 'Error rendering `{template}` -> {error}', |
| 184 | - ['template' => $metaValue, 'error' => $e->getMessage()] |
|
| 184 | + [ 'template' => $metaValue, 'error' => $e->getMessage() ] |
|
| 185 | 185 | ); |
| 186 | 186 | Craft::error($metaValue, __METHOD__); |
| 187 | 187 | // Restore the template mode |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | int $siteId = null, |
| 204 | 204 | bool $asArray = false |
| 205 | 205 | ): array { |
| 206 | - $result = []; |
|
| 206 | + $result = [ ]; |
|
| 207 | 207 | |
| 208 | 208 | // Load the meta containers and parse our globals |
| 209 | 209 | Seomatic::$plugin->metaContainers->previewMetaContainers($uri, $siteId, true); |
@@ -211,17 +211,17 @@ discard block |
||
| 211 | 211 | // Iterate through the desired $containerKeys |
| 212 | 212 | foreach ($containerKeys as $containerKey) { |
| 213 | 213 | if ($asArray) { |
| 214 | - $result[$containerKey] = Seomatic::$plugin->metaContainers->renderContainersArrayByType( |
|
| 214 | + $result[ $containerKey ] = Seomatic::$plugin->metaContainers->renderContainersArrayByType( |
|
| 215 | 215 | $containerKey |
| 216 | 216 | ); |
| 217 | 217 | } else { |
| 218 | - $result[$containerKey] = Seomatic::$plugin->metaContainers->renderContainersByType( |
|
| 218 | + $result[ $containerKey ] = Seomatic::$plugin->metaContainers->renderContainersByType( |
|
| 219 | 219 | $containerKey |
| 220 | 220 | ); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | // use "pretty" output in debug mode |
| 224 | - Craft::$app->response->formatters[Response::FORMAT_JSON] = [ |
|
| 224 | + Craft::$app->response->formatters[ Response::FORMAT_JSON ] = [ |
|
| 225 | 225 | 'class' => 'yii\web\JsonResponseFormatter', |
| 226 | 226 | 'prettyPrint' => YII_DEBUG, |
| 227 | 227 | ]; |
@@ -44,25 +44,25 @@ discard block |
||
| 44 | 44 | const DOCUMENTATION_URL = 'https://github.com/nystudio107/craft-seomatic/wiki'; |
| 45 | 45 | |
| 46 | 46 | const PULL_TEXT_FIELDS = [ |
| 47 | - ['fieldName' => 'seoTitle', 'seoField' => 'seoTitle'], |
|
| 48 | - ['fieldName' => 'seoDescription', 'seoField' => 'seoDescription'], |
|
| 49 | - ['fieldName' => 'seoKeywords', 'seoField' => 'seoKeywords'], |
|
| 50 | - ['fieldName' => 'seoImageDescription', 'seoField' => 'seoImageDescription'], |
|
| 51 | - ['fieldName' => 'ogTitle', 'seoField' => 'seoTitle'], |
|
| 52 | - ['fieldName' => 'ogSiteNamePosition', 'seoField' => 'siteNamePosition'], |
|
| 53 | - ['fieldName' => 'ogDescription', 'seoField' => 'seoDescription'], |
|
| 54 | - ['fieldName' => 'ogImageDescription', 'seoField' => 'seoImageDescription'], |
|
| 55 | - ['fieldName' => 'twitterTitle', 'seoField' => 'seoTitle'], |
|
| 56 | - ['fieldName' => 'twitterSiteNamePosition', 'seoField' => 'siteNamePosition'], |
|
| 57 | - ['fieldName' => 'twitterCreator', 'seoField' => 'twitterHandle'], |
|
| 58 | - ['fieldName' => 'twitterDescription', 'seoField' => 'seoDescription'], |
|
| 59 | - ['fieldName' => 'twitterImageDescription', 'seoField' => 'seoImageDescription'], |
|
| 47 | + [ 'fieldName' => 'seoTitle', 'seoField' => 'seoTitle' ], |
|
| 48 | + [ 'fieldName' => 'seoDescription', 'seoField' => 'seoDescription' ], |
|
| 49 | + [ 'fieldName' => 'seoKeywords', 'seoField' => 'seoKeywords' ], |
|
| 50 | + [ 'fieldName' => 'seoImageDescription', 'seoField' => 'seoImageDescription' ], |
|
| 51 | + [ 'fieldName' => 'ogTitle', 'seoField' => 'seoTitle' ], |
|
| 52 | + [ 'fieldName' => 'ogSiteNamePosition', 'seoField' => 'siteNamePosition' ], |
|
| 53 | + [ 'fieldName' => 'ogDescription', 'seoField' => 'seoDescription' ], |
|
| 54 | + [ 'fieldName' => 'ogImageDescription', 'seoField' => 'seoImageDescription' ], |
|
| 55 | + [ 'fieldName' => 'twitterTitle', 'seoField' => 'seoTitle' ], |
|
| 56 | + [ 'fieldName' => 'twitterSiteNamePosition', 'seoField' => 'siteNamePosition' ], |
|
| 57 | + [ 'fieldName' => 'twitterCreator', 'seoField' => 'twitterHandle' ], |
|
| 58 | + [ 'fieldName' => 'twitterDescription', 'seoField' => 'seoDescription' ], |
|
| 59 | + [ 'fieldName' => 'twitterImageDescription', 'seoField' => 'seoImageDescription' ], |
|
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | 62 | const PULL_ASSET_FIELDS = [ |
| 63 | - ['fieldName' => 'seoImage', 'seoField' => 'seoImage', 'transformName' => 'base'], |
|
| 64 | - ['fieldName' => 'ogImage', 'seoField' => 'seoImage', 'transformName' => 'facebook'], |
|
| 65 | - ['fieldName' => 'twitterImage', 'seoField' => 'seoImage', 'transformName' => 'twitter'], |
|
| 63 | + [ 'fieldName' => 'seoImage', 'seoField' => 'seoImage', 'transformName' => 'base' ], |
|
| 64 | + [ 'fieldName' => 'ogImage', 'seoField' => 'seoImage', 'transformName' => 'facebook' ], |
|
| 65 | + [ 'fieldName' => 'twitterImage', 'seoField' => 'seoImage', 'transformName' => 'twitter' ], |
|
| 66 | 66 | ]; |
| 67 | 67 | |
| 68 | 68 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public function actionDashboard(bool $showWelcome = false): Response |
| 89 | 89 | { |
| 90 | - $variables = []; |
|
| 90 | + $variables = [ ]; |
|
| 91 | 91 | $pluginName = Seomatic::$settings->pluginName; |
| 92 | 92 | $templateTitle = Craft::t('seomatic', 'Dashboard'); |
| 93 | 93 | // Asset bundle |
@@ -96,16 +96,16 @@ discard block |
||
| 96 | 96 | } catch (InvalidConfigException $e) { |
| 97 | 97 | Craft::error($e->getMessage(), __METHOD__); |
| 98 | 98 | } |
| 99 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 99 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 100 | 100 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 101 | 101 | true |
| 102 | 102 | ); |
| 103 | 103 | // Basic variables |
| 104 | - $variables['fullPageForm'] = false; |
|
| 105 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 106 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 107 | - $variables['title'] = $templateTitle; |
|
| 108 | - $variables['crumbs'] = [ |
|
| 104 | + $variables[ 'fullPageForm' ] = false; |
|
| 105 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 106 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 107 | + $variables[ 'title' ] = $templateTitle; |
|
| 108 | + $variables[ 'crumbs' ] = [ |
|
| 109 | 109 | [ |
| 110 | 110 | 'label' => $pluginName, |
| 111 | 111 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | 'url' => UrlHelper::cpUrl('seomatic/dashboard'), |
| 116 | 116 | ], |
| 117 | 117 | ]; |
| 118 | - $variables['selectedSubnavItem'] = 'dashboard'; |
|
| 119 | - $variables['showWelcome'] = $showWelcome; |
|
| 118 | + $variables[ 'selectedSubnavItem' ] = 'dashboard'; |
|
| 119 | + $variables[ 'showWelcome' ] = $showWelcome; |
|
| 120 | 120 | |
| 121 | 121 | // Render the template |
| 122 | 122 | return $this->renderTemplate('seomatic/dashboard/index', $variables); |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | public function actionGlobal(string $subSection = 'general', string $siteHandle = null): Response |
| 136 | 136 | { |
| 137 | - $variables = []; |
|
| 137 | + $variables = [ ]; |
|
| 138 | 138 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 139 | 139 | |
| 140 | 140 | $pluginName = Seomatic::$settings->pluginName; |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | } catch (InvalidConfigException $e) { |
| 147 | 147 | Craft::error($e->getMessage(), __METHOD__); |
| 148 | 148 | } |
| 149 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 149 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 150 | 150 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 151 | 151 | true |
| 152 | 152 | ); |
| 153 | 153 | // Basic variables |
| 154 | - $variables['fullPageForm'] = true; |
|
| 155 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 156 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 157 | - $variables['title'] = $templateTitle; |
|
| 158 | - $variables['subSectionTitle'] = $subSectionTitle; |
|
| 159 | - $variables['docTitle'] = $templateTitle.' - '.$subSectionTitle; |
|
| 160 | - $variables['crumbs'] = [ |
|
| 154 | + $variables[ 'fullPageForm' ] = true; |
|
| 155 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 156 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 157 | + $variables[ 'title' ] = $templateTitle; |
|
| 158 | + $variables[ 'subSectionTitle' ] = $subSectionTitle; |
|
| 159 | + $variables[ 'docTitle' ] = $templateTitle . ' - ' . $subSectionTitle; |
|
| 160 | + $variables[ 'crumbs' ] = [ |
|
| 161 | 161 | [ |
| 162 | 162 | 'label' => $pluginName, |
| 163 | 163 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -168,39 +168,39 @@ discard block |
||
| 168 | 168 | ], |
| 169 | 169 | [ |
| 170 | 170 | 'label' => $subSectionTitle, |
| 171 | - 'url' => UrlHelper::cpUrl('seomatic/global/'.$subSection), |
|
| 171 | + 'url' => UrlHelper::cpUrl('seomatic/global/' . $subSection), |
|
| 172 | 172 | ], |
| 173 | 173 | ]; |
| 174 | - $variables['selectedSubnavItem'] = 'global'; |
|
| 174 | + $variables[ 'selectedSubnavItem' ] = 'global'; |
|
| 175 | 175 | // Pass in the pull fields |
| 176 | 176 | $this->setGlobalFieldSourceVariables($variables); |
| 177 | 177 | // Enabled sites |
| 178 | 178 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 179 | - $variables['controllerHandle'] = 'global'.'/'.$subSection; |
|
| 180 | - $variables['currentSubSection'] = $subSection; |
|
| 179 | + $variables[ 'controllerHandle' ] = 'global' . '/' . $subSection; |
|
| 180 | + $variables[ 'currentSubSection' ] = $subSection; |
|
| 181 | 181 | // Meta bundle settings |
| 182 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle(intval($variables['currentSiteId'])); |
|
| 183 | - $variables['globals'] = $metaBundle->metaGlobalVars; |
|
| 184 | - $variables['sitemap'] = $metaBundle->metaSitemapVars; |
|
| 185 | - $variables['settings'] = $metaBundle->metaBundleSettings; |
|
| 182 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle(intval($variables[ 'currentSiteId' ])); |
|
| 183 | + $variables[ 'globals' ] = $metaBundle->metaGlobalVars; |
|
| 184 | + $variables[ 'sitemap' ] = $metaBundle->metaSitemapVars; |
|
| 185 | + $variables[ 'settings' ] = $metaBundle->metaBundleSettings; |
|
| 186 | 186 | // Template container settings |
| 187 | 187 | $templateContainers = $metaBundle->frontendTemplatesContainer->data; |
| 188 | - $variables['robotsTemplate'] = $templateContainers[FrontendTemplates::ROBOTS_TXT_HANDLE]; |
|
| 189 | - $variables['humansTemplate'] = $templateContainers[FrontendTemplates::HUMANS_TXT_HANDLE]; |
|
| 188 | + $variables[ 'robotsTemplate' ] = $templateContainers[ FrontendTemplates::ROBOTS_TXT_HANDLE ]; |
|
| 189 | + $variables[ 'humansTemplate' ] = $templateContainers[ FrontendTemplates::HUMANS_TXT_HANDLE ]; |
|
| 190 | 190 | // Image selectors |
| 191 | 191 | $bundleSettings = $metaBundle->metaBundleSettings; |
| 192 | - $variables['elementType'] = Asset::class; |
|
| 193 | - $variables['seoImageElements'] = $this->assetElementsFromIds($bundleSettings->seoImageIds, $siteId); |
|
| 194 | - $variables['twitterImageElements'] = $this->assetElementsFromIds($bundleSettings->twitterImageIds, $siteId); |
|
| 195 | - $variables['ogImageElements'] = $this->assetElementsFromIds($bundleSettings->ogImageIds, $siteId); |
|
| 192 | + $variables[ 'elementType' ] = Asset::class; |
|
| 193 | + $variables[ 'seoImageElements' ] = $this->assetElementsFromIds($bundleSettings->seoImageIds, $siteId); |
|
| 194 | + $variables[ 'twitterImageElements' ] = $this->assetElementsFromIds($bundleSettings->twitterImageIds, $siteId); |
|
| 195 | + $variables[ 'ogImageElements' ] = $this->assetElementsFromIds($bundleSettings->ogImageIds, $siteId); |
|
| 196 | 196 | // Preview the meta containers |
| 197 | 197 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 198 | 198 | MetaBundles::GLOBAL_META_BUNDLE, |
| 199 | - intval($variables['currentSiteId']) |
|
| 199 | + intval($variables[ 'currentSiteId' ]) |
|
| 200 | 200 | ); |
| 201 | 201 | |
| 202 | 202 | // Render the template |
| 203 | - return $this->renderTemplate('seomatic/settings/global/'.$subSection, $variables); |
|
| 203 | + return $this->renderTemplate('seomatic/settings/global/' . $subSection, $variables); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -230,11 +230,11 @@ discard block |
||
| 230 | 230 | $metaBundle->metaBundleSettings->setAttributes($bundleSettings); |
| 231 | 231 | } |
| 232 | 232 | $templateContainers = $metaBundle->frontendTemplatesContainer->data; |
| 233 | - $robotsContainer = $templateContainers[FrontendTemplates::ROBOTS_TXT_HANDLE]; |
|
| 233 | + $robotsContainer = $templateContainers[ FrontendTemplates::ROBOTS_TXT_HANDLE ]; |
|
| 234 | 234 | if (!empty($robotsContainer) && is_array($robotsTemplate)) { |
| 235 | 235 | $robotsContainer->setAttributes($robotsTemplate); |
| 236 | 236 | } |
| 237 | - $humansContainer = $templateContainers[FrontendTemplates::HUMANS_TXT_HANDLE]; |
|
| 237 | + $humansContainer = $templateContainers[ FrontendTemplates::HUMANS_TXT_HANDLE ]; |
|
| 238 | 238 | if (!empty($humansContainer) && is_array($humansTemplate)) { |
| 239 | 239 | $humansContainer->setAttributes($humansTemplate); |
| 240 | 240 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | public function actionContent(string $siteHandle = null): Response |
| 261 | 261 | { |
| 262 | - $variables = []; |
|
| 262 | + $variables = [ ]; |
|
| 263 | 263 | // Get the site to edit |
| 264 | 264 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 265 | 265 | |
@@ -271,16 +271,16 @@ discard block |
||
| 271 | 271 | } catch (InvalidConfigException $e) { |
| 272 | 272 | Craft::error($e->getMessage(), __METHOD__); |
| 273 | 273 | } |
| 274 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 274 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 275 | 275 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 276 | 276 | true |
| 277 | 277 | ); |
| 278 | 278 | // Basic variables |
| 279 | - $variables['fullPageForm'] = false; |
|
| 280 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 281 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 282 | - $variables['title'] = $templateTitle; |
|
| 283 | - $variables['crumbs'] = [ |
|
| 279 | + $variables[ 'fullPageForm' ] = false; |
|
| 280 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 281 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 282 | + $variables[ 'title' ] = $templateTitle; |
|
| 283 | + $variables[ 'crumbs' ] = [ |
|
| 284 | 284 | [ |
| 285 | 285 | 'label' => $pluginName, |
| 286 | 286 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -291,9 +291,9 @@ discard block |
||
| 291 | 291 | ], |
| 292 | 292 | ]; |
| 293 | 293 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 294 | - $variables['controllerHandle'] = 'content'; |
|
| 295 | - $variables['selectedSubnavItem'] = 'content'; |
|
| 296 | - $variables['metaBundles'] = Seomatic::$plugin->metaBundles->getContentMetaBundlesForSiteId($siteId); |
|
| 294 | + $variables[ 'controllerHandle' ] = 'content'; |
|
| 295 | + $variables[ 'selectedSubnavItem' ] = 'content'; |
|
| 296 | + $variables[ 'metaBundles' ] = Seomatic::$plugin->metaBundles->getContentMetaBundlesForSiteId($siteId); |
|
| 297 | 297 | |
| 298 | 298 | // Render the template |
| 299 | 299 | return $this->renderTemplate('seomatic/settings/content/index', $variables); |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | string $sourceHandle, |
| 318 | 318 | string $siteHandle = null |
| 319 | 319 | ): Response { |
| 320 | - $variables = []; |
|
| 320 | + $variables = [ ]; |
|
| 321 | 321 | // @TODO: Let people choose an entry/categorygroup/product as the preview |
| 322 | 322 | // Get the site to edit |
| 323 | 323 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | } catch (InvalidConfigException $e) { |
| 330 | 330 | Craft::error($e->getMessage(), __METHOD__); |
| 331 | 331 | } |
| 332 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 332 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 333 | 333 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 334 | 334 | true |
| 335 | 335 | ); |
@@ -339,22 +339,22 @@ discard block |
||
| 339 | 339 | $metaBundle = Seomatic::$plugin->metaBundles->getMetaBundleBySourceHandle( |
| 340 | 340 | $sourceBundleType, |
| 341 | 341 | $sourceHandle, |
| 342 | - intval($variables['currentSiteId']) |
|
| 342 | + intval($variables[ 'currentSiteId' ]) |
|
| 343 | 343 | ); |
| 344 | - $variables['globals'] = $metaBundle->metaGlobalVars; |
|
| 345 | - $variables['sitemap'] = $metaBundle->metaSitemapVars; |
|
| 346 | - $variables['settings'] = $metaBundle->metaBundleSettings; |
|
| 347 | - $variables['currentSourceHandle'] = $metaBundle->sourceHandle; |
|
| 348 | - $variables['currentSourceBundleType'] = $metaBundle->sourceBundleType; |
|
| 344 | + $variables[ 'globals' ] = $metaBundle->metaGlobalVars; |
|
| 345 | + $variables[ 'sitemap' ] = $metaBundle->metaSitemapVars; |
|
| 346 | + $variables[ 'settings' ] = $metaBundle->metaBundleSettings; |
|
| 347 | + $variables[ 'currentSourceHandle' ] = $metaBundle->sourceHandle; |
|
| 348 | + $variables[ 'currentSourceBundleType' ] = $metaBundle->sourceBundleType; |
|
| 349 | 349 | // Basic variables |
| 350 | 350 | $templateTitle = $metaBundle->sourceName; |
| 351 | 351 | $subSectionTitle = Craft::t('seomatic', ucfirst($subSection)); |
| 352 | - $variables['fullPageForm'] = true; |
|
| 353 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 354 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 355 | - $variables['title'] = $templateTitle; |
|
| 356 | - $variables['subSectionTitle'] = $subSectionTitle; |
|
| 357 | - $variables['crumbs'] = [ |
|
| 352 | + $variables[ 'fullPageForm' ] = true; |
|
| 353 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 354 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 355 | + $variables[ 'title' ] = $templateTitle; |
|
| 356 | + $variables[ 'subSectionTitle' ] = $subSectionTitle; |
|
| 357 | + $variables[ 'crumbs' ] = [ |
|
| 358 | 358 | [ |
| 359 | 359 | 'label' => $pluginName, |
| 360 | 360 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -364,19 +364,19 @@ discard block |
||
| 364 | 364 | 'url' => UrlHelper::cpUrl('seomatic/content'), |
| 365 | 365 | ], |
| 366 | 366 | [ |
| 367 | - 'label' => $metaBundle->sourceName.' · '.$subSectionTitle, |
|
| 367 | + 'label' => $metaBundle->sourceName . ' · ' . $subSectionTitle, |
|
| 368 | 368 | 'url' => UrlHelper::cpUrl("seomatic/content/${subSection}/${sourceBundleType}/${sourceHandle}"), |
| 369 | 369 | ], |
| 370 | 370 | ]; |
| 371 | - $variables['selectedSubnavItem'] = 'content'; |
|
| 372 | - $variables['controllerHandle'] = "edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"; |
|
| 371 | + $variables[ 'selectedSubnavItem' ] = 'content'; |
|
| 372 | + $variables[ 'controllerHandle' ] = "edit-content/${subSection}/${sourceBundleType}/${sourceHandle}"; |
|
| 373 | 373 | // Image selectors |
| 374 | - $variables['currentSubSection'] = $subSection; |
|
| 374 | + $variables[ 'currentSubSection' ] = $subSection; |
|
| 375 | 375 | $bundleSettings = $metaBundle->metaBundleSettings; |
| 376 | - $variables['elementType'] = Asset::class; |
|
| 377 | - $variables['seoImageElements'] = $this->assetElementsFromIds($bundleSettings->seoImageIds, $siteId); |
|
| 378 | - $variables['twitterImageElements'] = $this->assetElementsFromIds($bundleSettings->twitterImageIds, $siteId); |
|
| 379 | - $variables['ogImageElements'] = $this->assetElementsFromIds($bundleSettings->ogImageIds, $siteId); |
|
| 376 | + $variables[ 'elementType' ] = Asset::class; |
|
| 377 | + $variables[ 'seoImageElements' ] = $this->assetElementsFromIds($bundleSettings->seoImageIds, $siteId); |
|
| 378 | + $variables[ 'twitterImageElements' ] = $this->assetElementsFromIds($bundleSettings->twitterImageIds, $siteId); |
|
| 379 | + $variables[ 'ogImageElements' ] = $this->assetElementsFromIds($bundleSettings->ogImageIds, $siteId); |
|
| 380 | 380 | // Pass in the pull fields |
| 381 | 381 | $groupName = "Entry"; |
| 382 | 382 | $this->setContentFieldSourceVariables($sourceBundleType, $sourceHandle, $groupName, $variables); |
@@ -384,11 +384,11 @@ discard block |
||
| 384 | 384 | // Preview the meta containers |
| 385 | 385 | Seomatic::$plugin->metaContainers->previewMetaContainers( |
| 386 | 386 | $uri, |
| 387 | - intval($variables['currentSiteId']) |
|
| 387 | + intval($variables[ 'currentSiteId' ]) |
|
| 388 | 388 | ); |
| 389 | 389 | |
| 390 | 390 | // Render the template |
| 391 | - return $this->renderTemplate('seomatic/settings/content/'.$subSection, $variables); |
|
| 391 | + return $this->renderTemplate('seomatic/settings/content/' . $subSection, $variables); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | public function actionSite(string $subSection = 'identity', string $siteHandle = null): Response |
| 459 | 459 | { |
| 460 | - $variables = []; |
|
| 460 | + $variables = [ ]; |
|
| 461 | 461 | // Get the site to edit |
| 462 | 462 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 463 | 463 | |
@@ -467,24 +467,24 @@ discard block |
||
| 467 | 467 | if ($subSection == "social") { |
| 468 | 468 | $subSectionSuffix = " Media"; |
| 469 | 469 | } |
| 470 | - $subSectionTitle = Craft::t('seomatic', ucfirst($subSection).$subSectionSuffix); |
|
| 470 | + $subSectionTitle = Craft::t('seomatic', ucfirst($subSection) . $subSectionSuffix); |
|
| 471 | 471 | // Asset bundle |
| 472 | 472 | try { |
| 473 | 473 | Seomatic::$view->registerAssetBundle(SeomaticAsset::class); |
| 474 | 474 | } catch (InvalidConfigException $e) { |
| 475 | 475 | Craft::error($e->getMessage(), __METHOD__); |
| 476 | 476 | } |
| 477 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 477 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 478 | 478 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 479 | 479 | true |
| 480 | 480 | ); |
| 481 | 481 | // Basic variables |
| 482 | - $variables['fullPageForm'] = true; |
|
| 483 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 484 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 485 | - $variables['title'] = $templateTitle; |
|
| 486 | - $variables['subSectionTitle'] = $subSectionTitle; |
|
| 487 | - $variables['crumbs'] = [ |
|
| 482 | + $variables[ 'fullPageForm' ] = true; |
|
| 483 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 484 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 485 | + $variables[ 'title' ] = $templateTitle; |
|
| 486 | + $variables[ 'subSectionTitle' ] = $subSectionTitle; |
|
| 487 | + $variables[ 'crumbs' ] = [ |
|
| 488 | 488 | [ |
| 489 | 489 | 'label' => $pluginName, |
| 490 | 490 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -495,24 +495,24 @@ discard block |
||
| 495 | 495 | ], |
| 496 | 496 | [ |
| 497 | 497 | 'label' => $subSectionTitle, |
| 498 | - 'url' => UrlHelper::cpUrl('seomatic/site/'.$subSection), |
|
| 498 | + 'url' => UrlHelper::cpUrl('seomatic/site/' . $subSection), |
|
| 499 | 499 | ], |
| 500 | 500 | ]; |
| 501 | - $variables['selectedSubnavItem'] = 'site'; |
|
| 502 | - $variables['currentSubSection'] = $subSection; |
|
| 501 | + $variables[ 'selectedSubnavItem' ] = 'site'; |
|
| 502 | + $variables[ 'currentSubSection' ] = $subSection; |
|
| 503 | 503 | |
| 504 | 504 | // Enabled sites |
| 505 | 505 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 506 | - $variables['controllerHandle'] = 'site'.'/'.$subSection; |
|
| 506 | + $variables[ 'controllerHandle' ] = 'site' . '/' . $subSection; |
|
| 507 | 507 | |
| 508 | 508 | // The site settings for the appropriate meta bundle |
| 509 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle(intval($variables['currentSiteId'])); |
|
| 510 | - $variables['site'] = $metaBundle->metaSiteVars; |
|
| 511 | - $variables['genericImageElements'] = $this->assetElementsFromIds($variables['site']->identity->genericImageIds, $siteId); |
|
| 512 | - $variables['elementType'] = Asset::class; |
|
| 509 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle(intval($variables[ 'currentSiteId' ])); |
|
| 510 | + $variables[ 'site' ] = $metaBundle->metaSiteVars; |
|
| 511 | + $variables[ 'genericImageElements' ] = $this->assetElementsFromIds($variables[ 'site' ]->identity->genericImageIds, $siteId); |
|
| 512 | + $variables[ 'elementType' ] = Asset::class; |
|
| 513 | 513 | |
| 514 | 514 | // Render the template |
| 515 | - return $this->renderTemplate('seomatic/settings/site/'.$subSection, $variables); |
|
| 515 | + return $this->renderTemplate('seomatic/settings/site/' . $subSection, $variables); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | /** |
@@ -527,26 +527,26 @@ discard block |
||
| 527 | 527 | $siteSettings = $request->getParam('site'); |
| 528 | 528 | |
| 529 | 529 | // Make sure the twitter handle isn't prefixed with an @ |
| 530 | - if (!empty($siteSettings['twitterHandle'])) { |
|
| 531 | - $siteSettings['twitterHandle'] = ltrim($siteSettings['twitterHandle'], '@'); |
|
| 530 | + if (!empty($siteSettings[ 'twitterHandle' ])) { |
|
| 531 | + $siteSettings[ 'twitterHandle' ] = ltrim($siteSettings[ 'twitterHandle' ], '@'); |
|
| 532 | 532 | } |
| 533 | 533 | // Make sure the sameAsLinks are indexed by the handle |
| 534 | - if (!empty($siteSettings['sameAsLinks'])) { |
|
| 535 | - $siteSettings['sameAsLinks'] = ArrayHelper::index($siteSettings['sameAsLinks'], 'handle'); |
|
| 534 | + if (!empty($siteSettings[ 'sameAsLinks' ])) { |
|
| 535 | + $siteSettings[ 'sameAsLinks' ] = ArrayHelper::index($siteSettings[ 'sameAsLinks' ], 'handle'); |
|
| 536 | 536 | } |
| 537 | 537 | // The site settings for the appropriate meta bundle |
| 538 | 538 | $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle($siteId); |
| 539 | 539 | if ($metaBundle) { |
| 540 | 540 | if (is_array($siteSettings)) { |
| 541 | - if (!empty($siteSettings['identity'])) { |
|
| 542 | - $this->normalizeTimes($siteSettings['identity']['localBusinessOpeningHours']); |
|
| 543 | - $metaBundle->metaSiteVars->identity->setAttributes($siteSettings['identity']); |
|
| 544 | - $siteSettings['identity'] = $metaBundle->metaSiteVars->identity; |
|
| 541 | + if (!empty($siteSettings[ 'identity' ])) { |
|
| 542 | + $this->normalizeTimes($siteSettings[ 'identity' ][ 'localBusinessOpeningHours' ]); |
|
| 543 | + $metaBundle->metaSiteVars->identity->setAttributes($siteSettings[ 'identity' ]); |
|
| 544 | + $siteSettings[ 'identity' ] = $metaBundle->metaSiteVars->identity; |
|
| 545 | 545 | } |
| 546 | - if (!empty($siteSettings['creator'])) { |
|
| 547 | - $this->normalizeTimes($siteSettings['creator']['localBusinessOpeningHours']); |
|
| 548 | - $metaBundle->metaSiteVars->creator->setAttributes($siteSettings['creator']); |
|
| 549 | - $siteSettings['creator'] = $metaBundle->metaSiteVars->creator; |
|
| 546 | + if (!empty($siteSettings[ 'creator' ])) { |
|
| 547 | + $this->normalizeTimes($siteSettings[ 'creator' ][ 'localBusinessOpeningHours' ]); |
|
| 548 | + $metaBundle->metaSiteVars->creator->setAttributes($siteSettings[ 'creator' ]); |
|
| 549 | + $siteSettings[ 'creator' ] = $metaBundle->metaSiteVars->creator; |
|
| 550 | 550 | } |
| 551 | 551 | $metaBundle->metaSiteVars->setAttributes($siteSettings); |
| 552 | 552 | } |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | */ |
| 567 | 567 | public function actionPlugin(): Response |
| 568 | 568 | { |
| 569 | - $variables = []; |
|
| 569 | + $variables = [ ]; |
|
| 570 | 570 | $pluginName = Seomatic::$settings->pluginName; |
| 571 | 571 | $templateTitle = Craft::t('seomatic', 'Plugin Settings'); |
| 572 | 572 | // Asset bundle |
@@ -575,16 +575,16 @@ discard block |
||
| 575 | 575 | } catch (InvalidConfigException $e) { |
| 576 | 576 | Craft::error($e->getMessage(), __METHOD__); |
| 577 | 577 | } |
| 578 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 578 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 579 | 579 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 580 | 580 | true |
| 581 | 581 | ); |
| 582 | 582 | // Basic variables |
| 583 | - $variables['fullPageForm'] = true; |
|
| 584 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 585 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 586 | - $variables['title'] = $templateTitle; |
|
| 587 | - $variables['crumbs'] = [ |
|
| 583 | + $variables[ 'fullPageForm' ] = true; |
|
| 584 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 585 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 586 | + $variables[ 'title' ] = $templateTitle; |
|
| 587 | + $variables[ 'crumbs' ] = [ |
|
| 588 | 588 | [ |
| 589 | 589 | 'label' => $pluginName, |
| 590 | 590 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -594,8 +594,8 @@ discard block |
||
| 594 | 594 | 'url' => UrlHelper::cpUrl('seomatic/settings'), |
| 595 | 595 | ], |
| 596 | 596 | ]; |
| 597 | - $variables['selectedSubnavItem'] = 'plugin'; |
|
| 598 | - $variables['settings'] = Seomatic::$settings; |
|
| 597 | + $variables[ 'selectedSubnavItem' ] = 'plugin'; |
|
| 598 | + $variables[ 'settings' ] = Seomatic::$settings; |
|
| 599 | 599 | |
| 600 | 600 | // Render the template |
| 601 | 601 | return $this->renderTemplate('seomatic/settings/plugin/_edit', $variables); |
@@ -614,24 +614,24 @@ discard block |
||
| 614 | 614 | */ |
| 615 | 615 | public function actionTracking(string $subSection = 'googleAnalytics', string $siteHandle = null): Response |
| 616 | 616 | { |
| 617 | - $variables = []; |
|
| 617 | + $variables = [ ]; |
|
| 618 | 618 | // Get the site to edit |
| 619 | 619 | $siteId = $this->getSiteIdFromHandle($siteHandle); |
| 620 | 620 | // Enabled sites |
| 621 | 621 | $this->setMultiSiteVariables($siteHandle, $siteId, $variables); |
| 622 | - $variables['controllerHandle'] = 'tracking'; |
|
| 623 | - $variables['currentSubSection'] = $subSection; |
|
| 622 | + $variables[ 'controllerHandle' ] = 'tracking'; |
|
| 623 | + $variables[ 'currentSubSection' ] = $subSection; |
|
| 624 | 624 | |
| 625 | 625 | // The script meta containers for the global meta bundle |
| 626 | - $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle(intval($variables['currentSiteId'])); |
|
| 627 | - $variables['scripts'] = Seomatic::$plugin->metaBundles->getContainerDataFromBundle( |
|
| 626 | + $metaBundle = Seomatic::$plugin->metaBundles->getGlobalMetaBundle(intval($variables[ 'currentSiteId' ])); |
|
| 627 | + $variables[ 'scripts' ] = Seomatic::$plugin->metaBundles->getContainerDataFromBundle( |
|
| 628 | 628 | $metaBundle, |
| 629 | 629 | MetaScriptContainer::CONTAINER_TYPE |
| 630 | 630 | ); |
| 631 | 631 | // Plugin and section settings |
| 632 | 632 | $pluginName = Seomatic::$settings->pluginName; |
| 633 | 633 | $templateTitle = Craft::t('seomatic', 'Tracking Scripts'); |
| 634 | - $subSectionTitle = $variables['scripts'][$subSection]->name; |
|
| 634 | + $subSectionTitle = $variables[ 'scripts' ][ $subSection ]->name; |
|
| 635 | 635 | $subSectionTitle = Craft::t('seomatic', $subSectionTitle); |
| 636 | 636 | // Asset bundle |
| 637 | 637 | try { |
@@ -639,17 +639,17 @@ discard block |
||
| 639 | 639 | } catch (InvalidConfigException $e) { |
| 640 | 640 | Craft::error($e->getMessage(), __METHOD__); |
| 641 | 641 | } |
| 642 | - $variables['baseAssetsUrl'] = Craft::$app->assetManager->getPublishedUrl( |
|
| 642 | + $variables[ 'baseAssetsUrl' ] = Craft::$app->assetManager->getPublishedUrl( |
|
| 643 | 643 | '@nystudio107/seomatic/assetbundles/seomatic/dist', |
| 644 | 644 | true |
| 645 | 645 | ); |
| 646 | 646 | // Basic variables |
| 647 | - $variables['fullPageForm'] = true; |
|
| 648 | - $variables['docsUrl'] = self::DOCUMENTATION_URL; |
|
| 649 | - $variables['pluginName'] = Seomatic::$settings->pluginName; |
|
| 650 | - $variables['title'] = $templateTitle; |
|
| 651 | - $variables['subSectionTitle'] = $subSectionTitle; |
|
| 652 | - $variables['crumbs'] = [ |
|
| 647 | + $variables[ 'fullPageForm' ] = true; |
|
| 648 | + $variables[ 'docsUrl' ] = self::DOCUMENTATION_URL; |
|
| 649 | + $variables[ 'pluginName' ] = Seomatic::$settings->pluginName; |
|
| 650 | + $variables[ 'title' ] = $templateTitle; |
|
| 651 | + $variables[ 'subSectionTitle' ] = $subSectionTitle; |
|
| 652 | + $variables[ 'crumbs' ] = [ |
|
| 653 | 653 | [ |
| 654 | 654 | 'label' => $pluginName, |
| 655 | 655 | 'url' => UrlHelper::cpUrl('seomatic'), |
@@ -660,10 +660,10 @@ discard block |
||
| 660 | 660 | ], |
| 661 | 661 | [ |
| 662 | 662 | 'label' => $subSectionTitle, |
| 663 | - 'url' => UrlHelper::cpUrl('seomatic/tracking/'.$subSection), |
|
| 663 | + 'url' => UrlHelper::cpUrl('seomatic/tracking/' . $subSection), |
|
| 664 | 664 | ], |
| 665 | 665 | ]; |
| 666 | - $variables['selectedSubnavItem'] = 'tracking'; |
|
| 666 | + $variables[ 'selectedSubnavItem' ] = 'tracking'; |
|
| 667 | 667 | |
| 668 | 668 | // Render the template |
| 669 | 669 | return $this->renderTemplate('seomatic/settings/tracking/_edit', $variables); |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | foreach ($scriptData as $key => $value) { |
| 692 | 692 | if (is_array($value)) { |
| 693 | 693 | foreach ($value as $varsKey => $varsValue) { |
| 694 | - $data->$key[$varsKey]['value'] = $varsValue; |
|
| 694 | + $data->$key[ $varsKey ][ 'value' ] = $varsValue; |
|
| 695 | 695 | } |
| 696 | 696 | } else { |
| 697 | 697 | $data->$key = $value; |
@@ -721,17 +721,17 @@ discard block |
||
| 721 | 721 | if (is_string($value)) { |
| 722 | 722 | $value = Json::decode($value); |
| 723 | 723 | } |
| 724 | - $normalized = []; |
|
| 725 | - $times = ['open', 'close']; |
|
| 724 | + $normalized = [ ]; |
|
| 725 | + $times = [ 'open', 'close' ]; |
|
| 726 | 726 | for ($day = 0; $day <= 6; $day++) { |
| 727 | 727 | foreach ($times as $time) { |
| 728 | 728 | if ( |
| 729 | - isset($value[$day][$time]) && |
|
| 730 | - ($date = DateTimeHelper::toDateTime($value[$day][$time])) !== false |
|
| 729 | + isset($value[ $day ][ $time ]) && |
|
| 730 | + ($date = DateTimeHelper::toDateTime($value[ $day ][ $time ])) !== false |
|
| 731 | 731 | ) { |
| 732 | - $normalized[$day][$time] = $date; |
|
| 732 | + $normalized[ $day ][ $time ] = $date; |
|
| 733 | 733 | } else { |
| 734 | - $normalized[$day][$time] = null; |
|
| 734 | + $normalized[ $day ][ $time ] = null; |
|
| 735 | 735 | } |
| 736 | 736 | } |
| 737 | 737 | } |
@@ -754,47 +754,47 @@ discard block |
||
| 754 | 754 | $objectPrefix = 'object.'; |
| 755 | 755 | } |
| 756 | 756 | foreach (self::PULL_TEXT_FIELDS as $fields) { |
| 757 | - $fieldName = $fields['fieldName']; |
|
| 758 | - $source = $bundleSettings[$fieldName.'Source'] ?? ''; |
|
| 759 | - $sourceField = $bundleSettings[$fieldName.'Field'] ?? ''; |
|
| 757 | + $fieldName = $fields[ 'fieldName' ]; |
|
| 758 | + $source = $bundleSettings[ $fieldName . 'Source' ] ?? ''; |
|
| 759 | + $sourceField = $bundleSettings[ $fieldName . 'Field' ] ?? ''; |
|
| 760 | 760 | if (!empty($source)) { |
| 761 | - $seoField = $fields['seoField']; |
|
| 761 | + $seoField = $fields[ 'seoField' ]; |
|
| 762 | 762 | switch ($source) { |
| 763 | 763 | case 'sameAsSeo': |
| 764 | - $globalsSettings[$fieldName] = |
|
| 765 | - '{seomatic.meta.'.$seoField.'}'; |
|
| 764 | + $globalsSettings[ $fieldName ] = |
|
| 765 | + '{seomatic.meta.' . $seoField . '}'; |
|
| 766 | 766 | break; |
| 767 | 767 | |
| 768 | 768 | case 'sameAsSiteTwitter': |
| 769 | - $globalsSettings[$fieldName] = |
|
| 770 | - '{seomatic.site.'.$seoField.'}'; |
|
| 769 | + $globalsSettings[ $fieldName ] = |
|
| 770 | + '{seomatic.site.' . $seoField . '}'; |
|
| 771 | 771 | break; |
| 772 | 772 | |
| 773 | 773 | case 'fromField': |
| 774 | - $globalsSettings[$fieldName] = |
|
| 774 | + $globalsSettings[ $fieldName ] = |
|
| 775 | 775 | '{seomatic.helper.extractTextFromField(' |
| 776 | - .$objectPrefix.$elementName.$sourceField |
|
| 776 | + .$objectPrefix . $elementName . $sourceField |
|
| 777 | 777 | .')}'; |
| 778 | 778 | break; |
| 779 | 779 | |
| 780 | 780 | case 'fromUserField': |
| 781 | - $globalsSettings[$fieldName] = |
|
| 781 | + $globalsSettings[ $fieldName ] = |
|
| 782 | 782 | '{seomatic.helper.extractTextFromField(' |
| 783 | - .$objectPrefix.$elementName.'author.'.$sourceField |
|
| 783 | + .$objectPrefix . $elementName . 'author.' . $sourceField |
|
| 784 | 784 | .')}'; |
| 785 | 785 | break; |
| 786 | 786 | |
| 787 | 787 | case 'summaryFromField': |
| 788 | - $globalsSettings[$fieldName] = |
|
| 788 | + $globalsSettings[ $fieldName ] = |
|
| 789 | 789 | '{seomatic.helper.extractSummary(seomatic.helper.extractTextFromField(' |
| 790 | - .$objectPrefix.$elementName.$sourceField |
|
| 790 | + .$objectPrefix . $elementName . $sourceField |
|
| 791 | 791 | .'))}'; |
| 792 | 792 | break; |
| 793 | 793 | |
| 794 | 794 | case 'keywordsFromField': |
| 795 | - $globalsSettings[$fieldName] = |
|
| 795 | + $globalsSettings[ $fieldName ] = |
|
| 796 | 796 | '{seomatic.helper.extractKeywords(seomatic.helper.extractTextFromField(' |
| 797 | - .$objectPrefix.$elementName.$sourceField |
|
| 797 | + .$objectPrefix . $elementName . $sourceField |
|
| 798 | 798 | .'))}'; |
| 799 | 799 | break; |
| 800 | 800 | |
@@ -821,85 +821,85 @@ discard block |
||
| 821 | 821 | $objectPrefix = 'object.'; |
| 822 | 822 | } |
| 823 | 823 | foreach (self::PULL_ASSET_FIELDS as $fields) { |
| 824 | - $fieldName = $fields['fieldName']; |
|
| 825 | - $source = $bundleSettings[$fieldName.'Source'] ?? ''; |
|
| 826 | - $ids = $bundleSettings[$fieldName.'Ids'] ?? []; |
|
| 827 | - $sourceField = $bundleSettings[$fieldName.'Field'] ?? ''; |
|
| 824 | + $fieldName = $fields[ 'fieldName' ]; |
|
| 825 | + $source = $bundleSettings[ $fieldName . 'Source' ] ?? ''; |
|
| 826 | + $ids = $bundleSettings[ $fieldName . 'Ids' ] ?? [ ]; |
|
| 827 | + $sourceField = $bundleSettings[ $fieldName . 'Field' ] ?? ''; |
|
| 828 | 828 | if (!empty($source)) { |
| 829 | - $transformImage = $bundleSettings[$fieldName.'Transform']; |
|
| 830 | - $seoField = $fields['seoField']; |
|
| 831 | - $transformName = $fields['transformName']; |
|
| 829 | + $transformImage = $bundleSettings[ $fieldName . 'Transform' ]; |
|
| 830 | + $seoField = $fields[ 'seoField' ]; |
|
| 831 | + $transformName = $fields[ 'transformName' ]; |
|
| 832 | 832 | // Special-case Twitter transforms |
| 833 | 833 | if ($transformName == 'twitter') { |
| 834 | 834 | $transformName = 'twitter-summary'; |
| 835 | - if ($globalsSettings['twitterCard'] == 'summary_large_image') { |
|
| 835 | + if ($globalsSettings[ 'twitterCard' ] == 'summary_large_image') { |
|
| 836 | 836 | $transformName = 'twitter-large'; |
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | 839 | if ($transformImage) { |
| 840 | 840 | switch ($source) { |
| 841 | 841 | case 'sameAsSeo': |
| 842 | - $seoSource = $bundleSettings[$seoField.'Source'] ?? ''; |
|
| 843 | - $seoIds = $bundleSettings[$seoField.'Ids'] ?? []; |
|
| 844 | - $seoSourceField = $bundleSettings[$seoField.'Field'] ?? ''; |
|
| 842 | + $seoSource = $bundleSettings[ $seoField . 'Source' ] ?? ''; |
|
| 843 | + $seoIds = $bundleSettings[ $seoField . 'Ids' ] ?? [ ]; |
|
| 844 | + $seoSourceField = $bundleSettings[ $seoField . 'Field' ] ?? ''; |
|
| 845 | 845 | if (!empty($seoSource)) { |
| 846 | 846 | switch ($seoSource) { |
| 847 | 847 | case 'fromField': |
| 848 | 848 | if (!empty($seoSourceField)) { |
| 849 | - $globalsSettings[$fieldName] = '{seomatic.helper.socialTransform(' |
|
| 850 | - .$objectPrefix.$elementName.$seoSourceField.'.one()' |
|
| 851 | - .', "'.$transformName.'"' |
|
| 852 | - .', '.$siteId.')}'; |
|
| 849 | + $globalsSettings[ $fieldName ] = '{seomatic.helper.socialTransform(' |
|
| 850 | + .$objectPrefix . $elementName . $seoSourceField . '.one()' |
|
| 851 | + .', "' . $transformName . '"' |
|
| 852 | + .', ' . $siteId . ')}'; |
|
| 853 | 853 | } |
| 854 | 854 | break; |
| 855 | 855 | case 'fromAsset': |
| 856 | 856 | if (!empty($seoIds)) { |
| 857 | - $globalsSettings[$fieldName] = '{seomatic.helper.socialTransform(' |
|
| 858 | - .$seoIds[0] |
|
| 859 | - .', "'.$transformName.'"' |
|
| 860 | - .', '.$siteId.')}'; |
|
| 857 | + $globalsSettings[ $fieldName ] = '{seomatic.helper.socialTransform(' |
|
| 858 | + .$seoIds[ 0 ] |
|
| 859 | + .', "' . $transformName . '"' |
|
| 860 | + .', ' . $siteId . ')}'; |
|
| 861 | 861 | } |
| 862 | 862 | break; |
| 863 | 863 | default: |
| 864 | - $globalsSettings[$fieldName] = '{seomatic.meta.'.$seoField.'}'; |
|
| 864 | + $globalsSettings[ $fieldName ] = '{seomatic.meta.' . $seoField . '}'; |
|
| 865 | 865 | break; |
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | break; |
| 869 | 869 | case 'fromField': |
| 870 | 870 | if (!empty($sourceField)) { |
| 871 | - $globalsSettings[$fieldName] = '{seomatic.helper.socialTransform(' |
|
| 872 | - .$objectPrefix.$elementName.$sourceField.'.one()' |
|
| 873 | - .', "'.$transformName.'"' |
|
| 874 | - .', '.$siteId.')}'; |
|
| 871 | + $globalsSettings[ $fieldName ] = '{seomatic.helper.socialTransform(' |
|
| 872 | + .$objectPrefix . $elementName . $sourceField . '.one()' |
|
| 873 | + .', "' . $transformName . '"' |
|
| 874 | + .', ' . $siteId . ')}'; |
|
| 875 | 875 | } |
| 876 | 876 | break; |
| 877 | 877 | case 'fromAsset': |
| 878 | 878 | if (!empty($ids)) { |
| 879 | - $globalsSettings[$fieldName] = '{seomatic.helper.socialTransform(' |
|
| 880 | - .$ids[0] |
|
| 881 | - .', "'.$transformName.'"' |
|
| 882 | - .', '.$siteId.')}'; |
|
| 879 | + $globalsSettings[ $fieldName ] = '{seomatic.helper.socialTransform(' |
|
| 880 | + .$ids[ 0 ] |
|
| 881 | + .', "' . $transformName . '"' |
|
| 882 | + .', ' . $siteId . ')}'; |
|
| 883 | 883 | } |
| 884 | 884 | break; |
| 885 | 885 | } |
| 886 | 886 | } else { |
| 887 | 887 | switch ($source) { |
| 888 | 888 | case 'sameAsSeo': |
| 889 | - $globalsSettings[$fieldName] = '{seomatic.meta.'.$seoField.'}'; |
|
| 889 | + $globalsSettings[ $fieldName ] = '{seomatic.meta.' . $seoField . '}'; |
|
| 890 | 890 | break; |
| 891 | 891 | case 'fromField': |
| 892 | 892 | if (!empty($sourceField)) { |
| 893 | - $globalsSettings[$fieldName] = '{' |
|
| 894 | - .$elementName.$sourceField.'.one().url' |
|
| 893 | + $globalsSettings[ $fieldName ] = '{' |
|
| 894 | + .$elementName . $sourceField . '.one().url' |
|
| 895 | 895 | .'}'; |
| 896 | 896 | } |
| 897 | 897 | break; |
| 898 | 898 | case 'fromAsset': |
| 899 | 899 | if (!empty($ids)) { |
| 900 | - $globalsSettings[$fieldName] = '{{ craft.app.assets.assetById(' |
|
| 901 | - .$ids[0] |
|
| 902 | - .', '.$siteId.').url }}'; |
|
| 900 | + $globalsSettings[ $fieldName ] = '{{ craft.app.assets.assetById(' |
|
| 901 | + .$ids[ 0 ] |
|
| 902 | + .', ' . $siteId . ').url }}'; |
|
| 903 | 903 | } |
| 904 | 904 | break; |
| 905 | 905 | } |
@@ -913,15 +913,15 @@ discard block |
||
| 913 | 913 | */ |
| 914 | 914 | protected function setGlobalFieldSourceVariables(array &$variables) |
| 915 | 915 | { |
| 916 | - $variables['textFieldSources'] = array_merge( |
|
| 917 | - ['globalsGroup' => ['optgroup' => 'Globals Fields']], |
|
| 916 | + $variables[ 'textFieldSources' ] = array_merge( |
|
| 917 | + [ 'globalsGroup' => [ 'optgroup' => 'Globals Fields' ] ], |
|
| 918 | 918 | FieldHelper::fieldsOfTypeFromGlobals( |
| 919 | 919 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
| 920 | 920 | false |
| 921 | 921 | ) |
| 922 | 922 | ); |
| 923 | - $variables['assetFieldSources'] = array_merge( |
|
| 924 | - ['globalsGroup' => ['optgroup' => 'Globals Fields']], |
|
| 923 | + $variables[ 'assetFieldSources' ] = array_merge( |
|
| 924 | + [ 'globalsGroup' => [ 'optgroup' => 'Globals Fields' ] ], |
|
| 925 | 925 | FieldHelper::fieldsOfTypeFromGlobals( |
| 926 | 926 | FieldHelper::ASSET_FIELD_CLASS_KEY, |
| 927 | 927 | false |
@@ -941,8 +941,8 @@ discard block |
||
| 941 | 941 | string $groupName, |
| 942 | 942 | array &$variables |
| 943 | 943 | ) { |
| 944 | - $variables['textFieldSources'] = array_merge( |
|
| 945 | - ['entryGroup' => ['optgroup' => $groupName.' Fields'], 'title' => 'Title'], |
|
| 944 | + $variables[ 'textFieldSources' ] = array_merge( |
|
| 945 | + [ 'entryGroup' => [ 'optgroup' => $groupName . ' Fields' ], 'title' => 'Title' ], |
|
| 946 | 946 | FieldHelper::fieldsOfTypeFromSource( |
| 947 | 947 | $sourceBundleType, |
| 948 | 948 | $sourceHandle, |
@@ -950,8 +950,8 @@ discard block |
||
| 950 | 950 | false |
| 951 | 951 | ) |
| 952 | 952 | ); |
| 953 | - $variables['assetFieldSources'] = array_merge( |
|
| 954 | - ['entryGroup' => ['optgroup' => $groupName.' Fields']], |
|
| 953 | + $variables[ 'assetFieldSources' ] = array_merge( |
|
| 954 | + [ 'entryGroup' => [ 'optgroup' => $groupName . ' Fields' ] ], |
|
| 955 | 955 | FieldHelper::fieldsOfTypeFromSource( |
| 956 | 956 | $sourceBundleType, |
| 957 | 957 | $sourceHandle, |
@@ -959,15 +959,15 @@ discard block |
||
| 959 | 959 | false |
| 960 | 960 | ) |
| 961 | 961 | ); |
| 962 | - $variables['assetVolumeTextFieldSources'] = array_merge( |
|
| 963 | - ['entryGroup' => ['optgroup' => 'Asset Volume Fields'], 'title' => 'Title'], |
|
| 962 | + $variables[ 'assetVolumeTextFieldSources' ] = array_merge( |
|
| 963 | + [ 'entryGroup' => [ 'optgroup' => 'Asset Volume Fields' ], 'title' => 'Title' ], |
|
| 964 | 964 | FieldHelper::fieldsOfTypeFromAssetVolumes( |
| 965 | 965 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
| 966 | 966 | false |
| 967 | 967 | ) |
| 968 | 968 | ); |
| 969 | - $variables['userFieldSources'] = array_merge( |
|
| 970 | - ['entryGroup' => ['optgroup' => 'User Fields']], |
|
| 969 | + $variables[ 'userFieldSources' ] = array_merge( |
|
| 970 | + [ 'entryGroup' => [ 'optgroup' => 'User Fields' ] ], |
|
| 971 | 971 | FieldHelper::fieldsOfTypeFromUsers( |
| 972 | 972 | FieldHelper::TEXT_FIELD_CLASS_KEY, |
| 973 | 973 | false |
@@ -1025,43 +1025,43 @@ discard block |
||
| 1025 | 1025 | $sites = Craft::$app->getSites(); |
| 1026 | 1026 | if (Craft::$app->getIsMultiSite()) { |
| 1027 | 1027 | // Set defaults based on the section settings |
| 1028 | - $variables['enabledSiteIds'] = []; |
|
| 1029 | - $variables['siteIds'] = []; |
|
| 1028 | + $variables[ 'enabledSiteIds' ] = [ ]; |
|
| 1029 | + $variables[ 'siteIds' ] = [ ]; |
|
| 1030 | 1030 | |
| 1031 | 1031 | /** @var Site $site */ |
| 1032 | 1032 | foreach ($sites->getEditableSiteIds() as $editableSiteId) { |
| 1033 | - $variables['enabledSiteIds'][] = $editableSiteId; |
|
| 1034 | - $variables['siteIds'][] = $editableSiteId; |
|
| 1033 | + $variables[ 'enabledSiteIds' ][ ] = $editableSiteId; |
|
| 1034 | + $variables[ 'siteIds' ][ ] = $editableSiteId; |
|
| 1035 | 1035 | } |
| 1036 | 1036 | |
| 1037 | 1037 | // Make sure the $siteId they are trying to edit is in our array of editable sites |
| 1038 | - if (!in_array($siteId, $variables['enabledSiteIds'])) { |
|
| 1039 | - if (!empty($variables['enabledSiteIds'])) { |
|
| 1040 | - $siteId = reset($variables['enabledSiteIds']); |
|
| 1038 | + if (!in_array($siteId, $variables[ 'enabledSiteIds' ])) { |
|
| 1039 | + if (!empty($variables[ 'enabledSiteIds' ])) { |
|
| 1040 | + $siteId = reset($variables[ 'enabledSiteIds' ]); |
|
| 1041 | 1041 | } else { |
| 1042 | - $this->requirePermission('editSite:'.$siteId); |
|
| 1042 | + $this->requirePermission('editSite:' . $siteId); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
| 1046 | 1046 | // Set the currentSiteId and currentSiteHandle |
| 1047 | - $variables['currentSiteId'] = empty($siteId) ? Craft::$app->getSites()->currentSite->id : $siteId; |
|
| 1048 | - $variables['currentSiteHandle'] = empty($siteHandle) |
|
| 1047 | + $variables[ 'currentSiteId' ] = empty($siteId) ? Craft::$app->getSites()->currentSite->id : $siteId; |
|
| 1048 | + $variables[ 'currentSiteHandle' ] = empty($siteHandle) |
|
| 1049 | 1049 | ? Craft::$app->getSites()->currentSite->handle |
| 1050 | 1050 | : $siteHandle; |
| 1051 | 1051 | |
| 1052 | 1052 | // Page title |
| 1053 | - $variables['showSites'] = ( |
|
| 1053 | + $variables[ 'showSites' ] = ( |
|
| 1054 | 1054 | Craft::$app->getIsMultiSite() && |
| 1055 | - count($variables['enabledSiteIds']) |
|
| 1055 | + count($variables[ 'enabledSiteIds' ]) |
|
| 1056 | 1056 | ); |
| 1057 | 1057 | |
| 1058 | - if ($variables['showSites']) { |
|
| 1059 | - $variables['sitesMenuLabel'] = Craft::t( |
|
| 1058 | + if ($variables[ 'showSites' ]) { |
|
| 1059 | + $variables[ 'sitesMenuLabel' ] = Craft::t( |
|
| 1060 | 1060 | 'site', |
| 1061 | - $sites->getSiteById(intval($variables['currentSiteId']))->name |
|
| 1061 | + $sites->getSiteById(intval($variables[ 'currentSiteId' ]))->name |
|
| 1062 | 1062 | ); |
| 1063 | 1063 | } else { |
| 1064 | - $variables['sitesMenuLabel'] = ''; |
|
| 1064 | + $variables[ 'sitesMenuLabel' ] = ''; |
|
| 1065 | 1065 | } |
| 1066 | 1066 | } |
| 1067 | 1067 | |
@@ -1076,10 +1076,10 @@ discard block |
||
| 1076 | 1076 | protected function assetElementsFromIds($assetIds, int $siteId) |
| 1077 | 1077 | { |
| 1078 | 1078 | $elements = Craft::$app->getElements(); |
| 1079 | - $assets = []; |
|
| 1079 | + $assets = [ ]; |
|
| 1080 | 1080 | if (!empty($assetIds)) { |
| 1081 | 1081 | foreach ($assetIds as $assetId) { |
| 1082 | - $assets[] = $elements->getElementById($assetId, Asset::class, $siteId); |
|
| 1082 | + $assets[ ] = $elements->getElementById($assetId, Asset::class, $siteId); |
|
| 1083 | 1083 | } |
| 1084 | 1084 | } |
| 1085 | 1085 | |
@@ -1100,7 +1100,7 @@ discard block |
||
| 1100 | 1100 | if ($siteHandle !== null) { |
| 1101 | 1101 | $site = Craft::$app->getSites()->getSiteByHandle($siteHandle); |
| 1102 | 1102 | if (!$site) { |
| 1103 | - throw new NotFoundHttpException('Invalid site handle: '.$siteHandle); |
|
| 1103 | + throw new NotFoundHttpException('Invalid site handle: ' . $siteHandle); |
|
| 1104 | 1104 | } |
| 1105 | 1105 | $siteId = $site->id; |
| 1106 | 1106 | } else { |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function actionGetDecomposedType($schemaType) |
| 63 | 63 | { |
| 64 | - $result = []; |
|
| 64 | + $result = [ ]; |
|
| 65 | 65 | while ($schemaType) { |
| 66 | - $className = 'nystudio107\\seomatic\\models\\jsonld\\'.$schemaType; |
|
| 66 | + $className = 'nystudio107\\seomatic\\models\\jsonld\\' . $schemaType; |
|
| 67 | 67 | if (class_exists($className)) { |
| 68 | 68 | try { |
| 69 | 69 | $classRef = new \ReflectionClass($className); |
@@ -74,14 +74,14 @@ discard block |
||
| 74 | 74 | $staticProps = $classRef->getStaticProperties(); |
| 75 | 75 | |
| 76 | 76 | foreach ($staticProps as $key => $value) { |
| 77 | - if ($key[0] == '_') { |
|
| 77 | + if ($key[ 0 ] == '_') { |
|
| 78 | 78 | $newKey = ltrim($key, '_'); |
| 79 | - $staticProps[$newKey] = $value; |
|
| 80 | - unset($staticProps[$key]); |
|
| 79 | + $staticProps[ $newKey ] = $value; |
|
| 80 | + unset($staticProps[ $key ]); |
|
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | - $result[$schemaType] = $staticProps; |
|
| 84 | - $schemaType = $staticProps['schemaTypeExtends']; |
|
| 83 | + $result[ $schemaType ] = $staticProps; |
|
| 84 | + $schemaType = $staticProps[ 'schemaTypeExtends' ]; |
|
| 85 | 85 | if ($schemaType == "JsonLdType") { |
| 86 | 86 | $schemaType = null; |
| 87 | 87 | } |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @var MetaJsonLd |
| 39 | 39 | */ |
| 40 | - public $data = []; |
|
| 40 | + public $data = [ ]; |
|
| 41 | 41 | |
| 42 | 42 | // Public Methods |
| 43 | 43 | // ========================================================================= |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | Seomatic::$view->registerScript( |
| 62 | 62 | $jsonLd, |
| 63 | 63 | View::POS_END, |
| 64 | - ['type' => 'application/ld+json'] |
|
| 64 | + [ 'type' => 'application/ld+json' ] |
|
| 65 | 65 | ); |
| 66 | 66 | // If `devMode` is enabled, validate the JSON-LD and output any model errors |
| 67 | 67 | if (Seomatic::$devMode) { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | parent::normalizeContainerData(); |
| 88 | 88 | |
| 89 | 89 | foreach ($this->data as $key => $config) { |
| 90 | - $this->data[$key] = MetaJsonLd::create($config['type'], $config); |
|
| 90 | + $this->data[ $key ] = MetaJsonLd::create($config[ 'type' ], $config); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * |
| 37 | 37 | * @var MetaTag |
| 38 | 38 | */ |
| 39 | - public $data = []; |
|
| 39 | + public $data = [ ]; |
|
| 40 | 40 | |
| 41 | 41 | // Public Methods |
| 42 | 42 | // ========================================================================= |
@@ -56,9 +56,9 @@ discard block |
||
| 56 | 56 | Seomatic::$view->registerMetaTag($config); |
| 57 | 57 | // If `devMode` is enabled, validate the Meta Tag and output any model errors |
| 58 | 58 | if (Seomatic::$devMode) { |
| 59 | - $scenario = []; |
|
| 60 | - $scenario['default'] = 'error'; |
|
| 61 | - $scenario['warning'] = 'warning'; |
|
| 59 | + $scenario = [ ]; |
|
| 60 | + $scenario[ 'default' ] = 'error'; |
|
| 61 | + $scenario[ 'warning' ] = 'warning'; |
|
| 62 | 62 | $metaTagModel->debugMetaItem( |
| 63 | 63 | "Tag attribute: ", |
| 64 | 64 | $scenario |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | parent::normalizeContainerData(); |
| 80 | 80 | |
| 81 | 81 | foreach ($this->data as $key => $config) { |
| 82 | - $this->data[$key] = MetaTag::create($key, $config); |
|
| 82 | + $this->data[ $key ] = MetaTag::create($key, $config); |
|
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | } |