false, 'auto_submit_post_types' => [ 'post', 'page' ], 'api_key' => '', ]; /** * Constructor. */ public function __construct() { $this->id = 'thinkrank/get-instant-indexing-settings'; $this->label = __( 'Get ThinkRank Instant Indexing Settings', 'thinkrank' ); $this->description = __( 'Retrieve ThinkRank instant indexing (IndexNow) settings. The API key is auto-generated and is not exposed; only whether a key is set is reported. Use update-instant-indexing-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' => [ 'enabled' => [ 'type' => 'boolean' ], 'auto_submit_post_types' => [ 'type' => 'array', 'items' => [ 'type' => 'string' ], ], 'api_key_set' => [ 'type' => 'boolean' ], ], ]; } /** * Execute ability. * * @param array $input Ability input payload. * @return array */ public function execute( $input ) { $settings = wp_parse_args( (array) get_option( self::OPTION, [] ), self::DEFAULTS ); $post_types = is_array( $settings['auto_submit_post_types'] ?? null ) ? array_values( array_map( 'sanitize_key', $settings['auto_submit_post_types'] ) ) : []; return [ 'enabled' => (bool) ( $settings['enabled'] ?? false ), 'auto_submit_post_types' => $post_types, 'api_key_set' => '' !== (string) ( $settings['api_key'] ?? '' ), ]; } }