← All changes
|
includes/abilities/settings/class-get-site-identity-settings.php
+4
-46
2.0.0
→
2.9.0
View file →
| @@ -24,39 +24,14 @@ | ||
| 24 | 24 | * excluded here; use the dedicated robots.txt ability for those. |
| 25 | 25 | */ |
| 26 | 26 | class Get_Site_Identity_Settings extends Ability_Base { |
| 27 | 27 | /** |
| 28 | - * Boolean-typed site identity keys. | |
| 29 | - */ | |
| 30 | - private const BOOL_KEYS = [ | |
| 31 | - 'enabled', | |
| 32 | - 'breadcrumbs_enabled', | |
| 33 | - ]; | |
| 34 | - | |
| 35 | - /** | |
| 36 | - * String-typed site identity keys. | |
| 37 | - */ | |
| 38 | - private const STRING_KEYS = [ | |
| 39 | - 'title_template', | |
| 40 | - 'title_separator', | |
| 41 | - 'site_name', | |
| 42 | - 'site_description', | |
| 43 | - 'tagline', | |
| 44 | - 'breadcrumb_type', | |
| 45 | - 'breadcrumb_home_text', | |
| 46 | - 'breadcrumb_separator', | |
| 47 | - 'logo_url', | |
| 48 | - 'favicon_url', | |
| 49 | - 'apple_touch_icon_url', | |
| 50 | - ]; | |
| 51 | - | |
| 52 | - /** | |
| 53 | 28 | * Constructor. |
| 54 | 29 | */ |
| 55 | 30 | public function __construct() { |
| 56 | 31 | $this->id = 'thinkrank/get-site-identity-settings'; |
| 57 | 32 | $this->label = __( 'Get ThinkRank Site Identity Settings', 'thinkrank' ); |
| 58 | - $this->description = __( 'Retrieve ThinkRank site identity settings: title templates, site name/description, breadcrumb configuration, and brand imagery. Robots.txt configuration is excluded.', 'thinkrank' ); | |
| 33 | + $this->description = __( 'Retrieve ThinkRank site identity settings: the homepage/category/tag/author/search/archive title templates, site name and description, breadcrumb configuration, brand imagery, homepage hero, and the business details behind LocalBusiness schema. Robots.txt contents and schema toggles have their own abilities. Use update-site-identity-settings to change them.', 'thinkrank' ); | |
| 59 | 34 | } |
| 60 | 35 | |
| 61 | 36 | /** |
| 62 | 37 | * {@inheritDoc} |
| @@ -78,18 +53,9 @@ | ||
| 78 | 53 | * |
| 79 | 54 | * @return array<string, mixed> |
| 80 | 55 | */ |
| 81 | 56 | private static function schema_properties() { |
| 82 | - $props = []; | |
| 83 | - | |
| 84 | - foreach ( self::BOOL_KEYS as $key ) { | |
| 85 | - $props[ $key ] = [ 'type' => 'boolean' ]; | |
| 86 | - } | |
| 87 | - foreach ( self::STRING_KEYS as $key ) { | |
| 88 | - $props[ $key ] = [ 'type' => 'string' ]; | |
| 89 | - } | |
| 90 | - | |
| 91 | - return $props; | |
| 57 | + return Settings_Key_Map::site_identity(); | |
| 92 | 58 | } |
| 93 | 59 | |
| 94 | 60 | /** |
| 95 | 61 | * {@inheritDoc} |
| @@ -99,9 +65,9 @@ | ||
| 99 | 65 | public function get_input_schema() { |
| 100 | 66 | return [ |
| 101 | 67 | 'type' => 'object', |
| 102 | 68 | 'additionalProperties' => false, |
| 103 | - 'properties' => [], | |
| 69 | + 'properties' => self::empty_properties(), | |
| 104 | 70 | ]; |
| 105 | 71 | } |
| 106 | 72 | |
| 107 | 73 | /** |
| @@ -130,15 +96,7 @@ | ||
| 130 | 96 | public function execute( $input ) { |
| 131 | 97 | $mgr = new Site_Identity_Manager(); |
| 132 | 98 | $s = $mgr->get_settings( 'site', null ); |
| 133 | 99 | |
| 134 | - $out = []; | |
| 135 | - foreach ( self::BOOL_KEYS as $key ) { | |
| 136 | - $out[ $key ] = (bool) ( $s[ $key ] ?? false ); | |
| 137 | - } | |
| 138 | - foreach ( self::STRING_KEYS as $key ) { | |
| 139 | - $out[ $key ] = (string) ( $s[ $key ] ?? '' ); | |
| 140 | - } | |
| 141 | - | |
| 142 | - return [ 'settings' => $out ]; | |
| 100 | + return [ 'settings' => Settings_Key_Map::read( Settings_Key_Map::site_identity(), $s ) ]; | |
| 143 | 101 | } |
| 144 | 102 | } |