summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/soundcloud.php')
-rw-r--r--plugins/jetpack/modules/shortcodes/soundcloud.php16
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&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;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&param2=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'] );