| @@ -8,8 +8,12 @@ | ||
| 8 | 8 | * |
| 9 | 9 | * @package automattic/jetpack |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 13 | + exit( 0 ); | |
| 14 | +} | |
| 15 | + | |
| 12 | 16 | wp_oembed_add_provider( 'https://me.sh/*', 'https://me.sh/oembed?format=json' ); |
| 13 | 17 | wp_oembed_add_provider( '#https?://(www\.)?gfycat\.com/.*#i', 'https://api.gfycat.com/v1/oembed', true ); |
| 14 | 18 | wp_oembed_add_provider( '#https?://[^.]+\.(wistia\.com|wi\.st)/(medias|embed)/.*#', 'https://fast.wistia.com/oembed', true ); |
| 15 | 19 | wp_oembed_add_provider( '#https?://sketchfab\.com/.*#i', 'https://sketchfab.com/oembed', true ); |
| @@ -25,10 +29,13 @@ | ||
| 25 | 29 | * @param string $url The URL to fetch. |
| 26 | 30 | * |
| 27 | 31 | * @return int The timeout value in seconds. |
| 28 | 32 | */ |
| 29 | -function jetpack_oembed_timeout_override( $timeout, $url ) { | |
| 30 | - if ( false !== strpos( $url, 'iwmb.icloud.com' ) ) { | |
| 33 | +function jetpack_oembed_timeout_override( $timeout, $url = '' ) { | |
| 34 | + if ( | |
| 35 | + is_string( $url ) | |
| 36 | + && str_contains( $url, 'iwmb.icloud.com' ) | |
| 37 | + ) { | |
| 31 | 38 | return 10; |
| 32 | 39 | } |
| 33 | 40 | return $timeout; |
| 34 | 41 | } |
| @@ -35,15 +42,6 @@ | ||
| 35 | 42 | |
| 36 | 43 | // TODO: Remove this. This should hopefully be a temporary hack since Apple's oEmbed often seems to take more than 5 seconds to respond. 10 is an arbitrary number of seconds that seems to work better. |
| 37 | 44 | add_filter( 'http_request_timeout', 'jetpack_oembed_timeout_override', 10, 2 ); |
| 38 | 45 | |
| 39 | -/** | |
| 40 | - * Conditionally add PocketCasts as an oEmbed provider in advanced of its inclusion in WP 6.1. | |
| 41 | - * | |
| 42 | - * @todo Remove when WordPress 6.1 is the minimum supported version. | |
| 43 | - */ | |
| 44 | -global $wp_version; | |
| 45 | -if ( version_compare( $wp_version, '6.1-alpha-53744', '<' ) ) { | |
| 46 | - wp_oembed_add_provider( '#https?://pca\.st/.+#i', 'https://pca.st/oembed.json', true ); | |
| 47 | -} | |
| 48 | 46 | // WordPress core only registers pca.st, not pcast.pocketcasts.net. |
| 49 | 47 | wp_oembed_add_provider( '#https?://pcast\.pocketcasts\.net/.+#i', 'https://pcast.pocketcasts.net/oembed.json', true ); |