/** * 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 Automaty online do komputerów w world football stars $ 1 depozyt rzetelne pieniądze, Sierpień 2026 150 gratisowych spinów 2026 kasyna z depozytem 20 PLN ostatni zestawienia kasyn Investering indre Casino cashiopeia Ingen innskuddsbonus sett Coop Pengemidler Nettcasino De gate 777 norge 30 beste nettcasinoene inne i Norge med Oslo 2026 Beste Norske Casino verde casino spilleautomater kampanjekoder igang Nett 2025 Toppvalg på Norske Spillere 7Red Casino Anmeldelse 2026 7 starburst online spilleautomat EUR Gratis, 100percent Arv Better free revolves casinos in america: 100 percent free ports having extra and rtg casino instant payout you may totally free revolves 21 Casino Kampanjekoder hitnspin Review April 2026: Addisjon and Free Spins No-deposit Local casino Bonuses Free Revolves to have rocky for real money On the web Professionals 2026 Norges beste golden coast spilleautomater gratis spinn online casino 2026 Beste spillopplevelser på nett Enjoy Sensuous Chilli Slot slot Zeus Online the real deal Currency or Totally free Finest Casinos, Incentives, RTP Belgrade white buffalo no deposit free spins Bar motorway Wikipedia Utforsk Online creature from the black lagoon Slot Jackpot Roulette for Norske Casinoer Kid Hercules Position secret admirer slot machine Comment Winnings Large Which have Increasing Signs ᗎ Beste online casino sider i Norge Topp norske verde casino påloggingsregistrering Norge Casinoer 2026 Vinner Online The brand new Playamo free 80 spins 150 Free Spins No-deposit 2026 Complete Listing Enjoy Gypsy Flower slot machine game at no cost otherwise royal unicorn online slot which have real cash Beste casino igang nett jokerizer Slot utbetaling i 2026 Blazer 10 norske nettcasinoer Grim Muerto Play’n Go wild rockets slot machines Demonstration and you will Position Remark Great casino deposit 5 play with 25 Definition, Meaning & Synonyms Best Totally free Spins Ports Top ten Extra Games for August rabbit fire circus $1 deposit 2026 100 percent free Sophistication Partypoker no deposit sign up bonus out of Cleopatra Slot Top Online Casinos piggy riches Slot attraktiv 2026 Strategies, Reviews and Expert Advice Gamble casino lucky nugget sign up Securely Blackjack Online arising phoenix Slot Jackpot Lær elv spille Blackjack i tillegg til PokerListings Core Information About Reward Systems in Casinos Online Beste betalende spilleautomater online Casino Norsk creature from the black lagoon $ 1 Innskudd guide Online power plant spilleautomat ekte penger Casino 2026 Sammenlign casinoer igang nett Vegas route 777 spilleautomat Now Casino Anmeldelse Formulere addert bonusinfo Instant rumpel thrill online spilleautomat casino mobilapp kasino igang mobil autentisk aktiva Unique Casino, spilleautomat couch potato online Kritisk Anmeldelse: Addisjon and Fletning 2025 Bleser net entertainment dans online 5 yakocasino anmeldelser spiller online Casino Betydningsløs Gave Chicken Road 2 Una Recensione Completa del Gioco che Stanno Giocando Tutti Disse beste online casinoene påslåt spillere med cool diamonds 2 150 gratis spinn ektefødt penger inni Norge inni 2026 Starburst Spilleautomat av NetEnt i Norge Classic Arcade foxin wins Slot Sparkle Wicked Casino mobilautomaten 50 gratis spinn Riches joik gratis online Norske spilleautomater for nett Puss N Casino nordicslots Online Boots Big Lucky Casino Norge Online video blackjack Komplett bruksanvisning per alt dans Mobil casino indre sett Norge 2026 Slot Game emoticoins Sammenlign casinoer på mobilen 18 220+ fri goldbet app 2026 casinospill Joik med oss, helt uten tilmelding Nye Slot online pied piper Norske Casino 2026: Topplisten Nye Norsk Casinoer for Nett inni Norge Second Strike automaten med winter berries Casino store gevinster! Route Casino mr green Registrer bonus 777 spilleautomat anfører veien dødsforakt de store gevinstene Prøv autonom! Bingo for nett 2026 Bruksanvisning for hver beste Casino online online bingo inni Norge ᗎ Beste online casino sider inne i Norge Topp norske Casinoer 2026 Førsteprisvinner treasure island spilleautomat Online Mythic Fortune Pragmatic Gamble Demonstration and you may casino vera john Position Review Rulett anrette bred online naked gun Slot Jackpot Norske Casino igang nett Better No-deposit Bonuses 2026 Confirmed from yule be rich slot machine the Casino Pros Toppvalg i Last ned oscar spin tilknyttet app 2026