diff options
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/soundcloud.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/soundcloud.php | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/plugins/jetpack/modules/shortcodes/soundcloud.php b/plugins/jetpack/modules/shortcodes/soundcloud.php index 59479fc7..f8e14fab 100644 --- a/plugins/jetpack/modules/shortcodes/soundcloud.php +++ b/plugins/jetpack/modules/shortcodes/soundcloud.php @@ -17,7 +17,7 @@ * [soundcloud url="https://soundcloud.com/closetorgan/sets/smells-like-lynx-africa-private" color="00cc11"] * <iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/150745932&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"></iframe> * - * @package Jetpack + * @package automattic/jetpack */ /** @@ -47,6 +47,18 @@ function soundcloud_shortcode( $atts, $content = null ) { } } + // If the shortcode is displayed in a WPCOM notification, display a simple link only. + if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) { + require_once WP_CONTENT_DIR . '/lib/display-context.php'; + $context = A8C\Display_Context\get_current_context(); + if ( A8C\Display_Context\NOTIFICATIONS === $context ) { + return sprintf( + '<a href="%1$s" target="_blank" rel="noopener noreferrer">%1$s</a>', + esc_url( $shortcode_options['url'] ) + ); + } + } + // Turn shortcode option "param" (param=value¶m2=value) into array of params. $shortcode_params = array(); if ( isset( $shortcode_options['params'] ) ) { @@ -224,7 +236,7 @@ function jetpack_soundcloud_embed_reversal( $content ) { if ( ! preg_match( '#height="(\d+)"#i', $match[0], $hmatch ) ) { $height = ''; } else { - $height = ' height="' . intval( $hmatch[1] ) . '"'; + $height = ' height="' . (int) $hmatch[1] . '"'; } unset( $args['url'] ); |