YouTube Embed - Version 5.0

Version Description

  • Enhancement: The API is back ! The plugin can now fetch video information to add to the metadata
  • Enhancement: Caching is back ! Now that I'm happy with the speed of the main code, I'm now happy to cache it
  • Enhancement: Added housekeeping for the caching, because WordPress is rubbish at doing it itself
  • Enhancement: A new shortcode has been added to allow you to easily output video information to your post or page using a simple templating system
  • Enhancement: Added the new API data to the metadata but also added more elements
  • Enhancement: Improved the video ID validation if the API is not used
  • Enhancement: WordPress has a nasty habit of modifying the video IDs that are passed to the plugin. Most of these we're already able to undo, but it's now been enhanced further to work even better
  • Enhancement: The thumbnails shortcode now uses the API and, as a result, is slimmer and works with playlists too!
  • Enhancement: Made some minor changes towards better accessibility. It's been pretty shoddy up until now but the next release should complete this work
  • Maintenance: Data is passed around between functions via arrays rather than LOTS of variables, which is a much better of doing it
  • Maintenance: Removed the old video validation process as this is now handled by the API function
  • Maintenance: Widget changes to support the customizer in WP 4.5
  • Maintenance: Changed the branding back. Because it's me you want - I understand that now
  • Maintenance: Tested for WP 4.6 and PHP 7 compatibility because, you know, it's the future
  • Maintenance: Re-wrote this bad boy README
  • Bug: Fixed metadata output issues with playlists
  • Bug: Fixed bug where lists would not display if the new performance option was switched on
  • Bug: Fixed issue with the uninstaller
Download this release

Release Info

Developer dartiss
Plugin Icon 128x128 YouTube Embed
Version 5.0
Comparing to
See all releases

Code changes from version 4.3.5 to 5.0

Files changed (51) hide show
  1. FitVids Licence.txt +21 -0
  2. css/._admin.css +0 -0
  3. css/._admin.min.css +0 -0
  4. css/._main.css +0 -0
  5. css/._main.min.css +0 -0
  6. images/._cross.png +0 -0
  7. images/._flash.png +0 -0
  8. images/._html5.png +0 -0
  9. images/._tick.png +0 -0
  10. images/cross.png +0 -0
  11. images/flash.png +0 -0
  12. images/html5.png +0 -0
  13. images/tick.png +0 -0
  14. includes/._add-scripts.php +0 -0
  15. includes/._admin-config.php +0 -0
  16. includes/._api-access.php +0 -0
  17. includes/._caching.php +0 -0
  18. includes/._generate-embed-code.php +0 -0
  19. includes/._generate-other-code.php +0 -0
  20. includes/._generate-widgets.php +0 -0
  21. includes/._options-general.php +0 -0
  22. includes/._options-lists.php +0 -0
  23. includes/._options-plugins.php +0 -0
  24. includes/._options-profiles.php +0 -0
  25. includes/._shared-functions.php +0 -0
  26. includes/._shortcodes.php +0 -0
  27. includes/admin-config.php +3 -3
  28. includes/api-access.php +172 -0
  29. includes/caching.php +105 -0
  30. includes/generate-embed-code.php +72 -49
  31. includes/generate-other-code.php +76 -57
  32. includes/generate-widgets.php +15 -29
  33. includes/options-general.php +64 -17
  34. includes/options-lists.php +26 -17
  35. includes/options-profiles.php +10 -10
  36. includes/shared-functions.php +8 -33
  37. includes/shortcodes.php +75 -15
  38. js/._iframeResizer.js +0 -0
  39. js/._iframeResizer.min.js +0 -0
  40. js/._jquery.fitvids.js +0 -0
  41. js/._mce4-button.js +0 -0
  42. js/._mce4-button.min.js +0 -0
  43. js/mce4-button.js +0 -0
  44. js/mce4-button.min.js +0 -0
  45. languages/._youtube-embed.mo +0 -0
  46. languages/._youtube-embed.po +0 -0
  47. languages/youtube-embed.mo +0 -0
  48. languages/youtube-embed.po +32 -36
  49. readme.txt +111 -487
  50. uninstall.php +12 -6
  51. youtube-embed.php +7 -3
FitVids Licence.txt ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2013-2015 David J. Bradshaw
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
css/._admin.css ADDED
Binary file
css/._admin.min.css ADDED
Binary file
css/._main.css ADDED
Binary file
css/._main.min.css ADDED
Binary file
images/._cross.png ADDED
Binary file
images/._flash.png ADDED
Binary file
images/._html5.png ADDED
Binary file
images/._tick.png ADDED
Binary file
images/cross.png CHANGED
File without changes
images/flash.png CHANGED
File without changes
images/html5.png CHANGED
File without changes
images/tick.png CHANGED
File without changes
includes/._add-scripts.php ADDED
Binary file
includes/._admin-config.php ADDED
Binary file
includes/._api-access.php ADDED
Binary file
includes/._caching.php ADDED
Binary file
includes/._generate-embed-code.php ADDED
Binary file
includes/._generate-other-code.php ADDED
Binary file
includes/._generate-widgets.php ADDED
Binary file
includes/._options-general.php ADDED
Binary file
includes/._options-lists.php ADDED
Binary file
includes/._options-plugins.php ADDED
Binary file
includes/._options-profiles.php ADDED
Binary file
includes/._shared-functions.php ADDED
Binary file
includes/._shortcodes.php ADDED
Binary file
includes/admin-config.php CHANGED
@@ -52,7 +52,7 @@ function ye_set_plugin_meta( $links, $file ) {
52
  if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
53
 
54
  $links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/youtube-embed">' . __( 'Support', 'youtube-embed' ) . '</a>' ) );
55
- $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate', 'youtube-embed' ) . '</a>' ) );
56
 
57
  }
58
 
@@ -303,8 +303,8 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
303
 
304
  $text .= '<p>' . __( 'This screen allows you to set the options for the default and additional profiles. If you don\'t specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required.', 'youtube-embed' ) . '</p>';
305
  $text .= '<p>' . __( 'All settings will work whether the Flash or HTML5 player is used, unless one of the following icons is shown, indicating which format the option works with...', 'youtube-embed' ) . '</p>';
306
- $text .= "<p><img src='" . plugins_url( 'images/flash.png', dirname(__FILE__) ) . "' width='10px'/> - " . __( 'Flash player', 'youtube-embed' ) . '</br>';
307
- $text .= "<img src='" . plugins_url( 'images/html5.png', dirname(__FILE__) ) . "' width='10px'/> - " . __( 'HTML5 player', 'youtube-embed' ) . '</br>';
308
  }
309
 
310
  if ( $screen == 'lists' && $tab == 'help' ) {
52
  if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
53
 
54
  $links = array_merge( $links, array( '<a href="https://wordpress.org/support/plugin/youtube-embed">' . __( 'Support', 'youtube-embed' ) . '</a>' ) );
55
+ $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate', 'youtube-embed' ) . '</a>' ) );
56
 
57
  }
58
 
303
 
304
  $text .= '<p>' . __( 'This screen allows you to set the options for the default and additional profiles. If you don\'t specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required.', 'youtube-embed' ) . '</p>';
305
  $text .= '<p>' . __( 'All settings will work whether the Flash or HTML5 player is used, unless one of the following icons is shown, indicating which format the option works with...', 'youtube-embed' ) . '</p>';
306
+ $text .= "<p><img src='" . plugins_url( 'images/flash.png', dirname(__FILE__) ) . "' alt='" . __( 'Flash player', 'youtube-embed' ) . "' width='10px'/> - " . __( 'Flash player', 'youtube-embed' ) . '</br>';
307
+ $text .= "<img src='" . plugins_url( 'images/html5.png', dirname(__FILE__) ) . "' alt='" . __( 'HTML5 player', 'youtube-embed' ) . "' width='10px'/> - " . __( 'HTML5 player', 'youtube-embed' ) . '</br>';
308
  }
309
 
310
  if ( $screen == 'lists' && $tab == 'help' ) {
includes/api-access.php ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * API Access
4
+ *
5
+ * Function to access YouTube API for video data
6
+ *
7
+ * @package YouTube-Embed
8
+ *
9
+ * @since 5.0
10
+ *
11
+ * @param string $video_id The ID of the video
12
+ * @param string $api_key Allows an alternative API key to be specified
13
+ * @param string $no_cache Suppresses caching
14
+ * @param string $cache_time If the calling function already has the cache time, send it along, otherwise it is fetched
15
+ * @param string $playlist If a playlist, this is the name
16
+ * @return array Array of video information
17
+ */
18
+
19
+ function ye_get_api_data( $video_id, $api_key = '', $no_cache = false, $cache_time = '', $playlist = '' ) {
20
+
21
+ // Check for cached data. If exists, return that
22
+
23
+ if ( $playlist == '' ) {
24
+ $key = 'api_' . $video_id;
25
+ } else {
26
+ $key = 'api_' . $playlist;
27
+ }
28
+
29
+ $cache = ye_get_transient( $key );
30
+
31
+ if ( $cache !== false ) { return $cache; }
32
+
33
+ // Calculate the default video type
34
+
35
+ $valid = false;
36
+ $type = '';
37
+ if ( strlen( $video_id ) == 11 ) {
38
+ $type = 'v';
39
+ if ( preg_match('/^[a-zA-Z0-9_-]{11}$/', $video_id) == 0 ) {
40
+ $valid = false;
41
+ } else {
42
+ $valid = true;
43
+ }
44
+ } else {
45
+ if ( ( strtolower( substr( $video_id, 0, 2 ) ) == 'pl' && strlen( $video_id ) == 34 ) or ( strlen( $video_id ) == 16 ) or ( $playlist != '' ) ) {
46
+ $type = 'p';
47
+ if ( $playlist == '' && preg_match( '/[^A-Za-z0-9_-]/', $video_id ) == 1 ) {
48
+ $valid = false;
49
+ } else {
50
+ $valid = true;
51
+ }
52
+ }
53
+ }
54
+
55
+ // Set the default values
56
+
57
+ $return_data = array(
58
+ 'restricted' => '',
59
+ 'title' => get_the_title(),
60
+ 'description' => get_the_title(),
61
+ 'published' => get_the_date( 'c' ),
62
+ 'valid' => $valid,
63
+ 'type' => $type,
64
+ 'api' => false,
65
+ 'thumb_default' => '',
66
+ 'thumb_medium' => '',
67
+ 'thumb_high' => '',
68
+ 'thumb_standard' => '',
69
+ 'thumb_maxres' => ''
70
+ );
71
+
72
+ // Set the default thumbnail URLs
73
+
74
+ if ( ( $type == 'v' ) or ( $playlist != '' ) ) {
75
+
76
+ $return_data[ 'thumb_default' ] = 'https://i.ytimg.com/vi/' . $video_id . '/default.jpg';
77
+ $return_data[ 'thumb_medium' ] = 'https://i.ytimg.com/vi/' . $video_id . '/mqdefault.jpg';
78
+ $return_data[ 'thumb_high' ] = 'https://i.ytimg.com/vi/' . $video_id . '/hqdefault.jpg';
79
+ $return_data[ 'thumb_standard' ] = 'https://i.ytimg.com/vi/' . $video_id . '/sddefault.jpg';
80
+ $return_data[ 'thumb_maxres' ] = 'https://i.ytimg.com/vi/' . $video_id . '/maxresdefault.jpg';
81
+
82
+ }
83
+
84
+ // If a user defined playlist, go no further
85
+
86
+ if ( $playlist != '' ) { return $return_data; }
87
+
88
+ // Get the API key
89
+
90
+ if ( $api_key == '' ) {
91
+ $options = ye_get_general_defaults();
92
+ $api_key = $options[ 'api' ];
93
+ if ( $api_key == '' ) { return $return_data; }
94
+ }
95
+
96
+ // Get the API results and convert from JSON to a PHP array
97
+
98
+ $url = 'https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&id=' . $video_id . '&key=' . $api_key;
99
+ $api_data = json_decode( file_get_contents( $url ), true );
100
+ if ( $api_data == '' ) { return $return_data; }
101
+
102
+ if ( !isset( $api_data[ 'items' ][ '0' ] ) ) {
103
+
104
+ $url = 'https://www.googleapis.com/youtube/v3/playlists?part=snippet,contentDetails&id=' . $video_id . '&key=' . $api_key;
105
+ $api_data = json_decode( file_get_contents( $url ), true );
106
+ if ( $api_data == '' ) { return $return_data; }
107
+
108
+ if ( isset( $api_data[ 'items' ][ '0' ] ) ) {
109
+ $id_found = true;
110
+ $return_data[ 'type' ] = 'p';
111
+ } else {
112
+ $id_found = false;
113
+ }
114
+ } else {
115
+ $id_found = true;
116
+ $return_data[ 'type' ] = 'v';
117
+ }
118
+
119
+ $return_data[ 'api' ] = true; // Show that API data was used
120
+
121
+ // Extract out the API data
122
+
123
+ if ( $id_found ) {
124
+
125
+ $return_data[ 'valid' ] = true;
126
+
127
+ // Strip off the first two dimensions of the array
128
+
129
+ if ( isset( $api_data[ 'items' ][ '0' ] ) ) { $api_data = $api_data[ 'items' ][ '0' ]; }
130
+
131
+ // If set, assign the appropriate API data to the return array
132
+
133
+ if ( isset( $api_data[ 'snippet' ][ 'publishedAt' ] ) ) { $return_data[ 'published' ] = $api_data[ 'snippet' ][ 'publishedAt' ]; }
134
+
135
+ if ( isset( $api_data[ 'snippet' ][ 'title' ] ) ) { $return_data[ 'title' ] = htmlspecialchars( $api_data[ 'snippet' ][ 'title' ] ); }
136
+
137
+ if ( isset( $api_data[ 'snippet' ][ 'description' ] ) ) { $return_data[ 'description' ] = htmlspecialchars( $api_data[ 'snippet' ][ 'description' ] ); }
138
+
139
+ if ( isset( $api_data[ 'contentDetails' ][ 'contentRating' ][ 'ytRating' ] ) ) { $return_data[ 'restricted' ] = true; } else { $return_data[ 'restricted' ] = false; }
140
+
141
+ if ( isset( $api_data[ 'snippet' ][ 'thumbnails' ][ 'default' ][ 'url' ] ) ) { $return_data[ 'thumb_default' ] = $api_data[ 'snippet' ][ 'thumbnails' ][ 'default' ][ 'url' ]; }
142
+ if ( isset( $api_data[ 'snippet' ][ 'thumbnails' ][ 'medium' ][ 'url' ] ) ) { $return_data[ 'thumb_medium' ] = $api_data[ 'snippet' ][ 'thumbnails' ][ 'medium' ][ 'url' ]; }
143
+ if ( isset( $api_data[ 'snippet' ][ 'thumbnails' ][ 'high' ][ 'url' ] ) ) { $return_data[ 'thumb_high' ] = $api_data[ 'snippet' ][ 'thumbnails' ][ 'high' ][ 'url' ]; }
144
+ if ( isset( $api_data[ 'snippet' ][ 'thumbnails' ][ 'standard' ][ 'url' ] ) ) { $return_data[ 'thumb_standard' ] = $api_data[ 'snippet' ][ 'thumbnails' ][ 'standard' ][ 'url' ]; }
145
+ if ( isset( $api_data[ 'snippet' ][ 'thumbnails' ][ 'maxres' ][ 'url' ] ) ) { $return_data[ 'thumb_maxres' ] = $api_data[ 'snippet' ][ 'thumbnails' ][ 'maxres' ][ 'url' ]; }
146
+
147
+
148
+ } else {
149
+
150
+ $return_data[ 'valid' ] = false;
151
+
152
+ }
153
+
154
+ // If the description is missing or blank, set it to the title
155
+
156
+ if ( !isset( $return_data[ 'description' ] ) or trim( $return_data[ 'description' ] ) == '' ) { $return_data[ 'description' ] = $return_data[ 'title' ]; }
157
+
158
+ // Save the non-cached data (if required), but only if the API retrival was successful
159
+
160
+ $options = ye_get_general_defaults();
161
+
162
+ if ( $options[ 'api_cache' ] != 0 && $id_found ) {
163
+
164
+ $cache = $options[ 'api_cache' ] * 60 * 60 * 24;
165
+
166
+ ye_set_transient( $key, $return_data, $cache );
167
+
168
+ }
169
+
170
+ return $return_data;
171
+ }
172
+ ?>
includes/caching.php ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Transient Functions
4
+ *
5
+ * Functions to save cache data and housekeep it
6
+ *
7
+ * @package YouTube-Embed
8
+ */
9
+
10
+ /**
11
+ * Save a transient
12
+ *
13
+ * Generate a transient name and save it
14
+ *
15
+ * @since 5.0
16
+ *
17
+ * @param string $name The name of the transient
18
+ * @param string $data The data to store
19
+ * @param string $cache How long to cache the data for
20
+ * @param string $hash Whether to hash the name (true or false)
21
+ * @return string True or false, indicating success
22
+ */
23
+
24
+ function ye_set_transient( $name, $data, $cache, $hash = false ) {
25
+
26
+ if ( $hash ) { $name = hash( 'ripemd128', $name ); }
27
+
28
+ $result = set_transient( 'youtubeembed_' . $name, $data, $cache);
29
+
30
+ return $result;
31
+ }
32
+
33
+ /**
34
+ * Get a transient
35
+ *
36
+ * Generate a transient name and fetch it
37
+ *
38
+ * @since 5.0
39
+ *
40
+ * @param string $name The name of the transient
41
+ * @param string $hash Whether to hash the name (true or false)
42
+ * @return string The transient result or false, if failed
43
+ */
44
+
45
+ function ye_get_transient( $name, $hash = false ) {
46
+
47
+ if ( $hash ) { $name = hash( 'ripemd128', $name ); }
48
+
49
+ $result = get_transient( 'youtubeembed_' . $name );
50
+
51
+ return $result;
52
+ }
53
+
54
+ /**
55
+ * Set up the scheduler
56
+ *
57
+ * Set up the scheduler for midnight to run the housekeeping
58
+ *
59
+ * @since 5.0
60
+ */
61
+
62
+ function ye_set_up_scheduler() {
63
+
64
+ if ( !wp_next_scheduled( 'housekeep_ye_transients' ) ) {
65
+ wp_schedule_event( strtotime( '00:00' ) , 'daily', 'housekeep_ye_transients' );
66
+ }
67
+ }
68
+
69
+ add_action( 'init', 'ye_set_up_scheduler' );
70
+
71
+ /**
72
+ * Housekeep the transients
73
+ *
74
+ * Remove any expired transients, relevant to this plugin
75
+ *
76
+ * @since 5.0
77
+ */
78
+
79
+ function ye_housekeep_transients() {
80
+
81
+ $sql = "
82
+ DELETE
83
+ a, b
84
+ FROM
85
+ {$wpdb->options} a, {$wpdb->options} b
86
+ WHERE
87
+ a.option_name LIKE '%_transient_youtubeembed_%' AND
88
+ a.option_name NOT LIKE '%_transient_timeout_youtubeembed_%' AND
89
+ b.option_name = CONCAT(
90
+ '_transient_timeout_',
91
+ SUBSTRING(
92
+ a.option_name,
93
+ CHAR_LENGTH('_transient_') + 1
94
+ )
95
+ )
96
+ AND b.option_value < UNIX_TIMESTAMP()
97
+ ";
98
+
99
+ $clean = $wpdb -> query( $sql );
100
+
101
+ return;
102
+ }
103
+
104
+ add_action( 'ye_housekeep_transients', 'ye_clean_transients' );
105
+ ?>
includes/generate-embed-code.php CHANGED
@@ -17,44 +17,25 @@
17
  * @uses ye_add_links Add links under video
18
  * @uses ye_error Display an error
19
  * @uses ye_extract_id Get the video ID
20
- * @uses ye_validate_list Get the requested listr
21
- * @uses ye_validate_id Validate the video ID
22
  * @uses ye_validate_profile Get the requested profile
23
  * @uses ye_get_general_defaults Get general options
24
  * @uses ye_get_profile Set default profile options
25
  *
26
- * @param string $id Video ID
27
- * @param string $width Video width
28
- * @param string $height Video height
29
- * @param string $fullscreen Fullscreen button
30
- * @param string $related Show related info.
31
- * @param string $autoplay Start video automatically
32
- * @param string $loop Loop video to start
33
- * @param string $start Start in seconds
34
- * @param string $info Show video info.
35
- * @param string $annotation Annotations
36
- * @param string $cc Closed captions
37
- * @param string $style Stylesheet information
38
- * @param string $stop Stop in seconds
39
- * @param string $disablekb Disable keyboard controls
40
- * @param string $ratio Video size ratio
41
- * @param string $autohide Autohide controls
42
- * @param string $controls Display controls
43
- * @param string $profile Which profile to use
44
- * @param string $list_style How to use a list, if used
45
- * @param string $template Display template
46
- * @param string $color Progress bar color
47
- * @param string $theme Use dark or light theme
48
- * @param string $responsive Show responsive output
49
- * @param string $search Perform a search
50
- * @param string $user Look up user videos
51
- * @param string $modest Modest browsing
52
- * @param string $playsinline Playsinline on iOS
53
- * @param string $html5 Force HTML5
54
  * @return string Code output
55
  */
56
 
57
- function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscreen = '', $related = '', $autoplay = '', $loop = '', $start = '', $info = '', $annotation = '', $cc = '', $style = '', $stop = '', $disablekb = '', $ratio = '', $autohide = '', $controls = '', $profile = '', $list_style = '', $template = '', $color = '', $theme = '', $responsive = '', $search = '', $user = '', $modest = '', $playsinline = '', $html5 = '' ) {
 
 
 
 
 
 
 
 
58
 
59
  // Initialisation
60
 
@@ -90,9 +71,7 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
90
  // Check if it's a list
91
 
92
  $list_found = false;
93
- if ( $general[ 'list' ] == 1 ) {
94
- if ( $list_style != '' ) { $list_found = true; }
95
- } else {
96
  $list = ye_validate_list( $id, $general[ 'list_no' ] );
97
  if ( is_array( $list ) ) { $list_found = true; }
98
  }
@@ -110,14 +89,14 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
110
 
111
  $id = ye_extract_id( $id );
112
 
113
- // Check what type of video it is and whether it's valid
114
- // Should be 'v' (video), 'p' (playlist) or blank (not known)
115
 
116
- $embed_type = ye_validate_id( $id );
 
117
 
118
  // If the video is invalid, output an error
119
 
120
- if ( ( $embed_type == '' ) or ( strlen ( $embed_type ) != 1 ) ) {
121
  $result = $newline . '<!-- YouTube Embed v' . youtube_embed_version . ' -->' . $newline;
122
  $result .= sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) . $newline . '<!-- ' . __( 'End of YouTube Embed code' ) . ' -->' . $newline;
123
  return $result;
@@ -130,6 +109,7 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
130
  if ( $list_found ) {
131
 
132
  $embed_type = 'v';
 
133
 
134
  // Randomize the video
135
 
@@ -157,12 +137,34 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
157
  }
158
  }
159
  }
 
 
 
 
160
  }
161
  }
162
 
163
  // Correct the ID if a playlist
164
 
165
- if ( strtolower( substr( $id, 0, 2 ) ) == 'pl') { $id = substr( $id, 2 ); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
 
167
  // If this is a feed then display a thumbnail and/or text link to the original video
168
 
@@ -172,7 +174,7 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
172
  $result .= '<p>'.__( 'A video list cannot be viewed within this feed - please view the original content', 'youtube-embed' ) . '.</p>' . $newline;
173
  } else {
174
  $youtube_url = 'https://www.youtube.com/watch?' . $embed_type . '=' . $id;
175
- if ( ( $embed_type == 'v' ) && ( $general[ 'feed' ] != 't' ) ) { $result .= '<p><a href="' . $youtube_url . '"><img src="https://img.youtube.com/vi/' . $id . '/' . $general[ 'thumbnail' ] . '.jpg"></a></p>' . $newline; }
176
  if ( ( $general ['feed'] != 'v' ) or ( $embed_type != 'v' ) ) { $result .= '<p><a href="' . $youtube_url . '">' . __( 'Click here to view the video on YouTube', 'youtube-embed' ) . '</a>.</p>' . $newline; }
177
  }
178
  return $result;
@@ -301,16 +303,25 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
301
 
302
  if ( $metadata != 0 ) {
303
 
304
- $title = get_the_title();
 
 
 
 
 
 
 
 
305
 
306
  $result .= $ttab . '<meta itemprop="url" content="https://www.youtube.com/' . $embed_type . '/' . $id . '" />' . $newline;
307
- $result .= $ttab . '<meta itemprop="name" content="' . $title . '" />' . $newline;
308
- $result .= $ttab . '<meta itemprop="description" content="' . $title . '" />' . $newline;
309
- $result .= $ttab . '<meta itemprop="uploadDate" content="' . get_the_date( 'c' ) . '" />' . $newline;
310
- $result .= $ttab . '<meta itemprop="thumbnailUrl" content="https://i.ytimg.com/vi/' . $id . '/hqdefault.jpg" />' . $newline;
311
  $result .= $ttab . '<meta itemprop="embedUrl" content="https://www.youtube.com/embed/' . $id . '" />' . $newline;
312
  $result .= $ttab . '<meta itemprop="height" content="' . $height . '" />' . $newline;
313
  $result .= $ttab . '<meta itemprop="width" content="' . $width . '" />' . $newline;
 
314
  }
315
 
316
  // Work out, depending on privacy settings, the main address to use
@@ -382,7 +393,19 @@ function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscr
382
  $result .= '<!-- End of YouTube Embed code. Generated in ' . $runtime . ' seconds -->' . $newline;
383
  }
384
 
385
- return $newline . $result;
 
 
 
 
 
 
 
 
 
 
 
 
386
  }
387
 
388
  /**
@@ -412,7 +435,7 @@ function ye_validate_profile( $name, $number ) {
412
  $profile = $loop;
413
  } else {
414
  $profiles = ye_get_profile( $loop );
415
- $profname = strtolower( $profiles[ 'name' ] );
416
  if ( $profname == $name ) { $profile = $loop; }
417
  }
418
  $loop ++;
@@ -458,7 +481,7 @@ function ye_validate_list( $name, $number ) {
458
  if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
459
  $list = $listfiles[ 'list' ];
460
  } else {
461
- $listname = strtolower( $listfiles[ 'name' ] );
462
  if ( $listname == $name ) { $list = $listfiles[ 'list' ]; }
463
  }
464
  }
@@ -573,4 +596,4 @@ function ye_calculate_video_size( $width, $height, $default_width, $default_heig
573
 
574
  return $new_sizes;
575
  }
576
- ?>
17
  * @uses ye_add_links Add links under video
18
  * @uses ye_error Display an error
19
  * @uses ye_extract_id Get the video ID
20
+ * @uses ye_validate_list Get the requested lists
21
+ * @uses ye_get_api_data Get the API data
22
  * @uses ye_validate_profile Get the requested profile
23
  * @uses ye_get_general_defaults Get general options
24
  * @uses ye_get_profile Set default profile options
25
  *
26
+ * @param string $array Array of parameters
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  * @return string Code output
28
  */
29
 
30
+ function ye_generate_youtube_code( $array ) {
31
+
32
+ // Set defaults then merge with passed array. Finally, split array into individual variables
33
+
34
+ $default = array( 'id' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'list_style' => '', 'template' => '', 'color' => '', 'theme' => '', 'responsive' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'html5' => '' );
35
+
36
+ $array = array_merge( $default, $array );
37
+
38
+ extract( $array );
39
 
40
  // Initialisation
41
 
71
  // Check if it's a list
72
 
73
  $list_found = false;
74
+ if ( ( $general[ 'force_list_type' ] == 1 && $list_style != '' ) or ( $general[ 'force_list_type' ] != 1 ) ) {
 
 
75
  $list = ye_validate_list( $id, $general[ 'list_no' ] );
76
  if ( is_array( $list ) ) { $list_found = true; }
77
  }
89
 
90
  $id = ye_extract_id( $id );
91
 
92
+ // Fetch in video data
 
93
 
94
+ $api_data = ye_get_api_data( $id );
95
+ $embed_type = $api_data[ 'type' ];
96
 
97
  // If the video is invalid, output an error
98
 
99
+ if ( !$api_data[ 'valid' ] ) {
100
  $result = $newline . '<!-- YouTube Embed v' . youtube_embed_version . ' -->' . $newline;
101
  $result .= sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) . $newline . '<!-- ' . __( 'End of YouTube Embed code' ) . ' -->' . $newline;
102
  return $result;
109
  if ( $list_found ) {
110
 
111
  $embed_type = 'v';
112
+ $list_name = $id;
113
 
114
  // Randomize the video
115
 
137
  }
138
  }
139
  }
140
+
141
+ // Fetch in video data
142
+
143
+ $api_data = ye_get_api_data( $id, '', '', '', $list_name );
144
  }
145
  }
146
 
147
  // Correct the ID if a playlist
148
 
149
+ if ( strtolower( substr( $id, 0, 2 ) ) == 'pl' && strlen( $video_id ) == 34 ) { $id = substr( $id, 2 ); }
150
+
151
+ // Get from cache, if required
152
+
153
+ if ( $general[ 'video_cache' ] != 0 && get_the_date() !== false ) {
154
+
155
+ // Generate the cache key - it's a combination of ALL the passed parameters, some of the general options, all of the relevant profile options and the playlist, if specified
156
+
157
+ $general_extract = array( 'metadata' => $general[ 'metadata' ], 'feed' => $general[ 'feed' ], 'thumbnail' => $general[ 'thumbnail' ], 'privacy' => $general[ 'privacy' ], 'frameborder' => $general[ 'frameborder' ], 'language' => $general[ 'language' ], 'debug' => $general[ 'debug' ], 'script' => $general[ 'script' ], 'force_list_type' => $general[ 'force_list_type' ] );
158
+
159
+ $key = serialize( $options ) . serialize( $array ) . serialize ( $general_extract );
160
+
161
+ if ( $list_found ) { $key .= serialize( $list ); }
162
+
163
+ // Now fetch the cache
164
+
165
+ $cache = ye_get_transient( $key, true );
166
+ if ( $cache !== false ) { return $cache; }
167
+ }
168
 
169
  // If this is a feed then display a thumbnail and/or text link to the original video
170
 
174
  $result .= '<p>'.__( 'A video list cannot be viewed within this feed - please view the original content', 'youtube-embed' ) . '.</p>' . $newline;
175
  } else {
176
  $youtube_url = 'https://www.youtube.com/watch?' . $embed_type . '=' . $id;
177
+ if ( ( $embed_type == 'v' ) && ( $general[ 'feed' ] != 't' ) ) { $result .= '<p><a href="' . $youtube_url . '"><img src="https://img.youtube.com/vi/' . $id . '/' . $general[ 'thumbnail' ] . '.jpg" alt="' . $api_data[ 'title' ] . '"></a></p>' . $newline; }
178
  if ( ( $general ['feed'] != 'v' ) or ( $embed_type != 'v' ) ) { $result .= '<p><a href="' . $youtube_url . '">' . __( 'Click here to view the video on YouTube', 'youtube-embed' ) . '</a>.</p>' . $newline; }
179
  }
180
  return $result;
303
 
304
  if ( $metadata != 0 ) {
305
 
306
+ if ( $api_data[ 'restricted' ] === true ) {
307
+ $friendly = 'false';
308
+ } else {
309
+ if ( $api_data[ 'restricted' ] === false ) {
310
+ $friendly = 'true';
311
+ } else {
312
+ $friendly = '';
313
+ }
314
+ }
315
 
316
  $result .= $ttab . '<meta itemprop="url" content="https://www.youtube.com/' . $embed_type . '/' . $id . '" />' . $newline;
317
+ if ( $api_data[ 'title' ] != '' ) { $result .= $ttab . '<meta itemprop="name" content="' . $api_data[ 'title' ] . '" />' . $newline; }
318
+ if ( $api_data[ 'description' ] != '' ) { $result .= $ttab . '<meta itemprop="description" content="' . $api_data[ 'description' ] . '" />' . $newline; }
319
+ if ( $api_data[ 'published' ] != '' ) { $result .= $ttab . '<meta itemprop="uploadDate" content="' . $api_data[ 'published' ] . '" />' . $newline; }
320
+ if ( $api_data[ 'thumb_default' ] != '' ) { $result .= $ttab . '<meta itemprop="thumbnailUrl" content="' . $api_data[ 'thumb_default' ] . '" />' . $newline; }
321
  $result .= $ttab . '<meta itemprop="embedUrl" content="https://www.youtube.com/embed/' . $id . '" />' . $newline;
322
  $result .= $ttab . '<meta itemprop="height" content="' . $height . '" />' . $newline;
323
  $result .= $ttab . '<meta itemprop="width" content="' . $width . '" />' . $newline;
324
+ if ( $friendly != '' ) { $result .= $ttab . '<meta itemprop="isFamilyFriendly" content="' . $friendly . '" />' . $newline; }
325
  }
326
 
327
  // Work out, depending on privacy settings, the main address to use
393
  $result .= '<!-- End of YouTube Embed code. Generated in ' . $runtime . ' seconds -->' . $newline;
394
  }
395
 
396
+ $result = $newline . $result;
397
+
398
+ // Save the cache
399
+
400
+ if ( $general[ 'video_cache' ] != 0 && get_the_date() !== false ) {
401
+
402
+ $cache = $general[ 'video_cache' ] * 60 * 60;
403
+
404
+ ye_set_transient( $key, $result, $cache, true );
405
+
406
+ }
407
+
408
+ return $result;
409
  }
410
 
411
  /**
435
  $profile = $loop;
436
  } else {
437
  $profiles = ye_get_profile( $loop );
438
+ $profname = strtolower( $profiles[ 'profile_name' ] );
439
  if ( $profname == $name ) { $profile = $loop; }
440
  }
441
  $loop ++;
481
  if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
482
  $list = $listfiles[ 'list' ];
483
  } else {
484
+ $listname = strtolower( $listfiles[ 'list_name' ] );
485
  if ( $listname == $name ) { $list = $listfiles[ 'list' ]; }
486
  }
487
  }
596
 
597
  return $new_sizes;
598
  }
599
+ ?>
includes/generate-other-code.php CHANGED
@@ -7,17 +7,13 @@
7
  * @package YouTube-Embed
8
  * @since 2.0
9
  *
10
- * @uses ye_extract_id Extract an ID from a string
11
- * @uses ye_validate_id Confirm the type of video
12
- * @uses ye_error Display an error
13
- *
14
  * @param string $id YouTube video ID
15
  * @return string Download HTML
16
  */
17
 
18
  function ye_generate_download_code( $id ) {
19
 
20
- return 'http://keepvid.com/?url=https://www.youtube.com/watch?v=' . $id;
21
 
22
  }
23
 
@@ -30,7 +26,7 @@ function ye_generate_download_code( $id ) {
30
  * @since 2.0
31
  *
32
  * @uses ye_extract_id Extract an ID from a string
33
- * @uses ye_validate_id Confirm the type of video
34
  * @uses ye_error Display an error
35
  *
36
  * @param string $id YouTube video ID
@@ -39,26 +35,8 @@ function ye_generate_download_code( $id ) {
39
 
40
  function ye_generate_shorturl_code( $id ) {
41
 
42
- // Check that an ID has been specified
43
- if ( $id == '' ) {
44
- return ye_error( __( 'No video ID has been supplied', 'youtube-embed' ) );
45
- } else {
46
-
47
- // Extract the ID if a full URL has been specified
48
- $id = ye_extract_id( $id );
49
-
50
- // Check what type of video it is and whether it's valid
51
- $embed_type = ye_validate_id( $id );
52
- if ( $embed_type != 'v' ) {
53
- if ( strlen( $embed_type ) > 1 ) {
54
- return ye_error( $embed_type );
55
- } else {
56
- return ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) );
57
- }
58
- }
59
-
60
- return 'https://youtu.be/' . $id;
61
- }
62
  }
63
 
64
  /**
@@ -70,47 +48,31 @@ function ye_generate_shorturl_code( $id ) {
70
  * @since 2.0
71
  *
72
  * @uses ye_extract_id Extract an ID from a string
73
- * @uses ye_validate_id Confirm the type of video
74
  * @uses ye_error Display an error
75
  *
76
- * @param string $id YouTube video ID
77
- * @param string $style Link STYLE
78
- * @param string $class Link CLASS
79
- * @param string $rel Link REL
80
- * @param string $target Link target
81
- * @param string $width Width
82
- * @param string $height Height
83
- * @param string $alt ALT text
84
- * @param string $version Thumbnail version
85
- * @param string $nolink True or False, whether no link should be added
86
  * @return string $youtube_code Code
87
  */
88
 
89
- function ye_generate_thumbnail_code( $id, $style, $class, $rel, $target, $width, $height, $alt, $version, $nolink = false ) {
90
 
91
- // Extract the ID if a full URL has been specified
92
- $id = ye_extract_id( $id );
93
 
94
- // Check what type of video it is and whether it's valid
95
- $embed_type = ye_validate_id( $id );
96
 
97
- if ( $embed_type != 'v' ) {
98
- if ( strlen( $embed_type ) > 1 ) {
99
- return ye_error( $embed_type );
100
- } else {
101
- return ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) );
102
- }
103
- }
104
 
105
  $version = strtolower( $version );
106
- if ( ( $version != 'default' ) && ( $version != 'hq' ) && ( $version != 'start' ) && ( $version != 'middle' ) && ( $version != 'end' ) ) { $version = 'default'; }
107
- if ( $version == 'hq' ) { $version = 'hqdefault'; }
108
- if ( $version == 'start' ) { $version = 1; }
109
- if ( $version == 'middle' ) { $version = 2; }
110
- if ( $version == 'end' ) { $version = 3; }
111
 
112
  // Now create the required code
113
- if ( $alt == '' ) { $alt = sprintf( __( 'YouTube Video %s' ), $id ); }
 
114
  if ( !$nolink ) {
115
  $youtube_code = '<a href="https://www.youtube.com/watch?v=' . $id . '"';
116
  if ( $style != '' ) { $youtube_code .= ' style="' . $style . '"'; }
@@ -119,12 +81,69 @@ function ye_generate_thumbnail_code( $id, $style, $class, $rel, $target, $width,
119
  if ( $target != '' ) { $youtube_code .= ' target="' . $target . '"'; }
120
  $youtube_code .= '>';
121
  }
122
- $youtube_code .= '<img src="https://img.youtube.com/vi/' . $id . '/' . $version . '.jpg"';
123
  if ( $width != '' ) { $youtube_code .= ' width="' . $width . '"'; }
124
  if ( $height != '' ) { $youtube_code .= ' height="' . $height . '"'; }
125
  $youtube_code .= ' alt="' . $alt . '"/>';
126
  if ( !$nolink ) { $youtube_code .= '</a>'; }
127
 
 
 
128
  return $youtube_code;
129
  }
130
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  * @package YouTube-Embed
8
  * @since 2.0
9
  *
 
 
 
 
10
  * @param string $id YouTube video ID
11
  * @return string Download HTML
12
  */
13
 
14
  function ye_generate_download_code( $id ) {
15
 
16
+ return ye_generate_vinfo_code( $id, '%download%' );
17
 
18
  }
19
 
26
  * @since 2.0
27
  *
28
  * @uses ye_extract_id Extract an ID from a string
29
+ * @uses ye_get_api_data Get API data
30
  * @uses ye_error Display an error
31
  *
32
  * @param string $id YouTube video ID
35
 
36
  function ye_generate_shorturl_code( $id ) {
37
 
38
+ return ye_generate_vinfo_code( $id, '%shorturl%' );
39
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  }
41
 
42
  /**
48
  * @since 2.0
49
  *
50
  * @uses ye_extract_id Extract an ID from a string
51
+ * @uses ye_get_api_data Get API data
52
  * @uses ye_error Display an error
53
  *
54
+ * @param string $array Array of parameters
 
 
 
 
 
 
 
 
 
55
  * @return string $youtube_code Code
56
  */
57
 
58
+ function ye_generate_thumbnail_code( $array ) {
59
 
60
+ // Set defaults then merge with passed array. Finally, split array into individual variables
 
61
 
62
+ $default = array( 'id' => '', 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '', 'nolink' => false );
 
63
 
64
+ $array = array_merge( $default, $array );
65
+
66
+ extract( $array );
67
+
68
+ // Create the relevant version name to find it in the API array
 
 
69
 
70
  $version = strtolower( $version );
71
+ if ( ( $version != 'default' ) && ( $version != 'medium' ) && ( $version != 'high' ) && ( $version != 'standard' ) && ( $version != 'maxres' ) ) { $version = 'default'; }
 
 
 
 
72
 
73
  // Now create the required code
74
+
75
+ if ( $alt == '' ) { $alt = '%title%'; }
76
  if ( !$nolink ) {
77
  $youtube_code = '<a href="https://www.youtube.com/watch?v=' . $id . '"';
78
  if ( $style != '' ) { $youtube_code .= ' style="' . $style . '"'; }
81
  if ( $target != '' ) { $youtube_code .= ' target="' . $target . '"'; }
82
  $youtube_code .= '>';
83
  }
84
+ $youtube_code .= '<img src="%thumb_' . $version . '%"';
85
  if ( $width != '' ) { $youtube_code .= ' width="' . $width . '"'; }
86
  if ( $height != '' ) { $youtube_code .= ' height="' . $height . '"'; }
87
  $youtube_code .= ' alt="' . $alt . '"/>';
88
  if ( !$nolink ) { $youtube_code .= '</a>'; }
89
 
90
+ $youtube_code = ye_generate_vinfo_code( $id, $youtube_code) ;
91
+
92
  return $youtube_code;
93
  }
94
+
95
+ /**
96
+ * Generate Video Information
97
+ *
98
+ * Output video information
99
+ *
100
+ * @since 5.0
101
+ *
102
+ * @uses ye_extract_id Extract an ID from a string
103
+ * @uses ye_get_api_data Get API data
104
+ * @uses ye_error Display an error
105
+ *
106
+ * @param string $id Video ID
107
+ * @param string $text The text containing the information requirements
108
+ * @return string $output The resulting output
109
+ */
110
+
111
+ function ye_generate_vinfo_code( $id, $text ) {
112
+
113
+ if ( $id == '' ) {
114
+ return ye_error( __( 'No YouTube ID was specified.', 'youtube-embed' ) );
115
+ }
116
+
117
+ // Extract the ID if a full URL has been specified
118
+
119
+ $id = ye_extract_id( $id );
120
+
121
+ // Get the data from the API
122
+
123
+ $data = ye_get_api_data( $id );
124
+
125
+ // Exit out with an error if the ID was not valid
126
+
127
+ if ( !$data[ 'valid' ] ) {
128
+ return ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) );
129
+ }
130
+
131
+ // Now replace any tags in the text with the relevant information
132
+
133
+ $output = $text;
134
+
135
+ $output = str_replace( '%title%', $data[ 'title' ], $output );
136
+ $output = str_replace( '%description%', $data[ 'description' ], $output );
137
+ $output = str_replace( '%url%', 'https://www.youtube.com/watch?v=' . $id, $output );
138
+ $output = str_replace( '%shorturl%', 'https://youtu.be/' . $id, $output );
139
+ $output = str_replace( '%download%', 'http://keepvid.com/?url=https://www.youtube.com/watch?v=' . $id, $output );
140
+
141
+ $output = str_replace( '%thumb_default%', $data[ 'thumb_default' ], $output );
142
+ $output = str_replace( '%thumb_medium%', $data[ 'thumb_medium' ], $output );
143
+ $output = str_replace( '%thumb_high%', $data[ 'thumb_high' ], $output );
144
+ $output = str_replace( '%thumb_standard%', $data[ 'thumb_standard' ], $output );
145
+ $output = str_replace( '%thumb_maxres%', $data[ 'thumb_maxres' ], $output );
146
+
147
+ return $output;
148
+ }
149
+ ?>
includes/generate-widgets.php CHANGED
@@ -23,7 +23,9 @@ class YouTubeEmbedWidget extends WP_Widget {
23
 
24
  parent::__construct( 'youtube_embed_widget',
25
  __( 'YouTube Embed', 'youtube-embed' ),
26
- array( 'description' => __( 'Embed YouTube Widget.', 'youtube-embed' ), 'class' => 'my-widget-class' )
 
 
27
  );
28
  }
29
 
@@ -57,36 +59,20 @@ class YouTubeEmbedWidget extends WP_Widget {
57
  if ( $instance[ 'id_type' ] == 's' ) { $search = 1; } else { $search = ''; }
58
  if ( $instance[ 'id_type' ] == 'u' ) { $user = 1; } else { $user = ''; }
59
 
 
 
 
 
 
 
 
 
 
 
 
60
  // Generate the video and output it
61
 
62
- echo apply_filters( 'a3_lazy_load_html',
63
- ye_generate_youtube_code ( $instance[ 'id' ],
64
- '',
65
- '',
66
- '',
67
- '',
68
- '',
69
- '',
70
- $instance[ 'start' ],
71
- '',
72
- '',
73
- '',
74
- '',
75
- $instance[ 'stop' ],
76
- '',
77
- '',
78
- '',
79
- '',
80
- $instance[ 'profile' ],
81
- $instance[ 'list' ],
82
- '',
83
- '',
84
- '',
85
- '',
86
- '',
87
- $search,
88
- $user,
89
- '' ) );
90
 
91
  // Output the trailer
92
  echo $after_widget;
23
 
24
  parent::__construct( 'youtube_embed_widget',
25
  __( 'YouTube Embed', 'youtube-embed' ),
26
+ array( 'description' => __( 'Embed YouTube Widget.', 'youtube-embed' ),
27
+ 'class' => 'ye-widget',
28
+ 'customize_selective_refresh' => true )
29
  );
30
  }
31
 
59
  if ( $instance[ 'id_type' ] == 's' ) { $search = 1; } else { $search = ''; }
60
  if ( $instance[ 'id_type' ] == 'u' ) { $user = 1; } else { $user = ''; }
61
 
62
+ // Built the parameter array
63
+
64
+ $array = array(
65
+ 'id' => $instance[ 'id' ],
66
+ 'start' => $instance[ 'start' ],
67
+ 'stop' => $instance[ 'start' ],
68
+ 'profile' => $instance[ 'profile' ],
69
+ 'list_style' => $instance[ 'list' ],
70
+ 'search' => $instance[ 'search' ],
71
+ 'user' => $instance[ 'start' ] );
72
+
73
  // Generate the video and output it
74
 
75
+ echo apply_filters( 'a3_lazy_load_html', ye_generate_youtube_code ( $array ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
  // Output the trailer
78
  echo $after_widget;
includes/options-general.php CHANGED
@@ -47,22 +47,44 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
47
  $options[ 'language' ] = sanitize_text_field( $_POST[ 'youtube_embed_language' ] );
48
  $options[ 'script' ] = sanitize_text_field( $_POST[ 'youtube_embed_script' ] );
49
 
 
 
 
 
 
50
  if ( isset( $_POST[ 'youtube_embed_metadata' ] ) ) { $options[ 'metadata' ] = sanitize_text_field( $_POST[ 'youtube_embed_metadata' ] ); } else { $options[ 'metadata' ] = ''; }
51
  if ( isset( $_POST[ 'youtube_embed_frameborder' ] ) ) { $options[ 'frameborder' ] = sanitize_text_field( $_POST[ 'youtube_embed_frameborder' ] ); } else { $options[ 'frameborder' ] = ''; }
52
  if ( isset( $_POST[ 'youtube_embed_widgets' ] ) ) { $options[ 'widgets' ] = sanitize_text_field( $_POST[ 'youtube_embed_widgets' ] ); } else { $options[ 'widgets' ] = ''; }
53
  if ( isset( $_POST[ 'youtube_embed_debug' ] ) ) { $options[ 'debug' ] = sanitize_text_field( $_POST[ 'youtube_embed_debug' ] ); } else { $options[ 'debug' ] = ''; }
54
  if ( isset( $_POST[ 'youtube_embed_prompt' ] ) ) { $options[ 'prompt' ] = sanitize_text_field( $_POST[ 'youtube_embed_prompt' ] ); } else { $options[ 'prompt' ] = ''; }
55
- if ( isset( $_POST[ 'youtube_embed_list' ] ) ) { $options[ 'list' ] = sanitize_text_field( $_POST[ 'youtube_embed_list' ] ); } else { $options[ 'list' ] = ''; }
56
 
57
  // If the number of profiles or lists is less than zero, put it to 0
58
 
59
  if ( $options[ 'profile_no' ] < 0 ) { $options[ 'profile_no' ] = 0; }
60
  if ( $options[ 'list_no' ] < 0 ) { $options[ 'list_no' ] = 0; }
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  // Update the options
63
 
64
  update_option( 'youtube_embed_general', $options );
65
- $update_message = __( 'Settings Saved.', 'youtube-embed' );
66
 
67
  // Update the alternative shortcodes
68
 
@@ -71,7 +93,7 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
71
 
72
  update_option( 'youtube_embed_shortcode', $shortcode );
73
 
74
- echo '<div class="updated fade"><p><strong>' . $update_message . "</strong></p></div>\n";
75
  }
76
 
77
  // Get options
@@ -84,7 +106,15 @@ $shortcode = ye_get_shortcode();
84
 
85
  <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=ye-general-options' ?>">
86
 
87
- <h3 class="title"><?php _e( 'Embedding', 'youtube-embed' ); ?></h3><table class="form-table">
 
 
 
 
 
 
 
 
88
 
89
  <!-- Add Metadata -->
90
 
@@ -205,16 +235,42 @@ $shortcode = ye_get_shortcode();
205
 
206
  <tr>
207
  <th scope="row"><?php _e( 'Number of Profiles', 'youtube-embed' ); ?></th>
208
- <td><label for="youtube_embed_profile_no"><input type="text" size="2" maxlength="2" name="youtube_embed_profile_no" value="<?php echo esc_attr( $options[ 'profile_no' ] ); ?>"/></label>
209
- <p class="description"><?php _e( 'Maximum number of profiles.', 'youtube-embed' ); ?></p></td>
210
  </tr>
211
 
212
  <!-- Number of Lists -->
213
 
214
  <tr>
215
  <th scope="row"><?php _e( 'Number of Lists', 'youtube-embed' ); ?></th>
216
- <td><label for="youtube_embed_list_no"><input type="text" size="2" maxlength="2" name="youtube_embed_list_no" value="<?php echo esc_attr( $options[ 'list_no' ] ); ?>"/></label>
217
- <p class="description"><?php _e( 'Maximum number of lists.', 'youtube-embed' ); ?></p></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  </tr>
219
 
220
  </table><hr><h3 class="title"><?php _e( 'Security', 'youtube-embed' ); ?></h3><table class="form-table">
@@ -258,15 +314,6 @@ $shortcode = ye_get_shortcode();
258
  <p class="description"><?php echo __( 'The parameter value is an <a href="https://www.loc.gov/standards/iso639-2/php/code_list.php">ISO 639-1 two-letter language code</a> or a fully specified locale. For example, the current locale is ', 'youtube-embed' ) . strtolower( str_replace( '_', '-', get_locale() ) ) . '.'; ?></p></td>
259
  </tr>
260
 
261
- <!-- Specify a list -->
262
-
263
- <tr>
264
- <th scope="row"><?php _e( 'Force list specification', 'youtube-embed' ); ?></th>
265
- <td><label for="youtube_embed_list"><input type="checkbox" name="youtube_embed_list" value="1"<?php if ( $options[ 'list' ] == '1' ) { echo ' checked="checked"'; } ?>/>
266
- <?php _e( 'Force users to specify a list type', 'youtube-embed' ); ?></label>
267
- <p class="description"><?php _e( 'By switching this on, a list type must be specified for a list to be valid. This improves performance as use of a list doesn\'t then need to be verified.', 'youtube-embed' ); ?></p></td>
268
- </tr>
269
-
270
  </table>
271
 
272
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
47
  $options[ 'language' ] = sanitize_text_field( $_POST[ 'youtube_embed_language' ] );
48
  $options[ 'script' ] = sanitize_text_field( $_POST[ 'youtube_embed_script' ] );
49
 
50
+ $options[ 'api_cache' ] = sanitize_text_field( $_POST[ 'youtube_embed_api_cache' ] );
51
+ if ( !is_numeric( $options[ 'api_cache' ] ) ) { $options[ 'api_cache' ] = 0; }
52
+ $options[ 'video_cache' ] = sanitize_text_field( $_POST[ 'youtube_embed_video_cache' ] );
53
+ if ( !is_numeric( $options[ 'video_cache' ] ) ) { $options[ 'video_cache' ] = 0; }
54
+
55
  if ( isset( $_POST[ 'youtube_embed_metadata' ] ) ) { $options[ 'metadata' ] = sanitize_text_field( $_POST[ 'youtube_embed_metadata' ] ); } else { $options[ 'metadata' ] = ''; }
56
  if ( isset( $_POST[ 'youtube_embed_frameborder' ] ) ) { $options[ 'frameborder' ] = sanitize_text_field( $_POST[ 'youtube_embed_frameborder' ] ); } else { $options[ 'frameborder' ] = ''; }
57
  if ( isset( $_POST[ 'youtube_embed_widgets' ] ) ) { $options[ 'widgets' ] = sanitize_text_field( $_POST[ 'youtube_embed_widgets' ] ); } else { $options[ 'widgets' ] = ''; }
58
  if ( isset( $_POST[ 'youtube_embed_debug' ] ) ) { $options[ 'debug' ] = sanitize_text_field( $_POST[ 'youtube_embed_debug' ] ); } else { $options[ 'debug' ] = ''; }
59
  if ( isset( $_POST[ 'youtube_embed_prompt' ] ) ) { $options[ 'prompt' ] = sanitize_text_field( $_POST[ 'youtube_embed_prompt' ] ); } else { $options[ 'prompt' ] = ''; }
60
+ if ( isset( $_POST[ 'youtube_embed_list' ] ) ) { $options[ 'force_list_type' ] = sanitize_text_field( $_POST[ 'youtube_embed_list' ] ); } else { $options[ 'force_list_type' ] = ''; }
61
 
62
  // If the number of profiles or lists is less than zero, put it to 0
63
 
64
  if ( $options[ 'profile_no' ] < 0 ) { $options[ 'profile_no' ] = 0; }
65
  if ( $options[ 'list_no' ] < 0 ) { $options[ 'list_no' ] = 0; }
66
 
67
+ // Test the API key
68
+
69
+ $api_key = sanitize_text_field( $_POST[ 'youtube_embed_api' ] );
70
+ $api_valid = true;
71
+ if ( $api_key != '' ) {
72
+ $api_test = ye_get_api_data( 'jNQXAC9IVRw', $api_key, true );
73
+ if ( !$api_test[ 'api' ] ) { $api_valid = false; }
74
+ }
75
+
76
+ if ( !$api_valid ) {
77
+ $update_message = __( 'API key is invalid or API is unavailable.', 'youtube-embed' );
78
+ $update_class = 'error';
79
+ } else {
80
+ $options[ 'api' ] = $api_key;
81
+ $update_message = __( 'Settings Saved.', 'youtube-embed' );
82
+ $update_class = 'updated';
83
+ }
84
+
85
  // Update the options
86
 
87
  update_option( 'youtube_embed_general', $options );
 
88
 
89
  // Update the alternative shortcodes
90
 
93
 
94
  update_option( 'youtube_embed_shortcode', $shortcode );
95
 
96
+ echo '<div class="' . $update_class . ' fade"><p><strong>' . $update_message . "</strong></p></div>\n";
97
  }
98
 
99
  // Get options
106
 
107
  <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=ye-general-options' ?>">
108
 
109
+ <table class="form-table">
110
+
111
+ <tr>
112
+ <th scope="row"><?php _e( 'API Key', 'youtube-embed' ); ?></th>
113
+ <td><label for="youtube_embed_api"><input type="text" size="50" name="youtube_embed_api" value="<?php echo esc_attr( $options[ 'api' ] ); ?>"/></label>
114
+ <p class="description"><?php _e( 'Please see the instructions for details on creating your own API key.', 'youtube-embed' ); ?></p></td>
115
+ </tr>
116
+
117
+ </table><hr><h3 class="title"><?php _e( 'Embedding', 'youtube-embed' ); ?></h3><table class="form-table">
118
 
119
  <!-- Add Metadata -->
120
 
235
 
236
  <tr>
237
  <th scope="row"><?php _e( 'Number of Profiles', 'youtube-embed' ); ?></th>
238
+ <td><label for="youtube_embed_profile_no"><input type="text" size="2" maxlength="2" name="youtube_embed_profile_no" value="<?php echo esc_attr( $options[ 'profile_no' ] ); ?>"/> <?php _e( 'Maximum number of profiles.', 'youtube-embed' ); ?></label></td>
 
239
  </tr>
240
 
241
  <!-- Number of Lists -->
242
 
243
  <tr>
244
  <th scope="row"><?php _e( 'Number of Lists', 'youtube-embed' ); ?></th>
245
+ <td><label for="youtube_embed_list_no"><input type="text" size="2" maxlength="2" name="youtube_embed_list_no" value="<?php echo esc_attr( $options[ 'list_no' ] ); ?>"/> <?php _e( 'Maximum number of lists.', 'youtube-embed' ); ?></label></td>
246
+ </tr>
247
+
248
+ </table><hr><h3 class="title"><?php _e( 'Performance', 'youtube-embed' ); ?></h3><table class="form-table">
249
+
250
+
251
+ <!-- Specify a list -->
252
+
253
+ <tr>
254
+ <th scope="row"><?php _e( 'Force list specification', 'youtube-embed' ); ?></th>
255
+ <td><label for="youtube_embed_list"><input type="checkbox" name="youtube_embed_list" value="1"<?php if ( $options[ 'force_list_type' ] == '1' ) { echo ' checked="checked"'; } ?>/>
256
+ <?php _e( 'Force users to specify a list type', 'youtube-embed' ); ?></label>
257
+ <p class="description"><?php _e( 'By switching this on, a list type must be specified for a list to be valid. This improves performance as use of a list doesn\'t then need to be verified.', 'youtube-embed' ); ?></p></td>
258
+ </tr>
259
+
260
+ <!-- Video cache -->
261
+
262
+ <tr>
263
+ <th scope="row"><?php _e( 'Video Cache', 'youtube-embed' ); ?></th>
264
+ <td><label for="youtube_embed_video_cache"><input type="text" size="2" maxlength="2" name="youtube_embed_video_cache" value="<?php echo esc_attr( $options[ 'video_cache' ] ); ?>"/> <?php _e( 'days', 'youtube-embed' ); ?></label>
265
+ <p class="description"><?php _e( 'How long to cache the video output. Set to 0 to switch off.', 'youtube-embed' ); ?></p></td>
266
+ </tr>
267
+
268
+ <!-- API cache -->
269
+
270
+ <tr>
271
+ <th scope="row"><?php _e( 'API Cache', 'youtube-embed' ); ?></th>
272
+ <td><label for="youtube_embed_api_cache"><input type="text" size="2" maxlength="2" name="youtube_embed_api_cache" value="<?php echo esc_attr( $options[ 'api_cache' ] ); ?>"/> <?php _e( 'hours', 'youtube-embed' ); ?></label>
273
+ <p class="description"><?php _e( 'How long to cache the API data. Set to 0 to switch off.', 'youtube-embed' ); ?></p></td>
274
  </tr>
275
 
276
  </table><hr><h3 class="title"><?php _e( 'Security', 'youtube-embed' ); ?></h3><table class="form-table">
314
  <p class="description"><?php echo __( 'The parameter value is an <a href="https://www.loc.gov/standards/iso639-2/php/code_list.php">ISO 639-1 two-letter language code</a> or a fully specified locale. For example, the current locale is ', 'youtube-embed' ) . strtolower( str_replace( '_', '-', get_locale() ) ) . '.'; ?></p></td>
315
  </tr>
316
 
 
 
 
 
 
 
 
 
 
317
  </table>
318
 
319
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
includes/options-lists.php CHANGED
@@ -38,11 +38,12 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
38
 
39
  $id = trim( ye_extract_id( $id_array[ $loop ] ) );
40
 
41
- // Now check its validity
42
 
43
  if ( $id != '' ) {
44
- $type = ye_validate_id( $id );
45
- if ( $type != 'v' ) { $valid = false; }
 
46
  $new_id_list .= $id . "\n";
47
  }
48
  $loop ++;
@@ -50,7 +51,7 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
50
 
51
  // If one or more IDs weren't valid, output an error
52
 
53
- if (!$valid) {
54
  $class = 'error';
55
  $message = __( 'Errors were found with your video list. See the list below for details.', 'youtube-embed' );
56
  }
@@ -58,7 +59,7 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
58
 
59
  // Update the options
60
 
61
- $options[ 'name' ] = $_POST[ 'youtube_embed_name' ];
62
 
63
  if ( $new_id_list == '' ) {
64
  $options[ 'list' ] = sanitize_text_field( $_POST[ 'youtube_embed_video_list' ] );
@@ -119,7 +120,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
119
 
120
  $listfiles = ye_get_list( $loop );
121
  if ( $listfiles[ 'list' ] != '' ) {
122
- $listname = $listfiles[ 'name' ];
123
  $list_found = true;
124
  } else {
125
  $listname = __( 'List', 'youtube-embed' ) . ' ' . $loop;
@@ -146,7 +147,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
146
 
147
  <tr>
148
  <th scope="row"><?php _e( 'List Name', 'youtube-embed' ); ?></th>
149
- <td><label for="youtube_embed_name"><input type="text" size="20" name="youtube_embed_name" value="<?php echo esc_attr( $options[ 'name' ] ); ?>"/>
150
  <?php _e( 'The name you wish to give this list', 'youtube-embed' ); ?></label></td>
151
  </tr>
152
 
@@ -184,20 +185,17 @@ if ( $options[ 'list' ] != '' ) {
184
 
185
  // Validate the video type
186
 
187
- $type = ye_validate_id( $id );
188
 
189
- if ( $type == 'p' ) {
190
  $text = __( 'This is a playlist', 'youtube-embed' );
191
  $status = '-1';
192
  } else {
193
- if ( $type == '' ) {
194
  $text = __( 'Invalid video ID', 'youtube-embed' );
195
  $status = '-2';
196
  } else {
197
- if ( strlen( $type ) != 1 ) {
198
- $text = __( 'YouTube API error', 'youtube-embed' );
199
- $status = '-3';
200
- } else {
201
  $text = __( 'Valid video', 'youtube-embed' );
202
  $status = '0';
203
  }
@@ -207,6 +205,17 @@ if ( $options[ 'list' ] != '' ) {
207
  // Output the video information
208
 
209
  echo "\t<tr>\n\t\t<td>" . $id . "</td>\n";
 
 
 
 
 
 
 
 
 
 
 
210
  echo "\t\t<td style=\"";
211
 
212
  if ( $status != 0 ) {
@@ -217,10 +226,10 @@ if ( $options[ 'list' ] != '' ) {
217
 
218
  if ( $status == 0 ) {
219
  $alt_text = __( 'The video ID is valid', 'youtube-embed' );
220
- echo 'tick.png" alt="' . $alt_text . '" title="' . $alt_text . '" ';
221
  } else {
222
  $alt_text = __( 'The video ID is invalid', 'youtube-embed' );
223
- echo 'cross.png" alt="' . $alt_text . '" title="' . $alt_text . '" ';
224
  }
225
 
226
  echo "height=\"16px\" width=\"16px\"/>&nbsp;" . $text . "</td>\n\t</tr>\n";
@@ -231,4 +240,4 @@ if ( $options[ 'list' ] != '' ) {
231
  }
232
  ?>
233
 
234
- </div>
38
 
39
  $id = trim( ye_extract_id( $id_array[ $loop ] ) );
40
 
41
+ // Now check its validity using the API data
42
 
43
  if ( $id != '' ) {
44
+ $data = ye_get_api_data( $id );
45
+ $valid = $data[ 'valid' ];
46
+ if ( $data[ 'type' ] != 'v' ) { $valid = false; }
47
  $new_id_list .= $id . "\n";
48
  }
49
  $loop ++;
51
 
52
  // If one or more IDs weren't valid, output an error
53
 
54
+ if ( !$valid ) {
55
  $class = 'error';
56
  $message = __( 'Errors were found with your video list. See the list below for details.', 'youtube-embed' );
57
  }
59
 
60
  // Update the options
61
 
62
+ $options[ 'list_name' ] = $_POST[ 'youtube_embed_name' ];
63
 
64
  if ( $new_id_list == '' ) {
65
  $options[ 'list' ] = sanitize_text_field( $_POST[ 'youtube_embed_video_list' ] );
120
 
121
  $listfiles = ye_get_list( $loop );
122
  if ( $listfiles[ 'list' ] != '' ) {
123
+ $listname = $listfiles[ 'list_name' ];
124
  $list_found = true;
125
  } else {
126
  $listname = __( 'List', 'youtube-embed' ) . ' ' . $loop;
147
 
148
  <tr>
149
  <th scope="row"><?php _e( 'List Name', 'youtube-embed' ); ?></th>
150
+ <td><label for="youtube_embed_name"><input type="text" size="20" name="youtube_embed_name" value="<?php echo esc_attr( $options[ 'list_name' ] ); ?>"/>
151
  <?php _e( 'The name you wish to give this list', 'youtube-embed' ); ?></label></td>
152
  </tr>
153
 
185
 
186
  // Validate the video type
187
 
188
+ $api_data = ye_get_api_data( $id );
189
 
190
+ if ( $api_data[ 'type' ] == 'p' ) {
191
  $text = __( 'This is a playlist', 'youtube-embed' );
192
  $status = '-1';
193
  } else {
194
+ if ( !$api_data[ 'valid' ] ) {
195
  $text = __( 'Invalid video ID', 'youtube-embed' );
196
  $status = '-2';
197
  } else {
198
+ if ( $api_data[ 'valid' ] ) {
 
 
 
199
  $text = __( 'Valid video', 'youtube-embed' );
200
  $status = '0';
201
  }
205
  // Output the video information
206
 
207
  echo "\t<tr>\n\t\t<td>" . $id . "</td>\n";
208
+ echo "\t\t<td>";
209
+ if ( $api_data[ 'api' ] ) {
210
+ if ( $api_data[ 'title' ] == '' ) {
211
+ echo '[No title available]';
212
+ } else {
213
+ echo $api_data[ 'title' ];
214
+ }
215
+ } else {
216
+ echo '[No title - API not available]';
217
+ }
218
+ echo "</td>\n";
219
  echo "\t\t<td style=\"";
220
 
221
  if ( $status != 0 ) {
226
 
227
  if ( $status == 0 ) {
228
  $alt_text = __( 'The video ID is valid', 'youtube-embed' );
229
+ echo 'tick.png" alt="' . $alt_text . '" ';
230
  } else {
231
  $alt_text = __( 'The video ID is invalid', 'youtube-embed' );
232
+ echo 'cross.png" alt="' . $alt_text . '" ';
233
  }
234
 
235
  echo "height=\"16px\" width=\"16px\"/>&nbsp;" . $text . "</td>\n\t</tr>\n";
240
  }
241
  ?>
242
 
243
+ </div>
includes/options-profiles.php CHANGED
@@ -8,7 +8,7 @@
8
  * @since 2.0
9
  */
10
 
11
- $demo_video = 'Wc7cvpQS-xQ';
12
 
13
  // Set current profile number
14
 
@@ -19,7 +19,7 @@ if ( $profile_no == '' ) { $profile_no = 0; }
19
 
20
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-profile' , 'youtube_embed_profile_nonce' ) ) ) {
21
 
22
- $options[ 'name' ] = sanitize_text_field( $_POST[ 'youtube_embed_name' ] );
23
  $options[ 'width' ] = sanitize_text_field( $_POST[ 'youtube_embed_width' ] );
24
  $options[ 'height' ] = sanitize_text_field( $_POST[ 'youtube_embed_height' ] );
25
 
@@ -119,7 +119,7 @@ if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
119
 
120
  // Output message text
121
 
122
- if ( $updated ) { echo '<div class="updated fade"><p><strong>' . __( $options[ 'name' ].' Profile Saved.' ) . "</strong></p></div>\n"; }
123
 
124
  // Video option button has been pressed
125
 
@@ -154,7 +154,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
154
 
155
  <tr>
156
  <th scope="row"><?php _e( 'Profile Name', 'youtube-embed' ); ?></th>
157
- <td><label for="youtube_embed_name"><input type="text" size="20" name="youtube_embed_name" value="<?php echo esc_attr( $options[ 'name' ] ); ?>"<?php if ( $profile_no == 0 ) { echo ' readonly="readonly"'; } ?>/>
158
  <?php if ( $profile_no != 0 ) { _e( 'The name you wish to give this profile', 'youtube-embed' ); } ?></label></td>
159
  </tr>
160
 
@@ -177,7 +177,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
177
  <!-- Window Mode -->
178
 
179
  <tr>
180
- <th scope="row"><?php _e( 'Window Mode', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url( 'images/flash.png', dirname(__FILE__) ); ?>' width='10px' align='top'></th>
181
  <td><label for="youtube_embed_wmode"><select name="youtube_embed_wmode">
182
  <option value="opaque"<?php if ( $options[ 'wmode' ] == "opaque" ) { echo " selected='selected'"; } ?>><?php _e( 'Opaque', 'youtube-embed' ); ?></option>
183
  <option value="transparent"<?php if ( $options[ 'wmode' ] == "transparent" ) { echo " selected='selected'"; } ?>><?php _e( 'Transparent', 'youtube-embed' ); ?></option>
@@ -229,7 +229,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
229
  <!-- Playsinline -->
230
 
231
  <tr>
232
- <th scope="row"><?php _e( 'Plays Inline', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url( 'images/html5.png', dirname(__FILE__) ); ?>' width='10px' align='top'></th>
233
 
234
  <td><label for="youtube_embed_playsinline"><input type="checkbox" name="youtube_embed_playsinline" value="1"<?php if ( $options[ 'playsinline' ] == "1" ) { echo ' checked="checked"'; } ?>/>
235
  <?php _e( 'Whether videos play inline or fullscreen in an HTML5 player on iOS. ', 'youtube-embed' ); ?></label></td>
@@ -316,7 +316,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
316
  <!-- Auto Hide -->
317
 
318
  <tr>
319
- <th scope="row"><?php _e( 'Auto hide', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url( 'images/flash.png', dirname(__FILE__) ); ?>' width='10px' align='top'></th>
320
  <td><label for="youtube_embed_autohide"><select name="youtube_embed_autohide">
321
  <option value="0"<?php if ( $options[ 'autohide' ] == "0" ) { echo " selected='selected'"; } ?>><?php _e( 'Controls &amp; progress bar remain visible', 'youtube-embed' ); ?></option>
322
  <option value="1"<?php if ( $options[ 'autohide' ] == "1" ) { echo " selected='selected'"; } ?>><?php _e( 'Controls &amp; progress bar fade out', 'youtube-embed' ); ?></option>
@@ -356,7 +356,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
356
  <!-- Theme -->
357
 
358
  <tr>
359
- <th scope="row"><?php _e( 'Theme', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url( 'images/flash.png', dirname(__FILE__) ); ?>' width='10px' align='top'></th>
360
  <td><label for="youtube_embed_theme"><select name="youtube_embed_theme">
361
  <option value="dark"<?php if ( $options[ 'theme' ] == "dark" ) { echo " selected='selected'"; } ?>><?php _e( 'Dark', 'youtube-embed' ); ?></option>
362
  <option value="light"<?php if ( $options[ 'theme' ] == "light" ) { echo " selected='selected'"; } ?>><?php _e( 'Light', 'youtube-embed' ); ?></option>
@@ -426,9 +426,9 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
426
  if ( $video_type == "d" ) { $id = $demo_video; }
427
  if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; }
428
  if ( $video_type == "l" ) { $id = '095393D5B42B2266'; }
429
- echo ye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $profile_no );
430
  ?></p>
431
 
432
  </form></div>
433
 
434
- </div>
8
  * @since 2.0
9
  */
10
 
11
+ $demo_video = '8qMtsir0l9k';
12
 
13
  // Set current profile number
14
 
19
 
20
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-profile' , 'youtube_embed_profile_nonce' ) ) ) {
21
 
22
+ $options[ 'profile_name' ] = sanitize_text_field( $_POST[ 'youtube_embed_name' ] );
23
  $options[ 'width' ] = sanitize_text_field( $_POST[ 'youtube_embed_width' ] );
24
  $options[ 'height' ] = sanitize_text_field( $_POST[ 'youtube_embed_height' ] );
25
 
119
 
120
  // Output message text
121
 
122
+ if ( $updated ) { echo '<div class="updated fade"><p><strong>' . __( $options[ 'profile_name' ].' Profile Saved.' ) . "</strong></p></div>\n"; }
123
 
124
  // Video option button has been pressed
125
 
154
 
155
  <tr>
156
  <th scope="row"><?php _e( 'Profile Name', 'youtube-embed' ); ?></th>
157
+ <td><label for="youtube_embed_name"><input type="text" size="20" name="youtube_embed_name" value="<?php echo esc_attr( $options[ 'profile_name' ] ); ?>"<?php if ( $profile_no == 0 ) { echo ' readonly="readonly"'; } ?>/>
158
  <?php if ( $profile_no != 0 ) { _e( 'The name you wish to give this profile', 'youtube-embed' ); } ?></label></td>
159
  </tr>
160
 
177
  <!-- Window Mode -->
178
 
179
  <tr>
180
+ <th scope="row"><?php _e( 'Window Mode', 'youtube-embed' ); ?>&nbsp;<img src="<?php echo plugins_url( 'images/flash.png', dirname(__FILE__) ); ?>" alt="<?php _e( 'Flash', 'youtube-embed' ) ?>" width="10px" align="top"></th>
181
  <td><label for="youtube_embed_wmode"><select name="youtube_embed_wmode">
182
  <option value="opaque"<?php if ( $options[ 'wmode' ] == "opaque" ) { echo " selected='selected'"; } ?>><?php _e( 'Opaque', 'youtube-embed' ); ?></option>
183
  <option value="transparent"<?php if ( $options[ 'wmode' ] == "transparent" ) { echo " selected='selected'"; } ?>><?php _e( 'Transparent', 'youtube-embed' ); ?></option>
229
  <!-- Playsinline -->
230
 
231
  <tr>
232
+ <th scope="row"><?php _e( 'Plays Inline', 'youtube-embed' ); ?>&nbsp;<img src="<?php echo plugins_url( 'images/html5.png', dirname(__FILE__) ); ?>" alt="<?php _e( 'HTML5', 'youtube-embed' ) ?>" width="10px" align="top"></th>
233
 
234
  <td><label for="youtube_embed_playsinline"><input type="checkbox" name="youtube_embed_playsinline" value="1"<?php if ( $options[ 'playsinline' ] == "1" ) { echo ' checked="checked"'; } ?>/>
235
  <?php _e( 'Whether videos play inline or fullscreen in an HTML5 player on iOS. ', 'youtube-embed' ); ?></label></td>
316
  <!-- Auto Hide -->
317
 
318
  <tr>
319
+ <th scope="row"><?php _e( 'Auto hide', 'youtube-embed' ); ?>&nbsp;<img src="<?php echo plugins_url( 'images/flash.png', dirname(__FILE__) ); ?>" alt="<?php _e( 'Flash', 'youtube-embed' ) ?>" width="10px" align="top"></th>
320
  <td><label for="youtube_embed_autohide"><select name="youtube_embed_autohide">
321
  <option value="0"<?php if ( $options[ 'autohide' ] == "0" ) { echo " selected='selected'"; } ?>><?php _e( 'Controls &amp; progress bar remain visible', 'youtube-embed' ); ?></option>
322
  <option value="1"<?php if ( $options[ 'autohide' ] == "1" ) { echo " selected='selected'"; } ?>><?php _e( 'Controls &amp; progress bar fade out', 'youtube-embed' ); ?></option>
356
  <!-- Theme -->
357
 
358
  <tr>
359
+ <th scope="row"><?php _e( 'Theme', 'youtube-embed' ); ?>&nbsp;<img src="<?php echo plugins_url( 'images/flash.png', dirname(__FILE__) ); ?>" alt="<?php _e( 'Flash', 'youtube-embed' ) ?>" width="10px" align="top"></th>
360
  <td><label for="youtube_embed_theme"><select name="youtube_embed_theme">
361
  <option value="dark"<?php if ( $options[ 'theme' ] == "dark" ) { echo " selected='selected'"; } ?>><?php _e( 'Dark', 'youtube-embed' ); ?></option>
362
  <option value="light"<?php if ( $options[ 'theme' ] == "light" ) { echo " selected='selected'"; } ?>><?php _e( 'Light', 'youtube-embed' ); ?></option>
426
  if ( $video_type == "d" ) { $id = $demo_video; }
427
  if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; }
428
  if ( $video_type == "l" ) { $id = '095393D5B42B2266'; }
429
+ echo ye_generate_youtube_code( array( 'id' => $id, 'profile' => $profile_no ) );
430
  ?></p>
431
 
432
  </form></div>
433
 
434
+ </div>
includes/shared-functions.php CHANGED
@@ -85,35 +85,6 @@ function ye_extract_id( $id ) {
85
  return $id;
86
  }
87
 
88
- /**
89
- * Validate video type
90
- *
91
- * Function to work out what type of video has been requested.
92
- *
93
- * @since 2.0
94
- *
95
- * @param string $id Video ID
96
- * @return string Array containing file details
97
- */
98
-
99
- function ye_validate_id( $id ) {
100
-
101
- $type = '';
102
- if ( strlen( $id ) == 11 ) {
103
- $type = 'v';
104
- } else {
105
- if ( strtolower( substr( $id, 0, 2 ) ) == 'pl') {
106
- $type = 'p';
107
- } else {
108
- if ( strlen( $id ) == 16 ) {
109
- $type = 'p';
110
- }
111
- }
112
- }
113
-
114
- return $type;
115
- }
116
-
117
  /**
118
  * Function to report an error
119
  *
@@ -169,6 +140,7 @@ function ye_convert( $input ) {
169
  function ye_generate_profile_list( $current, $total, $full_list = false ) {
170
 
171
  $loop = 0;
 
172
  while ( $loop <= $total ) {
173
 
174
  // Attempt to get profile
@@ -185,7 +157,7 @@ function ye_generate_profile_list( $current, $total, $full_list = false ) {
185
 
186
  echo '<option value="' . $loop . '"';
187
  if ( $current == $loop ) { echo " selected='selected'"; }
188
- echo '>' . __( $profiles[ 'name' ] );
189
  if ( !$list_found ) { echo ' [undefined]'; }
190
  echo "</option>\n";
191
 
@@ -299,7 +271,10 @@ function ye_set_general_defaults() {
299
  'debug' => 1,
300
  'script' => '',
301
  'prompt' => 1,
302
- 'list' => 0,
 
 
 
303
  );
304
 
305
  // If a new user switch the list option on. Otherwise, an existing user will default to off
@@ -425,7 +400,7 @@ function ye_set_profile_defaults( $profile ) {
425
  // Set default array
426
 
427
  $default = array(
428
- 'name' => $profname,
429
  'width' => $width,
430
  'height' => $height,
431
  'fullscreen' => 1,
@@ -537,7 +512,7 @@ function ye_set_list( $lists ) {
537
  function ye_set_list_defaults( $list ) {
538
 
539
  $default = array(
540
- 'name' => 'List ' . $list,
541
  'list' => ''
542
  );
543
 
85
  return $id;
86
  }
87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  /**
89
  * Function to report an error
90
  *
140
  function ye_generate_profile_list( $current, $total, $full_list = false ) {
141
 
142
  $loop = 0;
143
+ echo 'Total: ' . $total;
144
  while ( $loop <= $total ) {
145
 
146
  // Attempt to get profile
157
 
158
  echo '<option value="' . $loop . '"';
159
  if ( $current == $loop ) { echo " selected='selected'"; }
160
+ echo '>' . __( $profiles[ 'profile_name' ] );
161
  if ( !$list_found ) { echo ' [undefined]'; }
162
  echo "</option>\n";
163
 
271
  'debug' => 1,
272
  'script' => '',
273
  'prompt' => 1,
274
+ 'force_list_type' => 0,
275
+ 'api' => '',
276
+ 'api_cache' => 7,
277
+ 'video_cache' => 24
278
  );
279
 
280
  // If a new user switch the list option on. Otherwise, an existing user will default to off
400
  // Set default array
401
 
402
  $default = array(
403
+ 'profile_name' => $profname,
404
  'width' => $width,
405
  'height' => $height,
406
  'fullscreen' => 1,
512
  function ye_set_list_defaults( $list ) {
513
 
514
  $default = array(
515
+ 'list_name' => 'List ' . $list,
516
  'list' => ''
517
  );
518
 
includes/shortcodes.php CHANGED
@@ -74,7 +74,7 @@ if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'ye_
74
 
75
  function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_shortcode = false ) {
76
 
77
- extract( shortcode_atts( array( 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'id' => '', 'url' => '', 'rel' => '', 'fs' => '', 'cc_load_policy' => '', 'iv_load_policy' => '', 'showinfo' => '', 'youtubeurl' => '', 'template' => '', 'list' => '', 'color' => '', 'theme' => '', 'height' => '', 'width' => '', 'dynamic' => '', 'responsive' => '', 'h' => '', 'w' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'html5' => '' ), $paras ) );
78
 
79
  // If no profile specified and an alternative shortcode used, get that shortcodes default profile
80
 
@@ -119,13 +119,40 @@ function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_sh
119
 
120
  if ( $responsive == '' ) { $responsive = $dynamic; }
121
 
122
- // Set up Autohide parameter
123
-
124
- $autohide = ye_set_autohide( $autohide );
125
-
126
  // Create YouTube code
127
 
128
- $youtube_code = ye_generate_youtube_code( $content, $width, $height, ye_convert( $fullscreen ), ye_convert( $related ), ye_convert( $autoplay ), ye_convert( $loop ), $start, ye_convert( $info ), ye_convert_3( $annotation ), ye_convert( $cc ), $style, $stop, ye_convert( $disablekb ), $ratio, $autohide, $controls, $profile, $list, $template, $color, $theme, ye_convert( $responsive ), ye_convert( $search ), ye_convert( $user ), ye_convert( $modest ), ye_convert( $playsinline ), ye_convert( $html5 ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
  return apply_filters( 'a3_lazy_load_html', do_shortcode( $youtube_code ) );
131
  }
@@ -148,12 +175,49 @@ function ye_thumbnail_sc( $paras = '', $content = '' ) {
148
 
149
  extract( shortcode_atts( array( 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '', 'nolink' => '' ), $paras ) );
150
 
151
- return do_shortcode( ye_generate_thumbnail_code( $content, $style, $class, $rel, $target, $width, $height, $alt, $version, $nolink ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
152
 
153
  }
154
 
155
  add_shortcode( 'youtube_thumb', 'ye_thumbnail_sc' );
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  /**
158
  * Short URL shortcode
159
  *
@@ -202,17 +266,13 @@ function ye_video_download( $paras = '', $content = '' ) {
202
 
203
  $id = ye_extract_id( $id );
204
 
205
- // Check what type of video it is and whether it's valid
206
 
207
- $embed_type = ye_validate_id( $id );
208
 
209
- if ( $embed_type != 'v' ) {
210
 
211
- if ( strlen( $embed_type ) > 1 ) {
212
- return do_shortcode( ye_error( $embed_type ) );
213
- } else {
214
- return do_shortcode( ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) ) );
215
- }
216
 
217
  }
218
 
74
 
75
  function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_shortcode = false ) {
76
 
77
+ extract( shortcode_atts( array( 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'id' => '', 'url' => '', 'rel' => '', 'fs' => '', 'cc_load_policy' => '', 'iv_load_policy' => '', 'showinfo' => '', 'youtubeurl' => '', 'template' => '', 'list' => '', 'color' => '', 'theme' => '', 'dynamic' => '', 'responsive' => '', 'h' => '', 'w' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'html5' => '' ), $paras ) );
78
 
79
  // If no profile specified and an alternative shortcode used, get that shortcodes default profile
80
 
119
 
120
  if ( $responsive == '' ) { $responsive = $dynamic; }
121
 
 
 
 
 
122
  // Create YouTube code
123
 
124
+ $array = array(
125
+ 'id' => $content,
126
+ 'width' => $width,
127
+ 'height' => $height,
128
+ 'fullscreen' => ye_convert( $fullscreen ),
129
+ 'related' => ye_convert( $related ),
130
+ 'autoplay' => ye_convert( $autoplay ),
131
+ 'loop' => ye_convert( $loop ),
132
+ 'start' => $start,
133
+ 'info' => ye_convert( $info ),
134
+ 'annotation' => ye_convert_3( $annotation ),
135
+ 'cc' => ye_convert( $cc ),
136
+ 'style' => $style,
137
+ 'stop' => $stop,
138
+ 'disablekb' => ye_convert( $disablekb ),
139
+ 'ratio' => $ratio,
140
+ 'autohide' => ye_set_autohide( $autohide ),
141
+ 'controls' => $controls,
142
+ 'profile' => $profile,
143
+ 'list_style' => $list,
144
+ 'template' => $template,
145
+ 'color' => $color,
146
+ 'theme' => $theme,
147
+ 'responsive' => ye_convert( $responsive ),
148
+ 'search' => ye_convert( $search ),
149
+ 'user' => ye_convert( $user ),
150
+ 'modest' => ye_convert( $modest ),
151
+ 'playsinline' => ye_convert( $playsinline ),
152
+ 'html5' => ye_convert( $html5 )
153
+ );
154
+
155
+ $youtube_code = ye_generate_youtube_code( $array );
156
 
157
  return apply_filters( 'a3_lazy_load_html', do_shortcode( $youtube_code ) );
158
  }
175
 
176
  extract( shortcode_atts( array( 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '', 'nolink' => '' ), $paras ) );
177
 
178
+ $array = array(
179
+ 'id' => $content,
180
+ 'style' => $style,
181
+ 'class' => $class,
182
+ 'rel' => $rel,
183
+ 'target' => $target,
184
+ 'width' => $width,
185
+ 'height' => $height,
186
+ 'alt' => $alt,
187
+ 'version' => $version,
188
+ 'nolink' => $nolink
189
+ );
190
+
191
+ return do_shortcode( ye_generate_thumbnail_code( $array ) );
192
 
193
  }
194
 
195
  add_shortcode( 'youtube_thumb', 'ye_thumbnail_sc' );
196
 
197
+ /**
198
+ * Video Information Shortcode
199
+ *
200
+ * Shortcode to return video information
201
+ *
202
+ * @since 5.0
203
+ *
204
+ * @uses ye_generate_vinfo_code Generate the video information code
205
+ *
206
+ * @param string $paras Shortcode parameters
207
+ * @param string $content Shortcode content
208
+ * @return string Video information code
209
+ */
210
+
211
+ function ye_vinfo_sc( $paras = '', $content = '' ) {
212
+
213
+ extract( shortcode_atts( array( 'id' => '' ), $paras ) );
214
+
215
+ return do_shortcode( ye_generate_vinfo_code( $id, $content ) );
216
+
217
+ }
218
+
219
+ add_shortcode( 'vinfo', 'ye_vinfo_sc' );
220
+
221
  /**
222
  * Short URL shortcode
223
  *
266
 
267
  $id = ye_extract_id( $id );
268
 
269
+ // Extract the API data
270
 
271
+ $data = ye_get_api_data( $id );
272
 
273
+ if ( $data[ 'type' ] != 'v' or !$data[ 'valid' ] ) {
274
 
275
+ return do_shortcode( ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) ) );
 
 
 
 
276
 
277
  }
278
 
js/._iframeResizer.js ADDED
Binary file
js/._iframeResizer.min.js ADDED
Binary file
js/._jquery.fitvids.js ADDED
Binary file
js/._mce4-button.js ADDED
Binary file
js/._mce4-button.min.js ADDED
Binary file
js/mce4-button.js CHANGED
File without changes
js/mce4-button.min.js CHANGED
File without changes
languages/._youtube-embed.mo ADDED
Binary file
languages/._youtube-embed.po ADDED
Binary file
languages/youtube-embed.mo CHANGED
Binary file
languages/youtube-embed.po CHANGED
@@ -2,8 +2,8 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Vixy YouTube Embed\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2016-05-05 13:20-0000\n"
6
- "PO-Revision-Date: 2016-05-05 13:20-0000\n"
7
  "Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
8
  "Language-Team: \n"
9
  "Language: en_GB\n"
@@ -17,7 +17,7 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
 
20
- #: includes/add-scripts.php:115 includes/admin-config.php:86
21
  #: includes/generate-widgets.php:25
22
  msgid "YouTube Embed"
23
  msgstr ""
@@ -26,11 +26,11 @@ msgstr ""
26
  msgid "Options"
27
  msgstr ""
28
 
29
- #: includes/add-scripts.php:127 includes/admin-config.php:92
30
  msgid "Profiles"
31
  msgstr ""
32
 
33
- #: includes/add-scripts.php:134 includes/admin-config.php:100
34
  msgid "Lists"
35
  msgstr ""
36
 
@@ -42,56 +42,52 @@ msgstr ""
42
  msgid "Support"
43
  msgstr ""
44
 
45
- #: includes/admin-config.php:55
46
- msgid "Donate"
47
- msgstr ""
48
-
49
- #: includes/admin-config.php:86
50
  msgid "About YouTube Embed"
51
  msgstr ""
52
 
53
- #: includes/admin-config.php:92 includes/options-profiles.php:116
54
  msgid "YouTube Embed Profiles"
55
  msgstr ""
56
 
57
- #: includes/admin-config.php:100 includes/options-lists.php:103
58
  msgid "YouTube Embed Lists"
59
  msgstr ""
60
 
61
- #: includes/admin-config.php:108
62
  msgid "3rd Party Plugins"
63
  msgstr ""
64
 
65
- #: includes/admin-config.php:116
66
  msgid "Video Overlay Ads"
67
  msgstr ""
68
 
69
- #: includes/admin-config.php:123 includes/options-plugins.php:39
70
  msgid "Video SEO"
71
  msgstr ""
72
 
73
- #: includes/admin-config.php:131
74
  msgid "General Settings"
75
  msgstr ""
76
 
77
- #: includes/admin-config.php:211 includes/admin-config.php:233
78
- #: includes/admin-config.php:255 includes/admin-config.php:277
79
  msgid "Help"
80
  msgstr ""
81
 
82
- #: includes/admin-config.php:213 includes/admin-config.php:235
83
- #: includes/admin-config.php:257
84
  msgid "Links"
85
  msgstr ""
86
 
87
- #: includes/admin-config.php:299
88
  msgid ""
89
  "This screen allows you to select non-specific options for the YouTube Embed "
90
  "plugin. For the default embedding settings, please select the <a href="
91
  "\"admin.php?page=ye-profile-options\">Profiles</a> administration option."
92
  msgstr ""
93
 
94
- #: includes/admin-config.php:304
95
  msgid ""
96
  "This screen allows you to set the options for the default and additional "
97
  "profiles. If you don't specify a specific parameter when displaying your "
@@ -100,28 +96,28 @@ msgid ""
100
  "required."
101
  msgstr ""
102
 
103
- #: includes/admin-config.php:305
104
  msgid ""
105
  "All settings will work whether the Flash or HTML5 player is used, unless one "
106
  "of the following icons is shown, indicating which format the option works "
107
  "with..."
108
  msgstr ""
109
 
110
- #: includes/admin-config.php:306
111
  msgid "Flash player"
112
  msgstr ""
113
 
114
- #: includes/admin-config.php:307
115
  msgid "HTML5 player"
116
  msgstr ""
117
 
118
- #: includes/admin-config.php:312
119
  msgid ""
120
  "This screen allows you to create lists of YouTube videos, which may be "
121
  "named. These lists can then be used in preference to a single video ID."
122
  msgstr ""
123
 
124
- #: includes/admin-config.php:317
125
  msgid ""
126
  "This screen lists plugins which have all been tested for compatibility with "
127
  "YouTube Embed (and in some cases, specific changes have been made by their "
@@ -129,47 +125,47 @@ msgid ""
129
  "even install the plugins (where hosted at WordPress.org)."
130
  msgstr ""
131
 
132
- #: includes/admin-config.php:318
133
  msgid ""
134
  "NB. Inclusion here does not provide any guarantee for third party software, "
135
  "which includes any support."
136
  msgstr ""
137
 
138
- #: includes/admin-config.php:319
139
  msgid ""
140
  "Some of these plugins will also appear under the YouTube Admin "
141
  "administration menu, once activated."
142
  msgstr ""
143
 
144
- #: includes/admin-config.php:323
145
  msgid ""
146
  "Remember to click the Save Changes button at the bottom of the screen for "
147
  "any changes to take effect."
148
  msgstr ""
149
 
150
- #: includes/admin-config.php:328
151
  msgid "For more information:"
152
  msgstr ""
153
 
154
- #: includes/admin-config.php:329
155
  msgid "YouTube Embed Plugin Documentation"
156
  msgstr ""
157
 
158
- #: includes/admin-config.php:332
159
  msgid "YouTube Player Documentation"
160
  msgstr ""
161
 
162
- #: includes/admin-config.php:432
163
  msgid ""
164
  "For some reason the shortcode <strong>[youtube]</strong> is not working on "
165
  "the main site"
166
  msgstr ""
167
 
168
- #: includes/admin-config.php:435
169
  msgid "An alternative plugin is using the <strong>[youtube]</strong> shortcode"
170
  msgstr ""
171
 
172
- #: includes/admin-config.php:442
173
  msgid ""
174
  ", possibly the <a href=\"admin.php?page=jetpack_modules&activated=true"
175
  "\">Shortcode Embeds module</a> in Jetpack"
2
  msgstr ""
3
  "Project-Id-Version: Vixy YouTube Embed\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-02-04 12:49-0000\n"
6
+ "PO-Revision-Date: 2016-02-04 12:49-0000\n"
7
  "Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
8
  "Language-Team: \n"
9
  "Language: en_GB\n"
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
 
20
+ #: includes/add-scripts.php:115 includes/admin-config.php:85
21
  #: includes/generate-widgets.php:25
22
  msgid "YouTube Embed"
23
  msgstr ""
26
  msgid "Options"
27
  msgstr ""
28
 
29
+ #: includes/add-scripts.php:127 includes/admin-config.php:91
30
  msgid "Profiles"
31
  msgstr ""
32
 
33
+ #: includes/add-scripts.php:134 includes/admin-config.php:99
34
  msgid "Lists"
35
  msgstr ""
36
 
42
  msgid "Support"
43
  msgstr ""
44
 
45
+ #: includes/admin-config.php:85
 
 
 
 
46
  msgid "About YouTube Embed"
47
  msgstr ""
48
 
49
+ #: includes/admin-config.php:91 includes/options-profiles.php:116
50
  msgid "YouTube Embed Profiles"
51
  msgstr ""
52
 
53
+ #: includes/admin-config.php:99 includes/options-lists.php:103
54
  msgid "YouTube Embed Lists"
55
  msgstr ""
56
 
57
+ #: includes/admin-config.php:107
58
  msgid "3rd Party Plugins"
59
  msgstr ""
60
 
61
+ #: includes/admin-config.php:115
62
  msgid "Video Overlay Ads"
63
  msgstr ""
64
 
65
+ #: includes/admin-config.php:122 includes/options-plugins.php:39
66
  msgid "Video SEO"
67
  msgstr ""
68
 
69
+ #: includes/admin-config.php:130
70
  msgid "General Settings"
71
  msgstr ""
72
 
73
+ #: includes/admin-config.php:210 includes/admin-config.php:232
74
+ #: includes/admin-config.php:254 includes/admin-config.php:276
75
  msgid "Help"
76
  msgstr ""
77
 
78
+ #: includes/admin-config.php:212 includes/admin-config.php:234
79
+ #: includes/admin-config.php:256
80
  msgid "Links"
81
  msgstr ""
82
 
83
+ #: includes/admin-config.php:298
84
  msgid ""
85
  "This screen allows you to select non-specific options for the YouTube Embed "
86
  "plugin. For the default embedding settings, please select the <a href="
87
  "\"admin.php?page=ye-profile-options\">Profiles</a> administration option."
88
  msgstr ""
89
 
90
+ #: includes/admin-config.php:303
91
  msgid ""
92
  "This screen allows you to set the options for the default and additional "
93
  "profiles. If you don't specify a specific parameter when displaying your "
96
  "required."
97
  msgstr ""
98
 
99
+ #: includes/admin-config.php:304
100
  msgid ""
101
  "All settings will work whether the Flash or HTML5 player is used, unless one "
102
  "of the following icons is shown, indicating which format the option works "
103
  "with..."
104
  msgstr ""
105
 
106
+ #: includes/admin-config.php:305
107
  msgid "Flash player"
108
  msgstr ""
109
 
110
+ #: includes/admin-config.php:306
111
  msgid "HTML5 player"
112
  msgstr ""
113
 
114
+ #: includes/admin-config.php:311
115
  msgid ""
116
  "This screen allows you to create lists of YouTube videos, which may be "
117
  "named. These lists can then be used in preference to a single video ID."
118
  msgstr ""
119
 
120
+ #: includes/admin-config.php:316
121
  msgid ""
122
  "This screen lists plugins which have all been tested for compatibility with "
123
  "YouTube Embed (and in some cases, specific changes have been made by their "
125
  "even install the plugins (where hosted at WordPress.org)."
126
  msgstr ""
127
 
128
+ #: includes/admin-config.php:317
129
  msgid ""
130
  "NB. Inclusion here does not provide any guarantee for third party software, "
131
  "which includes any support."
132
  msgstr ""
133
 
134
+ #: includes/admin-config.php:318
135
  msgid ""
136
  "Some of these plugins will also appear under the YouTube Admin "
137
  "administration menu, once activated."
138
  msgstr ""
139
 
140
+ #: includes/admin-config.php:322
141
  msgid ""
142
  "Remember to click the Save Changes button at the bottom of the screen for "
143
  "any changes to take effect."
144
  msgstr ""
145
 
146
+ #: includes/admin-config.php:327
147
  msgid "For more information:"
148
  msgstr ""
149
 
150
+ #: includes/admin-config.php:328
151
  msgid "YouTube Embed Plugin Documentation"
152
  msgstr ""
153
 
154
+ #: includes/admin-config.php:331
155
  msgid "YouTube Player Documentation"
156
  msgstr ""
157
 
158
+ #: includes/admin-config.php:431
159
  msgid ""
160
  "For some reason the shortcode <strong>[youtube]</strong> is not working on "
161
  "the main site"
162
  msgstr ""
163
 
164
+ #: includes/admin-config.php:434
165
  msgid "An alternative plugin is using the <strong>[youtube]</strong> shortcode"
166
  msgstr ""
167
 
168
+ #: includes/admin-config.php:441
169
  msgid ""
170
  ", possibly the <a href=\"admin.php?page=jetpack_modules&activated=true"
171
  "\">Shortcode Embeds module</a> in Jetpack"
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === YouTube Embed ===
2
  Contributors: dartiss
3
- Donate link: http://artiss.co.uk/donate
4
- Tags: download, embed, embedding, iframe, media, play, playlist, responsive, seo, video, widget, youtube
5
  Requires at least: 3.9
6
- Tested up to: 4.5.1
7
- Stable tag: 4.3.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -12,43 +12,67 @@ A simple to use method of embedding responsive YouTube videos into your posts an
12
 
13
  == Description ==
14
 
15
- **Version 4 removes a number of existing features. If you're upgrading from a previous version, please [click here](http://www.artiss.co.uk/youtube-embed-removed-features "Removed Features") for further details. If you were using the widget feature then please head to the FAQ before proceeding.**
16
 
17
- YouTube Embed is an incredibly simple, yet powerful, method of embedding YouTube videos into your WordPress site. Options include:
 
 
18
 
19
- * XHTML and HTML5 compliant - works with all the latest browsers
20
- * Dynamic video sizing for responsive sites
21
  * Build your own playlists and play them back however you want
22
  * Automatically generate playlists based on user name or search text
23
  * Create multiple profiles - use them for different videos to get the exact style that you want
24
- * Google compatible metadata is added to the video output - great for SEO!
25
- * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [get in touch](http://www.artiss.co.uk/plugin-contact "Contact")**
 
26
  * Support for Do Not Track
27
  * Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress"), [a3 lazy load](https://wordpress.org/plugins/a3-lazy-load/ "a3 lazy load") and [WordPress Video Overlay Ads](https://wordpress.org/plugins/video-overlay-ads/ "WordPress Video Overlay Ads") and many more. In the case of Video SEO and WordPress Video Overlay Ads, their options will even appear under the YouTube Embed menu for total simplicity!
28
  * Use [Turn Off The Lights](https://www.turnoffthelights.com/ "Turn Off The Lights")? This plugin works with it beautifully.
29
  * [iFrame Resizer](https://github.com/davidjbradshaw/iframe-resizer "iFrame Resizer") and [FitVids.js](https://github.com/davatron5000/FitVids.js "FitVids.js") supported to improve content resizing
30
- * Works "out of the box" with 4K, 60FPS and Chromecast - stream your embedded videos to your TV!
31
  * And much, much more!
32
 
33
- There are no premium features and no adverts - this is 100% complete and free! See the "Other Notes" tab for how to get started as well as the more advanced features. How easy is it to use? The fine people at [Webucator](https://www.webucator.com "Webucator") have put together an excellent video showing you how to get started with it..
 
 
 
 
34
 
35
- https://www.youtube.com/watch?v=Wc7cvpQS-xQ
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  == Getting Started ==
38
 
39
- To add a video to a post or page simply use the shortcode `[youtube]video[/youtube]`, where `video` is the ID or URL of the video. Alternatively, you can add one (or more) widgets to your sidebar.
 
 
40
 
41
- Within the administration area, click on YouTube Embed and then General Settings to view and edit default generic settings for the plugin. Also under the `YouTube Embed` menu (see screenshot 1) you can click on the `Profiles` sub-menu to set the default options which define the output of your videos. Any videos you display (unless overridden by parameters - more on that later) will use the settings from the Profiles screen.
42
 
43
- Although this document contains a lot of information more is available from a series of linked pages, plus as much information as possible is provided on the various administration pages. Whilst on the administration pages, click on the "Help" button in the top right for some useful tips and links. If anything isn't covered and you're unsure of what it does please ask [on the forum](https://wordpress.org/support/plugin/youtube-embed "WordPress Plugins Forum").
44
 
45
- == Advanced embedding options ==
 
 
 
 
 
 
46
 
47
  A basic shortcode will embed your video using your default profile settings. However, you may wish to override some of these options on a video-by-video basis - this is done via parameters added to the shortcode.
48
 
49
  e.g. `[youtube width=300 height=200]Z_sCoHGIpU0[/youtube]`
50
 
51
- Which options are available depends upon the embedding type you're using as well as the viewers set-up (for example, whether they have Flash installed or not). You can specify any of the parameters but they may be ignored. Please see the Profile screen in Administration for details of which parameters are supported by which embed method.
52
 
53
  * **annotation** - yes or no, this determines if annotations are shown
54
  * **autohide** - 0, 1 or 2, this parameter indicates whether the video controls will automatically hide after a video begins playing. The default behaviour, a value of 2, is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible. If this parameter is set to 0, the video progress bar and the video player controls will be visible throughout the video. If this parameter is set to 1, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
@@ -57,7 +81,7 @@ Which options are available depends upon the embedding type you're using as well
57
  * **color** - white or red, the colour of the progress bar (see the FAQ about having a white progress bar with the light theme)
58
  * **controls** - 0, 1 or 2, this decides whether the controls should display and when the Flash will load. A value of 0 will not show the controls but 1 or 2 will. A value of 2 will load Flash once the user initiates playback - otherwise it's loaded straight away.
59
  * **disablekb** - yes or no, disable keyboard controls
60
- * **fullscreen** - yes or no, this will add the fullscreen button to the toolbar. This also works with EmbedPlus.
61
  * **height** - the video height, in pixels
62
  * **html5** - yes or no, whether to force HTML5 as the default player or not (if available). NB: This is an undocumented feature and, as such, may not work
63
  * **info** - yes or no, show video information. If displaying a playlist this will show video thumbnails
@@ -80,18 +104,18 @@ Which options are available depends upon the embedding type you're using as well
80
 
81
  == Alternative Shortcodes ==
82
 
83
- Within administration, selecting `General Settings` from the `YouTube Embed` menu will provide a list of general options. One option is named `Alternative Shortcode` and allows you to specify another shortcode that will work exactly the same as the standard shortcode of `[youtube]`.
84
 
85
  There are 2 reasons why you might want to do this...
86
 
87
- 1. If migrating from another plugin, it may use a different shortcode - more details can be found in the section named "Migration"
88
  2. If another plugin uses the same shortcode (e.g. Jetpack) this will allow you to specify and use an alternative
89
 
90
  The new shortcode can also have its own default profile assigned to it (see the Profiles section for more details on this).
91
 
92
  == Widgets ==
93
 
94
- Widgets can be easily added. In Administration simply click on the `Widgets` option under the `Appearance` menu. `YouTube Embed` will be one of the listed widgets. Drag it to the appropriate sidebar on the right hand side and then choose your video options - any that aren't specified are taken from your supplied profile.
95
 
96
  If you wish to display an automatically generated playlist based on user name or search term, simply change the "ID Type" appropriately and then specify the name or search word(s) where the video ID would normally be entered.
97
 
@@ -99,19 +123,11 @@ And that's it! You can use unlimited widgets, so you can add different videos to
99
 
100
  == Playlists ==
101
 
102
- YouTube allows users to create their own playlists - collections of videos that can be played in sequence.
103
-
104
- YouTube used to supply Playlist IDs as 16 digits and these can still be used...
105
-
106
- e.g. `[youtube]095393D5B42B2266[/youtube]`
107
-
108
- Alternatively, if you're using a newer, non-16 digit ID then append 'PL' to the beginning.
109
 
110
  e.g. `[youtube]PLVTLbc6i-h_iuhdwUfuPDLFLXG2QQnz-x[/youtube]`
111
 
112
- Playlists cannot be used along with the EmbedPlus embedding method.
113
-
114
- A better alternative to playlists is the build-in lists function in YouTube Embed - see the Lists section for further details.
115
 
116
  == Templates ==
117
 
@@ -121,13 +137,11 @@ The template consists simply of any HTML that you wish but with `%video%` where
121
 
122
  e.g. `<div align="center">%video%</div>`
123
 
124
- Be wary that when adding template via a parameter that any HTML included may cause your video to have `<pre>` tags wrapped around it. The easiest way to check and fix this is to view any post in the HTML editor and remove any PRE tags that have been added.
125
-
126
  == Profiles ==
127
 
128
- You've probably already had a look at the default profile, accessible by selecting `Profiles` from the `YouTube Embed` administration menu option. Here you can specify the default option which will apply to any embedded video.
129
 
130
- However, in the top right hand corner is a drop-down box and a button marked `Change profile`. Simply select an alternative profile and click the button and you can then edit the options for this alternative profile. You can even name it as well.
131
 
132
  To use this profile, simply use the parameter `profile=` followed by the profile name or number. The options for this profile will then be used.
133
 
@@ -137,11 +151,11 @@ By default you have 5 extra profiles - if you wish to have more (or less) this n
137
 
138
  == Lists ==
139
 
140
- Although this plugin will play standard YouTube playlists their playback options are limited. Instead you can create your own video lists. Under the `YouTube Embed` administration menu is a sub-menu named `Lists`. Select this and you will be shown a screen where you can type in a list of video IDs (or URLS). You can also provide a name for the list.
141
 
142
  When saving the list each video is validated.
143
 
144
- As with profiles you can select the list from a drop down in the top right-hand corner. You can also change the number of lists from the `Options` sub-menu too.
145
 
146
  To use a list, simply specify the list name or number instead of a video ID, as well as a parameter to specify how you wish the list to be played back.
147
 
@@ -165,69 +179,65 @@ There are no guarantees with these and no support of their specific functionalit
165
 
166
  == Thumbnails ==
167
 
168
- YouTube embed also has the ability to return a thumbnail of a video (sorry, this doesn't work with playlists). There are two methods you can use for this - a shortcode or a function call.
169
 
170
- Use the function call `youtube_thumb_embed( 'id', 'paras', '', 'alt', 'nolink' )` to add a thumbnail to any part of your theme.
171
-
172
- Like the video embed equivalent, the `id` is the video ID and `alt` is the alternative text for the thumbnail image (optional). `nolink`, if set to `true`, will output the thumbnail without a link to the YouTube video, allowing you to add your own.
173
-
174
- The parameters are different, however, but, again, are separated by ampersand.
175
 
176
- The parameters are as follows...
177
 
 
178
  * **rel** - specify a REL override, e.g. rel="nofollow"
179
  * **target** - specify a TARGET override, e.g. target="_blank"
180
  * **width** - this specifies the width of the thumbnail image
181
  * **height** - this specifies the height of the thumbnail image
182
- * **version** - which version of the thumbnail to use. This can be `default`, `hq` (for a high quality version of the default image), `start`, `middle` or `end`. The latter 3 indicate where from the video the thumbnails are taken from
183
-
184
- e.g. `youtube_thumb_embed( 'id', 'rel=nofollow&target=_blank', '', 'Demo Video' )`
185
-
186
- To use the shortcode method, insert `[youtube_thumb]id[/youtube_thumb]` into a post or page to create a thumbnail of the relevant video ID which, once clicked, will open up the appropriate YouTube page.
187
-
188
- Like the function call above, you can specify a number of parameters. They are the same as detailed above but with the addition of one further parameter...
189
-
190
- * **alt** - specify some `ALT` text for the thumbnail image
191
 
192
  e.g. `[youtube_thumb target="_blank" alt="Demo video"]id[/youtube_thumb]`
193
 
194
  This overrides the `TARGET` and `ALT` elements of the thumbnail.
195
 
196
- You can also use `nolink` as a parameter with the shortcode, which works in the same way as with the function call.
197
-
198
  == Shortened URL ==
199
 
200
- You may return a short URL for any YouTube video by way of either a function call or a shortcode.
201
-
202
- For a function call add `youtube_short_url( 'id' )` to your code to return a URL (note that this is not written out, but returned as a value), where `id` is the video ID.
203
 
204
- e.g. `<a href="<?php echo youtube_short_url( 'Z_sCoHGIpU0' ); ?>"Click here for video</a>`
205
 
206
- This will create a link to a video using the short URL standard.
207
 
208
- To use the shortcode method simply insert `[youtube_url id=xx]` anywhere within a post to return a shortened URL. `xx` is the ID of the video.
209
 
210
- == Downloading Videos ==
 
 
211
 
212
- If you wish your users to be able to download a YouTube video or playlist then you can do this automatically or manually via either a shortcode of PHP function call.
213
 
214
- In the Profiles screen within administration there is an option to automatically show a download link. You can specify some text or HTML to display as well as CSS.
215
 
216
- If you'd prefer to do this manually then the function call is named `get_video_download` and has one parameter - the video ID. It will return the download link URL.
217
 
218
- e.g. `<a href="<?php echo get_video_download( 'Z_sCoHGIpU0' ); ?>">Download the video</a>`
 
 
 
 
 
 
 
 
 
219
 
220
- Alternatively, you can use the shortcode `download_video`. The content to link is specified between the open and close shortcode tags and there are 3 parameters...
221
 
222
- * **id** - The ID of the video or playlist. This is required.
223
- * **target** - The target of the link (e.g. `_blank`). This is optional.
224
- * **nofollow** - yes or no, use this to specify whether a `nofollow` tag should be added to the link. This is optional and by default it will be included.
225
 
226
- e.g. `[download_video id="Z_sCoHGIpU0" target="_blank"]Download the video[/download_video]`
227
 
228
  == Further Embedding Options ==
229
 
230
- Under the `YouTube Embed` administration menu is a sub-menu named `General Settings`. Select this and find the section named `Embedding`. There are 2 options here...
231
 
232
  1. Add Metadata - by default, RDFa metadata is added to video output. This can be switched on or off as required (see the FAQs for more information about metadata usage).
233
  2. Feed - videos will not appear in feeds so use this option to decide whether you want them to be converted to links and/or thumbnails.
@@ -242,27 +252,18 @@ In some cases activating these plugins will cause their settings screen to also
242
 
243
  If you'd like your own plugin adding to this list then please [get in touch](http://www.artiss.co.uk/plugin-contact "Contact").
244
 
245
- == Reviews & Mentions ==
246
-
247
- [Your YouTube Plugin is fantastic-it just saved my life on this site. Thank you!](https://twitter.com/AaronWatters/status/237957701605404672?uid=16257815&iid=am-130280753913455685118891763&nid=4+248 "Twitter - Aaron Watters") - Sonic Clamp.
248
-
249
- [New Technology Finds The Most Buzzed-About Parts Of Videos](http://www.socialtimes.com/2011/03/new-technology-finds-the-most-buzzed-about-parts-of-videos-interview/ "New Technology Finds The Most Buzzed-About Parts Of Videos") - SocialTimes.
250
-
251
- [Andesch tips on WordPress plugins!](http://andershagstrom.se/andesch-tipsar-om-wordpress-plugins/ "Andesch tipsar om WordPress-plugins!") - Anders.
252
-
253
- [Critical Mass](http://www.bikinginmemphis.com/2011/03/26/critical-mass/ "Critical Mass") - Biking in Memphis.
254
-
255
  == Installation ==
256
 
257
- YouTube Embed can be found and installed via the Plugin menu within WordPress administration. Alternatively, it can be downloaded and installed manually...
 
 
 
258
 
259
- 1. Upload the entire `youtube-embed` folder to your wp-content/plugins/ directory.
260
- 2. Activate the plugin through the 'Plugins' menu in WordPress.
261
- 3. Now you can add the shortcode to your posts and pages!
262
 
263
  == Frequently Asked Questions ==
264
 
265
- = I've upgraded to version 4.0+ from an earlier version and I was using the widget feature to display videos =
266
 
267
  I previously allowed some, although not all, parameters to be specified within the widget. However, as you can simply create your own profile for widgets I have removed this and, without leaving lots of redundant code behind, it was difficult to keep this backwards compatible.
268
 
@@ -329,8 +330,25 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
329
 
330
  == Changelog ==
331
 
332
- = 4.3.5 =
333
- * Maintenance: Updated branding, inc. adding donation links
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
 
335
  = 4.3.4 =
336
  * Bug: Fixed issue with 3 hyphens in a video ID being converted to &#8212;
@@ -395,7 +413,7 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
395
  * Enhancement: If another plugin is using the same shortcode as this I now output a prompt in the admin area. Also added a setting to turn off this prompt just in case you're using the secondary shortcode and are happy for this.
396
  * Enhancement: Re-written code for help screens, including adding more information and additional tabs.
397
  * Maintenance: Moved the settings page to, well, the Settings menu option. It makes sense.
398
- * Maintenence: Removed the enable of the JS API, which is now deprecated.
399
  * Maintenance: Improved the admin screen output code - had made it more WordPress standard in version 4 but got some of the code wrong.
400
 
401
  = 4.0.2 =
@@ -484,402 +502,8 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
484
  * Enhancement: Simplified the menu access rules which has resulted in resolving a number of existing issues
485
  * Bug: Fixed PHP error when allowing shortcodes in widgets
486
 
487
- = 2.7 =
488
- * Maintenance: Using new website for video download link
489
- * Maintenance: README updated with new compatibility details and modified FAQs
490
- * Bug: Fixed a bug where some option screen text was not displaying
491
- * Bug: Fixed the feature pointer, which was no longer working
492
- * Enhancement: Added profile options to allow you to switch on video download link, as well as style the output
493
-
494
- = 2.6.2 =
495
- * Bug: Fixed bug in uninstall routine
496
- * Enhancement: Replaced user of print_r in cache key generator with serialize, as this can cause problems with some hosting configurations
497
-
498
- = 2.6.1 =
499
- * Bug: Fixed minimised script that adds editor button
500
- * Bug: Updated broken advert links
501
- * Bug: Fixed link in admin bar when using WP 3.1 - 3.3
502
- * Bug: Removed un-necessary cookie update that was causing errors in some situations
503
- * Maintenance: Updated WP 3.3+ admin bar options to correctly reflect permissions, naming and ordering of equivalent admin menu
504
-
505
- = 2.6 =
506
- * Bug: Fixed a bug that means videos have zero width on new installations until the default profile is updated (thanks to Aidan from [Noise Republic](http://www.noiserepublic.co.uk "Noise Republic") for reporting that)
507
- * Bug: Corrected URLs pointing to help screens
508
- * Bug: Resolved issue where translated IDs were not corrected if included in a URL (thanks to kchayka for reporting that)
509
- * Bug: Fixed problem where video ID is not found in full URL if not specified first (thanks to christopherw for reporting that)
510
- * Bug: Modest branding profile switch wasn't doing anything - the option was hard-coded on. Now corrected
511
- * Bug: User defined error message now decodes correctly (thanks to kchayka for reporting that)
512
- * Bug: No longer caches the video output if a random playlist has been selected
513
- * Maintenance: Updated advertisement engine code
514
- * Maintenance: Renamed README menu to Instructions
515
- * Maintenance: Assorted on-screen wording improvements
516
- * Maintenance: Removed title option as it's un-supported
517
- * Maintenance: Updated the uninstall routine
518
- * Maintenance: Cleaned code and updated translation files
519
- * Enhancement: Added Do Not Track compatibility. Once active, if user has Do Not Track in use then cookies will not be stored
520
- * Enhancement: New option to specify the shortcode that the editor button uses. A cookie is used to store this
521
- * Enhancement: New option to switch on shortcodes in widgets. This will allow all shortcodes in widgets, though, not just those for this plugin
522
- * Enhancement: Reviewed and updated access right to admin screen. Added option to choose what level has access to profiles and/or lists screen
523
- * Enhancement: Many functions were only activated if user was not in Administration screens. However, using AJAX on your site triggers the administration flag and, hence, the functions would not work. Changed this
524
- * Enhancement: Added option to modify access to Profile and Lists screen
525
- * Enhancement: Improved the cache clearing option and statistics
526
- * Enhancement: Reflected on profile screen that modest branding now works with HTML5 player
527
- * Enhancement: Added option to thumbnail output to suppress the link, so that you can add your own
528
- * Enhancement: Updated "Controls" option to support new third parameter and update definitions. Ensured backwards compatibility with old parameter options
529
-
530
- = 2.5.6 =
531
- * Maintenance: Restricted access to Options and Profiles screen to administrators
532
- * Bug: Fixed bug which caused errors to be generated on new installations of plugin
533
- * Enhancement: Set a default width if the `content_width` global variable is set to zero
534
-
535
- = 2.5.5 =
536
- * Maintenance: Updated sponsorship - now includes option to switch off if user has donated
537
- * Maintenance: Updated options screen to reflect the fact that the `related` and `color` parameters are now supported by the HTML5 player
538
- * Maintenance: Updated options screen to show that the `info` parameter, if used alongside a playlist will show thumbnails of the videos
539
- * Maintenance: Removed redundant GA code, which was never used
540
- * Maintenance: Combined scripts
541
- * Bug: Fixed internationalisation
542
- * Bug: Fixed output of video information on the Lists option screen
543
- * Bug: Modified cache key so that length does not exceed MySQL field maximum
544
- * Bug: Added close anchor for media meta - causes unclosed anchor under IE9 (thanks to Marcel Bootsman for identifying this)
545
- * Bug: Responsive video was not working on a demonstration video in Profile screen
546
-
547
- = 2.5.4 =
548
- * Bug: Fixed bug that prevented some fields in options screens to not save
549
-
550
- = 2.5.3 =
551
- * Bug: Fixed further issues with the widget code (thanks to Rose-Anne Constantineau for reporting it and helping me test the result)
552
- * Maintenance: Improved some of the internationalisation texts
553
- * Maintenance: Neatened up some of the code output
554
-
555
- = 2.5.2 =
556
- * Bug: Fixed a bug where widgets weren't showing single videos (thanks to Josh Callaghan for reporting this)
557
-
558
- = 2.5.1 =
559
- * Bug: Fixed a bug with Admin Bar when using WP 3.1 - 3.3 (thanks to Carl D'Halluin for finding this)
560
-
561
- = 2.5 =
562
- * Maintenance: Updated code to work with new playlist options
563
- * Maintenance: Removed embedded URL option due to issues with existing code (see FAQ for details)
564
- * Maintenance: Added further FAQs based on common forum queries
565
- * Maintenance: Wording on options screens changed to better identify differences between players
566
- * Maintenance: Added advertisement to profile screen
567
- * Maintenance: Modified demonstration video and made sponsorship request more visible
568
- * Maintenance: Changes the YouTube admin screen icon
569
- * Enhancement: Download link now uses deturl.com
570
- * Enhancement: Admin Bar link improved in WP 3.3 onwards
571
- * Enhancement: New user upload and search features added
572
- * Enhancement: Now supports ability to specify the time to stop video playback
573
- * Enhancement: Default windowing mode changed to improve performance
574
- * Enhancement: FRAMEBORDER is switchable for the purpose of HTML5 compatibility
575
- * Enhancement: Added internationalisation
576
- * Enhancement: README in admin menu now shows the corresponding README for the version of the plugin you have installed, rather than the latest one
577
- * Enhancement: Added option to admin screen to clear video cache (see FAQ for details)
578
- * Enhancement: Allow recursive shortcodes - that is, shortcodes within the YouTube shortcode
579
- * Bug: Fixed bug in retrieving the video title
580
- * Bug: Resolved various debug messages
581
- * Bug: Fixed bug in MCE button JavaScript
582
-
583
- = 2.4.1 =
584
- * Maintenance: Removed dashboard widget
585
-
586
- = 2.4 =
587
- * Maintenance: Re-sequenced the changelog in the README
588
- * Maintenance: Removed drop shadow option
589
- * Maintenance: Re-design of widgets, reducing number of parameters down to make it easier to use - use profiles to modify missing parameters
590
- * Maintenance: Updated YouTube icons
591
- * Enhancement: Added frameborder="0" to IFRAME code
592
- * Enhancement: Added Privacy-Enhanced mode. Doesn't work with Chromeless player.
593
- * Enhancement: Added `title` option, so you can name the video
594
- * Enhancement: Added `ssl` option, allowing you to override whether HTTP or HTTPS is used for the video
595
- * Enhancement: Added `dynamic` option (and matching Profile switch) to allow users to request dynamically resizing video (responsive). Additional option to allow specified width to be maximum
596
- * Enhancement: Made `modestbranding` a switchable option (switchable in profile options but not on video-by-video basis) due to issues with Apple devices
597
- * Enhancement: Improved matching of URL embedded into post
598
- * Enhancement: If you have the [README Parser plugin](http://wordpress.org/extend/plugins/wp-readme-parser/ "README Parser") installed then a new sub-menu will display the README instructions
599
- * Enhancement: Use WP 3.3 Feature Pointer to highlight new menu when plugin is activated
600
- * Bug: Ensure `showinfo` parameter is set correctly
601
- * Bug: If width or height is missing from Profile screen then fill it in based on widescreen format. Otherwise, causes video to break
602
- * Bug: Video information was being fetched from caching even if option selected to switch it off. Fixed!
603
-
604
- = 2.3.1 =
605
- * Maintenance: Removed the sponsorship
606
-
607
- = 2.3 =
608
- * Enhancement: Editor button will add text between shortcodes if no URL or ID is specified
609
- * Enhancement: Square brackets are stripped from alternative shortcodes on option screen - text added to warn against this too
610
- * Enhancement: Added Chromeless player option
611
- * Enhancement: Increased maximum output length of profile and list names to 30 characters
612
- * Bug: Fixed incorrect listing of long profile or list names
613
- * Bug: Fixed INCLUDE bug in widgets.php
614
-
615
- = 2.2 =
616
- * Maintenance: Updated dashboard widget to latest version
617
- * Maintenance: Added advertising banners to options screen - these can be turned off if you donate
618
- * Enhancement: Replace WP_PLUGIN_URL with plugins_url()
619
- * Enhancement: Added H and W as alternative shortcode parameters to HEIGHT and WIDTH
620
- * Enhancement: Editor button should appear for anyone from editor role upwards
621
- * Enhancement: Removed maximum length from profile and list names. However, only first 20 characters will appear in lists
622
-
623
- = 2.1 =
624
- * Enhancement: New option to switch API options (where HTTP or HTTPS, display messages or not or even switch off)
625
- * Enhancement: Output video playback errors as XHTML comments. Output to post a generic message which can be changed in the options
626
- * Enhancement: Video information is shown in lists screen when first entering (no need to press Save button to display)
627
- * Enhancement: Added new `color` parameter, which allows you to specify the color of the progress bar
628
- * Enhancement: Added new `theme` parameter, allowing you to specify if the player is dark or light skinned
629
- * Enhancement: Added new `https` parameter, allowing you to use HTTPS instead of HTTP for the video display
630
- * Enhancement: Added new `version` parameter to thumbnails, allowing different versions (including a high resolution one) to be displayed
631
- * Enhancement: Added new administration option to allow the thumbnail used in RSS feeds to be specified
632
- * Enhancement: Log the current plugin version into the database. This may be of use in future upgrades to detect which version the user is upgrading from
633
- * Bug: Fixed video title no longer being fetched since 2.0.3 (because of using v2 of API)
634
- * Bug: Fixed some error output - due to changes made in an earlier release some errors would not display
635
-
636
- = 2.0.4 =
637
- * Enhancement: Removed HTTPS access to gdata API - will add a switchable option for this in a later release
638
-
639
- = 2.0.3 =
640
- * Enhancement: Decode any passed `template` parameters, as WP may have encoded the content first
641
- * Enhancement: Improved file handling
642
- * Enhancement: Now using HTTPS and version 2 of YouTube gdata API
643
- * Enhancement: New general option to switch off reporting of API errors - will simply accept ID and work out type
644
- * Maintenance: Added details to the README to cover issues with `style` backwards compatibility and YouTube API
645
-
646
- = 2.0.2 =
647
- * Enhancement: Strip tags from video ID, in case any have crept in
648
- * Enhancement: Tidied some of the widget controls
649
- * Enhancement: You can now specify YouTube short URLs as video IDs
650
- * Bug: Removed reference to jscolor.js script, which isn't used
651
- * Bug: Video IDs beginning with numbers are being confused with list numbers
652
- * Bug: Corrected problem with random single videos being picked from a list
653
- * Bug: Fixed problem with list where one video was being ignored and another repeated
654
- * Bug: Modified widget code to allow for all states to be allowable. Defaults updated
655
- * Bug: YouTube documentation states that if you don't specify the fullscreen parameter it will default to off. It doesn't. Corrected in the code
656
-
657
- = 2.0.1 =
658
- * Enhancement: Changed cache key encoding so that it was compatible with PHP 4
659
- * Enhancement: Added autoplay option to EmbedPlus
660
- * Enhancement: Re-instated `style` option, allowing you to apply a direct set of CSS elements to the output - a requirement if you wish to add a border to the video, for instance
661
- * Maintenance: Updated screens and documentation to show the `start` parameter works with EmbedPlus
662
- * Bug: Fixed incorrect caching of options - was only changing if override parameters were modified
663
- * Bug: Video Information Cache will no longer reset to zero if the Embed cache is greater
664
- * Bug: Added random ID to EmbedPlus output to resolve a bug that can affect IE users
665
-
666
- = 2.0 =
667
- * Maintenance: Renamed to Artiss YouTube Embed from YouTube Embed
668
- * Maintenance: Major re-write, using new coding standards
669
- * Maintenance: AS3 player is now used, AS2 has been retired
670
- * Maintenance: Compliancy and browser checked - XHTML and HTML5 compliant and works in all the latest browsers
671
- * Maintenance: README completely re-written, contextual help added to admin screens and links to further information
672
- * Enhancement: New administration screens, introducing multiple profiles and playlists
673
- * Enhancement: Both OBJECT and IFRAME versions can be selected
674
- * Enhancement: Migration options added, allowing compatibility with other similar plugins
675
- * Enhancement: Can now specify full video URL as well as video ID
676
- * Enhancement: No need to use separate shortcode for playlists, as they are automatically detected. Video IDs are also now validated
677
- * Enhancement: Options to allow YouTube URLs not within shortcodes to be accepted, as well as in comments
678
- * Enhancement: RDFa metadata added to code output
679
- * Enhancement: Caching of code and ID checking to improve performance
680
- * Enhancement: Templating system replaces CSS specification
681
- * Enhancement: Improved editor button and link added to admin bar
682
- * Enhancement: Many, many more changes - too many to list!
683
-
684
- = 1.5 =
685
- * Enhancement: Added clone of 'youtube' shortcode, called 'youtube_video'
686
- * Enhancement: Editor now has YouTube button, which inserts the YouTube shortcode (this can be switched off in the options screen)
687
- * Enhancement: Added new option to disable keyboard controls
688
- * Enhancement: Added option to supply a ratio, in case height or width are not supplied - the missing parameter will then be calculated
689
- * Enhancement: Option to create a download link (for video and playlist) using function call or shortcode
690
- * Enhancement: You can now change on the options screen which set of parameters the demonstration video uses (i.e. "normal" or EmbedPlus). This allows you to try your options on a different video type without switching to it.
691
-
692
- = 1.4.2 =
693
- * Enhancement: Added keyboard disable option
694
- * Bug: Fixed bug which meant that people upgrading from previous versions may not be able to display video until they've been to the options screen and re-saved their default options
695
-
696
- = 1.4.1 =
697
- * Enhancement: HD option is available with EmbedPlus - updated the admin and widget screen to reflect this
698
-
699
- = 1.4 =
700
- * Maintenance: Tidied up code
701
- * Enhancement: Now supports multiple widgets - widget code completely re-written
702
- * Enhancement: Support for EmbedPlus added
703
- * Enhancement: Added option to suppress links back to YouTube
704
- * Enhancement: Added functions and shortcodes for returning and outputting available transcripts
705
-
706
- = 1.3.1 =
707
- * Enhancement: New widget option to specify title
708
-
709
- = 1.3 =
710
- * Enhancement: Added transparency option so that videos won't cover up layers
711
-
712
- = 1.2 =
713
- * Enhancement: Minor changes to the XHTML code to prevent warnings from certain validators
714
-
715
- = 1.1 =
716
- * Maintenance: Updated test video on options screen, as previous one had been removed
717
- * Maintenance: Confirmed WP 3.0 compatibility
718
- * Enhancement: Resulting XHTML code is better formatted, with comments identifying code location
719
-
720
- = 1.0 =
721
- * Initial release
722
-
723
  == Upgrade Notice ==
724
 
725
- = 4.3.5 =
726
- * Minor update to change branding
727
-
728
- = 4.3.4 =
729
- * Update to fix bug in video IDs with multiple hyphens
730
-
731
- = 4.3.3 =
732
- * Update to remove a malware-reported URL from the README
733
-
734
- = 4.3.2 =
735
- * Upgrade to fix a bug with manual lists being saved
736
-
737
- = 4.3.1 =
738
- * Upgrade to fix an urgent issue that can generate WordPress errors
739
-
740
- = 4.3 =
741
- * Upgrade to add a new third party plugin screen
742
-
743
- = 4.2.1 =
744
- * Important update to fix a bug with the template field
745
-
746
- = 4.2 =
747
- * Who needs caching when the code works this fast? It's now 365% quicker than version 4.1. Completely re-written core code for rip-roaring speed
748
-
749
- = 4.1 =
750
- * Loads and loads of new features. Because I love you all.
751
-
752
- = 4.0.2 =
753
- * Minor bug fixes
754
-
755
- = 4.0.1 =
756
- * Upgrade to remove some debug code
757
-
758
- = 4.0 =
759
- * Fixed, squeezed and reduced. Make sure you read the changelog before upgrading!
760
-
761
- = 3.3.5 =
762
- * Update with text domain, ready for automatic translation
763
-
764
- = 3.3.4 =
765
- * Assorted fixes and enhancements inc. (I hope) a fix to the editor button not working
766
-
767
- = 3.3.3 =
768
- * Fix to resolve multiple urgent issues
769
-
770
- = 3.3.2 =
771
- * An urgent fix to the urgent fix, due to a corrupt file
772
-
773
- = 3.3.1 =
774
- * Urgent fix to get videos displaying. Alternatively, switch off API in Options screen
775
-
776
- = 3.3 =
777
- * Update to fix assorted bugs and to remove the redundant Vixy branding
778
-
779
- = 3.2.1 =
780
- * Update to bring metadata up to latest standards and to fix playlist issue
781
-
782
- = 3.2 =
783
- * Update to add new features, including the ability to show a video's comments
784
-
785
- = 3.1 =
786
- * Update to add new features including video quality option
787
-
788
- = 3.0.1 =
789
- * Update to fix admin bar links and add some further security improvements
790
-
791
- = 3.0 =
792
- * Update for bug fixes and enhancements including a new video download option with affiliate scheme
793
-
794
- = 2.7 =
795
- * Update to fix some bugs and add minor new features
796
-
797
- = 2.6.2 =
798
- * Update to fix an uninstaller bug and a problem that may affect some hosts
799
-
800
- = 2.6.1 =
801
- * Update to fix some bugs introduced in 2.6
802
-
803
- = 2.6 =
804
- * Upgrade to implement numerous bug fixes and enhancements
805
-
806
- = 2.5.6 =
807
- * Upgrade to fix critical bug for new installations
808
-
809
- = 2.5.5 =
810
- * Upgrade for various bug fixes and maintenance updates
811
-
812
- = 2.5.4 =
813
- * Upgrade to fix an issue with options not updating
814
-
815
- = 2.5.3 =
816
- * Upgrade to fix issues with widgets
817
-
818
- = 2.5.2 =
819
- * Upgrade if you use widgets to display videos
820
-
821
- = 2.5.1 =
822
- * Upgrade if you are using a WordPress version before 3.3
823
-
824
- = 2.5 =
825
- * Upgrade to add a number of new features (including automatic generation of playlists based on user name or search term) and fix some bugs
826
-
827
- = 2.4.1 =
828
- * Upgrade to remove the dashboard widget
829
-
830
- = 2.4 =
831
- * Numerous improvements, including new option for responsive video output
832
-
833
- = 2.3.1 =
834
- * Upgrade to remove the sponsorship
835
-
836
- = 2.3 =
837
- * Assorted bug fixes and minor improvements. Also added Chromeless player.
838
-
839
- = 2.2 =
840
- * Assorted minor improvements
841
-
842
- = 2.1 =
843
- * New options to change player colors, chose your thumbnails and control API usage
844
-
845
- = 2.0.4 =
846
- * Fixed SSL bug by removing HTTPS access to API
847
-
848
- = 2.0.3 =
849
- * Removed secure API access as this was causing some users issues
850
-
851
- = 2.0.2 =
852
- * Further update to fix a few minor bugs found in 2.0. A few small enhancements have also been made
853
-
854
- = 2.0.1 =
855
- * Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
856
-
857
- = 2.0 =
858
- * Upgrade to take advantage of many new features. Code completely re-written
859
-
860
- = 1.5 =
861
- * Upgrade to add a number of new options including video size ratios, disabling keyboard controls, an editor button and different demonstration video options on the admin screen
862
-
863
- = 1.4.2 =
864
- * Upgrade is you upgraded to version 1.4 or 1.4.1 from a previous version, to fix an important bug
865
-
866
- = 1.4.1 =
867
- * Upgrade to make a small correction to the parameter lists
868
-
869
- = 1.4 =
870
- * Update to add EmbedPlus, multi-widgets and transcript output capabilities
871
-
872
- = 1.3.1 =
873
- * Update if you wish to change the widget heading
874
-
875
- = 1.3 =
876
- * Update if you find that the videos are covering up layers
877
-
878
- = 1.2 =
879
- * Update to ensure no warnings are reported by XHTML validators
880
-
881
- = 1.1 =
882
- * Update to get the test video on the options screen working again!
883
 
884
- = 1.0 =
885
- * Initial release
1
  === YouTube Embed ===
2
  Contributors: dartiss
3
+ Donate link: http://www.artiss.co.uk/donate
4
+ Tags: embed, insert, video, youtube
5
  Requires at least: 3.9
6
+ Tested up to: 4.6
7
+ Stable tag: 5.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
12
 
13
  == Description ==
14
 
15
+ **Version 5 is here! Now with API access to further improve the rich metadata but also the output caching has returned to make this plugin the fasted method to embed YouTube videos around!**
16
 
17
+ YouTube Embed is an incredibly fast, simple, yet powerful, method of embedding YouTube videos into your WordPress site.
18
+
19
+ Key features include...
20
 
 
 
21
  * Build your own playlists and play them back however you want
22
  * Automatically generate playlists based on user name or search text
23
  * Create multiple profiles - use them for different videos to get the exact style that you want
24
+ * Dynamic video sizing for responsive sites
25
+ * Housekept caching keeps the code generation nimble and your database tables slimline
26
+ * Google compatible metadata is added to the video output based on data provided by the YouTube API - great for SEO!
27
  * Support for Do Not Track
28
  * Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress"), [a3 lazy load](https://wordpress.org/plugins/a3-lazy-load/ "a3 lazy load") and [WordPress Video Overlay Ads](https://wordpress.org/plugins/video-overlay-ads/ "WordPress Video Overlay Ads") and many more. In the case of Video SEO and WordPress Video Overlay Ads, their options will even appear under the YouTube Embed menu for total simplicity!
29
  * Use [Turn Off The Lights](https://www.turnoffthelights.com/ "Turn Off The Lights")? This plugin works with it beautifully.
30
  * [iFrame Resizer](https://github.com/davidjbradshaw/iframe-resizer "iFrame Resizer") and [FitVids.js](https://github.com/davatron5000/FitVids.js "FitVids.js") supported to improve content resizing
31
+ * Works "out of the box" with 4K, 60FPS and Chromecast - stream your embedded videos to your TV!
32
  * And much, much more!
33
 
34
+ Technical specification...
35
+
36
+ * Designed for both single and multi-site installations
37
+ * PHP7 compatible
38
+ * Fully internationalized, ready for translations! If you would like to add a translation to his plugin then please head to our [Translating WordPress](https://translate.wordpress.org/projects/wp-plugins/youtube-embed “Translating WordPress”) page
39
 
40
+ But, most importantly, there are no premium features and no adverts - this is 100% complete and free! See the "Other Notes" tab for how to get started as well as the more advanced features, including how to specify an API key to unlock the maximum number of features!
41
+
42
+ How easy is it to use? The fine people at [Webucator](https://www.webucator.com "Webucator") have put together an excellent video showing you how to get started with it..
43
+
44
+ https://www.youtube.com/watch?v=Wc7cvpQS-xQ
45
+
46
+ **Reviews & Mentions**
47
+
48
+ [Your YouTube Plugin is fantastic-it just saved my life on this site. Thank you!](https://twitter.com/AaronWatters/status/237957701605404672?uid=16257815&iid=am-130280753913455685118891763&nid=4+248 "Twitter - Aaron Watters") - Sonic Clamp.
49
+ [New Technology Finds The Most Buzzed-About Parts Of Videos](http://www.socialtimes.com/2011/03/new-technology-finds-the-most-buzzed-about-parts-of-videos-interview/ "New Technology Finds The Most Buzzed-About Parts Of Videos") - SocialTimes.
50
+ [Andesch tips on WordPress plugins!](http://andershagstrom.se/andesch-tipsar-om-wordpress-plugins/ "Andesch tipsar om WordPress-plugins!") - Anders.
51
+ [Critical Mass](http://www.bikinginmemphis.com/2011/03/26/critical-mass/ "Critical Mass") - Biking in Memphis.
52
 
53
  == Getting Started ==
54
 
55
+ To add a video to a post or page simply use the shortcode `[youtube]video[/youtube]`, where `video` is the ID or URL of the YouTube video. Alternatively, you can add one (or more) widgets to your sidebar.
56
+
57
+ If you're not sure what the video ID is, please head to the FAQ section where it's explained in greater detail!
58
 
59
+ Within the administration area, click on the YouTube Embed menu option and then General Settings to view and edit the generic settings for the plugin. Also under the YouTube Embed menu (see screenshot 1) you can click on the Profiles sub-menu to set the default options which define the output of your videos. Any videos you display (unless overridden by parameters - more on that later) will use the settings from the Profiles screen.
60
 
61
+ Although this document contains a lot of information more is provided on the various administration pages. Whilst on the administration pages, click on the "Help" button in the top right for some useful tips and links. If anything isn't covered and you're unsure of what it does please ask [on the forum](https://wordpress.org/support/plugin/youtube-embed "WordPress Plugins Forum").
62
 
63
+ == Creating an API Key ==
64
+
65
+ At the top of the `General Settings` administration screen is an option to specify an API key. This is optional but many of the features of this plugin - including accurate video information being added to the metadata - will not be available without it. Thankfully an API key is easy to get and is free.
66
+
67
+ First, head to the [YouTube Developers Console](https://console.developers.google.com/project "Developers Console") and create a project. Click on this project and head to "Credentials" in the side menu. Click on "Create credentials" and from the drop-down select API Key. You will be prompted for the type of key so select "Server key". Name it and then press Create. The API key will be shown.
68
+
69
+ == Further embedding options ==
70
 
71
  A basic shortcode will embed your video using your default profile settings. However, you may wish to override some of these options on a video-by-video basis - this is done via parameters added to the shortcode.
72
 
73
  e.g. `[youtube width=300 height=200]Z_sCoHGIpU0[/youtube]`
74
 
75
+ Which options are available depends upon the users's set-up (for example, whether they have Flash installed or not). You can specify any of the parameters but they may be ignored. Please see the Profile screen in Administration for further details on any restrictions which may exist.
76
 
77
  * **annotation** - yes or no, this determines if annotations are shown
78
  * **autohide** - 0, 1 or 2, this parameter indicates whether the video controls will automatically hide after a video begins playing. The default behaviour, a value of 2, is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible. If this parameter is set to 0, the video progress bar and the video player controls will be visible throughout the video. If this parameter is set to 1, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
81
  * **color** - white or red, the colour of the progress bar (see the FAQ about having a white progress bar with the light theme)
82
  * **controls** - 0, 1 or 2, this decides whether the controls should display and when the Flash will load. A value of 0 will not show the controls but 1 or 2 will. A value of 2 will load Flash once the user initiates playback - otherwise it's loaded straight away.
83
  * **disablekb** - yes or no, disable keyboard controls
84
+ * **fullscreen** - yes or no, this will add the fullscreen button to the toolbar
85
  * **height** - the video height, in pixels
86
  * **html5** - yes or no, whether to force HTML5 as the default player or not (if available). NB: This is an undocumented feature and, as such, may not work
87
  * **info** - yes or no, show video information. If displaying a playlist this will show video thumbnails
104
 
105
  == Alternative Shortcodes ==
106
 
107
+ Within Administration, selecting General Settings from the YouTube Embed menu will provide a list of generic options. One option is named `Alternative Shortcode` and allows you to specify another shortcode that will work exactly the same as the standard shortcode of `[youtube]`.
108
 
109
  There are 2 reasons why you might want to do this...
110
 
111
+ 1. If migrating from another plugin, it may use a different shortcode
112
  2. If another plugin uses the same shortcode (e.g. Jetpack) this will allow you to specify and use an alternative
113
 
114
  The new shortcode can also have its own default profile assigned to it (see the Profiles section for more details on this).
115
 
116
  == Widgets ==
117
 
118
+ Widgets can be easily added. In Administration simply click on the Widgets option under the Appearance menu. YouTube Embed will be one of the listed widgets. Drag it to the appropriate sidebar on the right hand side and then choose your video options - any that aren't specified are taken from your supplied profile. It's best to have a profile set-up specifically for widgets!
119
 
120
  If you wish to display an automatically generated playlist based on user name or search term, simply change the "ID Type" appropriately and then specify the name or search word(s) where the video ID would normally be entered.
121
 
123
 
124
  == Playlists ==
125
 
126
+ YouTube allows users to create their own playlists - collections of videos that can be played in sequence. These are embedded in the same way, by supplying the playlist ID.
 
 
 
 
 
 
127
 
128
  e.g. `[youtube]PLVTLbc6i-h_iuhdwUfuPDLFLXG2QQnz-x[/youtube]`
129
 
130
+ An alternative to the YouTube build playlists is the build-in lists function - see the Lists section for further details.
 
 
131
 
132
  == Templates ==
133
 
137
 
138
  e.g. `<div align="center">%video%</div>`
139
 
 
 
140
  == Profiles ==
141
 
142
+ You've probably already had a look at the default profile, accessible by selecting Profiles from the YouTube Embed Administration menu option. Here you can specify the default option which will apply to any embedded video.
143
 
144
+ However, in the top right hand corner is a drop-down box and a button marked Change profile. Simply select an alternative profile and click the button and you can then edit the options for this alternative profile. You can even name it as well.
145
 
146
  To use this profile, simply use the parameter `profile=` followed by the profile name or number. The options for this profile will then be used.
147
 
151
 
152
  == Lists ==
153
 
154
+ Although this plugin will play standard YouTube playlists their playback options are limited. Instead you can create your own video lists. Under the YouTube Embed administration menu is a sub-menu named Lists. Select this and you will be shown a screen where you can type in a list of video IDs (or URLS). You can also provide a name for the list.
155
 
156
  When saving the list each video is validated.
157
 
158
+ As with profiles you can select the list from a drop down in the top right-hand corner. You can also change the number of lists from the Options sub-menu too.
159
 
160
  To use a list, simply specify the list name or number instead of a video ID, as well as a parameter to specify how you wish the list to be played back.
161
 
179
 
180
  == Thumbnails ==
181
 
182
+ YouTube Embed also has the ability to return a thumbnail of a video (sorry, this doesn't work with playlists).
183
 
184
+ To use the shortcode method, insert `[youtube_thumb]id[/youtube_thumb]` into a post or page to create a thumbnail of the relevant video ID which, once clicked, will open up the appropriate YouTube page.
 
 
 
 
185
 
186
+ You can specify a number of parameters...
187
 
188
+ * **alt** - specify some `ALT` text for the thumbnail image
189
  * **rel** - specify a REL override, e.g. rel="nofollow"
190
  * **target** - specify a TARGET override, e.g. target="_blank"
191
  * **width** - this specifies the width of the thumbnail image
192
  * **height** - this specifies the height of the thumbnail image
193
+ * **nolink** - if set to `true`, will output the thumbnail without a link to the YouTube video, allowing you to add your own
194
+ * **version** - which version of the thumbnail to use. This can be `default` (120x90), `medium` (320x180), `high` (480x360), `standard` (640x480) or `maxres`
195
+ * **version** - which version of the thumbnail to use. This can be `default` (120x90), `medium` (320x180), `high` (480x360), `standard` (640x480) or `maxres`
 
 
 
 
 
 
196
 
197
  e.g. `[youtube_thumb target="_blank" alt="Demo video"]id[/youtube_thumb]`
198
 
199
  This overrides the `TARGET` and `ALT` elements of the thumbnail.
200
 
 
 
201
  == Shortened URL ==
202
 
203
+ You may return a short URL for any YouTube video by simply inserting `[youtube_url id=xx]` anywhere within a post. `xx` is the ID of the video.
 
 
204
 
205
+ == Downloading Videos ==
206
 
207
+ If you wish your users to be able to download a YouTube video or playlist then you can do this automatically.
208
 
209
+ In the Profiles screen within administration there is an option to automatically show a download link. You can specify some text or HTML to display as well as CSS. If you'd prefer to do this manually then you can use the shortcode `download_video`. The content to link is specified between the open and close shortcode tags and there are 3 parameters...
210
 
211
+ * **id** - The ID of the video or playlist. This is required.
212
+ * **target** - The target of the link (e.g. `_blank`). This is optional.
213
+ * **nofollow** - yes or no, use this to specify whether a `nofollow` tag should be added to the link. This is optional and by default it will be included.
214
 
215
+ e.g. `[download_video id="Z_sCoHGIpU0" target="_blank"]Download the video[/download_video]`
216
 
217
+ == Video Information ==
218
 
219
+ The shortcode of `vinfo` can be used to output useful video information. Simple pass the video ID using the parameter of `id` and then add any text between the opening and closing shortcode. If this text contains any of the following tags then they will be replaced with the relevant video information...
220
 
221
+ * %title% - the title of the video
222
+ * %description% - the video description
223
+ * %url% - a link to the video on YouTube
224
+ * %shorturl% - a shorturl of the video
225
+ * %download% - a link to a site where the video can be downloaded
226
+ * %thumb_default% - URL of a thumbnail image 120x90 pixels in size
227
+ * %thumb_medium% - URL of a thumbnail image 320x180 pixels in size
228
+ * %thumb_high% - URL of a thumbnail image 480x360 pixels in size
229
+ * %thumb_standard% - URL of a thumbnail image 640x480 pixels in size
230
+ * %thumb_maxres% - URL of a thumbnail image the biggest it can be, based on the original video size
231
 
232
+ These tags can be included in URLs as well. For example, if you added the following in the HTML view...
233
 
234
+ `[vinfo id="Z_sCoHGIpU0"]<a href="%url%"><img src="%thumb_default%"></a>[/vinfo]`
 
 
235
 
236
+ This would display a 120x90 pixel thumbnail with a clickable link to the original video.
237
 
238
  == Further Embedding Options ==
239
 
240
+ Under the YouTube Embed administration menu is a sub-menu named General Settings. Select this and find the section named Embedding. There are 2 options here that have not been covered already...
241
 
242
  1. Add Metadata - by default, RDFa metadata is added to video output. This can be switched on or off as required (see the FAQs for more information about metadata usage).
243
  2. Feed - videos will not appear in feeds so use this option to decide whether you want them to be converted to links and/or thumbnails.
252
 
253
  If you'd like your own plugin adding to this list then please [get in touch](http://www.artiss.co.uk/plugin-contact "Contact").
254
 
 
 
 
 
 
 
 
 
 
 
255
  == Installation ==
256
 
257
+ YouTube Embed can be found and installed via the Plugin menu within WordPress administration (Plugins -> Add New). Alternatively, it can be downloaded from WordPress.org and installed manually...
258
+
259
+ 1. Upload the entire `youtube-embed` folder to your `wp-content/plugins/` directory.
260
+ 2. Activate the plugin through the 'Plugins' menu in WordPress administration.
261
 
262
+ Voila! It's ready to go.
 
 
263
 
264
  == Frequently Asked Questions ==
265
 
266
+ = I've upgraded to version 4 (or above) from an earlier version and I was using the widget feature to display videos =
267
 
268
  I previously allowed some, although not all, parameters to be specified within the widget. However, as you can simply create your own profile for widgets I have removed this and, without leaving lots of redundant code behind, it was difficult to keep this backwards compatible.
269
 
330
 
331
  == Changelog ==
332
 
333
+ = 5.0 =
334
+ * Enhancement: The API is back <fist pump>! The plugin can now fetch video information to add to the metadata
335
+ * Enhancement: Caching is back <double fist pump>! Now that I'm happy with the speed of the main code, I'm now happy to cache it
336
+ * Enhancement: Added housekeeping for the caching, because WordPress is rubbish at doing it itself <grumble, don't get me started>
337
+ * Enhancement: A new shortcode has been added to allow you to easily output video information to your post or page using a simple templating system
338
+ * Enhancement: Added the new API data to the metadata but also added more elements
339
+ * Enhancement: Improved the video ID validation if the API is not used
340
+ * Enhancement: WordPress has a nasty habit of modifying the video IDs that are passed to the plugin. Most of these we're already able to undo, but it's now been enhanced further to work even better
341
+ * Enhancement: The thumbnails shortcode now uses the API and, as a result, is slimmer and works with playlists too!
342
+ * Enhancement: Made some minor changes towards better accessibility. It's been pretty shoddy up until now but the next release should complete this work
343
+ * Maintenance: Data is passed around between functions via arrays rather than LOTS of variables, which is a much better of doing it
344
+ * Maintenance: Removed the old video validation process as this is now handled by the API function
345
+ * Maintenance: Widget changes to support the customizer in WP 4.5
346
+ * Maintenance: Changed the branding back. Because it's me you want - I understand that now
347
+ * Maintenance: Tested for WP 4.6 and PHP 7 compatibility because, you know, it's the future
348
+ * Maintenance: Re-wrote this bad boy README
349
+ * Bug: Fixed metadata output issues with playlists
350
+ * Bug: Fixed bug where lists would not display if the new performance option was switched on
351
+ * Bug: Fixed issue with the uninstaller
352
 
353
  = 4.3.4 =
354
  * Bug: Fixed issue with 3 hyphens in a video ID being converted to &#8212;
413
  * Enhancement: If another plugin is using the same shortcode as this I now output a prompt in the admin area. Also added a setting to turn off this prompt just in case you're using the secondary shortcode and are happy for this.
414
  * Enhancement: Re-written code for help screens, including adding more information and additional tabs.
415
  * Maintenance: Moved the settings page to, well, the Settings menu option. It makes sense.
416
+ * Maintenance: Removed the enable of the JS API, which is now deprecated.
417
  * Maintenance: Improved the admin screen output code - had made it more WordPress standard in version 4 but got some of the code wrong.
418
 
419
  = 4.0.2 =
502
  * Enhancement: Simplified the menu access rules which has resulted in resolving a number of existing issues
503
  * Bug: Fixed PHP error when allowing shortcodes in widgets
504
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
505
  == Upgrade Notice ==
506
 
507
+ = 5.0 =
508
+ * The API is back! Caching is back! It has glitter! Ok, it doesn't have glitter
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
509
 
 
 
uninstall.php CHANGED
@@ -20,24 +20,24 @@ $options = get_option( 'youtube_embed_general' );
20
 
21
  if ( is_array( $options ) ) {
22
 
23
- delete_site_option( 'youtube_embed_general' );
24
 
25
  // If the number of profiles field exists, delete each one in turn
26
 
27
- if ( array_key_exists( 'profile_no', $options ) ) {
28
  $loop = 0;
29
  while ( $loop <= $options[ 'profile_no' ] ) {
30
- delete_site_option( 'youtube_embed_profile' . $loop );
31
  $loop ++;
32
  }
33
  }
34
 
35
  // If the number of lists field exists, delete each one in turn
36
 
37
- if ( !array_key_exists( 'list_no', $options ) ) {
38
  $loop = 1;
39
  while ( $loop <= $options[ 'list_no' ] ) {
40
- delete_site_option( 'youtube_embed_list' . $loop );
41
  $loop ++;
42
  }
43
  }
@@ -50,4 +50,10 @@ delete_option( 'youtube_embed_shortcode' );
50
  delete_option( 'youtube_embed_shortcode_admin' );
51
  delete_option( 'youtube_embed_shortcode_site' );
52
  delete_option( 'youtube_embed_version' );
53
- ?>
 
 
 
 
 
 
20
 
21
  if ( is_array( $options ) ) {
22
 
23
+ delete_option( 'youtube_embed_general' );
24
 
25
  // If the number of profiles field exists, delete each one in turn
26
 
27
+ if ( isset( $options[ 'profile_no' ] ) ) {
28
  $loop = 0;
29
  while ( $loop <= $options[ 'profile_no' ] ) {
30
+ delete_option( 'youtube_embed_profile' . $loop );
31
  $loop ++;
32
  }
33
  }
34
 
35
  // If the number of lists field exists, delete each one in turn
36
 
37
+ if ( isset( $options[ 'list_no' ] ) ) {
38
  $loop = 1;
39
  while ( $loop <= $options[ 'list_no' ] ) {
40
+ delete_option( 'youtube_embed_list' . $loop );
41
  $loop ++;
42
  }
43
  }
50
  delete_option( 'youtube_embed_shortcode_admin' );
51
  delete_option( 'youtube_embed_shortcode_site' );
52
  delete_option( 'youtube_embed_version' );
53
+
54
+ // Remove any transient data
55
+
56
+ global $wpdb;
57
+ $sql = "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_youtubeembed_%' OR option_name LIKE '_transient_timeout_youtubeembed_%'";
58
+ $wipe = $wpdb -> query( $sql );
59
+ ?>
youtube-embed.php CHANGED
@@ -3,8 +3,8 @@
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://wordpress.org/plugins/youtube-embed/
5
  Description: Embed YouTube Videos in WordPress
6
- Version: 4.3.5
7
- Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  Text Domain: youtube-embed
10
  Domain Path: /languages
@@ -19,7 +19,7 @@ Domain Path: /languages
19
  * @since 2.0
20
  */
21
 
22
- define( 'youtube_embed_version', '4.3.5' );
23
 
24
  $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
25
 
@@ -35,6 +35,10 @@ include_once( $functions_dir . 'generate-other-code.php' ); // Generate downl
35
 
36
  include_once( $functions_dir . 'generate-widgets.php' ); // Generate widgets
37
 
 
 
 
 
38
  if ( is_admin() && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
39
 
40
  include_once( $functions_dir . 'admin-config.php' ); // Administration configuration
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://wordpress.org/plugins/youtube-embed/
5
  Description: Embed YouTube Videos in WordPress
6
+ Version: 5.0
7
+ Author: dartiss
8
  Author URI: http://www.artiss.co.uk
9
  Text Domain: youtube-embed
10
  Domain Path: /languages
19
  * @since 2.0
20
  */
21
 
22
+ define( 'youtube_embed_version', '5.0' );
23
 
24
  $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
25
 
35
 
36
  include_once( $functions_dir . 'generate-widgets.php' ); // Generate widgets
37
 
38
+ include_once( $functions_dir . 'api-access.php' ); // Fetch video data from YouTube API
39
+
40
+ include_once( $functions_dir . 'caching.php' ); // Data caching functions
41
+
42
  if ( is_admin() && !( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
43
 
44
  include_once( $functions_dir . 'admin-config.php' ); // Administration configuration