Make WordPress Core


Ignore:
Timestamp:
10/29/2015 11:10:46 PM (10 years ago)
Author:
pento
Message:

Embeds: Provide a cached text fallback.

Sometimes, embedded sites might suffer from less than 100% uptime. Instead of leaving the embedding site with a big blank space where the embed should be, let's fall back to a link to the embedded post, so there's at least some context for the post.

Fixes #34462.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/oembed/filterResult.php

    r34903 r35437  
    7979        $this->assertFalse( wp_filter_oembed_result( '', (object) array( 'type' => 'rich' ), '' ) );
    8080    }
     81
     82    function test_filter_oembed_result_blockquote_adds_style_to_iframe() {
     83        $html   = '<blockquote></blockquote><iframe></iframe>';
     84        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     85
     86        $this->assertEquals( '<blockquote></blockquote><iframe sandbox="allow-scripts" security="restricted" style="display:none;"></iframe>', $actual );
     87    }
     88
     89    function test_filter_oembed_result_allowed_html() {
     90        $html   = '<blockquote><strong><a href="" target=""></a></strong></blockquote><iframe></iframe>';
     91        $actual = wp_filter_oembed_result( $html, (object) array( 'type' => 'rich' ), '' );
     92
     93        $this->assertEquals( '<blockquote><a href=""></a></blockquote><iframe sandbox="allow-scripts" security="restricted" style="display:none;"></iframe>', $actual );
     94    }
    8195}
Note: See TracChangeset for help on using the changeset viewer.