/** * Placeholder until the recursive has_shortcode() patch is merged * @see https://core.trac.wordpress.org/ticket/26343#comment:10 */ function gravityview_has_shortcode_r($content, $tag = 'gravityview') { return GVCommon::has_shortcode_r($content, $tag); }
/** * @covers GVCommon::has_shortcode_r */ function test_has_shortcode_r() { add_shortcode('shortcode_one', '__return_empty_string'); add_shortcode('shortcode_two', '__return_empty_string'); $shortcode_exists = array('[gravityview]', '[shortcode_one][shortcode_two][gravityview][/shortcode_two][/shortcode_one]', '[shortcode_one] [shortcode_two] [gravityview /] [/shortcode_two] [/shortcode_one]', '[shortcode_one][gravityview][/shortcode_one]', '[shortcode_one] [shortcode_two] [gravityview /] [/shortcode_two] [/shortcode_one]'); foreach ($shortcode_exists as $item) { $this->assertNotEmpty(GVCommon::has_shortcode_r($item)); } $should_be_false = array('[gravity_view]', 'gravityview', '[gravityview', '[gravity view]'); foreach ($should_be_false as $item) { $this->assertFalse(GVCommon::has_shortcode_r($item)); } }