= AMP_Theme_Support::STANDARD_MODE_SLUG; $options[ Option::ALL_TEMPLATES_SUPPORTED ] = true; return $options; }; foreach ( $filtered_hooks as $filter_hook ) { add_filter( $filter_hook, $options_filter ); } } $urls = array_filter( $this->scannable_url_provider->get_urls(), static function ( $item ) { return is_array( $item ) && isset( $item['url'] ); } ); if ( $options_filter ) { foreach ( $filtered_hooks as $filter_hook ) { remove_filter( $filter_hook, $options_filter ); } } return rest_ensure_response( array_map( function ( $item ) use ( $request ) { return $this->prepare_item_for_response( $item, $request )->get_data(); }, $urls ) ); } /** * Prepares the scannable URL entry for the REST response. * * @param array $item Scannable URL entry. * @param WP_REST_Request $request Request object. * @return WP_REST_Response Response object on success, or WP_Error object on failure. */ public function prepare_item_for_response( $item, $request ) { $item = wp_array_slice_assoc( $item, [ 'url', 'type', 'label' ] ); if ( amp_is_canonical() ) { $item['amp_url'] = $item['url']; } else { $item['amp_url'] = $this->paired_routing->add_endpoint( $item['url'] ); } $validated_url_post = AMP_Validated_URL_Post_Type::get_invalid_url_post( $item['url'] ); if ( $validated_url_post instanceof WP_Post ) { $item['validation_errors'] = []; $data = json_decode( $validated_url_post->post_content, true ); if ( is_array( $data ) ) { $item['validation_errors'] = wp_list_pluck( $data, 'data' ); } $item['validated_url_post'] = [ 'id' => $validated_url_post->ID, 'edit_link' => get_edit_post_link( $validated_url_post->ID, 'raw' ), ]; $item['stale'] = ( count( AMP_Validated_URL_Post_Type::get_post_staleness( $validated_url_post ) ) > 0 ); } else { $item['validation_errors'] = null; $item['validated_url_post'] = null; $item['stale'] = null; } return rest_ensure_response( $item ); } /** * Retrieves the block type' schema, conforming to JSON Schema. * * @return array Item schema data. */ public function get_item_schema() { return [ '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'amp-wp-' . $this->rest_base, 'type' => 'object', 'properties' => [ 'url' => [ 'description' => __( 'URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'amp_url' => [ 'description' => __( 'AMP URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'type' => [ 'description' => __( 'Type', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'label' => [ 'description' => __( 'Label', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'validated_url_post' => [ 'description' => __( 'Validated URL post if previously scanned.', 'amp' ), 'type' => [ 'object', 'null' ], 'properties' => [ 'id' => [ 'type' => 'integer', ], 'edit_link' => [ 'type' => 'string', 'format' => 'uri', ], ], 'readonly' => true, 'context' => [ 'view' ], ], 'validation_errors' => [ 'description' => __( 'Validation errors for validated URL if previously scanned.', 'amp' ), 'type' => [ 'array', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], 'stale' => [ 'description' => __( 'Whether the Validated URL post is stale.', 'amp' ), 'type' => [ 'boolean', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], ], ]; } } = AMP_Theme_Support::STANDARD_MODE_SLUG; $options[ Option::ALL_TEMPLATES_SUPPORTED ] = true; return $options; }; foreach ( $filtered_hooks as $filter_hook ) { add_filter( $filter_hook, $options_filter ); } } $urls = array_filter( $this->scannable_url_provider->get_urls(), static function ( $item ) { return is_array( $item ) && isset( $item['url'] ); } ); if ( $options_filter ) { foreach ( $filtered_hooks as $filter_hook ) { remove_filter( $filter_hook, $options_filter ); } } return rest_ensure_response( array_map( function ( $item ) use ( $request ) { return $this->prepare_item_for_response( $item, $request )->get_data(); }, $urls ) ); } /** * Prepares the scannable URL entry for the REST response. * * @param array $item Scannable URL entry. * @param WP_REST_Request $request Request object. * @return WP_REST_Response Response object on success, or WP_Error object on failure. */ public function prepare_item_for_response( $item, $request ) { $item = wp_array_slice_assoc( $item, [ 'url', 'type', 'label' ] ); if ( amp_is_canonical() ) { $item['amp_url'] = $item['url']; } else { $item['amp_url'] = $this->paired_routing->add_endpoint( $item['url'] ); } $validated_url_post = AMP_Validated_URL_Post_Type::get_invalid_url_post( $item['url'] ); if ( $validated_url_post instanceof WP_Post ) { $item['validation_errors'] = []; $data = json_decode( $validated_url_post->post_content, true ); if ( is_array( $data ) ) { $item['validation_errors'] = wp_list_pluck( $data, 'data' ); } $item['validated_url_post'] = [ 'id' => $validated_url_post->ID, 'edit_link' => get_edit_post_link( $validated_url_post->ID, 'raw' ), ]; $item['stale'] = ( count( AMP_Validated_URL_Post_Type::get_post_staleness( $validated_url_post ) ) > 0 ); } else { $item['validation_errors'] = null; $item['validated_url_post'] = null; $item['stale'] = null; } return rest_ensure_response( $item ); } /** * Retrieves the block type' schema, conforming to JSON Schema. * * @return array Item schema data. */ public function get_item_schema() { return [ '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'amp-wp-' . $this->rest_base, 'type' => 'object', 'properties' => [ 'url' => [ 'description' => __( 'URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'amp_url' => [ 'description' => __( 'AMP URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'type' => [ 'description' => __( 'Type', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'label' => [ 'description' => __( 'Label', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'validated_url_post' => [ 'description' => __( 'Validated URL post if previously scanned.', 'amp' ), 'type' => [ 'object', 'null' ], 'properties' => [ 'id' => [ 'type' => 'integer', ], 'edit_link' => [ 'type' => 'string', 'format' => 'uri', ], ], 'readonly' => true, 'context' => [ 'view' ], ], 'validation_errors' => [ 'description' => __( 'Validation errors for validated URL if previously scanned.', 'amp' ), 'type' => [ 'array', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], 'stale' => [ 'description' => __( 'Whether the Validated URL post is stale.', 'amp' ), 'type' => [ 'boolean', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], ], ]; } } = AMP_Theme_Support::STANDARD_MODE_SLUG; $options[ Option::ALL_TEMPLATES_SUPPORTED ] = true; return $options; }; foreach ( $filtered_hooks as $filter_hook ) { add_filter( $filter_hook, $options_filter ); } } $urls = array_filter( $this->scannable_url_provider->get_urls(), static function ( $item ) { return is_array( $item ) && isset( $item['url'] ); } ); if ( $options_filter ) { foreach ( $filtered_hooks as $filter_hook ) { remove_filter( $filter_hook, $options_filter ); } } return rest_ensure_response( array_map( function ( $item ) use ( $request ) { return $this->prepare_item_for_response( $item, $request )->get_data(); }, $urls ) ); } /** * Prepares the scannable URL entry for the REST response. * * @param array $item Scannable URL entry. * @param WP_REST_Request $request Request object. * @return WP_REST_Response Response object on success, or WP_Error object on failure. */ public function prepare_item_for_response( $item, $request ) { $item = wp_array_slice_assoc( $item, [ 'url', 'type', 'label' ] ); if ( amp_is_canonical() ) { $item['amp_url'] = $item['url']; } else { $item['amp_url'] = $this->paired_routing->add_endpoint( $item['url'] ); } $validated_url_post = AMP_Validated_URL_Post_Type::get_invalid_url_post( $item['url'] ); if ( $validated_url_post instanceof WP_Post ) { $item['validation_errors'] = []; $data = json_decode( $validated_url_post->post_content, true ); if ( is_array( $data ) ) { $item['validation_errors'] = wp_list_pluck( $data, 'data' ); } $item['validated_url_post'] = [ 'id' => $validated_url_post->ID, 'edit_link' => get_edit_post_link( $validated_url_post->ID, 'raw' ), ]; $item['stale'] = ( count( AMP_Validated_URL_Post_Type::get_post_staleness( $validated_url_post ) ) > 0 ); } else { $item['validation_errors'] = null; $item['validated_url_post'] = null; $item['stale'] = null; } return rest_ensure_response( $item ); } /** * Retrieves the block type' schema, conforming to JSON Schema. * * @return array Item schema data. */ public function get_item_schema() { return [ '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'amp-wp-' . $this->rest_base, 'type' => 'object', 'properties' => [ 'url' => [ 'description' => __( 'URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'amp_url' => [ 'description' => __( 'AMP URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'type' => [ 'description' => __( 'Type', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'label' => [ 'description' => __( 'Label', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'validated_url_post' => [ 'description' => __( 'Validated URL post if previously scanned.', 'amp' ), 'type' => [ 'object', 'null' ], 'properties' => [ 'id' => [ 'type' => 'integer', ], 'edit_link' => [ 'type' => 'string', 'format' => 'uri', ], ], 'readonly' => true, 'context' => [ 'view' ], ], 'validation_errors' => [ 'description' => __( 'Validation errors for validated URL if previously scanned.', 'amp' ), 'type' => [ 'array', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], 'stale' => [ 'description' => __( 'Whether the Validated URL post is stale.', 'amp' ), 'type' => [ 'boolean', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], ], ]; } } = AMP_Theme_Support::STANDARD_MODE_SLUG; $options[ Option::ALL_TEMPLATES_SUPPORTED ] = true; return $options; }; foreach ( $filtered_hooks as $filter_hook ) { add_filter( $filter_hook, $options_filter ); } } $urls = array_filter( $this->scannable_url_provider->get_urls(), static function ( $item ) { return is_array( $item ) && isset( $item['url'] ); } ); if ( $options_filter ) { foreach ( $filtered_hooks as $filter_hook ) { remove_filter( $filter_hook, $options_filter ); } } return rest_ensure_response( array_map( function ( $item ) use ( $request ) { return $this->prepare_item_for_response( $item, $request )->get_data(); }, $urls ) ); } /** * Prepares the scannable URL entry for the REST response. * * @param array $item Scannable URL entry. * @param WP_REST_Request $request Request object. * @return WP_REST_Response Response object on success, or WP_Error object on failure. */ public function prepare_item_for_response( $item, $request ) { $item = wp_array_slice_assoc( $item, [ 'url', 'type', 'label' ] ); if ( amp_is_canonical() ) { $item['amp_url'] = $item['url']; } else { $item['amp_url'] = $this->paired_routing->add_endpoint( $item['url'] ); } $validated_url_post = AMP_Validated_URL_Post_Type::get_invalid_url_post( $item['url'] ); if ( $validated_url_post instanceof WP_Post ) { $item['validation_errors'] = []; $data = json_decode( $validated_url_post->post_content, true ); if ( is_array( $data ) ) { $item['validation_errors'] = wp_list_pluck( $data, 'data' ); } $item['validated_url_post'] = [ 'id' => $validated_url_post->ID, 'edit_link' => get_edit_post_link( $validated_url_post->ID, 'raw' ), ]; $item['stale'] = ( count( AMP_Validated_URL_Post_Type::get_post_staleness( $validated_url_post ) ) > 0 ); } else { $item['validation_errors'] = null; $item['validated_url_post'] = null; $item['stale'] = null; } return rest_ensure_response( $item ); } /** * Retrieves the block type' schema, conforming to JSON Schema. * * @return array Item schema data. */ public function get_item_schema() { return [ '$schema' => 'http://json-schema.org/draft-04/schema#', 'title' => 'amp-wp-' . $this->rest_base, 'type' => 'object', 'properties' => [ 'url' => [ 'description' => __( 'URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'amp_url' => [ 'description' => __( 'AMP URL', 'amp' ), 'type' => 'string', 'format' => 'uri', 'readonly' => true, 'context' => [ 'view' ], ], 'type' => [ 'description' => __( 'Type', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'label' => [ 'description' => __( 'Label', 'amp' ), 'type' => 'string', 'readonly' => true, 'context' => [ 'view' ], ], 'validated_url_post' => [ 'description' => __( 'Validated URL post if previously scanned.', 'amp' ), 'type' => [ 'object', 'null' ], 'properties' => [ 'id' => [ 'type' => 'integer', ], 'edit_link' => [ 'type' => 'string', 'format' => 'uri', ], ], 'readonly' => true, 'context' => [ 'view' ], ], 'validation_errors' => [ 'description' => __( 'Validation errors for validated URL if previously scanned.', 'amp' ), 'type' => [ 'array', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], 'stale' => [ 'description' => __( 'Whether the Validated URL post is stale.', 'amp' ), 'type' => [ 'boolean', 'null' ], 'readonly' => true, 'context' => [ 'view' ], ], ], ]; } } Entrepreneuriat Archives - Infos Culture du Faso
mer 4 décembre 2024

Suivez-nous sur les réseaux sociaux

spot_img
AccueilTagsEntrepreneuriat

Tag: Entrepreneuriat

Aucun article à afficher

- Advertisement -spot_img

Latest Articles

Vous ne pouvez pas copier le contenu de cette page