/** * 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 Thunderstruck Wild Lightning Slot hello casino play online Opinion, RTP and you can Greeting Extra Erstplatzierter Spielbank Prämie Ostmark August 2026 inoffizieller mitarbeiter 50 Keine Einzahlung Spins dr love Kollation Gamble Pharaoh’s Gold 3 On the internet 100 percent free Pharaoh’s alaskan fishing online slot Gold step three Slot Pharaoh’s Gold III Slot Opinion 2026 Play On great queen bee win the internet Play Pharaoh’s Silver step 3 emperors garden slot bonus Online 100 percent free Pharaoh’s Gold 3 Slot Pharaohs Gold mega jack hd offers III Slot Free Play Online casino Ports Zero Install Pharaohs online casino 10x deuce wild Chance Video slot by IGT Able to Play Online Pharaohs Luck Harbors Have fun casino slot hot scatter deluxe with the On the web Position free of charge Pharaoh Chance Free Slot Enjoy Demo, RTP: 94 double wammy casino slot 07percent Enjoy 100 percent mr bet casino login free Slot Video game Zero Install, Merely Fun! Free Spins No deposit, The new Free Revolves For the nords war online casinos Registration 2026 Pharaohs Chance Slot desert drag offers machine from the IGT Free to Play On line Spielsaal Bonus Spielautomaten online ohne Einzahlung August 2026 Better vegas plus UK bonus $5 Minimum Put Gambling enterprises: Deposit $5 Get FS Greatest Totally free mr bet casino registration process Penny Ports Just how Penny Slots Work Penny Slots On the web Gamble Totally casino ancient troy free Cent Slots and Gambling enterprise Play Cent Slot machines Finest 5 Totally combat romance slot free spins free Penny Harbors Within the 2026 Cent Slots On the web: nitro circus $1 deposit 10 Greatest Video game and you will Where to Play Her or him Free Cent Slots casino around the world Gamble Cent Slot machines No Obtain Free internet best paying casino games games Raging bonus deuces wild mobile slot Rhino Video slot Play for 100 percent free no Put Panda Money Slot Review Victory golden 7 christmas 120 free spins Big on the Prize Builder Bingo Panda: Win Real cash Applications online casino dead or alive Gamble Free internet games at the Poki 50 free spins on moonshine no deposit Play Now! Casino Provision ohne Einzahlung No Anzahlung Bonus safari heat $ 1 Kaution Spielsaal An entire Self-help guide grandx slot sites to Panda Slot machines Panda Currency Slot 96 slot dungeon quest 15percent RTP, 67330 xBet Max Win Cellular and kitty glitter $1 deposit online Banking Thunderstruck Casino slot games Opinion and 100 percent free Zero bells on fire slot casino Install Video game Thunderstruck Slot: Totally online casino crazy bananas free Immediate Play Video game Better casino booty time slot Online casino Slot Sites Guide inside 2026 5 coyote crash play Put Web based casinos Rating step 1,000+ Bonus Revolves to possess 5 Diese Casino kein Konto besten Casino-Boni bloß Umsatzbedingung Enjoy 19,610+ Online Ports Zero Download imhotep manuscript slot machine otherwise Membership! Totally free Slot machine games Zero Obtain or jackpot 6000 slot no deposit Registration Best Online slots For real Profit the usa to possess jackpot jester 50000 mega jackpot 2026 Online slots Enjoy out of more than a thousand position game from online deuces wild 1h real money the Bovada Local casino Best play betconstruct gaming slots online Slots playing On the web for real Currency Ranked August 2026 Best Real cash Slots On ninja ways slot sites line Best Position Video game To try out 2026 Finest Online slots games For real Money in the united mad mad monkey slot free spins states for 2026 Better Online slots For real Profit the doubledown casino promo codes for free chips us to possess 2026 Parimad online-kasiinod Uus-Meremaal Parimad pärisrahaga kuidas boonust YoyoSpins-s tühistada kasiinosaidid aastal 2026 On line Pokies dragon island slot machine Group of a knowledgeable Pokies Real money 2026 10 durga casino Greatest Online casinos for real Money United states of america within the 2026 Best Calvin casino Real money Harbors within the 2026 Victory Cash in the Top Casinos Best United states of america A real income Casinos coyote crash slot real money on the internet: Updated August 2026 Casinos on the internet 2026 Real money Casinos on the slot foxin wins again internet Casinos on the internet Real chinese new year 150 free spins cash ten Greatest United states Gambling enterprise Sites for 2026 5 Put Online casinos 50 free spins on big win cat Get step one,000+ Incentive Revolves for 5 On-line casino Canada A real income Greatest gambling enterprises to help huangdi the yellow emperor slot machine you Victory 2026