Skip to content

Commit 2375d66

Browse files
committed
Remove parsing functions and update docs.
Able Player already supports URLs in these parameters.
1 parent a7cd640 commit 2375d66

File tree

2 files changed

+6
-31
lines changed

2 files changed

+6
-31
lines changed

src/ableplayer.php

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,10 @@ function ableplayer_shortcode( $atts, $content = null ) {
408408
$o .= ' data-skin="' . $all_atts['skin'] . '"';
409409
}
410410
if ( ! empty( $all_atts['youtube-id'] ) ) {
411-
$youtube_url = ableplayer_parse_youtube( $all_atts['youtube-id'] );
412-
$o .= ' data-youtube-id="' . $all_atts['youtube-id'] . '"';
411+
$o .= ' data-youtube-id="' . $all_atts['youtube-id'] . '"';
413412
}
414413
if ( ! empty( $all_atts['youtube-desc-id'] ) ) {
415-
$youtube_desc_url = ableplayer_parse_youtube( $all_atts['youtube-id'] );
416-
$o .= ' data-youtube-desc-id="' . $all_atts['youtube-desc-id'] . '"';
414+
$o .= ' data-youtube-desc-id="' . $all_atts['youtube-desc-id'] . '"';
417415
}
418416
if ( ! empty( $all_atts['youtube-nocookie'] ) ) {
419417
$o .= ' data-youtube-nocookie="' . $all_atts['youtube-nocookie'] . '"';
@@ -440,28 +438,6 @@ function ableplayer_shortcode( $atts, $content = null ) {
440438
}
441439
add_shortcode( 'ableplayer', 'ableplayer_shortcode' );
442440

443-
/**
444-
* Parse the value of a YouTube shortcode attribute to extract YouTube ID if necessary.
445-
*
446-
* @param string $attr Value of the attribute.
447-
*
448-
* @param string YouTube video ID.
449-
*/
450-
function ableplayer_parse_youtube( $attr ) {
451-
$query = parse_url( $attr );
452-
if ( ! isset( $query['query'] ) ) {
453-
$replace = array( 'http://youtu.be/', 'https://youtu.be/' );
454-
455-
return str_replace( $replace, '', $attr );
456-
} else {
457-
parse_str( $query['query'], $results );
458-
459-
return $results['v'];
460-
}
461-
462-
return $attr;
463-
}
464-
465441
/**
466442
* Get unique ID for a specific Ableplayer instance.
467443
*

src/readme.txt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ The [ableplayer] shortcode supports the following attributes.
4141

4242
= Required attributes (one of these) =
4343

44-
* **youtube-id** - 11-character YouTube ID
45-
* **vimeo-id** - Vimeo ID
44+
* **youtube-id** - 11-character YouTube ID or YouTube URL.
45+
* **vimeo-id** - Vimeo ID or URL.
4646

4747
= Optional attributes =
4848

49-
* **youtube-desc-id** - YouTube ID of a described version of the video
50-
* **vimeo-desc-id** - Vimeo ID of a described version of the video
49+
* **youtube-desc-id** - YouTube URL or ID of a described version of the video
50+
* **vimeo-desc-id** - Vimeo URL or ID of a described version of the video
5151
* **youtube-nocookie** => "true" or "false" (use "true" to embed YouTube untracked, for added privacy)
5252
* **id** - a unique id for the player (if omitted, one will be automatically assigned)
5353
* **autoplay** - "true" or "false" (default is "false")
@@ -110,7 +110,6 @@ This example uses a shortcode to add a Vimeo player to the page, with two versio
110110
= 1.2.0 =
111111

112112
* Update Able Player to 4.5.0, while retaining 4.4.1 scripts.
113-
* Add support to pass YouTube URLs into shortcode as well as YouTube IDs.
114113
* Make scripts sensitive to SCRIPT_DEBUG or `wp_get_environment_type()` for easier debugging.
115114
* Add unminified versions of CSS.
116115
* Add filters to customize JS and CSS urls.

0 commit comments

Comments
 (0)