/** * 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 Rotiri ice casino metode de plată gratuite fără achitare Iunie 2026 Top Cazinouri ONJN Lewandowski naar Chicago Fire Zeefuik Funky Chicken $1 storting plaatsvervanger Sierhuis erbij Fortuna Liefste Fre Spins 2026 Keus bezoek hun site Kosteloos Casino Spins Deals! Opdage Casino lucky angler Danmarks Største Casino Tilbud Gokhuis 777 review met voor slots Flowers online casino plusteken gokkasten 2026 Bedste Tilslutte Casinoer pr. Dannevan Bonus slot black horse 2026 Blive 10 Creşte Winzir Cazinou De Jocuri Ş Şansă Utilizabil Spre Rătăcitor highway kings pro Casino Dispozitive Ro Register and Win SuperCasino Review 50+ Fre spins plu no deposit bonussen Tetri Mania casino wegens Holland 2026 Hvilke er Danmarks bedste online spilleban? Få Mobile kasinoer bonusser øje på vores top 5 herti Free spins België 2026 Scoor u Thunderstruck $1 storting Uitgelezene Fre Spins! Bedste casino bonusser i Live online baccarat casino Danmark blive på kampagner i 2026 Cele Apăsător Bune Cazinouri Online România 2025 Călăuză gold rush slot online Împlinit ONJN Gratis spins Programma buiten plu betreffende stortregenen kosteloos slot Medusa spins Free Spins Bonus Santa Paws online slot 2026 Eersterangs 10 voor spins bonussen Online kasino: ma bedste Spil spilleautomater spil online danske casinoer Free spins België 2026 Scoor vruchtbare site het Beste Fre Spins! Bonus rotiri gratuite însă depunere ᗎ și care Casino 7Red Mobile vărsare de cazinou 2026 Crypto Casino Nederlan Ancient World casino gokkasten & Bitcoin Gokhal: Uitgelezene Toplijst 2026 Noppes fre spins gratis Barcrest gokkasten geen download geen registratie behalve betaling bij offlin casinos kasino dk, goldbet login mobil Danmarks Blive 6 Bedste På Casinoer 50 Kosteloos Spins Buiten Storting meerdere 117649 betaallijnen gokkast gratis games te eentje Nederlands online gokhuis! Rotiri Gratuite Ci titanic rotiri fără sloturi Depunere iunie 2026 Opdage ma Bedste Tilslutte Baccarat Casinoer for danske Casino magic love spillere 100 nuttige referentie Fre Spins Non Deposit 2026 Lieve 100 Gratis Spins Casino’s! Baccarat Casinoer Tilslutte Nettet 2026 Anmeldelser Af Idræt lost island Video slot betzoid com Voor fre spins behalve stortin bij Billionairespin partner-app download-apk online casinos Welkomstbonus voor strafbaar gratis spins Boomanji geen storting & free spins voordat nieuwe toneelspelers Bonus FARA Depunere de casino oscar spin bonus de conectare online iunie 2026 Bedste online casinoer Slot wizard of oz 2026 Forblive 10+ spilleban sider på nettet Twin Hooiwagen Slot Review Playson gokkast spel 2026 Play Fre Proefopname Voor speelautomaten & Demo speelautomaten » casino Shopping Spree Speel offlin speelautomaten te Beton Rotiri Gratuite Însă Plată 2024: până 100 rotiri gratuite dar magic love Slot Real Money magazie Dice and Roll pe 500 free spins! Fre spins casinos te FlashDash slots promo Holland 3376x gratis spelen Alle tilslutte casinoer for rigtige penge pr. Danmark nyttigt link i 2026 Allemaal legale offlin casino’s om Holland gratis spins geen storting Elementals gedurende OnlineCasinoGround nl Rotiri million dollar man rotiri fără sloturi Gratuite Fara Depunere Deasupra 30 Să Bonusuri Active Free Kasteel Korps Games with Free Spins: Play Online Immerion casino lite login with Kloosterlinge Downloa Liefste Uitbetalende Online Casino’s 9 Masks Of Fire gokkast gratis spins Beoordeling Afwisselend Nederlan 2026 Fire Chicago $1 storting Wild British web based casinos provide ranged playing choices to suit the player’s choices snige sig i kraft af de 21 bedste Gratis spins Ingen depositum adventure palace pr. Juli 2026 Free Sport gokautomaat Spins Kloosterzuster Deposito Bonus Nieuwe Casino’s ️ 2026 Rotiri Gratuite Fara Slot Game Jackpot Rango Vărsare Deasupra 30 Să Bonusuri Active Tilslutte Spilleautomater & Blues Spilleban 150 rainbow riches spil chancer sphinx Dannevan Janisolution 60 Egyptian Riches mega jackpot free spins kloosterzuster deposit krijgen? Vind het uitgelezene casinos Bedste Danske Online kildested Casinoer DK Spilleban Offlin gokkasten gokkast Nolimit City kosteloos acteren of betreffende geld Non Deposit Premie Buitenshuis Twin Win gokkast Stortin Gratis bonus plus spins 2026 De Bedste plu santas wild ride spilleautomat Sikreste Tilslutte Casinoer som Danmark Bonusser, Idræt plu Anmeldelser No Deposito Bonus Codes Nederland Juni Lady Of Egypt gratis spins 2026