YouTube Embed - Version 4.2

Version Description

  • Enhancement: Re-written the core embedding code. Redundant code removed and, for the remaining code, re-imagined to improve performance
  • Enhancement: Massively changed how the plugin retrieves saved options and, in particular, how I populate default values. The result? Much improved performance
  • Enhancement: Reviewed and reduced the calls to fetch the options
  • Enhancement: Added a new general option to allow you to force a list type to be specified before a list can be used. The reason? By doing this the code doesn't have to check if the ID it a list name each time and it improves performance. For those upgrading this will be switched off by default to maintain backwards compatibility
  • Enhancement: Admin bar options only appear if viewing the admin bar on the site (showing it whilst in the admin screens seemed rather pointless)
  • Enhancement: If you use WordPress Video Overlay Ads or Video SEO for WordPress then the settings menus will appear under the YouTube Embed menu
  • Enhancement: SSL options removed as it's now used by default, including with thumbnails and schema.org links
  • Enhancement: Improved the RSS feed output for search or user upload requests
  • Maintenance: Removed some deprecated elements in the code
  • Maintenance: Updated includes so that plugin folders were not hardcoded
  • Maintenance: Updated which functions I was using to retrieve folder names so that they are fully SSL compatible
  • Maintenance: Removed a load of redundant functions
  • Maintenance: Replaced a function with a PHP command but this means that the plugin is no compatible with PHP versions below 5.1
  • Maintenance: Tidied up the list screen further
  • Maintenance: Replaced the 'dynamic' parameter with 'responsive' which, as a name, is far more accurate. 'dynamic' will still work, though.
  • Maintenance: Improved admin screen validation and sanitisation
  • Bug fix: Uninstall wasn't clearing up properly on multisites
Download this release

Release Info

Developer codedart
Plugin Icon 128x128 YouTube Embed
Version 4.2
Comparing to
See all releases

Code changes from version 4.1.1 to 4.2

includes/add-scripts.php CHANGED
@@ -7,27 +7,46 @@
7
  * @package YouTube-Embed
8
  */
9
 
10
- // Switch on shortcodes in widgets, if requested
11
-
12
- if ( !is_admin() ) {
13
- $options = get_option( 'youtube_embed_general' );
14
- if ( $options[ 'widgets' ] == 1 ) { add_filter( 'widget_text', 'do_shortcode' ); }
15
- }
16
-
17
  /**
18
  * Plugin initialisation
19
  *
20
- * Loads the plugin's translated strings
21
  *
22
  * @since 2.5.5
23
  */
24
 
25
  function vye_plugin_init() {
26
 
 
 
27
  $language_dir = plugin_basename( dirname( __FILE__ ) ) . '/languages/';
28
 
29
  load_plugin_textdomain( 'youtube-embed', false, $language_dir );
30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  }
32
 
33
  add_action( 'init', 'vye_plugin_init' );
@@ -42,7 +61,7 @@ add_action( 'init', 'vye_plugin_init' );
42
 
43
  function vye_main_scripts() {
44
 
45
- wp_register_style( 'vye_dynamic', plugins_url( '/youtube-embed/css/main.min.css' ) );
46
 
47
  wp_enqueue_style( 'vye_dynamic' );
48
 
@@ -60,7 +79,7 @@ add_action( 'wp_enqueue_scripts', 'vye_main_scripts' );
60
 
61
  function vye_admin_css() {
62
 
63
- wp_enqueue_style( 'tinymce_button', plugins_url() . '/youtube-embed/css/admin.min.css' );
64
 
65
  }
66
 
@@ -79,40 +98,43 @@ add_action( 'admin_print_styles', 'vye_admin_css' );
79
 
80
  function vye_admin_bar_render( $meta = TRUE ) {
81
 
82
- $options = vye_set_general_defaults();
 
 
83
 
84
- if ( $options[ 'admin_bar' ] != '' ) {
85
 
86
- global $wp_admin_bar;
87
 
88
- if ( !is_user_logged_in() ) { return; }
89
- if ( !is_admin_bar_showing() ) { return; }
90
- if ( !current_user_can( $options[ 'menu_access' ] ) ) { return; }
91
 
92
- $wp_admin_bar -> add_menu( array(
93
- 'id' => 'aye-menu',
94
- 'title' => __( 'YouTube Embed', 'youtube-embed' ) ) );
95
 
96
- $wp_admin_bar -> add_menu( array(
97
- 'parent' => 'aye-menu',
98
- 'id' => 'aye-options',
99
- 'title' => __( 'Options', 'youtube-embed' ),
100
- 'href' => admin_url( 'admin.php?page=ye-general-options' ),
101
- 'meta' => array( 'target' => '_blank' ) ) );
102
 
103
- $wp_admin_bar -> add_menu( array(
104
- 'parent' => 'aye-menu',
105
- 'id' => 'aye-profile',
106
- 'title' => __( 'Profiles', 'youtube-embed' ),
107
- 'href' => admin_url( 'admin.php?page=ye-profile-options' ),
108
- 'meta' => array( 'target' => '_blank' ) ) );
109
 
110
- $wp_admin_bar -> add_menu( array(
111
- 'parent' => 'aye-menu',
112
- 'id' => 'aye-lists',
113
- 'title' => __( 'Lists', 'youtube-embed' ),
114
- 'href' => admin_url( 'admin.php?page=ye-list-options' ),
115
- 'meta' => array( 'target' => '_blank' ) ) );
 
116
  }
117
  }
118
 
@@ -132,14 +154,15 @@ function youtube_embed_add_to_head() {
132
 
133
  youtube_embed_shortcode_checks( 'site' );
134
 
135
- $options = vye_set_general_defaults();
136
 
137
  if ( $options[ 'script' ] == 'f' ) {
138
 
139
  $tab = "\t";
140
  $newline = "\n";
141
 
142
- echo '<script type="text/javascript" src="' . plugins_url() . '/youtube-embed/js/jquery.fitvids.js"></script>' . $newline;
 
143
  echo '<script>' . $newline;
144
  echo $tab . '$(".youtube-embed").fitVids();' . $newline;
145
  echo '</script>' . $newline;
@@ -147,7 +170,7 @@ function youtube_embed_add_to_head() {
147
  }
148
 
149
  if ( $options[ 'script' ] == 'i' ) {
150
- wp_enqueue_script( 'youtube-embed-iframe-resizer', plugins_url() . '/youtube-embed/js/iframeResizer.min.js' );
151
  }
152
  }
153
 
7
  * @package YouTube-Embed
8
  */
9
 
 
 
 
 
 
 
 
10
  /**
11
  * Plugin initialisation
12
  *
13
+ * Perform various actions upon initialisation of the plugin
14
  *
15
  * @since 2.5.5
16
  */
17
 
18
  function vye_plugin_init() {
19
 
20
+ // Loads the plugin's translated strings
21
+
22
  $language_dir = plugin_basename( dirname( __FILE__ ) ) . '/languages/';
23
 
24
  load_plugin_textdomain( 'youtube-embed', false, $language_dir );
25
 
26
+ // Switch on shortcodes in widgets, if requested
27
+
28
+ if ( !is_admin() ) {
29
+ $options = get_option( 'youtube_embed_general' );
30
+ if ( $options[ 'widgets' ] == 1 ) { add_filter( 'widget_text', 'do_shortcode' ); }
31
+ }
32
+
33
+ // Check if plugin has upgraded and, if so, perform further actions
34
+
35
+ $version = get_option( 'youtube_embed_version' );
36
+
37
+ if ( $version != youtube_embed_version ) {
38
+
39
+ // Set up default option values (if not already set)
40
+
41
+ $options = vye_set_general_defaults();
42
+ vye_set_shortcode();
43
+ vye_set_list( $options[ 'list_no' ] );
44
+ vye_set_profile( $options[ 'profile_no' ] );
45
+
46
+ // Update saved version number
47
+
48
+ update_option( 'youtube_embed_version', youtube_embed_version );
49
+ }
50
  }
51
 
52
  add_action( 'init', 'vye_plugin_init' );
61
 
62
  function vye_main_scripts() {
63
 
64
+ wp_register_style( 'vye_dynamic', plugins_url( 'css/main.min.css', dirname(__FILE__) ) );
65
 
66
  wp_enqueue_style( 'vye_dynamic' );
67
 
79
 
80
  function vye_admin_css() {
81
 
82
+ wp_enqueue_style( 'tinymce_button', plugins_url( 'css/admin.min.css', dirname(__FILE__) ));
83
 
84
  }
85
 
98
 
99
  function vye_admin_bar_render( $meta = TRUE ) {
100
 
101
+ if ( !is_admin() ) {
102
+
103
+ $options = vye_get_general_defaults();
104
 
105
+ if ( $options[ 'admin_bar' ] != '' ) {
106
 
107
+ global $wp_admin_bar;
108
 
109
+ if ( !is_user_logged_in() ) { return; }
110
+ if ( !is_admin_bar_showing() ) { return; }
111
+ if ( !current_user_can( $options[ 'menu_access' ] ) ) { return; }
112
 
113
+ $wp_admin_bar -> add_menu( array(
114
+ 'id' => 'aye-menu',
115
+ 'title' => __( 'YouTube Embed', 'youtube-embed' ) ) );
116
 
117
+ $wp_admin_bar -> add_menu( array(
118
+ 'parent' => 'aye-menu',
119
+ 'id' => 'aye-options',
120
+ 'title' => __( 'Options', 'youtube-embed' ),
121
+ 'href' => admin_url( 'admin.php?page=ye-general-options' ),
122
+ 'meta' => array( 'target' => '_blank' ) ) );
123
 
124
+ $wp_admin_bar -> add_menu( array(
125
+ 'parent' => 'aye-menu',
126
+ 'id' => 'aye-profile',
127
+ 'title' => __( 'Profiles', 'youtube-embed' ),
128
+ 'href' => admin_url( 'admin.php?page=ye-profile-options' ),
129
+ 'meta' => array( 'target' => '_blank' ) ) );
130
 
131
+ $wp_admin_bar -> add_menu( array(
132
+ 'parent' => 'aye-menu',
133
+ 'id' => 'aye-lists',
134
+ 'title' => __( 'Lists', 'youtube-embed' ),
135
+ 'href' => admin_url( 'admin.php?page=ye-list-options' ),
136
+ 'meta' => array( 'target' => '_blank' ) ) );
137
+ }
138
  }
139
  }
140
 
154
 
155
  youtube_embed_shortcode_checks( 'site' );
156
 
157
+ $options = vye_get_general_defaults();
158
 
159
  if ( $options[ 'script' ] == 'f' ) {
160
 
161
  $tab = "\t";
162
  $newline = "\n";
163
 
164
+ echo '<script type="text/javascript" src="' . plugins_url( 'js/jquery.fitvids.js', dirname(__FILE__) ) . '"></script>' . $newline;
165
+
166
  echo '<script>' . $newline;
167
  echo $tab . '$(".youtube-embed").fitVids();' . $newline;
168
  echo '</script>' . $newline;
170
  }
171
 
172
  if ( $options[ 'script' ] == 'i' ) {
173
+ wp_enqueue_script( 'youtube-embed-iframe-resizer', plugins_url( 'js/iframeResizer.min.js', dirname(__FILE__) ) );
174
  }
175
  }
176
 
includes/admin-config.php CHANGED
@@ -74,7 +74,7 @@ function vye_menu_initialise() {
74
 
75
  // Get level access for menus
76
 
77
- $options = vye_set_general_defaults();
78
 
79
  $menu_access = $options[ 'menu_access' ];
80
 
@@ -100,6 +100,21 @@ function vye_menu_initialise() {
100
 
101
  add_action( 'load-' . $vye_lists_hook, 'vye_add_lists_help' );
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  // Add options sub-menu
104
 
105
  global $vye_options_hook;
@@ -122,7 +137,7 @@ add_action( 'admin_menu', 'vye_menu_initialise' );
122
 
123
  function vye_general_options() {
124
 
125
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/options-general.php' );
126
 
127
  }
128
 
@@ -136,7 +151,7 @@ function vye_general_options() {
136
 
137
  function vye_profile_options() {
138
 
139
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/options-profiles.php' );
140
 
141
  }
142
 
@@ -150,7 +165,7 @@ function vye_profile_options() {
150
 
151
  function vye_list_options() {
152
 
153
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/options-lists.php' );
154
 
155
  }
156
 
@@ -245,8 +260,8 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
245
 
246
  $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>';
247
  $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>';
248
- $text .= "<p><img src='" . plugins_url() . "/youtube-embed/images/flash.png' width='10px'/> - " . __( 'Flash player', 'youtube-embed' ) . '</br>';
249
- $text .= "<img src='" . plugins_url() . "/youtube-embed/images/html5.png' width='10px'/> - " . __( 'HTML5 player', 'youtube-embed' ) . '</br>';
250
  }
251
 
252
  if ( ( $screen == 'lists' ) && ( $tab == 'help' ) ) {
@@ -264,7 +279,7 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
264
  $text .= '<p><a href="https://wordpress.org/plugins/youtube-embed/">' . __( 'YouTube Embed Plugin Documentation', 'youtube-embed' ) . '</a></p>';
265
 
266
  if ( $screen != 'lists' ) {
267
- $text .= '<p><a href="http://code.google.com/apis/youtube/player_parameters.html">' . __( 'YouTube Player Documentation', 'youtube-embed' ) . '</a></p>';
268
  }
269
 
270
  if ( $screen == 'options' ) {
@@ -282,7 +297,7 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
282
  *
283
  * Add filters (assuming user is editing) for TinyMCE
284
  *
285
- * @uses vye_set_general_defaults Set default options
286
  *
287
  * @since 2.0
288
  */
@@ -293,7 +308,7 @@ function youtube_embed_button() {
293
 
294
  if ( get_user_option( 'rich_editing' ) == 'true' ) {
295
 
296
- $options = vye_set_general_defaults();
297
  if ( $options[ 'editor_button' ] != '' ) {
298
 
299
  // Add filters
@@ -303,7 +318,8 @@ function youtube_embed_button() {
303
  }
304
  }
305
  }
306
- add_action( 'init', 'youtube_embed_button' );
 
307
 
308
  /**
309
  * Register new TinyMCE button
@@ -336,7 +352,7 @@ function register_youtube_embed_button( $buttons ) {
336
 
337
  function add_youtube_embed_mce_plugin( $plugin_array ) {
338
 
339
- $plugin_array[ 'mce4_youtube_button' ] = plugins_url() . '/youtube-embed/js/mce4-button.min.js';
340
 
341
  return $plugin_array;
342
  }
@@ -358,7 +374,7 @@ function youtube_embed_admin_messages() {
358
 
359
  if ( ( $shortcode_admin != 0 ) or ( $shortcode_site != 0 ) ) {
360
 
361
- $options = vye_set_general_defaults();
362
 
363
  if ( $options[ 'prompt' ] == 1 ) {
364
 
74
 
75
  // Get level access for menus
76
 
77
+ $options = vye_get_general_defaults();
78
 
79
  $menu_access = $options[ 'menu_access' ];
80
 
100
 
101
  add_action( 'load-' . $vye_lists_hook, 'vye_add_lists_help' );
102
 
103
+ // If installed, add link to Video Overlay Ads plugin
104
+
105
+ if ( function_exists( 'video_overlay_create_menu' ) ) {
106
+
107
+ add_submenu_page( 'ye-profile-options', __( 'Video Overlay Ads Settings', 'youtube-embed' ), __( 'Video Overlay Ads', 'youtube-embed' ), 'administrator', 'ye-video-overlay', 'video_overlay_settings_page' );
108
+ }
109
+
110
+ // If installed, add link to Video SEO
111
+
112
+ if ( class_exists( 'wpseo_Video_Sitemap' ) ) {
113
+
114
+ add_submenu_page( 'ye-profile-options', __( 'Video SEO', 'youtube-embed' ), __( 'Video SEO', 'youtube-embed' ), 'manage_options', 'ye-wpseo-video', 'wpseo_Video_Sitemap::admin_panel' );
115
+
116
+ }
117
+
118
  // Add options sub-menu
119
 
120
  global $vye_options_hook;
137
 
138
  function vye_general_options() {
139
 
140
+ include_once( plugin_dir_path( __FILE__ ) . 'options-general.php' );
141
 
142
  }
143
 
151
 
152
  function vye_profile_options() {
153
 
154
+ include_once( plugin_dir_path( __FILE__ ) . 'options-profiles.php' );
155
 
156
  }
157
 
165
 
166
  function vye_list_options() {
167
 
168
+ include_once( plugin_dir_path( __FILE__ ) . 'options-lists.php' );
169
 
170
  }
171
 
260
 
261
  $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>';
262
  $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>';
263
+ $text .= "<p><img src='" . plugins_url( 'images/flash.png', dirname(__FILE__) ) . "' width='10px'/> - " . __( 'Flash player', 'youtube-embed' ) . '</br>';
264
+ $text .= "<img src='" . plugins_url( 'images/html5.png', dirname(__FILE__) ) . "' width='10px'/> - " . __( 'HTML5 player', 'youtube-embed' ) . '</br>';
265
  }
266
 
267
  if ( ( $screen == 'lists' ) && ( $tab == 'help' ) ) {
279
  $text .= '<p><a href="https://wordpress.org/plugins/youtube-embed/">' . __( 'YouTube Embed Plugin Documentation', 'youtube-embed' ) . '</a></p>';
280
 
281
  if ( $screen != 'lists' ) {
282
+ $text .= '<p><a href="https://code.google.com/apis/youtube/player_parameters.html">' . __( 'YouTube Player Documentation', 'youtube-embed' ) . '</a></p>';
283
  }
284
 
285
  if ( $screen == 'options' ) {
297
  *
298
  * Add filters (assuming user is editing) for TinyMCE
299
  *
300
+ * @uses vye_get_general_defaults Set default options
301
  *
302
  * @since 2.0
303
  */
308
 
309
  if ( get_user_option( 'rich_editing' ) == 'true' ) {
310
 
311
+ $options = vye_get_general_defaults();
312
  if ( $options[ 'editor_button' ] != '' ) {
313
 
314
  // Add filters
318
  }
319
  }
320
  }
321
+
322
+ add_action( 'admin_init', 'youtube_embed_button' );
323
 
324
  /**
325
  * Register new TinyMCE button
352
 
353
  function add_youtube_embed_mce_plugin( $plugin_array ) {
354
 
355
+ $plugin_array[ 'mce4_youtube_button' ] = plugins_url( 'js/mce4-button.min.js', dirname(__FILE__) );
356
 
357
  return $plugin_array;
358
  }
374
 
375
  if ( ( $shortcode_admin != 0 ) or ( $shortcode_site != 0 ) ) {
376
 
377
+ $options = vye_get_general_defaults();
378
 
379
  if ( $options[ 'prompt' ] == 1 ) {
380
 
includes/generate-embed-code.php CHANGED
@@ -20,8 +20,8 @@
20
  * @uses vye_validate_list Get the requested listr
21
  * @uses vye_validate_id Validate the video ID
22
  * @uses vye_validate_profile Get the requested profile
23
- * @uses vye_set_general_defaults Get general options
24
- * @uses vye_set_profile_defaults Set default profile options
25
  *
26
  * @param string $id Video ID
27
  * @param string $width Video width
@@ -45,8 +45,7 @@
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 $https Use HTTPS for links
49
- * @param string $dynamic Show dynamic output
50
  * @param string $search Perform a search
51
  * @param string $user Look up user videos
52
  * @param string $modest Modest browsing
@@ -55,28 +54,30 @@
55
  * @return string Code output
56
  */
57
 
58
- function vye_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 = '', $https = '', $dynamic = '', $search = '', $user = '', $modest = '', $playsinline = '', $html5 = '' ) {
 
 
59
 
60
  $start_time = microtime( true );
 
 
61
 
62
  // Ensure an ID is passed
63
 
64
  if ( $id == '' ) { return vye_error( __( 'No video/playlist ID has been supplied', 'youtube-embed' ) ); }
65
 
66
- $newline = "\n";
67
- $tab = "\t";
68
-
69
  // Get general options
70
 
71
- $general = vye_set_general_defaults();
72
 
73
- // Find the profile, if one is specified
74
 
75
- $profile = vye_validate_profile( $profile, $general[ 'profile_no' ] );
76
-
77
- // Get default values if no values are supplied
78
-
79
- $options = vye_set_profile_defaults( $profile );
 
80
 
81
  // If a user look-up or search has been requested, miss out looking up list details and
82
  // simple assign it as an IFRAME video
@@ -86,10 +87,19 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
86
 
87
  if ( ( $user == 0 ) && ( $search == 0 ) ) {
88
 
89
- // Check it's not a list
90
 
91
- $list = vye_validate_list( $id, $general[ 'list_no' ] );
92
- if ( !is_array( $list ) ) {
 
 
 
 
 
 
 
 
 
93
 
94
  // Check if certain parameters are included in the URL
95
 
@@ -101,6 +111,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
101
  $id = vye_extract_id( $id );
102
 
103
  // Check what type of video it is and whether it's valid
 
104
 
105
  $embed_type = vye_validate_id( $id );
106
 
@@ -108,13 +119,16 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
108
 
109
  if ( ( $embed_type == '' ) or ( strlen ( $embed_type ) != 1 ) ) {
110
  $result = $newline . '<!-- YouTube Embed v' . youtube_embed_version . ' -->' . $newline;
111
- $result .= sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) . $newline . '<!-- End of YouTube Embed code -->' . $newline;
112
  return $result;
113
  }
114
 
115
- } else {
 
 
 
 
116
 
117
- $return = '';
118
  $embed_type = 'v';
119
 
120
  // Randomize the video
@@ -124,9 +138,8 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
124
  // Extract one video randomly
125
 
126
  if ( $list_style == 'single' ) {
127
- $id = $list[ array_rand( $list, 1 ) ];
128
 
129
- // Build the playlist
130
 
131
  } else {
132
 
@@ -147,38 +160,29 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
147
  }
148
  }
149
 
150
- $metadata = $general[ 'metadata' ];
151
-
152
  // Correct the ID if a playlist
153
 
154
- if ( strtolower( substr( $id, 0, 2 ) ) == 'pl') {
155
- $id = substr( $id, 2 );
156
- }
157
-
158
- // Work out correct protocol to use - HTTP or HTTPS
159
-
160
- if ( $https == '' ) { $https = $options[ 'https' ]; }
161
- if ( $https == 1 ) { $https = 's'; } else { $https = ''; }
162
 
163
  // If this is a feed then display a thumbnail and/or text link to the original video
164
 
165
  if ( is_feed () ) {
166
  $result = '';
167
- if ( $playlist_ids != '' ) {
168
  $result .= '<p>'.__( 'A video list cannot be viewed within this feed - please view the original content', 'youtube-embed' ) . '.</p>' . $newline;
169
  } else {
170
- $youtube_url = 'http' . $https . '://www.youtube.com/watch?' . $embed_type . '=' . $id;
171
- if ( ( $embed_type == 'v' ) && ( $general[ 'feed' ] != 't' ) ) { $result .= '<p><a href="' . $youtube_url . '"><img src="http://img.youtube.com/vi/' . $id . '/' . $general[ 'thumbnail' ] . '.jpg"></a></p>' . $newline; }
172
  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; }
173
  }
174
  return $result;
175
  }
176
 
177
- // If a dynamic size has been requested, check whether the width should be fixed
178
 
179
- $fixed = 0;
180
- if ( $dynamic == '' ) {
181
- $dynamic = $options[ 'dynamic' ];
182
  $fixed = $options[ 'fixed' ];
183
  } else {
184
  if ( $width != '' ) { $fixed = 1; }
@@ -187,16 +191,16 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
187
  // Only set width and height from defaults if both are missing
188
 
189
  if ( ( $width == '' ) && ( $height == '' ) ) {
190
-
191
  $width = $options[ 'width' ];
192
  $height = $options[ 'height' ];
193
  }
194
 
195
- // If controls parameter is not numeric then convert to 0 or 1
196
- // This is to maintain backwards compatibility after version 2.6
197
 
198
- if ( ( !is_numeric( $controls ) ) && ( $controls != '' ) ) {
199
- $controls = vye_convert( $controls );
 
 
200
  }
201
 
202
  // If values have not been pressed, use the default values
@@ -217,73 +221,45 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
217
  if ( $modest == '' ) { $modest = $options[ 'modest' ]; }
218
  if ( $playsinline == '' ) { $playsinline = $options[ 'playsinline' ]; }
219
  if ( $html5 == '' ) { $html5 = $options[ 'html5' ]; }
 
 
 
220
 
221
  $language = $general[ 'language'];
 
222
  $debug = $general[ 'debug' ];
223
  $wmode = $options[ 'wmode' ];
224
-
225
- if ( $theme == '' ) { $theme = $options[ 'theme' ]; }
226
-
227
- // Build the required template
228
-
229
- if ( $template == '' ) { $template = $options[ 'template' ]; } else { $template = vye_decode( $template ); }
230
- if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
231
-
232
- // If looping and no playlist has been generated, add the current ID
233
- // This is a workaround for the AS3 player which won't otherwise loop
234
-
235
- if ( ( $loop == 1 ) && ( $embed_type != 'p' ) && ( $playlist_ids == '' ) ) { $playlist_ids = $id; }
236
-
237
- // Set parameters without default values
238
 
239
  if ( $start == '' ) { $start = '0'; }
240
  if ( $stop == '' ) { $stop = '0'; }
241
 
242
- // If height or width is missing, calculate missing parameter using ratio
243
-
244
- if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
245
- $ratio_to_use = '';
246
- if ( $ratio != '' ) {
247
-
248
- // Extract the ratio from the provided string
249
-
250
- $pos = strpos( $ratio, ':', 0 );
251
- if ( $pos !== false ) {
252
- $ratio_l = substr( $ratio, 0, $pos );
253
- $ratio_r = substr( $ratio, $pos + 1 );
254
- if ( ( is_numeric( $ratio_l ) ) && ( is_numeric( $ratio_r ) ) ) { $ratio_to_use = $ratio_l / $ratio_r; }
255
- }
256
- }
257
-
258
- // If no, or invalid, ratio supplied, calculate from the default video dimensions
259
-
260
- if ( $ratio_to_use == '' ) { $ratio_to_use = $options[ 'width' ] / $options[ 'height' ]; }
261
 
262
- // Complete the missing width or height using the ratio
 
263
 
264
- if ( $width == '' ) { $width = round( $height * $ratio_to_use, 0); }
265
- if ( $height == '' ) { $height = round( $width / $ratio_to_use, 0); }
 
 
266
  }
 
267
 
268
- // Set Frameborder output
269
 
270
- $frameborder = '';
271
- $amp = '&';
272
- if ( isset( $general[ 'frameborder' ] ) ) {
273
- if ( $general[ 'frameborder' ] != 1 ) {
274
- $frameborder = 'frameborder="0" ';
275
- } else {
276
- $amp = '&amp;';
277
- }
278
  }
279
 
280
- // Set up embed types
281
 
282
- $class = 'youtube-player';
283
  $paras = '';
284
 
285
- // Generate parameters to add to URL
286
-
287
  if ( $modest == 1 ) { $paras .= $amp . 'modestbranding=1'; }
288
  if ( $fullscreen != 1 ) { $paras .= $amp . 'fs=0'; }
289
  if ( $related != 1 ) { $paras .= $amp . 'rel=0'; }
@@ -301,25 +277,22 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
301
  if ( $playsinline == 1 ) { $paras .= $amp . 'playsinline=1'; }
302
  if ( $html5 == 1 ) { $paras .= $amp . 'html5=1'; }
303
  if ( $language != '' ) { $paras .= $amp . 'hl=' . $language; }
 
 
304
 
305
  // If not a playlist, add the playlist parameter
306
 
307
  if ( ( $playlist_ids != '' ) && ( $playlist_ids != $id ) ) { $paras .= $amp . 'playlist=' . $playlist_ids; }
308
 
309
- // Add start & stop parameters
310
-
311
- if ( $start != 0 ) { $paras .= $amp . 'start=' . $start; }
312
- if ( $stop != 0 ) { $paras .= $amp . 'end=' . $stop; }
313
-
314
  // Generate DIVs to wrap around video
315
 
316
  $ttab = $tab;
317
  $result = '<div class="youtube-embed';
318
- if ( $dynamic == 1 ) { $result .= ' ye-container'; }
319
  $result .= '"';
320
- if ( $metadata != 0 ) { $result .= ' itemprop="video" itemscope itemtype="http://schema.org/VideoObject"'; }
321
  $result .= '>' . $newline;
322
- if ( ( $dynamic == 1 ) && ( $fixed == 1) ) {
323
  $result = '<div style="width: ' . $width . 'px; max-width: 100%">' . $newline . $tab . $result;
324
  $ttab .= $tab;
325
  }
@@ -330,20 +303,18 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
330
 
331
  $title = get_the_title();
332
 
333
- $result .= $ttab . '<meta itemprop="url" content="http' . $https . '://www.youtube.com/' . $embed_type . '/' . $id . '" />' . $newline;
334
  $result .= $ttab . '<meta itemprop="name" content="' . $title . '" />' . $newline;
335
  $result .= $ttab . '<meta itemprop="description" content="' . $title . '" />' . $newline;
336
  $result .= $ttab . '<meta itemprop="uploadDate" content="' . get_the_date( 'c' ) . '" />' . $newline;
337
- $result .= $ttab . '<meta itemprop="thumbnailUrl" content="http://i.ytimg.com/vi/' . $id . '/hqdefault.jpg" />' . $newline;
338
- $result .= $ttab . '<meta itemprop="embedUrl" content="http' . $https . '://www.youtube.com/embed/' . $id . '" />' . $newline;
339
  $result .= $ttab . '<meta itemprop="height" content="' . $height . '" />' . $newline;
340
  $result .= $ttab . '<meta itemprop="width" content="' . $width . '" />' . $newline;
341
  }
342
 
343
  // Work out, depending on privacy settings, the main address to use
344
 
345
- $privacy = $general[ 'privacy' ];
346
-
347
  if ( $privacy == 2 ) {
348
  $do_not_track = vye_do_not_track();
349
  if ( $do_not_track ) { $privacy = 1; } else { $privacy = 0; }
@@ -353,7 +324,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
353
 
354
  // Generate the first part of the embed URL along with the ID section
355
 
356
- $embed_url = 'http' . $https . '://www.' . $url_privacy . '/embed';
357
  $id_paras = '/' . $id;
358
 
359
  // If a playlist, user or download build the ID appropriately
@@ -390,7 +361,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
390
  // Now apply the template to the result
391
 
392
  $end_tag = '';
393
- if ( ( $dynamic == 1 ) && ( $fixed == 1 ) ) {
394
  $end_tag .= $tab . '</div>' . $newline . '</div>' . $newline;
395
  } else {
396
  $end_tag .= '</div>' . $newline;
@@ -440,7 +411,7 @@ function vye_validate_profile( $name, $number ) {
440
  if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
441
  $profile = $loop;
442
  } else {
443
- $profiles = get_option( 'youtube_embed_profile' . $loop );
444
  $profname = strtolower( $profiles[ 'name' ] );
445
  if ( $profname == $name ) { $profile = $loop; }
446
  }
@@ -482,12 +453,14 @@ function vye_validate_list( $name, $number ) {
482
 
483
  $loop = 1;
484
  while ( ( $loop <= $number ) && ( $list == '' ) ) {
485
- $listfiles = get_option( 'youtube_embed_list' . $loop );
486
- if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
487
- $list = $listfiles[ 'list' ];
488
- } else {
489
- $listname = strtolower( $listfiles[ 'name' ] );
490
- if ( $listname == $name ) { $list = $listfiles[ 'list' ]; }
 
 
491
  }
492
  $loop ++;
493
  }
@@ -532,24 +505,72 @@ function vye_get_url_para( $id, $para, $current ) {
532
  }
533
 
534
  /**
535
- * Decode a string
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
536
  *
537
- * Decode an HTML encoded string. I'm not using htmlspecialchars_decode to maintain
538
- * PHP 4 compatibility.
539
  *
540
- * @since 2.0.3
541
  *
542
- * @param string $encoded The encoded string
543
- * @return string The decoded string
 
 
 
 
544
  */
545
 
546
- function vye_decode( $encoded ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
547
 
548
- $find = array( '&amp;', '&quot;', '&#039;', '&lt;', '&gt;' );
549
- $replace = array( '&', '"', "'", '<', '>' );
550
 
551
- $decoded = str_replace( $find, $replace, $encoded );
 
552
 
553
- return $decoded;
554
  }
555
  ?>
20
  * @uses vye_validate_list Get the requested listr
21
  * @uses vye_validate_id Validate the video ID
22
  * @uses vye_validate_profile Get the requested profile
23
+ * @uses vye_get_general_defaults Get general options
24
+ * @uses vye_get_profile Set default profile options
25
  *
26
  * @param string $id Video ID
27
  * @param string $width Video width
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
54
  * @return string Code output
55
  */
56
 
57
+ function vye_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
 
61
  $start_time = microtime( true );
62
+ $newline = "\n";
63
+ $tab = "\t";
64
 
65
  // Ensure an ID is passed
66
 
67
  if ( $id == '' ) { return vye_error( __( 'No video/playlist ID has been supplied', 'youtube-embed' ) ); }
68
 
 
 
 
69
  // Get general options
70
 
71
+ $general = vye_get_general_defaults();
72
 
73
+ // Find the profile, if one is specified. Otherwise use default
74
 
75
+ if ( $profile != '' ) {
76
+ $profile = vye_validate_profile( $profile, $general[ 'profile_no' ] );
77
+ } else {
78
+ $profile = 0;
79
+ }
80
+ $options = vye_get_profile( $profile );
81
 
82
  // If a user look-up or search has been requested, miss out looking up list details and
83
  // simple assign it as an IFRAME video
87
 
88
  if ( ( $user == 0 ) && ( $search == 0 ) ) {
89
 
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 = vye_validate_list( $id, $general[ 'list_no' ] );
97
+ if ( is_array( $list ) ) { $list_found = true; }
98
+ }
99
+
100
+ // If this isn't a list, extract the ID and work out the type
101
+
102
+ if ( !$list_found ) {
103
 
104
  // Check if certain parameters are included in the URL
105
 
111
  $id = vye_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 = vye_validate_id( $id );
117
 
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;
124
  }
125
 
126
+ }
127
+
128
+ // This is a list, so build the list appropriately
129
+
130
+ if ( $list_found ) {
131
 
 
132
  $embed_type = 'v';
133
 
134
  // Randomize the video
138
  // Extract one video randomly
139
 
140
  if ( $list_style == 'single' ) {
 
141
 
142
+ $id = $list[ array_rand( $list, 1 ) ];
143
 
144
  } else {
145
 
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
 
169
  if ( is_feed () ) {
170
  $result = '';
171
+ if ( ( $playlist_ids != '' ) or ( $user != 0 ) or ( $search != 0 ) ) {
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;
179
  }
180
 
181
+ // If responsive output has been requested, check whether the width should be fixed
182
 
183
+ $fixed = '';
184
+ if ( $responsive == '' ) {
185
+ $responsive = $options[ 'dynamic' ];
186
  $fixed = $options[ 'fixed' ];
187
  } else {
188
  if ( $width != '' ) { $fixed = 1; }
191
  // Only set width and height from defaults if both are missing
192
 
193
  if ( ( $width == '' ) && ( $height == '' ) ) {
 
194
  $width = $options[ 'width' ];
195
  $height = $options[ 'height' ];
196
  }
197
 
198
+ // If height or width is missing, calculate missing parameter using ratio
 
199
 
200
+ if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
201
+ $new_sizes = vye_calculate_video_size( $width, $height, $options[ 'width' ], $options[ 'height' ], $ratio);
202
+ $width = $new_sizes[ 'width' ];
203
+ $height = $new_sizes[ 'height' ];
204
  }
205
 
206
  // If values have not been pressed, use the default values
221
  if ( $modest == '' ) { $modest = $options[ 'modest' ]; }
222
  if ( $playsinline == '' ) { $playsinline = $options[ 'playsinline' ]; }
223
  if ( $html5 == '' ) { $html5 = $options[ 'html5' ]; }
224
+ if ( $theme == '' ) { $theme = $options[ 'theme' ]; }
225
+
226
+ // And for those not passed, simply assign the defaults to variables
227
 
228
  $language = $general[ 'language'];
229
+ $metadata = $general[ 'metadata' ];
230
  $debug = $general[ 'debug' ];
231
  $wmode = $options[ 'wmode' ];
232
+ $privacy = $general[ 'privacy' ];
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
  if ( $start == '' ) { $start = '0'; }
235
  if ( $stop == '' ) { $stop = '0'; }
236
 
237
+ $class = 'youtube-player';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
238
 
239
+ // Build the required template
240
+ // If no video tag is found, set to the default
241
 
242
+ if ( $template == '' ) {
243
+ $template = $options[ 'template' ];
244
+ } else {
245
+ $template = htmlspecialchars_decode( $template, ENT_QUOTES );
246
  }
247
+ if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
248
 
249
+ // Set validation options
250
 
251
+ if ( isset( $general[ 'frameborder' ] ) && $general[ 'frameborder' ] != 1 ) {
252
+ $frameborder = 'frameborder="0" ';
253
+ $amp = '&';
254
+ } else {
255
+ $frameborder = '';
256
+ $amp = '&amp;';
 
 
257
  }
258
 
259
+ // Generate parameters to add to URL but only if they differ from the default
260
 
 
261
  $paras = '';
262
 
 
 
263
  if ( $modest == 1 ) { $paras .= $amp . 'modestbranding=1'; }
264
  if ( $fullscreen != 1 ) { $paras .= $amp . 'fs=0'; }
265
  if ( $related != 1 ) { $paras .= $amp . 'rel=0'; }
277
  if ( $playsinline == 1 ) { $paras .= $amp . 'playsinline=1'; }
278
  if ( $html5 == 1 ) { $paras .= $amp . 'html5=1'; }
279
  if ( $language != '' ) { $paras .= $amp . 'hl=' . $language; }
280
+ if ( $start != 0 ) { $paras .= $amp . 'start=' . $start; }
281
+ if ( $stop != 0 ) { $paras .= $amp . 'end=' . $stop; }
282
 
283
  // If not a playlist, add the playlist parameter
284
 
285
  if ( ( $playlist_ids != '' ) && ( $playlist_ids != $id ) ) { $paras .= $amp . 'playlist=' . $playlist_ids; }
286
 
 
 
 
 
 
287
  // Generate DIVs to wrap around video
288
 
289
  $ttab = $tab;
290
  $result = '<div class="youtube-embed';
291
+ if ( $responsive == 1 ) { $result .= ' ye-container'; }
292
  $result .= '"';
293
+ if ( $metadata != 0 ) { $result .= ' itemprop="video" itemscope itemtype="https://schema.org/VideoObject"'; }
294
  $result .= '>' . $newline;
295
+ if ( ( $responsive == 1 ) && ( $fixed == 1) ) {
296
  $result = '<div style="width: ' . $width . 'px; max-width: 100%">' . $newline . $tab . $result;
297
  $ttab .= $tab;
298
  }
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
317
 
 
 
318
  if ( $privacy == 2 ) {
319
  $do_not_track = vye_do_not_track();
320
  if ( $do_not_track ) { $privacy = 1; } else { $privacy = 0; }
324
 
325
  // Generate the first part of the embed URL along with the ID section
326
 
327
+ $embed_url = 'https://www.' . $url_privacy . '/embed';
328
  $id_paras = '/' . $id;
329
 
330
  // If a playlist, user or download build the ID appropriately
361
  // Now apply the template to the result
362
 
363
  $end_tag = '';
364
+ if ( ( $responsive == 1 ) && ( $fixed == 1 ) ) {
365
  $end_tag .= $tab . '</div>' . $newline . '</div>' . $newline;
366
  } else {
367
  $end_tag .= '</div>' . $newline;
411
  if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
412
  $profile = $loop;
413
  } else {
414
+ $profiles = vye_get_profile( $loop );
415
  $profname = strtolower( $profiles[ 'name' ] );
416
  if ( $profname == $name ) { $profile = $loop; }
417
  }
453
 
454
  $loop = 1;
455
  while ( ( $loop <= $number ) && ( $list == '' ) ) {
456
+ $listfiles = vye_get_list( $loop );
457
+ if ( is_array( $listfiles) ) {
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
  }
465
  $loop ++;
466
  }
505
  }
506
 
507
  /**
508
+ * Is Do Not Track active?
509
+ *
510
+ * Function to return whether Do Not Track is active in the current
511
+ * browser
512
+ *
513
+ * @since 2.6
514
+ *
515
+ * @return string True or false
516
+ */
517
+
518
+ function vye_do_not_track() {
519
+
520
+ if ( isset( $_SERVER[ 'HTTP_DNT' ] ) ) {
521
+ if ( $_SERVER[ 'HTTP_DNT' ] == 1 ) { return true; }
522
+ } else {
523
+ if ( function_exists( 'getallheaders' ) ) {
524
+ foreach ( getallheaders() as $key => $value ) {
525
+ if ( ( strtolower( $key ) === 'dnt' ) && ( $value == 1 ) ) { return true; }
526
+ }
527
+ }
528
+ }
529
+ return false;
530
+ }
531
+
532
+ /**
533
+ * Calculate video size
534
  *
535
+ * Calculate the video size using a ratio
 
536
  *
537
+ * @since 4.2
538
  *
539
+ * @param string $width Current width
540
+ * @param string $height Current height
541
+ * @param string $default_width The default width
542
+ * @param string $default_height The default height
543
+ * @param string $ratio User supplied ratio
544
+ * @return array Array of new width and height
545
  */
546
 
547
+ function vye_calculate_video_size( $width, $height, $default_width, $default_height, $ratio ) {
548
+
549
+ $ratio_to_use = '';
550
+
551
+ // If a ratio has been specified by the user, extract it
552
+
553
+ if ( $ratio != '' ) {
554
+ $pos = strpos( $ratio, ':', 0 );
555
+ if ( $pos !== false ) {
556
+ $ratio_l = substr( $ratio, 0, $pos );
557
+ $ratio_r = substr( $ratio, $pos + 1 );
558
+ if ( ( is_numeric( $ratio_l ) ) && ( is_numeric( $ratio_r ) ) ) { $ratio_to_use = $ratio_l / $ratio_r; }
559
+ }
560
+ }
561
+
562
+ // If no, or invalid, ratio supplied, calculate from the default video dimensions
563
+
564
+ if ( $ratio_to_use == '' ) { $ratio_to_use = $default_width / $default_height; }
565
+
566
+ // Complete the missing width or height using the ratio
567
 
568
+ if ( $width == '' ) { $width = round( $height * $ratio_to_use, 0); }
569
+ if ( $height == '' ) { $height = round( $width / $ratio_to_use, 0); }
570
 
571
+ $new_sizes[ 'width' ] = $width;
572
+ $new_sizes[ 'height' ] = $height;
573
 
574
+ return $new_sizes;
575
  }
576
  ?>
includes/generate-other-code.php CHANGED
@@ -57,7 +57,7 @@ function vye_generate_shorturl_code( $id ) {
57
  }
58
  }
59
 
60
- return 'http://youtu.be/' . $id;
61
  }
62
  }
63
 
@@ -112,14 +112,14 @@ function vye_generate_thumbnail_code( $id, $style, $class, $rel, $target, $width
112
  // Now create the required code
113
  if ( $alt == '' ) { $alt = sprintf( __( 'YouTube Video %s' ), $id ); }
114
  if ( !$nolink ) {
115
- $youtube_code = '<a href="http://www.youtube.com/watch?v=' . $id . '"';
116
  if ( $style != '' ) { $youtube_code .= ' style="' . $style . '"'; }
117
  if ( $class != '' ) { $youtube_code .= ' class="' . $class . '"'; }
118
  if ( $rel != '' ) { $youtube_code .= ' rel="' . $rel . '"'; }
119
  if ( $target != '' ) { $youtube_code .= ' target="' . $target . '"'; }
120
  $youtube_code .= '>';
121
  }
122
- $youtube_code .= '<img src="http://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 . '"/>';
57
  }
58
  }
59
 
60
+ return 'https://youtu.be/' . $id;
61
  }
62
  }
63
 
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 . '"'; }
117
  if ( $class != '' ) { $youtube_code .= ' class="' . $class . '"'; }
118
  if ( $rel != '' ) { $youtube_code .= ' rel="' . $rel . '"'; }
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 . '"/>';
includes/generate-widgets.php CHANGED
@@ -84,7 +84,6 @@ class YouTubeEmbedWidget extends WP_Widget {
84
  '',
85
  '',
86
  '',
87
- '',
88
  $search,
89
  $user,
90
  '' ) );
@@ -126,6 +125,8 @@ class YouTubeEmbedWidget extends WP_Widget {
126
  *
127
  * @since 2.0
128
  *
 
 
129
  * @param string $instance Instance
130
  */
131
 
@@ -135,19 +136,19 @@ class YouTubeEmbedWidget extends WP_Widget {
135
 
136
  $default = array( 'titles' => 'YouTube', 'id' => '', 'profile' => '', 'start' => '', 'list' => '', 'stop' => '', 'id_type' => 'v' );
137
  $instance = wp_parse_args( ( array ) $instance, $default );
138
- $general = vye_set_general_defaults();
139
 
140
  // Widget Title field
141
 
142
  $field_id = $this -> get_field_id( 'titles' );
143
  $field_name = $this -> get_field_name( 'titles' );
144
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Widget Title', 'youtube-embed' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'titles' ] ).'" /></p>';
145
 
146
  // Video ID field
147
 
148
  $field_id = $this -> get_field_id( 'id' );
149
  $field_name = $this -> get_field_name( 'id' );
150
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Video ID', 'youtube-embed' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'id' ] ) . '" /></p>';
151
 
152
  // ID Type
153
 
@@ -156,11 +157,11 @@ class YouTubeEmbedWidget extends WP_Widget {
156
  $field_id = $this -> get_field_id( 'id_type' );
157
  $field_name = $this -> get_field_name( 'id_type' );
158
  echo "\r\n" . '<tr><td width="100%">' . __( 'ID Type', 'youtube-embed' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value="v"';
159
- if ( attribute_escape( $instance[ 'id_type' ] ) == 'v' ) { echo " selected='selected'"; }
160
  echo '>' . __( 'Video or Playlist', 'youtube-embed' ) . '</option><option value="s"';
161
- if ( attribute_escape( $instance[ 'id_type' ] ) == 's' ) { echo " selected='selected'"; }
162
  echo '>' . __( 'Search', 'youtube-embed' ) . '</option><option value="u"';
163
- if ( attribute_escape( $instance[ 'id_type' ] ) == 'u' ) { echo " selected='selected'"; }
164
  echo '>' . __( 'User', 'youtube-embed' ) . '</option></select></td></tr>';
165
 
166
  echo "</table>\n";
@@ -170,7 +171,7 @@ class YouTubeEmbedWidget extends WP_Widget {
170
  $field_id = $this -> get_field_id( 'profile' );
171
  $field_name = $this -> get_field_name( 'profile' );
172
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile', 'youtube-embed' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
173
- vye_generate_profile_list( attribute_escape( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
174
  echo '</select></p>';
175
 
176
  echo "<table>\n";
@@ -179,13 +180,13 @@ class YouTubeEmbedWidget extends WP_Widget {
179
 
180
  $field_id = $this -> get_field_id( 'start' );
181
  $field_name = $this -> get_field_name( 'start' );
182
- echo "\r\n" . '<tr><td width="100%">' . __( 'Start (seconds)', 'youtube-embed' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /></td></tr>';
183
 
184
  // Stop field
185
 
186
  $field_id = $this -> get_field_id( 'stop' );
187
  $field_name = $this -> get_field_name( 'stop' );
188
- echo "\r\n" . '<tr><td width="100%">' . __( 'Stop (seconds)', 'youtube-embed' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'stop' ] ) . '" /></td></tr>';
189
 
190
  echo "</table><table>\n";
191
 
@@ -194,13 +195,13 @@ class YouTubeEmbedWidget extends WP_Widget {
194
  $field_id = $this -> get_field_id( 'list' );
195
  $field_name = $this -> get_field_name( 'list' );
196
  echo "\r\n" . '<tr><td width="100%">' . __( 'List Playback', 'youtube-embed' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
197
- if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
198
  echo '>' . __( 'Profile default', 'youtube-embed' ) . '</option><option value="order"';
199
- if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
200
  echo '>' . __( 'Play each video in order', 'youtube-embed' ) . '</option><option value="random"';
201
- if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
202
  echo '>' . __( 'Play videos randomly', 'youtube-embed' ) . '</option><option value="single"';
203
- if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
204
  echo '>' . __( 'Play one random video', 'youtube-embed' ) . '</option></select></td></tr>';
205
 
206
  echo "</table>\n";
84
  '',
85
  '',
86
  '',
 
87
  $search,
88
  $user,
89
  '' ) );
125
  *
126
  * @since 2.0
127
  *
128
+ * @uses vye_get_general_defaults Fetch general options
129
+ *
130
  * @param string $instance Instance
131
  */
132
 
136
 
137
  $default = array( 'titles' => 'YouTube', 'id' => '', 'profile' => '', 'start' => '', 'list' => '', 'stop' => '', 'id_type' => 'v' );
138
  $instance = wp_parse_args( ( array ) $instance, $default );
139
+ $general = vye_get_general_defaults();
140
 
141
  // Widget Title field
142
 
143
  $field_id = $this -> get_field_id( 'titles' );
144
  $field_name = $this -> get_field_name( 'titles' );
145
+ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Widget Title', 'youtube-embed' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . esc_attr( $instance[ 'titles' ] ).'" /></p>';
146
 
147
  // Video ID field
148
 
149
  $field_id = $this -> get_field_id( 'id' );
150
  $field_name = $this -> get_field_name( 'id' );
151
+ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Video ID', 'youtube-embed' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . esc_attr( $instance[ 'id' ] ) . '" /></p>';
152
 
153
  // ID Type
154
 
157
  $field_id = $this -> get_field_id( 'id_type' );
158
  $field_name = $this -> get_field_name( 'id_type' );
159
  echo "\r\n" . '<tr><td width="100%">' . __( 'ID Type', 'youtube-embed' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value="v"';
160
+ if ( esc_attr( $instance[ 'id_type' ] ) == 'v' ) { echo " selected='selected'"; }
161
  echo '>' . __( 'Video or Playlist', 'youtube-embed' ) . '</option><option value="s"';
162
+ if ( esc_attr( $instance[ 'id_type' ] ) == 's' ) { echo " selected='selected'"; }
163
  echo '>' . __( 'Search', 'youtube-embed' ) . '</option><option value="u"';
164
+ if ( esc_attr( $instance[ 'id_type' ] ) == 'u' ) { echo " selected='selected'"; }
165
  echo '>' . __( 'User', 'youtube-embed' ) . '</option></select></td></tr>';
166
 
167
  echo "</table>\n";
171
  $field_id = $this -> get_field_id( 'profile' );
172
  $field_name = $this -> get_field_name( 'profile' );
173
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile', 'youtube-embed' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
174
+ vye_generate_profile_list( esc_attr( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
175
  echo '</select></p>';
176
 
177
  echo "<table>\n";
180
 
181
  $field_id = $this -> get_field_id( 'start' );
182
  $field_name = $this -> get_field_name( 'start' );
183
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Start (seconds)', 'youtube-embed' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . esc_attr( $instance[ 'start' ] ) . '" /></td></tr>';
184
 
185
  // Stop field
186
 
187
  $field_id = $this -> get_field_id( 'stop' );
188
  $field_name = $this -> get_field_name( 'stop' );
189
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Stop (seconds)', 'youtube-embed' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . esc_attr( $instance[ 'stop' ] ) . '" /></td></tr>';
190
 
191
  echo "</table><table>\n";
192
 
195
  $field_id = $this -> get_field_id( 'list' );
196
  $field_name = $this -> get_field_name( 'list' );
197
  echo "\r\n" . '<tr><td width="100%">' . __( 'List Playback', 'youtube-embed' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
198
+ if ( esc_attr( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
199
  echo '>' . __( 'Profile default', 'youtube-embed' ) . '</option><option value="order"';
200
+ if ( esc_attr( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
201
  echo '>' . __( 'Play each video in order', 'youtube-embed' ) . '</option><option value="random"';
202
+ if ( esc_attr( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
203
  echo '>' . __( 'Play videos randomly', 'youtube-embed' ) . '</option><option value="single"';
204
+ if ( esc_attr( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
205
  echo '>' . __( 'Play one random video', 'youtube-embed' ) . '</option></select></td></tr>';
206
 
207
  echo "</table>\n";
includes/options-general.php CHANGED
@@ -21,24 +21,38 @@ if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
21
 
22
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'youtube_embed_general_nonce' ) ) ) {
23
 
24
- if ( isset( $_POST[ 'youtube_embed_editor_button' ] ) ) { $options[ 'editor_button' ] = $_POST[ 'youtube_embed_editor_button' ]; } else { $options[ 'editor_button' ] = ''; }
25
- if ( isset( $_POST[ 'youtube_embed_admin_bar' ] ) ) { $options[ 'admin_bar' ] = $_POST[ 'youtube_embed_admin_bar' ]; } else { $options[ 'admin_bar' ] = ''; }
26
-
27
- $options[ 'profile_no' ] = $_POST[ 'youtube_embed_profile_no' ];
28
- $options[ 'list_no' ] = $_POST[ 'youtube_embed_list_no' ];
29
- $options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ];
30
- $options[ 'feed' ] = $_POST[ 'youtube_embed_feed' ];
31
- $options[ 'thumbnail' ] = $_POST[ 'youtube_embed_thumbnail' ];
32
- $options[ 'privacy' ] = $_POST[ 'youtube_embed_privacy' ];
33
- $options[ 'menu_access' ] = $_POST[ 'youtube_embed_menu_access' ];
34
- $options[ 'language' ] = $_POST[ 'youtube_embed_language' ];
35
- $options[ 'script' ] = $_POST[ 'youtube_embed_script' ];
36
-
37
- if ( isset( $_POST[ 'youtube_embed_metadata' ] ) ) { $options[ 'metadata' ] = $_POST[ 'youtube_embed_metadata' ]; } else { $options[ 'metadata' ] = ''; }
38
- if ( isset( $_POST[ 'youtube_embed_frameborder' ] ) ) { $options[ 'frameborder' ] = $_POST[ 'youtube_embed_frameborder' ]; } else { $options[ 'frameborder' ] = ''; }
39
- if ( isset( $_POST[ 'youtube_embed_widgets' ] ) ) { $options[ 'widgets' ] = $_POST[ 'youtube_embed_widgets' ]; } else { $options[ 'widgets' ] = ''; }
40
- if ( isset( $_POST[ 'youtube_embed_debug' ] ) ) { $options[ 'debug' ] = $_POST[ 'youtube_embed_debug' ]; } else { $options[ 'debug' ] = ''; }
41
- if ( isset( $_POST[ 'youtube_embed_prompt' ] ) ) { $options[ 'prompt' ] = $_POST[ 'youtube_embed_prompt' ]; } else { $options[ 'prompt' ] = ''; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
 
43
  // If the number of profiles or lists is less than zero, put it to 0
44
 
@@ -52,26 +66,18 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
52
 
53
  // Update the alternative shortcodes
54
 
55
- $shortcode = $_POST[ 'youtube_embed_shortcode' ];
56
  $shortcode = trim( $shortcode, '[]' );
57
 
58
  update_option( 'youtube_embed_shortcode', $shortcode );
59
 
60
- // If the option to clear the cache has been ticked run an SQL to clear them down
61
-
62
- if ( !empty( $_POST[ 'youtube_embed_clear_cache' ] ) ) {
63
- global $wpdb;
64
- $wpdb -> query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_%ye_video_%' OR option_name LIKE '_transient_%ye_type_%' OR option_name LIKE '_transient_%ye_title_%' OR option_name LIKE '_transient_%vye_comments_%'" );
65
- $update_message .= ' ' . __( 'Cache cleared.', 'youtube-embed' );
66
- }
67
-
68
  echo '<div class="updated fade"><p><strong>' . $update_message . "</strong></p></div>\n";
69
  }
70
 
71
  // Get options
72
 
73
- $options = vye_set_general_defaults();
74
- $shortcode = vye_set_shortcode_option();
75
  ?>
76
 
77
  <p><?php _e( 'These are the general settings for YouTube Embed. Please select <a href="admin.php?page=ye-profile-options">Profiles</a> for default embedding settings.', 'youtube-embed' ); ?></p>
@@ -141,7 +147,7 @@ $shortcode = vye_set_shortcode_option();
141
 
142
  <tr>
143
  <th scope="row"><?php _e( 'Alternative Shortcode', 'youtube-embed' ); ?></th>
144
- <td><label for="youtube_embed_shortcode"><input type="text" size="30" name="youtube_embed_shortcode" value="<?php echo $shortcode; ?>"/></label>
145
  <p class="description"><?php _e( 'An alternative shortcode to use.', 'youtube-embed' ); ?></p></td>
146
  </tr>
147
 
@@ -199,7 +205,7 @@ $shortcode = vye_set_shortcode_option();
199
 
200
  <tr>
201
  <th scope="row"><?php _e( 'Number of Profiles', 'youtube-embed' ); ?></th>
202
- <td><label for="youtube_embed_profile_no"><input type="text" size="2" maxlength="2" name="youtube_embed_profile_no" value="<?php echo $options[ 'profile_no' ]; ?>"/></label>
203
  <p class="description"><?php _e( 'Maximum number of profiles.', 'youtube-embed' ); ?></p></td>
204
  </tr>
205
 
@@ -207,7 +213,7 @@ $shortcode = vye_set_shortcode_option();
207
 
208
  <tr>
209
  <th scope="row"><?php _e( 'Number of Lists', 'youtube-embed' ); ?></th>
210
- <td><label for="youtube_embed_list_no"><input type="text" size="2" maxlength="2" name="youtube_embed_list_no" value="<?php echo $options[ 'list_no' ]; ?>"/></label>
211
  <p class="description"><?php _e( 'Maximum number of lists.', 'youtube-embed' ); ?></p></td>
212
  </tr>
213
 
@@ -248,8 +254,17 @@ $shortcode = vye_set_shortcode_option();
248
 
249
  <tr>
250
  <th scope="row"><?php _e( 'Interface language', 'youtube-embed' ); ?></th>
251
- <td><label for="youtube_embed_language"><input type="text" size="5" maxlength="5" name="youtube_embed_language" value="<?php echo $options[ 'language' ]; ?>"/><?php _e( 'The player\'s interface language', 'youtube-embed' ); ?></label>
252
- <p class="description"><?php echo __( 'The parameter value is an <a href="http://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>
 
 
 
 
 
 
 
 
 
253
  </tr>
254
 
255
  </table>
21
 
22
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'youtube_embed_general_nonce' ) ) ) {
23
 
24
+ // If the number of profiles or lists have changed check that they all have
25
+ // correct values assigned (if at all)
26
+
27
+ $options = vye_get_general_defaults();
28
+ if ( isset( $options[ 'list_no' ] ) && isset( $_POST[ 'youtube_embed_list_no' ] ) && $options[ 'list_no' ] != $_POST[ 'youtube_embed_list_no' ] ) {
29
+ vye_set_list( sanitize_text_field( $_POST[ 'youtube_embed_list_no' ] ) );
30
+ }
31
+ if ( isset( $options[ 'profile_no' ] ) && isset( $_POST[ 'youtube_embed_list_no' ] ) && $options[ 'profile_no' ] != $_POST[ 'youtube_embed_list_no' ] ) {
32
+ vye_set_profile( sanitize_text_field( $_POST[ 'youtube_embed_profile_no' ] ) );
33
+ }
34
+
35
+ // Update options
36
+
37
+ if ( isset( $_POST[ 'youtube_embed_editor_button' ] ) ) { $options[ 'editor_button' ] = sanitize_text_field( $_POST[ 'youtube_embed_editor_button' ] ); } else { $options[ 'editor_button' ] = ''; }
38
+ if ( isset( $_POST[ 'youtube_embed_admin_bar' ] ) ) { $options[ 'admin_bar' ] = sanitize_text_field( $_POST[ 'youtube_embed_admin_bar' ] ); } else { $options[ 'admin_bar' ] = ''; }
39
+
40
+ $options[ 'profile_no' ] = sanitize_text_field( $_POST[ 'youtube_embed_profile_no' ] );
41
+ $options[ 'list_no' ] = sanitize_text_field( $_POST[ 'youtube_embed_list_no' ] );
42
+ $options[ 'alt_profile' ] = sanitize_text_field( $_POST[ 'youtube_embed_alt_profile' ] );
43
+ $options[ 'feed' ] = sanitize_text_field( $_POST[ 'youtube_embed_feed' ] );
44
+ $options[ 'thumbnail' ] = sanitize_text_field( $_POST[ 'youtube_embed_thumbnail' ] );
45
+ $options[ 'privacy' ] = sanitize_text_field( $_POST[ 'youtube_embed_privacy' ] );
46
+ $options[ 'menu_access' ] = sanitize_text_field( $_POST[ 'youtube_embed_menu_access' ] );
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
 
66
 
67
  // Update the alternative shortcodes
68
 
69
+ $shortcode = sanitize_text_field( $_POST[ 'youtube_embed_shortcode' ] );
70
  $shortcode = trim( $shortcode, '[]' );
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
78
 
79
+ $options = vye_get_general_defaults();
80
+ $shortcode = vye_get_shortcode();
81
  ?>
82
 
83
  <p><?php _e( 'These are the general settings for YouTube Embed. Please select <a href="admin.php?page=ye-profile-options">Profiles</a> for default embedding settings.', 'youtube-embed' ); ?></p>
147
 
148
  <tr>
149
  <th scope="row"><?php _e( 'Alternative Shortcode', 'youtube-embed' ); ?></th>
150
+ <td><label for="youtube_embed_shortcode"><input type="text" size="30" name="youtube_embed_shortcode" value="<?php echo esc_attr( $shortcode ); ?>"/></label>
151
  <p class="description"><?php _e( 'An alternative shortcode to use.', 'youtube-embed' ); ?></p></td>
152
  </tr>
153
 
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
 
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
 
254
 
255
  <tr>
256
  <th scope="row"><?php _e( 'Interface language', 'youtube-embed' ); ?></th>
257
+ <td><label for="youtube_embed_language"><input type="text" size="5" maxlength="5" name="youtube_embed_language" value="<?php echo esc_attr( $options[ 'language' ] ); ?>"/><?php _e( 'The player\'s interface language', 'youtube-embed' ); ?></label>
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>
includes/options-lists.php CHANGED
@@ -10,7 +10,7 @@
10
 
11
  // Set current list number
12
 
13
- if ( isset( $_POST[ 'youtube_embed_list_no' ] ) ) { $list_no = $_POST[ 'youtube_embed_list_no' ]; } else { $list_no = 0; }
14
  if ( $list_no == '' ) { $list_no = 1; }
15
 
16
  // If options have been updated on screen, update the database
@@ -26,7 +26,7 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
26
  $class = 'error';
27
  $message = __( 'All fields must be completed.', 'youtube-embed' );
28
  } else {
29
- $id_array = explode( "\n", $_POST[ 'youtube_embed_video_list' ] );
30
  $loop = 0;
31
  $valid = true;
32
 
@@ -61,7 +61,7 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
61
  $options[ 'name' ] = $_POST[ 'youtube_embed_name' ];
62
 
63
  if ( $new_id_list == '' ) {
64
- $options[ 'list' ] = $_POST[ 'youtube_embed_video_list' ];
65
  } else {
66
  $options[ 'list' ] = substr( $new_id_list, 0, strlen( $new_id_list ) - 1 );
67
  }
@@ -74,8 +74,8 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
74
 
75
  // Fetch options into an array
76
 
77
- if ( $class != "error" ) { $options = vye_set_list_defaults( $list_no ); }
78
- $general = vye_set_general_defaults();
79
 
80
  // Get number of lists in use
81
 
@@ -83,9 +83,9 @@ $loop = 1;
83
  $max_list = 0;
84
  while ( $loop <= $general[ 'list_no' ] ) {
85
 
86
- $list = get_option( 'youtube_embed_list' . $loop );
87
 
88
- if ( $list == '' ) {
89
  $max_list = $loop - 1;
90
  $loop = $general[ 'list_no' ];
91
  }
@@ -95,7 +95,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
95
  // Display any screen headings
96
 
97
  ?>
98
- <div class="wrap" style="width: 1010px;">
99
  <?php
100
  global $wp_version;
101
  if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
@@ -117,11 +117,14 @@ if ( $message != '' ) { echo '<div class="' . $class . '"><p><strong>' . $messag
117
  $loop = 1;
118
  while ( $loop <= $general[ 'list_no' ] ) {
119
 
120
- $listfiles = get_option( 'youtube_embed_list' . $loop );
121
- $listname = $listfiles[ 'name' ];
122
- $list_found = true;
123
-
124
- if ( $listname == '' ) { $listname = __( 'List', 'youtube-embed' ) . ' ' . $loop; $list_found = false; }
 
 
 
125
  echo '<option value="' . $loop . '"';
126
  if ( $list_no == $loop ) { echo " selected='selected'"; }
127
  echo '>' . $listname;
@@ -143,7 +146,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
143
 
144
  <tr>
145
  <th scope="row"><?php _e( 'List Name', 'youtube-embed' ); ?></th>
146
- <td><label for="youtube_embed_name"><input type="text" size="20" name="youtube_embed_name" value="<?php echo $options[ 'name' ]; ?>"/>
147
  <?php _e( 'The name you wish to give this list', 'youtube-embed' ); ?></label></td>
148
  </tr>
149
 
@@ -151,7 +154,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
151
 
152
  <tr>
153
  <th scope="row"><?php _e( 'Video IDs (one per line)', 'youtube-embed' ); ?></th>
154
- <td><label for="youtube_embed_list"><textarea name="youtube_embed_video_list" rows="10" cols="12" class="large-text code"><?php echo $options[ 'list' ]; ?></textarea></label></td>
155
  </tr>
156
 
157
  </table>
@@ -169,7 +172,7 @@ if ( $options[ 'list' ] != '' ) {
169
 
170
  $id_array = explode( "\n", $options[ 'list' ] );
171
 
172
- echo "<table class=\"widefat\">\n<thead>\n\t<tr>\n\t\t<th>" . __( 'Video ID', 'youtube-embed' ) . "</th>\n\t\t<th>" . __( 'Video Title', 'youtube-embed' ) . "</th>\n\t\t<th>" . __( 'Status', 'youtube-embed' ) . "</th>\n\t</tr>\n</thead>\n<tbody>\n";
173
  $loop = 0;
174
 
175
  while ( $loop < count( $id_array ) ) {
@@ -210,7 +213,8 @@ if ( $options[ 'list' ] != '' ) {
210
  echo 'font-weight: bold; color: #f00;';
211
  }
212
 
213
- echo '"><img src="' . plugins_url() . '/youtube-embed/images/';
 
214
  if ( $status == 0 ) {
215
  $alt_text = __( 'The video ID is valid', 'youtube-embed' );
216
  echo 'tick.png" alt="' . $alt_text . '" title="' . $alt_text . '" ';
10
 
11
  // Set current list number
12
 
13
+ if ( isset( $_POST[ 'youtube_embed_list_no' ] ) ) { $list_no = sanitize_text_field( $_POST[ 'youtube_embed_list_no' ] ); } else { $list_no = 0; }
14
  if ( $list_no == '' ) { $list_no = 1; }
15
 
16
  // If options have been updated on screen, update the database
26
  $class = 'error';
27
  $message = __( 'All fields must be completed.', 'youtube-embed' );
28
  } else {
29
+ $id_array = explode( "\n", sanitize_text_field( $_POST[ 'youtube_embed_video_list' ] ) );
30
  $loop = 0;
31
  $valid = true;
32
 
61
  $options[ 'name' ] = $_POST[ 'youtube_embed_name' ];
62
 
63
  if ( $new_id_list == '' ) {
64
+ $options[ 'list' ] = sanitize_text_field( $_POST[ 'youtube_embed_video_list' ] );
65
  } else {
66
  $options[ 'list' ] = substr( $new_id_list, 0, strlen( $new_id_list ) - 1 );
67
  }
74
 
75
  // Fetch options into an array
76
 
77
+ if ( $class != "error" ) { $options = vye_get_list( $list_no ); }
78
+ $general = vye_get_general_defaults();
79
 
80
  // Get number of lists in use
81
 
83
  $max_list = 0;
84
  while ( $loop <= $general[ 'list_no' ] ) {
85
 
86
+ $list = vye_get_list( $loop );
87
 
88
+ if ( $list[ 'list' ] == '' ) {
89
  $max_list = $loop - 1;
90
  $loop = $general[ 'list_no' ];
91
  }
95
  // Display any screen headings
96
 
97
  ?>
98
+ <div class="wrap">
99
  <?php
100
  global $wp_version;
101
  if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
117
  $loop = 1;
118
  while ( $loop <= $general[ 'list_no' ] ) {
119
 
120
+ $listfiles = vye_get_list( $loop );
121
+ if ( $listfiles[ 'list' ] != '' ) {
122
+ $listname = $listfiles[ 'name' ];
123
+ $list_found = true;
124
+ } else {
125
+ $listname = __( 'List', 'youtube-embed' ) . ' ' . $loop;
126
+ $list_found = false;
127
+ }
128
  echo '<option value="' . $loop . '"';
129
  if ( $list_no == $loop ) { echo " selected='selected'"; }
130
  echo '>' . $listname;
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
 
154
 
155
  <tr>
156
  <th scope="row"><?php _e( 'Video IDs (one per line)', 'youtube-embed' ); ?></th>
157
+ <td><label for="youtube_embed_list"><textarea name="youtube_embed_video_list" rows="10" cols="20" class="regular-text code"><?php echo esc_textarea( $options[ 'list' ] ); ?></textarea></label></td>
158
  </tr>
159
 
160
  </table>
172
 
173
  $id_array = explode( "\n", $options[ 'list' ] );
174
 
175
+ echo "<table class=\"widefat\" style=\"max-width: 800px\">\n<thead>\n\t<tr>\n\t\t<th>" . __( 'Video ID', 'youtube-embed' ) . "</th>\n\t\t<th>" . __( 'Video Title', 'youtube-embed' ) . "</th>\n\t\t<th>" . __( 'Status', 'youtube-embed' ) . "</th>\n\t</tr>\n</thead>\n<tbody>\n";
176
  $loop = 0;
177
 
178
  while ( $loop < count( $id_array ) ) {
213
  echo 'font-weight: bold; color: #f00;';
214
  }
215
 
216
+ echo '"><img src="' . plugins_url( 'images/', dirname(__FILE__) );
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 . '" ';
includes/options-profiles.php CHANGED
@@ -12,45 +12,44 @@ $demo_video = 'Wc7cvpQS-xQ';
12
 
13
  // Set current profile number
14
 
15
- if ( isset( $_POST[ 'youtube_embed_profile_no' ] ) ) { $profile_no = $_POST[ 'youtube_embed_profile_no' ]; } else { $profile_no = 0; }
16
  if ( $profile_no == '' ) { $profile_no = 0; }
17
 
18
  // If options have been updated on screen, update the database
19
 
20
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-profile' , 'youtube_embed_profile_nonce' ) ) ) {
21
 
22
- $options[ 'name' ] = htmlentities( $_POST[ 'youtube_embed_name' ] );
23
- $options[ 'width' ] = $_POST[ 'youtube_embed_width' ];
24
- $options[ 'height' ] = $_POST[ 'youtube_embed_height' ];
25
 
26
  $options[ 'template' ] = htmlspecialchars_decode( $_POST[ 'youtube_embed_template' ] );
27
  if ( strpos( $options[ 'template' ], '%video%' ) === false ) { $options[ 'template' ] = '%video%'; }
28
 
29
- $options[ 'style' ] = $_POST[ 'youtube_embed_style' ];
30
- $options[ 'autohide'] = $_POST[ 'youtube_embed_autohide' ];
31
- $options[ 'controls'] = $_POST[ 'youtube_embed_controls' ];
32
- $options[ 'wmode'] = $_POST[ 'youtube_embed_wmode' ];
33
- $options[ 'color' ] = $_POST[ 'youtube_embed_color' ];
34
- $options[ 'theme' ] = $_POST[ 'youtube_embed_theme' ];
35
- $options[ 'download_style' ] = $_POST[ 'youtube_embed_download_style' ];
36
 
37
  $options[ 'download_text' ] = str_replace( '\"', '"', str_replace( "\'", "'", $_POST[ 'youtube_embed_download_text' ] ) );
38
 
39
- if ( isset( $_POST[ 'youtube_embed_playsinline' ] ) ) { $options[ 'playsinline' ] = $_POST[ 'youtube_embed_playsinline' ]; } else { $options[ 'playsinline' ] = ''; }
40
- if ( isset( $_POST[ 'youtube_embed_fullscreen' ] ) ) { $options[ 'fullscreen' ] = $_POST[ 'youtube_embed_fullscreen' ]; } else { $options[ 'fullscreen' ] = ''; }
41
- if ( isset( $_POST[ 'youtube_embed_autoplay' ] ) ) { $options[ 'autoplay'] = $_POST[ 'youtube_embed_autoplay' ]; } else { $options[ 'autoplay' ] = ''; }
42
- if ( isset( $_POST[ 'youtube_embed_loop' ] ) ) { $options[ 'loop'] = $_POST[ 'youtube_embed_loop' ]; } else { $options[ 'loop' ] = ''; }
43
- if ( isset( $_POST[ 'youtube_embed_cc' ] ) ) { $options[ 'cc'] = $_POST[ 'youtube_embed_cc' ]; } else { $options[ 'cc' ] = ''; }
44
- if ( isset( $_POST[ 'youtube_embed_annotation' ] ) ) { $options[ 'annotation'] = $_POST[ 'youtube_embed_annotation' ]; } else { $options[ 'annotation' ] = ''; }
45
- if ( isset( $_POST[ 'youtube_embed_related' ] ) ) { $options[ 'related'] = $_POST[ 'youtube_embed_related' ]; } else { $options[ 'related' ] = ''; }
46
- if ( isset( $_POST[ 'youtube_embed_info' ] ) ) { $options[ 'info'] = $_POST[ 'youtube_embed_info' ]; } else { $options[ 'info' ] = ''; }
47
- if ( isset( $_POST[ 'youtube_embed_disablekb' ] ) ) { $options[ 'disablekb'] = $_POST[ 'youtube_embed_disablekb' ]; } else { $options[ 'disablekb' ] = ''; }
48
- if ( isset( $_POST[ 'youtube_embed_html5' ] ) ) { $options[ 'html5'] = $_POST[ 'youtube_embed_html5' ]; } else { $options[ 'html5' ] = ''; }
49
- if ( isset( $_POST[ 'youtube_embed_https' ] ) ) { $options[ 'https' ] = $_POST[ 'youtube_embed_https' ]; } else { $options[ 'https' ] = ''; }
50
- if ( isset( $_POST[ 'youtube_embed_modest' ] ) ) { $options[ 'modest' ] = $_POST[ 'youtube_embed_modest' ]; } else { $options[ 'modest' ] = ''; }
51
- if ( isset( $_POST[ 'youtube_embed_dynamic' ] ) ) { $options[ 'dynamic' ] = $_POST[ 'youtube_embed_dynamic' ]; } else { $options[ 'dynamic' ] = ''; }
52
- if ( isset( $_POST[ 'youtube_embed_fixed' ] ) ) { $options[ 'fixed' ] = $_POST[ 'youtube_embed_fixed' ]; } else { $options[ 'fixed' ] = ''; }
53
- if ( isset( $_POST[ 'youtube_embed_download' ] ) ) { $options[ 'download' ] = $_POST[ 'youtube_embed_download' ]; } else { $options[ 'download' ] = ''; }
54
 
55
  $default_size = $_POST[ 'youtube_embed_size' ];
56
 
@@ -70,10 +69,10 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
70
  $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
71
  }
72
  if ( ( $options[ 'width' ] == '' ) && ( $options[ 'height' ] != '' ) ) {
73
- $options[ 'width' ] = round( ( $options[ 'height' ] / 9 ) * 16, 0 );
74
  }
75
  if ( ( $options[ 'width' ] != '' ) && ( $options[ 'height' ] == '' ) ) {
76
- $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
77
  }
78
 
79
  update_option( 'youtube_embed_profile' . $profile_no, $options );
@@ -87,18 +86,18 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
87
 
88
  // Fetch options into an array
89
 
90
- $options = vye_set_profile_defaults( $profile_no );
91
- $general = vye_set_general_defaults();
92
 
93
  // Get number of lists in use
94
 
95
- $loop = 1;
96
- $max_list = 1;
97
  while ( $loop <= $general[ 'list_no' ] ) {
98
 
99
- $list = get_option( 'youtube_embed_profile' . $loop );
100
 
101
- if ( $list == '' ) {
102
  $max_list = $loop;
103
  $loop = $general[ 'list_no' ];
104
  }
@@ -155,7 +154,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
155
 
156
  <tr>
157
  <th scope="row"><?php _e( 'Profile Name', 'youtube-embed' ); ?></th>
158
- <td><label for="youtube_embed_name"><input type="text" size="20" name="youtube_embed_name" value="<?php echo $options[ 'name' ]; ?>"<?php if ( $profile_no == 0 ) { echo ' readonly="readonly"'; } ?>/>
159
  <?php if ( $profile_no != 0 ) { _e( 'The name you wish to give this profile', 'youtube-embed' ); } ?></label></td>
160
  </tr>
161
 
@@ -163,7 +162,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
163
 
164
  <tr>
165
  <th scope="row"><?php _e( 'Template', 'youtube-embed' ); ?></th>
166
- <td><label for="youtube_embed_template"><textarea name="youtube_embed_template" rows="4" cols="50" class="large-text code"><?php echo htmlspecialchars( $options[ 'template' ] ); ?></textarea>
167
  <p class="description"><?php _e( 'Wrapper for video output. Must include <code>%video%</code> tag to show video position.', 'youtube-embed' ); ?></p></label></td>
168
  </tr>
169
 
@@ -171,22 +170,14 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
171
 
172
  <tr>
173
  <th scope="row"><?php _e( 'Style', 'youtube-embed' ); ?></th>
174
- <td><label for="youtube_embed_style"><input type="text" name="youtube_embed_style" class="large-text code" value="<?php echo htmlspecialchars( $options[ 'style' ] ); ?>"/>
175
  <p class="description"><?php _e( 'CSS elements to apply to video.', 'youtube-embed' ); ?></p></label></td>
176
  </tr>
177
 
178
- <!-- SSL -->
179
-
180
- <tr>
181
- <th scope="row"><?php _e( 'SSL', 'youtube-embed' ); ?></th>
182
- <td><label for="youtube_embed_https"><input type="checkbox" name="youtube_embed_https" value="1"<?php if ( $options[ 'https' ] == "1" ) { echo ' checked="checked"'; } ?>/>
183
- <?php _e( 'Use SSL? <a href="http://www.google.com/support/youtube/bin/answer.py?answer=171780&expand=UseHTTPS#HTTPS">Read more</a>', 'youtube-embed' ); ?></label></td>
184
- </tr>
185
-
186
  <!-- Window Mode -->
187
 
188
  <tr>
189
- <th scope="row"><?php _e( 'Window Mode', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url() ; ?>/youtube-embed/images/flash.png' width='10px' align='top'></th>
190
  <td><label for="youtube_embed_wmode"><select name="youtube_embed_wmode">
191
  <option value="opaque"<?php if ( $options[ 'wmode' ] == "opaque" ) { echo " selected='selected'"; } ?>><?php _e( 'Opaque', 'youtube-embed' ); ?></option>
192
  <option value="transparent"<?php if ( $options[ 'wmode' ] == "transparent" ) { echo " selected='selected'"; } ?>><?php _e( 'Transparent', 'youtube-embed' ); ?></option>
@@ -201,7 +192,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
201
 
202
  <tr>
203
  <th scope="row"><?php _e( 'Video Size', 'youtube-embed' ); ?></th>
204
- <td><label for="youtube_embed_height"><input type="text" size="3" maxlength="3" name="youtube_embed_width" value="<?php echo $options[ 'width' ]; ?>"/>&nbsp;x&nbsp;<input type="text" size="3" maxlength="3" name="youtube_embed_height" value="<?php echo $options[ 'height' ]; ?>"/>
205
  <?php _e( 'The width x height of the video, in pixels', 'youtube-embed' ); ?></label></td>
206
  </tr>
207
 
@@ -219,10 +210,10 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
219
  </select></label><p class="description"><?php _e( 'Select one of these default sizes to override the above video sizes.', 'youtube-embed' ); ?></p></td>
220
  </tr>
221
 
222
- <!-- Dynamically Resize -->
223
 
224
  <tr>
225
- <th scope="row"><?php _e( 'Dynamically Resize', 'youtube-embed' ); ?></th>
226
  <td><label for="youtube_embed_dynamic"><input type="checkbox" name="youtube_embed_dynamic" value="1"<?php if ( $options[ 'dynamic' ] == "1" ) { echo ' checked="checked"'; } ?>/>
227
  <?php _e( 'Show full width and resize with the browser', 'youtube-embed' ); ?></label></td>
228
  </tr>
@@ -238,7 +229,8 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
238
  <!-- Playsinline -->
239
 
240
  <tr>
241
- <th scope="row"><?php _e( 'Plays Inline', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url() ; ?>/youtube-embed/images/html5.png' width='10px' align='top'></th>
 
242
  <td><label for="youtube_embed_playsinline"><input type="checkbox" name="youtube_embed_playsinline" value="1"<?php if ( $options[ 'playsinline' ] == "1" ) { echo ' checked="checked"'; } ?>/>
243
  <?php _e( 'Whether videos play inline or fullscreen in an HTML5 player on iOS. ', 'youtube-embed' ); ?></label></td>
244
  </tr>
@@ -324,7 +316,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
324
  <!-- Auto Hide -->
325
 
326
  <tr>
327
- <th scope="row"><?php _e( 'Auto hide', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url() ; ?>/youtube-embed/images/flash.png' width='10px' align='top'></th>
328
  <td><label for="youtube_embed_autohide"><select name="youtube_embed_autohide">
329
  <option value="0"<?php if ( $options[ 'autohide' ] == "0" ) { echo " selected='selected'"; } ?>><?php _e( 'Controls &amp; progress bar remain visible', 'youtube-embed' ); ?></option>
330
  <option value="1"<?php if ( $options[ 'autohide' ] == "1" ) { echo " selected='selected'"; } ?>><?php _e( 'Controls &amp; progress bar fade out', 'youtube-embed' ); ?></option>
@@ -364,7 +356,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
364
  <!-- Theme -->
365
 
366
  <tr>
367
- <th scope="row"><?php _e( 'Theme', 'youtube-embed' ); ?>&nbsp;<img src='<?php echo plugins_url() ; ?>/youtube-embed/images/flash.png' width='10px' align='top'></th>
368
  <td><label for="youtube_embed_theme"><select name="youtube_embed_theme">
369
  <option value="dark"<?php if ( $options[ 'theme' ] == "dark" ) { echo " selected='selected'"; } ?>><?php _e( 'Dark', 'youtube-embed' ); ?></option>
370
  <option value="light"<?php if ( $options[ 'theme' ] == "light" ) { echo " selected='selected'"; } ?>><?php _e( 'Light', 'youtube-embed' ); ?></option>
@@ -397,7 +389,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
397
 
398
  <tr>
399
  <th scope="row"><?php _e( 'Download Text', 'youtube-embed' ); ?></th>
400
- <td><label for="youtube_embed_download_txt"><input type="text" name="youtube_embed_download_text" class="large-text" value="<?php echo htmlspecialchars( $options[ 'download_text' ] ); ?>"/>
401
  <p class="description"><?php _e( 'Text or HTML to display to prompt download.', 'youtube-embed' ); ?></p></label></td>
402
  </tr>
403
 
@@ -405,7 +397,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
405
 
406
  <tr>
407
  <th scope="row"><?php _e( 'Download Style', 'youtube-embed' ); ?></th>
408
- <td><label for="youtube_embed_download_style"><input type="text" name="youtube_embed_download_style" class="large-text code" value="<?php echo htmlspecialchars( $options[ 'download_style' ] ); ?>"/>
409
  <p class="description"><?php _e( 'CSS elements to apply to video download link.', 'youtube-embed' ); ?></p></label></td>
410
  </tr>
411
 
@@ -418,7 +410,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
418
  </form>
419
 
420
  <a href="#" name="video"></a>
421
- <div style="max-width: <?php echo $options[ 'width' ]; ?>px">
422
  <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=ye-profile-options#video' ?>">
423
  <h3><?php _e( 'YouTube Video Sample', 'youtube-embed' ); ?></h3>
424
  <p><?php _e( 'The video below uses the above, saved profile settings. Use the drop-down below to change which parameters the video uses - press the Change Video button to update it.', 'youtube-embed' ); ?></p>
12
 
13
  // Set current profile number
14
 
15
+ if ( isset( $_POST[ 'youtube_embed_profile_no' ] ) ) { $profile_no = sanitize_text_field( $_POST[ 'youtube_embed_profile_no' ] ); } else { $profile_no = 0; }
16
  if ( $profile_no == '' ) { $profile_no = 0; }
17
 
18
  // If options have been updated on screen, update the database
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
 
26
  $options[ 'template' ] = htmlspecialchars_decode( $_POST[ 'youtube_embed_template' ] );
27
  if ( strpos( $options[ 'template' ], '%video%' ) === false ) { $options[ 'template' ] = '%video%'; }
28
 
29
+ $options[ 'style' ] = sanitize_text_field( $_POST[ 'youtube_embed_style' ] );
30
+ $options[ 'autohide'] = sanitize_text_field( $_POST[ 'youtube_embed_autohide' ] );
31
+ $options[ 'controls'] = sanitize_text_field( $_POST[ 'youtube_embed_controls' ] );
32
+ $options[ 'wmode'] = sanitize_text_field( $_POST[ 'youtube_embed_wmode' ] );
33
+ $options[ 'color' ] = sanitize_text_field( $_POST[ 'youtube_embed_color' ] );
34
+ $options[ 'theme' ] = sanitize_text_field( $_POST[ 'youtube_embed_theme' ] );
35
+ $options[ 'download_style' ] = sanitize_text_field( $_POST[ 'youtube_embed_download_style' ] );
36
 
37
  $options[ 'download_text' ] = str_replace( '\"', '"', str_replace( "\'", "'", $_POST[ 'youtube_embed_download_text' ] ) );
38
 
39
+ if ( isset( $_POST[ 'youtube_embed_playsinline' ] ) ) { $options[ 'playsinline' ] = sanitize_text_field( $_POST[ 'youtube_embed_playsinline' ] ); } else { $options[ 'playsinline' ] = ''; }
40
+ if ( isset( $_POST[ 'youtube_embed_fullscreen' ] ) ) { $options[ 'fullscreen' ] = sanitize_text_field( $_POST[ 'youtube_embed_fullscreen' ] ); } else { $options[ 'fullscreen' ] = ''; }
41
+ if ( isset( $_POST[ 'youtube_embed_autoplay' ] ) ) { $options[ 'autoplay'] = sanitize_text_field( $_POST[ 'youtube_embed_autoplay' ] ); } else { $options[ 'autoplay' ] = ''; }
42
+ if ( isset( $_POST[ 'youtube_embed_loop' ] ) ) { $options[ 'loop'] = sanitize_text_field( $_POST[ 'youtube_embed_loop' ] ); } else { $options[ 'loop' ] = ''; }
43
+ if ( isset( $_POST[ 'youtube_embed_cc' ] ) ) { $options[ 'cc'] = sanitize_text_field( $_POST[ 'youtube_embed_cc' ] ); } else { $options[ 'cc' ] = ''; }
44
+ if ( isset( $_POST[ 'youtube_embed_annotation' ] ) ) { $options[ 'annotation'] = sanitize_text_field( $_POST[ 'youtube_embed_annotation' ] ); } else { $options[ 'annotation' ] = ''; }
45
+ if ( isset( $_POST[ 'youtube_embed_related' ] ) ) { $options[ 'related'] = sanitize_text_field( $_POST[ 'youtube_embed_related' ] ); } else { $options[ 'related' ] = ''; }
46
+ if ( isset( $_POST[ 'youtube_embed_info' ] ) ) { $options[ 'info'] = sanitize_text_field( $_POST[ 'youtube_embed_info' ] ); } else { $options[ 'info' ] = ''; }
47
+ if ( isset( $_POST[ 'youtube_embed_disablekb' ] ) ) { $options[ 'disablekb'] = sanitize_text_field( $_POST[ 'youtube_embed_disablekb' ] ); } else { $options[ 'disablekb' ] = ''; }
48
+ if ( isset( $_POST[ 'youtube_embed_html5' ] ) ) { $options[ 'html5'] = sanitize_text_field( $_POST[ 'youtube_embed_html5' ] ); } else { $options[ 'html5' ] = ''; }
49
+ if ( isset( $_POST[ 'youtube_embed_modest' ] ) ) { $options[ 'modest' ] = sanitize_text_field( $_POST[ 'youtube_embed_modest' ] ); } else { $options[ 'modest' ] = ''; }
50
+ if ( isset( $_POST[ 'youtube_embed_dynamic' ] ) ) { $options[ 'dynamic' ] = sanitize_text_field( $_POST[ 'youtube_embed_dynamic' ] ); } else { $options[ 'dynamic' ] = ''; }
51
+ if ( isset( $_POST[ 'youtube_embed_fixed' ] ) ) { $options[ 'fixed' ] = sanitize_text_field( $_POST[ 'youtube_embed_fixed' ] ); } else { $options[ 'fixed' ] = ''; }
52
+ if ( isset( $_POST[ 'youtube_embed_download' ] ) ) { $options[ 'download' ] = sanitize_text_field( $_POST[ 'youtube_embed_download' ] ); } else { $options[ 'download' ] = ''; }
 
53
 
54
  $default_size = $_POST[ 'youtube_embed_size' ];
55
 
69
  $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
70
  }
71
  if ( ( $options[ 'width' ] == '' ) && ( $options[ 'height' ] != '' ) ) {
72
+ $options[ 'width' ] = round( ( $options[ 'height' ] / 9 ) * 16, 0 );
73
  }
74
  if ( ( $options[ 'width' ] != '' ) && ( $options[ 'height' ] == '' ) ) {
75
+ $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
76
  }
77
 
78
  update_option( 'youtube_embed_profile' . $profile_no, $options );
86
 
87
  // Fetch options into an array
88
 
89
+ $options = vye_get_profile( $profile_no );
90
+ $general = vye_get_general_defaults();
91
 
92
  // Get number of lists in use
93
 
94
+ $loop = 0;
95
+ $max_list = $general[ 'list_no' ];
96
  while ( $loop <= $general[ 'list_no' ] ) {
97
 
98
+ $list = vye_get_profile( $loop );
99
 
100
+ if ( $list[ 'default' ] ) {
101
  $max_list = $loop;
102
  $loop = $general[ 'list_no' ];
103
  }
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
 
162
 
163
  <tr>
164
  <th scope="row"><?php _e( 'Template', 'youtube-embed' ); ?></th>
165
+ <td><label for="youtube_embed_template"><textarea name="youtube_embed_template" rows="4" cols="50" class="large-text code"><?php echo esc_html( $options[ 'template' ] ); ?></textarea>
166
  <p class="description"><?php _e( 'Wrapper for video output. Must include <code>%video%</code> tag to show video position.', 'youtube-embed' ); ?></p></label></td>
167
  </tr>
168
 
170
 
171
  <tr>
172
  <th scope="row"><?php _e( 'Style', 'youtube-embed' ); ?></th>
173
+ <td><label for="youtube_embed_style"><input type="text" name="youtube_embed_style" class="large-text code" value="<?php echo esc_html( $options[ 'style' ] ); ?>"/>
174
  <p class="description"><?php _e( 'CSS elements to apply to video.', 'youtube-embed' ); ?></p></label></td>
175
  </tr>
176
 
 
 
 
 
 
 
 
 
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>
192
 
193
  <tr>
194
  <th scope="row"><?php _e( 'Video Size', 'youtube-embed' ); ?></th>
195
+ <td><label for="youtube_embed_height"><input type="text" size="3" maxlength="3" name="youtube_embed_width" value="<?php echo esc_attr( $options[ 'width' ] ); ?>"/>&nbsp;x&nbsp;<input type="text" size="3" maxlength="3" name="youtube_embed_height" value="<?php echo esc_attr( $options[ 'height' ] ); ?>"/>
196
  <?php _e( 'The width x height of the video, in pixels', 'youtube-embed' ); ?></label></td>
197
  </tr>
198
 
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
 
213
+ <!-- Responsive Output -->
214
 
215
  <tr>
216
+ <th scope="row"><?php _e( 'Responsive Output', 'youtube-embed' ); ?></th>
217
  <td><label for="youtube_embed_dynamic"><input type="checkbox" name="youtube_embed_dynamic" value="1"<?php if ( $options[ 'dynamic' ] == "1" ) { echo ' checked="checked"'; } ?>/>
218
  <?php _e( 'Show full width and resize with the browser', 'youtube-embed' ); ?></label></td>
219
  </tr>
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>
236
  </tr>
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
  <!-- 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>
389
 
390
  <tr>
391
  <th scope="row"><?php _e( 'Download Text', 'youtube-embed' ); ?></th>
392
+ <td><label for="youtube_embed_download_txt"><input type="text" name="youtube_embed_download_text" class="large-text" value="<?php echo esc_html( $options[ 'download_text' ] ); ?>"/>
393
  <p class="description"><?php _e( 'Text or HTML to display to prompt download.', 'youtube-embed' ); ?></p></label></td>
394
  </tr>
395
 
397
 
398
  <tr>
399
  <th scope="row"><?php _e( 'Download Style', 'youtube-embed' ); ?></th>
400
+ <td><label for="youtube_embed_download_style"><input type="text" name="youtube_embed_download_style" class="large-text code" value="<?php echo esc_html( $options[ 'download_style' ] ); ?>"/>
401
  <p class="description"><?php _e( 'CSS elements to apply to video download link.', 'youtube-embed' ); ?></p></label></td>
402
  </tr>
403
 
410
  </form>
411
 
412
  <a href="#" name="video"></a>
413
+ <div style="max-width: <?php echo esc_attr( $options[ 'width' ] ); ?>px">
414
  <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=ye-profile-options#video' ?>">
415
  <h3><?php _e( 'YouTube Video Sample', 'youtube-embed' ); ?></h3>
416
  <p><?php _e( 'The video below uses the above, saved profile settings. Use the drop-down below to change which parameters the video uses - press the Change Video button to update it.', 'youtube-embed' ); ?></p>
includes/shared-functions.php CHANGED
@@ -7,85 +7,6 @@
7
  * @package YouTube-Embed
8
  */
9
 
10
- /**
11
- * Is Do Not Track active?
12
- *
13
- * Function to return whether Do Not Track is active in the current
14
- * browser
15
- *
16
- * @since 2.6
17
- *
18
- * @return string True or false
19
- */
20
-
21
- function vye_do_not_track() { // 1.0
22
-
23
- if ( isset( $_SERVER[ 'HTTP_DNT' ] ) ) {
24
- if ( $_SERVER[ 'HTTP_DNT' ] == 1 ) { return true; }
25
- } else {
26
- if ( function_exists( 'getallheaders' ) ) {
27
- foreach ( getallheaders() as $key => $value ) {
28
- if ( ( strtolower( $key ) === 'dnt' ) && ( $value == 1 ) ) { return true; }
29
- }
30
- }
31
- }
32
- return false;
33
- }
34
-
35
- /**
36
- * Get the cookie path
37
- *
38
- * Work out the path for the current installation to add cookies for
39
- *
40
- * @since 2.6
41
- *
42
- * @return string Cookie path
43
- */
44
-
45
- function vye_get_cookie_path() {
46
-
47
- // Remove the http:// from the beginning of the site URL
48
-
49
- $path = str_replace( 'http://', '', site_url( '/', 'http' ) );
50
-
51
- // Find the first slash in the results
52
-
53
- $pos = strpos( $path, '/' );
54
-
55
- // Strip all before the first slash
56
-
57
- $path = substr( $path, $pos ) . 'wp-content/';
58
-
59
- return $path;
60
- }
61
-
62
- /**
63
- * Extract parameters (1.0)
64
- *
65
- * Function to extract parameters from an input string
66
- *
67
- * @since 2.0
68
- *
69
- * @param string $input Input string to search through
70
- * @param string $para Parameter to look for
71
- * @return string Parameter value (if found)
72
- */
73
-
74
- function vye_get_parameters( $input, $para ) {
75
-
76
- $start = strpos( strtolower( $input ), $para . '=' );
77
- $content = '';
78
-
79
- if ( $start !== false ) {
80
- $start = $start + strlen( $para ) + 1;
81
- $end=strpos( strtolower( $input ), '&', $start );
82
- if ( $end !== false ) { $end = $end - 1; } else { $end = strlen( $input ); }
83
- $content = substr( $input, $start, $end - $start + 1 );
84
- }
85
-
86
- return $content;
87
- }
88
-
89
  /**
90
  * Extract a video ID
91
  *
@@ -175,11 +96,11 @@ function vye_extract_id( $id ) {
175
  function vye_validate_id( $id ) {
176
 
177
  $type = '';
178
- if ( strtolower( substr( $id, 0, 2 ) ) == 'pl') {
179
- $type = 'p';
180
  } else {
181
- if ( strlen( $id ) == 11 ) {
182
- $type = 'v';
183
  } else {
184
  if ( strlen( $id ) == 16 ) {
185
  $type = 'p';
@@ -230,117 +151,6 @@ function vye_convert( $input ) {
230
  return $output;
231
  }
232
 
233
- /**
234
- * Convert input to a 1 or 3 equivalent
235
- *
236
- * Function to convert a Yes or No input to an equivalent 1 or 3 output
237
- *
238
- * @since 2.0
239
- *
240
- * @uses vye_yes_or_no Convert input to a true or false equivalent
241
- *
242
- * @param string $input Input, usually Yes or No
243
- * @return string 1, 3 or blank, depending on input
244
- */
245
-
246
- function vye_convert_3( $input ) {
247
-
248
- $input = vye_yes_or_no( $input );
249
- $output = '';
250
- if ( $input === true ) { $output = '1'; }
251
- if ( $input === false ) { $output = '3'; }
252
-
253
- return $output;
254
- }
255
-
256
- /**
257
- * Convert input to True or False (1.0)
258
- *
259
- * Return true or false, depending on the input. Possible inputs are Yes, No, 0, 1, True,
260
- * False, On, Off
261
- *
262
- * @since 2.0
263
- *
264
- * @param string $input Value passed for checking
265
- * @return string Blank string or boolean true, false
266
- */
267
-
268
- function vye_yes_or_no( $input = '' ) {
269
-
270
- $input = strtolower( $input );
271
- if ( ( $input === true ) or ( $input == 'true' ) or ( $input == '1' ) or ( $input == 'yes' ) or ( $input == 'on' ) ) { return true; }
272
- if ( ( $input === false ) or ( $input == 'false' ) or ( $input == '0' ) or ( $input == 'no' ) or ( $input == 'off' ) ) { return false; }
273
-
274
- return;
275
- }
276
-
277
- /**
278
- * Fetch a file (1.6)
279
- *
280
- * Use WordPress API to fetch a file and check results
281
- * RC is 0 to indicate success, -1 a failure
282
- *
283
- * @since 2.0
284
- *
285
- * @param string $filein File name to fetch
286
- * @param string $header Only get headers?
287
- * @return string Array containing file contents and response
288
- */
289
-
290
- function vye_get_file( $filein, $header = false ) {
291
-
292
- $rc = 0;
293
- $error = '';
294
- if ( $header ) {
295
- $fileout = wp_remote_head( $filein );
296
- if ( is_wp_error( $fileout ) ) {
297
- $error = 'Header: '.$fileout->get_error_message();
298
- $rc = -1;
299
- }
300
- } else {
301
- $fileout = wp_remote_get( $filein );
302
- if ( is_wp_error( $fileout ) ) {
303
- $error = 'Body: '.$fileout->get_error_message();
304
- $rc = -1;
305
- } else {
306
- if ( isset( $fileout[ 'body' ] ) ) {
307
- $file_return[ 'file' ] = $fileout[ 'body' ];
308
- }
309
- }
310
- }
311
-
312
- $file_return[ 'error' ] = $error;
313
- $file_return[ 'rc' ] = $rc;
314
- if ( !is_wp_error( $fileout ) ) {
315
- if ( isset( $fileout[ 'response' ][ 'code' ] ) ) {
316
- $file_return[ 'response' ] = $fileout[ 'response' ][ 'code' ];
317
- }
318
- }
319
-
320
- return $file_return;
321
- }
322
-
323
- /**
324
- * Convert autohide parameter
325
- *
326
- * Convert autohide text value to a numeric equivalent
327
- *
328
- * @since 2.0
329
- *
330
- * @param string $autohide Autohide parameter value
331
- * @return string Autohide numeric equivalent
332
- */
333
-
334
- function vye_set_autohide( $autohide ) {
335
-
336
- $autohide = strtolower( $autohide );
337
- if ( $autohide == 'no' ) { $autohide = '0'; }
338
- if ( $autohide == 'yes' ) { $autohide = '1'; }
339
- if ( $autohide == 'fade' ) { $autohide = '2'; }
340
-
341
- return $autohide;
342
- }
343
-
344
  /**
345
  * Generate a profile list
346
  *
@@ -355,21 +165,16 @@ function vye_set_autohide( $autohide ) {
355
 
356
  function vye_generate_profile_list( $current, $total, $full_list = false ) {
357
 
358
- echo '<option value="0"';
359
- if ( $current == "0" ) { echo " selected='selected'"; }
360
- echo ' >' . __( 'Default' ) . '</option>';
361
- $loop = 1;
362
  while ( $loop <= $total ) {
363
 
364
  // Attempt to get profile
365
 
366
- $profiles = get_option( 'youtube_embed_profile' . $loop );
367
- $profname = $profiles[ 'name' ];
368
- $list_found = true;
369
 
370
  // If list is undefined, give it a default name
371
 
372
- if ( $profname == '' ) { $profname = __( 'Profile' ) . ' ' . $loop; $list_found = false; }
373
 
374
  // Output profile information
375
 
@@ -377,7 +182,7 @@ function vye_generate_profile_list( $current, $total, $full_list = false ) {
377
 
378
  echo '<option value="' . $loop . '"';
379
  if ( $current == $loop ) { echo " selected='selected'"; }
380
- echo '>' . __( $profname );
381
  if ( !$list_found ) { echo ' [undefined]'; }
382
  echo "</option>\n";
383
 
@@ -390,45 +195,20 @@ function vye_generate_profile_list( $current, $total, $full_list = false ) {
390
  }
391
 
392
  /**
393
- * Extract XML (2.0)
394
  *
395
- * Function to extract from an XML compatible file
 
396
  *
397
- * @since
398
  *
399
- * @param string $input The XML file
400
- * @param string $tag The tag to search for
401
- * @return string The tag contents
402
  */
403
 
404
- function vye_extract_xml( $input, $tag ) {
405
-
406
- $field = '';
407
- $tag = trim( $tag );
408
-
409
- // Find start tag
410
-
411
- $start_tag = strpos( $input, '<' . $tag . ' ' );
412
- if ( !$start_tag ) { $start_tag = strpos( $input, '<' . $tag . '>' ); }
413
-
414
- if ( $start_tag !== false ) {
415
-
416
- // Find the end of the start field
417
-
418
- $field_start = strpos( $input, '>', $start_tag );
419
-
420
- // Find the end tag
421
-
422
- $field_end = strpos( $input, '</' . $tag . '>' );
423
-
424
- // Now extract the field
425
 
426
- if ( ( $field_start !== false ) && ( $field_start !== false ) ) {
427
- $field = substr( $input, $field_start + 1, $field_end - $field_start - 1 );
428
- }
429
- }
430
 
431
- return $field;
432
  }
433
 
434
  /**
@@ -441,17 +221,10 @@ function vye_extract_xml( $input, $tag ) {
441
  * @return string Alternative Shortcode
442
  */
443
 
444
- function vye_set_shortcode_option() {
445
 
446
  $shortcode = get_option( 'youtube_embed_shortcode' );
447
 
448
- // If an array, transform to new format
449
-
450
- if ( is_array( $shortcode ) ) {
451
- $shortcode = $shortcode[ 1 ];
452
- update_option( 'youtube_embed_shortcode', $shortcode );
453
- }
454
-
455
  // If setting doesn't exist, set defaults
456
 
457
  if ( $shortcode == '' ) {
@@ -462,6 +235,23 @@ function vye_set_shortcode_option() {
462
  return $shortcode;
463
  }
464
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
465
  /**
466
  * Function to set general YouTube options
467
  *
@@ -469,7 +259,7 @@ function vye_set_shortcode_option() {
469
  *
470
  * @since 2.0
471
  *
472
- * @return strings Options array
473
  */
474
 
475
  function vye_set_general_defaults() {
@@ -498,9 +288,16 @@ function vye_set_general_defaults() {
498
  'language' => '',
499
  'debug' => 1,
500
  'script' => '',
501
- 'prompt' => 1
 
502
  );
503
 
 
 
 
 
 
 
504
  $new_options = array_merge( $default_array, $options );
505
 
506
  // Update the options, if changed, and return the result
@@ -510,29 +307,99 @@ function vye_set_general_defaults() {
510
  return $new_options;
511
  }
512
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
513
  /**
514
  * Function to set YouTube profile options
515
  *
516
- * Looks up profile options, based on passed profile numer.
517
  * If none exist, or some are missing, set default values
518
  *
519
  * @since 2.0
520
  *
521
- * @param string $profile Profile number
522
  * @return string Options array
523
  */
524
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
525
  function vye_set_profile_defaults( $profile ) {
526
 
 
 
527
  if ( $profile == 0 ) {
528
  $profname = 'Default';
529
  } else {
530
  $profname = 'Profile ' . $profile;
531
  }
532
- $options = get_option( 'youtube_embed_profile' . $profile );
533
-
534
- $changed = false;
535
- $new_user = false;
536
 
537
  // Work out default dimensions
538
 
@@ -541,63 +408,62 @@ function vye_set_profile_defaults( $profile ) {
541
  if ( ( $width == 0 ) or ( $width == '' ) ) { $width = 560; }
542
  $height = 25 + round( ( $width / 16 ) * 9, 0 );
543
 
544
- // If the old options exist, import them and then delete them
545
-
546
- if ( !is_array( $options ) ) {
547
- if ( ( $profile == 0 ) && ( get_option( 'youtube_embed' ) ) ) {
548
- $old_opts = get_option( 'youtube_embed' );
549
- $options = $old_opts;
550
- delete_option( 'youtube_embed' );
551
- $changed = true;
552
- } else {
553
- $options = array();
554
- }
555
- }
556
-
557
- // Because of upgrading, check each option - if not set, apply default
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
558
 
559
- if ( !array_key_exists( 'name', $options ) ) { $options[ 'name' ] = $profname; $changed = true; }
560
 
561
- if ( !array_key_exists( 'width', $options ) ) {
562
- $options[ 'width' ] = $width;
563
- $options[ 'height' ] = $height;
564
- $changed = true;
565
- }
566
- if ( !array_key_exists( 'height', $options ) ) { $options[ 'height' ] = 340; $changed = true; }
567
- if ( !array_key_exists( 'fullscreen', $options ) ) { $options[ 'fullscreen' ] = 1; $changed = true; }
568
- if ( !array_key_exists( 'template', $options ) ) { $options[ 'template' ] = '%video%'; $changed = true; }
569
- if ( !array_key_exists( 'autoplay', $options ) ) { $options[ 'autoplay' ] = ''; $changed = true; }
570
- if ( !array_key_exists( 'start', $options ) ) { $options[ 'start' ] = 0; $changed = true; }
571
- if ( !array_key_exists( 'loop', $options ) ) { $options[ 'loop' ] = ''; $changed = true; }
572
- if ( !array_key_exists( 'cc', $options ) ) { $options[ 'cc' ] = ''; $changed = true; }
573
- if ( !array_key_exists( 'annotation', $options ) ) { $options[ 'annotation' ] = 1; $changed = true; }
574
- if ( !array_key_exists( 'related', $options ) ) { $options[ 'related' ] = 1; $changed = true; }
575
- if ( !array_key_exists( 'info', $options ) ) { $options[ 'info' ] = 1; $changed = true; }
576
- if ( !array_key_exists( 'stop', $options ) ) { $options[ 'stop' ] = 0; $changed = true; }
577
- if ( !array_key_exists( 'disablekb', $options ) ) { $options[ 'disablekb' ] = ''; $changed = true; }
578
- if ( !array_key_exists( 'autohide', $options ) ) { $options[ 'autohide' ] = 2; $changed = true; }
579
- if ( !array_key_exists( 'controls', $options ) ) { $options[ 'controls' ] = 1; $changed = true; }
580
- if ( !array_key_exists( 'wmode', $options ) ) { $options[ 'wmode' ] = 'window'; $changed = true; }
581
- if ( !array_key_exists( 'style', $options ) ) { $options[ 'style' ] = ''; $changed = true; }
582
- if ( !array_key_exists( 'color', $options ) ) { $options[ 'color' ] = 'red'; $changed = true; }
583
- if ( !array_key_exists( 'theme', $options ) ) { $options[ 'theme' ] = 'dark'; $changed = true; }
584
- if ( !array_key_exists( 'https', $options ) ) { $options[ 'https' ] = 1; $changed = true; }
585
- if ( !array_key_exists( 'modest', $options ) ) { $options[ 'modest' ] = ''; $changed = true; }
586
- if ( !array_key_exists( 'dynamic', $options ) ) { $options[ 'dynamic' ] = ''; $changed = true; }
587
- if ( !array_key_exists( 'fixed', $options ) ) { $options[ 'fixed' ] = ''; $changed = true; }
588
- if ( !array_key_exists( 'download', $options ) ) { $options[ 'download' ] = ''; $changed = true; }
589
- if ( !array_key_exists( 'download_style', $options ) ) { $options[ 'download_style' ] = ''; $changed = true; }
590
- if ( !array_key_exists( 'download_text', $options ) ) { $options[ 'download_text' ] = 'Click here to download the video'; $changed = true; }
591
- if ( !array_key_exists( 'playsinline', $options ) ) { $options[ 'playsinline' ] = ''; $changed = true; }
592
- if ( !array_key_exists( 'html5', $options ) ) { $options[ 'html5' ] = ''; $changed = true; }
593
 
594
- // Update the options, if changed, and return the result
595
 
596
- if ( $changed ) { update_option( 'youtube_embed_profile' . $profile, $options ); }
597
 
598
- // Remove added slashes from template XHTML
599
 
600
- $options[ 'template' ] = stripslashes( $options[ 'template' ] );
601
 
602
  return $options;
603
  }
@@ -605,33 +471,63 @@ function vye_set_profile_defaults( $profile ) {
605
  /**
606
  * Function to set default list options
607
  *
608
- * Looks up list options, based on passed list number.
609
- * If none exist, or some are missing, set default values
610
  *
611
  * @since 2.0
612
  *
613
- * @param string $list List number
614
- * @return string Options array
615
  */
616
 
617
- function vye_set_list_defaults( $list ) {
618
 
619
- $options = get_option( 'youtube_embed_list' . $list );
620
- $changed = false;
621
 
622
- // If array doesn't exist create an empty one
623
 
624
- if ( !is_array( $options ) ) { $options = array(); }
625
 
626
- // Because of upgrading, check each option - if not set, apply default
627
 
628
- if ( !array_key_exists( 'name',$options ) ) { $options[ 'name' ] = 'List ' . $list; $changed = true; }
629
- if ( !array_key_exists( 'list',$options ) ) { $options[ 'list' ] = ''; $changed = true; }
630
 
631
- // Update the options, if changed, and return the result
632
 
633
- if ( $changed ) { update_option( 'youtube_embed_list' . $list, $options ); }
634
- return $options;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
635
  }
636
 
637
  /**
7
  * @package YouTube-Embed
8
  */
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  /**
11
  * Extract a video ID
12
  *
96
  function vye_validate_id( $id ) {
97
 
98
  $type = '';
99
+ if ( strlen( $id ) == 11 ) {
100
+ $type = 'v';
101
  } else {
102
+ if ( strtolower( substr( $id, 0, 2 ) ) == 'pl') {
103
+ $type = 'p';
104
  } else {
105
  if ( strlen( $id ) == 16 ) {
106
  $type = 'p';
151
  return $output;
152
  }
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  /**
155
  * Generate a profile list
156
  *
165
 
166
  function vye_generate_profile_list( $current, $total, $full_list = false ) {
167
 
168
+ $loop = 0;
 
 
 
169
  while ( $loop <= $total ) {
170
 
171
  // Attempt to get profile
172
 
173
+ $profiles = vye_get_profile( $loop );
 
 
174
 
175
  // If list is undefined, give it a default name
176
 
177
+ if ( $profiles[ 'default' ] ) { $list_found = false; } else { $list_found = true; }
178
 
179
  // Output profile information
180
 
182
 
183
  echo '<option value="' . $loop . '"';
184
  if ( $current == $loop ) { echo " selected='selected'"; }
185
+ echo '>' . __( $profiles[ 'name' ] );
186
  if ( !$list_found ) { echo ' [undefined]'; }
187
  echo "</option>\n";
188
 
195
  }
196
 
197
  /**
198
+ * Function to get shortcode options
199
  *
200
+ * Return shortcode options. It's in a seperate function in case any further shared
201
+ * functionality needs to be added.
202
  *
203
+ * @since 4.2
204
  *
205
+ * @return strings Alternative shortcode name
 
 
206
  */
207
 
208
+ function vye_get_shortcode() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
+ return get_option( 'youtube_embed_shortcode' );
 
 
 
211
 
 
212
  }
213
 
214
  /**
221
  * @return string Alternative Shortcode
222
  */
223
 
224
+ function vye_set_shortcode() {
225
 
226
  $shortcode = get_option( 'youtube_embed_shortcode' );
227
 
 
 
 
 
 
 
 
228
  // If setting doesn't exist, set defaults
229
 
230
  if ( $shortcode == '' ) {
235
  return $shortcode;
236
  }
237
 
238
+ /**
239
+ * Function to get general YouTube options
240
+ *
241
+ * Return options. It's in a seperate function in case any further shared
242
+ * functionality needs to be added.
243
+ *
244
+ * @since 4.2
245
+ *
246
+ * @return strings Options array
247
+ */
248
+
249
+ function vye_get_general_defaults() {
250
+
251
+ return get_option( 'youtube_embed_general' );
252
+
253
+ }
254
+
255
  /**
256
  * Function to set general YouTube options
257
  *
259
  *
260
  * @since 2.0
261
  *
262
+ * @return string Options array
263
  */
264
 
265
  function vye_set_general_defaults() {
288
  'language' => '',
289
  'debug' => 1,
290
  'script' => '',
291
+ 'prompt' => 1,
292
+ 'list' => 0,
293
  );
294
 
295
+ // If a new user switch the list option on. Otherwise, an existing user will default to off
296
+
297
+ if ( !is_array( $options )) { $default_array[ 'list' ] = 1; }
298
+
299
+ // Merge existing and default options - any missing from existing will take the default settings
300
+
301
  $new_options = array_merge( $default_array, $options );
302
 
303
  // Update the options, if changed, and return the result
307
  return $new_options;
308
  }
309
 
310
+ /**
311
+ * Function to get profile options
312
+ *
313
+ * Return profiles. It's in a seperate function in case any further shared
314
+ * functionality needs to be added.
315
+ *
316
+ * @since 4.2
317
+ *
318
+ * @param string $profile Profile number
319
+ * @return strings Profile array
320
+ */
321
+
322
+ function vye_get_profile( $profile ) {
323
+
324
+ $options = get_option( 'youtube_embed_profile' . $profile );
325
+
326
+ // If there is no profile set up, set to default values and save
327
+
328
+ if ( !is_array( $options ) ) {
329
+ $options = vye_set_profile_defaults( $profile );
330
+ $options[ 'default' ] = true;
331
+ } else {
332
+ $options[ 'default' ] = false;
333
+ }
334
+
335
+ return $options;
336
+ }
337
+
338
  /**
339
  * Function to set YouTube profile options
340
  *
341
+ * Looks up profile options, based on passed number of profiles.
342
  * If none exist, or some are missing, set default values
343
  *
344
  * @since 2.0
345
  *
346
+ * @param string $profiles Number of profiles
347
  * @return string Options array
348
  */
349
 
350
+ function vye_set_profile( $profiles ) {
351
+
352
+ $profile = 0;
353
+ while ( $profile <= $profiles ) {
354
+
355
+ $options = get_option( 'youtube_embed_profile' . $profile );
356
+
357
+ // If the profile doesn't exist, don't assign anything to it
358
+
359
+ if ( is_array( $options ) ) {
360
+
361
+ // Because of upgrading, check each option - if not set, apply default
362
+
363
+ $default_array = vye_set_profile_defaults( $profile );
364
+
365
+ $new_options = array_merge( $default_array, $options );
366
+
367
+ // Update the options, if changed, and return the result
368
+
369
+ if ( $options != $new_options ) { update_option( 'youtube_embed_profile' . $profile, $new_options ); }
370
+
371
+ // Remove added slashes from template XHTML
372
+
373
+ $options[ 'template' ] = stripslashes( $options[ 'template' ] );
374
+
375
+ }
376
+
377
+ $profile++;
378
+
379
+ }
380
+
381
+ return $options;
382
+ }
383
+
384
+ /**
385
+ * Function to set initial profile default options
386
+ *
387
+ * Sets default values for a profile
388
+ *
389
+ * @since 4.2
390
+ *
391
+ * @return array Profile array
392
+ */
393
+
394
  function vye_set_profile_defaults( $profile ) {
395
 
396
+ // Set profile name
397
+
398
  if ( $profile == 0 ) {
399
  $profname = 'Default';
400
  } else {
401
  $profname = 'Profile ' . $profile;
402
  }
 
 
 
 
403
 
404
  // Work out default dimensions
405
 
408
  if ( ( $width == 0 ) or ( $width == '' ) ) { $width = 560; }
409
  $height = 25 + round( ( $width / 16 ) * 9, 0 );
410
 
411
+ // Set default array
412
+
413
+ $default = array(
414
+ 'name' => $profname,
415
+ 'width' => $width,
416
+ 'height' => $height,
417
+ 'fullscreen' => 1,
418
+ 'template' => '%video%',
419
+ 'autoplay' => '',
420
+ 'start' => 0,
421
+ 'loop' => '',
422
+ 'cc' => '',
423
+ 'annotation' => 1,
424
+ 'related' => 1,
425
+ 'info' => 1,
426
+ 'stop' => 0,
427
+ 'disablekb' => '',
428
+ 'autohide' => 2,
429
+ 'controls' => 1,
430
+ 'wmode' => 'window',
431
+ 'style' => '',
432
+ 'color' => 'red',
433
+ 'theme' => 'dark',
434
+ 'modest' => '',
435
+ 'dynamic' => '',
436
+ 'fixed' => '',
437
+ 'download' => '',
438
+ 'download_style' => '',
439
+ 'download_text' => 'Click here to download the video',
440
+ 'playsinline' => '',
441
+ 'html5' => ''
442
+ );
443
+
444
+ return $default;
445
 
446
+ }
447
 
448
+ /**
449
+ * Function to get list options
450
+ *
451
+ * Return lists. It's in a seperate function in case any further shared
452
+ * functionality needs to be added.
453
+ *
454
+ * @since 4.2
455
+ *
456
+ * @param string $list List number
457
+ * @return strings Options array
458
+ */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
 
460
+ function vye_get_list( $list ) {
461
 
462
+ $options = get_option( 'youtube_embed_list' . $list );
463
 
464
+ // If there is no list set up, set to default values and save
465
 
466
+ if ( !is_array( $options ) ) { $options = vye_set_list_defaults( $list ); }
467
 
468
  return $options;
469
  }
471
  /**
472
  * Function to set default list options
473
  *
474
+ * Looks up list options, based on passed number of lists.
475
+ * If any options are missing, set default values
476
  *
477
  * @since 2.0
478
  *
479
+ * @param string $list Number of lists
 
480
  */
481
 
482
+ function vye_set_list( $lists ) {
483
 
484
+ $list = 1;
485
+ while ( $list <= $lists ) {
486
 
487
+ $options = get_option( 'youtube_embed_list' . $list );
488
 
489
+ // Only process if array exists
490
 
491
+ if ( is_array( $options ) ) {
492
 
493
+ // Because of upgrading, check each option - if not set, apply default
 
494
 
495
+ $default_array = vye_set_list_defaults( $list );
496
 
497
+ $new_options = array_merge( $default_array, $options );
498
+
499
+ // Update the options, if changed, and return the result
500
+
501
+ if ( $options != $new_options ) { update_option( 'youtube_embed_list' . $list, $new_options ); }
502
+
503
+ }
504
+
505
+ $list++;
506
+ }
507
+
508
+ return;
509
+ }
510
+
511
+
512
+ /**
513
+ * Function to set initial list default options
514
+ *
515
+ * Sets default values for a list
516
+ *
517
+ * @since 4.2
518
+ *
519
+ * @param string $list List number
520
+ * @return array List array
521
+ */
522
+
523
+ function vye_set_list_defaults( $list ) {
524
+
525
+ $default = array(
526
+ 'name' => 'List ' . $list,
527
+ 'list' => ''
528
+ );
529
+
530
+ return $default;
531
  }
532
 
533
  /**
includes/shortcodes.php CHANGED
@@ -50,7 +50,7 @@ function vye_video_shortcode_alt( $paras = '', $content = '' ) {
50
 
51
  }
52
 
53
- $shortcode = vye_set_shortcode_option();
54
 
55
  if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'vye_video_shortcode_alt' ); }
56
 
@@ -63,7 +63,7 @@ if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'vye
63
  *
64
  * @uses vye_get_embed_type Get the embed type
65
  * @uses vye_set_autohide Get the autohide parameter
66
- * @uses vye_set_general_defaults Set default options
67
  * @uses vye_generate_youtube_code Generate the embed code
68
  *
69
  * @param string $paras Shortcode parameters
@@ -74,7 +74,7 @@ if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'vye
74
 
75
  function vye_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' => '', 'ssl' => '', 'height' => '', 'width' => '', 'dynamic' => '', '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
 
@@ -82,7 +82,7 @@ function vye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
82
 
83
  // Get general options
84
 
85
- $options = vye_set_general_defaults();
86
  $profile = $options[ 'alt_profile' ];
87
  }
88
 
@@ -115,13 +115,17 @@ function vye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
115
  }
116
  }
117
 
 
 
 
 
118
  // Set up Autohide parameter
119
 
120
  $autohide = vye_set_autohide( $autohide );
121
 
122
  // Create YouTube code
123
 
124
- $youtube_code = vye_generate_youtube_code( $content, $width, $height, vye_convert( $fullscreen ), vye_convert( $related ), vye_convert( $autoplay ), vye_convert( $loop ), $start, vye_convert( $info ), vye_convert_3( $annotation ), vye_convert( $cc ), $style, $stop, vye_convert( $disablekb ), $ratio, $autohide, $controls, $profile, $list, $template, $color, $theme, vye_convert( $ssl ), vye_convert( $dynamic ), vye_convert( $search ), vye_convert( $user ), vye_convert( $modest ), vye_convert( $playsinline ), vye_convert( $html5 ) );
125
 
126
  return apply_filters( 'a3_lazy_load_html', do_shortcode( $youtube_code ) );
127
  }
@@ -222,4 +226,69 @@ function vye_video_download( $paras = '', $content = '' ) {
222
  }
223
 
224
  add_shortcode( 'download_video', 'vye_video_download' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  ?>
50
 
51
  }
52
 
53
+ $shortcode = vye_get_shortcode();
54
 
55
  if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'vye_video_shortcode_alt' ); }
56
 
63
  *
64
  * @uses vye_get_embed_type Get the embed type
65
  * @uses vye_set_autohide Get the autohide parameter
66
+ * @uses vye_get_general_defaults Set default options
67
  * @uses vye_generate_youtube_code Generate the embed code
68
  *
69
  * @param string $paras Shortcode parameters
74
 
75
  function vye_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
 
82
 
83
  // Get general options
84
 
85
+ $options = vye_get_general_defaults();
86
  $profile = $options[ 'alt_profile' ];
87
  }
88
 
115
  }
116
  }
117
 
118
+ // If no responsive parameter specified use the deprecated dynamic parameter instead
119
+
120
+ if ( $responsive == '' ) { $responsive = $dynamic; }
121
+
122
  // Set up Autohide parameter
123
 
124
  $autohide = vye_set_autohide( $autohide );
125
 
126
  // Create YouTube code
127
 
128
+ $youtube_code = vye_generate_youtube_code( $content, $width, $height, vye_convert( $fullscreen ), vye_convert( $related ), vye_convert( $autoplay ), vye_convert( $loop ), $start, vye_convert( $info ), vye_convert_3( $annotation ), vye_convert( $cc ), $style, $stop, vye_convert( $disablekb ), $ratio, $autohide, $controls, $profile, $list, $template, $color, $theme, vye_convert( $responsive ), vye_convert( $search ), vye_convert( $user ), vye_convert( $modest ), vye_convert( $playsinline ), vye_convert( $html5 ) );
129
 
130
  return apply_filters( 'a3_lazy_load_html', do_shortcode( $youtube_code ) );
131
  }
226
  }
227
 
228
  add_shortcode( 'download_video', 'vye_video_download' );
229
+
230
+ /**
231
+ * Convert input to a 1 or 3 equivalent
232
+ *
233
+ * Function to convert a Yes or No input to an equivalent 1 or 3 output
234
+ *
235
+ * @since 2.0
236
+ *
237
+ * @uses vye_yes_or_no Convert input to a true or false equivalent
238
+ *
239
+ * @param string $input Input, usually Yes or No
240
+ * @return string 1, 3 or blank, depending on input
241
+ */
242
+
243
+ function vye_convert_3( $input ) {
244
+
245
+ $input = vye_yes_or_no( $input );
246
+ $output = '';
247
+ if ( $input === true ) { $output = '1'; }
248
+ if ( $input === false ) { $output = '3'; }
249
+
250
+ return $output;
251
+ }
252
+
253
+ /**
254
+ * Convert input to True or False (1.0)
255
+ *
256
+ * Return true or false, depending on the input. Possible inputs are Yes, No, 0, 1, True,
257
+ * False, On, Off
258
+ *
259
+ * @since 2.0
260
+ *
261
+ * @param string $input Value passed for checking
262
+ * @return string Blank string or boolean true, false
263
+ */
264
+
265
+ function vye_yes_or_no( $input = '' ) {
266
+
267
+ $input = strtolower( $input );
268
+ if ( ( $input === true ) or ( $input == 'true' ) or ( $input == '1' ) or ( $input == 'yes' ) or ( $input == 'on' ) ) { return true; }
269
+ if ( ( $input === false ) or ( $input == 'false' ) or ( $input == '0' ) or ( $input == 'no' ) or ( $input == 'off' ) ) { return false; }
270
+
271
+ return;
272
+ }
273
+
274
+ /**
275
+ * Convert autohide parameter
276
+ *
277
+ * Convert autohide text value to a numeric equivalent
278
+ *
279
+ * @since 2.0
280
+ *
281
+ * @param string $autohide Autohide parameter value
282
+ * @return string Autohide numeric equivalent
283
+ */
284
+
285
+ function vye_set_autohide( $autohide ) {
286
+
287
+ $autohide = strtolower( $autohide );
288
+ if ( $autohide == 'no' ) { $autohide = '0'; }
289
+ if ( $autohide == 'yes' ) { $autohide = '1'; }
290
+ if ( $autohide == 'fade' ) { $autohide = '2'; }
291
+
292
+ return $autohide;
293
+ }
294
  ?>
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: 2015-12-08 13:47-0000\n"
6
- "PO-Revision-Date: 2015-12-08 13:47-0000\n"
7
  "Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
8
  "Language-Team: \n"
9
  "Language: en_GB\n"
@@ -17,20 +17,20 @@ msgstr ""
17
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
18
  "X-Poedit-SearchPath-0: .\n"
19
 
20
- #: includes/add-scripts.php:94 includes/admin-config.php:107
21
  #: includes/generate-widgets.php:25
22
  msgid "YouTube Embed"
23
  msgstr ""
24
 
25
- #: includes/add-scripts.php:99
26
  msgid "Options"
27
  msgstr ""
28
 
29
- #: includes/add-scripts.php:106 includes/admin-config.php:91
30
  msgid "Profiles"
31
  msgstr ""
32
 
33
- #: includes/add-scripts.php:113 includes/admin-config.php:99
34
  msgid "Lists"
35
  msgstr ""
36
 
@@ -50,7 +50,7 @@ msgstr ""
50
  msgid "YouTube"
51
  msgstr ""
52
 
53
- #: includes/admin-config.php:91 includes/options-profiles.php:117
54
  msgid "YouTube Embed Profiles"
55
  msgstr ""
56
 
@@ -58,28 +58,40 @@ msgstr ""
58
  msgid "YouTube Embed Lists"
59
  msgstr ""
60
 
61
- #: includes/admin-config.php:107 includes/options-general.php:16
 
 
 
 
 
 
 
 
 
 
 
 
62
  msgid "YouTube Embed Options"
63
  msgstr ""
64
 
65
- #: includes/admin-config.php:174 includes/admin-config.php:196
66
- #: includes/admin-config.php:218
67
  msgid "Help"
68
  msgstr ""
69
 
70
- #: includes/admin-config.php:176 includes/admin-config.php:198
71
- #: includes/admin-config.php:220
72
  msgid "Links"
73
  msgstr ""
74
 
75
- #: includes/admin-config.php:241
76
  msgid ""
77
  "This screen allows you to select non-specific options for the YouTube Embed "
78
  "plugin. For the default embedding settings, please select the <a href="
79
  "\"admin.php?page=ye-profile-options\">Profiles</a> administration option."
80
  msgstr ""
81
 
82
- #: includes/admin-config.php:246
83
  msgid ""
84
  "This screen allows you to set the options for the default and additional "
85
  "profiles. If you don't specify a specific parameter when displaying your "
@@ -88,82 +100,86 @@ msgid ""
88
  "required."
89
  msgstr ""
90
 
91
- #: includes/admin-config.php:247
92
  msgid ""
93
  "All settings will work whether the Flash or HTML5 player is used, unless one "
94
  "of the following icons is shown, indicating which format the option works "
95
  "with..."
96
  msgstr ""
97
 
98
- #: includes/admin-config.php:248
99
  msgid "Flash player"
100
  msgstr ""
101
 
102
- #: includes/admin-config.php:249
103
  msgid "HTML5 player"
104
  msgstr ""
105
 
106
- #: includes/admin-config.php:254
107
  msgid ""
108
  "This screen allows you to create lists of YouTube videos, which may be "
109
  "named. These lists can then be used in preference to a single video ID."
110
  msgstr ""
111
 
112
- #: includes/admin-config.php:258
113
  msgid ""
114
  "Remember to click the Save Changes button at the bottom of the screen for "
115
  "any changes to take effect."
116
  msgstr ""
117
 
118
- #: includes/admin-config.php:263
119
  msgid "For more information:"
120
  msgstr ""
121
 
122
- #: includes/admin-config.php:264
123
  msgid "YouTube Embed Plugin Documentation"
124
  msgstr ""
125
 
126
- #: includes/admin-config.php:267
127
  msgid "YouTube Player Documentation"
128
  msgstr ""
129
 
130
- #: includes/admin-config.php:366
131
  msgid ""
132
  "For some reason the shortcode <strong>[youtube]</strong> is not working on "
133
  "the main site"
134
  msgstr ""
135
 
136
- #: includes/admin-config.php:369
137
  msgid "An alternative plugin is using the <strong>[youtube]</strong> shortcode"
138
  msgstr ""
139
 
140
- #: includes/admin-config.php:376
141
  msgid ""
142
  ", possibly the <a href=\"admin.php?page=jetpack_modules&activated=true"
143
  "\">Shortcode Embeds module</a> in Jetpack"
144
  msgstr ""
145
 
146
- #: includes/generate-embed-code.php:64
147
  msgid "No video/playlist ID has been supplied"
148
  msgstr ""
149
 
150
- #: includes/generate-embed-code.php:111 includes/generate-other-code.php:56
151
- #: includes/generate-other-code.php:101 includes/shortcodes.php:210
152
  #, php-format
153
  msgid "The YouTube ID of %s is invalid."
154
  msgstr ""
155
 
156
- #: includes/generate-embed-code.php:168
 
 
 
 
157
  msgid ""
158
  "A video list cannot be viewed within this feed - please view the original "
159
  "content"
160
  msgstr ""
161
 
162
- #: includes/generate-embed-code.php:172
163
  msgid "Click here to view the video on YouTube"
164
  msgstr ""
165
 
166
- #: includes/generate-embed-code.php:381
167
  msgid ""
168
  "The maximum URL length has been exceeded. Please reduce your parameter and/"
169
  "or playlist."
@@ -182,322 +198,332 @@ msgstr ""
182
  msgid "Embed YouTube Widget."
183
  msgstr ""
184
 
185
- #: includes/generate-widgets.php:144
186
  msgid "Widget Title"
187
  msgstr ""
188
 
189
- #: includes/generate-widgets.php:150 includes/options-lists.php:172
190
  msgid "Video ID"
191
  msgstr ""
192
 
193
- #: includes/generate-widgets.php:158
194
  msgid "ID Type"
195
  msgstr ""
196
 
197
- #: includes/generate-widgets.php:160
198
  msgid "Video or Playlist"
199
  msgstr ""
200
 
201
- #: includes/generate-widgets.php:162
202
  msgid "Search"
203
  msgstr ""
204
 
205
- #: includes/generate-widgets.php:164
206
  msgid "User"
207
  msgstr ""
208
 
209
- #: includes/generate-widgets.php:172 includes/shared-functions.php:372
210
  msgid "Profile"
211
  msgstr ""
212
 
213
- #: includes/generate-widgets.php:182
214
  msgid "Start (seconds)"
215
  msgstr ""
216
 
217
- #: includes/generate-widgets.php:188
218
  msgid "Stop (seconds)"
219
  msgstr ""
220
 
221
- #: includes/generate-widgets.php:196
222
  msgid "List Playback"
223
  msgstr ""
224
 
225
- #: includes/generate-widgets.php:198
226
  msgid "Profile default"
227
  msgstr ""
228
 
229
- #: includes/generate-widgets.php:200
230
  msgid "Play each video in order"
231
  msgstr ""
232
 
233
- #: includes/generate-widgets.php:202
234
  msgid "Play videos randomly"
235
  msgstr ""
236
 
237
- #: includes/generate-widgets.php:204
238
  msgid "Play one random video"
239
  msgstr ""
240
 
241
- #: includes/options-general.php:51 includes/options-lists.php:22
242
  msgid "Settings Saved."
243
  msgstr ""
244
 
245
- #: includes/options-general.php:65
246
- msgid "Cache cleared."
247
- msgstr ""
248
-
249
- #: includes/options-general.php:77
250
  msgid ""
251
  "These are the general settings for YouTube Embed. Please select <a href="
252
  "\"admin.php?page=ye-profile-options\">Profiles</a> for default embedding "
253
  "settings."
254
  msgstr ""
255
 
256
- #: includes/options-general.php:81
257
  msgid "Embedding"
258
  msgstr ""
259
 
260
- #: includes/options-general.php:86
261
  msgid "Add Metadata"
262
  msgstr ""
263
 
264
- #: includes/options-general.php:88
265
  msgid "Allow rich metadata to be added to code"
266
  msgstr ""
267
 
268
- #: includes/options-general.php:94
269
  msgid "Feed"
270
  msgstr ""
271
 
272
- #: includes/options-general.php:96
273
  msgid "Text link"
274
  msgstr ""
275
 
276
- #: includes/options-general.php:97
277
  msgid "Thumbnail"
278
  msgstr ""
279
 
280
- #: includes/options-general.php:98
281
  msgid "Thumbnail &amp; Text Link"
282
  msgstr ""
283
 
284
- #: includes/options-general.php:100
285
  msgid ""
286
  "Videos cannot be embedded in feeds. Select how you wish them to be shown "
287
  "instead."
288
  msgstr ""
289
 
290
- #: includes/options-general.php:106
291
  msgid "Thumbnail to use"
292
  msgstr ""
293
 
294
- #: includes/options-general.php:108 includes/shared-functions.php:360
295
  msgid "Default"
296
  msgstr ""
297
 
298
- #: includes/options-general.php:109
299
  msgid "Default (HQ)"
300
  msgstr ""
301
 
302
- #: includes/options-general.php:110
303
  msgid "Start"
304
  msgstr ""
305
 
306
- #: includes/options-general.php:111
307
  msgid "Middle"
308
  msgstr ""
309
 
310
- #: includes/options-general.php:112
311
  msgid "End"
312
  msgstr ""
313
 
314
- #: includes/options-general.php:114
315
  msgid "Choose which thumbnail to use."
316
  msgstr ""
317
 
318
- #: includes/options-general.php:120
319
  msgid "Content Resizing Script"
320
  msgstr ""
321
 
322
- #: includes/options-general.php:122
323
  msgid "None"
324
  msgstr ""
325
 
326
- #: includes/options-general.php:123
327
  msgid "FitVids.js"
328
  msgstr ""
329
 
330
- #: includes/options-general.php:124
331
  msgid "iFrame Resizer"
332
  msgstr ""
333
 
334
- #: includes/options-general.php:126
335
  msgid "Use a third party content resizing script?"
336
  msgstr ""
337
 
338
- #: includes/options-general.php:129
339
  msgid "Shortcodes"
340
  msgstr ""
341
 
342
- #: includes/options-general.php:134
343
  msgid "Allow shortcodes in widgets"
344
  msgstr ""
345
 
346
- #: includes/options-general.php:136
347
  msgid "Allow shortcodes to be used in widgets"
348
  msgstr ""
349
 
350
- #: includes/options-general.php:137
351
  msgid "This will apply to <strong>all</strong> widgets."
352
  msgstr ""
353
 
354
- #: includes/options-general.php:143
355
  msgid "Alternative Shortcode"
356
  msgstr ""
357
 
358
- #: includes/options-general.php:145
359
  msgid "An alternative shortcode to use."
360
  msgstr ""
361
 
362
- #: includes/options-general.php:151
363
  msgid "Profile to use"
364
  msgstr ""
365
 
366
- #: includes/options-general.php:160
367
  msgid "Show Shortcode Re-use Prompt"
368
  msgstr ""
369
 
370
- #: includes/options-general.php:162
371
  msgid "Show a prompt if the main shortcode is being re-used by another plugin"
372
  msgstr ""
373
 
374
- #: includes/options-general.php:165
375
  msgid "Administration Options"
376
  msgstr ""
377
 
378
- #: includes/options-general.php:170 includes/options-general.php:178
379
  msgid "Show Editor Button"
380
  msgstr ""
381
 
382
- #: includes/options-general.php:172
383
  msgid "Show the YouTube button on the post editor"
384
  msgstr ""
385
 
386
- #: includes/options-general.php:180
387
  msgid "Add link to options screen to Admin Bar"
388
  msgstr ""
389
 
390
- #: includes/options-general.php:186
391
  msgid "Menu Screen Access"
392
  msgstr ""
393
 
394
- #: includes/options-general.php:188
395
  msgid "Administrator"
396
  msgstr ""
397
 
398
- #: includes/options-general.php:189
399
  msgid "Editor"
400
  msgstr ""
401
 
402
- #: includes/options-general.php:190
403
  msgid "Author"
404
  msgstr ""
405
 
406
- #: includes/options-general.php:191
407
  msgid "Contributor"
408
  msgstr ""
409
 
410
- #: includes/options-general.php:193
411
  msgid "Specify the user access required for the menu screens."
412
  msgstr ""
413
 
414
- #: includes/options-general.php:196
415
  msgid "Profile &amp; List Sizes"
416
  msgstr ""
417
 
418
- #: includes/options-general.php:201
419
  msgid "Number of Profiles"
420
  msgstr ""
421
 
422
- #: includes/options-general.php:203
423
  msgid "Maximum number of profiles."
424
  msgstr ""
425
 
426
- #: includes/options-general.php:209
427
  msgid "Number of Lists"
428
  msgstr ""
429
 
430
- #: includes/options-general.php:211
431
  msgid "Maximum number of lists."
432
  msgstr ""
433
 
434
- #: includes/options-general.php:214
435
  msgid "Security"
436
  msgstr ""
437
 
438
- #: includes/options-general.php:219
439
  msgid "Privacy-Enhanced Mode"
440
  msgstr ""
441
 
442
- #: includes/options-general.php:221
443
  msgid "Cookies should always be stored"
444
  msgstr ""
445
 
446
- #: includes/options-general.php:222
447
  msgid "Cookies should never be stored"
448
  msgstr ""
449
 
450
- #: includes/options-general.php:223
451
  msgid "Cookies should be stored based on user's Do Not Track setting"
452
  msgstr ""
453
 
454
- #: includes/options-general.php:225
455
  msgid "Read more about <a href=\"http://donottrack.us/\">Do Not Track</a>."
456
  msgstr ""
457
 
458
- #: includes/options-general.php:231
459
  msgid "Show debug output"
460
  msgstr ""
461
 
462
- #: includes/options-general.php:233
463
  msgid "Show debug output as HTML comments"
464
  msgstr ""
465
 
466
- #: includes/options-general.php:236
467
  msgid "Miscellaneous"
468
  msgstr ""
469
 
470
- #: includes/options-general.php:241
471
  msgid "Improve Validation"
472
  msgstr ""
473
 
474
- #: includes/options-general.php:243
475
  msgid "Improve the validity of the generated markup"
476
  msgstr ""
477
 
478
- #: includes/options-general.php:244
479
  msgid ""
480
  "Will extend the length of the URL, limiting the number of videos in a manual "
481
  "playlist. Switch off metadata for even better validation results."
482
  msgstr ""
483
 
484
- #: includes/options-general.php:250
485
  msgid "Interface language"
486
  msgstr ""
487
 
488
- #: includes/options-general.php:251
489
  msgid "The player's interface language"
490
  msgstr ""
491
 
492
- #: includes/options-general.php:252
493
  msgid ""
494
- "The parameter value is an <a href=\"http://www.loc.gov/standards/iso639-2/"
495
  "php/code_list.php\">ISO 639-1 two-letter language code</a> or a fully "
496
  "specified locale. For example, the current locale is "
497
  msgstr ""
498
 
499
- #: includes/options-general.php:259 includes/options-lists.php:161
500
- #: includes/options-profiles.php:416
 
 
 
 
 
 
 
 
 
 
 
 
 
 
501
  msgid "Save Changes"
502
  msgstr ""
503
 
@@ -509,443 +535,433 @@ msgstr ""
509
  msgid "Errors were found with your video list. See the list below for details."
510
  msgstr ""
511
 
512
- #: includes/options-lists.php:124
513
  msgid "List"
514
  msgstr ""
515
 
516
- #: includes/options-lists.php:135
517
  msgid "Change list"
518
  msgstr ""
519
 
520
- #: includes/options-lists.php:138
521
  #, php-format
522
  msgid "These are the options for list %s."
523
  msgstr ""
524
 
525
- #: includes/options-lists.php:138
526
  msgid ""
527
  "Update the name, if required, and specify a list of YouTube video IDs. Use "
528
  "the drop-down on the right hand side to swap between lists."
529
  msgstr ""
530
 
531
- #: includes/options-lists.php:145
532
  msgid "List Name"
533
  msgstr ""
534
 
535
- #: includes/options-lists.php:147
536
  msgid "The name you wish to give this list"
537
  msgstr ""
538
 
539
- #: includes/options-lists.php:153
540
  msgid "Video IDs (one per line)"
541
  msgstr ""
542
 
543
- #: includes/options-lists.php:172
544
  msgid "Video Title"
545
  msgstr ""
546
 
547
- #: includes/options-lists.php:172
548
  msgid "Status"
549
  msgstr ""
550
 
551
- #: includes/options-lists.php:187
552
  msgid "This is a playlist"
553
  msgstr ""
554
 
555
- #: includes/options-lists.php:191
556
  msgid "Invalid video ID"
557
  msgstr ""
558
 
559
- #: includes/options-lists.php:195
560
  msgid "YouTube API error"
561
  msgstr ""
562
 
563
- #: includes/options-lists.php:198
564
  msgid "Valid video"
565
  msgstr ""
566
 
567
- #: includes/options-lists.php:215
568
  msgid "The video ID is valid"
569
  msgstr ""
570
 
571
- #: includes/options-lists.php:218
572
  msgid "The video ID is invalid"
573
  msgstr ""
574
 
575
- #: includes/options-profiles.php:123
576
  msgid " Profile Saved."
577
  msgstr ""
578
 
579
- #: includes/options-profiles.php:137
580
  msgid "Change profile"
581
  msgstr ""
582
 
583
- #: includes/options-profiles.php:145
584
  msgid "These are the options for the default profile."
585
  msgstr ""
586
 
587
- #: includes/options-profiles.php:147
588
  #, php-format
589
  msgid "These are the options for profile %s."
590
  msgstr ""
591
 
592
- #: includes/options-profiles.php:149
593
  msgid "Use the drop-down on the right hand side to swap between profiles."
594
  msgstr ""
595
 
596
- #: includes/options-profiles.php:157
597
  msgid "Profile Name"
598
  msgstr ""
599
 
600
- #: includes/options-profiles.php:159
601
  msgid "The name you wish to give this profile"
602
  msgstr ""
603
 
604
- #: includes/options-profiles.php:165
605
  msgid "Template"
606
  msgstr ""
607
 
608
- #: includes/options-profiles.php:167
609
  msgid ""
610
  "Wrapper for video output. Must include <code>%video%</code> tag to show "
611
  "video position."
612
  msgstr ""
613
 
614
- #: includes/options-profiles.php:173
615
  msgid "Style"
616
  msgstr ""
617
 
618
- #: includes/options-profiles.php:175
619
  msgid "CSS elements to apply to video."
620
  msgstr ""
621
 
622
- #: includes/options-profiles.php:181
623
- msgid "SSL"
624
- msgstr ""
625
-
626
- #: includes/options-profiles.php:183
627
- msgid ""
628
- "Use SSL? <a href=\"http://www.google.com/support/youtube/bin/answer.py?"
629
- "answer=171780&expand=UseHTTPS#HTTPS\">Read more</a>"
630
- msgstr ""
631
-
632
- #: includes/options-profiles.php:189
633
  msgid "Window Mode"
634
  msgstr ""
635
 
636
- #: includes/options-profiles.php:191
637
  msgid "Opaque"
638
  msgstr ""
639
 
640
- #: includes/options-profiles.php:192
641
  msgid "Transparent"
642
  msgstr ""
643
 
644
- #: includes/options-profiles.php:193
645
  msgid "Window"
646
  msgstr ""
647
 
648
- #: includes/options-profiles.php:195
649
  msgid ""
650
  "Sets the Window Mode property of the Flash movie for transparency, layering, "
651
  "and positioning in the browser. <a href=\"http://www.communitymx.com/content/"
652
  "article.cfm?cid=e5141\">Learn more</a>."
653
  msgstr ""
654
 
655
- #: includes/options-profiles.php:198 includes/options-profiles.php:203
656
  msgid "Video Size"
657
  msgstr ""
658
 
659
- #: includes/options-profiles.php:205
660
  msgid "The width x height of the video, in pixels"
661
  msgstr ""
662
 
663
- #: includes/options-profiles.php:211
664
  msgid "Default Sizes"
665
  msgstr ""
666
 
667
- #: includes/options-profiles.php:213
668
  msgid "Use above sizes"
669
  msgstr ""
670
 
671
- #: includes/options-profiles.php:219
672
  msgid "Select one of these default sizes to override the above video sizes."
673
  msgstr ""
674
 
675
- #: includes/options-profiles.php:225
676
- msgid "Dynamically Resize"
677
  msgstr ""
678
 
679
- #: includes/options-profiles.php:227
680
  msgid "Show full width and resize with the browser"
681
  msgstr ""
682
 
683
- #: includes/options-profiles.php:233
684
  msgid "Set Maximum Size"
685
  msgstr ""
686
 
687
- #: includes/options-profiles.php:235
688
  msgid "Use above width to define maximum size"
689
  msgstr ""
690
 
691
- #: includes/options-profiles.php:241
692
  msgid "Plays Inline"
693
  msgstr ""
694
 
695
- #: includes/options-profiles.php:243
696
  msgid "Whether videos play inline or fullscreen in an HTML5 player on iOS. "
697
  msgstr ""
698
 
699
- #: includes/options-profiles.php:246
700
  msgid "Playback"
701
  msgstr ""
702
 
703
- #: includes/options-profiles.php:251
704
  msgid "Autoplay"
705
  msgstr ""
706
 
707
- #: includes/options-profiles.php:253
708
  msgid ""
709
  "Choose whether the initial video will automatically start to play when the "
710
  "player loads"
711
  msgstr ""
712
 
713
- #: includes/options-profiles.php:259
714
  msgid "Loop Video"
715
  msgstr ""
716
 
717
- #: includes/options-profiles.php:261
718
  msgid "Play the initial video again and again"
719
  msgstr ""
720
 
721
- #: includes/options-profiles.php:262
722
  msgid ""
723
  "In the case of a playlist, this will play the entire playlist and then start "
724
  "again at the first video."
725
  msgstr ""
726
 
727
- #: includes/options-profiles.php:268
728
  msgid "Annotations"
729
  msgstr ""
730
 
731
- #: includes/options-profiles.php:270
732
  msgid "Video annotations are shown by default"
733
  msgstr ""
734
 
735
- #: includes/options-profiles.php:276
736
  msgid "Closed Captions"
737
  msgstr ""
738
 
739
- #: includes/options-profiles.php:278
740
  msgid "Don't show closed captions"
741
  msgstr ""
742
 
743
- #: includes/options-profiles.php:279
744
  msgid "Show closed captions"
745
  msgstr ""
746
 
747
- #: includes/options-profiles.php:280
748
  msgid "User default"
749
  msgstr ""
750
 
751
- #: includes/options-profiles.php:282
752
  msgid "Show closed captions (subtitles)."
753
  msgstr ""
754
 
755
- #: includes/options-profiles.php:288
756
  msgid "Default to HTML5"
757
  msgstr ""
758
 
759
- #: includes/options-profiles.php:290
760
  msgid "Default to the HTML5 player (if available)"
761
  msgstr ""
762
 
763
- #: includes/options-profiles.php:291
764
  msgid "This is an undocumented feature and may not work."
765
  msgstr ""
766
 
767
- #: includes/options-profiles.php:294 includes/options-profiles.php:299
768
  msgid "Information"
769
  msgstr ""
770
 
771
- #: includes/options-profiles.php:301
772
  msgid "Display the video title and uploader before the video starts"
773
  msgstr ""
774
 
775
- #: includes/options-profiles.php:302
776
  msgid "If displaying a playlist this will show video thumbnails."
777
  msgstr ""
778
 
779
- #: includes/options-profiles.php:308
780
  msgid "Related Videos"
781
  msgstr ""
782
 
783
- #: includes/options-profiles.php:310
784
  msgid "Load related videos once playback starts"
785
  msgstr ""
786
 
787
- #: includes/options-profiles.php:311
788
  msgid "Also toggles the search option."
789
  msgstr ""
790
 
791
- #: includes/options-profiles.php:317
792
  msgid "Modest Branding"
793
  msgstr ""
794
 
795
- #: includes/options-profiles.php:319
796
  msgid "Reduce branding on video"
797
  msgstr ""
798
 
799
- #: includes/options-profiles.php:322 includes/options-profiles.php:339
800
  msgid "Controls"
801
  msgstr ""
802
 
803
- #: includes/options-profiles.php:327
804
  msgid "Auto hide"
805
  msgstr ""
806
 
807
- #: includes/options-profiles.php:329
808
  msgid "Controls &amp; progress bar remain visible"
809
  msgstr ""
810
 
811
- #: includes/options-profiles.php:330
812
  msgid "Controls &amp; progress bar fade out"
813
  msgstr ""
814
 
815
- #: includes/options-profiles.php:331
816
  msgid "Progress bar fades"
817
  msgstr ""
818
 
819
- #: includes/options-profiles.php:333
820
  msgid ""
821
  "Whether the video controls will automatically hide after a video begins "
822
  "playing."
823
  msgstr ""
824
 
825
- #: includes/options-profiles.php:341
826
  msgid "Controls do not display &amp; Flash player loads immediately"
827
  msgstr ""
828
 
829
- #: includes/options-profiles.php:342
830
  msgid "Controls display &amp; Flash player loads immediately"
831
  msgstr ""
832
 
833
- #: includes/options-profiles.php:343
834
  msgid "Controls display &amp; Flash player loads once video starts"
835
  msgstr ""
836
 
837
- #: includes/options-profiles.php:345
838
  msgid ""
839
  "Whether the video player controls are displayed. For Flash it also defines "
840
  "when the controls display in the player as well as when the player will load."
841
  msgstr ""
842
 
843
- #: includes/options-profiles.php:351
844
  msgid "Disable Keyboard"
845
  msgstr ""
846
 
847
- #: includes/options-profiles.php:353
848
  msgid "Disable the player keyboard controls"
849
  msgstr ""
850
 
851
- #: includes/options-profiles.php:359
852
  msgid "Fullscreen"
853
  msgstr ""
854
 
855
- #: includes/options-profiles.php:361
856
  msgid "A button will allow the viewer to watch the video fullscreen"
857
  msgstr ""
858
 
859
- #: includes/options-profiles.php:367
860
  msgid "Theme"
861
  msgstr ""
862
 
863
- #: includes/options-profiles.php:369
864
  msgid "Dark"
865
  msgstr ""
866
 
867
- #: includes/options-profiles.php:370
868
  msgid "Light"
869
  msgstr ""
870
 
871
- #: includes/options-profiles.php:372
872
  msgid "Display player controls within a dark or light control bar."
873
  msgstr ""
874
 
875
- #: includes/options-profiles.php:378
876
  msgid "Progress Bar Color"
877
  msgstr ""
878
 
879
- #: includes/options-profiles.php:380
880
  msgid "Red"
881
  msgstr ""
882
 
883
- #: includes/options-profiles.php:381
884
  msgid "White (desaturated)"
885
  msgstr ""
886
 
887
- #: includes/options-profiles.php:383
888
  msgid ""
889
  "The color that will be used in the player's video progress bar to highlight "
890
  "the amount of the video that's already been seen."
891
  msgstr ""
892
 
893
- #: includes/options-profiles.php:386
894
  msgid "Download Link"
895
  msgstr ""
896
 
897
- #: includes/options-profiles.php:391
898
  msgid "Show Download Link"
899
  msgstr ""
900
 
901
- #: includes/options-profiles.php:393
902
  #, php-format
903
  msgid "Show a link to %s under the video"
904
  msgstr ""
905
 
906
- #: includes/options-profiles.php:399
907
  msgid "Download Text"
908
  msgstr ""
909
 
910
- #: includes/options-profiles.php:401
911
  msgid "Text or HTML to display to prompt download."
912
  msgstr ""
913
 
914
- #: includes/options-profiles.php:407
915
  msgid "Download Style"
916
  msgstr ""
917
 
918
- #: includes/options-profiles.php:409
919
  msgid "CSS elements to apply to video download link."
920
  msgstr ""
921
 
922
- #: includes/options-profiles.php:423
923
  msgid "YouTube Video Sample"
924
  msgstr ""
925
 
926
- #: includes/options-profiles.php:424
927
  msgid ""
928
  "The video below uses the above, saved profile settings. Use the drop-down "
929
  "below to change which parameters the video uses - press the Change Video "
930
  "button to update it."
931
  msgstr ""
932
 
933
- #: includes/options-profiles.php:426
934
  msgid "Standard"
935
  msgstr ""
936
 
937
- #: includes/options-profiles.php:427
938
  msgid "3D"
939
  msgstr ""
940
 
941
- #: includes/options-profiles.php:428
942
  msgid "Playlist"
943
  msgstr ""
944
 
945
- #: includes/options-profiles.php:431
946
  msgid "Change video"
947
  msgstr ""
948
 
949
- #: includes/shortcodes.php:195
950
  msgid "No YouTube ID was found."
951
  msgstr ""
2
  msgstr ""
3
  "Project-Id-Version: Vixy YouTube Embed\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2016-01-19 13:21-0000\n"
6
+ "PO-Revision-Date: 2016-01-19 13:22-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:122
21
  #: includes/generate-widgets.php:25
22
  msgid "YouTube Embed"
23
  msgstr ""
24
 
25
+ #: includes/add-scripts.php:120
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
 
50
  msgid "YouTube"
51
  msgstr ""
52
 
53
+ #: includes/admin-config.php:91 includes/options-profiles.php:116
54
  msgid "YouTube Embed Profiles"
55
  msgstr ""
56
 
58
  msgid "YouTube Embed Lists"
59
  msgstr ""
60
 
61
+ #: includes/admin-config.php:107
62
+ msgid "Video Overlay Ads Settings"
63
+ msgstr ""
64
+
65
+ #: includes/admin-config.php:107
66
+ msgid "Video Overlay Ads"
67
+ msgstr ""
68
+
69
+ #: includes/admin-config.php:114
70
+ msgid "Video SEO"
71
+ msgstr ""
72
+
73
+ #: includes/admin-config.php:122 includes/options-general.php:16
74
  msgid "YouTube Embed Options"
75
  msgstr ""
76
 
77
+ #: includes/admin-config.php:189 includes/admin-config.php:211
78
+ #: includes/admin-config.php:233
79
  msgid "Help"
80
  msgstr ""
81
 
82
+ #: includes/admin-config.php:191 includes/admin-config.php:213
83
+ #: includes/admin-config.php:235
84
  msgid "Links"
85
  msgstr ""
86
 
87
+ #: includes/admin-config.php:256
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:261
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
  "required."
101
  msgstr ""
102
 
103
+ #: includes/admin-config.php:262
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:263
111
  msgid "Flash player"
112
  msgstr ""
113
 
114
+ #: includes/admin-config.php:264
115
  msgid "HTML5 player"
116
  msgstr ""
117
 
118
+ #: includes/admin-config.php:269
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:273
125
  msgid ""
126
  "Remember to click the Save Changes button at the bottom of the screen for "
127
  "any changes to take effect."
128
  msgstr ""
129
 
130
+ #: includes/admin-config.php:278
131
  msgid "For more information:"
132
  msgstr ""
133
 
134
+ #: includes/admin-config.php:279
135
  msgid "YouTube Embed Plugin Documentation"
136
  msgstr ""
137
 
138
+ #: includes/admin-config.php:282
139
  msgid "YouTube Player Documentation"
140
  msgstr ""
141
 
142
+ #: includes/admin-config.php:382
143
  msgid ""
144
  "For some reason the shortcode <strong>[youtube]</strong> is not working on "
145
  "the main site"
146
  msgstr ""
147
 
148
+ #: includes/admin-config.php:385
149
  msgid "An alternative plugin is using the <strong>[youtube]</strong> shortcode"
150
  msgstr ""
151
 
152
+ #: includes/admin-config.php:392
153
  msgid ""
154
  ", possibly the <a href=\"admin.php?page=jetpack_modules&activated=true"
155
  "\">Shortcode Embeds module</a> in Jetpack"
156
  msgstr ""
157
 
158
+ #: includes/generate-embed-code.php:67
159
  msgid "No video/playlist ID has been supplied"
160
  msgstr ""
161
 
162
+ #: includes/generate-embed-code.php:122 includes/generate-other-code.php:56
163
+ #: includes/generate-other-code.php:101 includes/shortcodes.php:214
164
  #, php-format
165
  msgid "The YouTube ID of %s is invalid."
166
  msgstr ""
167
 
168
+ #: includes/generate-embed-code.php:122
169
+ msgid "End of YouTube Embed code"
170
+ msgstr ""
171
+
172
+ #: includes/generate-embed-code.php:172
173
  msgid ""
174
  "A video list cannot be viewed within this feed - please view the original "
175
  "content"
176
  msgstr ""
177
 
178
+ #: includes/generate-embed-code.php:176
179
  msgid "Click here to view the video on YouTube"
180
  msgstr ""
181
 
182
+ #: includes/generate-embed-code.php:352
183
  msgid ""
184
  "The maximum URL length has been exceeded. Please reduce your parameter and/"
185
  "or playlist."
198
  msgid "Embed YouTube Widget."
199
  msgstr ""
200
 
201
+ #: includes/generate-widgets.php:145
202
  msgid "Widget Title"
203
  msgstr ""
204
 
205
+ #: includes/generate-widgets.php:151 includes/options-lists.php:175
206
  msgid "Video ID"
207
  msgstr ""
208
 
209
+ #: includes/generate-widgets.php:159
210
  msgid "ID Type"
211
  msgstr ""
212
 
213
+ #: includes/generate-widgets.php:161
214
  msgid "Video or Playlist"
215
  msgstr ""
216
 
217
+ #: includes/generate-widgets.php:163
218
  msgid "Search"
219
  msgstr ""
220
 
221
+ #: includes/generate-widgets.php:165
222
  msgid "User"
223
  msgstr ""
224
 
225
+ #: includes/generate-widgets.php:173
226
  msgid "Profile"
227
  msgstr ""
228
 
229
+ #: includes/generate-widgets.php:183
230
  msgid "Start (seconds)"
231
  msgstr ""
232
 
233
+ #: includes/generate-widgets.php:189
234
  msgid "Stop (seconds)"
235
  msgstr ""
236
 
237
+ #: includes/generate-widgets.php:197
238
  msgid "List Playback"
239
  msgstr ""
240
 
241
+ #: includes/generate-widgets.php:199
242
  msgid "Profile default"
243
  msgstr ""
244
 
245
+ #: includes/generate-widgets.php:201
246
  msgid "Play each video in order"
247
  msgstr ""
248
 
249
+ #: includes/generate-widgets.php:203
250
  msgid "Play videos randomly"
251
  msgstr ""
252
 
253
+ #: includes/generate-widgets.php:205
254
  msgid "Play one random video"
255
  msgstr ""
256
 
257
+ #: includes/options-general.php:65 includes/options-lists.php:22
258
  msgid "Settings Saved."
259
  msgstr ""
260
 
261
+ #: includes/options-general.php:83
 
 
 
 
262
  msgid ""
263
  "These are the general settings for YouTube Embed. Please select <a href="
264
  "\"admin.php?page=ye-profile-options\">Profiles</a> for default embedding "
265
  "settings."
266
  msgstr ""
267
 
268
+ #: includes/options-general.php:87
269
  msgid "Embedding"
270
  msgstr ""
271
 
272
+ #: includes/options-general.php:92
273
  msgid "Add Metadata"
274
  msgstr ""
275
 
276
+ #: includes/options-general.php:94
277
  msgid "Allow rich metadata to be added to code"
278
  msgstr ""
279
 
280
+ #: includes/options-general.php:100
281
  msgid "Feed"
282
  msgstr ""
283
 
284
+ #: includes/options-general.php:102
285
  msgid "Text link"
286
  msgstr ""
287
 
288
+ #: includes/options-general.php:103
289
  msgid "Thumbnail"
290
  msgstr ""
291
 
292
+ #: includes/options-general.php:104
293
  msgid "Thumbnail &amp; Text Link"
294
  msgstr ""
295
 
296
+ #: includes/options-general.php:106
297
  msgid ""
298
  "Videos cannot be embedded in feeds. Select how you wish them to be shown "
299
  "instead."
300
  msgstr ""
301
 
302
+ #: includes/options-general.php:112
303
  msgid "Thumbnail to use"
304
  msgstr ""
305
 
306
+ #: includes/options-general.php:114
307
  msgid "Default"
308
  msgstr ""
309
 
310
+ #: includes/options-general.php:115
311
  msgid "Default (HQ)"
312
  msgstr ""
313
 
314
+ #: includes/options-general.php:116
315
  msgid "Start"
316
  msgstr ""
317
 
318
+ #: includes/options-general.php:117
319
  msgid "Middle"
320
  msgstr ""
321
 
322
+ #: includes/options-general.php:118
323
  msgid "End"
324
  msgstr ""
325
 
326
+ #: includes/options-general.php:120
327
  msgid "Choose which thumbnail to use."
328
  msgstr ""
329
 
330
+ #: includes/options-general.php:126
331
  msgid "Content Resizing Script"
332
  msgstr ""
333
 
334
+ #: includes/options-general.php:128
335
  msgid "None"
336
  msgstr ""
337
 
338
+ #: includes/options-general.php:129
339
  msgid "FitVids.js"
340
  msgstr ""
341
 
342
+ #: includes/options-general.php:130
343
  msgid "iFrame Resizer"
344
  msgstr ""
345
 
346
+ #: includes/options-general.php:132
347
  msgid "Use a third party content resizing script?"
348
  msgstr ""
349
 
350
+ #: includes/options-general.php:135
351
  msgid "Shortcodes"
352
  msgstr ""
353
 
354
+ #: includes/options-general.php:140
355
  msgid "Allow shortcodes in widgets"
356
  msgstr ""
357
 
358
+ #: includes/options-general.php:142
359
  msgid "Allow shortcodes to be used in widgets"
360
  msgstr ""
361
 
362
+ #: includes/options-general.php:143
363
  msgid "This will apply to <strong>all</strong> widgets."
364
  msgstr ""
365
 
366
+ #: includes/options-general.php:149
367
  msgid "Alternative Shortcode"
368
  msgstr ""
369
 
370
+ #: includes/options-general.php:151
371
  msgid "An alternative shortcode to use."
372
  msgstr ""
373
 
374
+ #: includes/options-general.php:157
375
  msgid "Profile to use"
376
  msgstr ""
377
 
378
+ #: includes/options-general.php:166
379
  msgid "Show Shortcode Re-use Prompt"
380
  msgstr ""
381
 
382
+ #: includes/options-general.php:168
383
  msgid "Show a prompt if the main shortcode is being re-used by another plugin"
384
  msgstr ""
385
 
386
+ #: includes/options-general.php:171
387
  msgid "Administration Options"
388
  msgstr ""
389
 
390
+ #: includes/options-general.php:176 includes/options-general.php:184
391
  msgid "Show Editor Button"
392
  msgstr ""
393
 
394
+ #: includes/options-general.php:178
395
  msgid "Show the YouTube button on the post editor"
396
  msgstr ""
397
 
398
+ #: includes/options-general.php:186
399
  msgid "Add link to options screen to Admin Bar"
400
  msgstr ""
401
 
402
+ #: includes/options-general.php:192
403
  msgid "Menu Screen Access"
404
  msgstr ""
405
 
406
+ #: includes/options-general.php:194
407
  msgid "Administrator"
408
  msgstr ""
409
 
410
+ #: includes/options-general.php:195
411
  msgid "Editor"
412
  msgstr ""
413
 
414
+ #: includes/options-general.php:196
415
  msgid "Author"
416
  msgstr ""
417
 
418
+ #: includes/options-general.php:197
419
  msgid "Contributor"
420
  msgstr ""
421
 
422
+ #: includes/options-general.php:199
423
  msgid "Specify the user access required for the menu screens."
424
  msgstr ""
425
 
426
+ #: includes/options-general.php:202
427
  msgid "Profile &amp; List Sizes"
428
  msgstr ""
429
 
430
+ #: includes/options-general.php:207
431
  msgid "Number of Profiles"
432
  msgstr ""
433
 
434
+ #: includes/options-general.php:209
435
  msgid "Maximum number of profiles."
436
  msgstr ""
437
 
438
+ #: includes/options-general.php:215
439
  msgid "Number of Lists"
440
  msgstr ""
441
 
442
+ #: includes/options-general.php:217
443
  msgid "Maximum number of lists."
444
  msgstr ""
445
 
446
+ #: includes/options-general.php:220
447
  msgid "Security"
448
  msgstr ""
449
 
450
+ #: includes/options-general.php:225
451
  msgid "Privacy-Enhanced Mode"
452
  msgstr ""
453
 
454
+ #: includes/options-general.php:227
455
  msgid "Cookies should always be stored"
456
  msgstr ""
457
 
458
+ #: includes/options-general.php:228
459
  msgid "Cookies should never be stored"
460
  msgstr ""
461
 
462
+ #: includes/options-general.php:229
463
  msgid "Cookies should be stored based on user's Do Not Track setting"
464
  msgstr ""
465
 
466
+ #: includes/options-general.php:231
467
  msgid "Read more about <a href=\"http://donottrack.us/\">Do Not Track</a>."
468
  msgstr ""
469
 
470
+ #: includes/options-general.php:237
471
  msgid "Show debug output"
472
  msgstr ""
473
 
474
+ #: includes/options-general.php:239
475
  msgid "Show debug output as HTML comments"
476
  msgstr ""
477
 
478
+ #: includes/options-general.php:242
479
  msgid "Miscellaneous"
480
  msgstr ""
481
 
482
+ #: includes/options-general.php:247
483
  msgid "Improve Validation"
484
  msgstr ""
485
 
486
+ #: includes/options-general.php:249
487
  msgid "Improve the validity of the generated markup"
488
  msgstr ""
489
 
490
+ #: includes/options-general.php:250
491
  msgid ""
492
  "Will extend the length of the URL, limiting the number of videos in a manual "
493
  "playlist. Switch off metadata for even better validation results."
494
  msgstr ""
495
 
496
+ #: includes/options-general.php:256
497
  msgid "Interface language"
498
  msgstr ""
499
 
500
+ #: includes/options-general.php:257
501
  msgid "The player's interface language"
502
  msgstr ""
503
 
504
+ #: includes/options-general.php:258
505
  msgid ""
506
+ "The parameter value is an <a href=\"https://www.loc.gov/standards/iso639-2/"
507
  "php/code_list.php\">ISO 639-1 two-letter language code</a> or a fully "
508
  "specified locale. For example, the current locale is "
509
  msgstr ""
510
 
511
+ #: includes/options-general.php:264
512
+ msgid "Force list specification"
513
+ msgstr ""
514
+
515
+ #: includes/options-general.php:266
516
+ msgid "Force users to specify a list type"
517
+ msgstr ""
518
+
519
+ #: includes/options-general.php:267
520
+ msgid ""
521
+ "By switching this on, a list type must be specified for a list to be valid. "
522
+ "This improves performance as use of a list doesn't then need to be verified."
523
+ msgstr ""
524
+
525
+ #: includes/options-general.php:274 includes/options-lists.php:164
526
+ #: includes/options-profiles.php:408
527
  msgid "Save Changes"
528
  msgstr ""
529
 
535
  msgid "Errors were found with your video list. See the list below for details."
536
  msgstr ""
537
 
538
+ #: includes/options-lists.php:125
539
  msgid "List"
540
  msgstr ""
541
 
542
+ #: includes/options-lists.php:138
543
  msgid "Change list"
544
  msgstr ""
545
 
546
+ #: includes/options-lists.php:141
547
  #, php-format
548
  msgid "These are the options for list %s."
549
  msgstr ""
550
 
551
+ #: includes/options-lists.php:141
552
  msgid ""
553
  "Update the name, if required, and specify a list of YouTube video IDs. Use "
554
  "the drop-down on the right hand side to swap between lists."
555
  msgstr ""
556
 
557
+ #: includes/options-lists.php:148
558
  msgid "List Name"
559
  msgstr ""
560
 
561
+ #: includes/options-lists.php:150
562
  msgid "The name you wish to give this list"
563
  msgstr ""
564
 
565
+ #: includes/options-lists.php:156
566
  msgid "Video IDs (one per line)"
567
  msgstr ""
568
 
569
+ #: includes/options-lists.php:175
570
  msgid "Video Title"
571
  msgstr ""
572
 
573
+ #: includes/options-lists.php:175
574
  msgid "Status"
575
  msgstr ""
576
 
577
+ #: includes/options-lists.php:190
578
  msgid "This is a playlist"
579
  msgstr ""
580
 
581
+ #: includes/options-lists.php:194
582
  msgid "Invalid video ID"
583
  msgstr ""
584
 
585
+ #: includes/options-lists.php:198
586
  msgid "YouTube API error"
587
  msgstr ""
588
 
589
+ #: includes/options-lists.php:201
590
  msgid "Valid video"
591
  msgstr ""
592
 
593
+ #: includes/options-lists.php:219
594
  msgid "The video ID is valid"
595
  msgstr ""
596
 
597
+ #: includes/options-lists.php:222
598
  msgid "The video ID is invalid"
599
  msgstr ""
600
 
601
+ #: includes/options-profiles.php:122
602
  msgid " Profile Saved."
603
  msgstr ""
604
 
605
+ #: includes/options-profiles.php:136
606
  msgid "Change profile"
607
  msgstr ""
608
 
609
+ #: includes/options-profiles.php:144
610
  msgid "These are the options for the default profile."
611
  msgstr ""
612
 
613
+ #: includes/options-profiles.php:146
614
  #, php-format
615
  msgid "These are the options for profile %s."
616
  msgstr ""
617
 
618
+ #: includes/options-profiles.php:148
619
  msgid "Use the drop-down on the right hand side to swap between profiles."
620
  msgstr ""
621
 
622
+ #: includes/options-profiles.php:156
623
  msgid "Profile Name"
624
  msgstr ""
625
 
626
+ #: includes/options-profiles.php:158
627
  msgid "The name you wish to give this profile"
628
  msgstr ""
629
 
630
+ #: includes/options-profiles.php:164
631
  msgid "Template"
632
  msgstr ""
633
 
634
+ #: includes/options-profiles.php:166
635
  msgid ""
636
  "Wrapper for video output. Must include <code>%video%</code> tag to show "
637
  "video position."
638
  msgstr ""
639
 
640
+ #: includes/options-profiles.php:172
641
  msgid "Style"
642
  msgstr ""
643
 
644
+ #: includes/options-profiles.php:174
645
  msgid "CSS elements to apply to video."
646
  msgstr ""
647
 
648
+ #: includes/options-profiles.php:180
 
 
 
 
 
 
 
 
 
 
649
  msgid "Window Mode"
650
  msgstr ""
651
 
652
+ #: includes/options-profiles.php:182
653
  msgid "Opaque"
654
  msgstr ""
655
 
656
+ #: includes/options-profiles.php:183
657
  msgid "Transparent"
658
  msgstr ""
659
 
660
+ #: includes/options-profiles.php:184
661
  msgid "Window"
662
  msgstr ""
663
 
664
+ #: includes/options-profiles.php:186
665
  msgid ""
666
  "Sets the Window Mode property of the Flash movie for transparency, layering, "
667
  "and positioning in the browser. <a href=\"http://www.communitymx.com/content/"
668
  "article.cfm?cid=e5141\">Learn more</a>."
669
  msgstr ""
670
 
671
+ #: includes/options-profiles.php:189 includes/options-profiles.php:194
672
  msgid "Video Size"
673
  msgstr ""
674
 
675
+ #: includes/options-profiles.php:196
676
  msgid "The width x height of the video, in pixels"
677
  msgstr ""
678
 
679
+ #: includes/options-profiles.php:202
680
  msgid "Default Sizes"
681
  msgstr ""
682
 
683
+ #: includes/options-profiles.php:204
684
  msgid "Use above sizes"
685
  msgstr ""
686
 
687
+ #: includes/options-profiles.php:210
688
  msgid "Select one of these default sizes to override the above video sizes."
689
  msgstr ""
690
 
691
+ #: includes/options-profiles.php:216
692
+ msgid "Responsive Output"
693
  msgstr ""
694
 
695
+ #: includes/options-profiles.php:218
696
  msgid "Show full width and resize with the browser"
697
  msgstr ""
698
 
699
+ #: includes/options-profiles.php:224
700
  msgid "Set Maximum Size"
701
  msgstr ""
702
 
703
+ #: includes/options-profiles.php:226
704
  msgid "Use above width to define maximum size"
705
  msgstr ""
706
 
707
+ #: includes/options-profiles.php:232
708
  msgid "Plays Inline"
709
  msgstr ""
710
 
711
+ #: includes/options-profiles.php:235
712
  msgid "Whether videos play inline or fullscreen in an HTML5 player on iOS. "
713
  msgstr ""
714
 
715
+ #: includes/options-profiles.php:238
716
  msgid "Playback"
717
  msgstr ""
718
 
719
+ #: includes/options-profiles.php:243
720
  msgid "Autoplay"
721
  msgstr ""
722
 
723
+ #: includes/options-profiles.php:245
724
  msgid ""
725
  "Choose whether the initial video will automatically start to play when the "
726
  "player loads"
727
  msgstr ""
728
 
729
+ #: includes/options-profiles.php:251
730
  msgid "Loop Video"
731
  msgstr ""
732
 
733
+ #: includes/options-profiles.php:253
734
  msgid "Play the initial video again and again"
735
  msgstr ""
736
 
737
+ #: includes/options-profiles.php:254
738
  msgid ""
739
  "In the case of a playlist, this will play the entire playlist and then start "
740
  "again at the first video."
741
  msgstr ""
742
 
743
+ #: includes/options-profiles.php:260
744
  msgid "Annotations"
745
  msgstr ""
746
 
747
+ #: includes/options-profiles.php:262
748
  msgid "Video annotations are shown by default"
749
  msgstr ""
750
 
751
+ #: includes/options-profiles.php:268
752
  msgid "Closed Captions"
753
  msgstr ""
754
 
755
+ #: includes/options-profiles.php:270
756
  msgid "Don't show closed captions"
757
  msgstr ""
758
 
759
+ #: includes/options-profiles.php:271
760
  msgid "Show closed captions"
761
  msgstr ""
762
 
763
+ #: includes/options-profiles.php:272
764
  msgid "User default"
765
  msgstr ""
766
 
767
+ #: includes/options-profiles.php:274
768
  msgid "Show closed captions (subtitles)."
769
  msgstr ""
770
 
771
+ #: includes/options-profiles.php:280
772
  msgid "Default to HTML5"
773
  msgstr ""
774
 
775
+ #: includes/options-profiles.php:282
776
  msgid "Default to the HTML5 player (if available)"
777
  msgstr ""
778
 
779
+ #: includes/options-profiles.php:283
780
  msgid "This is an undocumented feature and may not work."
781
  msgstr ""
782
 
783
+ #: includes/options-profiles.php:286 includes/options-profiles.php:291
784
  msgid "Information"
785
  msgstr ""
786
 
787
+ #: includes/options-profiles.php:293
788
  msgid "Display the video title and uploader before the video starts"
789
  msgstr ""
790
 
791
+ #: includes/options-profiles.php:294
792
  msgid "If displaying a playlist this will show video thumbnails."
793
  msgstr ""
794
 
795
+ #: includes/options-profiles.php:300
796
  msgid "Related Videos"
797
  msgstr ""
798
 
799
+ #: includes/options-profiles.php:302
800
  msgid "Load related videos once playback starts"
801
  msgstr ""
802
 
803
+ #: includes/options-profiles.php:303
804
  msgid "Also toggles the search option."
805
  msgstr ""
806
 
807
+ #: includes/options-profiles.php:309
808
  msgid "Modest Branding"
809
  msgstr ""
810
 
811
+ #: includes/options-profiles.php:311
812
  msgid "Reduce branding on video"
813
  msgstr ""
814
 
815
+ #: includes/options-profiles.php:314 includes/options-profiles.php:331
816
  msgid "Controls"
817
  msgstr ""
818
 
819
+ #: includes/options-profiles.php:319
820
  msgid "Auto hide"
821
  msgstr ""
822
 
823
+ #: includes/options-profiles.php:321
824
  msgid "Controls &amp; progress bar remain visible"
825
  msgstr ""
826
 
827
+ #: includes/options-profiles.php:322
828
  msgid "Controls &amp; progress bar fade out"
829
  msgstr ""
830
 
831
+ #: includes/options-profiles.php:323
832
  msgid "Progress bar fades"
833
  msgstr ""
834
 
835
+ #: includes/options-profiles.php:325
836
  msgid ""
837
  "Whether the video controls will automatically hide after a video begins "
838
  "playing."
839
  msgstr ""
840
 
841
+ #: includes/options-profiles.php:333
842
  msgid "Controls do not display &amp; Flash player loads immediately"
843
  msgstr ""
844
 
845
+ #: includes/options-profiles.php:334
846
  msgid "Controls display &amp; Flash player loads immediately"
847
  msgstr ""
848
 
849
+ #: includes/options-profiles.php:335
850
  msgid "Controls display &amp; Flash player loads once video starts"
851
  msgstr ""
852
 
853
+ #: includes/options-profiles.php:337
854
  msgid ""
855
  "Whether the video player controls are displayed. For Flash it also defines "
856
  "when the controls display in the player as well as when the player will load."
857
  msgstr ""
858
 
859
+ #: includes/options-profiles.php:343
860
  msgid "Disable Keyboard"
861
  msgstr ""
862
 
863
+ #: includes/options-profiles.php:345
864
  msgid "Disable the player keyboard controls"
865
  msgstr ""
866
 
867
+ #: includes/options-profiles.php:351
868
  msgid "Fullscreen"
869
  msgstr ""
870
 
871
+ #: includes/options-profiles.php:353
872
  msgid "A button will allow the viewer to watch the video fullscreen"
873
  msgstr ""
874
 
875
+ #: includes/options-profiles.php:359
876
  msgid "Theme"
877
  msgstr ""
878
 
879
+ #: includes/options-profiles.php:361
880
  msgid "Dark"
881
  msgstr ""
882
 
883
+ #: includes/options-profiles.php:362
884
  msgid "Light"
885
  msgstr ""
886
 
887
+ #: includes/options-profiles.php:364
888
  msgid "Display player controls within a dark or light control bar."
889
  msgstr ""
890
 
891
+ #: includes/options-profiles.php:370
892
  msgid "Progress Bar Color"
893
  msgstr ""
894
 
895
+ #: includes/options-profiles.php:372
896
  msgid "Red"
897
  msgstr ""
898
 
899
+ #: includes/options-profiles.php:373
900
  msgid "White (desaturated)"
901
  msgstr ""
902
 
903
+ #: includes/options-profiles.php:375
904
  msgid ""
905
  "The color that will be used in the player's video progress bar to highlight "
906
  "the amount of the video that's already been seen."
907
  msgstr ""
908
 
909
+ #: includes/options-profiles.php:378
910
  msgid "Download Link"
911
  msgstr ""
912
 
913
+ #: includes/options-profiles.php:383
914
  msgid "Show Download Link"
915
  msgstr ""
916
 
917
+ #: includes/options-profiles.php:385
918
  #, php-format
919
  msgid "Show a link to %s under the video"
920
  msgstr ""
921
 
922
+ #: includes/options-profiles.php:391
923
  msgid "Download Text"
924
  msgstr ""
925
 
926
+ #: includes/options-profiles.php:393
927
  msgid "Text or HTML to display to prompt download."
928
  msgstr ""
929
 
930
+ #: includes/options-profiles.php:399
931
  msgid "Download Style"
932
  msgstr ""
933
 
934
+ #: includes/options-profiles.php:401
935
  msgid "CSS elements to apply to video download link."
936
  msgstr ""
937
 
938
+ #: includes/options-profiles.php:415
939
  msgid "YouTube Video Sample"
940
  msgstr ""
941
 
942
+ #: includes/options-profiles.php:416
943
  msgid ""
944
  "The video below uses the above, saved profile settings. Use the drop-down "
945
  "below to change which parameters the video uses - press the Change Video "
946
  "button to update it."
947
  msgstr ""
948
 
949
+ #: includes/options-profiles.php:418
950
  msgid "Standard"
951
  msgstr ""
952
 
953
+ #: includes/options-profiles.php:419
954
  msgid "3D"
955
  msgstr ""
956
 
957
+ #: includes/options-profiles.php:420
958
  msgid "Playlist"
959
  msgstr ""
960
 
961
+ #: includes/options-profiles.php:423
962
  msgid "Change video"
963
  msgstr ""
964
 
965
+ #: includes/shortcodes.php:199
966
  msgid "No YouTube ID was found."
967
  msgstr ""
readme.txt CHANGED
@@ -1,13 +1,13 @@
1
  === YouTube Embed ===
2
  Contributors: codedart
3
- Tags: annotations, artiss, chromecast, codedart, comments, download, embed, embedding, embedplus, flash, flv, hd, iframe, media, play, playlist, profile, responsive, seo, url, video, widget, youtube, youtuber
4
  Requires at least: 3.9
5
- Tested up to: 4.3.1
6
- Stable tag: 4.1.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
- A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
11
 
12
  == Description ==
13
 
@@ -23,7 +23,7 @@ YouTube Embed is an incredibly simple, yet powerful, method of embedding YouTube
23
  * Google compatible metadata is added to the video output - great for SEO!
24
  * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [contact me](http://www.artiss.co.uk/plugin-contact "Contact")**
25
  * Support for Do Not Track
26
- * Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress") and [a3 lazy load](https://wordpress.org/plugins/a3-lazy-load/ "a3 lazy load")
27
  * Use [Turn Off The Lights](https://www.turnoffthelights.com/ "Turn Off The Lights")? This plugin works with it beautifully.
28
  * [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
29
  * Works "out of the box" with 4K, 60FPS and Chromecast - stream your embedded videos to your TV!
@@ -56,11 +56,9 @@ Which options are available depends upon the embedding type you're using as well
56
  * **color** - white or red, the colour of the progress bar (see the FAQ about having a white progress bar with the light theme)
57
  * **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.
58
  * **disablekb** - yes or no, disable keyboard controls
59
- * **dynamic** - whether to use dynamic sizing or not. When switched on the video will resize when your site does (i.e. responsive). If a video width is supplied this will be the maximum width, otherwise full width will be assumed. Height is ignored and will be worked out automatically.
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
- * **https** - yes or no, whether to use HTTPS for the video
64
  * **info** - yes or no, show video information. If displaying a playlist this will show video thumbnails
65
  * **list** - if you've specified your own list, use this to select the way the videos should be output. Should be `random` (display videos in a random order), `single` (show just one video, randomly picked from the list) or `order` (show each video in the original order - this is the default)
66
  * **loop** - yes or no, whether to start the video again once it ends
@@ -69,8 +67,8 @@ Which options are available depends upon the embedding type you're using as well
69
  * **profile** - specify a different default profile (see section on Profiles for further details)
70
  * **ratio** - allows you to define a window ratio - specify just a height or width and the ratio will calculate the missing dimension. Uses the format x:x, e.g. 4:3, 16:9
71
  * **related** - yes or no, show related videos
 
72
  * **search** - yes or no, create a playlist based on a search word. The search word should be specified instead of a video ID. See "Automatically Generate Playlists" option for more details
73
- * **ssl** - Use SSL or not? Basically, if set on the URL will be HTTPS rather than HTTP.
74
  * **start** - a number of seconds from where to start the video playing
75
  * **stop** - this stops the video at a specific time, given in seconds
76
  * **style** - apply CSS elements directly to the video output
@@ -144,11 +142,13 @@ When saving the list each video is validated.
144
 
145
  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.
146
 
147
- To use a list, simply specify the list name or number instead of a video ID.
148
 
149
- e.g. `[youtube]List 1[/youtube]`
150
 
151
- There is also a parameter, named `list`, that lets you modify the playback of the list. You can either play each in turn, play them randomly, or have just one played (but picked randomly).
 
 
152
 
153
  == Automatically Generated Playlists ==
154
 
@@ -319,6 +319,25 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
319
 
320
  == Changelog ==
321
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  = 4.1.1 =
323
  * Bug fix: Corrected settings URL in plugin meta.
324
  * Bug fix: If plugin has never run before, ensure a default options array is generated.
@@ -669,6 +688,9 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
669
 
670
  == Upgrade Notice ==
671
 
 
 
 
672
  = 4.1 =
673
  * Loads and loads of new features. Because I love you all.
674
 
1
  === YouTube Embed ===
2
  Contributors: codedart
3
+ Tags: download, embed, embedding, iframe, media, play, playlist, responsive, seo, video, widget, youtube
4
  Requires at least: 3.9
5
+ Tested up to: 4.4.1
6
+ Stable tag: 4.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
+ A simple to use method of embedding responsive YouTube videos into your posts and pages but with powerful features for those that need them.
11
 
12
  == Description ==
13
 
23
  * Google compatible metadata is added to the video output - great for SEO!
24
  * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [contact me](http://www.artiss.co.uk/plugin-contact "Contact")**
25
  * Support for Do Not Track
26
+ * 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"). In the case of Video SEO and WordPress Video Overlay Ads, their options will even appear under the YouTube Embed menu for total simplicity!
27
  * Use [Turn Off The Lights](https://www.turnoffthelights.com/ "Turn Off The Lights")? This plugin works with it beautifully.
28
  * [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
29
  * Works "out of the box" with 4K, 60FPS and Chromecast - stream your embedded videos to your TV!
56
  * **color** - white or red, the colour of the progress bar (see the FAQ about having a white progress bar with the light theme)
57
  * **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.
58
  * **disablekb** - yes or no, disable keyboard controls
 
59
  * **fullscreen** - yes or no, this will add the fullscreen button to the toolbar. This also works with EmbedPlus.
60
  * **height** - the video height, in pixels
61
  * **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
 
62
  * **info** - yes or no, show video information. If displaying a playlist this will show video thumbnails
63
  * **list** - if you've specified your own list, use this to select the way the videos should be output. Should be `random` (display videos in a random order), `single` (show just one video, randomly picked from the list) or `order` (show each video in the original order - this is the default)
64
  * **loop** - yes or no, whether to start the video again once it ends
67
  * **profile** - specify a different default profile (see section on Profiles for further details)
68
  * **ratio** - allows you to define a window ratio - specify just a height or width and the ratio will calculate the missing dimension. Uses the format x:x, e.g. 4:3, 16:9
69
  * **related** - yes or no, show related videos
70
+ * **responsive** - whether to use responsive output or not. When switched on the video will resize when your site does (i.e. responsive). If a video width is supplied this will be the maximum width, otherwise full width will be assumed. Height is ignored and will be worked out automatically.
71
  * **search** - yes or no, create a playlist based on a search word. The search word should be specified instead of a video ID. See "Automatically Generate Playlists" option for more details
 
72
  * **start** - a number of seconds from where to start the video playing
73
  * **stop** - this stops the video at a specific time, given in seconds
74
  * **style** - apply CSS elements directly to the video output
142
 
143
  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.
144
 
145
+ 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.
146
 
147
+ e.g. `[youtube list='order']List 1[/youtube]`
148
 
149
+ The list parameter allows to to either play each in turn, play them randomly, or have just one played (but picked randomly).
150
+
151
+ An option within the general options screen allows you to change whether this parameter MUST be used. If switched on, you will gain a performance increase, otherwise the plugin has no way of knowing if you're asking for a playlist so must verify the ID you've specified against all your lists.
152
 
153
  == Automatically Generated Playlists ==
154
 
319
 
320
  == Changelog ==
321
 
322
+ = 4.2 =
323
+ * Enhancement: Re-written the core embedding code. Redundant code removed and, for the remaining code, re-imagined to improve performance
324
+ * Enhancement: Massively changed how the plugin retrieves saved options and, in particular, how I populate default values. The result? Much improved performance
325
+ * Enhancement: Reviewed and reduced the calls to fetch the options
326
+ * Enhancement: Added a new general option to allow you to force a list type to be specified before a list can be used. The reason? By doing this the code doesn't have to check if the ID it a list name each time and it improves performance. For those upgrading this will be switched off by default to maintain backwards compatibility
327
+ * Enhancement: Admin bar options only appear if viewing the admin bar on the site (showing it whilst in the admin screens seemed rather pointless)
328
+ * Enhancement: If you use [WordPress Video Overlay Ads](https://wordpress.org/plugins/video-overlay-ads/ "WordPress Video Overlay Ads") or [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress") then the settings menus will appear under the YouTube Embed menu
329
+ * Enhancement: SSL options removed as it's now used by default, including with thumbnails and schema.org links
330
+ * Enhancement: Improved the RSS feed output for search or user upload requests
331
+ * Maintenance: Removed some deprecated elements in the code
332
+ * Maintenance: Updated includes so that plugin folders were not hardcoded
333
+ * Maintenance: Updated which functions I was using to retrieve folder names so that they are fully SSL compatible
334
+ * Maintenance: Removed a load of redundant functions
335
+ * Maintenance: Replaced a function with a PHP command but this means that the plugin is no compatible with PHP versions below 5.1
336
+ * Maintenance: Tidied up the list screen further
337
+ * Maintenance: Replaced the 'dynamic' parameter with 'responsive' which, as a name, is far more accurate. 'dynamic' will still work, though.
338
+ * Maintenance: Improved admin screen validation and sanitisation
339
+ * Bug fix: Uninstall wasn't clearing up properly on multisites
340
+
341
  = 4.1.1 =
342
  * Bug fix: Corrected settings URL in plugin meta.
343
  * Bug fix: If plugin has never run before, ensure a default options array is generated.
688
 
689
  == Upgrade Notice ==
690
 
691
+ = 4.2 =
692
+ * 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
693
+
694
  = 4.1 =
695
  * Loads and loads of new features. Because I love you all.
696
 
uninstall.php CHANGED
@@ -19,14 +19,15 @@ $options = get_option( 'youtube_embed_general' );
19
  // If the general options existed, delete it!
20
 
21
  if ( is_array( $options ) ) {
22
- delete_option( 'youtube_embed_general' );
 
23
 
24
  // If the number of profiles field exists, delete each one in turn
25
 
26
  if ( array_key_exists( 'profile_no', $options ) ) {
27
  $loop = 0;
28
  while ( $loop <= $options[ 'profile_no' ] ) {
29
- delete_option( 'youtube_embed_profile' . $loop );
30
  $loop ++;
31
  }
32
  }
@@ -36,7 +37,7 @@ if ( is_array( $options ) ) {
36
  if ( !array_key_exists( 'list_no', $options ) ) {
37
  $loop = 1;
38
  while ( $loop <= $options[ 'list_no' ] ) {
39
- delete_option( 'youtube_embed_list' . $loop );
40
  $loop ++;
41
  }
42
  }
@@ -44,8 +45,9 @@ if ( is_array( $options ) ) {
44
 
45
  // Delete all other options
46
 
47
- delete_option( 'youtube_embed_general' );
48
- delete_option( 'youtube_embed_shortcode' );
49
- delete_option( 'youtube_embed_shortcode_admin' );
50
- delete_option( 'youtube_embed_shortcode_site' );
 
51
  ?>
19
  // If the general options existed, delete it!
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
  }
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
  }
45
 
46
  // Delete all other options
47
 
48
+ delete_site_option( 'youtube_embed_general' );
49
+ delete_site_option( 'youtube_embed_shortcode' );
50
+ delete_site_option( 'youtube_embed_shortcode_admin' );
51
+ delete_site_option( 'youtube_embed_shortcode_site' );
52
+ delete_site_option( 'youtube_embed_version' );
53
  ?>
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: 4.1.1
7
  Author: Coded Art
8
  Author URI: http://codedart.co
9
  Text Domain: youtube-embed
@@ -19,9 +19,9 @@ Domain Path: /languages
19
  * @since 2.0
20
  */
21
 
22
- define( 'youtube_embed_version', '4.1.1' );
23
 
24
- $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
25
 
26
  // Include all the various functions
27
 
3
  Plugin Name: YouTube Embed
4
  Plugin URI: https://wordpress.org/plugins/youtube-embed/
5
  Description: Embed YouTube Videos in WordPress
6
+ Version: 4.2
7
  Author: Coded Art
8
  Author URI: http://codedart.co
9
  Text Domain: youtube-embed
19
  * @since 2.0
20
  */
21
 
22
+ define( 'youtube_embed_version', '4.2' );
23
 
24
+ $functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
25
 
26
  // Include all the various functions
27