Skip to content

Commit

Permalink
Issue #841: Improve the PLAYLIST_REGEX.
Browse files Browse the repository at this point in the history
Props @westonruter for the new regex.
Also, remove periods from '@return void.'
  • Loading branch information
Ryan Kienstra committed Feb 15, 2018
1 parent aba8cf1 commit f13d2ad
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions includes/embeds/class-amp-playlist-embed-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AMP_Playlist_Embed_Handler extends AMP_Base_Embed_Handler {
*
* @var string.
*/
const PLAYLIST_REGEX = '/(?s)\<script [^>]* class="wp-playlist-script"\>[^<]*?(.*).*?\<\/script\>/';
const PLAYLIST_REGEX = ':<script type="application/json" class="wp-playlist-script">(.+?)</script>:s';

/**
* The ID of individual playlist.
Expand All @@ -71,7 +71,7 @@ public function register_embed() {
/**
* Unregisters the playlist shortcode.
*
* @return void.
* @return void
*/
public function unregister_embed() {
remove_shortcode( self::SHORTCODE );
Expand All @@ -80,7 +80,7 @@ public function unregister_embed() {
/**
* Enqueues the playlist styling.
*
* @return void.
* @return void
*/
public function styling() {
global $post;
Expand Down Expand Up @@ -241,7 +241,7 @@ public function get_thumb_dimensions( $track ) {
*
* @param string $type The type of tracks: 'audio' or 'video'.
* @param string $container_id The ID of the container.
* @return void.
* @return void
*/
public function tracks( $type, $container_id ) {
?>
Expand Down

0 comments on commit f13d2ad

Please sign in to comment.