diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2020-01-06 14:32:30 -0500 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2020-01-06 14:32:30 -0500 |
commit | 10ef81bf85ad0a4bad0d204838e14c99ca2526f7 (patch) | |
tree | b4bb36a326d41de12d1a6181d2a2baf34696ac24 /plugins/jetpack/modules/shortcodes/mixcloud.php | |
parent | Updating script for Update (diff) | |
download | blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.gz blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.tar.bz2 blogs-gentoo-10ef81bf85ad0a4bad0d204838e14c99ca2526f7.zip |
Update jetpack 8.0
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/mixcloud.php')
-rw-r--r-- | plugins/jetpack/modules/shortcodes/mixcloud.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/plugins/jetpack/modules/shortcodes/mixcloud.php b/plugins/jetpack/modules/shortcodes/mixcloud.php index 3580a924..4a016d5f 100644 --- a/plugins/jetpack/modules/shortcodes/mixcloud.php +++ b/plugins/jetpack/modules/shortcodes/mixcloud.php @@ -1,8 +1,8 @@ <?php -/* +/** * Mixcloud embeds * - * examples: + * Examples: * [mixcloud MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ /] * [mixcloud MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ width=640 height=480 /] * [mixcloud http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ /] @@ -10,21 +10,29 @@ * [mixcloud]http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/[/mixcloud] * [mixcloud]MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/[/mixcloud] * [mixcloud http://www.mixcloud.com/mat/playlists/classics/ width=660 height=208 hide_cover=1 hide_tracklist=1] -*/ + * + * @package Jetpack + */ -// Register oEmbed provider -// Example URL: http://www.mixcloud.com/oembed/?url=http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ +/* + * Register oEmbed provider + * Example URL: http://www.mixcloud.com/oembed/?url=http://www.mixcloud.com/MalibuRum/play-6-kissy-sellouts-winter-sun-house-party-mix/ + */ wp_oembed_add_provider( '#https?://(?:www\.)?mixcloud\.com/\S*#i', 'https://www.mixcloud.com/oembed', true ); -// Register mixcloud shortcode -add_shortcode( 'mixcloud', 'mixcloud_shortcode' ); +/** + * Register mixcloud shortcode. + * + * @param array $atts Shortcode atttributes. + * @param string $content Post content. + */ function mixcloud_shortcode( $atts, $content = null ) { if ( empty( $atts[0] ) && empty( $content ) ) { return '<!-- mixcloud error: invalid mixcloud resource -->'; } - $regular_expression = '/((?<=mixcloud\\.com\\/)[\\w-\\/]+$)|(^[\\w-\\/]+$)/i'; + $regular_expression = '/((?<=mixcloud\.com\/)[\w\-\/]+$)|(^[\w\-\/]+$)/i'; preg_match( $regular_expression, $content, $match ); if ( ! empty( $match ) ) { $resource_id = trim( $match[0] ); @@ -57,7 +65,7 @@ function mixcloud_shortcode( $atts, $content = null ) { $atts ); - // remove falsey values + // remove falsey values. $atts = array_filter( $atts ); $query_args = array( 'url' => $mixcloud_url ); @@ -73,3 +81,4 @@ function mixcloud_shortcode( $atts, $content = null ) { return $response_body->html; } +add_shortcode( 'mixcloud', 'mixcloud_shortcode' ); |