Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-includes
/
Requests
/
Utility
/
File Content:
class-wp-oembed-controller-20260621150705-20260704183405.php
<?php /** * 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 */ 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() * @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 ) { $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. global $wp_embed; /* @var WP_Embed $wp_embed */ $html = $wp_embed->get_embed_handler_html( $args, $url ); if ( $html ) { global $wp_scripts; // 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; } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
418-20260707101118.php
478 bytes
0644
418.php
478 bytes
0644
ChaCha20.php
12934 bytes
0644
Hooks-20260622053010.php
1510 bytes
0644
Hooks.php
1510 bytes
0644
admin-bar.css
23876 bytes
0644
archives.php
2768 bytes
0644
autoload.php
2731 bytes
0644
block-20260704221420.json
601 bytes
0644
block.json
601 bytes
0644
buttons-rtl.min-20260705061510.css
5856 bytes
0644
buttons-rtl.min.css
5856 bytes
0644
categories.php
2570 bytes
0644
category-template.php
55563 bytes
0644
class-IXR-introspectionserver.php
5323 bytes
0644
class-wp-customize-nav-menus.php
57019 bytes
0644
class-wp-http-streams-20260705030126.php
16117 bytes
0644
class-wp-http-streams.php
16117 bytes
0644
class-wp-network-query.php
19169 bytes
0644
class-wp-network.php
12379 bytes
0644
class-wp-oembed-controller-20260621150705-20260704183405.php
6793 bytes
0644
class-wp-oembed-controller-20260621150705.php
6793 bytes
0644
class-wp-oembed-controller-20260622005059-20260707054941.php
6793 bytes
0644
class-wp-oembed-controller-20260622005059.php
6793 bytes
0644
class-wp-oembed-controller.php
6793 bytes
0644
class-wp-simplepie-sanitize-kses-20260704221911.php
1775 bytes
0644
class-wp-simplepie-sanitize-kses.php
1775 bytes
0644
class-wp-site-20260705034751.php
7428 bytes
0644
class-wp-site-query.php
29308 bytes
0644
class-wp-site.php
7428 bytes
0644
class-wp-sitemaps-posts-20260707010813.php
5875 bytes
0644
class-wp-sitemaps-posts.php
5875 bytes
0644
class-wp-sitemaps-stylesheet.php
8599 bytes
0644
class-wp-theme-20260705030102.php
51601 bytes
0644
class-wp-theme.php
51601 bytes
0644
class-wp-widget-media-image.php
12037 bytes
0644
customize-base.js
25766 bytes
0644
customize-selective-refresh.js
33332 bytes
0644
data.js
147192 bytes
0644
editor-styles-rtl.css
3470 bytes
0644
effect-puff.js
943 bytes
0644
footer-embed.php
438 bytes
0644
fsockopen.php
12436 bytes
0644
https-detection-20260623101720-20260623182156.php
6871 bytes
0644
https-detection-20260623101720.php
6871 bytes
0644
https-detection-20260623211809-20260705135142-20260707123743.php
6871 bytes
0644
https-detection-20260623211809-20260705135142.php
6871 bytes
0644
https-detection-20260623211809-20260706034700.php
6871 bytes
0644
https-detection-20260623211809-20260706090531-20260707214747.php
6871 bytes
0644
https-detection-20260623211809-20260706090531.php
6871 bytes
0644
https-detection-20260623211809.php
6871 bytes
0644
https-detection.php
6871 bytes
0644
https-migration-20260621215951.php
4730 bytes
0644
https-migration-20260621222700-20260622020253-20260705080023.php
4730 bytes
0644
https-migration-20260621222700-20260622020253.php
4730 bytes
0644
https-migration-20260621222700.php
4730 bytes
0644
https-migration-20260622015718.php
4730 bytes
0644
https-migration-20260622015741-20260706200457.php
4730 bytes
0644
https-migration-20260622015741.php
4730 bytes
0644
https-migration-20260622015815-20260706180602.php
4730 bytes
0644
https-migration-20260622015815.php
4730 bytes
0644
https-migration-20260622055634.php
4730 bytes
0644
https-migration-20260622071438.php
4730 bytes
0644
https-migration-20260622145328.php
4730 bytes
0644
https-migration-20260622194220.php
4730 bytes
0644
https-migration-20260622211332-20260623120608.php
4730 bytes
0644
https-migration-20260622211332.php
4730 bytes
0644
https-migration-20260623022315.php
4730 bytes
0644
https-migration.php
4730 bytes
0644
index.php
1531 bytes
0644
jquery-ui-dialog-rtl.css
5967 bytes
0644
jquery.form-20260703233250.js
41023 bytes
0644
jquery.form.js
41023 bytes
0644
jquery.serialize-object-20260707120002.js
769 bytes
0644
jquery.serialize-object.js
769 bytes
0644
json2-20260704221611.js
18422 bytes
0644
json2.js
18422 bytes
0644
latest-comments.php
4999 bytes
0644
locale.php
162 bytes
0644
media-views.css
56034 bytes
0644
module.audio-video.matroska.php
107155 bytes
0644
ms-blogs.php
25174 bytes
0644
nav-menu-template.php
23296 bytes
0644
php72compat_const-20260706064610.php
4597 bytes
0644
php72compat_const.php
4597 bytes
0644
plural-forms.php
7612 bytes
0644
revision.php
22027 bytes
0644
shortcode.php
697 bytes
0644
style-rtl-20260703121405.css
68520 bytes
0644
style-rtl.css
68520 bytes
0644
taxonomy.php
165888 bytes
0644
tinymce.min.js
365570 bytes
0644
tooltip.min.js
6091 bytes
0644
wp-content.css
8624 bytes
0644
wp-custom-header.js
10447 bytes
0644
N4ST4R_ID | Naxtarrr