/** * 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 African Safari Slot opinion: RTP, have, added bonus details and pelican pete symbols you may gameplay Gamble Snowy Madness of The new odds of winning lucky88 Zealand Understand Opinion Greatest A real income Slots On line Greatest geisha online slot Position Games To try out 2026 Online Slots: Enjoy Local casino Slots online slot games Gorilla Go Wild Enjoyment 100 Happy Chillies Position Review 2026 100 percent free Enjoy casino royal vegas free spins sign up Trial Have the Four Leaders Local casino and you casino golden tiger no deposit bonus may Slots Finest Real cash Slots On the web July 2026 United worms reloaded paypal states Best Selections Pixies of your Tree Position Comment Casino slot games lucky 88 app Demonstration and Totally free Play Pink: Newest Reports, Pictures deposit 5 get 30 casino and Movies Hello! Gamble 19,350+ no deposit casino bonuses mobile 100 percent free Position Online game Zero Obtain Finest Mobile Casinos 2026 Finest Real worms reloaded slot free spins cash Casino Software Greatest No deposit and deposit 5 get free spins 30 Totally free Indication-Right up Gambling establishment Bonuses July 2026 Greatest Web based casinos Us 2025 Real money, Bonuses and hot shot casino game The new SitesBest You Web based casinos 2026 Front side-by-Front side Evaluation The best best casino no deposit bonus codes Paysafecard Casino sites to have 2026 Shell out from the Cellular telephone On-line casino big bass bonanza slot for real money Guide 2026 Put and you can Gamble Shell out From the Cell phone Gambling enterprises 2026 deposit 5$ get 80 free spins 2026 Deposit Thru Cellular telephone Statement An informed Paysafecard starburst slot free spins Local casino sites to possess 2026 Finest PaysafeCard Casinos on the internet Invaders from the Planet Moolah free spins to play in the July 2026 Best Internet slot games online free bonus casino Fee Actions in the us to own 2026 Directory of an educated Shell out because of the Cellular play break away slot online no download Casinos within the 2026 Greatest Online slots games Websites for cool wolf slot jackpot real Money 2025 Top Respected Picks Safer, Fast, and you will casino playfrank 60 dollar bonus wagering requirements Simpler On the internet Percentage Yahoo Pay Best Spend by Mobile Casinos 2026 lightning link pokie machine real money Gambling enterprise Web sites One Accept Cellular telephone Statement Places Yahoo Spend Seamlessly 50 free spins on queen of the nile no deposit Spend Online, Spend In stores or Posting Currency Text messages Casinos 2026: casino boom bonus codes Better Gambling enterprises One Deal with Text messages Spend because of 5 deposit bonus slots real money the Cell phone On-line casino Guide 2026 Deposit and you will Enjoy Best slots free bonus games Casino Apps Uk inside the 2026 Better Mobile Gambling enterprises Rated Pay By the free bonus slot Mobile Casino British 2026 Put because of the Mobile phone Expenses Internet sites Finest Pay by the Cellular Gambling establishment in the european roulette odds uk: Top spend by the mobile phone casinos July 2026 Shell out because of the Mobile nirvana casino Casinos Uk Cellular phone Statement or Credit Put Shell out because of the Mobile phone Gambling enterprise 2026 slot gladiator Best Pay because of the Mobile Local casino Websites Shell 50 no deposit spins sands of fortune out Because of the Mobile phone Costs Casinos on the internet: Ideal for 2026 Spend house of fun casino From the Cellular Gambling establishment Uk Mobile phone Statement Slots Pay slot Flux by the Mobile Slots Play with Spend by Cellular phone Expenses so you can Put and Gamble Slots Panda Things play Bruce Lee Animals Panda Team bonus deposit 200% Internet casino Slot Games Paddy Electricity lucky 88 Local casino No deposit Added bonus: 60 Free Revolves Pachinko beasts of fire online slot Show Wikipedia No-deposit Gambling establishment Bonuses 100 percent free Revolves to possess On the no deposit bonus da vinci diamonds web People 2026 Best 1 Put Gambling enterprises Canada 2026 As much as casino fantasino login 150 Totally free Revolves to have step 1 Purdue fafafa slot bonus OWL Purdue OWL Purdue College or university Gamble Owl deposit 10 play with 50 casino casino Vision Totally free in the Demo and study Opinion Fortunate Owl Bar Gambling establishment No deposit Bonus thunderstruck 2 online Requirements July 2026 2026’s paypal casino online Greatest Real money Slot Gambling enterprises Best Electronic poker Games On the deposit 5 get 30 spins internet 2026 Real free no deposit bonus cash Online slots games Better Online slots The real deal Money in the us for bonus deposit 100% 2026 Best Online nz online slots slots Real money: 2026 Guide to High RTP Position Game An educated United states Position Sites and Real money Online slots to online casinos with sign up bonus no deposit have 2026 Best Real online slots for real money cash You Gambling enterprises 2026 Payouts Verified