true, 'noindex' => false, 'nofollow' => false, 'noarchive' => false, 'noimageindex' => false, 'nosnippet' => false, ]; /** * Constructor. */ public function __construct() { $this->id = 'thinkrank/get-robots-meta-settings'; $this->label = __( 'Get ThinkRank Robots Meta Settings', 'thinkrank' ); $this->description = __( 'Retrieve ThinkRank site-wide default robots meta directives (index, noindex, nofollow, noarchive, noimageindex, nosnippet). Use update-robots-meta-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' => [ 'index' => [ 'type' => 'boolean' ], 'noindex' => [ 'type' => 'boolean' ], 'nofollow' => [ 'type' => 'boolean' ], 'noarchive' => [ 'type' => 'boolean' ], 'noimageindex' => [ 'type' => 'boolean' ], 'nosnippet' => [ '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 ); $out = []; foreach ( array_keys( self::DEFAULTS ) as $key ) { $out[ $key ] = (bool) ( $settings[ $key ] ?? self::DEFAULTS[ $key ] ); } return $out; } }