public function test_embed_reversal() { $string = '<iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/219074591&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe> bananas after'; $reversal_test = Shortcake_Bakery::get_instance()->reverse_embed($string); $this->assertTrue($reversal_test['success']); $expected_shortcode = array('shortcode' => 'soundcloud', 'attributes' => array('url' => 'https://api.soundcloud.com/tracks/219074591', 'type' => 'visual', 'autoplay' => 0), 'inner_content' => null, 'raw' => '[soundcloud url="https://api.soundcloud.com/tracks/219074591" type="visual" autoplay="0"]'); $this->assertEquals($expected_shortcode, $reversal_test['shortcodes'][0]); }
/** * Set up shortcode actions */ private function setup_actions() { add_action('init', array($this, 'action_init_register_shortcodes')); add_action('shortcode_ui_after_do_shortcode', function ($shortcode) { return Shortcake_Bakery::get_shortcake_admin_dependencies(); }); add_action('admin_enqueue_scripts', array($this, 'action_admin_enqueue_scripts')); add_action('media_buttons', array($this, 'action_media_buttons')); add_action('wp_ajax_shortcake_bakery_embed_reverse', array($this, 'action_ajax_shortcake_bakery_embed_reverse')); }
function Shortcake_Bakery() { return Shortcake_Bakery::get_instance(); }