YouTube Embed - Version 2.4

Version Description

  • Maintenance: Re-sequenced the changelog in the README
  • Maintenance: Removed drop shadow option
  • Maintenance: Re-design of widgets, reducing number of parameters down to make it easier to use - use profiles to modify missing parameters
  • Maintenance: Updated YouTube icons
  • Bug: Ensure showinfo parameter is set correctly
  • Bug: If width or height is missing from Profile screen then fill it in based on widescreen format. Otherwise, causes video to break
  • Bug: Video information was being fetched from caching even if option selected to switch it off. Fixed!
  • Enhancement: Added frameborder="0" to IFRAME code
  • Enhancement: Added Privacy-Enhanced mode. Doesn't work with Chromeless player.
  • Enhancement: Added title option, so you can name the video
  • Enhancement: Added ssl option, allowing you to override whether HTTP or HTTPS is used for the video
  • Enhancement: Added dynamic option (and matching Profile switch) to allow users to request dynamically resizing video (responsive). Additional option to allow specified width to be maximum
  • Enhancement: Made modestbranding a switchable option (switchable in profile options but not on video-by-video basis) due to issues with Apple devices
  • Enhancement: Improved matching of URL embedded into post
  • Enhancement: If you have the README Parser plugin installed then a new sub-menu will display the README instructions
  • Enhancement: Use WP 3.3 Feature Pointer to highlight new menu when plugin is activated
Download this release

Release Info

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

Code changes from version 2.3.1 to 2.4

Files changed (46) hide show
  1. css/{youtube-embed UNCOMPRESSED.css → ye-admin UNCOMPRESSED.css } +8 -0
  2. css/ye-admin.css +1 -0
  3. css/ye-dynamic UNCOMPRESSED.css +17 -0
  4. css/ye-dynamic.css +1 -0
  5. css/{tinymce-button UNCOMPRESSED.css → ye-tinymce-button UNCOMPRESSED.css} +0 -0
  6. css/{tinymce-button-3.1 UNCOMPRESSED.css → ye-tinymce-button-3.1 UNCOMPRESSED.css} +0 -0
  7. css/{tinymce-button-3.1.css → ye-tinymce-button-3.1.css} +0 -0
  8. css/{tinymce-button.css → ye-tinymce-button.css} +0 -0
  9. css/youtube-embed.css +0 -1
  10. images/Thumbs.db +0 -0
  11. images/menu_icon.png +0 -0
  12. images/poweredby.png +0 -0
  13. images/screen_icon.png +0 -0
  14. images/shadow.png +0 -0
  15. images/youtube_button_b&w.png +0 -0
  16. images/youtube_button_colour.png +0 -0
  17. includes/about.php +1 -1
  18. includes/add-scripts.php +52 -0
  19. includes/{admin-menu.php → admin-config.php} +111 -15
  20. includes/artiss-dashboard-widget.php +19 -7
  21. includes/content.php +6 -2
  22. includes/display-readme.php +24 -0
  23. includes/function-calls.php +4 -2
  24. includes/generate-embed-code.php +96 -16
  25. includes/mcebutton.php +1 -1
  26. includes/options-general.php +9 -0
  27. includes/options-profiles.php +40 -8
  28. includes/options-widgets.php +57 -167
  29. includes/set-option-defaults.php +4 -5
  30. includes/shared.php +1 -1
  31. includes/shortcodes.php +2 -2
  32. includes/widgets.php +142 -150
  33. js/ye-gatracker UNCOMPRESSED.js +3 -0
  34. js/ye-gatracker.js +1 -0
  35. js/{mcebutton UNCOMPRESSED.js → ye-mcebutton UNCOMPRESSED.js} +0 -0
  36. js/{mcebutton.js → ye-mcebutton.js} +0 -0
  37. readme.txt +150 -123
  38. screenshot-1.png +0 -0
  39. screenshot-2.png +0 -0
  40. screenshot-3.png +0 -0
  41. screenshot-4.png +0 -0
  42. screenshot-5.png +0 -0
  43. screenshot-6.png +0 -0
  44. screenshot-7.png +0 -0
  45. uninstall.php +1 -0
  46. youtube-embed.php +8 -3
css/{youtube-embed UNCOMPRESSED.css → ye-admin UNCOMPRESSED.css } RENAMED
@@ -6,4 +6,12 @@
6
  .yt_heading {
7
  font-weight: bold;
8
  font-size: 1.1em;
 
 
 
 
 
 
 
 
9
  }
6
  .yt_heading {
7
  font-weight: bold;
8
  font-size: 1.1em;
9
+ }
10
+
11
+ #np-notepad ul {
12
+ list-style: disc;
13
+ }
14
+
15
+ #np-notepad ul, ol {
16
+ margin-left: 60px;
17
  }
css/ye-admin.css ADDED
@@ -0,0 +1 @@
 
1
+ .ytbox_grey{background-color:#f1f1f1;padding:10px;border:1px solid #ddd;}.yt_heading{font-weight:bold;font-size:1.1em;}#np-notepad ul{list-style:disc;}#np-notepad ul,ol{margin-left:60px;}
css/ye-dynamic UNCOMPRESSED.css ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .ye-container {
2
+ position: relative;
3
+ padding-bottom: 56.25%;
4
+ padding-top: 30px;
5
+ height: 0;
6
+ overflow: hidden;
7
+ }
8
+
9
+ .ye-container iframe,
10
+ .ye-container object,
11
+ .ye-container embed {
12
+ position: absolute;
13
+ top: 0;
14
+ left: 0;
15
+ width: 100%;
16
+ height: 100%;
17
+ }
css/ye-dynamic.css ADDED
@@ -0,0 +1 @@
 
1
+ .ye-container{position:relative;padding-bottom:56.25%;padding-top:30px;height:0;overflow:hidden;}.ye-container iframe,.ye-container object,.ye-container embed{position:absolute;top:0;left:0;width:100%;height:100%;}
css/{tinymce-button UNCOMPRESSED.css → ye-tinymce-button UNCOMPRESSED.css} RENAMED
File without changes
css/{tinymce-button-3.1 UNCOMPRESSED.css → ye-tinymce-button-3.1 UNCOMPRESSED.css} RENAMED
File without changes
css/{tinymce-button-3.1.css → ye-tinymce-button-3.1.css} RENAMED
File without changes
css/{tinymce-button.css → ye-tinymce-button.css} RENAMED
File without changes
css/youtube-embed.css DELETED
@@ -1 +0,0 @@
1
- .ytbox_grey{background-color:#f1f1f1;padding:10px;border:1px solid #ddd;}.yt_heading{font-weight:bold;font-size:1.1em;}
 
images/Thumbs.db ADDED
Binary file
images/menu_icon.png CHANGED
Binary file
images/poweredby.png CHANGED
Binary file
images/screen_icon.png CHANGED
Binary file
images/shadow.png DELETED
Binary file
images/youtube_button_b&w.png CHANGED
Binary file
images/youtube_button_colour.png CHANGED
Binary file
includes/about.php CHANGED
@@ -31,7 +31,7 @@ _e( '<p>Images have been compressed with <a href="http://www.smushit.com/ysmush.
31
 
32
  _e( '<p>JavaScript has been compressed with <a href="http://javascriptcompressor.com/">JavaScript Compressor</a>.</p>' );
33
 
34
- _e( '<p>YouTube icons are courtesy of <a href="http://icondock.com/">IconDock</a>. Other icons are by <a href="http://p.yusukekamiyamane.com/">Yusuke Kamiyamane</a>.</p>' );
35
 
36
  _e( '<h3>Support Information</h3>' );
37
 
31
 
32
  _e( '<p>JavaScript has been compressed with <a href="http://javascriptcompressor.com/">JavaScript Compressor</a>.</p>' );
33
 
34
+ _e( '<p>YouTube icons are courtesy of <a href="http://www.youtube.com/t/creators_downloads">YouTube</a>. Other icons are by <a href="http://p.yusukekamiyamane.com/">Yusuke Kamiyamane</a>.</p>' );
35
 
36
  _e( '<h3>Support Information</h3>' );
37
 
includes/add-scripts.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Add Scripts
4
+ *
5
+ * Add JS and CSS to the main theme and to admin
6
+ *
7
+ * @package YouTubeEmbed
8
+ */
9
+
10
+ /**
11
+ * Add scripts to theme
12
+ *
13
+ * Add styles and scripts to the main theme
14
+ *
15
+ * @since 2.4
16
+ */
17
+
18
+ function ye_main_scripts() {
19
+
20
+ wp_enqueue_script( 'ye_ga_js', plugins_url( '/youtube-embed/js/ye-gatracker.js' ) );
21
+
22
+ wp_register_style( 'ye_dynamic', plugins_url( '/youtube-embed/css/ye-dynamic.css' ) );
23
+
24
+ wp_enqueue_style( 'ye_dynamic' );
25
+
26
+ }
27
+
28
+ add_action( 'wp_enqueue_scripts', 'ye_main_scripts' );
29
+
30
+ /**
31
+ * Add CSS to admin
32
+ *
33
+ * Add stylesheets to the admin screens
34
+ *
35
+ * @since 2.0
36
+ */
37
+
38
+ function ye_admin_css() {
39
+
40
+ wp_enqueue_style( 'ye_admin', plugins_url() . '/youtube-embed/css/ye-admin.css' );
41
+
42
+ wp_enqueue_style( 'ye_dynamic', plugins_url() . '/youtube-embed/css/ye-dynamic.css' );
43
+
44
+ global $wp_version;
45
+ if ( ( float ) $wp_version >= 3.2 ) { $version = ''; } else { $version = '-3.1'; }
46
+
47
+ wp_enqueue_style( 'tinymce_button', plugins_url() . '/youtube-embed/css/ye-tinymce-button' . $version . '.css' );
48
+
49
+ }
50
+
51
+ add_action( 'admin_print_styles', 'ye_admin_css' );
52
+ ?>
includes/{admin-menu.php → admin-config.php} RENAMED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Admin Menu Functions
4
  *
5
  * Various functions relating to the various administration screens
6
  *
@@ -24,11 +24,18 @@ function ye_menu_initialise() {
24
  ye_add_submenu( 'YouTube Embed Options', 'Options', 'youtube-embed-general', 'ye_general_options' );
25
  ye_add_submenu( 'YouTube Embed Profiles', 'Profiles', 'youtube-embed-profiles', 'ye_profile_options' );
26
  ye_add_submenu( 'YouTube Embed Lists', 'Lists', 'youtube-embed-lists', 'ye_list_options' );
 
 
 
 
 
27
  ye_add_submenu( 'YouTube Embed About', 'About', 'youtube-embed-about', 'ye_support_about' );
28
 
29
  add_filter( 'plugin_action_links', 'ye_add_settings_link', 10, 2 );
30
  }
 
31
  add_action( 'admin_menu','ye_menu_initialise' );
 
32
  add_filter( 'plugin_row_meta', 'ye_set_plugin_meta', 10, 2 );
33
 
34
  /**
@@ -40,7 +47,9 @@ add_filter( 'plugin_row_meta', 'ye_set_plugin_meta', 10, 2 );
40
  */
41
 
42
  function ye_general_options() {
 
43
  include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-general.php" );
 
44
  }
45
 
46
  /**
@@ -52,7 +61,9 @@ function ye_general_options() {
52
  */
53
 
54
  function ye_profile_options() {
 
55
  include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-profiles.php" );
 
56
  }
57
 
58
  /**
@@ -64,36 +75,36 @@ function ye_profile_options() {
64
  */
65
 
66
  function ye_list_options() {
 
67
  include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-lists.php" );
 
68
  }
69
 
70
  /**
71
- * Include about and support screen
72
  *
73
- * XHTML about screen which will, optionally, display help details as well
74
  *
75
- * @since 2.0
76
  */
77
 
78
- function ye_support_about() {
79
- include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/about.php" );
80
  }
81
 
82
  /**
83
- * Add CSS files
84
  *
85
- * Add stylesheets to the admin screens
86
  *
87
  * @since 2.0
88
  */
89
 
90
- function ye_menu_css() {
91
- wp_enqueue_style( 'youtube_embed', plugins_url() . '/youtube-embed/css/youtube-embed.css' );
92
- global $wp_version;
93
- if ( ( float ) $wp_version >= 3.2 ) { $version = ''; } else { $version = '-3.1'; }
94
- wp_enqueue_style( 'tinymce_button', plugins_url() . '/youtube-embed/css/tinymce-button' . $version . '.css' );
95
  }
96
- add_action( 'admin_print_styles', 'ye_menu_css' );
97
 
98
  /**
99
  * Add Settings link to plugin list
@@ -136,8 +147,11 @@ function ye_add_settings_link( $links, $file ) {
136
  function ye_set_plugin_meta( $links, $file ) {
137
 
138
  if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
 
139
  $links = array_merge( $links, array( '<a href="admin.php?page=youtube-embed-about">' . __( 'Support' ) . '</a>' ) );
 
140
  $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate' ) . '</a>' ) );
 
141
  }
142
 
143
  return $links;
@@ -168,7 +182,7 @@ function ye_add_submenu( $page_title, $menu_title, $menu_slug, $function ) {
168
 
169
  if ( $menu_slug == "youtube-embed-lists" ) { $help_text = '<p>This screen allows you to create lists of YouTube videos, which may be named. These lists can then be used in preference to a single video ID.</p>'; }
170
 
171
- if ( $menu_slug != "youtube-embed-about" ) {
172
  $help_text .= '<p>Remember to click the Save Settings button at the bottom of the screen for new settings to take effect.</p>';
173
  } else {
174
  $help_text = '<p>This screen provides useful information about this plugin along with methods of support.</p>';
@@ -184,4 +198,86 @@ function ye_add_submenu( $page_title, $menu_title, $menu_slug, $function ) {
184
 
185
  return;
186
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  ?>
1
  <?php
2
  /**
3
+ * Admin Config Functions
4
  *
5
  * Various functions relating to the various administration screens
6
  *
24
  ye_add_submenu( 'YouTube Embed Options', 'Options', 'youtube-embed-general', 'ye_general_options' );
25
  ye_add_submenu( 'YouTube Embed Profiles', 'Profiles', 'youtube-embed-profiles', 'ye_profile_options' );
26
  ye_add_submenu( 'YouTube Embed Lists', 'Lists', 'youtube-embed-lists', 'ye_list_options' );
27
+
28
+ if ( function_exists( 'wp_readme_parser' ) ) {
29
+ ye_add_submenu( 'YouTube Embed README', 'README', 'youtube-embed-readme', 'ye_support_readme' );
30
+ }
31
+
32
  ye_add_submenu( 'YouTube Embed About', 'About', 'youtube-embed-about', 'ye_support_about' );
33
 
34
  add_filter( 'plugin_action_links', 'ye_add_settings_link', 10, 2 );
35
  }
36
+
37
  add_action( 'admin_menu','ye_menu_initialise' );
38
+
39
  add_filter( 'plugin_row_meta', 'ye_set_plugin_meta', 10, 2 );
40
 
41
  /**
47
  */
48
 
49
  function ye_general_options() {
50
+
51
  include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-general.php" );
52
+
53
  }
54
 
55
  /**
61
  */
62
 
63
  function ye_profile_options() {
64
+
65
  include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-profiles.php" );
66
+
67
  }
68
 
69
  /**
75
  */
76
 
77
  function ye_list_options() {
78
+
79
  include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-lists.php" );
80
+
81
  }
82
 
83
  /**
84
+ * Include README screen
85
  *
86
+ * Parse and display the README instructions
87
  *
88
+ * @since 2.4
89
  */
90
 
91
+ function ye_support_readme() {
92
+ include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/display-readme.php" );
93
  }
94
 
95
  /**
96
+ * Include about and support screen
97
  *
98
+ * XHTML about screen which will, optionally, display help details as well
99
  *
100
  * @since 2.0
101
  */
102
 
103
+ function ye_support_about() {
104
+
105
+ include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/about.php" );
106
+
 
107
  }
 
108
 
109
  /**
110
  * Add Settings link to plugin list
147
  function ye_set_plugin_meta( $links, $file ) {
148
 
149
  if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
150
+
151
  $links = array_merge( $links, array( '<a href="admin.php?page=youtube-embed-about">' . __( 'Support' ) . '</a>' ) );
152
+
153
  $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate' ) . '</a>' ) );
154
+
155
  }
156
 
157
  return $links;
182
 
183
  if ( $menu_slug == "youtube-embed-lists" ) { $help_text = '<p>This screen allows you to create lists of YouTube videos, which may be named. These lists can then be used in preference to a single video ID.</p>'; }
184
 
185
+ if ( ( $menu_slug != "youtube-embed-about" ) && ( $menu_slug != "youtube-embed-readme" ) ) {
186
  $help_text .= '<p>Remember to click the Save Settings button at the bottom of the screen for new settings to take effect.</p>';
187
  } else {
188
  $help_text = '<p>This screen provides useful information about this plugin along with methods of support.</p>';
198
 
199
  return;
200
  }
201
+
202
+ /**
203
+ * Detect plugin activation
204
+ *
205
+ * Upon detection of activation set an option
206
+ *
207
+ * @since 2.4
208
+ */
209
+
210
+ function ye_plugin_activate() {
211
+
212
+ update_option( 'youtube_embed_activated', true );
213
+
214
+ }
215
+ register_activation_hook( WP_PLUGIN_DIR . "/youtube-embed/youtube-embed.php", 'ye_plugin_activate' );
216
+
217
+ // If plugin activated, run activation commands and delete option
218
+
219
+ global $wp_version;
220
+
221
+ if ( get_option( 'youtube_embed_activated' ) && ( ( float ) $wp_version >= 3.3 ) ) {
222
+
223
+ add_action( 'admin_enqueue_scripts', 'ye_admin_enqueue_scripts' );
224
+
225
+ delete_option( 'youtube_embed_activated' );
226
+
227
+ }
228
+
229
+ /**
230
+ * Enqueue Feature Pointer files
231
+ *
232
+ * Add the required feature pointer files
233
+ *
234
+ * @since 2.4
235
+ */
236
+
237
+ function ye_admin_enqueue_scripts() {
238
+
239
+ wp_enqueue_style( 'wp-pointer' );
240
+ wp_enqueue_script( 'wp-pointer' );
241
+
242
+ add_action( 'admin_print_footer_scripts', 'ye_admin_print_footer_scripts' );
243
+ }
244
+
245
+ /**
246
+ * Show Feature Pointer
247
+ *
248
+ * Display feature pointer
249
+ *
250
+ * @since 2.4
251
+ */
252
+
253
+ function ye_admin_print_footer_scripts() {
254
+
255
+ $pointer_content = '<h3>Welcome to Artiss YouTube Embed</h3>';
256
+ $pointer_content .= '<p style="font-style:italic;">Thank you for installing this plugin.</p>';
257
+ $pointer_content .= '<p>These new menu options will allow you to configure your videos to just how you want them and provide links for help and support.</p><p>Even if you do nothing else, please visit the Profiles option to check your default video values.';
258
+ ?>
259
+ <script>
260
+ jQuery(function () {
261
+ var body = jQuery(document.body),
262
+ menu = jQuery('#toplevel_page_youtube-embed-general'),
263
+ collapse = jQuery('#collapse-menu'),
264
+ yembed = menu.find("a[href='admin.php?page=youtube-embed-profiles']"),
265
+ options = {
266
+ content: '<?php echo $pointer_content; ?>',
267
+ position: {
268
+ edge: 'left',
269
+ align: 'center',
270
+ of: menu.is('.wp-menu-open') && !menu.is('.folded *') ? yembed : menu
271
+ },
272
+ close: function() {
273
+ }};
274
+
275
+ if ( !yembed.length )
276
+ return;
277
+
278
+ body.pointer(options).pointer('open');
279
+ });
280
+ </script>
281
+ <?php
282
+ }
283
  ?>
includes/artiss-dashboard-widget.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
  /**
3
- * Artiss Dashboard Widget (v1.3)
4
  *
5
  * Add a box to the dashboard to display Artiss posts, and plugin news and support links
6
  *
@@ -44,7 +44,7 @@ function adw_create_widget() {
44
  $output .= "<span style=\"font-size: 0.8em; float: right\"><a href=\"http://www.artiss.co.uk/donate\">Donate</a></span>";
45
 
46
  // News heading
47
- $output .= "<span style=\"font-size: 1.1em; font-weight: bold;\">Latest News</span><br/><br/>\n";
48
 
49
  // Fetch the Twitter status'
50
  $file_return = adw_get_file( 'http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=artiss_tech&count=' . $news_items . '&exclude_replies=true' );
@@ -55,7 +55,7 @@ function adw_create_widget() {
55
 
56
  $twitter_feed = $file_return[ 'file' ];
57
 
58
- $output .= "<span style=\"font-weight: bold; font-size: 0.9em;\">Last updated " . date('l jS F \a\t g:ia') . ".</span><br/><br/>\n<ul>\n";
59
 
60
  $loop = 1;
61
  $pos = 1;
@@ -64,9 +64,21 @@ function adw_create_widget() {
64
  $start = strpos( $twitter_feed, '<text>', $pos );
65
  $end = strpos( $twitter_feed, '</text>', $start );
66
 
67
- $status = substr( $twitter_feed, $start + 6, $end - $start - 6 ); // Extract status
68
- $status = str_replace( 'New blog post: ', '', $status ); // Remove blog post text
69
- $status = ereg_replace( "[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $status ); // Add URL links
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  $output .= '<li>' . $status . "</li>\n";
72
 
@@ -81,7 +93,7 @@ function adw_create_widget() {
81
  $output .= "<p><a href=\"http://twitter.com/artiss_tech\">Follow us on Twitter</a></p>\n";
82
 
83
  // Generate support links
84
- $output .= "<span style=\"font-size: 1.1em; font-weight: bold;\">Support Links</span><br/><br/>\n<ul>\n<li><a href=\"http://www.artiss.co.uk\">Artiss.co.uk website</a><br/></li>\n<li><a href=\"http://www.artiss.co.uk/wp-plugins\">Main plugin page</a><br/></li>\n<li><a href=\"http://www.artiss.co.uk/forum\">Plugin forum </a></li>\n</ul>\n";
85
 
86
  // Update cache
87
  set_transient( 'artiss_dashboard_text', $output, $minutes_to_cache * 60 );
1
  <?php
2
  /**
3
+ * Artiss Dashboard Widget (v1.4)
4
  *
5
  * Add a box to the dashboard to display Artiss posts, and plugin news and support links
6
  *
44
  $output .= "<span style=\"font-size: 0.8em; float: right\"><a href=\"http://www.artiss.co.uk/donate\">Donate</a></span>";
45
 
46
  // News heading
47
+ $output .= "<span style=\"font-size: 1.1em; font-weight: bold;\">Latest News</span><br/>\n";
48
 
49
  // Fetch the Twitter status'
50
  $file_return = adw_get_file( 'http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=artiss_tech&count=' . $news_items . '&exclude_replies=true' );
55
 
56
  $twitter_feed = $file_return[ 'file' ];
57
 
58
+ $output .= "<span style=\"font-weight: bold; font-size: 0.8em;\">Last updated " . date('l jS F \a\t g:ia') . ".</span><br/>\n<ul>\n";
59
 
60
  $loop = 1;
61
  $pos = 1;
64
  $start = strpos( $twitter_feed, '<text>', $pos );
65
  $end = strpos( $twitter_feed, '</text>', $start );
66
 
67
+ // Extract status
68
+ $status = substr( $twitter_feed, $start + 6, $end - $start - 6 );
69
+
70
+ // Remove new post suffix
71
+ $pos = strpos( $status, ': ' );
72
+ if ( $pos !== false ) {
73
+ $prefix = substr( $status, 0, $pos + 1 );
74
+ $status = str_replace( 'New blog post: ', '', $status );
75
+ }
76
+
77
+ // Remove hashtags
78
+ $status = rtrim( preg_replace( '/#[^\s]+\s?/', '', $status ) );
79
+
80
+ // Add URL links
81
+ $status = ereg_replace( "[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]","<a href=\"\\0\">\\0</a>", $status );
82
 
83
  $output .= '<li>' . $status . "</li>\n";
84
 
93
  $output .= "<p><a href=\"http://twitter.com/artiss_tech\">Follow us on Twitter</a></p>\n";
94
 
95
  // Generate support links
96
+ $output .= "<span style=\"font-size: 1.1em; font-weight: bold;\">Support Links</span><br/>\n<ul>\n<li><a href=\"http://www.artiss.co.uk\">Artiss.co.uk website</a><br/></li>\n<li><a href=\"http://www.artiss.co.uk/wp-plugins\">Main plugin page</a><br/></li>\n<li><a href=\"http://www.artiss.co.uk/forum\">Plugin forum </a></li>\n</ul>\n";
97
 
98
  // Update cache
99
  set_transient( 'artiss_dashboard_text', $output, $minutes_to_cache * 60 );
includes/content.php CHANGED
@@ -148,10 +148,14 @@ function ye_embed_handler( $matches, $attr, $url, $rawattr ) {
148
 
149
  return $code;
150
  }
 
151
  $url = ye_set_url_option();
152
  if ( $url != '' ) {
153
- wp_embed_register_handler( 'youtube', '/http:\/\/(?:www\.)?youtube.*watch\?[pv]=([a-zA-Z0-9\-_]+)/', 'ye_embed_handler' );
154
- wp_embed_register_handler( 'youtube_embed', '/http:\/\/(?:www\.)?youtube.*[pv]\/([a-zA-Z0-9\-_]+)/', 'ye_embed_handler' );
 
 
 
155
  }
156
 
157
  /**
148
 
149
  return $code;
150
  }
151
+
152
  $url = ye_set_url_option();
153
  if ( $url != '' ) {
154
+ //$ye_regex = '/http:\/\/(?:www\.)?youtube.*watch\?[pv]=([a-zA-Z0-9\-_]+)/';
155
+ // http://stackoverflow.com/questions/7654542/youtube-url-regex
156
+ $ye_regex = '\s*(https?:\/\/www.youtube(?:-nocookie)?.com\/(?:v|embed)\/([a-zA-Z0-9-]+)).*';
157
+ wp_embed_register_handler( 'youtube', $ye_regex, 'ye_embed_handler' );
158
+ wp_embed_register_handler( 'youtube_embed', $ye_regex, 'ye_embed_handler' );
159
  }
160
 
161
  /**
includes/display-readme.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * README Page
4
+ *
5
+ * Display the README instructions
6
+ *
7
+ * @package YouTubeEmbed
8
+ * @since 2.4
9
+ */
10
+ ?>
11
+ <div class="wrap">
12
+ <div class="icon32" id="icon-edit-pages"></div>
13
+
14
+ <h2><?php _e( 'Artiss YouTube Embed README'); ?></h2>
15
+
16
+ <?php
17
+ if ( !function_exists( 'wp_readme_parser' ) ) {
18
+ echo '<p>You shouldn\'t be able to see this but I guess that odd things can happen!<p>';
19
+ echo '<p>To display the README you must install the <a href="http://wordpress.org/extend/plugins/wp-readme-parser/">README Parser plugin</a>.</p>';
20
+ } else {
21
+ echo wp_readme_parser( array( 'exclude' => 'meta,upgrade notice,screenshots,support,changelog,links,installation,licence', 'ignore' => 'For help with this plugin,,for more information and advanced options ' ), 'YouTube Embed' );
22
+ }
23
+ ?>
24
+ </div>
includes/function-calls.php CHANGED
@@ -52,7 +52,9 @@ function youtube_video_embed( $content, $paras = '', $style = '' ) {
52
  $hd = ye_get_parameters( $paras, 'hd' );
53
  $color = ye_get_parameters( $paras, 'color' );
54
  $theme = ye_get_parameters( $paras, 'theme' );
55
- $https = ye_get_parameters( $paras, 'https' );
 
 
56
 
57
  // Get Embed type
58
  $type = ye_get_embed_type( $type, $embedplus );
@@ -60,7 +62,7 @@ function youtube_video_embed( $content, $paras = '', $style = '' ) {
60
  // Set up Autohide parameter
61
  $autohide = ye_set_autohide( $autohide );
62
 
63
- echo ye_generate_youtube_code( $content, $type, $width, $height, ye_convert( $fullscreen ), ye_convert( $related ), ye_convert( $autoplay ), ye_convert( $loop ), $start, ye_convert( $info ), ye_convert_3( $annotation ), ye_convert( $cc ), $style, ye_convert( $link ), ye_convert( $react ), $stop, ye_convert( $sweetspot ), ye_convert( $disablekb ), $ratio, $autohide, ye_convert( $controls ), $profile, $list, ye_convert( $audio ), $template, ye_convert( $hd ), $color, $theme, $https );
64
  return;
65
  }
66
 
52
  $hd = ye_get_parameters( $paras, 'hd' );
53
  $color = ye_get_parameters( $paras, 'color' );
54
  $theme = ye_get_parameters( $paras, 'theme' );
55
+ $https = ye_get_parameters( $paras, 'ssl' );
56
+ $title = ye_get_parameters( $paras, 'title' );
57
+ $dynamic = ye_get_parameters( $paras, 'dynamic' );
58
 
59
  // Get Embed type
60
  $type = ye_get_embed_type( $type, $embedplus );
62
  // Set up Autohide parameter
63
  $autohide = ye_set_autohide( $autohide );
64
 
65
+ echo ye_generate_youtube_code( $content, $type, $width, $height, ye_convert( $fullscreen ), ye_convert( $related ), ye_convert( $autoplay ), ye_convert( $loop ), $start, ye_convert( $info ), ye_convert_3( $annotation ), ye_convert( $cc ), $style, ye_convert( $link ), ye_convert( $react ), $stop, ye_convert( $sweetspot ), ye_convert( $disablekb ), $ratio, $autohide, ye_convert( $controls ), $profile, $list, ye_convert( $audio ), $template, ye_convert( $hd ), $color, $theme, ye_convert( $https ), $title, ye_convert( $dynamic ) );
66
  return;
67
  }
68
 
includes/generate-embed-code.php CHANGED
@@ -52,47 +52,58 @@
52
  * @param string $color Progress bar colour
53
  * @param string $theme Use dark or light theme
54
  * @param string $https Use HTTPS for links
 
55
  * @return string Code output
56
  */
57
 
58
- function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height = '', $fullscreen = '', $related = '', $autoplay = '', $loop = '', $start = '', $info = '', $annotation = '', $cc = '', $style = '', $link = '', $react = '', $stop = '', $sweetspot = '', $disablekb = '', $ratio = '', $autohide = '', $controls = '', $profile = '', $list_style = '', $audio = '', $template = '', $hd = '', $color = '', $theme = '', $https = '' ) {
59
 
60
  // Ensure an ID is passed
 
61
  if ( $id == '' ) { return ye_error( 'No video/playlist ID has been supplied' ); }
62
 
63
  // Get general options
 
64
  $general = ye_set_general_defaults();
65
 
66
  // Find the profile, if one is specified
 
67
  $profile = ye_validate_profile( $profile, $general[ 'profile_no' ] );
68
 
69
  // Get default values if no values are supplied
 
70
  $options = ye_set_profile_defaults( $profile );
71
 
72
  // Check it's not a list
 
73
  $playlist_ids = '';
74
  $list = ye_validate_list( $id, $general[ 'list_no' ] );
75
  if ( !is_array( $list ) ) {
76
 
77
  // Check if certain parameters are included in the URL
 
78
  $width = ye_get_url_para( $id, 'w', $width );
79
  $height = ye_get_url_para( $id, 'h', $height );
80
 
81
  // Extract the ID if a full URL has been specified
 
82
  $id = ye_extract_id( $id );
83
 
84
  // Is it being previewed? In which case remove any cache
 
85
  if ( ( preg_match( '/p=([0-9]*)&preview=true/', $_SERVER['QUERY_STRING'] ) == 1 ) && ( $general[ 'preview' ] == 1 ) ) {
86
  delete_transient( 'ye_type_' . $id );
87
  delete_transient( 'ye_title_' . $id );
88
  }
89
 
90
  // Check what type of video it is and whether it's valid
 
91
  $return = ye_validate_id( $id, true );
92
  $title = $return['title'];
93
  $embed_type = $return[ 'type' ];
94
 
95
  // If the video is invalid, output an appropriate error
 
96
  if ( ( $embed_type == '' ) or ( strlen ( $embed_type ) != 1 ) ) {
97
  if ( $embed_type == '' ) {
98
  $error = 'The YouTube ID of ' . $id . ' is invalid.';
@@ -109,18 +120,23 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
109
  $embed_type = 'v';
110
 
111
  // Randomize the video
 
112
  if ( $list_style == 'random' ) { shuffle( $list ); }
113
 
114
  // Extract one video randomly
 
115
  if ( $list_style == 'single' ) {
116
  $id = $list[ array_rand( $list, 1 ) ];
117
 
118
  // Build the playlist
 
119
  } else {
120
 
121
  $id = $list [ 0 ];
122
  $title = '';
 
123
  // Build the playlist
 
124
  if ( count( $list ) > 1 ) {
125
  $loop = 1;
126
  while ( $loop < count( $list ) ) {
@@ -134,9 +150,11 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
134
  }
135
 
136
  // Generate a cache key for the above passed parameters
137
- $cache_key = 'ye_video_' . base64_encode( sha1( $id . $type . $width . $height . $fullscreen . $related . $autoplay . $loop . $start . $info . $annotation . $cc . $style . $link . $react . $stop . $sweetspot . $disablekb . $ratio . $autohide . $controls . $profile . $list_style . $audio . $template . $hd . $color . $theme . $https . print_r( $general, true ) . print_r( $options, true ) . print_r( $list, true ) ) );
 
138
 
139
  // Try and get the output from cache. If it exists, return the code
 
140
  if ( ( $general[ 'embed_cache' ] != 0 ) && ( !is_feed() ) ) {
141
  $result = get_transient( $cache_key );
142
  if ( $result !== false) { return $result; }
@@ -145,10 +163,12 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
145
  $metadata = $general[ 'metadata' ];
146
 
147
  // Work out correct protocol to use - HTTP or HTTPS
 
148
  if ( $https == '' ) { $https = $options[ 'https' ]; }
149
  if ( $https == 1 ) { $https = 's'; } else { $https = ''; }
150
 
151
  // If this is a feed then display a thumbnail and/or text link to the original video
 
152
  if ( is_feed () ) {
153
  $result = '';
154
  if ( $playlist_ids != '' ) {
@@ -161,13 +181,26 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
161
  return $result;
162
  }
163
 
 
 
 
 
 
 
 
 
 
 
164
  // Only set width and height from defaults if both are missing
 
165
  if ( ( $width == '' ) && ( $height == '' ) ) {
 
166
  $width = $options[ 'width' ];
167
  $height = $options[ 'height' ];
168
  }
169
 
170
  // If values have not been pressed, use the default values
 
171
  if ( $fullscreen == '' ) { $fullscreen = $options[ 'fullscreen' ]; }
172
  if ( $related == '' ) { $related = $options[ 'related' ]; }
173
  if ( $autoplay == '' ) { $autoplay = $options[ 'autoplay' ]; }
@@ -188,20 +221,23 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
188
  if ( $theme == '' ) { $theme = $options[ 'theme' ]; }
189
 
190
  $wmode = $options[ 'wmode' ];
191
- $shadow = $options[ 'shadow' ];
192
 
193
  // Build the required template
 
194
  if ( $template == '' ) { $template = $options[ 'template' ]; } else { $template = ye_decode( $template ); }
195
  if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
196
 
197
  // If a multi-play list has been specified and EmbedPlus selected, use fallback embedding method instead
 
198
  if ( ( $playlist_ids != '' ) && ( $type == 'm' ) && ( $list_style != 'single' ) ) { $type = $options[ 'fallback' ]; }
199
 
200
  // If looping and no playlist has been generated, add the current ID
201
  // This is a workaround for the AS3 player which won't otherwise loop
 
202
  if ( ( $loop == 1 ) && ( $embed_type != 'p' ) && ( $playlist_ids == '' ) ) { $playlist_ids = $id; }
203
 
204
  // If no type was specified, depending on whether this is a video or playlist, set the specific default
 
205
  if ( $type == '' ) {
206
  if ( $embed_type == 'v' ) {
207
  $type = $options[ 'type' ];
@@ -211,14 +247,18 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
211
  }
212
 
213
  // Set parameters without default values
 
214
  if ( $start == '' ) { $start = '0'; }
215
  if ( $stop == '' ) { $stop = '0'; }
216
 
217
  // If height or width is missing, calculate missing parameter using ratio
 
218
  if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
219
  $ratio_to_use = '';
220
  if ( $ratio != '' ) {
 
221
  // Extract the ratio from the provided string
 
222
  $pos = strpos( $ratio, ':', 0 );
223
  if ( $pos !== false ) {
224
  $ratio_l = substr( $ratio, 0, $pos );
@@ -228,20 +268,24 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
228
  }
229
 
230
  // If no, or invalid, ratio supplied, calculate from the default video dimensions
 
231
  if ( $ratio_to_use == '' ) { $ratio_to_use = $options[ 'width' ] / $options[ 'height' ]; }
232
 
233
  // Complete the missing width or height using the ratio
 
234
  if ( $width == '' ) { $width = round( $height * $ratio_to_use, 0); }
235
  if ( $height == '' ) { $height = round( $width / $ratio_to_use, 0); }
236
  }
237
 
238
  // If audio playback option is set, restrict the height to just show the player toolbar
 
239
  if ( $audio == '1' ) { $height = 27; }
240
 
241
  // Set up embed types
 
242
  $tab = '';
243
  $class = 'youtube-player';
244
- $paras = 'version=3&amp;modestbranding=1';
245
 
246
  $embedplus = false;
247
  $swf = false;
@@ -249,6 +293,7 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
249
  $chromeless = false;
250
 
251
  if ( $type != 'v' ) {
 
252
  if ( $type == 'm' ) {
253
  $embedplus = true;
254
  $tab = "\t";
@@ -267,11 +312,12 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
267
  }
268
 
269
  // Generate parameters to add to URL
 
270
  if ( $fullscreen == 1 ) { $paras .= '&amp;fs=1'; } else { $paras .= '&amp;fs=0'; }
271
  if ( $related != 1 ) { $paras .= '&amp;rel=0'; }
272
  if ( $autoplay == 1 ) { $paras .= '&amp;autoplay=1'; $paras_ep .= '&amp;autoplay=1'; }
273
  if ( $loop == 1 ) { $paras .= '&amp;loop=1'; }
274
- if ( $info == 1 ) { $paras .= '&amp;showinfo=1'; }
275
  if ( $annotation != 1 ) { $paras .= '&amp;iv_load_policy=3'; }
276
  if ( $cc == 1 ) { $paras .= '&amp;cc_load_policy=1'; }
277
  if ( $disablekb == 1 ) { $paras .= '&amp;disablekb=1'; }
@@ -279,25 +325,35 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
279
  if ( $controls != 1 ) { $paras .= '&amp;controls=0'; }
280
  if ( strtolower( $color ) != 'red' ) { $paras .= '&amp;color=' . strtolower( $color ); }
281
  if ( strtolower( $theme ) != 'dark' ) { $paras .= '&amp;theme=' . strtolower( $theme ); }
 
282
 
283
  // If not a playlist, add the playlist parameter
 
284
  if ( $playlist_ids != '' ) { $paras .= '&amp;playlist=' . $playlist_ids; }
285
 
286
  // Generate EmbedPlus parameters
 
287
  $paras_ep = '&amp;width=' . $width . '&amp;height=' . $height;
288
  if ( $react != 1 ) { $paras_ep .= '&amp;react=0'; }
289
  if ( $sweetspot != 1 ) { $paras_ep .= '&amp;sweetspot=0'; }
290
  if ( $hd == 1 ) { $paras_ep .= '&amp;hd=1'; }
291
 
292
  // Add start & stop parameters
 
293
  if ( $start != 0 ) { $paras .= '&amp;start=' . $start; $paras_ep .= '&amp;start=' . $start; }
294
  if ( $stop != 0 ) { $paras_ep .= '&amp;stop=' . $stop; }
295
 
296
- $result = '';
 
 
 
 
 
297
 
298
  // Add EmbedPlus code
 
299
  if ( $embedplus ) {
300
- $result .= "<object type=\"application/x-shockwave-flash\" width=\"" . $width . "\" height=\"" . $embedheight . "\" data=\"http://getembedplus.com/embedplus.swf\" style=\"" . $style . "\" id=\"" . uniqid( 'ep_', true ) . "\">\n";
301
  $result .= "\t<param value=\"http://getembedplus.com/embedplus.swf\" name=\"movie\" />\n";
302
  $result .= "\t<param value=\"high\" name=\"quality\" />\n";
303
  $result .= "\t<param value=\"" . $wmode . "\" name=\"wmode\" />\n";
@@ -306,21 +362,31 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
306
  $result .= "\t<param name=\"flashvars\" value=\"ytid=" . $id . $paras_ep . "\" />\n";
307
  }
308
 
 
 
 
 
 
 
 
 
 
309
  // Add AS3 YouTube embed code
 
310
  if ( ( $swf ) or ( $chromeless ) or ( ( $embedplus ) && ( ( $fallback == 'o' ) or ( $fallback == 'p' ) ) ) ) {
311
 
312
  if ( $chromeless ) {
313
  $url_start = 'http' . $https . '://www.youtube.com/apiplayer?video_id=' . $id . '&';
314
  } else {
315
- $url_start = 'http' . $https . '://www.youtube.com/' . $embed_type . '/' . $id . '?';
316
  }
317
 
318
  $result .= $tab . "<object class=\"" . $class . "\" type=\"application/x-shockwave-flash\" data=\"" . $url_start . $paras . "\" width=\"" . $width . "\" height=\"" . $height . "\" style=\"" . $style . "\"";
319
 
320
  if ( $metadata != 0 ) { $result .= " rel=\"media:video\" resource=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id ."\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\""; }
321
- $result .= ">\n";
322
  if ( $metadata != 0 ) { $result .= $tab . "\t<a rel=\"media:thumbnail\" href=\"http://img.youtube.com/vi/" . $id . "/default.jpg\" />\n"; }
323
- $result .= $tab . "\t<param name=\"movie\" value=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id . "?" . $paras . "\" />\n";
324
  $result .= $tab . "\t<param name=\"wmode\" value=\"" . $wmode . "\" />\n";
325
  if ( $fullscreen == 1 ) { $result .= $tab . "\t<param name=\"allowFullScreen\" value=\"true\" />\n"; }
326
  if ( ( $link != 1 ) && ( $link != '' ) ) { $result .= $tab . "\t<param name=\"allowNetworking\" value=\"internal\" />\n"; }
@@ -329,27 +395,34 @@ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
329
  }
330
 
331
  // Add IFRAME embed code
 
332
  if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
333
  if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
334
- $result .= $tab . '<iframe style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="http' . $https . '://www.youtube.com/embed/' . $playlist_para . $id . '?' . $paras . '&amp;wmode=' . $wmode . '"';
335
  if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
336
- $result .= "></iframe>\n";
337
  }
338
 
339
  // If using EmbedPlus, add the OBJECT closure tag
340
- if ( $embedplus ) { $result .= "</object>\n<!--[if lte IE 6]> <style type=\"text/css\">.cantembedplus{display:none;}</style><![endif]-->\n"; }
341
 
342
- // Add drop shadow
343
- if ( ( is_numeric( $shadow ) ) && ( $shadow != 0 ) ) { $result .= "<br/><img src=\"" . plugins_url() . "/youtube-embed/images/shadow.png\" alt=\"\" title=\"\" height=\"" . $shadow . "\" width=\"" . $width . "\" />\n"; }
344
 
345
  // Now apply the template to the result
346
- $result = str_replace( '%video%', $result, $template );
 
 
 
 
 
 
347
 
348
  // Now add a commented header and trailer
 
349
  $result = "\n<!-- YouTube Embed v" . youtube_embed_version . " | http://www.artiss.co.uk/artiss-youtube-embed -->\n" . $result;
350
  $result .= "<!-- End of YouTube Embed code -->\n";
351
 
352
  // Cache the output
 
353
  if ( $general[ 'embed_cache' ] != 0 ) { set_transient( $cache_key, $result, 3600 * $general[ 'embed_cache' ] ); }
354
 
355
  return $result;
@@ -375,6 +448,7 @@ function ye_validate_profile( $name, $number ) {
375
  if ( ( $name != '' ) && ( $name != 'default' ) ) {
376
 
377
  // Loop around, fetching in profile names
 
378
  $loop = 1;
379
  while ( ( $loop <= $number ) && ( $profile == 0 ) ) {
380
  if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
@@ -407,16 +481,19 @@ function ye_validate_list( $name, $number ) {
407
  $list = '';
408
 
409
  // If the parameter contains commas, assume to be a comma seperated list and move into an array
 
410
  if ( strpos( $name, ',' ) !== false ) {
411
  $list = explode( ',', $name );
412
  } else {
413
 
414
  // No comma, so check if this is a named list
 
415
  $name = strtolower( $name );
416
 
417
  if ( $name != '' ) {
418
 
419
  // Loop around, fetching in profile names
 
420
  $loop = 1;
421
  while ( ( $loop <= $number ) && ( $list == '' ) ) {
422
  $listfiles = get_option( 'youtube_embed_list' . $loop );
@@ -450,15 +527,18 @@ function ye_validate_list( $name, $number ) {
450
  function ye_get_url_para( $id, $para, $current ) {
451
 
452
  // Look for an ampersand
 
453
  $start_pos = false;
454
  if ( strpos( $id, '&amp;' . $para . '=' ) !== false ) { $start_pos = strpos( $id, '&amp;' . $para . '=' ) + 6 + strlen( $para ); }
455
 
456
  // If a parameter was found, look for the end of it
 
457
  if ( $start_pos !== false ) {
458
  $end_pos = strpos( $id, '&amp;', $start_pos + 1 );
459
  if ( !$end_pos ) { $end_pos = strlen( $id ); }
460
 
461
  // Extract the parameter and return it
 
462
  $current = substr( $id, $start_pos, $end_pos - $start_pos );
463
  }
464
 
52
  * @param string $color Progress bar colour
53
  * @param string $theme Use dark or light theme
54
  * @param string $https Use HTTPS for links
55
+ * @param string $title Video title
56
  * @return string Code output
57
  */
58
 
59
+ function ye_generate_youtube_code( $id = '', $type = '', $width = '', $height = '', $fullscreen = '', $related = '', $autoplay = '', $loop = '', $start = '', $info = '', $annotation = '', $cc = '', $style = '', $link = '', $react = '', $stop = '', $sweetspot = '', $disablekb = '', $ratio = '', $autohide = '', $controls = '', $profile = '', $list_style = '', $audio = '', $template = '', $hd = '', $color = '', $theme = '', $https = '', $title = '', $dynamic = '' ) {
60
 
61
  // Ensure an ID is passed
62
+
63
  if ( $id == '' ) { return ye_error( 'No video/playlist ID has been supplied' ); }
64
 
65
  // Get general options
66
+
67
  $general = ye_set_general_defaults();
68
 
69
  // Find the profile, if one is specified
70
+
71
  $profile = ye_validate_profile( $profile, $general[ 'profile_no' ] );
72
 
73
  // Get default values if no values are supplied
74
+
75
  $options = ye_set_profile_defaults( $profile );
76
 
77
  // Check it's not a list
78
+
79
  $playlist_ids = '';
80
  $list = ye_validate_list( $id, $general[ 'list_no' ] );
81
  if ( !is_array( $list ) ) {
82
 
83
  // Check if certain parameters are included in the URL
84
+
85
  $width = ye_get_url_para( $id, 'w', $width );
86
  $height = ye_get_url_para( $id, 'h', $height );
87
 
88
  // Extract the ID if a full URL has been specified
89
+
90
  $id = ye_extract_id( $id );
91
 
92
  // Is it being previewed? In which case remove any cache
93
+
94
  if ( ( preg_match( '/p=([0-9]*)&preview=true/', $_SERVER['QUERY_STRING'] ) == 1 ) && ( $general[ 'preview' ] == 1 ) ) {
95
  delete_transient( 'ye_type_' . $id );
96
  delete_transient( 'ye_title_' . $id );
97
  }
98
 
99
  // Check what type of video it is and whether it's valid
100
+
101
  $return = ye_validate_id( $id, true );
102
  $title = $return['title'];
103
  $embed_type = $return[ 'type' ];
104
 
105
  // If the video is invalid, output an appropriate error
106
+
107
  if ( ( $embed_type == '' ) or ( strlen ( $embed_type ) != 1 ) ) {
108
  if ( $embed_type == '' ) {
109
  $error = 'The YouTube ID of ' . $id . ' is invalid.';
120
  $embed_type = 'v';
121
 
122
  // Randomize the video
123
+
124
  if ( $list_style == 'random' ) { shuffle( $list ); }
125
 
126
  // Extract one video randomly
127
+
128
  if ( $list_style == 'single' ) {
129
  $id = $list[ array_rand( $list, 1 ) ];
130
 
131
  // Build the playlist
132
+
133
  } else {
134
 
135
  $id = $list [ 0 ];
136
  $title = '';
137
+
138
  // Build the playlist
139
+
140
  if ( count( $list ) > 1 ) {
141
  $loop = 1;
142
  while ( $loop < count( $list ) ) {
150
  }
151
 
152
  // Generate a cache key for the above passed parameters
153
+
154
+ $cache_key = 'ye_video_' . base64_encode( sha1( $id . $type . $width . $height . $fullscreen . $related . $autoplay . $loop . $start . $info . $annotation . $cc . $style . $link . $react . $stop . $sweetspot . $disablekb . $ratio . $autohide . $controls . $profile . $list_style . $audio . $template . $hd . $color . $theme . $https . $dynamic . $title . print_r( $general, true ) . print_r( $options, true ) . print_r( $list, true ) ) );
155
 
156
  // Try and get the output from cache. If it exists, return the code
157
+
158
  if ( ( $general[ 'embed_cache' ] != 0 ) && ( !is_feed() ) ) {
159
  $result = get_transient( $cache_key );
160
  if ( $result !== false) { return $result; }
163
  $metadata = $general[ 'metadata' ];
164
 
165
  // Work out correct protocol to use - HTTP or HTTPS
166
+
167
  if ( $https == '' ) { $https = $options[ 'https' ]; }
168
  if ( $https == 1 ) { $https = 's'; } else { $https = ''; }
169
 
170
  // If this is a feed then display a thumbnail and/or text link to the original video
171
+
172
  if ( is_feed () ) {
173
  $result = '';
174
  if ( $playlist_ids != '' ) {
181
  return $result;
182
  }
183
 
184
+ // If a dynamic size has been requested, check whether the width should be fixed
185
+
186
+ $fixed = 0;
187
+ if ( $dynamic == '' ) {
188
+ $dynamic = $options[ 'dynamic' ];
189
+ $fixed = $options[ 'fixed' ];
190
+ } else {
191
+ if ( $width != '' ) { $fixed = 1; }
192
+ }
193
+
194
  // Only set width and height from defaults if both are missing
195
+
196
  if ( ( $width == '' ) && ( $height == '' ) ) {
197
+
198
  $width = $options[ 'width' ];
199
  $height = $options[ 'height' ];
200
  }
201
 
202
  // If values have not been pressed, use the default values
203
+
204
  if ( $fullscreen == '' ) { $fullscreen = $options[ 'fullscreen' ]; }
205
  if ( $related == '' ) { $related = $options[ 'related' ]; }
206
  if ( $autoplay == '' ) { $autoplay = $options[ 'autoplay' ]; }
221
  if ( $theme == '' ) { $theme = $options[ 'theme' ]; }
222
 
223
  $wmode = $options[ 'wmode' ];
 
224
 
225
  // Build the required template
226
+
227
  if ( $template == '' ) { $template = $options[ 'template' ]; } else { $template = ye_decode( $template ); }
228
  if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
229
 
230
  // If a multi-play list has been specified and EmbedPlus selected, use fallback embedding method instead
231
+
232
  if ( ( $playlist_ids != '' ) && ( $type == 'm' ) && ( $list_style != 'single' ) ) { $type = $options[ 'fallback' ]; }
233
 
234
  // If looping and no playlist has been generated, add the current ID
235
  // This is a workaround for the AS3 player which won't otherwise loop
236
+
237
  if ( ( $loop == 1 ) && ( $embed_type != 'p' ) && ( $playlist_ids == '' ) ) { $playlist_ids = $id; }
238
 
239
  // If no type was specified, depending on whether this is a video or playlist, set the specific default
240
+
241
  if ( $type == '' ) {
242
  if ( $embed_type == 'v' ) {
243
  $type = $options[ 'type' ];
247
  }
248
 
249
  // Set parameters without default values
250
+
251
  if ( $start == '' ) { $start = '0'; }
252
  if ( $stop == '' ) { $stop = '0'; }
253
 
254
  // If height or width is missing, calculate missing parameter using ratio
255
+
256
  if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
257
  $ratio_to_use = '';
258
  if ( $ratio != '' ) {
259
+
260
  // Extract the ratio from the provided string
261
+
262
  $pos = strpos( $ratio, ':', 0 );
263
  if ( $pos !== false ) {
264
  $ratio_l = substr( $ratio, 0, $pos );
268
  }
269
 
270
  // If no, or invalid, ratio supplied, calculate from the default video dimensions
271
+
272
  if ( $ratio_to_use == '' ) { $ratio_to_use = $options[ 'width' ] / $options[ 'height' ]; }
273
 
274
  // Complete the missing width or height using the ratio
275
+
276
  if ( $width == '' ) { $width = round( $height * $ratio_to_use, 0); }
277
  if ( $height == '' ) { $height = round( $width / $ratio_to_use, 0); }
278
  }
279
 
280
  // If audio playback option is set, restrict the height to just show the player toolbar
281
+
282
  if ( $audio == '1' ) { $height = 27; }
283
 
284
  // Set up embed types
285
+
286
  $tab = '';
287
  $class = 'youtube-player';
288
+ $paras = 'version=3';
289
 
290
  $embedplus = false;
291
  $swf = false;
293
  $chromeless = false;
294
 
295
  if ( $type != 'v' ) {
296
+ $paras .= '&amp;modestbranding=1';
297
  if ( $type == 'm' ) {
298
  $embedplus = true;
299
  $tab = "\t";
312
  }
313
 
314
  // Generate parameters to add to URL
315
+
316
  if ( $fullscreen == 1 ) { $paras .= '&amp;fs=1'; } else { $paras .= '&amp;fs=0'; }
317
  if ( $related != 1 ) { $paras .= '&amp;rel=0'; }
318
  if ( $autoplay == 1 ) { $paras .= '&amp;autoplay=1'; $paras_ep .= '&amp;autoplay=1'; }
319
  if ( $loop == 1 ) { $paras .= '&amp;loop=1'; }
320
+ if ( $info != 1 ) { $paras .= '&amp;showinfo=0'; }
321
  if ( $annotation != 1 ) { $paras .= '&amp;iv_load_policy=3'; }
322
  if ( $cc == 1 ) { $paras .= '&amp;cc_load_policy=1'; }
323
  if ( $disablekb == 1 ) { $paras .= '&amp;disablekb=1'; }
325
  if ( $controls != 1 ) { $paras .= '&amp;controls=0'; }
326
  if ( strtolower( $color ) != 'red' ) { $paras .= '&amp;color=' . strtolower( $color ); }
327
  if ( strtolower( $theme ) != 'dark' ) { $paras .= '&amp;theme=' . strtolower( $theme ); }
328
+ if ( $title != '' ) { $paras .= '&amp;title=' . urlencode( $title ); }
329
 
330
  // If not a playlist, add the playlist parameter
331
+
332
  if ( $playlist_ids != '' ) { $paras .= '&amp;playlist=' . $playlist_ids; }
333
 
334
  // Generate EmbedPlus parameters
335
+
336
  $paras_ep = '&amp;width=' . $width . '&amp;height=' . $height;
337
  if ( $react != 1 ) { $paras_ep .= '&amp;react=0'; }
338
  if ( $sweetspot != 1 ) { $paras_ep .= '&amp;sweetspot=0'; }
339
  if ( $hd == 1 ) { $paras_ep .= '&amp;hd=1'; }
340
 
341
  // Add start & stop parameters
342
+
343
  if ( $start != 0 ) { $paras .= '&amp;start=' . $start; $paras_ep .= '&amp;start=' . $start; }
344
  if ( $stop != 0 ) { $paras_ep .= '&amp;stop=' . $stop; }
345
 
346
+ // Generate DIVs to wrap around video
347
+
348
+ if ( $dynamic == 1) {
349
+ $result = "<div class=\"ye-container\">\n";
350
+ if ( $fixed == 1) { $result = '<div style="width: ' . $width . 'px; max-width: 100%">' . $result; }
351
+ }
352
 
353
  // Add EmbedPlus code
354
+
355
  if ( $embedplus ) {
356
+ $result .= "<object type=\"application/x-shockwave-flash\" width=\"" . $width . "\" height=\"" . $embedheight . "\" data=\"http://getembedplus.com/embedplus.swf\" style=\"" . $style . "\" id=\"" . uniqid( 'ep_', true ) . "\" >\n";
357
  $result .= "\t<param value=\"http://getembedplus.com/embedplus.swf\" name=\"movie\" />\n";
358
  $result .= "\t<param value=\"high\" name=\"quality\" />\n";
359
  $result .= "\t<param value=\"" . $wmode . "\" name=\"wmode\" />\n";
362
  $result .= "\t<param name=\"flashvars\" value=\"ytid=" . $id . $paras_ep . "\" />\n";
363
  }
364
 
365
+ // Generate standard or privacy encoded URL
366
+
367
+ $privacy = $general[ 'privacy' ];
368
+ if ( $privacy == 1 ) {
369
+ $url_privacy = 'youtube-nocookie.com';
370
+ } else {
371
+ $url_privacy = 'youtube.com';
372
+ }
373
+
374
  // Add AS3 YouTube embed code
375
+
376
  if ( ( $swf ) or ( $chromeless ) or ( ( $embedplus ) && ( ( $fallback == 'o' ) or ( $fallback == 'p' ) ) ) ) {
377
 
378
  if ( $chromeless ) {
379
  $url_start = 'http' . $https . '://www.youtube.com/apiplayer?video_id=' . $id . '&';
380
  } else {
381
+ $url_start = 'http' . $https . '://www.' . $url_privacy . '/' . $embed_type . '/' . $id . '?';
382
  }
383
 
384
  $result .= $tab . "<object class=\"" . $class . "\" type=\"application/x-shockwave-flash\" data=\"" . $url_start . $paras . "\" width=\"" . $width . "\" height=\"" . $height . "\" style=\"" . $style . "\"";
385
 
386
  if ( $metadata != 0 ) { $result .= " rel=\"media:video\" resource=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id ."\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\""; }
387
+ $result .= " >\n";
388
  if ( $metadata != 0 ) { $result .= $tab . "\t<a rel=\"media:thumbnail\" href=\"http://img.youtube.com/vi/" . $id . "/default.jpg\" />\n"; }
389
+ $result .= $tab . "\t<param name=\"movie\" value=\"http" . $https . "://www." . $url_privacy . "/" . $embed_type . "/" . $id . "?" . $paras . "\" />\n";
390
  $result .= $tab . "\t<param name=\"wmode\" value=\"" . $wmode . "\" />\n";
391
  if ( $fullscreen == 1 ) { $result .= $tab . "\t<param name=\"allowFullScreen\" value=\"true\" />\n"; }
392
  if ( ( $link != 1 ) && ( $link != '' ) ) { $result .= $tab . "\t<param name=\"allowNetworking\" value=\"internal\" />\n"; }
395
  }
396
 
397
  // Add IFRAME embed code
398
+
399
  if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
400
  if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
401
+ $result .= $tab . '<iframe frameborder="0" style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="http' . $https . '://www.' . $url_privacy . '/embed/' . $playlist_para . $id . '?' . $paras . '&amp;wmode=' . $wmode . '"';
402
  if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
403
+ $result .= " ></iframe>\n";
404
  }
405
 
406
  // If using EmbedPlus, add the OBJECT closure tag
 
407
 
408
+ if ( $embedplus ) { $result .= "</object>\n<!--[if lte IE 6]> <style type=\"text/css\">.cantembedplus{display:none;}</style><![endif]-->\n"; }
 
409
 
410
  // Now apply the template to the result
411
+
412
+ $end_tag = '';
413
+ if ( $dynamic == 1 ) {
414
+ $end_tag .= '</div>';
415
+ if ( $fixed == 1 ) { $end_tag .= '</div>'; }
416
+ }
417
+ $result = str_replace( '%video%', $result . $end_tag . "\n", $template );
418
 
419
  // Now add a commented header and trailer
420
+
421
  $result = "\n<!-- YouTube Embed v" . youtube_embed_version . " | http://www.artiss.co.uk/artiss-youtube-embed -->\n" . $result;
422
  $result .= "<!-- End of YouTube Embed code -->\n";
423
 
424
  // Cache the output
425
+
426
  if ( $general[ 'embed_cache' ] != 0 ) { set_transient( $cache_key, $result, 3600 * $general[ 'embed_cache' ] ); }
427
 
428
  return $result;
448
  if ( ( $name != '' ) && ( $name != 'default' ) ) {
449
 
450
  // Loop around, fetching in profile names
451
+
452
  $loop = 1;
453
  while ( ( $loop <= $number ) && ( $profile == 0 ) ) {
454
  if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
481
  $list = '';
482
 
483
  // If the parameter contains commas, assume to be a comma seperated list and move into an array
484
+
485
  if ( strpos( $name, ',' ) !== false ) {
486
  $list = explode( ',', $name );
487
  } else {
488
 
489
  // No comma, so check if this is a named list
490
+
491
  $name = strtolower( $name );
492
 
493
  if ( $name != '' ) {
494
 
495
  // Loop around, fetching in profile names
496
+
497
  $loop = 1;
498
  while ( ( $loop <= $number ) && ( $list == '' ) ) {
499
  $listfiles = get_option( 'youtube_embed_list' . $loop );
527
  function ye_get_url_para( $id, $para, $current ) {
528
 
529
  // Look for an ampersand
530
+
531
  $start_pos = false;
532
  if ( strpos( $id, '&amp;' . $para . '=' ) !== false ) { $start_pos = strpos( $id, '&amp;' . $para . '=' ) + 6 + strlen( $para ); }
533
 
534
  // If a parameter was found, look for the end of it
535
+
536
  if ( $start_pos !== false ) {
537
  $end_pos = strpos( $id, '&amp;', $start_pos + 1 );
538
  if ( !$end_pos ) { $end_pos = strlen( $id ); }
539
 
540
  // Extract the parameter and return it
541
+
542
  $current = substr( $id, $start_pos, $end_pos - $start_pos );
543
  }
544
 
includes/mcebutton.php CHANGED
@@ -56,7 +56,7 @@ function register_youtube_embed_button( $buttons ) {
56
  */
57
 
58
  function add_youtube_embed_mce_plugin( $plugin_array ) {
59
- $plugin_array[ 'YouTube' ] = plugins_url() . '/youtube-embed/js/mcebutton.js';
60
  return $plugin_array;
61
  }
62
  ?>
56
  */
57
 
58
  function add_youtube_embed_mce_plugin( $plugin_array ) {
59
+ $plugin_array[ 'YouTube' ] = plugins_url() . '/youtube-embed/js/ye-mcebutton.js';
60
  return $plugin_array;
61
  }
62
  ?>
includes/options-general.php CHANGED
@@ -46,6 +46,7 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
46
  $options[ 'api' ] = $_POST[ 'youtube_embed_api' ];
47
  $options[ 'error_message' ] = htmlspecialchars( $_POST[ 'youtube_embed_error_message' ] );
48
  $options[ 'thumbnail' ] = $_POST[ 'youtube_embed_thumbnail' ];
 
49
 
50
  // Update the options
51
  update_option( 'youtube_embed_general', $options );
@@ -248,6 +249,14 @@ $url = ye_set_url_option();
248
  <td><input type="text" size="60" name="youtube_embed_error_message" value="<?php echo $options[ 'error_message' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'This is the message that will be shown on the post' ); ?></span></td>
249
  </tr></table>
250
 
 
 
 
 
 
 
 
 
251
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
252
 
253
  <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/></p>
46
  $options[ 'api' ] = $_POST[ 'youtube_embed_api' ];
47
  $options[ 'error_message' ] = htmlspecialchars( $_POST[ 'youtube_embed_error_message' ] );
48
  $options[ 'thumbnail' ] = $_POST[ 'youtube_embed_thumbnail' ];
49
+ $options[ 'privacy' ] = $_POST[ 'youtube_embed_privacy' ];
50
 
51
  // Update the options
52
  update_option( 'youtube_embed_general', $options );
249
  <td><input type="text" size="60" name="youtube_embed_error_message" value="<?php echo $options[ 'error_message' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'This is the message that will be shown on the post' ); ?></span></td>
250
  </tr></table>
251
 
252
+ <br/><span class="yt_heading"><?php _e( 'Security' ); ?></span>
253
+
254
+ <table class="form-table"><tr>
255
+ <th scope="row"><?php _e( 'Privacy-Enhanced Mode' ); ?></th>
256
+ <td><input type="checkbox" name="youtube_embed_privacy" value="1"<?php if ( $options[ 'privacy' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'When on, the player on this site will not store cookies' ); ?></span></td>
257
+ </tr></table>
258
+
259
+
260
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
261
 
262
  <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/></p>
includes/options-profiles.php CHANGED
@@ -22,6 +22,7 @@ if ( $profile_no == '' ) { $profile_no = 0; }
22
  // If options have been updated on screen, update the database
23
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-profile' , 'youtube_embed_profile_nonce' ) ) ) {
24
 
 
25
  $options[ 'name' ] = $_POST[ 'youtube_embed_name' ];
26
  $options[ 'type' ] = $_POST[ 'youtube_embed_type' ];
27
  $options[ 'playlist' ] = $_POST[ 'youtube_embed_playlist' ];
@@ -47,12 +48,15 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
47
  $options[ 'controls'] = $_POST[ 'youtube_embed_controls' ];
48
  $options[ 'fallback'] = $_POST[ 'youtube_embed_fallback' ];
49
  $options[ 'wmode'] = $_POST[ 'youtube_embed_wmode' ];
50
- $options[ 'shadow'] = $_POST[ 'youtube_embed_shadow' ];
51
  $options[ 'audio'] = $_POST[ 'youtube_embed_audio' ];
52
  $options[ 'hd'] = $_POST[ 'youtube_embed_hd' ];
53
  $options[ 'color' ] = $_POST[ 'youtube_embed_color' ];
54
  $options[ 'theme' ] = $_POST[ 'youtube_embed_theme' ];
55
  $options[ 'https' ] = $_POST[ 'youtube_embed_https' ];
 
 
 
 
56
 
57
  $default_size = $_POST[ 'youtube_embed_size' ];
58
 
@@ -61,6 +65,23 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
61
  $options[ 'height'] = ltrim( substr( $default_size, -4, 4 ), '0' );
62
  }
63
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  update_option( 'youtube_embed_profile' . $profile_no, $options );
65
  echo '<div class="updated fade"><p><strong>' . __( $options[ 'name' ].' Profile Saved.' ) . "</strong></p></div>\n";
66
  } else {
@@ -148,6 +169,16 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
148
  <option value="12800745"<?php if ( $default_size == "12800745" ) { echo " selected='selected'"; } ?>><?php _e( '1280x745 16:9' ); ?></option>
149
  </select>&nbsp;<span class="description"><?php _e( 'Select one of these default sizes to override the above video sizes' ); ?></span></td>
150
  </tr>
 
 
 
 
 
 
 
 
 
 
151
  </table>
152
 
153
  <table class="form-table">
@@ -162,10 +193,6 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
162
  <td><input type="checkbox" name="youtube_embed_autoplay" value="1"<?php if ( $options[ 'autoplay' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'The video will start playing when the player loads' ); ?></span></td>
163
  </tr>
164
 
165
- <tr>
166
- <th scope="row"><?php _e( 'Drop Shadow Height' ); ?></th>
167
- <td><input type="text" size="2" name="youtube_embed_shadow" value="<?php echo $options[ 'shadow' ]; ?>"/>px&nbsp;<span class="description">Number of pixels high for drop-shadow. Put to 0 to switch off.</span></td>
168
- </tr>
169
  </table>
170
 
171
  <br/><span class="yt_heading"><?php _e( 'Non-EmbedPlus Options' ); ?></span>
@@ -188,8 +215,8 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
188
  </tr>
189
 
190
  <tr>
191
- <th scope="row"><?php _e( 'HTTPS' ); ?></th>
192
- <td><input type="checkbox" name="youtube_embed_https" value="1"<?php if ( $options[ 'https' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Use HTTPS? <a href="http://www.google.com/support/youtube/bin/answer.py?answer=171780&expand=UseHTTPS#HTTPS">Read more</a>' ); ?></span></td>
193
  </tr>
194
 
195
  <tr>
@@ -266,6 +293,11 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
266
  <option value="window"<?php if ( $options[ 'wmode' ] == "window" ) { echo " selected='selected'"; } ?>><?php _e( 'Window' ); ?></option>
267
  </select><span class="description"><?php _e( 'Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser. <a href="http://www.communitymx.com/content/article.cfm?cid=e5141">Learn more</a>.' ); ?></span></td>
268
  </tr>
 
 
 
 
 
269
  </table>
270
 
271
  <br/><span class="yt_heading"><?php _e( 'EmbedPlus Options' ); ?></span><span class="description" style="float: right"><?php _e( '<a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-embedplus">Learn more about EmbedPlus</a>' ); ?></span>
@@ -316,7 +348,7 @@ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
316
  <input type="submit" name="Video" class="button-secondary" value="<?php _e( 'Change video' ); ?>"/></p>
317
 
318
  <p><?php
319
- if ( $video_type == "d" ) { $id = 'TJJJaDMpCn0'; $type = ''; }
320
  if ( $video_type == "p" ) { $id = 'YVvn8dpSAt0'; $type = 'm'; }
321
  if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; $type = ''; ; }
322
  if ( $video_type == "l" ) { $id = '095393D5B42B2266'; $type = ''; }
22
  // If options have been updated on screen, update the database
23
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-profile' , 'youtube_embed_profile_nonce' ) ) ) {
24
 
25
+
26
  $options[ 'name' ] = $_POST[ 'youtube_embed_name' ];
27
  $options[ 'type' ] = $_POST[ 'youtube_embed_type' ];
28
  $options[ 'playlist' ] = $_POST[ 'youtube_embed_playlist' ];
48
  $options[ 'controls'] = $_POST[ 'youtube_embed_controls' ];
49
  $options[ 'fallback'] = $_POST[ 'youtube_embed_fallback' ];
50
  $options[ 'wmode'] = $_POST[ 'youtube_embed_wmode' ];
 
51
  $options[ 'audio'] = $_POST[ 'youtube_embed_audio' ];
52
  $options[ 'hd'] = $_POST[ 'youtube_embed_hd' ];
53
  $options[ 'color' ] = $_POST[ 'youtube_embed_color' ];
54
  $options[ 'theme' ] = $_POST[ 'youtube_embed_theme' ];
55
  $options[ 'https' ] = $_POST[ 'youtube_embed_https' ];
56
+ $options[ 'privacy' ] = $_POST[ 'youtube_embed_privacy' ];
57
+ $options[ 'modest' ] = $_POST[ 'youtube_embed_modest' ];
58
+ $options[ 'dynamic' ] = $_POST[ 'youtube_embed_dynamic' ];
59
+ $options[ 'fixed' ] = $_POST[ 'youtube_embed_fixed' ];
60
 
61
  $default_size = $_POST[ 'youtube_embed_size' ];
62
 
65
  $options[ 'height'] = ltrim( substr( $default_size, -4, 4 ), '0' );
66
  }
67
 
68
+ // Set width or height, if missing
69
+
70
+ if ( ( $options[ 'width' ] == '' ) && ( $options[ 'height' ] == '' ) ) {
71
+ if ( isset( $GLOBALS[ 'content_width' ] ) ) {
72
+ $options[ 'width' ] = $GLOBALS[ 'content_width' ];
73
+ } else {
74
+ $options[ 'width' ] = 560;
75
+ }
76
+ $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
77
+ }
78
+ if ( ( $options[ 'width' ] == '' ) && ( $options[ 'height' ] != '' ) ) {
79
+ $options[ 'width' ] = round( ( $options[ 'height' ] / 9 ) * 16, 0 );
80
+ }
81
+ if ( ( $options[ 'width' ] != '' ) && ( $options[ 'height' ] == '' ) ) {
82
+ $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
83
+ }
84
+
85
  update_option( 'youtube_embed_profile' . $profile_no, $options );
86
  echo '<div class="updated fade"><p><strong>' . __( $options[ 'name' ].' Profile Saved.' ) . "</strong></p></div>\n";
87
  } else {
169
  <option value="12800745"<?php if ( $default_size == "12800745" ) { echo " selected='selected'"; } ?>><?php _e( '1280x745 16:9' ); ?></option>
170
  </select>&nbsp;<span class="description"><?php _e( 'Select one of these default sizes to override the above video sizes' ); ?></span></td>
171
  </tr>
172
+
173
+ <tr>
174
+ <th scope="row"><?php _e( 'Dynamically Resize' ); ?></th>
175
+ <td><input type="checkbox" name="youtube_embed_dynamic" value="1"<?php if ( $options[ 'dynamic' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Show full width and resize with the browser' ); ?></span></td>
176
+ </tr>
177
+
178
+ <tr>
179
+ <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Set Maximum Size' ); ?></th>
180
+ <td><input type="checkbox" name="youtube_embed_fixed" value="1"<?php if ( $options[ 'fixed' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Use above width to define maximum size' ); ?></span></td>
181
+ </tr>
182
  </table>
183
 
184
  <table class="form-table">
193
  <td><input type="checkbox" name="youtube_embed_autoplay" value="1"<?php if ( $options[ 'autoplay' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'The video will start playing when the player loads' ); ?></span></td>
194
  </tr>
195
 
 
 
 
 
196
  </table>
197
 
198
  <br/><span class="yt_heading"><?php _e( 'Non-EmbedPlus Options' ); ?></span>
215
  </tr>
216
 
217
  <tr>
218
+ <th scope="row"><?php _e( 'SSL' ); ?></th>
219
+ <td><input type="checkbox" name="youtube_embed_https" value="1"<?php if ( $options[ 'https' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Use SSL? <a href="http://www.google.com/support/youtube/bin/answer.py?answer=171780&expand=UseHTTPS#HTTPS">Read more</a>' ); ?></span></td>
220
  </tr>
221
 
222
  <tr>
293
  <option value="window"<?php if ( $options[ 'wmode' ] == "window" ) { echo " selected='selected'"; } ?>><?php _e( 'Window' ); ?></option>
294
  </select><span class="description"><?php _e( 'Sets the Window Mode property of the Flash movie for transparency, layering, and positioning in the browser. <a href="http://www.communitymx.com/content/article.cfm?cid=e5141">Learn more</a>.' ); ?></span></td>
295
  </tr>
296
+
297
+ <tr>
298
+ <th scope="row"><?php _e( 'Modest Branding' ); ?></th>
299
+ <td><input type="checkbox" name="youtube_embed_modest" value="1"<?php if ( $options[ 'modest' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Reduce branding on video.' ); ?></span></td>
300
+ </tr>
301
  </table>
302
 
303
  <br/><span class="yt_heading"><?php _e( 'EmbedPlus Options' ); ?></span><span class="description" style="float: right"><?php _e( '<a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-embedplus">Learn more about EmbedPlus</a>' ); ?></span>
348
  <input type="submit" name="Video" class="button-secondary" value="<?php _e( 'Change video' ); ?>"/></p>
349
 
350
  <p><?php
351
+ if ( $video_type == "d" ) { $id = 'PwBIAB0D3GY'; $type = ''; }
352
  if ( $video_type == "p" ) { $id = 'YVvn8dpSAt0'; $type = 'm'; }
353
  if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; $type = ''; ; }
354
  if ( $video_type == "l" ) { $id = '095393D5B42B2266'; $type = ''; }
includes/options-widgets.php CHANGED
@@ -1,52 +1,51 @@
1
  <?php
 
2
  // Set default options
3
- $default = array( 'titles' => 'YouTube', 'id' => '', 'type' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'link' => '', 'react' => '', 'stop' => '', 'sweetspot' => '', 'disablekb' => '', 'autohide' => '', 'controls' => '', 'profile' => '0', 'list' => '', 'template' => '', 'hd' => '', 'style' => '' );
 
4
  $instance = wp_parse_args( ( array ) $instance, $default );
5
  $general = ye_set_general_defaults();
6
 
7
- // Title field
 
8
  $field_id = $this -> get_field_id( 'titles' );
9
  $field_name = $this -> get_field_name( 'titles' );
10
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Title' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'titles' ] ).'" /></p>';
 
 
 
 
 
 
11
 
12
  // Video ID field
 
13
  $field_id = $this -> get_field_id( 'id' );
14
  $field_name = $this -> get_field_name( 'id' );
15
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Video URL, ID or List name' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'id' ] ) . '" /></p>';
16
 
17
  // Profile field
 
18
  $field_id = $this -> get_field_id( 'profile' );
19
  $field_name = $this -> get_field_name( 'profile' );
20
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
21
  ye_generate_profile_list( attribute_escape( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
22
  echo '</select></p>';
23
 
24
- // Embed type field
25
- $field_id = $this -> get_field_id( 'type' );
26
- $field_name = $this -> get_field_name( 'type' );
27
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Embed Type' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
28
- if ( attribute_escape( $instance[ 'type' ] ) == '' ) { echo " selected='selected'"; }
29
- echo '>' . __( 'Profile default' ) . '</option><option value="v"';
30
- if ( attribute_escape( $instance[ 'type' ] ) == 'v' ) { echo " selected='selected'"; }
31
- echo '>' . __( 'IFRAME' ) . '</option><option value="p"';
32
- if ( attribute_escape( $instance[ 'type' ] ) == 'p' ) { echo " selected='selected'"; }
33
- echo '>' . __( 'OBJECT' ) . '</option><option value="m"';
34
- if ( attribute_escape( $instance[ 'type' ] ) == 'c' ) { echo " selected='selected'"; }
35
- echo '>' . __( 'Chromeless' ) . '</option><option value="c"';
36
- if ( attribute_escape( $instance[ 'type' ] ) == 'm' ) { echo " selected='selected'"; }
37
- echo '>' . __( 'EmbedPlus' ) . '</option></select></p>';
38
-
39
  // Template
 
40
  $field_id = $this -> get_field_id( 'template' );
41
  $field_name = $this -> get_field_name( 'template' );
42
  echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Template' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'template' ] ) . '" /></p>';
43
 
44
  // Style
 
45
  $field_id = $this -> get_field_id( 'style' );
46
  $field_name = $this -> get_field_name( 'style' );
47
  echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Style' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'style' ] ) . '" /></p>';
48
 
49
  // Size fields
 
50
  $field_id = $this -> get_field_id( 'width' );
51
  $field_name = $this -> get_field_name( 'width' );
52
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Size' ) . ': </label><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'width' ] ) . '" />&nbsp;x&nbsp;';
@@ -57,12 +56,36 @@ echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' .
57
 
58
  echo "<table>\n";
59
 
60
- // Start field
61
- $field_id = $this -> get_field_id( 'start' );
62
- $field_name = $this -> get_field_name( 'start' );
63
- echo "\r\n" . '<tr><td width="100%">' . __( 'Start (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /></td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
 
65
  // Autoplay field
 
66
  $field_id = $this -> get_field_id( 'autoplay' );
67
  $field_name = $this -> get_field_name( 'autoplay' );
68
  echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
@@ -73,29 +96,25 @@ echo '>' . __( 'No' ) . '</option><option value="1"';
73
  if ( attribute_escape( $instance[ 'autoplay' ] ) == '1' ) { echo " selected='selected'"; }
74
  echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
75
 
 
 
 
 
 
 
76
  echo "</table>\n";
77
 
78
  ?>
79
  <h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
80
  <?php
81
 
82
- // Autohide field
83
- $field_id = $this -> get_field_id( 'autohide' );
84
- $field_name = $this -> get_field_name( 'autohide' );
85
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Auto hide' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
86
- if ( attribute_escape( $instance[ 'autohide' ] ) == '' ) { echo " selected='selected'"; }
87
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
88
- if ( attribute_escape( $instance[ 'autohide' ] ) == '0' ) { echo " selected='selected'"; }
89
- echo '>' . __( 'Controls &amp; progress bar visible' ) . '</option><option value="1"';
90
- if ( attribute_escape( $instance[ 'autohide' ] ) == '1' ) { echo " selected='selected'"; }
91
- echo '>' . __( 'Controls &amp; progress bar fade out' ) . '</option><option value="2"';
92
- if ( attribute_escape( $instance[ 'autohide' ] ) == '2' ) { echo " selected='selected'"; }
93
- echo '>' . __( 'Progress bar fades' ) . '</option></select></p>';
94
 
95
  // List field
 
96
  $field_id = $this -> get_field_id( 'list' );
97
  $field_name = $this -> get_field_name( 'list' );
98
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'List Playback' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
99
  if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
100
  echo '>' . __( 'Profile default' ) . '</option><option value="order"';
101
  if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
@@ -103,22 +122,10 @@ echo '>' . __( 'Play each video in order' ) . '</option><option value="random"';
103
  if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
104
  echo '>' . __( 'Play videos randomly' ) . '</option><option value="single"';
105
  if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
106
- echo '>' . __( 'Play one random video' ) . '</option></select></p>';
107
-
108
- echo "<table>\n";
109
-
110
- // Controls field
111
- $field_id = $this -> get_field_id( 'controls' );
112
- $field_name = $this -> get_field_name( 'controls' );
113
- echo "\r\n" . '<tr><td width="100%">' . __( 'Controls' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
114
- if ( attribute_escape( $instance[ 'controls' ] ) == '' ) { echo " selected='selected'"; }
115
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
116
- if ( attribute_escape( $instance[ 'controls' ] ) == '0' ) { echo " selected='selected'"; }
117
- echo '>' . __( 'No' ) . '</option><option value="1"';
118
- if ( attribute_escape( $instance[ 'controls' ] ) == '1' ) { echo " selected='selected'"; }
119
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
120
 
121
  // Loop video field
 
122
  $field_id = $this -> get_field_id( 'loop' );
123
  $field_name = $this -> get_field_name( 'loop' );
124
  echo "\r\n" . '<tr><td width="100%">' . __( 'Loop Video' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
@@ -130,91 +137,6 @@ if ( attribute_escape( $instance[ 'loop' ] ) == '1' ) { echo " selected='selecte
130
  echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
131
 
132
  echo "</table>\n";
133
- ?>
134
- <h4><?php _e( 'Non-EmbedPlus &amp; HTML5 Options' ); ?></h4>
135
- <?php
136
-
137
- echo "<table>\n";
138
-
139
- // Annotation field
140
- $field_id = $this -> get_field_id( 'annotation' );
141
- $field_name = $this -> get_field_name( 'annotation' );
142
- echo "\r\n" . '<tr><td width="100%">' . __( 'Annotations' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
143
- if ( attribute_escape( $instance[ 'annotation' ] ) == '' ) { echo " selected='selected'"; }
144
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
145
- if ( attribute_escape( $instance[ 'annotation' ] ) == '0' ) { echo " selected='selected'"; }
146
- echo '>' . __( 'No' ) . '</option><option value="1"';
147
- if ( attribute_escape( $instance[ 'annotation' ] ) == '1' ) { echo " selected='selected'"; }
148
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
149
-
150
- // Closed Caption field
151
- $field_id = $this -> get_field_id( 'cc' );
152
- $field_name = $this -> get_field_name( 'cc' );
153
- echo "\r\n" . '<tr><td width="100%">' . __( 'Closed Captions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
154
- if ( attribute_escape( $instance[ 'cc' ] ) == '' ) { echo " selected='selected'"; }
155
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
156
- if ( attribute_escape( $instance[ 'cc' ] ) == '0' ) { echo " selected='selected'"; }
157
- echo '>' . __( 'No' ) . '</option><option value="1"';
158
- if ( attribute_escape( $instance[ 'cc' ] ) == '1' ) { echo " selected='selected'"; }
159
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
160
-
161
- // Disable keyboard field
162
- $field_id = $this -> get_field_id( 'disablekb' );
163
- $field_name = $this -> get_field_name( 'disablekb' );
164
- echo "\r\n" . '<tr><td width="100%">' . __( 'Disable Keyboard' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
165
- if ( attribute_escape( $instance[ 'disablekb' ] ) == '' ) { echo " selected='selected'"; }
166
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
167
- if ( attribute_escape( $instance[ 'disablekb' ] ) == '0' ) { echo " selected='selected'"; }
168
- echo '>' . __( 'No' ) . '</option><option value="1"';
169
- if ( attribute_escape( $instance[ 'disablekb' ] ) == '1' ) { echo " selected='selected'"; }
170
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
171
-
172
- // Fullscreen field
173
- $field_id = $this -> get_field_id( 'fullscreen' );
174
- $field_name = $this -> get_field_name( 'fullscreen' );
175
- echo "\r\n" . '<tr><td width="100%">' . __( 'Fullscreen' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
176
- if ( attribute_escape( $instance[ 'fullscreen' ] ) == '' ) { echo " selected='selected'"; }
177
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
178
- if ( attribute_escape( $instance[ 'fullscreen' ] ) == '0' ) { echo " selected='selected'"; }
179
- echo '>' . __( 'No' ) . '</option><option value="1"';
180
- if ( attribute_escape( $instance[ 'fullscreen' ] ) == '1' ) { echo " selected='selected'"; }
181
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
182
-
183
- // Information field
184
- $field_id = $this -> get_field_id( 'info' );
185
- $field_name = $this -> get_field_name( 'info' );
186
- echo "\r\n" . '<tr><td width="100%">' . __( 'Information' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
187
- if ( attribute_escape( $instance[ 'info' ] ) == '' ) { echo " selected='selected'"; }
188
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
189
- if ( attribute_escape( $instance[ 'info' ] ) == '0' ) { echo " selected='selected'"; }
190
- echo '>' . __( 'No' ) . '</option><option value="1"';
191
- if ( attribute_escape( $instance[ 'info' ] ) == '1' ) { echo " selected='selected'"; }
192
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
193
-
194
- // YouTube Link field
195
- $field_id = $this -> get_field_id( 'link' );
196
- $field_name = $this -> get_field_name( 'link' );
197
- echo "\r\n" . '<tr><td width="100%">' . __( 'Link to YouTube' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
198
- if ( attribute_escape( $instance[ 'link' ] ) == '' ) { echo " selected='selected'"; }
199
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
200
- if ( attribute_escape( $instance[ 'link' ] ) == '0' ) { echo " selected='selected'"; }
201
- echo '>' . __( 'No' ) . '</option><option value="1"';
202
- if ( attribute_escape( $instance[ 'link' ] ) == '1' ) { echo " selected='selected'"; }
203
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
204
-
205
- // Related videos field
206
- $field_id = $this -> get_field_id( 'related' );
207
- $field_name = $this -> get_field_name( 'related' );
208
- echo "\r\n" . '<tr><td width="100%">' . __( 'Related Videos' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
209
- if ( attribute_escape( $instance[ 'related' ] ) == '' ) { echo " selected='selected'"; }
210
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
211
- if ( attribute_escape( $instance[ 'related' ] ) == '0' ) { echo " selected='selected'"; }
212
- echo '>' . __( 'No' ) . '</option><option value="1"';
213
- if ( attribute_escape( $instance[ 'related' ] ) == '1' ) { echo " selected='selected'"; }
214
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
215
-
216
- echo "</table>\n";
217
-
218
  ?>
219
  <h4><?php _e('EmbedPlus Options'); ?></h4>
220
  <?php
@@ -222,42 +144,10 @@ echo "</table>\n";
222
  echo "<table>\n";
223
 
224
  // Stop field
 
225
  $field_id = $this -> get_field_id( 'stop' );
226
  $field_name = $this -> get_field_name( 'stop' );
227
  echo "\r\n" . '<tr><td width="100%">' . __( 'Stop (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'stop' ] ) . '" /></td></tr>';
228
 
229
- // HD field
230
- $field_id = $this -> get_field_id( 'hd' );
231
- $field_name = $this -> get_field_name( 'hd' );
232
- echo "\r\n" . '<tr><td width="100%">' . __( 'Play HD' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
233
- if ( attribute_escape( $instance[ 'hd' ] ) == '' ) { echo " selected='selected'"; }
234
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
235
- if ( attribute_escape( $instance[ 'hd' ] ) == '0' ) { echo " selected='selected'"; }
236
- echo '>' . __( 'No' ) . '</option><option value="1"';
237
- if ( attribute_escape( $instance[ 'hd' ] ) == '1' ) { echo " selected='selected'"; }
238
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
239
-
240
- // Reactions field
241
- $field_id = $this -> get_field_id( 'react' );
242
- $field_name = $this -> get_field_name( 'react' );
243
- echo "\r\n" . '<tr><td width="100%">' . __( 'Real-time Reactions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
244
- if ( attribute_escape( $instance[ 'react' ] ) == '' ) { echo " selected='selected'"; }
245
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
246
- if ( attribute_escape( $instance[ 'react' ] ) == '0' ) { echo " selected='selected'"; }
247
- echo '>' . __( 'No' ) . '</option><option value="1"';
248
- if ( attribute_escape( $instance[ 'react' ] ) == '1' ) { echo " selected='selected'"; }
249
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
250
-
251
- // Sweetspot field
252
- $field_id = $this -> get_field_id( 'sweetspot' );
253
- $field_name = $this -> get_field_name( 'sweetspot' );
254
- echo "\r\n" . '<tr><td width="100%">' . __( 'Sweet Spots' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
255
- if ( attribute_escape( $instance[ 'sweetspot' ] ) == '' ) { echo " selected='selected'"; }
256
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
257
- if ( attribute_escape( $instance[ 'sweetspot' ] ) == '0' ) { echo " selected='selected'"; }
258
- echo '>' . __( 'No' ) . '</option><option value="1"';
259
- if ( attribute_escape( $instance[ 'sweetspot' ] ) == '1' ) { echo " selected='selected'"; }
260
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
261
-
262
  echo "</table>\n";
263
  ?>
1
  <?php
2
+
3
  // Set default options
4
+
5
+ $default = array( 'titles' => 'YouTube', 'video_title' => '', 'id' => '', 'profile' => '', 'type' => '', 'template' => '', 'style' => '', 'start' => '', 'autoplay' => '', 'width' => '', 'height' => '', 'dynamic' => '', 'list' => '', 'loop' => '', 'stop' => '' );
6
  $instance = wp_parse_args( ( array ) $instance, $default );
7
  $general = ye_set_general_defaults();
8
 
9
+ // Widget Title field
10
+
11
  $field_id = $this -> get_field_id( 'titles' );
12
  $field_name = $this -> get_field_name( 'titles' );
13
+ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Widget Title' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'titles' ] ).'" /></p>';
14
+
15
+ // Video Title field
16
+
17
+ $field_id = $this -> get_field_id( 'video_title' );
18
+ $field_name = $this -> get_field_name( 'video_title' );
19
+ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Video Title' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'video_title' ] ).'" /></p>';
20
 
21
  // Video ID field
22
+
23
  $field_id = $this -> get_field_id( 'id' );
24
  $field_name = $this -> get_field_name( 'id' );
25
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Video URL, ID or List name' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'id' ] ) . '" /></p>';
26
 
27
  // Profile field
28
+
29
  $field_id = $this -> get_field_id( 'profile' );
30
  $field_name = $this -> get_field_name( 'profile' );
31
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
32
  ye_generate_profile_list( attribute_escape( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
33
  echo '</select></p>';
34
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  // Template
36
+
37
  $field_id = $this -> get_field_id( 'template' );
38
  $field_name = $this -> get_field_name( 'template' );
39
  echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Template' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'template' ] ) . '" /></p>';
40
 
41
  // Style
42
+
43
  $field_id = $this -> get_field_id( 'style' );
44
  $field_name = $this -> get_field_name( 'style' );
45
  echo "\r\n" . '<p><label for="' . $field_id . '">'.__( 'Style' ).': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'style' ] ) . '" /></p>';
46
 
47
  // Size fields
48
+
49
  $field_id = $this -> get_field_id( 'width' );
50
  $field_name = $this -> get_field_name( 'width' );
51
  echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Size' ) . ': </label><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'width' ] ) . '" />&nbsp;x&nbsp;';
56
 
57
  echo "<table>\n";
58
 
59
+ // Dynamic Resize
60
+
61
+ $field_id = $this -> get_field_id( 'dynamic' );
62
+ $field_name = $this -> get_field_name( 'dynamic' );
63
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Dynamically Resize' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
64
+ if ( attribute_escape( $instance[ 'dynamic' ] ) == '' ) { echo " selected='selected'"; }
65
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
66
+ if ( attribute_escape( $instance[ 'dynamic' ] ) == '0' ) { echo " selected='selected'"; }
67
+ echo '>' . __( 'No' ) . '</option><option value="1"';
68
+ if ( attribute_escape( $instance[ 'dynamic' ] ) == '1' ) { echo " selected='selected'"; }
69
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
70
+
71
+ // Embed type field
72
+
73
+ $field_id = $this -> get_field_id( 'type' );
74
+ $field_name = $this -> get_field_name( 'type' );
75
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Embed Type' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
76
+ if ( attribute_escape( $instance[ 'type' ] ) == '' ) { echo " selected='selected'"; }
77
+ echo '>' . __( 'Profile default' ) . '</option><option value="v"';
78
+ if ( attribute_escape( $instance[ 'type' ] ) == 'v' ) { echo " selected='selected'"; }
79
+ echo '>' . __( 'IFRAME' ) . '</option><option value="p"';
80
+ if ( attribute_escape( $instance[ 'type' ] ) == 'p' ) { echo " selected='selected'"; }
81
+ echo '>' . __( 'OBJECT' ) . '</option><option value="m"';
82
+ if ( attribute_escape( $instance[ 'type' ] ) == 'c' ) { echo " selected='selected'"; }
83
+ echo '>' . __( 'Chromeless' ) . '</option><option value="c"';
84
+ if ( attribute_escape( $instance[ 'type' ] ) == 'm' ) { echo " selected='selected'"; }
85
+ echo '>' . __( 'EmbedPlus' ) . '</option></select></td></tr>';
86
 
87
  // Autoplay field
88
+
89
  $field_id = $this -> get_field_id( 'autoplay' );
90
  $field_name = $this -> get_field_name( 'autoplay' );
91
  echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
96
  if ( attribute_escape( $instance[ 'autoplay' ] ) == '1' ) { echo " selected='selected'"; }
97
  echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
98
 
99
+ // Start field
100
+
101
+ $field_id = $this -> get_field_id( 'start' );
102
+ $field_name = $this -> get_field_name( 'start' );
103
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Start (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'start' ] ) . '" /></td></tr>';
104
+
105
  echo "</table>\n";
106
 
107
  ?>
108
  <h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
109
  <?php
110
 
111
+ echo "<table>\n";
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  // List field
114
+
115
  $field_id = $this -> get_field_id( 'list' );
116
  $field_name = $this -> get_field_name( 'list' );
117
+ echo "\r\n" . '<tr><td width="100%">' . __( 'List Playback' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
118
  if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
119
  echo '>' . __( 'Profile default' ) . '</option><option value="order"';
120
  if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
122
  if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
123
  echo '>' . __( 'Play videos randomly' ) . '</option><option value="single"';
124
  if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
125
+ echo '>' . __( 'Play one random video' ) . '</option></select></td></tr>';
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  // Loop video field
128
+
129
  $field_id = $this -> get_field_id( 'loop' );
130
  $field_name = $this -> get_field_name( 'loop' );
131
  echo "\r\n" . '<tr><td width="100%">' . __( 'Loop Video' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
137
  echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
138
 
139
  echo "</table>\n";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  ?>
141
  <h4><?php _e('EmbedPlus Options'); ?></h4>
142
  <?php
144
  echo "<table>\n";
145
 
146
  // Stop field
147
+
148
  $field_id = $this -> get_field_id( 'stop' );
149
  $field_name = $this -> get_field_name( 'stop' );
150
  echo "\r\n" . '<tr><td width="100%">' . __( 'Stop (seconds)' ) . '</td><td><input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'stop' ] ) . '" /></td></tr>';
151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  echo "</table>\n";
153
  ?>
includes/set-option-defaults.php CHANGED
@@ -75,7 +75,7 @@ function ye_set_general_defaults() {
75
  $changed = true;
76
  } else {
77
  // If array doesn't exist, set defaults
78
- $options = array( 'editor_button' => 1, 'admin_bar' => 1, 'profile_no' => 5, 'list_no' => 5, 'info_cache' => 1, 'embed_cache' => 24, 'transcript_cache' => 24, 'alt_profile' => 0, 'alt_profile2' => 0, 'bracket' => '', 'alt' => 0, 'url_profile' => 0, 'other_profile' => 0, 'comments' => '', 'comments_profile' => 0, 'metadata' => 1, 'feed' => 'b', 'api' => 1, 'error_message' => $default_error, 'thumbnail' => 2 );
79
  $changed = true;
80
  }
81
  }
@@ -133,14 +133,13 @@ function ye_set_profile_defaults( $profile ) {
133
  $changed = false;
134
  $new_user = false;
135
 
136
-
137
  // Work out default dimensions
138
  if ( isset( $GLOBALS[ 'content_width' ] ) ) {
139
  $width = $GLOBALS[ 'content_width' ];
140
  } else {
141
  $width = 560;
142
  }
143
- $height = round( ( $width / 16 ) * 9, 0 );
144
 
145
  if ( !is_array( $options ) ) {
146
  if ( ( $profile == 0 ) && ( get_option( 'youtube_embed' ) ) ) {
@@ -151,7 +150,7 @@ function ye_set_profile_defaults( $profile ) {
151
  $changed = true;
152
  } else {
153
  // If array doesn't exist, set defaults
154
- $options = array( 'width' => $width, 'height' => $height, 'fullscreen' => '', 'template' => '%video%', 'autoplay' => '', 'start' => '0', 'loop' => '', 'cc' => '', 'annotation' => '1', 'related' => '', 'info' => '1', 'link' => '1', 'react' => '1', 'stop' => '0', 'sweetspot' => '1', 'type' => 'v', 'disablekb' => '', 'autohide' => '2', 'controls' => '1', 'playlist' => 'v', 'fallback' => 'v', 'wmode' => 'opaque', 'shadow' => '0', 'audio' => '', 'hd' => '1', 'style' => '', 'color' => 'red', 'theme' => 'dark', 'https' => '0' );
155
  $changed = true;
156
  }
157
  }
@@ -178,11 +177,11 @@ function ye_set_profile_defaults( $profile ) {
178
  if ( !array_key_exists( 'playlist', $options ) ) { $options[ 'playlist' ] = 'v'; $changed = true; }
179
  if ( !array_key_exists( 'fallback', $options ) ) { $options[ 'fallback' ] = 'v'; $changed = true; }
180
  if ( !array_key_exists( 'wmode', $options ) ) { $options[ 'wmode' ] = 'opaque'; $changed = true; }
181
- if ( !array_key_exists( 'shadow', $options ) ) { $options[ 'shadow' ] = '0'; $changed = true; }
182
  if ( !array_key_exists( 'template', $options ) ) { $options[ 'template' ] = '%video%'; $changed = true; }
183
  if ( !array_key_exists( 'hd', $options ) ) { $options[ 'hd' ] = '1'; $changed = true; }
184
  if ( !array_key_exists( 'color', $options ) ) { $options[ 'color' ] = 'red'; $changed = true; }
185
  if ( !array_key_exists( 'theme', $options ) ) { $options[ 'theme' ] = 'dark'; $changed = true; }
 
186
 
187
  // Update the options, if changed, and return the result
188
  if ( $changed ) { update_option( 'youtube_embed_profile' . $profile, $options ); }
75
  $changed = true;
76
  } else {
77
  // If array doesn't exist, set defaults
78
+ $options = array( 'editor_button' => 1, 'admin_bar' => 1, 'profile_no' => 5, 'list_no' => 5, 'info_cache' => 1, 'embed_cache' => 24, 'transcript_cache' => 24, 'alt_profile' => 0, 'alt_profile2' => 0, 'bracket' => '', 'alt' => 0, 'url_profile' => 0, 'other_profile' => 0, 'comments' => '', 'comments_profile' => 0, 'metadata' => 1, 'feed' => 'b', 'api' => 1, 'error_message' => $default_error, 'thumbnail' => 2, 'privacy' => 0 );
79
  $changed = true;
80
  }
81
  }
133
  $changed = false;
134
  $new_user = false;
135
 
 
136
  // Work out default dimensions
137
  if ( isset( $GLOBALS[ 'content_width' ] ) ) {
138
  $width = $GLOBALS[ 'content_width' ];
139
  } else {
140
  $width = 560;
141
  }
142
+ $height = 27 + round( ( $width / 16 ) * 9, 0 );
143
 
144
  if ( !is_array( $options ) ) {
145
  if ( ( $profile == 0 ) && ( get_option( 'youtube_embed' ) ) ) {
150
  $changed = true;
151
  } else {
152
  // If array doesn't exist, set defaults
153
+ $options = array( 'width' => $width, 'height' => $height, 'fullscreen' => '', 'template' => '%video%', 'autoplay' => '', 'start' => '0', 'loop' => '', 'cc' => '', 'annotation' => '1', 'related' => '', 'info' => '1', 'link' => '1', 'react' => '1', 'stop' => '0', 'sweetspot' => '1', 'type' => 'v', 'disablekb' => '', 'autohide' => '2', 'controls' => '1', 'playlist' => 'v', 'fallback' => 'v', 'wmode' => 'opaque', 'audio' => '', 'hd' => '1', 'style' => '', 'color' => 'red', 'theme' => 'dark', 'https' => '0', 'modest' => '1', 'dynamic' => '', 'fixed' => '' );
154
  $changed = true;
155
  }
156
  }
177
  if ( !array_key_exists( 'playlist', $options ) ) { $options[ 'playlist' ] = 'v'; $changed = true; }
178
  if ( !array_key_exists( 'fallback', $options ) ) { $options[ 'fallback' ] = 'v'; $changed = true; }
179
  if ( !array_key_exists( 'wmode', $options ) ) { $options[ 'wmode' ] = 'opaque'; $changed = true; }
 
180
  if ( !array_key_exists( 'template', $options ) ) { $options[ 'template' ] = '%video%'; $changed = true; }
181
  if ( !array_key_exists( 'hd', $options ) ) { $options[ 'hd' ] = '1'; $changed = true; }
182
  if ( !array_key_exists( 'color', $options ) ) { $options[ 'color' ] = 'red'; $changed = true; }
183
  if ( !array_key_exists( 'theme', $options ) ) { $options[ 'theme' ] = 'dark'; $changed = true; }
184
+ if ( !array_key_exists( 'modest', $options ) ) { $options[ 'modest' ] = 1; $changed = true; }
185
 
186
  // Update the options, if changed, and return the result
187
  if ( $changed ) { update_option( 'youtube_embed_profile' . $profile, $options ); }
includes/shared.php CHANGED
@@ -123,7 +123,7 @@ function ye_validate_id( $id, $title_needed = false ) {
123
  $options = ye_set_general_defaults();
124
 
125
  // Attempt to get the video type and title from cache
126
- if ( $general[ 'info_cache' ] != 0 ) {
127
  $type = get_transient( 'ye_type_' . $id );
128
  $title = get_transient( 'ye_title_' . $id );
129
  }
123
  $options = ye_set_general_defaults();
124
 
125
  // Attempt to get the video type and title from cache
126
+ if ( $options[ 'info_cache' ] != 0 ) {
127
  $type = get_transient( 'ye_type_' . $id );
128
  $title = get_transient( 'ye_title_' . $id );
129
  }
includes/shortcodes.php CHANGED
@@ -85,7 +85,7 @@ if ( $shortcode[ 2 ] != '' ) { add_shortcode( $shortcode[ 2 ], 'ye_video_shortco
85
 
86
  function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_shortcode = '' ) {
87
 
88
- extract( shortcode_atts( array( 'type' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'link' => '', 'react' => '', 'stop' => '', 'sweetspot' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'embedplus' => '', 'audio' => '', 'id' => '', 'url' => '', 'rel' => '', 'fs' => '', 'cc_load_policy' => '', 'iv_load_policy' => '', 'showinfo' => '', 'youtubeurl' => '', 'template' => '', 'list' => '', 'hd' => '', 'color' => '', 'theme' => '', 'https' => '', 'height' => '', 'width' => '' ), $paras ) );
89
 
90
  // If no profile specified and an alternative shortcode used, get that shortcodes default profile
91
  if ( ( $profile == '' ) && ( $alt_shortcode != '' ) ) {
@@ -125,7 +125,7 @@ function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_sh
125
  $autohide = ye_set_autohide( $autohide );
126
 
127
  // Create YouTube code
128
- $youtube_code = ye_generate_youtube_code( $content, $type, $width, $height, ye_convert( $fullscreen ), ye_convert( $related ), ye_convert( $autoplay ), ye_convert( $loop ), $start, ye_convert( $info ), ye_convert_3( $annotation ), ye_convert( $cc ), $style, ye_convert( $link ), ye_convert( $react ), $stop, ye_convert( $sweetspot ), ye_convert( $disablekb ), $ratio, $autohide, ye_convert( $controls ), $profile, $list, ye_convert( $audio ), $template, ye_convert( $hd ), $color, $theme, ye_convert( $https ) );
129
 
130
  return $youtube_code;
131
  }
85
 
86
  function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_shortcode = '' ) {
87
 
88
+ extract( shortcode_atts( array( 'type' => '', 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'link' => '', 'react' => '', 'stop' => '', 'sweetspot' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'embedplus' => '', 'audio' => '', 'id' => '', 'url' => '', 'rel' => '', 'fs' => '', 'cc_load_policy' => '', 'iv_load_policy' => '', 'showinfo' => '', 'youtubeurl' => '', 'template' => '', 'list' => '', 'hd' => '', 'color' => '', 'theme' => '', 'ssl' => '', 'height' => '', 'width' => '', 'title' => '', 'dynamic' => '', 'h' => '', 'w' => '' ), $paras ) );
89
 
90
  // If no profile specified and an alternative shortcode used, get that shortcodes default profile
91
  if ( ( $profile == '' ) && ( $alt_shortcode != '' ) ) {
125
  $autohide = ye_set_autohide( $autohide );
126
 
127
  // Create YouTube code
128
+ $youtube_code = ye_generate_youtube_code( $content, $type, $width, $height, ye_convert( $fullscreen ), ye_convert( $related ), ye_convert( $autoplay ), ye_convert( $loop ), $start, ye_convert( $info ), ye_convert_3( $annotation ), ye_convert( $cc ), $style, ye_convert( $link ), ye_convert( $react ), $stop, ye_convert( $sweetspot ), ye_convert( $disablekb ), $ratio, $autohide, ye_convert( $controls ), $profile, $list, ye_convert( $audio ), $template, ye_convert( $hd ), $color, $theme, ye_convert( $ssl ), $title, ye_convert( $dynamic ) );
129
 
130
  return $youtube_code;
131
  }
includes/widgets.php CHANGED
@@ -7,155 +7,147 @@
7
  * @package YouTubeEmbed
8
  */
9
 
10
- global $wp_version;
11
- if ( ( float ) $wp_version >= 2.8 ) {
12
-
13
- class YouTubeEmbedWidget extends WP_Widget {
14
-
15
- /**
16
- * Widget Constructor
17
- *
18
- * Call WP_Widget class to define widget
19
- *
20
- * @since 2.0
21
- *
22
- * @uses WP_Widget Standard WP_Widget class
23
- */
24
-
25
- function YouTubeEmbedWidget() {
26
- parent::WP_Widget( 'youtube_embed_widget',
27
- 'YouTube Embed',
28
- array( 'description' => 'Embed YouTube Widget.', 'class' => 'my-widget-class' )
29
- );
30
- }
31
-
32
- /**
33
- * Display widget
34
- *
35
- * Display the YouTube widget
36
- *
37
- * @since 2.0
38
- *
39
- * @uses generate_youtube_code Generate the required YouTube code
40
- *
41
- * @param string $args Arguments
42
- * @param string $instance Instance
43
- */
44
-
45
- function widget( $args, $instance ) {
46
- extract( $args, EXTR_SKIP );
47
-
48
- // Output the header
49
- echo $before_widget;
50
-
51
- // Extract title for heading
52
- $title = $instance[ 'titles' ];
53
-
54
- // Output title, if one exists
55
- if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
56
-
57
- // Generate the video and output it
58
- echo ye_generate_youtube_code ( $instance[ 'id' ],
59
- $instance[ 'type' ],
60
- $instance[ 'width' ],
61
- $instance[ 'height' ],
62
- $instance[ 'fullscreen' ],
63
- $instance[ 'related' ],
64
- $instance[ 'autoplay' ],
65
- $instance[ 'loop' ],
66
- $instance[ 'start' ],
67
- $instance[ 'info' ],
68
- $instance[ 'annotation' ],
69
- $instance[ 'cc' ],
70
- $instance[ 'style' ],
71
- $instance[ 'link' ],
72
- $instance[ 'react' ],
73
- $instance[ 'stop' ],
74
- $instance[ 'sweetspot' ],
75
- $instance[ 'disablekb' ],
76
- '',
77
- $instance[ 'autohide' ],
78
- $instance[ 'controls' ],
79
- $instance[ 'profile' ],
80
- $instance[ 'list' ],
81
- '',
82
- $instance[ 'template' ],
83
- $instance[ 'hd' ] );
84
-
85
- // Output the trailer
86
- echo $after_widget;
87
- }
88
-
89
- /**
90
- * Widget update/save function
91
- *
92
- * Update and save widget
93
- *
94
- * @since 2.0
95
- *
96
- * @param string $new_instance New instance
97
- * @param string $old_instance Old instance
98
- * @return string Instance
99
- */
100
-
101
- function update( $new_instance, $old_instance ) {
102
-
103
- $instance = $old_instance;
104
- $instance[ 'titles' ] = strip_tags( $new_instance[ 'titles' ] );
105
- $instance[ 'id' ] = $new_instance[ 'id' ];
106
- $instance[ 'type' ] = $new_instance[ 'type' ];
107
- $instance[ 'width' ] = $new_instance[ 'width' ];
108
- $instance[ 'height' ] = $new_instance[ 'height' ];
109
- $instance[ 'fullscreen' ] = $new_instance[ 'fullscreen' ];
110
- $instance[ 'related' ] = $new_instance[ 'related' ];
111
- $instance[ 'autoplay' ] = $new_instance[ 'autoplay' ];
112
- $instance[ 'loop' ] = $new_instance[ 'loop' ];
113
- $instance[ 'start' ] = $new_instance[ 'start' ];
114
- $instance[ 'info' ] = $new_instance[ 'info' ];
115
- $instance[ 'annotation' ] = $new_instance[ 'annotation' ];
116
- $instance[ 'cc' ] = $new_instance[ 'cc' ];
117
- $instance[ 'style' ] = $new_instance[ 'style' ];
118
- $instance[ 'link' ] = $new_instance[ 'link' ];
119
- $instance[ 'react' ] = $new_instance[ 'react' ];
120
- $instance[ 'stop' ] = $new_instance[ 'stop' ];
121
- $instance[ 'sweetspot' ] = $new_instance[ 'sweetspot' ];
122
- $instance[ 'disablekb' ] = $new_instance[ 'disablekb' ];
123
- $instance[ 'autohide' ] = $new_instance[ 'autohide' ];
124
- $instance[ 'controls' ] = $new_instance[ 'controls' ];
125
- $instance[ 'profile' ] = $new_instance[ 'profile' ];
126
- $instance[ 'list' ] = $new_instance[ 'list' ];
127
- $instance[ 'template' ] = $new_instance[ 'template' ];
128
- $instance[ 'hd' ] = $new_instance[ 'hd' ];
129
-
130
- return $instance;
131
- }
132
-
133
- /**
134
- * Widget Admin control form
135
- *
136
- * Define admin file
137
- *
138
- * @since 2.0
139
- *
140
- * @param string $instance Instance
141
- */
142
-
143
- function form( $instance ) {
144
- include ( WP_PLUGIN_DIR . '/youtube-embed/includes/options-widgets.php' );
145
- }
146
- }
147
-
148
- /**
149
- * Register Widget
150
- *
151
- * Register widget when loading the WP core
152
- *
153
- * @since 2.0
154
- */
155
-
156
- function youtube_embed_register_widgets() {
157
- register_widget( 'YouTubeEmbedWidget' );
158
- }
159
- add_action( 'widgets_init', 'youtube_embed_register_widgets' );
160
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  ?>
7
  * @package YouTubeEmbed
8
  */
9
 
10
+ class YouTubeEmbedWidget extends WP_Widget {
11
+
12
+ /**
13
+ * Widget Constructor
14
+ *
15
+ * Call WP_Widget class to define widget
16
+ *
17
+ * @since 2.0
18
+ *
19
+ * @uses WP_Widget Standard WP_Widget class
20
+ */
21
+
22
+ function YouTubeEmbedWidget() {
23
+ parent::WP_Widget( 'youtube_embed_widget',
24
+ 'YouTube Embed',
25
+ array( 'description' => 'Embed YouTube Widget.', 'class' => 'my-widget-class' )
26
+ );
27
+ }
28
+
29
+ /**
30
+ * Display widget
31
+ *
32
+ * Display the YouTube widget
33
+ *
34
+ * @since 2.0
35
+ *
36
+ * @uses generate_youtube_code Generate the required YouTube code
37
+ *
38
+ * @param string $args Arguments
39
+ * @param string $instance Instance
40
+ */
41
+
42
+ function widget( $args, $instance ) {
43
+ extract( $args, EXTR_SKIP );
44
+
45
+ // Output the header
46
+ echo $before_widget;
47
+
48
+ // Extract title for heading
49
+ $title = $instance[ 'titles' ];
50
+
51
+ // Output title, if one exists
52
+ if ( !empty( $title ) ) { echo $before_title . $title . $after_title; }
53
+
54
+ // Generate the video and output it
55
+ echo ye_generate_youtube_code ( $instance[ 'id' ],
56
+ $instance[ 'type' ],
57
+ $instance[ 'width' ],
58
+ $instance[ 'height' ],
59
+ '',
60
+ '',
61
+ $instance[ 'autoplay' ],
62
+ $instance[ 'loop' ],
63
+ $instance[ 'start' ],
64
+ '',
65
+ '',
66
+ '',
67
+ $instance[ 'style' ],
68
+ '',
69
+ '',
70
+ $instance[ 'stop' ],
71
+ '',
72
+ '',
73
+ '',
74
+ '',
75
+ '',
76
+ $instance[ 'profile' ],
77
+ $instance[ 'list' ],
78
+ '',
79
+ $instance[ 'template' ],
80
+ '',
81
+ '',
82
+ '',
83
+ '',
84
+ '',
85
+ $instance[ 'video_title' ],
86
+ $instance[ 'dynamic' ]);
87
+
88
+ // Output the trailer
89
+ echo $after_widget;
90
+ }
91
+
92
+ /**
93
+ * Widget update/save function
94
+ *
95
+ * Update and save widget
96
+ *
97
+ * @since 2.0
98
+ *
99
+ * @param string $new_instance New instance
100
+ * @param string $old_instance Old instance
101
+ * @return string Instance
102
+ */
103
+
104
+ function update( $new_instance, $old_instance ) {
105
+
106
+ $instance = $old_instance;
107
+ $instance[ 'titles' ] = strip_tags( $new_instance[ 'titles' ] );
108
+ $instance[ 'video_title' ] = strip_tags( $new_instance[ 'video_title' ] );#
109
+ $instance[ 'id' ] = $new_instance[ 'id' ];
110
+ $instance[ 'profile' ] = $new_instance[ 'profile' ];
111
+ $instance[ 'type' ] = $new_instance[ 'type' ];
112
+ $instance[ 'template' ] = $new_instance[ 'template' ];
113
+ $instance[ 'style' ] = $new_instance[ 'style' ];
114
+ $instance[ 'start' ] = $new_instance[ 'start' ];
115
+ $instance[ 'autoplay' ] = $new_instance[ 'autoplay' ];
116
+ $instance[ 'width' ] = $new_instance[ 'width' ];
117
+ $instance[ 'height' ] = $new_instance[ 'height' ];
118
+ $instance[ 'dynamic' ] = $new_instance[ 'dynamic' ];
119
+ $instance[ 'list' ] = $new_instance[ 'list' ];
120
+ $instance[ 'loop' ] = $new_instance[ 'loop' ];
121
+ $instance[ 'stop' ] = $new_instance[ 'stop' ];
122
+
123
+ return $instance;
124
+ }
125
+
126
+ /**
127
+ * Widget Admin control form
128
+ *
129
+ * Define admin file
130
+ *
131
+ * @since 2.0
132
+ *
133
+ * @param string $instance Instance
134
+ */
135
+
136
+ function form( $instance ) {
137
+ include ( WP_PLUGIN_DIR . '/youtube-embed/includes/options-widgets.php' );
138
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  }
140
+
141
+ /**
142
+ * Register Widget
143
+ *
144
+ * Register widget when loading the WP core
145
+ *
146
+ * @since 2.0
147
+ */
148
+
149
+ function youtube_embed_register_widgets() {
150
+ register_widget( 'YouTubeEmbedWidget' );
151
+ }
152
+ add_action( 'widgets_init', 'youtube_embed_register_widgets' );
153
  ?>
js/ye-gatracker UNCOMPRESSED.js ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ function recordOutboundLink(category, action, label) {
2
+ _gaq.push(['_trackEvent', category, action, label]);
3
+ }
js/ye-gatracker.js ADDED
@@ -0,0 +1 @@
 
1
+ function recordOutboundLink(category,action,label){_gaq.push(['_trackEvent',category,action,label])}
js/{mcebutton UNCOMPRESSED.js → ye-mcebutton UNCOMPRESSED.js} RENAMED
File without changes
js/{mcebutton.js → ye-mcebutton.js} RENAMED
File without changes
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Artiss YouTube Embed ===
2
  Contributors: dartiss
3
  Donate link: http://artiss.co.uk/donate
4
- Tags: admin, annotations, artiss, automatic, editor, embed, embedding, embedplus, flash, flv, google, hd, height, iframe, manage, media, plugin, page, play, playlist, post, profile, sidebar, simple, smart, url, valid, video, widget, width, xhtml, youtube, youtuber
5
  Requires at least: 2.9
6
- Tested up to: 3.2.1
7
- Stable tag: 2.3.1
8
 
9
  A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
10
 
@@ -14,6 +14,7 @@ Artiss YouTube Embed (formally YouTube Embed) is an incredibly simple, yet power
14
 
15
  * XHTML and HTML5 compliant - works with all the latest browsers
16
  * Multiple embedding methods available - OBJECT, IFRAME, CHROMELESS and EmbedPlus
 
17
  * Allow users to add videos to comments
18
  * Build your own playlists and play them back however you want
19
  * Create multiple profiles - use them for different videos to get the exact style that you want
@@ -48,13 +49,16 @@ The following parameters work with all embed types:
48
 
49
  * **audio** - yes or no, this will hide the video and display just the toolbar (ideal for audio only playback) if switched on
50
  * **autoplay** - yes or no, should the video automatically start playing?
 
51
  * **height** - the video height, in pixels
52
  * **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)
53
  * **profile** - specify a different default profile (see section on Profiles for further details)
54
  * **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
 
55
  * **start** - a number of seconds from where to start the video playing
56
  * **style** - apply CSS elements directly to the video output
57
  * **template** - specify a template (see section on Templates for further details)
 
58
  * **type** - which embedding type to use, this can be `embedplus`, `iframe`, `object` or `chromeless`
59
  * **width** - the video width, in pixels
60
 
@@ -127,7 +131,7 @@ The template consists simply of any HTML that you wish but with `%video%` where
127
 
128
  e.g. `<div align="center">%video%</div>`
129
 
130
- Be wary that when adding template via a parameter that any HTML included may cause your video to have <pre> tags wrapped around it. The easiest way to check and fix this is to view any post in the HTML editor and remove any <pre> tags that have been added.
131
 
132
  == Profiles ==
133
 
@@ -284,7 +288,7 @@ All of my plugins are supported via [my website](http://www.artiss.co.uk "Artiss
284
 
285
  Please feel free to visit the site for plugin updates and development news - either visit the site regularly or [follow me on Twitter](http://www.twitter.com/artiss_tech "Artiss.co.uk on Twitter") (@artiss_tech).
286
 
287
- For problems, suggestions or enhancements for this plugin, there is [a dedicated page](http://www.artiss.co.uk/artiss-youtube-embed "Artiss YouTube Embed") and [a forum](http://www.artiss.co.uk/forum "WordPress Plugins Forum"). The dedicated page will also list any known issues and planned enhancements.
288
 
289
  **This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
290
 
@@ -385,47 +389,90 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
385
  4. The lists screen - videos have been added and validated. The drop-down help is also shown.
386
  5. The About screen
387
  6. The default widget options
 
388
 
389
  == Changelog ==
390
 
391
- = 1.0 =
392
- * Initial release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
 
394
- = 1.1 =
395
- * Maintenance: Updated test video on options screen, as previous one had been removed
396
- * Maintenance: Confirmed WP 3.0 compatibility
397
- * Enhancement: Resulting XHTML code is better formatted, with comments identifying code location
398
 
399
- = 1.2 =
400
- * Enhancement: Minor changes to the XHTML code to prevent warnings from certain validators
 
 
 
 
 
401
 
402
- = 1.3 =
403
- * Enhancement: Added transparency option so that videos won't cover up layers
 
 
 
 
 
404
 
405
- = 1.3.1 =
406
- * Enhancement: New widget option to specify title
 
 
 
 
 
 
 
 
 
 
407
 
408
- = 1.4 =
409
- * Maintenance: Tidied up code
410
- * Enhancement: Now supports multiple widgets - widget code completely re-written
411
- * Enhancement: Support for EmbedPlus added
412
- * Enhancement: Added option to suppress links back to YouTube
413
- * Enhancement: Added functions and shortcodes for returning and outputting available transcripts
414
 
415
- = 1.4.1 =
416
- * Enhancement: HD option is available with EmbedPlus - updated the admin and widget screen to reflect this
 
 
 
 
417
 
418
- = 1.4.2 =
419
- * Enhancement: Added keyboard disable option
420
- * Bug: Fixed bug which meant that people upgrading from previous versions may not be able to display video until they've been to the options screen and re-saved their default options
 
 
 
 
 
 
 
421
 
422
- = 1.5 =
423
- * Enhancement: Added clone of 'youtube' shortcode, called 'youtube_video'
424
- * Enhancement: Editor now has YouTube button, which inserts the YouTube shortcode (this can be switched off in the options screen)
425
- * Enhancement: Added new option to disable keyboard controls
426
- * Enhancement: Added option to supply a ratio, in case height or width are not supplied - the missing parameter will then be calculated
427
- * Enhancement: Option to create a download link (for video and playlist) using function call or shortcode
428
- * Enhancement: You can now change on the options screen which set of parameters the demonstration video uses (i.e. "normal" or EmbedPlus). This allows you to try your options on a different video type without switching to it.
 
429
 
430
  = 2.0 =
431
  * Maintenance: Renamed to Artiss YouTube Embed from YouTube Embed
@@ -445,120 +492,100 @@ That's correct - all Artiss plugins will now add this feature to keep you up-to-
445
  * Enhancement: Improved editor button and link added to admin bar
446
  * Enhancement: Many, many more changes - too many to list!
447
 
448
- = 2.0.1 =
449
- * Enhancement: Changed cache key encoding so that it was compatible with PHP 4
450
- * Enhancement: Added autoplay option to EmbedPlus
451
- * Enhancement: Re-instated `style` option, allowing you to apply a direct set of CSS elements to the output - a requirement if you wish to add a border to the video, for instance
452
- * Maintenance: Updated screens and documentation to show the `start` parameter works with EmbedPlus
453
- * Bug: Fixed incorrect caching of options - was only changing if override parameters were modified
454
- * Bug: Video Information Cache will no longer reset to zero if the Embed cache is greater
455
- * Bug: Added random ID to EmbedPlus output to resolve a bug that can affect IE users
456
-
457
- = 2.0.2 =
458
- * Enhancement: Strip tags from video ID, in case any have crept in
459
- * Enhancement: Tidied some of the widget controls
460
- * Enhancement: You can now specify YouTube short URLs as video IDs
461
- * Bug: Removed reference to jscolor.js script, which isn't used
462
- * Bug: Video IDs beginning with numbers are being confused with list numbers
463
- * Bug: Corrected problem with random single videos being picked from a list
464
- * Bug: Fixed problem with list where one video was being ignored and another repeated
465
- * Bug: Modified widget code to allow for all states to be allowable. Defaults updated
466
- * Bug: YouTube documentation states that if you don't specify the fullscreen parameter it will default to off. It doesn't. Corrected in the code
467
 
468
- = 2.0.3 =
469
- * Enhancement: Decode any passed `template` parameters, as WP may have encoded the content first
470
- * Enhancement: Improved file handling
471
- * Enhancement: Now using HTTPS and version 2 of YouTube gdata API
472
- * Enhancement: New general option to switch off reporting of API errors - will simply accept ID and work out type
473
- * Maintenance: Added details to the README to cover issues with `style` backwards compatibility and YouTube API
474
 
475
- = 2.0.4 =
476
- * Enhancement: Removed HTTPS access to gdata API - will add a switchable option for this in a later release
477
 
478
- = 2.1 =
479
- * Enhancement: New option to switch API options (where HTTP or HTTPS, display messages or not or even switch off)
480
- * Enhancement: Output video playback errors as XHTML comments. Output to post a generic message which can be changed in the options
481
- * Enhancement: Video information is shown in lists screen when first entering (no need to press Save button to display)
482
- * Enhancement: Added new `color` parameter, which allows you to specify the colour of the progress bar
483
- * Enhancement: Added new `theme` parameter, allowing you to specify if the player is dark or light skinned
484
- * Enhancement: Added new `https` parameter, allowing you to use HTTPS instead of HTTP for the video display
485
- * Enhancement: Added new `version` parameter to thumbnails, allowing different versions (including a high resolution one) to be displayed
486
- * Enhancement: Added new administration option to allow the thumbnail used in RSS feeds to be specified
487
- * Enhancement: Log the current plugin version into the database. This may be of use in future upgrades to detect which version the user is upgrading from
488
- * Bug: Fixed video title no longer being fetched since 2.0.3 (because of using v2 of API)
489
- * Bug: Fixed some error output - due to changes made in an earlier release some errors would not display
490
 
491
- = 2.2 =
492
- * Maintenance: Updated dashboard widget to latest version
493
- * Maintenance: Added advertising banners to options screen - these can be turned off if you donate
494
- * Enhancement: Replace WP_PLUGIN_URL with plugins_url()
495
- * Enhancement: Added H and W as alternative shortcode parameters to HEIGHT and WIDTH
496
- * Enhancement: Editor button should appear for anyone from editor role upwards
497
- * Enhancement: Removed maximum length from profile and list names. However, only first 20 characters will appear in lists
498
 
499
- = 2.3 =
500
- * Bug: Fixed incorrect listing of long profile or list names
501
- * Bug: Fixed INCLUDE bug in widgets.php
502
- * Enhancement: Editor button will add text between shortcodes if no URL or ID is specified
503
- * Enhancement: Square brackets are stripped from alternative shortcodes on option screen - text added to warn against this too
504
- * Enhancement: Added Chromeless player option
505
- * Enhancement: Increased maximum output length of profile and list names to 30 characters
506
 
507
- = 2.3.1 =
508
- * Maintenance: Removed the sponsorship
509
 
510
- == Upgrade Notice ==
 
 
 
511
 
512
  = 1.0 =
513
  * Initial release
514
 
515
- = 1.1 =
516
- * Update to get the test video on the options screen working again!
517
 
518
- = 1.2 =
519
- * Update to ensure no warnings are reported by XHTML validators
520
 
521
- = 1.3 =
522
- * Update if you find that the videos are covering up layers
523
 
524
- = 1.3.1 =
525
- * Update if you wish to change the widget heading
526
 
527
- = 1.4 =
528
- * Update to add EmbedPlus, multi-widgets and transcript output capabilities
529
 
530
- = 1.4.1 =
531
- * Upgrade to make a small correction to the parameter lists
532
 
533
- = 1.4.2 =
534
- * Upgrade is you upgraded to version 1.4 or 1.4.1 from a previous version, to fix an important bug
535
 
536
- = 1.5 =
537
- * Upgrade to add a number of new options including video size ratios, disabling keyboard controls, an editor button and different demonstration video options on the admin screen
538
 
539
- = 2.0 =
540
- * Upgrade to take advantage of many new features. Code completely re-written
541
 
542
  = 2.0.1 =
543
  * Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
544
 
545
- = 2.0.2 =
546
- * Further update to fix a few minor bugs found in 2.0. A few small enhancements have also been made
547
 
548
- = 2.0.3 =
549
- * Removed secure API access as this was causing some users issues
550
 
551
- = 2.0.4 =
552
- * Fixed SSL bug by removing HTTPS access to API
553
 
554
- = 2.1 =
555
- * New options to change player colours, chose your thumbnails and control API usage
556
 
557
- = 2.2 =
558
- * Assorted minor improvements
559
 
560
- = 2.3 =
561
- * Assorted bug fixes and minor improvements. Also added Chromeless player.
562
 
563
- = 2.3.1 =
564
- * Upgrade to remove the sponsorship
 
 
 
 
 
 
 
 
 
1
  === Artiss YouTube Embed ===
2
  Contributors: dartiss
3
  Donate link: http://artiss.co.uk/donate
4
+ Tags: admin, annotations, artiss, automatic, editor, embed, embedding, embedplus, flash, flv, google, hd, height, iframe, manage, media, plugin, page, play, playlist, post, profile, responsive, sidebar, simple, smart, url, valid, video, widget, width, xhtml, youtube, youtuber
5
  Requires at least: 2.9
6
+ Tested up to: 3.3
7
+ Stable tag: 2.4
8
 
9
  A simple to use method of embedding YouTube videos into your posts and pages but with powerful features for those that need them.
10
 
14
 
15
  * XHTML and HTML5 compliant - works with all the latest browsers
16
  * Multiple embedding methods available - OBJECT, IFRAME, CHROMELESS and EmbedPlus
17
+ * Dynamic video sizing for responsive sites
18
  * Allow users to add videos to comments
19
  * Build your own playlists and play them back however you want
20
  * Create multiple profiles - use them for different videos to get the exact style that you want
49
 
50
  * **audio** - yes or no, this will hide the video and display just the toolbar (ideal for audio only playback) if switched on
51
  * **autoplay** - yes or no, should the video automatically start playing?
52
+ * **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.
53
  * **height** - the video height, in pixels
54
  * **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)
55
  * **profile** - specify a different default profile (see section on Profiles for further details)
56
  * **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
57
+ * **ssl** - Use SSL or not? Basically, if set on the URL will be HTTPS rather than HTTP.
58
  * **start** - a number of seconds from where to start the video playing
59
  * **style** - apply CSS elements directly to the video output
60
  * **template** - specify a template (see section on Templates for further details)
61
+ * **title** - the title of the video
62
  * **type** - which embedding type to use, this can be `embedplus`, `iframe`, `object` or `chromeless`
63
  * **width** - the video width, in pixels
64
 
131
 
132
  e.g. `<div align="center">%video%</div>`
133
 
134
+ Be wary that when adding template via a parameter that any HTML included may cause your video to have <pre> tags wrapped around it. The easiest way to check and fix this is to view any post in the HTML editor and remove any PRE tags that have been added.
135
 
136
  == Profiles ==
137
 
288
 
289
  Please feel free to visit the site for plugin updates and development news - either visit the site regularly or [follow me on Twitter](http://www.twitter.com/artiss_tech "Artiss.co.uk on Twitter") (@artiss_tech).
290
 
291
+ For problems, suggestions or enhancements for this plugin, there is [a dedicated page](http://www.artiss.co.uk/youtube-embed "Artiss YouTube Embed") and [a forum](http://www.artiss.co.uk/forum "WordPress Plugins Forum"). The dedicated page will also list any known issues and planned enhancements.
292
 
293
  **This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
294
 
389
  4. The lists screen - videos have been added and validated. The drop-down help is also shown.
390
  5. The About screen
391
  6. The default widget options
392
+ 7. The default visual editor options with the YouTube Embed button
393
 
394
  == Changelog ==
395
 
396
+ = 2.4 =
397
+
398
+ * Maintenance: Re-sequenced the changelog in the README
399
+ * Maintenance: Removed drop shadow option
400
+ * Maintenance: Re-design of widgets, reducing number of parameters down to make it easier to use - use profiles to modify missing parameters
401
+ * Maintenance: Updated YouTube icons
402
+ * Bug: Ensure `showinfo` parameter is set correctly
403
+ * Bug: If width or height is missing from Profile screen then fill it in based on widescreen format. Otherwise, causes video to break
404
+ * Bug: Video information was being fetched from caching even if option selected to switch it off. Fixed!
405
+ * Enhancement: Added frameborder="0" to IFRAME code
406
+ * Enhancement: Added Privacy-Enhanced mode. Doesn't work with Chromeless player.
407
+ * Enhancement: Added `title` option, so you can name the video
408
+ * Enhancement: Added `ssl` option, allowing you to override whether HTTP or HTTPS is used for the video
409
+ * Enhancement: Added `dynamic` option (and matching Profile switch) to allow users to request dynamically resizing video (responsive). Additional option to allow specified width to be maximum
410
+ * Enhancement: Made `modestbranding` a switchable option (switchable in profile options but not on video-by-video basis) due to issues with Apple devices
411
+ * Enhancement: Improved matching of URL embedded into post
412
+ * Enhancement: If you have the [README Parser plugin](http://wordpress.org/extend/plugins/wp-readme-parser/ "README Parser") installed then a new sub-menu will display the README instructions
413
+ * Enhancement: Use WP 3.3 Feature Pointer to highlight new menu when plugin is activated
414
 
415
+ = 2.3.1 =
416
+ * Maintenance: Removed the sponsorship
 
 
417
 
418
+ = 2.3 =
419
+ * Bug: Fixed incorrect listing of long profile or list names
420
+ * Bug: Fixed INCLUDE bug in widgets.php
421
+ * Enhancement: Editor button will add text between shortcodes if no URL or ID is specified
422
+ * Enhancement: Square brackets are stripped from alternative shortcodes on option screen - text added to warn against this too
423
+ * Enhancement: Added Chromeless player option
424
+ * Enhancement: Increased maximum output length of profile and list names to 30 characters
425
 
426
+ = 2.2 =
427
+ * Maintenance: Updated dashboard widget to latest version
428
+ * Maintenance: Added advertising banners to options screen - these can be turned off if you donate
429
+ * Enhancement: Replace WP_PLUGIN_URL with plugins_url()
430
+ * Enhancement: Added H and W as alternative shortcode parameters to HEIGHT and WIDTH
431
+ * Enhancement: Editor button should appear for anyone from editor role upwards
432
+ * Enhancement: Removed maximum length from profile and list names. However, only first 20 characters will appear in lists
433
 
434
+ = 2.1 =
435
+ * Enhancement: New option to switch API options (where HTTP or HTTPS, display messages or not or even switch off)
436
+ * Enhancement: Output video playback errors as XHTML comments. Output to post a generic message which can be changed in the options
437
+ * Enhancement: Video information is shown in lists screen when first entering (no need to press Save button to display)
438
+ * Enhancement: Added new `color` parameter, which allows you to specify the colour of the progress bar
439
+ * Enhancement: Added new `theme` parameter, allowing you to specify if the player is dark or light skinned
440
+ * Enhancement: Added new `https` parameter, allowing you to use HTTPS instead of HTTP for the video display
441
+ * Enhancement: Added new `version` parameter to thumbnails, allowing different versions (including a high resolution one) to be displayed
442
+ * Enhancement: Added new administration option to allow the thumbnail used in RSS feeds to be specified
443
+ * Enhancement: Log the current plugin version into the database. This may be of use in future upgrades to detect which version the user is upgrading from
444
+ * Bug: Fixed video title no longer being fetched since 2.0.3 (because of using v2 of API)
445
+ * Bug: Fixed some error output - due to changes made in an earlier release some errors would not display
446
 
447
+ = 2.0.4 =
448
+ * Enhancement: Removed HTTPS access to gdata API - will add a switchable option for this in a later release
 
 
 
 
449
 
450
+ = 2.0.3 =
451
+ * Enhancement: Decode any passed `template` parameters, as WP may have encoded the content first
452
+ * Enhancement: Improved file handling
453
+ * Enhancement: Now using HTTPS and version 2 of YouTube gdata API
454
+ * Enhancement: New general option to switch off reporting of API errors - will simply accept ID and work out type
455
+ * Maintenance: Added details to the README to cover issues with `style` backwards compatibility and YouTube API
456
 
457
+ = 2.0.2 =
458
+ * Enhancement: Strip tags from video ID, in case any have crept in
459
+ * Enhancement: Tidied some of the widget controls
460
+ * Enhancement: You can now specify YouTube short URLs as video IDs
461
+ * Bug: Removed reference to jscolor.js script, which isn't used
462
+ * Bug: Video IDs beginning with numbers are being confused with list numbers
463
+ * Bug: Corrected problem with random single videos being picked from a list
464
+ * Bug: Fixed problem with list where one video was being ignored and another repeated
465
+ * Bug: Modified widget code to allow for all states to be allowable. Defaults updated
466
+ * Bug: YouTube documentation states that if you don't specify the fullscreen parameter it will default to off. It doesn't. Corrected in the code
467
 
468
+ = 2.0.1 =
469
+ * Enhancement: Changed cache key encoding so that it was compatible with PHP 4
470
+ * Enhancement: Added autoplay option to EmbedPlus
471
+ * Enhancement: Re-instated `style` option, allowing you to apply a direct set of CSS elements to the output - a requirement if you wish to add a border to the video, for instance
472
+ * Maintenance: Updated screens and documentation to show the `start` parameter works with EmbedPlus
473
+ * Bug: Fixed incorrect caching of options - was only changing if override parameters were modified
474
+ * Bug: Video Information Cache will no longer reset to zero if the Embed cache is greater
475
+ * Bug: Added random ID to EmbedPlus output to resolve a bug that can affect IE users
476
 
477
  = 2.0 =
478
  * Maintenance: Renamed to Artiss YouTube Embed from YouTube Embed
492
  * Enhancement: Improved editor button and link added to admin bar
493
  * Enhancement: Many, many more changes - too many to list!
494
 
495
+ = 1.5 =
496
+ * Enhancement: Added clone of 'youtube' shortcode, called 'youtube_video'
497
+ * Enhancement: Editor now has YouTube button, which inserts the YouTube shortcode (this can be switched off in the options screen)
498
+ * Enhancement: Added new option to disable keyboard controls
499
+ * Enhancement: Added option to supply a ratio, in case height or width are not supplied - the missing parameter will then be calculated
500
+ * Enhancement: Option to create a download link (for video and playlist) using function call or shortcode
501
+ * Enhancement: You can now change on the options screen which set of parameters the demonstration video uses (i.e. "normal" or EmbedPlus). This allows you to try your options on a different video type without switching to it.
 
 
 
 
 
 
 
 
 
 
 
 
502
 
503
+ = 1.4.2 =
504
+ * Enhancement: Added keyboard disable option
505
+ * Bug: Fixed bug which meant that people upgrading from previous versions may not be able to display video until they've been to the options screen and re-saved their default options
 
 
 
506
 
507
+ = 1.4.1 =
508
+ * Enhancement: HD option is available with EmbedPlus - updated the admin and widget screen to reflect this
509
 
510
+ = 1.4 =
511
+ * Maintenance: Tidied up code
512
+ * Enhancement: Now supports multiple widgets - widget code completely re-written
513
+ * Enhancement: Support for EmbedPlus added
514
+ * Enhancement: Added option to suppress links back to YouTube
515
+ * Enhancement: Added functions and shortcodes for returning and outputting available transcripts
 
 
 
 
 
 
516
 
517
+ = 1.3.1 =
518
+ * Enhancement: New widget option to specify title
 
 
 
 
 
519
 
520
+ = 1.3 =
521
+ * Enhancement: Added transparency option so that videos won't cover up layers
 
 
 
 
 
522
 
523
+ = 1.2 =
524
+ * Enhancement: Minor changes to the XHTML code to prevent warnings from certain validators
525
 
526
+ = 1.1 =
527
+ * Maintenance: Updated test video on options screen, as previous one had been removed
528
+ * Maintenance: Confirmed WP 3.0 compatibility
529
+ * Enhancement: Resulting XHTML code is better formatted, with comments identifying code location
530
 
531
  = 1.0 =
532
  * Initial release
533
 
534
+ == Upgrade Notice ==
 
535
 
536
+ = 2.4 =
537
+ * Numerous improvements, including new option for responsive video output
538
 
539
+ = 2.3.1 =
540
+ * Upgrade to remove the sponsorship
541
 
542
+ = 2.3 =
543
+ * Assorted bug fixes and minor improvements. Also added Chromeless player.
544
 
545
+ = 2.2 =
546
+ * Assorted minor improvements
547
 
548
+ = 2.1 =
549
+ * New options to change player colours, chose your thumbnails and control API usage
550
 
551
+ = 2.0.4 =
552
+ * Fixed SSL bug by removing HTTPS access to API
553
 
554
+ = 2.0.3 =
555
+ * Removed secure API access as this was causing some users issues
556
 
557
+ = 2.0.2 =
558
+ * Further update to fix a few minor bugs found in 2.0. A few small enhancements have also been made
559
 
560
  = 2.0.1 =
561
  * Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
562
 
563
+ = 2.0 =
564
+ * Upgrade to take advantage of many new features. Code completely re-written
565
 
566
+ = 1.5 =
567
+ * Upgrade to add a number of new options including video size ratios, disabling keyboard controls, an editor button and different demonstration video options on the admin screen
568
 
569
+ = 1.4.2 =
570
+ * Upgrade is you upgraded to version 1.4 or 1.4.1 from a previous version, to fix an important bug
571
 
572
+ = 1.4.1 =
573
+ * Upgrade to make a small correction to the parameter lists
574
 
575
+ = 1.4 =
576
+ * Update to add EmbedPlus, multi-widgets and transcript output capabilities
577
 
578
+ = 1.3.1 =
579
+ * Update if you wish to change the widget heading
580
 
581
+ = 1.3 =
582
+ * Update if you find that the videos are covering up layers
583
+
584
+ = 1.2 =
585
+ * Update to ensure no warnings are reported by XHTML validators
586
+
587
+ = 1.1 =
588
+ * Update to get the test video on the options screen working again!
589
+
590
+ = 1.0 =
591
+ * Initial release
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
screenshot-4.png CHANGED
Binary file
screenshot-5.png CHANGED
Binary file
screenshot-6.png CHANGED
Binary file
screenshot-7.png ADDED
Binary file
uninstall.php CHANGED
@@ -43,4 +43,5 @@ if ( is_array( $options ) ) {
43
  delete_option( 'widget_youtube_embed_widget' );
44
  delete_option( 'youtube_embed_shortcode' );
45
  delete_option( 'youtube_embed_url' );
 
46
  ?>
43
  delete_option( 'widget_youtube_embed_widget' );
44
  delete_option( 'youtube_embed_shortcode' );
45
  delete_option( 'youtube_embed_url' );
46
+ delete_option( 'youtube_embed_activated' );
47
  ?>
youtube-embed.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Artiss YouTube Embed
4
  Plugin URI: http://www.artiss.co.uk/artiss-youtube-embed
5
  Description: Embed YouTube Videos in WordPress
6
- Version: 2.3.1
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
@@ -17,12 +17,14 @@ Author URI: http://www.artiss.co.uk
17
  * @since 2.0
18
  */
19
 
20
- define( 'youtube_embed_version', '2.3.1' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
24
  // Include all the various functions
25
 
 
 
26
  include_once( $functions_dir . 'shared.php' ); // Shared routines
27
 
28
  include_once( $functions_dir . 'set-option-defaults.php' ); // Set default options
@@ -33,7 +35,7 @@ include_once( $functions_dir . 'generate-embed-code.php' ); // Generate YouT
33
 
34
  if ( is_admin() ) {
35
 
36
- include_once( $functions_dir . 'admin-menu.php' ); // Administration menus
37
 
38
  include_once( $functions_dir . 'mcebutton.php' ); // Editor button
39
 
@@ -76,7 +78,10 @@ include_once($functions_dir . 'widgets.php');
76
  */
77
 
78
  if ( !is_admin() ) {
 
79
  function ye_debug( $paras = '', $content = '' ) { echo youtube_embed_version . ' :: ' . WP_PLUGIN_DIR; }
 
80
  add_shortcode( 'ye-debug', 'ye_debug' );
 
81
  }
82
  ?>
3
  Plugin Name: Artiss YouTube Embed
4
  Plugin URI: http://www.artiss.co.uk/artiss-youtube-embed
5
  Description: Embed YouTube Videos in WordPress
6
+ Version: 2.4
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
17
  * @since 2.0
18
  */
19
 
20
+ define( 'youtube_embed_version', '2.4' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
24
  // Include all the various functions
25
 
26
+ include_once( $functions_dir . 'add-scripts.php' ); // Add various scripts
27
+
28
  include_once( $functions_dir . 'shared.php' ); // Shared routines
29
 
30
  include_once( $functions_dir . 'set-option-defaults.php' ); // Set default options
35
 
36
  if ( is_admin() ) {
37
 
38
+ include_once( $functions_dir . 'admin-config.php' ); // Administration configuration
39
 
40
  include_once( $functions_dir . 'mcebutton.php' ); // Editor button
41
 
78
  */
79
 
80
  if ( !is_admin() ) {
81
+
82
  function ye_debug( $paras = '', $content = '' ) { echo youtube_embed_version . ' :: ' . WP_PLUGIN_DIR; }
83
+
84
  add_shortcode( 'ye-debug', 'ye_debug' );
85
+
86
  }
87
  ?>