PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.2
Jetpack – WP Security, Backup, Speed, & Growth v16.2
16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 All 503 releases
← All changes | modules/shortcodes/ted.php +21 -3 12.7.316.2 View file →
@@ -12,8 +12,12 @@
12 12 *
13 13 * @package automattic/jetpack
14 14 */
15 15
16 +if ( ! defined( 'ABSPATH' ) ) {
17 + exit( 0 );
18 +}
19 +
16 20 wp_oembed_add_provider( '!https?://(www\.)?ted.com/talks/view/id/.+!i', 'https://www.ted.com/talks/oembed.json', true );
17 21 wp_oembed_add_provider( '!https?://(www\.)?ted.com/talks/[a-zA-Z\-\_]+\.html!i', 'https://www.ted.com/talks/oembed.json', true );
18 22
19 23 /**
@@ -105,11 +109,25 @@
105 109 *
106 110 * @return string|false
107 111 */
108 112 function ted_filter_oembed_amp_iframe( $cache, $url ) {
109 - if ( is_string( $cache )
110 - && strpos( $url, 'ted.com' )
111 - ) {
113 + if ( ! is_string( $cache ) ) {
114 + return $cache;
115 + }
116 +
117 + $host = wp_parse_url( $url, PHP_URL_HOST );
118 + if ( ! $host ) {
119 + return $cache;
120 + }
121 +
122 + $allowed_hosts = array(
123 + 'ted.com',
124 + 'www.ted.com',
125 + 'embed.ted.com',
126 + );
127 +
128 + $host = strtolower( $host );
129 + if ( in_array( $host, $allowed_hosts, true ) ) {
112 130 $cache = preg_replace(
113 131 '/src=[\'"].*?[\'"]/',
114 132 '$0 sandbox="allow-popups allow-scripts allow-same-origin"',
115 133 $cache