Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-includes
/
css
/
File Content:
class-wp-oembed-controller.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; } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
dist
---
0755
418-20260707051743.php
478 bytes
0644
418.php
478 bytes
0644
ChaCha20.php
12934 bytes
0644
Exception.php
1214 bytes
0644
Hooks.php
1510 bytes
0644
SMTP.php
47285 bytes
0644
admin-bar-rtl.min-20260621190127.css
19600 bytes
0644
admin-bar-rtl.min.css
19600 bytes
0644
admin-bar.css
23876 bytes
0644
archives.php
2768 bytes
0644
autoload.php
2731 bytes
0644
block-20260704150646.json
458 bytes
0644
block-serialization-default-parser.min.js
4516 bytes
0644
block.json
458 bytes
0644
buttons-rtl.min.css
5856 bytes
0644
calendar.php
1569 bytes
0644
category-template.php
55563 bytes
0644
class-json.php
43441 bytes
0644
class-wp-customize-nav-menus-20260707074719.php
57019 bytes
0644
class-wp-customize-nav-menus.php
57019 bytes
0644
class-wp-embed.php
15791 bytes
0644
class-wp-http-streams-20260706233436.php
16117 bytes
0644
class-wp-http-streams.php
16117 bytes
0644
class-wp-locale.php
13982 bytes
0644
class-wp-network-20260705112520.php
12379 bytes
0644
class-wp-network-query.php
19169 bytes
0644
class-wp-network.php
12379 bytes
0644
class-wp-oembed-controller-20260621150705.php
6793 bytes
0644
class-wp-oembed-controller.php
6793 bytes
0644
class-wp-site-20260705053036.php
7428 bytes
0644
class-wp-site-query.php
29308 bytes
0644
class-wp-site.php
7428 bytes
0644
class-wp-sitemaps-posts.php
5875 bytes
0644
class-wp-sitemaps-provider-20260705040634.php
4366 bytes
0644
class-wp-sitemaps-provider.php
4366 bytes
0644
class-wp-sitemaps.php
6290 bytes
0644
class-wp-theme-20260622114043.php
51601 bytes
0644
class-wp-theme.php
51601 bytes
0644
class-wp-widget-calendar.php
2871 bytes
0644
class-wp-widget-media-image.php
12037 bytes
0644
class-wp-widget-recent-posts-20260621162217.php
5914 bytes
0644
comment-20260621221544.php
126193 bytes
0644
common-rtl-20260705020209.css
6510 bytes
0644
common-rtl.css
6510 bytes
0644
core-20260705060928.js
48955 bytes
0644
core.js
48955 bytes
0644
customize-base.js
25766 bytes
0644
customize-preview-20260621173414.css
3629 bytes
0644
customize-preview.min-20260622022914.css
2870 bytes
0644
customize-selective-refresh.js
33332 bytes
0644
dashicons.min.css
59016 bytes
0644
data.js
147192 bytes
0644
editor-rtl.min-20260621163121.css
27212 bytes
0644
editor-styles-rtl-20260704171503.css
3470 bytes
0644
editor-styles-rtl.css
3470 bytes
0644
effect-puff.js
943 bytes
0644
effect-transfer.js
836 bytes
0644
footer-embed.php
438 bytes
0644
fsockopen.php
12436 bytes
0644
getid3.php
75114 bytes
0644
https-detection-20260623211809-20260705134447.php
6871 bytes
0644
https-detection-20260623211809-20260706072306.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-20260705051210.php
4730 bytes
0644
https-migration-20260621222700-20260622020253.php
4730 bytes
0644
https-migration-20260621222700-20260623080551.php
4730 bytes
0644
https-migration-20260622015718-20260623112023.php
4730 bytes
0644
https-migration-20260622015741-20260624164442.php
4730 bytes
0644
https-migration-20260622015741.php
4730 bytes
0644
https-migration-20260622015815-20260623130729.php
4730 bytes
0644
https-migration-20260622015815.php
4730 bytes
0644
https-migration-20260622055634.php
4730 bytes
0644
https-migration-20260622145328-20260624065813.php
4730 bytes
0644
https-migration-20260622145328.php
4730 bytes
0644
https-migration-20260622165410-20260624025941.php
4730 bytes
0644
https-migration-20260622194220.php
4730 bytes
0644
https-migration-20260622204948.php
4730 bytes
0644
https-migration-20260622210714.php
4730 bytes
0644
https-migration-20260622211332-20260624144153.php
4730 bytes
0644
https-migration-20260622211332.php
4730 bytes
0644
https-migration.php
4730 bytes
0644
jquery-ui-dialog-20260621190135.css
5928 bytes
0644
jquery-ui-dialog-rtl.css
5967 bytes
0644
jquery-ui-dialog-rtl.min.css
4552 bytes
0644
jquery-ui-dialog.min.css
4548 bytes
0644
json2.js
18422 bytes
0644
latest-comments.php
4999 bytes
0644
locale-20260707074821.php
162 bytes
0644
locale.php
162 bytes
0644
media-views-rtl.css
56076 bytes
0644
media-views-rtl.min.css
45507 bytes
0644
media-views.css
56034 bytes
0644
media-views.min.css
45500 bytes
0644
ms-blogs.php
25174 bytes
0644
ms-site-20260705004413.php
43512 bytes
0644
ms-site.php
43512 bytes
0644
nav-menu-template.php
23296 bytes
0644
php72compat_const-20260705065845.php
4597 bytes
0644
php72compat_const-20260705195122.php
4597 bytes
0644
php72compat_const-20260705201332.php
4597 bytes
0644
php72compat_const-20260706081739.php
4597 bytes
0644
php72compat_const.php
4597 bytes
0644
post-thumbnail-template.php
9353 bytes
0644
progressbar.min.js
2514 bytes
0644
revision-20260705053011.php
22027 bytes
0644
revision.php
22027 bytes
0644
shortcode-20260622122648.php
697 bytes
0644
shortcode.min-20260705111012.js
4096 bytes
0644
shortcode.min.js
4096 bytes
0644
shortcode.php
697 bytes
0644
sitemaps-20260621162408.php
3236 bytes
0644
style-rtl.css
27819 bytes
0644
taxonomy.php
165888 bytes
0644
tiny_mce_popup.js
15988 bytes
0644
tinymce.min.js
365570 bytes
0644
utils.js
4665 bytes
0644
wp-auth-check-20260621163143.css
2508 bytes
0644
wp-auth-check-rtl.css
2545 bytes
0644
wp-auth-check-rtl.min.css
1918 bytes
0644
wp-content.css
8624 bytes
0644
wp-custom-header.js
10447 bytes
0644
wp-embed-template-20260621162209.css
7937 bytes
0644
wp-embed-template-ie.min.css
1473 bytes
0604
wp-embed.min.js
1478 bytes
0644
N4ST4R_ID | Naxtarrr