Changeset 42343 for trunk/src/wp-includes/class-wp-oembed-controller.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-oembed-controller.php
r41162 r42343 32 32 $maxwidth = apply_filters( 'oembed_default_width', 600 ); 33 33 34 register_rest_route( 'oembed/1.0', '/embed', array( 35 array( 36 'methods' => WP_REST_Server::READABLE, 37 'callback' => array( $this, 'get_item' ), 38 'args' => array( 39 'url' => array( 40 'required' => true, 41 'sanitize_callback' => 'esc_url_raw', 42 ), 43 'format' => array( 44 'default' => 'json', 45 'sanitize_callback' => 'wp_oembed_ensure_format', 46 ), 47 'maxwidth' => array( 48 'default' => $maxwidth, 49 'sanitize_callback' => 'absint', 34 register_rest_route( 35 'oembed/1.0', '/embed', array( 36 array( 37 'methods' => WP_REST_Server::READABLE, 38 'callback' => array( $this, 'get_item' ), 39 'args' => array( 40 'url' => array( 41 'required' => true, 42 'sanitize_callback' => 'esc_url_raw', 43 ), 44 'format' => array( 45 'default' => 'json', 46 'sanitize_callback' => 'wp_oembed_ensure_format', 47 ), 48 'maxwidth' => array( 49 'default' => $maxwidth, 50 'sanitize_callback' => 'absint', 51 ), 50 52 ), 51 53 ), 52 ), 53 ) ); 54 55 register_rest_route( 'oembed/1.0', '/proxy', array( 56 array( 57 'methods' => WP_REST_Server::READABLE, 58 'callback' => array( $this, 'get_proxy_item' ), 59 'permission_callback' => array( $this, 'get_proxy_item_permissions_check' ), 60 'args' => array( 61 'url' => array( 62 'description' => __( 'The URL of the resource for which to fetch oEmbed data.' ), 63 'type' => 'string', 64 'required' => true, 65 'sanitize_callback' => 'esc_url_raw', 66 ), 67 'format' => array( 68 'description' => __( 'The oEmbed format to use.' ), 69 'type' => 'string', 70 'default' => 'json', 71 'enum' => array( 72 'json', 73 'xml', 74 ), 75 ), 76 'maxwidth' => array( 77 'description' => __( 'The maximum width of the embed frame in pixels.' ), 78 'type' => 'integer', 79 'default' => $maxwidth, 80 'sanitize_callback' => 'absint', 81 ), 82 'maxheight' => array( 83 'description' => __( 'The maximum height of the embed frame in pixels.' ), 84 'type' => 'integer', 85 'sanitize_callback' => 'absint', 86 ), 87 'discover' => array( 88 'description' => __( 'Whether to perform an oEmbed discovery request for non-whitelisted providers.' ), 89 'type' => 'boolean', 90 'default' => true, 54 ) 55 ); 56 57 register_rest_route( 58 'oembed/1.0', '/proxy', array( 59 array( 60 'methods' => WP_REST_Server::READABLE, 61 'callback' => array( $this, 'get_proxy_item' ), 62 'permission_callback' => array( $this, 'get_proxy_item_permissions_check' ), 63 'args' => array( 64 'url' => array( 65 'description' => __( 'The URL of the resource for which to fetch oEmbed data.' ), 66 'type' => 'string', 67 'required' => true, 68 'sanitize_callback' => 'esc_url_raw', 69 ), 70 'format' => array( 71 'description' => __( 'The oEmbed format to use.' ), 72 'type' => 'string', 73 'default' => 'json', 74 'enum' => array( 75 'json', 76 'xml', 77 ), 78 ), 79 'maxwidth' => array( 80 'description' => __( 'The maximum width of the embed frame in pixels.' ), 81 'type' => 'integer', 82 'default' => $maxwidth, 83 'sanitize_callback' => 'absint', 84 ), 85 'maxheight' => array( 86 'description' => __( 'The maximum height of the embed frame in pixels.' ), 87 'type' => 'integer', 88 'sanitize_callback' => 'absint', 89 ), 90 'discover' => array( 91 'description' => __( 'Whether to perform an oEmbed discovery request for non-whitelisted providers.' ), 92 'type' => 'boolean', 93 'default' => true, 94 ), 91 95 ), 92 96 ), 93 ) ,94 ) );97 ) 98 ); 95 99 } 96 100 … … 158 162 unset( $args['_wpnonce'] ); 159 163 $cache_key = 'oembed_' . md5( serialize( $args ) ); 160 $data = get_transient( $cache_key );164 $data = get_transient( $cache_key ); 161 165 if ( ! empty( $data ) ) { 162 166 return $data;
Note: See TracChangeset
for help on using the changeset viewer.