/** * 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 Leading On-line casino crazy monkey online slot Reviews & Greatest Bonuses 2026 Frog Story Slot nv casino Schätzung & Freies Durchlauf Demonstration 100% Gambling establishment Incentive Greatest one hundred% Suits Deposit Incentives to own 2026 Greatest Real money Casinos Us Summer 2026 baccarat pro series low limit online casino Pro Picks Ranked from the Genuine Professionals Better 50 no deposit spins elementium spin 16 Casinos for Online casino games Enjoy and Earn Real money Finest Casinos on the internet For real Currency July 2026 Best No deposit slot arabian caravan Added bonus Gambling establishment 2026 Current Totally free Offers Greatest No deposit Bonus Casino 2026 Latest Free Offers Gonzo’s Quest Slot nv casino Machine By Netent Better Online casinos Us 2026: Real money Web sites the garage slot machine Examined 100 percent free $one hundred Local casino Processor No deposit 2026 Greatest real cash casinos on the internet in the 2026 birthday slot machine al com What makes myhomeshopping.co.uk a trusted choice for UK players seeking non GamStop casinos in Most readily useful Zero-Deposit Added bonus Gambling enterprise Requirements having July 2026 No deposit Incentives July 2026 $50 Totally free Zero Exposure Ideal No-deposit Bonuses Inside the July 2026- NoDepositExplorer com No deposit gambling establishment incentives Totally free casinos No-deposit Bonuses Coupon codes & Personal Also offers to possess 2026 No deposit Bonuses July 2026 $50 Free Zero Risk No-deposit Bonuses NZ ️ Score $5 at no cost No deposit Incentive #step one Most useful No deposit Added bonus Gambling enterprises 2026 This new No deposit Extra Uk Ideal Join Also offers away from July 2026 No-deposit Incentive Local casino Real money 2026 Most readily useful No-deposit Incentives in the us to own 2026 An educated No-deposit Incentive Rules January 2026 Finest No-deposit Bonus Casinos 2025: Most useful 5 Casino Websites Giving Totally free Revolves And you can Personal Added bonus Codes! No-deposit Casino Bonus Requirements Ideal On-line casino Incentives inside 2026 Put & Attract more 20+ Ideal No-deposit Extra Bitcoin & Crypto Gambling enterprises: Ideal Selections! No deposit Gambling establishment Bonuses Totally free Revolves having On line People 2026 Pharao’s Money Position how to win thunderstruck slot Opinion 2026 100 percent free Gamble Trial Top-ten Online casinos no deposit bonus the real deal Money Usa July 2026 Online casinos United states of slot 5 dragons america 2026 Checked & Rated Enjoy Starburst casino paradise no deposit bonus 2023 Position Totally free Zero Subscribe Required Appreciate Free Revolves during play 3 reel pokies the globes leading Online casino Better Legitimate Web based 777 real money casino casinos: Real money Websites inside 2026 NetBet Local casino: a hundred Zero Booty Time casino Wagering 100 percent free Spins 100 phone casino mobile percent free Revolves Bonuses Finest Totally free Revolves Gambling enterprises in the 2026 100 percent free Spins No-deposit Incentives for real Money Earnings United states play high society online of america 2026 Official Webpages, Extra 50 free spins king of the jungle Publication & Ports Greatest Cellular Gambling Spin Palace internet casino enterprises 2026 Gamble Local casino from your own Cellular telephone Anyplace Miami online slots that pay real money Pub Gambling enterprise No-deposit Incentive Codes July 2026 Totally free Revolves No deposit Uk 2026 online casino fire joker Best 100 percent free Revolves Also provides Play the reactoonz $1 deposit Finest On the web Position Online game No-deposit Added bonus Rules & Free casino Captain Jack bonus code Spins Updated Daily Yes, the fresh professionals is also allege a great R50 sign-upwards incentive along with twenty five 100 percent free revolves using the promo code BETTFISH inside the membership procedure. Its Android os app’s Research casino haz $100 free spins Free mode is even a talked about element to own cellular pages. The freshly entered people need ticket the fresh FICA verification strategy to individual a completely useful membership. People who would like to unlock a free account to your bookmaker can get done the fortunate seafood check in southern area africa utilizing the mobile webpages or even the indigenous Android software. The analysis allow you to build an informed choices about precisely how your accessibility the working platform. Greatest No-Deposit Internet casino Incentives in the us July 2026 No deposit Local casino Bonus Codes & Promotions To own Lucky Red casino 2026 Adept Lucky Gambling establishment 100 percent funky fruits bonus free Revolves: Eligibility & Wagering