Skip to content

Commit 069451a

Browse files
committed
remove oembed discovery option
1 parent 0f4e6ee commit 069451a

File tree

1 file changed

+4
-25
lines changed

1 file changed

+4
-25
lines changed

iframely/iframely.php

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function is_iframely_amp ( $args ) {
9999
add_filter( 'oembed_fetch_url', 'maybe_add_iframe_amp', 10, 3 );
100100
function maybe_add_iframe_amp( $provider, $args, $url ) {
101101

102-
if (is_iframely_amp( $args ) && strpos($provider, '//iframe.ly') !== false) {
102+
if (is_iframely_amp( $args ) && strpos($provider, 'iframe.ly') !== false) {
103103
$provider = add_query_arg( 'amp', '1', $provider );
104104
}
105105
return $provider;
@@ -108,7 +108,7 @@ function maybe_add_iframe_amp( $provider, $args, $url ) {
108108
add_filter( 'embed_oembed_html', 'iframely_filter_oembed_result', 10, 3 );
109109
function iframely_filter_oembed_result( $html, $url, $args ) {
110110

111-
if (strpos($html, '<amp-iframe') !== false) {
111+
if (strpos($html, '<amp-iframe') !== false) { // covers "amp-iframely"
112112
// Avoid corrupted amp-iframe overflow div as a result of wpautop
113113
remove_filter( 'the_content', 'wpautop' );
114114
// Restore wpautop if it was disabled
@@ -182,7 +182,7 @@ function iframely_bust_gutenberg_cache( $args) {
182182

183183
function maybe_add_gutenberg_1( $provider, $args, $url ) {
184184

185-
if (strpos($provider, '//iframe.ly') !== false && strpos($provider, 'iframe=card') === false) {
185+
if (strpos($provider, 'iframe.ly') !== false && strpos($provider, 'iframe=card') === false) {
186186
$provider = add_query_arg( 'iframe', '1', $provider );
187187
}
188188
return $provider;
@@ -253,27 +253,6 @@ function maybe_disable_cache($ttl, $url, $attr, $post_ID) {
253253
# Register [iframely] shortcode
254254
add_shortcode( 'iframely', 'embed_iframely' );
255255

256-
# rewrite oembed discovery
257-
add_filter( 'oembed_endpoint_url', 'publish_embeds_via_iframely', 10, 2) ;
258-
function publish_embeds_via_iframely($url, $permalink, $format = 'json') {
259-
260-
if ('' !== $permalink && get_site_option( 'publish_iframely_cards')) {
261-
262-
$endpoint = iframely_create_api_link ('discovery');
263-
264-
$endpoint = add_query_arg( array(
265-
'url' => urlencode( $permalink ),
266-
'format' => strpos($url, 'format=xml') ? 'xml': 'json'
267-
// $format isn't passed inside the filter for some reason, hence the workaround
268-
), $endpoint );
269-
270-
return $endpoint;
271-
272-
} else {
273-
return $url;
274-
}
275-
276-
}
277256

278257
# Function to process content in iframely shortcode, ex: [iframely]http://anything[/iframely]
279258
function embed_iframely( $atts, $content = '' ) {
@@ -437,7 +416,7 @@ function iframely_settings_page() {
437416

438417
<li>
439418
<p><input type="checkbox" name="publish_iframely_cards" value="1" <?php if (get_site_option('publish_iframely_cards')) { ?> checked="checked" <?php } ?> /> Use Iframely <a href="https://iframely.com/docs/cards" target="_blanak">summary cards</a> as embeds for your site</p>
440-
<p>Since WP 4.4 your site <a href="https://make.wordpress.org/core/2015/10/28/new-embeds-feature-in-wordpress-4-4/" target="_blank">publishes embeds</a> by default so that <strong>your own</strong> and other WP sites can embed summaries of your posts.
419+
<p>Since WP 4.4 your site <a href="https://make.wordpress.org/core/2015/10/28/new-embeds-feature-in-wordpress-4-4/" target="_blank">publishes embeds</a> by default so that <strong>your own</strong> WP site can embed summaries of your posts.
441420
<br>Use this option to override the default widgets and use nice Iframely cards instead.
442421
<br>Customize design of your cards <a href="https://iframely.com/customize" target="_blank">here</a>.
443422
Preview your Iframely cards <a href="https://iframely.com/embed" target="_blank">here</a>.

0 commit comments

Comments
 (0)