id = 'thinkrank/get-image-seo-settings'; $this->label = __( 'Get ThinkRank Image SEO Settings', 'thinkrank' ); $this->description = __( 'Retrieve ThinkRank image SEO settings, which control automatic alt/title injection, the token-based formats used to generate them, and whether generated alt text is persisted to the Media Library. Use update-image-seo-settings to change them.', 'thinkrank' ); } /** * {@inheritDoc} * * @return array */ public function get_annotations() { return [ 'readonly' => true, 'destructive' => false, 'idempotent' => true, 'priority' => 1.0, 'openWorldHint' => false, ]; } /** * {@inheritDoc} * * @return array */ public function get_input_schema() { return [ 'type' => 'object', 'additionalProperties' => false, 'properties' => self::empty_properties(), ]; } /** * {@inheritDoc} * * @return array */ public function get_output_schema() { return [ 'type' => 'object', 'properties' => [ 'settings' => [ 'type' => 'object', 'properties' => [ 'add_missing_alt' => [ 'type' => 'boolean' ], 'alt_format' => [ 'type' => 'string' ], 'add_missing_title' => [ 'type' => 'boolean' ], 'title_format' => [ 'type' => 'string' ], 'save_alt_to_media' => [ 'type' => 'boolean' ], 'auto_fill_on_upload' => [ 'type' => 'boolean' ], 'media_alt_overwrite' => [ 'type' => 'boolean' ], ], ], ], ]; } /** * Execute ability. * * @param array $input Ability input payload. * @return array */ public function execute( $input ) { $mgr = new Image_SEO_Manager(); $s = $mgr->get_settings( 'site', null ); $out = []; foreach ( self::BOOL_KEYS as $key ) { $out[ $key ] = (bool) ( $s[ $key ] ?? false ); } foreach ( self::STRING_KEYS as $key ) { $out[ $key ] = (string) ( $s[ $key ] ?? '' ); } return [ 'settings' => $out ]; } }