FIX: Leaflet scripts and styles were not enqued for shortcodes event_full and event_venue

This commit is contained in:
savvasha
2019-09-11 14:12:22 +03:00
parent aad3f1c428
commit 9ace2fba2e
2 changed files with 31 additions and 1 deletions

View File

@@ -1684,3 +1684,32 @@ if( ! function_exists( 'array_replace' ) ) {
return $res;
}
}
/**
* Check if a shortcode is shown on content
* @return bool
*/
function sp_has_shortcodes( $content, $tags ) {
if( is_array( $tags ) ) {
foreach ( $tags as $tag ) {
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
if ( empty( $matches ) )
return false;
foreach ( $matches as $shortcode ) {
if ( $tag === $shortcode[2] )
return true;
}
}
} else {
if ( shortcode_exists( $tags ) ) {
preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
if ( empty( $matches ) )
return false;
foreach ( $matches as $shortcode ) {
if ( $tags === $shortcode[2] )
return true;
}
}
}
return false;
}