id = 'thinkrank/get-social-meta-settings'; $this->label = __( 'Get ThinkRank Social Meta Settings', 'thinkrank' ); $this->description = __( 'Retrieve ThinkRank social meta settings, covering Open Graph, Twitter Cards, and per-network verification and handle configuration. Use update-social-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, ]; } /** * Build the JSON schema properties for social meta settings. * * @return array */ private static function schema_properties() { $props = []; foreach ( self::BOOL_KEYS as $key ) { $props[ $key ] = [ 'type' => 'boolean' ]; } foreach ( self::INT_KEYS as $key ) { $props[ $key ] = [ 'type' => 'integer' ]; } foreach ( self::STRING_KEYS as $key ) { $props[ $key ] = [ 'type' => 'string' ]; } return $props; } /** * {@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' => self::schema_properties(), ], ], ]; } /** * Execute ability. * * @param array $input Ability input payload. * @return array */ public function execute( $input ) { $mgr = new Social_Meta_Manager(); $s = $mgr->get_settings( 'site', null ); $out = []; foreach ( self::BOOL_KEYS as $key ) { $out[ $key ] = (bool) ( $s[ $key ] ?? false ); } foreach ( self::INT_KEYS as $key ) { $out[ $key ] = (int) ( $s[ $key ] ?? 0 ); } foreach ( self::STRING_KEYS as $key ) { $out[ $key ] = (string) ( $s[ $key ] ?? '' ); } return [ 'settings' => $out ]; } }