/** * WP_oEmbed_Controller class, used to provide an oEmbed endpoint. * * @package WordPress * @subpackage Embeds * @since 4.4.0 */ /** * oEmbed API endpoint controller. * * Registers the REST API route and delivers the response data. * The output format (XML or JSON) is handled by the REST API. * * @since 4.4.0 */ #[AllowDynamicProperties] final class WP_oEmbed_Controller { /** * Register the oEmbed REST API route. * * @since 4.4.0 */ public function register_routes() { /** * Filters the maxwidth oEmbed parameter. * * @since 4.4.0 * * @param int $maxwidth Maximum allowed width. Default 600. */ $maxwidth = apply_filters( 'oembed_default_width', 600 ); register_rest_route( 'oembed/1.0', '/embed', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_item' ), 'permission_callback' => '__return_true', 'args' => array( 'url' => array( 'description' => __( 'The URL of the resource for which to fetch oEmbed data.' ), 'required' => true, 'type' => 'string', 'format' => 'uri', ), 'format' => array( 'default' => 'json', 'sanitize_callback' => 'wp_oembed_ensure_format', ), 'maxwidth' => array( 'default' => $maxwidth, 'sanitize_callback' => 'absint', ), ), ), ) ); register_rest_route( 'oembed/1.0', '/proxy', array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_proxy_item' ), 'permission_callback' => array( $this, 'get_proxy_item_permissions_check' ), 'args' => array( 'url' => array( 'description' => __( 'The URL of the resource for which to fetch oEmbed data.' ), 'required' => true, 'type' => 'string', 'format' => 'uri', ), 'format' => array( 'description' => __( 'The oEmbed format to use.' ), 'type' => 'string', 'default' => 'json', 'enum' => array( 'json', 'xml', ), ), 'maxwidth' => array( 'description' => __( 'The maximum width of the embed frame in pixels.' ), 'type' => 'integer', 'default' => $maxwidth, 'sanitize_callback' => 'absint', ), 'maxheight' => array( 'description' => __( 'The maximum height of the embed frame in pixels.' ), 'type' => 'integer', 'sanitize_callback' => 'absint', ), 'discover' => array( 'description' => __( 'Whether to perform an oEmbed discovery request for unsanctioned providers.' ), 'type' => 'boolean', 'default' => true, ), ), ), ) ); } /** * Callback for the embed API endpoint. * * Returns the JSON object for the post. * * @since 4.4.0 * * @param WP_REST_Request $request Full data about the request. * @return array|WP_Error oEmbed response data or WP_Error on failure. */ public function get_item( $request ) { $post_id = url_to_postid( $request['url'] ); /** * Filters the determined post ID. * * @since 4.4.0 * * @param int $post_id The post ID. * @param string $url The requested URL. */ $post_id = apply_filters( 'oembed_request_post_id', $post_id, $request['url'] ); $data = get_oembed_response_data( $post_id, $request['maxwidth'] ); if ( ! $data ) { return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) ); } return $data; } /** * Checks if current user can make a proxy oEmbed request. * * @since 4.8.0 * * @return true|WP_Error True if the request has read access, WP_Error object otherwise. */ public function get_proxy_item_permissions_check() { if ( ! current_user_can( 'edit_posts' ) ) { return new WP_Error( 'rest_forbidden', __( 'Sorry, you are not allowed to make proxied oEmbed requests.' ), array( 'status' => rest_authorization_required_code() ) ); } return true; } /** * Callback for the proxy API endpoint. * * Returns the JSON object for the proxied item. * * @since 4.8.0 * * @see WP_oEmbed::get_html() * @global WP_Embed $wp_embed WordPress Embed object. * @global WP_Scripts $wp_scripts * * @param WP_REST_Request $request Full data about the request. * @return object|WP_Error oEmbed response data or WP_Error on failure. */ public function get_proxy_item( $request ) { global $wp_embed, $wp_scripts; $args = $request->get_params(); // Serve oEmbed data from cache if set. unset( $args['_wpnonce'] ); $cache_key = 'oembed_' . md5( serialize( $args ) ); $data = get_transient( $cache_key ); if ( ! empty( $data ) ) { return $data; } $url = $request['url']; unset( $args['url'] ); // Copy maxwidth/maxheight to width/height since WP_oEmbed::fetch() uses these arg names. if ( isset( $args['maxwidth'] ) ) { $args['width'] = $args['maxwidth']; } if ( isset( $args['maxheight'] ) ) { $args['height'] = $args['maxheight']; } // Short-circuit process for URLs belonging to the current site. $data = get_oembed_response_data_for_url( $url, $args ); if ( $data ) { return $data; } $data = _wp_oembed_get_object()->get_data( $url, $args ); if ( false === $data ) { // Try using a classic embed, instead. /* @var WP_Embed $wp_embed */ $html = $wp_embed->get_embed_handler_html( $args, $url ); if ( $html ) { // Check if any scripts were enqueued by the shortcode, and include them in the response. $enqueued_scripts = array(); foreach ( $wp_scripts->queue as $script ) { $enqueued_scripts[] = $wp_scripts->registered[ $script ]->src; } return (object) array( 'provider_name' => __( 'Embed Handler' ), 'html' => $html, 'scripts' => $enqueued_scripts, ); } return new WP_Error( 'oembed_invalid_url', get_status_header_desc( 404 ), array( 'status' => 404 ) ); } /** This filter is documented in wp-includes/class-wp-oembed.php */ $data->html = apply_filters( 'oembed_result', _wp_oembed_get_object()->data2html( (object) $data, $url ), $url, $args ); /** * Filters the oEmbed TTL value (time to live). * * Similar to the {@see 'oembed_ttl'} filter, but for the REST API * oEmbed proxy endpoint. * * @since 4.8.0 * * @param int $time Time to live (in seconds). * @param string $url The attempted embed URL. * @param array $args An array of embed request arguments. */ $ttl = apply_filters( 'rest_oembed_ttl', DAY_IN_SECONDS, $url, $args ); set_transient( $cache_key, $data, $ttl ); return $data; } } https://validator.w3.org/feed/docs/rss2.html Play Real Money All in Bet Online Mucchio Games Better 50+ Interac Casinos Canada On the web & e-Transfer Acknowledged Incontro Chicken Road Pepegol di Bisca Italia Giocare Gratis, RTP 98% Betchan Gambling establishment No deposit Added bonus Requirements August 2026 Better No-deposit Harbors 2026 Better No deposit Harbors Offers Tragamonedas sin cargo Gamble Roulette Online for real Currency Better 10 Gambling enterprises inside 2026 Casumo Local casino No deposit Bonus, 100 percent free spins & Coupons Ford F-Collection casino ruby fortune login Wikipedia Cosmic Jewels tragaperras online Dragon Dancing Demonstration free 80 spins no deposit 2023 Gamble Free Ports from the High com Finest $5 Minimum Deposit Casinos Us 2026 Gamble viking runecraft slot machine On the internet Twist Local casino $step 1 Put Added bonus Personal 70 100 percent free Spins 2026 Render Best $5 Lowest Deposit Casinos 40 free spins no deposit 2023 for 2026 Soluciona Máquinas Tragamonedas Online Sin cargo o bien Con manga larga Recursos Real Best real cash online slots Gamble ports the real deal money al com Play 100 percent free Position Games On the 50 free spins tropic dancer internet no down load, no subscription Gonzo’s Trip Position Enjoy 95 97% RTP, 2200 xBet Max Winnings Juegos de Tragamonedas Regalado: Jugar spinfest Debido a Gratuito online Best 15 Free Spins No-deposit Incentives One to Spend Punctual 2025 Zeus free spins casino uk On the internet Slot Play for Totally free No deposit Totally free Revolves during the SpinWizard!Twist Wizard No deposit Gambling establishment Also provides Slots de balde online Soluciona mi reseña aquí acerca de un 500+ máquinas tragamonedas 7s Nuts Position Demonstration & Game Review ᐈ Wager 100 percent free for the SlotCatalog Thunderstruck roller derby 5 deposit Position Video game Demo Gamble & Free Revolves Largest English Every day Inside the Borneo 20 The new No deposit roman riches $1 deposit Bonus Codes For September 2026 Current Every day Best Web based casinos in the Canada 2024 Best 30 Canadian Gambling enterprises +treinta 000 Juegos powbet casino sobre Casino De balde Online Top real cash on the web the heat is on slot free spins pokies gambling enterprises in australia Organization Insider Africa 10 Greatest Sugar Momma Websites: See a sugar Momma On line Play Blackjack The best Dinner in the Bellevue, Washington Lost Las vegas Demonstration Play 100 percent free Ports during the High com Greatest Gambling establishment Ports for real Money 2026: Enjoy Position Video game On the internet Award winning Public Gambling establishment Experience slot roshtein immortality cube megaways with the brand new U S. Casinos Accepting MuchBetter 2026 Best Financial Import Gambling enterprises Deposit with full confidence & Play 100 percent free Slots with highest payout slots Free Spins: Play On line and no Down load Comprehending What an ESA Letter Is Totally free Revolves No-deposit Incentives Earn Real cash 2026 Very Cat reel rush casino Play Totally free Microgaming Application Casino Harbors The fresh Local casino No-deposit Incentives Canada Free online games Pharaohs of 100 free spins no deposit casino euro Old Egypt Better Instadebit Casinos Canada 2026 Deposits & Incentives Arcanebet Gambling enterprise Remark: Bonuses, Profits & Assessment Better Skrill Playing Internet sites: 7 Casinos jackpot city free spins existing customers no deposit on the internet Acknowledging Skrill in the 2026 Enjoy Nuts Lifetime Slot machine game: Online Demonstration because of the IGT