Version Description
- Maintenance: Now suppressing errors when fetching of API data fails
- Maintenance: Updated the drop-down of video sizes in the profiles screen, based upon latest YouTube recommendations
- Maintenance: Two sections of the README had the same name so wasn't displaying correctly on wordpress.org - now corrected!
- Maintenance: Updated the screenshots - something I should have done for 5.0 but forgot (mumbling apologies)
- Bug: Okay, I admit it, I was caching the videos when they were random user-generated playlists, which meant the random order was the same each time
. Now I suppress caching if this is the case - Bug: For reasons I've yet to ascertain, some people appear to have an old value left over as the API key. I've therefore added a check for this and will clear it down if needs be
- Bug: Got rid of a number of PHP errors, most of which would have caused issues with the code as well
- Bug: No-one spotted this one
but I did - the list and profile counts weren't always correct. Also, the profiles count was getting a bit confused with the lists count and the list count had really no idea what it was doing generally. Basically, it's sorted - Bug: To make things easier for myself I changed the array names that held the profile and list names. But, yeah, this means they weren't transferred from previous setups. Arse. Okay, that's now sorted
- Bug: In trying to resolve that last issue I found that the code that's supposed to run during a plugin update wasn't. Some jiggery-pokery later, it's been re-written and works like a dream!
Download this release
Release Info
Developer | dartiss |
Plugin | YouTube Embed |
Version | 5.0.1 |
Comparing to | |
See all releases |
Code changes from version 5.0 to 5.0.1
- css/._admin.css +0 -0
- css/._admin.min.css +0 -0
- css/._main.css +0 -0
- css/._main.min.css +0 -0
- images/._cross.png +0 -0
- images/._flash.png +0 -0
- images/._html5.png +0 -0
- images/._tick.png +0 -0
- images/cross.png +0 -0
- images/flash.png +0 -0
- images/html5.png +0 -0
- images/tick.png +0 -0
- includes/._add-scripts.php +0 -0
- includes/._admin-config.php +0 -0
- includes/._api-access.php +0 -0
- includes/._caching.php +0 -0
- includes/._generate-embed-code.php +0 -0
- includes/._generate-other-code.php +0 -0
- includes/._generate-widgets.php +0 -0
- includes/._options-general.php +0 -0
- includes/._options-lists.php +0 -0
- includes/._options-plugins.php +0 -0
- includes/._options-profiles.php +0 -0
- includes/._shared-functions.php +0 -0
- includes/._shortcodes.php +0 -0
- includes/add-scripts.php +44 -22
- includes/api-access.php +1 -1
- includes/generate-embed-code.php +13 -4
- includes/generate-widgets.php +3 -3
- includes/options-lists.php +4 -7
- includes/options-profiles.php +14 -14
- includes/shared-functions.php +29 -2
- js/._iframeResizer.js +0 -0
- js/._iframeResizer.min.js +0 -0
- js/._jquery.fitvids.js +0 -0
- js/._mce4-button.js +0 -0
- js/._mce4-button.min.js +0 -0
- js/mce4-button.js +0 -0
- js/mce4-button.min.js +0 -0
- languages/._youtube-embed.mo +0 -0
- languages/._youtube-embed.po +0 -0
- readme.txt +22 -11
- youtube-embed.php +4 -4
css/._admin.css
DELETED
Binary file
|
css/._admin.min.css
DELETED
Binary file
|
css/._main.css
DELETED
Binary file
|
css/._main.min.css
DELETED
Binary file
|
images/._cross.png
DELETED
Binary file
|
images/._flash.png
DELETED
Binary file
|
images/._html5.png
DELETED
Binary file
|
images/._tick.png
DELETED
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
DELETED
Binary file
|
includes/._admin-config.php
DELETED
Binary file
|
includes/._api-access.php
DELETED
Binary file
|
includes/._caching.php
DELETED
Binary file
|
includes/._generate-embed-code.php
DELETED
Binary file
|
includes/._generate-other-code.php
DELETED
Binary file
|
includes/._generate-widgets.php
DELETED
Binary file
|
includes/._options-general.php
DELETED
Binary file
|
includes/._options-lists.php
DELETED
Binary file
|
includes/._options-plugins.php
DELETED
Binary file
|
includes/._options-profiles.php
DELETED
Binary file
|
includes/._shared-functions.php
DELETED
Binary file
|
includes/._shortcodes.php
DELETED
Binary file
|
includes/add-scripts.php
CHANGED
@@ -15,41 +15,63 @@
|
|
15 |
* @since 2.5.5
|
16 |
*/
|
17 |
|
18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
-
|
21 |
|
22 |
-
|
23 |
|
24 |
-
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
|
34 |
|
35 |
-
$
|
36 |
|
37 |
-
|
|
|
38 |
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
|
|
|
50 |
}
|
51 |
|
52 |
-
add_action( '
|
53 |
|
54 |
/**
|
55 |
* Add scripts to theme
|
@@ -249,4 +271,4 @@ function youtube_embed_shortcode_checks( $source ) {
|
|
249 |
|
250 |
update_option( 'youtube_embed_shortcode_' . $source, $shortcode );
|
251 |
}
|
252 |
-
?>
|
15 |
* @since 2.5.5
|
16 |
*/
|
17 |
|
18 |
+
/**
|
19 |
+
* Upgrade checks
|
20 |
+
*
|
21 |
+
* Check if plugin has upgraded and, if so, perform further actions
|
22 |
+
*
|
23 |
+
* @since 5.0.1
|
24 |
+
*/
|
25 |
|
26 |
+
$version = get_option( 'youtube_embed_version' );
|
27 |
|
28 |
+
if ( $version != youtube_embed_version ) {
|
29 |
|
30 |
+
// Set up default option values (if not already set)
|
31 |
|
32 |
+
$options = ye_set_general_defaults();
|
33 |
+
ye_set_shortcode();
|
34 |
+
ye_set_list( $options[ 'list_no' ] );
|
35 |
+
ye_set_profile( $options[ 'profile_no' ] );
|
36 |
|
37 |
+
// Update saved version number
|
38 |
+
|
39 |
+
update_option( 'youtube_embed_version', youtube_embed_version );
|
40 |
+
}
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Plugin initialisation
|
44 |
+
*
|
45 |
+
* Load the plugin's translated strings
|
46 |
+
*
|
47 |
+
* @since 2.5.5
|
48 |
+
*/
|
49 |
|
50 |
+
function ye_plugin_init() {
|
51 |
|
52 |
+
$language_dir = plugin_basename( dirname( __FILE__ ) ) . '/languages/';
|
53 |
|
54 |
+
load_plugin_textdomain( 'youtube-embed', false, $language_dir );
|
55 |
+
}
|
56 |
|
57 |
+
add_action( 'init', 'ye_plugin_init' );
|
58 |
|
59 |
+
/**
|
60 |
+
* Admin initialisation
|
61 |
+
*
|
62 |
+
* Switch on shortcodes in widgets, if required
|
63 |
+
*
|
64 |
+
* @since 5.0.1
|
65 |
+
*/
|
66 |
|
67 |
+
function ye_admin_init() {
|
68 |
|
69 |
+
$options = get_option( 'youtube_embed_general' );
|
70 |
+
|
71 |
+
if ( $options[ 'widgets' ] == 1 ) { add_filter( 'widget_text', 'do_shortcode' ); }
|
72 |
}
|
73 |
|
74 |
+
add_action( 'admin_init', 'ye_admin_init' );
|
75 |
|
76 |
/**
|
77 |
* Add scripts to theme
|
271 |
|
272 |
update_option( 'youtube_embed_shortcode_' . $source, $shortcode );
|
273 |
}
|
274 |
+
?>
|
includes/api-access.php
CHANGED
@@ -96,7 +96,7 @@ function ye_get_api_data( $video_id, $api_key = '', $no_cache = false, $cache_ti
|
|
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' ] ) ) {
|
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' ] ) ) {
|
includes/generate-embed-code.php
CHANGED
@@ -42,6 +42,7 @@ function ye_generate_youtube_code( $array ) {
|
|
42 |
$start_time = microtime( true );
|
43 |
$newline = "\n";
|
44 |
$tab = "\t";
|
|
|
45 |
|
46 |
// Ensure an ID is passed
|
47 |
|
@@ -113,7 +114,13 @@ function ye_generate_youtube_code( $array ) {
|
|
113 |
|
114 |
// Randomize the video
|
115 |
|
116 |
-
if ( $list_style == 'random' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
// Extract one video randomly
|
119 |
|
@@ -121,6 +128,8 @@ function ye_generate_youtube_code( $array ) {
|
|
121 |
|
122 |
$id = $list[ array_rand( $list, 1 ) ];
|
123 |
|
|
|
|
|
124 |
} else {
|
125 |
|
126 |
$id = $list [ 0 ];
|
@@ -146,11 +155,11 @@ function ye_generate_youtube_code( $array ) {
|
|
146 |
|
147 |
// Correct the ID if a playlist
|
148 |
|
149 |
-
if ( strtolower( substr( $id, 0, 2 ) ) == 'pl' && strlen( $
|
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 |
|
@@ -397,7 +406,7 @@ function ye_generate_youtube_code( $array ) {
|
|
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 |
|
42 |
$start_time = microtime( true );
|
43 |
$newline = "\n";
|
44 |
$tab = "\t";
|
45 |
+
$cache_suppress = false;
|
46 |
|
47 |
// Ensure an ID is passed
|
48 |
|
114 |
|
115 |
// Randomize the video
|
116 |
|
117 |
+
if ( $list_style == 'random' ) {
|
118 |
+
|
119 |
+
shuffle( $list );
|
120 |
+
|
121 |
+
$cache_suppress = true;
|
122 |
+
|
123 |
+
}
|
124 |
|
125 |
// Extract one video randomly
|
126 |
|
128 |
|
129 |
$id = $list[ array_rand( $list, 1 ) ];
|
130 |
|
131 |
+
$cache_suppress = true;
|
132 |
+
|
133 |
} else {
|
134 |
|
135 |
$id = $list [ 0 ];
|
155 |
|
156 |
// Correct the ID if a playlist
|
157 |
|
158 |
+
if ( strtolower( substr( $id, 0, 2 ) ) == 'pl' && strlen( $id ) == 34 ) { $id = substr( $id, 2 ); }
|
159 |
|
160 |
// Get from cache, if required
|
161 |
|
162 |
+
if ( $general[ 'video_cache' ] != 0 && get_the_date() !== false && !$cache_suppress ) {
|
163 |
|
164 |
// 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
|
165 |
|
406 |
|
407 |
// Save the cache
|
408 |
|
409 |
+
if ( $general[ 'video_cache' ] != 0 && get_the_date() !== false && !$cache_suppress ) {
|
410 |
|
411 |
$cache = $general[ 'video_cache' ] * 60 * 60;
|
412 |
|
includes/generate-widgets.php
CHANGED
@@ -67,8 +67,8 @@ class YouTubeEmbedWidget extends WP_Widget {
|
|
67 |
'stop' => $instance[ 'start' ],
|
68 |
'profile' => $instance[ 'profile' ],
|
69 |
'list_style' => $instance[ 'list' ],
|
70 |
-
'search' => $
|
71 |
-
'user' => $
|
72 |
|
73 |
// Generate the video and output it
|
74 |
|
@@ -206,4 +206,4 @@ function youtube_embed_register_widgets() {
|
|
206 |
register_widget( 'YouTubeEmbedWidget' );
|
207 |
}
|
208 |
add_action( 'widgets_init', 'youtube_embed_register_widgets' );
|
209 |
-
?>
|
67 |
'stop' => $instance[ 'start' ],
|
68 |
'profile' => $instance[ 'profile' ],
|
69 |
'list_style' => $instance[ 'list' ],
|
70 |
+
'search' => $search,
|
71 |
+
'user' => $user );
|
72 |
|
73 |
// Generate the video and output it
|
74 |
|
206 |
register_widget( 'YouTubeEmbedWidget' );
|
207 |
}
|
208 |
add_action( 'widgets_init', 'youtube_embed_register_widgets' );
|
209 |
+
?>
|
includes/options-lists.php
CHANGED
@@ -80,16 +80,13 @@ $general = ye_get_general_defaults();
|
|
80 |
|
81 |
// Get number of lists in use
|
82 |
|
83 |
-
$loop =
|
84 |
-
$
|
85 |
while ( $loop <= $general[ 'list_no' ] ) {
|
86 |
|
87 |
$list = ye_get_list( $loop );
|
|
|
88 |
|
89 |
-
if ( $list[ 'list' ] == '' ) {
|
90 |
-
$max_list = $loop - 1;
|
91 |
-
$loop = $general[ 'list_no' ];
|
92 |
-
}
|
93 |
$loop ++;
|
94 |
}
|
95 |
|
@@ -101,7 +98,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
|
|
101 |
global $wp_version;
|
102 |
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
103 |
?>
|
104 |
-
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed Lists', 'youtube-embed' ); ?><span class="title-count"><?php echo $
|
105 |
|
106 |
<?php
|
107 |
|
80 |
|
81 |
// Get number of lists in use
|
82 |
|
83 |
+
$loop = 0;
|
84 |
+
$max_lists = 0;
|
85 |
while ( $loop <= $general[ 'list_no' ] ) {
|
86 |
|
87 |
$list = ye_get_list( $loop );
|
88 |
+
if ( !$list[ 'default' ] ) { $max_lists ++; }
|
89 |
|
|
|
|
|
|
|
|
|
90 |
$loop ++;
|
91 |
}
|
92 |
|
98 |
global $wp_version;
|
99 |
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
100 |
?>
|
101 |
+
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed Lists', 'youtube-embed' ); ?><span class="title-count"><?php echo $max_lists; ?></span></h<?php echo $heading; ?>>
|
102 |
|
103 |
<?php
|
104 |
|
includes/options-profiles.php
CHANGED
@@ -89,21 +89,19 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
|
|
89 |
$options = ye_get_profile( $profile_no );
|
90 |
$general = ye_get_general_defaults();
|
91 |
|
92 |
-
// Get number of
|
93 |
|
94 |
$loop = 0;
|
95 |
-
$
|
96 |
-
while ( $loop <= $general[ '
|
97 |
|
98 |
-
$
|
|
|
99 |
|
100 |
-
if ( $list[ 'default' ] ) {
|
101 |
-
$max_list = $loop;
|
102 |
-
$loop = $general[ 'list_no' ];
|
103 |
-
}
|
104 |
$loop ++;
|
105 |
}
|
106 |
|
|
|
107 |
// Output headings
|
108 |
?>
|
109 |
|
@@ -113,7 +111,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
|
|
113 |
global $wp_version;
|
114 |
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
115 |
?>
|
116 |
-
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed Profiles', 'youtube-embed' ); ?><span class="title-count"><?php echo $
|
117 |
|
118 |
<?php
|
119 |
|
@@ -202,11 +200,13 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
|
|
202 |
<th scope="row"><?php _e( 'Default Sizes', 'youtube-embed' ); ?></th>
|
203 |
<td><label for="youtube_embed_size"><select name="youtube_embed_size">
|
204 |
<option value=""<?php if ( $default_size == '' ) { echo " selected='selected'"; } ?>><?php _e( 'Use above sizes', 'youtube-embed' ); ?></option>
|
205 |
-
<option value="
|
206 |
-
<option value="
|
207 |
-
<option value="
|
208 |
-
<option value="
|
209 |
-
<option value="
|
|
|
|
|
210 |
</select></label><p class="description"><?php _e( 'Select one of these default sizes to override the above video sizes.', 'youtube-embed' ); ?></p></td>
|
211 |
</tr>
|
212 |
|
89 |
$options = ye_get_profile( $profile_no );
|
90 |
$general = ye_get_general_defaults();
|
91 |
|
92 |
+
// Get number of profiles in use
|
93 |
|
94 |
$loop = 0;
|
95 |
+
$max_profiles = 0;
|
96 |
+
while ( $loop <= $general[ 'profile_no' ] ) {
|
97 |
|
98 |
+
$profile = ye_get_profile( $loop );
|
99 |
+
if ( !$profile[ 'default' ] ) { $max_profiles ++; }
|
100 |
|
|
|
|
|
|
|
|
|
101 |
$loop ++;
|
102 |
}
|
103 |
|
104 |
+
|
105 |
// Output headings
|
106 |
?>
|
107 |
|
111 |
global $wp_version;
|
112 |
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
113 |
?>
|
114 |
+
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed Profiles', 'youtube-embed' ); ?><span class="title-count"><?php echo $max_profiles; ?></span></h<?php echo $heading; ?>>
|
115 |
|
116 |
<?php
|
117 |
|
200 |
<th scope="row"><?php _e( 'Default Sizes', 'youtube-embed' ); ?></th>
|
201 |
<td><label for="youtube_embed_size"><select name="youtube_embed_size">
|
202 |
<option value=""<?php if ( $default_size == '' ) { echo " selected='selected'"; } ?>><?php _e( 'Use above sizes', 'youtube-embed' ); ?></option>
|
203 |
+
<option value="04260420"<?php if ( $default_size == "04260420" ) { echo " selected='selected'"; } ?>><?php echo '240p'; ?></option>
|
204 |
+
<option value="06400360"<?php if ( $default_size == "06400360" ) { echo " selected='selected'"; } ?>><?php echo '360p'; ?></option>
|
205 |
+
<option value="08540480"<?php if ( $default_size == "08540480" ) { echo " selected='selected'"; } ?>><?php echo '480p'; ?></option>
|
206 |
+
<option value="12800720"<?php if ( $default_size == "12800720" ) { echo " selected='selected'"; } ?>><?php echo '720p'; ?></option>
|
207 |
+
<option value="19201080"<?php if ( $default_size == "19201080" ) { echo " selected='selected'"; } ?>><?php echo '1080p'; ?></option>
|
208 |
+
<option value="38402160"<?php if ( $default_size == "38402160" ) { echo " selected='selected'"; } ?>><?php echo '1440p'; ?></option>
|
209 |
+
<option value="38402160"<?php if ( $default_size == "38402160" ) { echo " selected='selected'"; } ?>><?php echo '2160p'; ?></option>
|
210 |
</select></label><p class="description"><?php _e( 'Select one of these default sizes to override the above video sizes.', 'youtube-embed' ); ?></p></td>
|
211 |
</tr>
|
212 |
|
includes/shared-functions.php
CHANGED
@@ -285,6 +285,10 @@ function ye_set_general_defaults() {
|
|
285 |
|
286 |
$new_options = array_merge( $default_array, $options );
|
287 |
|
|
|
|
|
|
|
|
|
288 |
// Update the options, if changed, and return the result
|
289 |
|
290 |
if ( $options != $new_options ) { update_option( 'youtube_embed_general', $new_options ); }
|
@@ -351,8 +355,17 @@ function ye_set_profile( $profiles ) {
|
|
351 |
|
352 |
$default_array = ye_set_profile_defaults( $profile );
|
353 |
|
|
|
|
|
354 |
$new_options = array_merge( $default_array, $options );
|
355 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
// Update the options, if changed, and return the result
|
357 |
|
358 |
if ( $options != $new_options ) { update_option( 'youtube_embed_profile' . $profile, $new_options ); }
|
@@ -452,7 +465,12 @@ function ye_get_list( $list ) {
|
|
452 |
|
453 |
// If there is no list set up, set to default values and save
|
454 |
|
455 |
-
if ( !is_array( $options ) ) {
|
|
|
|
|
|
|
|
|
|
|
456 |
|
457 |
return $options;
|
458 |
}
|
@@ -474,7 +492,7 @@ function ye_set_list( $lists ) {
|
|
474 |
while ( $list <= $lists ) {
|
475 |
|
476 |
$options = get_option( 'youtube_embed_list' . $list );
|
477 |
-
|
478 |
// Only process if array exists
|
479 |
|
480 |
if ( is_array( $options ) ) {
|
@@ -483,8 +501,17 @@ function ye_set_list( $lists ) {
|
|
483 |
|
484 |
$default_array = ye_set_list_defaults( $list );
|
485 |
|
|
|
|
|
486 |
$new_options = array_merge( $default_array, $options );
|
487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
488 |
// Update the options, if changed, and return the result
|
489 |
|
490 |
if ( $options != $new_options ) { update_option( 'youtube_embed_list' . $list, $new_options ); }
|
285 |
|
286 |
$new_options = array_merge( $default_array, $options );
|
287 |
|
288 |
+
// Check if API is invalid (some people are finding a value left over from past install). If so, clear it down
|
289 |
+
|
290 |
+
if ( strlen( $new_options[ 'api'] ) == 1 ) { $new_options[ 'api' ] = ''; }
|
291 |
+
|
292 |
// Update the options, if changed, and return the result
|
293 |
|
294 |
if ( $options != $new_options ) { update_option( 'youtube_embed_general', $new_options ); }
|
355 |
|
356 |
$default_array = ye_set_profile_defaults( $profile );
|
357 |
|
358 |
+
// Merge the two arrays
|
359 |
+
|
360 |
$new_options = array_merge( $default_array, $options );
|
361 |
|
362 |
+
// Because I've changed the variable name from name to profile_name, convert any with the old name
|
363 |
+
|
364 |
+
if ( isset( $new_options[ 'name' ] ) ) {
|
365 |
+
$new_options[ 'profile_name' ] = $new_options[ 'name' ];
|
366 |
+
unset( $new_options[ 'name' ] );
|
367 |
+
}
|
368 |
+
|
369 |
// Update the options, if changed, and return the result
|
370 |
|
371 |
if ( $options != $new_options ) { update_option( 'youtube_embed_profile' . $profile, $new_options ); }
|
465 |
|
466 |
// If there is no list set up, set to default values and save
|
467 |
|
468 |
+
if ( !is_array( $options ) ) {
|
469 |
+
$options = ye_set_list_defaults( $list );
|
470 |
+
$options[ 'default' ] = true;
|
471 |
+
} else {
|
472 |
+
$options[ 'default' ] = false;
|
473 |
+
}
|
474 |
|
475 |
return $options;
|
476 |
}
|
492 |
while ( $list <= $lists ) {
|
493 |
|
494 |
$options = get_option( 'youtube_embed_list' . $list );
|
495 |
+
|
496 |
// Only process if array exists
|
497 |
|
498 |
if ( is_array( $options ) ) {
|
501 |
|
502 |
$default_array = ye_set_list_defaults( $list );
|
503 |
|
504 |
+
// Merge the two arrays
|
505 |
+
|
506 |
$new_options = array_merge( $default_array, $options );
|
507 |
|
508 |
+
// Because I've changed the variable name from name to list_name, convert any with the old name
|
509 |
+
|
510 |
+
if ( isset( $new_options[ 'name' ] ) ) {
|
511 |
+
$new_options[ 'list_name' ] = $new_options[ 'name' ];
|
512 |
+
unset( $new_options[ 'name' ] );
|
513 |
+
}
|
514 |
+
|
515 |
// Update the options, if changed, and return the result
|
516 |
|
517 |
if ( $options != $new_options ) { update_option( 'youtube_embed_list' . $list, $new_options ); }
|
js/._iframeResizer.js
DELETED
Binary file
|
js/._iframeResizer.min.js
DELETED
Binary file
|
js/._jquery.fitvids.js
DELETED
Binary file
|
js/._mce4-button.js
DELETED
Binary file
|
js/._mce4-button.min.js
DELETED
Binary file
|
js/mce4-button.js
CHANGED
File without changes
|
js/mce4-button.min.js
CHANGED
File without changes
|
languages/._youtube-embed.mo
DELETED
Binary file
|
languages/._youtube-embed.po
DELETED
Binary file
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ 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 |
|
@@ -35,7 +35,7 @@ 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
|
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 |
|
@@ -45,14 +45,14 @@ 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 |
|
@@ -235,7 +235,7 @@ These tags can be included in URLs as well. For example, if you added the follow
|
|
235 |
|
236 |
This would display a 120x90 pixel thumbnail with a clickable link to the original video.
|
237 |
|
238 |
-
==
|
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 |
|
@@ -330,6 +330,18 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
|
|
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
|
@@ -504,6 +516,5 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
|
|
504 |
|
505 |
== Upgrade Notice ==
|
506 |
|
507 |
-
= 5.0 =
|
508 |
-
*
|
509 |
-
|
4 |
Tags: embed, insert, video, youtube
|
5 |
Requires at least: 3.9
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 5.0.1
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
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 |
|
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 |
|
235 |
|
236 |
This would display a 120x90 pixel thumbnail with a clickable link to the original video.
|
237 |
|
238 |
+
== Other Settings ==
|
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 |
|
330 |
|
331 |
== Changelog ==
|
332 |
|
333 |
+
= 5.0.1 =
|
334 |
+
* Maintenance: Now suppressing errors when fetching of API data fails
|
335 |
+
* Maintenance: Updated the drop-down of video sizes in the profiles screen, based upon latest YouTube recommendations
|
336 |
+
* Maintenance: Two sections of the README had the same name so wasn't displaying correctly on wordpress.org - now corrected!
|
337 |
+
* Maintenance: Updated the screenshots - something I should have done for 5.0 but forgot (mumbling apologies)
|
338 |
+
* Bug: Okay, I admit it, I was caching the videos when they were random user-generated playlists, which meant the random order was the same each time <sigh>. Now I suppress caching if this is the case
|
339 |
+
* Bug: For reasons I've yet to ascertain, some people appear to have an old value left over as the API key. I've therefore added a check for this and will clear it down if needs be
|
340 |
+
* Bug: Got rid of a number of PHP errors, most of which would have caused issues with the code as well
|
341 |
+
* Bug: No-one spotted this one <cue diabolical laughter> but I did - the list and profile counts weren't always correct. Also, the profiles count was getting a bit confused with the lists count and the list count had really no idea what it was doing generally. Basically, it's sorted
|
342 |
+
* Bug: To make things easier for myself I changed the array names that held the profile and list names. But, yeah, this means they weren't transferred from previous setups. Arse. Okay, that's now sorted
|
343 |
+
* Bug: In trying to resolve that last issue I found that the code that's supposed to run during a plugin update wasn't. Some jiggery-pokery later, it's been re-written and works like a dream!
|
344 |
+
|
345 |
= 5.0 =
|
346 |
* Enhancement: The API is back <fist pump>! The plugin can now fetch video information to add to the metadata
|
347 |
* 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
|
516 |
|
517 |
== Upgrade Notice ==
|
518 |
|
519 |
+
= 5.0.1 =
|
520 |
+
* A soothing band-aid to place on top of the lightly grazed 5.0
|
|
youtube-embed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
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
|
@@ -19,16 +19,16 @@ 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 |
|
26 |
// Include all the various functions
|
27 |
|
28 |
-
include_once( $functions_dir . 'add-scripts.php' ); // Add various scripts
|
29 |
-
|
30 |
include_once( $functions_dir . 'shared-functions.php' ); // Shared routines
|
31 |
|
|
|
|
|
32 |
include_once( $functions_dir . 'generate-embed-code.php' ); // Generate YouTube embed code
|
33 |
|
34 |
include_once( $functions_dir . 'generate-other-code.php' ); // Generate download & short URLs & thumbnails
|
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.1
|
7 |
Author: dartiss
|
8 |
Author URI: http://www.artiss.co.uk
|
9 |
Text Domain: youtube-embed
|
19 |
* @since 2.0
|
20 |
*/
|
21 |
|
22 |
+
define( 'youtube_embed_version', '5.0.1' );
|
23 |
|
24 |
$functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
|
25 |
|
26 |
// Include all the various functions
|
27 |
|
|
|
|
|
28 |
include_once( $functions_dir . 'shared-functions.php' ); // Shared routines
|
29 |
|
30 |
+
include_once( $functions_dir . 'add-scripts.php' ); // Add various scripts
|
31 |
+
|
32 |
include_once( $functions_dir . 'generate-embed-code.php' ); // Generate YouTube embed code
|
33 |
|
34 |
include_once( $functions_dir . 'generate-other-code.php' ); // Generate download & short URLs & thumbnails
|