YouTube Embed - Version 2.2

Version Description

  • Maintenance: Updated dashboard widget to latest version
  • Maintenance: Added advertising banners to options screen - these can be turned off if you donate
  • Enhancement: Replace WP_PLUGIN_URL with plugins_url()
  • Enhancement: Added H and W as alternative shortcode parameters to HEIGHT and WIDTH
  • Enhancement: Editor button should appear for anyone from editor role upwards
  • Enhancement: Removed maximum length from profile and list names. However, only first 20 characters will appear in lists

=

Download this release

Release Info

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

Code changes from version 2.5 to 2.2

Files changed (69) hide show
  1. css/aye-admin.css +0 -1
  2. css/aye-dynamic UNCOMPRESSED.css +0 -17
  3. css/aye-dynamic.css +0 -1
  4. css/{aye-tinymce-button UNCOMPRESSED.css → tinymce-button UNCOMPRESSED.css} +0 -0
  5. css/{aye-tinymce-button-3.1 UNCOMPRESSED.css → tinymce-button-3.1 UNCOMPRESSED.css} +0 -0
  6. css/{aye-tinymce-button-3.1.css → tinymce-button-3.1.css} +0 -0
  7. css/{aye-tinymce-button.css → tinymce-button.css} +0 -0
  8. css/{aye-admin UNCOMPRESSED.css → youtube-embed UNCOMPRESSED.css } +0 -8
  9. css/youtube-embed.css +1 -0
  10. images/Facebook.png +0 -0
  11. images/Google+.png +0 -0
  12. images/RSS.png +0 -0
  13. images/Thumbs.db +0 -0
  14. images/Twitter.png +0 -0
  15. images/menu_icon.png +0 -0
  16. images/poweredby.png +0 -0
  17. images/screen_icon.png +0 -0
  18. images/shadow.png +0 -0
  19. images/themefuse_banner.jpg +0 -0
  20. images/youtube_button_b&w.png +0 -0
  21. images/youtube_button_colour.png +0 -0
  22. includes/about.php +62 -0
  23. includes/admin-bar.php +38 -0
  24. includes/admin-menu.php +187 -0
  25. includes/artiss-dashboard-widget.php +115 -0
  26. includes/aye-add-scripts.php +0 -52
  27. includes/aye-add-to-admin-bar.php +0 -107
  28. includes/aye-admin-config.php +0 -479
  29. includes/aye-display-about.php +0 -51
  30. includes/aye-display-readme.php +0 -26
  31. includes/aye-function-calls.php +0 -229
  32. includes/aye-generate-download-code.php +0 -41
  33. includes/aye-generate-shorturl-code.php +0 -41
  34. includes/aye-generate-widgets.php +0 -158
  35. includes/aye-options-widgets.php +0 -162
  36. includes/{aye-update-post-content.php → content.php} +65 -43
  37. includes/{aye-deprecated.php → deprecated.php} +4 -4
  38. includes/function-calls.php +225 -0
  39. includes/generate-download-code.php +41 -0
  40. includes/{aye-generate-embed-code.php → generate-embed-code.php} +99 -245
  41. includes/generate-shorturl-code.php +41 -0
  42. includes/{aye-generate-thumbnail-code.php → generate-thumbnail-code.php} +13 -13
  43. includes/{aye-generate-transcript-code.php → generate-transcript-code.php} +14 -17
  44. includes/{aye-add-mce-button.php → mcebutton.php} +5 -7
  45. includes/{aye-options-general.php → options-general.php} +68 -77
  46. includes/{aye-options-lists.php → options-lists.php} +32 -26
  47. includes/{aye-options-profiles.php → options-profiles.php} +80 -121
  48. includes/options-widgets.php +261 -0
  49. includes/{aye-set-defaults.php → set-option-defaults.php} +13 -14
  50. includes/{aye-shared-functions.php → shared.php} +46 -69
  51. includes/{aye-shortcodes.php → shortcodes.php} +52 -75
  52. includes/widgets.php +161 -0
  53. js/aye-ga-tracker UNCOMPRESSED.js +0 -3
  54. js/aye-ga-tracker.js +0 -1
  55. js/aye-mce-button.js +0 -1
  56. js/{aye-mce-button UNCOMPRESSED.js → mcebutton UNCOMPRESSED.js } +2 -7
  57. js/mcebutton.js +1 -0
  58. languages/youtube-embed.mo +0 -0
  59. languages/youtube-embed.po +0 -1106
  60. readme.txt +129 -243
  61. screenshot-1.png +0 -0
  62. screenshot-2.png +0 -0
  63. screenshot-3.png +0 -0
  64. screenshot-4.png +0 -0
  65. screenshot-5.png +0 -0
  66. screenshot-6.png +0 -0
  67. screenshot-7.png +0 -0
  68. uninstall.php +1 -2
  69. youtube-embed.php +44 -26
css/aye-admin.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;}#np-notepad ul{list-style:disc;}#np-notepad ul,ol{margin-left:60px;}
 
css/aye-dynamic UNCOMPRESSED.css DELETED
@@ -1,17 +0,0 @@
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/aye-dynamic.css DELETED
@@ -1 +0,0 @@
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/{aye-tinymce-button UNCOMPRESSED.css → tinymce-button UNCOMPRESSED.css} RENAMED
File without changes
css/{aye-tinymce-button-3.1 UNCOMPRESSED.css → tinymce-button-3.1 UNCOMPRESSED.css} RENAMED
File without changes
css/{aye-tinymce-button-3.1.css → tinymce-button-3.1.css} RENAMED
File without changes
css/{aye-tinymce-button.css → tinymce-button.css} RENAMED
File without changes
css/{aye-admin UNCOMPRESSED.css → youtube-embed UNCOMPRESSED.css } RENAMED
@@ -6,12 +6,4 @@
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
  }
6
  .yt_heading {
7
  font-weight: bold;
8
  font-size: 1.1em;
 
 
 
 
 
 
 
 
9
  }
css/youtube-embed.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;}
images/Facebook.png DELETED
Binary file
images/Google+.png DELETED
Binary file
images/RSS.png DELETED
Binary file
images/Thumbs.db ADDED
Binary file
images/Twitter.png DELETED
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 ADDED
Binary file
images/themefuse_banner.jpg DELETED
Binary file
images/youtube_button_b&w.png CHANGED
Binary file
images/youtube_button_colour.png CHANGED
Binary file
includes/about.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * About Page
4
+ *
5
+ * About the plugin
6
+ *
7
+ * @package YouTubeEmbed
8
+ * @since 2.0
9
+ */
10
+ ?>
11
+ <div class="wrap">
12
+ <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
13
+
14
+ <h2><?php _e( 'About Artiss YouTube Embed'); ?></h2>
15
+
16
+ <?php
17
+ $options = ye_set_general_defaults();
18
+ if ( $options[ 'donation' ] != 1 ) : ?>
19
+
20
+ <br/><div style="text-align: center;"><script type="text/javascript">
21
+ var psHost = (("https:" == document.location.protocol) ? "https://" : "http://");
22
+ document.write(unescape("%3Cscript src='" + psHost + "pluginsponsors.com/direct/spsn/display.php?client=youtube-embed&spot=' type='text/javascript'%3E%3C/script%3E"));
23
+ </script></div>
24
+
25
+ <?php endif; ?>
26
+
27
+ <p><?php _e( 'You are using Artiss YouTube Embed version ' . youtube_embed_version . '. It was written by David Artiss.' ); ?></p>
28
+
29
+ <a href="http://www.youtube.com/"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/poweredby.png" alt="Powered by YouTube" title="Powered by YouTube" align="right" /></a>
30
+
31
+ <?php
32
+
33
+ _e( '<h3>Copyrights</h3>' );
34
+
35
+ _e( '<p>YouTube, and all associated logos, is the copyright of Google Inc.</p>' );
36
+
37
+ _e( '<p>EmbedPlus is copyright. Read the <a href="http://embedplus.com/terms.aspx" target="_blank">Terms &amp; Conditions of Use</a>.</p>' );
38
+
39
+ _e( '<h3>Acknowledgements</h3>' );
40
+
41
+ _e( '<p>Images have been compressed with <a href="http://www.smushit.com/ysmush.it/">Smush.it</a>.</p>' );
42
+
43
+ _e( '<p>JavaScript has been compressed with <a href="http://javascriptcompressor.com/">JavaScript Compressor</a>.</p>' );
44
+
45
+ _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>' );
46
+
47
+ _e( '<h3>Support Information</h3>' );
48
+
49
+ _e( '<p>Useful support information and links can be found by clicking on the Help tab at the top of each of the Artiss YouTube Embed administration screens.</p>' );
50
+
51
+ _e( '<h4>This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.</h4>' );
52
+
53
+ _e( '<h3>Stay in Touch</h3>' );
54
+
55
+ _e( '<p><a href="http://www.artiss.co.uk/wp-plugins">See the full list</a> of Artiss plugins, including beta releases.</p>' );
56
+
57
+ _e( '<p><a href="http://www.twitter.com/artiss_tech">Follow Artiss.co.uk</a> on Twitter.</p>' );
58
+
59
+ _e( '<p><a href="http://www.artiss.co.uk/feed">Subscribe</a> to the Artiss.co.uk news feed.</p>' );
60
+
61
+ ?>
62
+ </div>
includes/admin-bar.php ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Bar
4
+ *
5
+ * Set up Admin Bar links
6
+ *
7
+ * @package YouTubeEmbed
8
+ */
9
+
10
+ /**
11
+ * Add option to Admin Bar
12
+ *
13
+ * Add link to YouTube Embed profile options to Admin Bar. This will only appear
14
+ * if the user can edit plugins
15
+ *
16
+ * @since 2.0
17
+ */
18
+
19
+ function ye_admin_bar_render() {
20
+
21
+ if ( current_user_can( 'edit_plugins' ) ) {
22
+
23
+ $options = ye_set_general_defaults();
24
+
25
+ if ( $options[ 'admin_bar' ] != '' ) {
26
+
27
+ global $wp_admin_bar;
28
+ $wp_admin_bar -> add_menu( array(
29
+ 'parent' => 'appearance',
30
+ 'id' => 'ye-options',
31
+ 'title' => __( 'YouTube Embed' ),
32
+ 'href' => admin_url( 'admin.php?page=youtube-embed-profiles' ),
33
+ 'meta' => false ) );
34
+ }
35
+ }
36
+ }
37
+ add_action( 'wp_before_admin_bar_render', 'ye_admin_bar_render' );
38
+ ?>
includes/admin-menu.php ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin Menu Functions
4
+ *
5
+ * Various functions relating to the various administration screens
6
+ *
7
+ * @package YouTubeEmbed
8
+ */
9
+
10
+ /**
11
+ * Admin Screen Initialisation
12
+ *
13
+ * Set up admin menu and submenu options
14
+ *
15
+ * @since 2.0
16
+ *
17
+ * @uses ye_add_submenu Add a submenu, with optional help drop-down
18
+ */
19
+
20
+ function ye_menu_initialise() {
21
+
22
+ add_menu_page( 'YouTube Embed Options', 'YouTube', 'manage_options', 'youtube-embed-general', 'ye_general_options', plugins_url() . '/youtube-embed/images/menu_icon.png' );
23
+
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
+ /**
35
+ * Include general options screen
36
+ *
37
+ * XHTML options screen to prompt and update some general plugin options
38
+ *
39
+ * @since 2.0
40
+ */
41
+
42
+ function ye_general_options() {
43
+ include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-general.php" );
44
+ }
45
+
46
+ /**
47
+ * Include profile options screen
48
+ *
49
+ * XHTML options screen to prompt and update profile options
50
+ *
51
+ * @since 2.0
52
+ */
53
+
54
+ function ye_profile_options() {
55
+ include_once( WP_PLUGIN_DIR . "/youtube-embed/includes/options-profiles.php" );
56
+ }
57
+
58
+ /**
59
+ * Include list options screen
60
+ *
61
+ * XHTML options screen to prompt and update list options
62
+ *
63
+ * @since 2.0
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
100
+ *
101
+ * Add a Settings link to the options listed against this plugin
102
+ *
103
+ * @since 2.0
104
+ *
105
+ * @param string $links Current links
106
+ * @param string $file File in use
107
+ * @return string Links, now with settings added
108
+ */
109
+
110
+ function ye_add_settings_link( $links, $file ) {
111
+
112
+ static $this_plugin;
113
+
114
+ if ( !$this_plugin ) { $this_plugin = plugin_basename( __FILE__ ); }
115
+
116
+ if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
117
+ $settings_link = '<a href="admin.php?page=youtube-embed-general">' . __( 'Settings' ) . '</a>';
118
+ array_unshift( $links, $settings_link );
119
+ }
120
+
121
+ return $links;
122
+ }
123
+
124
+ /**
125
+ * Add meta to plugin details
126
+ *
127
+ * Add options to plugin meta line
128
+ *
129
+ * @since 2.0
130
+ *
131
+ * @param string $links Current links
132
+ * @param string $file File in use
133
+ * @return string Links, now with settings added
134
+ */
135
+
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;
144
+ }
145
+
146
+
147
+ /**
148
+ * Add a submenu and, optionally, help
149
+ *
150
+ * Add a submenu and, if using WP 3 and above, help instructions to the drop-down
151
+ * at the top of the screen
152
+ *
153
+ * @since 2.0
154
+ *
155
+ * @param string $page_title Title to give menu page
156
+ * @param string $menu_title Title for menu option
157
+ * @param string $menu_slug Unique slug for the menu
158
+ * @param string $function Function name for menu option
159
+ */
160
+
161
+ function ye_add_submenu( $page_title, $menu_title, $menu_slug, $function ) {
162
+
163
+ $profile_slug = add_submenu_page( 'youtube-embed-general', $page_title, $menu_title, 'manage_options', $menu_slug, $function );
164
+
165
+ if ( $menu_slug == "youtube-embed-general" ) { $help_text = '<p>This screen allows you to select non-specific options for the Artiss YouTube Embed plugin. For the default embedding settings, please select the <a href="http://www.artiss.co.uk/wp-admin/admin.php?page=youtube-embed-profiles">Profiles</a> administration option.</p>'; }
166
+
167
+ if ( $menu_slug == "youtube-embed-profiles" ) { $help_text = "<p>This screen allows you to set the options for the default and additional profiles. If you don't specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required.</p>"; }
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>';
175
+ }
176
+
177
+ $help_text .= '<p><strong>For more information:</strong></p><p><a href="http://www.artiss.co.uk/artiss-youtube-embed">Artiss YouTube Embed Plugin Documentation</a></p><p><a href="http://code.google.com/apis/youtube/player_parameters.html">YouTube Player Documentation</a></p>';
178
+
179
+ if ( $menu_slug == "youtube-embed-profiles" ) { $help_text .= '<p><a href="http://embedplus.com/">EmbedPlus website</a></p>'; }
180
+
181
+ $help_text .= '<p><a href="http://www.artiss.co.uk/forum/specific-plugins-group2/artiss-youtube-embed-forum7">Artiss YouTube Embed Support Forum</a></p><h4>This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.</h4>';
182
+
183
+ add_contextual_help( $profile_slug, __( $help_text ) );
184
+
185
+ return;
186
+ }
187
+ ?>
includes/artiss-dashboard-widget.php ADDED
@@ -0,0 +1,115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ *
7
+ * @package YouTubeEmbed
8
+ * @since 2.0
9
+ */
10
+
11
+ /**
12
+ * Define Dashboard Widget
13
+ *
14
+ * Set up a new dashboard widget
15
+ *
16
+ */
17
+
18
+ function artiss_dashboard_widget() {
19
+ global $wp_meta_boxes;
20
+ wp_add_dashboard_widget( 'artiss_help_widget', 'Artiss News & Support', 'adw_create_widget' );
21
+ }
22
+ add_action( 'wp_dashboard_setup', 'artiss_dashboard_widget' );
23
+
24
+ /**
25
+ * Display Dashboard Widget
26
+ *
27
+ * Show dashboard widget. Fetch top news items from Twitter cache them.
28
+ *
29
+ */
30
+
31
+ function adw_create_widget() {
32
+
33
+ // Set number of minutes to cache output
34
+ $minutes_to_cache = 120;
35
+
36
+ // Set number of news items to display
37
+ $news_items = 5; // Attempt to get the cache
38
+ $output = get_transient( 'artiss_dashboard_text' );
39
+
40
+ // No cache found
41
+ if (!$output) {
42
+
43
+ // Add donation link
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' );
51
+
52
+ if ( $file_return[ 'file' ] != '' ) {
53
+
54
+ // Extract Twitter status' and output
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;
62
+ while ( $loop < ( $news_items + 1 ) ) {
63
+
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
+
73
+ $pos = $end+7;
74
+ $loop ++;
75
+ }
76
+ $output .= "</ul>\n";
77
+
78
+ }
79
+
80
+ // Add link to Twitter
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 );
88
+ }
89
+
90
+ echo $output;
91
+ }
92
+
93
+ /**
94
+ * Fetch a file (1.5)
95
+ * Use WordPress API to fetch a file and check results
96
+ *
97
+ * @package [Plugin Name]
98
+ * @since [version number]
99
+ *
100
+ * @param string $filein File name to fetch
101
+ * @return string Array containing file contents and response
102
+ */
103
+
104
+ function adw_get_file( $filein ) {
105
+
106
+ $fileout = wp_remote_get( $filein );
107
+ if ( !is_wp_error( $response ) ) {
108
+ if ( isset( $fileout[ 'body' ] ) ) { $file_return[ 'file' ] = $fileout[ 'body' ]; }
109
+ if ( isset( $fileout[ 'response '][ 'code' ] ) ) { $file_return[ 'response' ] = $fileout[ 'response' ][ 'code' ]; }
110
+ }
111
+
112
+ return $file_return;
113
+
114
+ }
115
+ ?>
includes/aye-add-scripts.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
- /**
3
- * Add Scripts
4
- *
5
- * Add JS and CSS to the main theme and to admin
6
- *
7
- * @package Artiss-YouTube-Embed
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 aye_main_scripts() {
19
-
20
- wp_enqueue_script( 'aye_ga_js', plugins_url( '/youtube-embed/js/aye-ga-tracker.js' ) );
21
-
22
- wp_register_style( 'aye_dynamic', plugins_url( '/youtube-embed/css/aye-dynamic.css' ) );
23
-
24
- wp_enqueue_style( 'aye_dynamic' );
25
-
26
- }
27
-
28
- add_action( 'wp_enqueue_scripts', 'aye_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 aye_admin_css() {
39
-
40
- wp_enqueue_style( 'aye_admin', plugins_url() . '/youtube-embed/css/aye-admin.css' );
41
-
42
- wp_enqueue_style( 'aye_dynamic', plugins_url() . '/youtube-embed/css/aye-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/aye-tinymce-button' . $version . '.css' );
48
-
49
- }
50
-
51
- add_action( 'admin_print_styles', 'aye_admin_css' );
52
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-add-to-admin-bar.php DELETED
@@ -1,107 +0,0 @@
1
- <?php
2
- /**
3
- * Admin Bar
4
- *
5
- * Set up Admin Bar links
6
- *
7
- * @package Artiss-YouTube-Embed
8
- */
9
-
10
- /**
11
- * Add option to Admin Bar (WP 3.1 - 3.3)
12
- *
13
- * Add link to YouTube Embed profile options to Admin Bar. This will only appear
14
- * if the user can edit plugins
15
- * With help from http://technerdia.com/1140_wordpress-admin-bar.html
16
- *
17
- * @uses aye_set_general_default Set default options
18
- *
19
- * @since 2.0
20
- */
21
-
22
- function ye_admin_bar_render_3_1() {
23
-
24
- global $wp_version;
25
-
26
- if ( current_user_can( 'edit_plugins' ) && ( ( float ) $wp_version >= 3.1 ) && ( ( float ) $wp_version < 3.3 ) ) {
27
-
28
- $options = ye_set_general_defaults();
29
-
30
- if ( $options[ 'admin_bar' ] != '' ) {
31
-
32
- global $wp_admin_bar;
33
- $wp_admin_bar -> add_menu( array(
34
- 'parent' => 'appearance',
35
- 'id' => 'ye-options',
36
- 'title' => __( 'YouTube Embed' ),
37
- 'href' => admin_url( 'admin.php?page=youtube-embed-profiles' ),
38
- 'meta' => false ) );
39
- }
40
- }
41
- }
42
-
43
- add_action( 'wp_before_admin_bar_render', 'ye_admin_bar_render_3_1' );
44
-
45
- /**
46
- * Add option to Admin Bar (WP 3.3+)
47
- *
48
- * Add link to YouTube Embed profile options to Admin Bar.
49
- * With help from http://technerdia.com/1140_wordpress-admin-bar.html
50
- *
51
- * @uses aye_set_general_default Set default options
52
- *
53
- * @since 2.5
54
- */
55
-
56
- function aye_admin_bar_render_3_3( $meta = TRUE ) {
57
-
58
- global $wp_version;
59
-
60
- if ( ( float ) $wp_version >= 3.3 ) {
61
-
62
- $options = aye_set_general_defaults();
63
-
64
- if ( $options[ 'admin_bar' ] != '' ) {
65
-
66
- global $wp_admin_bar;
67
-
68
- if ( !is_user_logged_in() ) { return; }
69
- if ( !is_super_admin() || !is_admin_bar_showing() ) { return; }
70
-
71
- $wp_admin_bar -> add_menu( array(
72
- 'id' => 'aye-menu',
73
- 'title' => __( 'YouTube Embed' ) ) );
74
-
75
- $wp_admin_bar -> add_menu( array(
76
- 'parent' => 'aye-menu',
77
- 'id' => 'aye-options',
78
- 'title' => __( 'Options' ),
79
- 'href' => admin_url( 'admin.php?page=aye-general-options' ),
80
- 'meta' => array( 'target' => '_blank' ) ) );
81
-
82
- $wp_admin_bar -> add_menu( array(
83
- 'parent' => 'aye-menu',
84
- 'id' => 'aye-profile',
85
- 'title' => __( 'Profiles' ),
86
- 'href' => admin_url( 'admin.php?page=aye-profile-options' ),
87
- 'meta' => array( 'target' => '_blank' ) ) );
88
-
89
- $wp_admin_bar -> add_menu( array(
90
- 'parent' => 'aye-menu',
91
- 'id' => 'aye-lists',
92
- 'title' => __( 'Lists' ),
93
- 'href' => admin_url( 'admin.php?page=aye-list-options' ),
94
- 'meta' => array( 'target' => '_blank' ) ) );
95
-
96
- $wp_admin_bar -> add_menu( array(
97
- 'parent' => 'aye-menu',
98
- 'id' => 'aye-readme',
99
- 'title' => __( 'README' ),
100
- 'href' => admin_url( 'admin.php?page=aye-support-readme' ),
101
- 'meta' => array( 'target' => '_blank' ) ) );
102
- }
103
- }
104
- }
105
-
106
- add_action( 'admin_bar_menu', 'aye_admin_bar_render_3_3', 40 );
107
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-admin-config.php DELETED
@@ -1,479 +0,0 @@
1
- <?php
2
- /**
3
- * Admin Config Functions
4
- *
5
- * Various functions relating to the various administration screens
6
- *
7
- * @package Artiss-YouTube-Embed
8
- */
9
-
10
- /**
11
- * Add Settings link to plugin list
12
- *
13
- * Add a Settings link to the options listed against this plugin
14
- *
15
- * @since 2.0
16
- *
17
- * @param string $links Current links
18
- * @param string $file File in use
19
- * @return string Links, now with settings added
20
- */
21
-
22
- function aye_add_settings_link( $links, $file ) {
23
-
24
- static $this_plugin;
25
-
26
- if ( !$this_plugin ) { $this_plugin = plugin_basename( __FILE__ ); }
27
-
28
- if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
29
- $settings_link = '<a href="admin.php?page=aye-general-options">' . __( 'Settings' ) . '</a>';
30
- array_unshift( $links, $settings_link );
31
- }
32
-
33
- return $links;
34
- }
35
-
36
- add_filter( 'plugin_action_links', 'aye_add_settings_link', 10, 2 );
37
-
38
- /**
39
- * Add meta to plugin details
40
- *
41
- * Add options to plugin meta line
42
- *
43
- * @since 2.0
44
- *
45
- * @param string $links Current links
46
- * @param string $file File in use
47
- * @return string Links, now with settings added
48
- */
49
-
50
- function aye_set_plugin_meta( $links, $file ) {
51
-
52
- if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
53
-
54
- $links = array_merge( $links, array( '<a href="admin.php?page=aye-display-about">' . __( 'Support' ) . '</a>' ) );
55
-
56
- $links = array_merge( $links, array( '<a href="http://www.artiss.co.uk/donate">' . __( 'Donate' ) . '</a>' ) );
57
- }
58
-
59
- return $links;
60
- }
61
-
62
- add_filter( 'plugin_row_meta', 'aye_set_plugin_meta', 10, 2 );
63
-
64
- /**
65
- * Admin Screen Initialisation
66
- *
67
- * Set up admin menu and submenu options
68
- *
69
- * @since 2.0
70
- *
71
- * @uses aye_contextual_help_type Work out help type
72
- */
73
-
74
- function aye_menu_initialise() {
75
-
76
- // Depending on WordPress version and available functions decide which (if any) contextual help system to use
77
-
78
- $contextual_help = aye_contextual_help_type();
79
-
80
- // Add main admin option
81
-
82
- add_menu_page( __( 'Artiss YouTube Embed Settings' ), __( 'YouTube' ), 'manage_options', 'aye-general-options', 'aye_general_options', plugins_url() . '/youtube-embed/images/menu_icon.png' );
83
-
84
- // Add options sub-menu
85
-
86
- if ( $contextual_help == 'new' ) { global $aye_options_hook; }
87
-
88
- $aye_options_hook = add_submenu_page( 'aye-general-options', __( 'Artiss YouTube Embed Options' ), __( 'Options' ), 'edit_posts', 'aye-general-options', 'aye_general_options' );
89
-
90
- if ( $contextual_help == 'new' ) { add_action( 'load-' . $aye_options_hook, 'aye_add_options_help' ); }
91
-
92
- if ( $contextual_help == 'old' ) { add_contextual_help( $aye_options_hook, aye_options_help() ); }
93
-
94
- // Add profiles sub-menu
95
-
96
- if ( $contextual_help == 'new' ) { global $aye_profiles_hook; }
97
-
98
- $aye_profiles_hook = add_submenu_page( 'aye-general-options', __( 'Artiss YouTube Embed Profiles' ), __( 'Profiles' ), 'edit_posts', 'aye-profile-options', 'aye_profile_options' );
99
-
100
- if ( $contextual_help == 'new' ) { add_action( 'load-' . $aye_profiles_hook, 'aye_add_profiles_help' ); }
101
-
102
- if ( $contextual_help == 'old' ) { add_contextual_help( $aye_profiles_hook, aye_profiles_help() ); }
103
-
104
- // Add lists sub-menu
105
-
106
- if ( $contextual_help == 'new' ) { global $aye_lists_hook; }
107
-
108
- $aye_lists_hook = add_submenu_page( 'aye-general-options', __( 'Artiss YouTube Embed Lists' ), __( 'Lists' ), 'edit_posts', 'aye-list-options', 'aye_list_options' );
109
-
110
- if ( $contextual_help == 'new' ) { add_action( 'load-' . $aye_lists_hook, 'aye_add_lists_help' ); }
111
-
112
- if ( $contextual_help == 'old' ) { add_contextual_help( $aye_lists_hook, aye_lists_help() ); }
113
-
114
- // Add readme sub-menu
115
-
116
- if ( function_exists( 'wp_readme_parser' ) ) {
117
- add_submenu_page( 'aye-general-options', __( 'Artiss YouTube Embed README' ), __( 'README' ), 'edit_posts', 'aye-support-readme', 'aye_support_readme' );
118
- }
119
-
120
- // Add about sub-menu
121
-
122
- if ( $contextual_help == 'new' ) { global $aye_about_hook; }
123
-
124
- $aye_about_hook = add_submenu_page( 'aye-general-options', __( 'About Artiss YouTube Embed' ), __( 'About' ), 'edit_posts', 'aye-support-about', 'aye_support_about' );
125
-
126
- if ( $contextual_help == 'new' ) { add_action( 'load-' . $aye_about_hook, 'aye_add_about_help' ); }
127
-
128
- if ( $contextual_help == 'old' ) { add_contextual_help( $aye_about_hook, aye_about_help() ); }
129
-
130
- }
131
-
132
- add_action( 'admin_menu', 'aye_menu_initialise' );
133
-
134
- /**
135
- * Get contextual help type
136
- *
137
- * Return whether this WP installation requires the new or old contextual help type, or none at all
138
- *
139
- * @since 2.5
140
- *
141
- * @return string Contextual help type - 'new', 'old' or false
142
- */
143
-
144
- function aye_contextual_help_type() {
145
-
146
- global $wp_version;
147
-
148
- $type = false;
149
-
150
- if ( ( float ) $wp_version >= 3.3 ) {
151
- $type = 'new';
152
- } else {
153
- if ( function_exists( 'add_contextual_help' ) ) {
154
- $type = 'old';
155
- }
156
- }
157
-
158
- return $type;
159
- }
160
-
161
- /**
162
- * Include general options screen
163
- *
164
- * XHTML options screen to prompt and update some general plugin options
165
- *
166
- * @since 2.0
167
- */
168
-
169
- function aye_general_options() {
170
-
171
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/aye-options-general.php' );
172
-
173
- }
174
-
175
- /**
176
- * Include profile options screen
177
- *
178
- * XHTML options screen to prompt and update profile options
179
- *
180
- * @since 2.0
181
- */
182
-
183
- function aye_profile_options() {
184
-
185
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/aye-options-profiles.php' );
186
-
187
- }
188
-
189
- /**
190
- * Include list options screen
191
- *
192
- * XHTML options screen to prompt and update list options
193
- *
194
- * @since 2.0
195
- */
196
-
197
- function aye_list_options() {
198
-
199
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/aye-options-lists.php' );
200
-
201
- }
202
-
203
- /**
204
- * Include README screen
205
- *
206
- * Parse and display the README instructions
207
- *
208
- * @since 2.4
209
- */
210
-
211
- function aye_support_readme() {
212
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/aye-display-readme.php' );
213
- }
214
-
215
- /**
216
- * Include about and support screen
217
- *
218
- * XHTML about screen which will, optionally, display help details as well
219
- *
220
- * @since 2.0
221
- */
222
-
223
- function aye_support_about() {
224
-
225
- include_once( WP_PLUGIN_DIR . '/youtube-embed/includes/aye-display-about.php' );
226
-
227
- }
228
-
229
- /**
230
- * Add Options Help
231
- *
232
- * Add help tab to options screen
233
- *
234
- * @since 2.5
235
- *
236
- * @uses aye_options_help Return help text
237
- */
238
-
239
- function aye_add_options_help() {
240
-
241
- global $aye_options_hook;
242
- $screen = get_current_screen();
243
-
244
- if ( $screen->id != $aye_options_hook ) { return; }
245
-
246
- $screen -> add_help_tab( array( 'id' => 'aye-options-help-tab', 'title' => __( 'Help' ), 'content' => aye_options_help() ) );
247
- }
248
-
249
- /**
250
- * Options Help
251
- *
252
- * Return help text for options screen
253
- *
254
- * @since 2.5
255
- *
256
- * @return string Help Text
257
- */
258
-
259
- function aye_options_help() {
260
-
261
- $help_text = '<p>' . __( 'This screen allows you to select non-specific options for the Artiss YouTube Embed plugin. For the default embedding settings, please select the <a href="admin.php?page=aye-profile-options">Profiles</a> administration option.' ) . '</p>';
262
- $help_text .= '<p>' . __( 'Remember to click the Save Settings button at the bottom of the screen for new settings to take effect.' ) . '</p>';
263
- $help_text .= '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
264
- $help_text .= '<p><a href="http://www.artiss.co.uk/artiss-youtube-embed">' . __( 'Artiss YouTube Embed Plugin Documentation' ) . '</a></p>';
265
- $help_text .= '<p><a href="http://code.google.com/apis/youtube/player_parameters.html">' . __( 'YouTube Player Documentation' ) . '</a></p>';
266
- $help_text .= '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
267
-
268
- return $help_text;
269
- }
270
-
271
- /**
272
- * Add Profiles Help
273
- *
274
- * Add help tab to profiles screen
275
- *
276
- * @since 2.5
277
- *
278
- * @uses aye_profiles_help Return help text
279
- */
280
-
281
- function aye_add_profiles_help() {
282
-
283
- global $aye_profiles_hook;
284
- $screen = get_current_screen();
285
-
286
- if ( $screen->id != $aye_profiles_hook ) { return; }
287
-
288
- $screen -> add_help_tab( array( 'id' => 'aye-profiles-help-tab', 'title' => __( 'Help' ), 'content' => aye_profiles_help() ) );
289
- }
290
-
291
- /**
292
- * Profiles Help
293
- *
294
- * Return help text for profiles screen
295
- *
296
- * @since 2.5
297
- *
298
- * @return string Help Text
299
- */
300
-
301
- function aye_profiles_help() {
302
-
303
- $help_text = '<p>' . __( 'This screen allows you to set the options for the default and additional profiles. If you don\'t specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required.' ) . '</p>';
304
- $help_text .= '<p>' . __( 'Remember to click the Save Settings button at the bottom of the screen for new settings to take effect.' ) . '</p>';
305
- $help_text .= '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
306
- $help_text .= '<p><a href="http://www.artiss.co.uk/artiss-youtube-embed">' . __( 'Artiss YouTube Embed Plugin Documentation' ) . '</a></p>';
307
- $help_text .= '<p><a href="http://code.google.com/apis/youtube/player_parameters.html">' . __( 'YouTube Player Documentation' ) . '</a></p>';
308
- $help_text .= '<p><a href="http://embedplus.com/">' . __( 'EmbedPlus website' ) . '</a></p>';
309
- $help_text .= '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
310
-
311
- return $help_text;
312
- }
313
-
314
- /**
315
- * Add Lists Help
316
- *
317
- * Add help tab to lists screen
318
- *
319
- * @since 2.5
320
- *
321
- * @uses aye_lists_help Return help text
322
- */
323
-
324
- function aye_add_lists_help() {
325
-
326
- global $aye_lists_hook;
327
- $screen = get_current_screen();
328
-
329
- if ( $screen->id != $aye_lists_hook ) { return; }
330
-
331
- $screen -> add_help_tab( array( 'id' => 'aye-lists-help-tab', 'title' => __( 'Help' ), 'content' => aye_lists_help() ) );
332
- }
333
-
334
- /**
335
- * Profiles Help
336
- *
337
- * Return help text for profiles screen
338
- *
339
- * @since 2.5
340
- *
341
- * @return string Help Text
342
- */
343
-
344
- function aye_lists_help() {
345
-
346
- $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>';
347
- $help_text .= '<p>' . __( 'Remember to click the Save Settings button at the bottom of the screen for new settings to take effect.' ) . '</p>';
348
- $help_text .= '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
349
- $help_text .= '<p><a href="http://www.artiss.co.uk/artiss-youtube-embed">' . __( 'Artiss YouTube Embed Plugin Documentation' ) . '</a></p>';
350
- $help_text .= '<p><a href="http://code.google.com/apis/youtube/player_parameters.html">' . __( 'YouTube Player Documentation' ) . '</a></p>';
351
- $help_text .= '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
352
-
353
- return $help_text;
354
- }
355
-
356
- /**
357
- * Add About Help
358
- *
359
- * Add help tab to about screen
360
- *
361
- * @since 2.5
362
- *
363
- * @uses aye_about_help Return help text
364
- */
365
-
366
- function aye_add_about_help() {
367
-
368
- global $aye_about_hook;
369
- $screen = get_current_screen();
370
-
371
- if ( $screen->id != $aye_about_hook ) { return; }
372
-
373
- $screen -> add_help_tab( array( 'id' => 'aye-about-help-tab', 'title' => __( 'Help' ), 'content' => aye_about_help() ) );
374
- }
375
-
376
- /**
377
- * About Help
378
- *
379
- * Return help text for about screen
380
- *
381
- * @since 2.5
382
- *
383
- * @return string Help Text
384
- */
385
-
386
- function aye_about_help() {
387
-
388
- $help_text = '<p>' . __( 'This screen provides useful information about this plugin along with methods of support.' ) . '</p>';
389
- $help_text .= '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
390
- $help_text .= '<p><a href="http://www.artiss.co.uk/artiss-youtube-embed">' . __( 'Artiss YouTube Embed Plugin Documentation' ) . '</a></p>';
391
- $help_text .= '<p><a href="http://code.google.com/apis/youtube/player_parameters.html">' . __( 'YouTube Player Documentation' ) . '</a></p>';
392
- $help_text .= '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
393
-
394
- return $help_text;
395
- }
396
-
397
- /**
398
- * Detect plugin activation
399
- *
400
- * Upon detection of activation set an option
401
- *
402
- * @since 2.4
403
- */
404
-
405
- function aye_plugin_activate() {
406
-
407
- update_option( 'youtube_embed_activated', true );
408
-
409
- }
410
-
411
- register_activation_hook( WP_PLUGIN_DIR . "/youtube-embed/youtube-embed.php", 'aye_plugin_activate' );
412
-
413
- // If plugin activated, run activation commands and delete option
414
-
415
- global $wp_version;
416
-
417
- if ( get_option( 'youtube_embed_activated' ) && ( ( float ) $wp_version >= 3.3 ) ) {
418
-
419
- add_action( 'admin_enqueue_scripts', 'aye_admin_enqueue_scripts' );
420
-
421
- delete_option( 'youtube_embed_activated' );
422
- }
423
-
424
- /**
425
- * Enqueue Feature Pointer files
426
- *
427
- * Add the required feature pointer files
428
- *
429
- * @since 2.4
430
- */
431
-
432
- function aye_admin_enqueue_scripts() {
433
-
434
- wp_enqueue_style( 'wp-pointer' );
435
- wp_enqueue_script( 'wp-pointer' );
436
-
437
- add_action( 'admin_print_footer_scripts', 'aye_admin_print_footer_scripts' );
438
- }
439
-
440
- /**
441
- * Show Feature Pointer
442
- *
443
- * Display feature pointer
444
- *
445
- * @since 2.4
446
- */
447
-
448
- function aye_admin_print_footer_scripts() {
449
-
450
- $pointer_content = '<h3>' . __( 'Welcome to Artiss YouTube Embed' ) . '</h3>';
451
- $pointer_content .= '<p style="font-style:italic;">' . __( 'Thank you for installing this plugin.' ) . '</p>';
452
- $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>';
453
- $pointer_content .= '<p>' . __( 'Even if you do nothing else, please visit the Profiles option to check your default video values.' ) . '</p>';
454
- ?>
455
- <script>
456
- jQuery(function () {
457
- var body = jQuery(document.body),
458
- menu = jQuery('#toplevel_page_youtube-embed-general'),
459
- collapse = jQuery('#collapse-menu'),
460
- yembed = menu.find("a[href='admin.php?page=youtube-embed-profiles']"),
461
- options = {
462
- content: '<?php echo $pointer_content; ?>',
463
- position: {
464
- edge: 'left',
465
- align: 'center',
466
- of: menu.is('.wp-menu-open') && !menu.is('.folded *') ? yembed : menu
467
- },
468
- close: function() {
469
- }};
470
-
471
- if ( !yembed.length )
472
- return;
473
-
474
- body.pointer(options).pointer('open');
475
- });
476
- </script>
477
- <?php
478
- }
479
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-display-about.php DELETED
@@ -1,51 +0,0 @@
1
- <?php
2
- /**
3
- * About Page
4
- *
5
- * About the plugin
6
- *
7
- * @package Artiss-YouTube-Embed
8
- * @since 2.0
9
- */
10
- ?>
11
- <div class="wrap" style="width: 1010px;">
12
- <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
13
-
14
- <h2><?php _e( 'About Artiss YouTube Embed' ); ?></h2>
15
-
16
- <p><?php echo sprintf( __( 'You are using Artiss YouTube Embed version %s. It was written by David Artiss.' ), youtube_embed_version ); ?></p>
17
-
18
- <a href="http://www.youtube.com/"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/poweredby.png" alt="Powered by YouTube" title="Powered by YouTube" align="right" /></a>
19
-
20
- <?php
21
-
22
- echo '<h3>' . __( 'Copyrights' ) . '</h3>';
23
-
24
- echo '<p>' . __( 'YouTube, and all associated logos, is the copyright of Google Inc.' ) . '</p>';
25
-
26
- echo '<p>' . __( 'EmbedPlus is copyright. Read the <a href="http://embedplus.com/terms.aspx" target="_blank">Terms &amp; Conditions of Use</a>.' ) . '</p>';
27
-
28
- echo '<h3>' . __( 'Acknowledgements' ) . '</h3>';
29
-
30
- echo '<p>' . __( 'Images have been compressed with <a href="http://www.smushit.com/ysmush.it/">Smush.it</a>.' ) . '</p>';
31
-
32
- echo '<p>' . __( 'JavaScript has been compressed with <a href="http://javascriptcompressor.com/">JavaScript Compressor</a>.' ) . '</p>';
33
-
34
- echo '<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
- echo '<h3>' . __( 'Support Information' ) . '</h3>';
37
-
38
- echo '<p>' . __( 'Useful support information and links can be found by clicking on the Help tab at the top of each of the Artiss YouTube Embed administration screens.' ) . '</p>';
39
-
40
- echo '<h4>' . __( 'This plugin, and all support, is supplied for free, but <a title="Donate" href="http://artiss.co.uk/donate" target="_blank">donations</a> are always welcome.' ) . '</h4>';
41
-
42
- echo '<h3>' . __( 'Stay in Touch' ) . '</h3>';
43
-
44
- echo '<p>' . __( '<a href="http://www.artiss.co.uk/wp-plugins">See the full list</a> of Artiss plugins, including beta releases.' ) . '</p>';
45
-
46
- echo '<p>' . __( '<a href="http://www.twitter.com/artiss_tech">Follow Artiss.co.uk</a> on Twitter.' ) . '</p>';
47
-
48
- echo '<p>' . __( '<a href="http://www.artiss.co.uk/feed">Subscribe</a> to the Artiss.co.uk news feed.' ) . '</p>';
49
-
50
- ?>
51
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-display-readme.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
- /**
3
- * README Page
4
- *
5
- * Display the README instructions
6
- *
7
- * @package Artiss-YouTube-Embed
8
- * @since 2.4
9
- */
10
- ?>
11
- <div class="wrap" style="width: 1010px;">
12
- <div class="icon32" id="icon-edit-pages"></div>
13
-
14
- <?php $plugin = 'Artiss YouTube Embed'; ?>
15
-
16
- <h2><?php _e( $plugin . ' README' ); ?></h2>
17
-
18
- <?php
19
- if ( !function_exists( 'wp_readme_parser' ) ) {
20
- echo '<p>You shouldn\'t be able to see this but I guess that odd things can happen!<p>';
21
- 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>';
22
- } else {
23
- 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 ' ), 'http://plugins.svn.wordpress.org/youtube-embed/tags/' . youtube_embed_version . '/readme.txt' );
24
- }
25
- ?>
26
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-function-calls.php DELETED
@@ -1,229 +0,0 @@
1
- <?php
2
- /**
3
- * Function Calls
4
- *
5
- * Various function calls that the user may call directly
6
- *
7
- * @package Artiss-YouTube-Embed
8
- */
9
-
10
- /**
11
- * Embed a YouTube video
12
- *
13
- * Write out XHTML to embed a YouTube video
14
- *
15
- * @since 2.0
16
- *
17
- * @uses aye_get_parameters Extract parameters from input
18
- * @uses aye_get_embed_type Work out the correct embed type to use
19
- * @uses aye_set_autohide Set correct autohide parameter
20
- * @uses aye_generate_youtube_code Generate the YouTube code
21
- *
22
- * @param string $content YouTube video ID
23
- * @param string $paras List of parameters
24
- * @param string $style Optional CSS
25
- */
26
-
27
- function youtube_video_embed( $content, $paras = '', $style = '' ) {
28
- $width = aye_get_parameters( $paras, 'width' );
29
- $height = aye_get_parameters( $paras, 'height' );
30
- $fullscreen = aye_get_parameters( $paras, 'fullscreen' );
31
- $related = aye_get_parameters( $paras, 'related' );
32
- $autoplay = aye_get_parameters( $paras, 'autoplay' );
33
- $loop = aye_get_parameters( $paras, 'loop' );
34
- $start = aye_get_parameters( $paras, 'start' );
35
- $info = aye_get_parameters( $paras, 'info' );
36
- $annotation = aye_get_parameters( $paras, 'annotation' );
37
- $cc = aye_get_parameters( $paras, 'cc' );
38
- $link = aye_get_parameters( $paras, 'link' );
39
- $react = aye_get_parameters( $paras, 'react' );
40
- $stop = aye_get_parameters( $paras, 'stop' );
41
- $sweetspot = aye_get_parameters( $paras, 'sweetspot' );
42
- $embedplus = aye_get_parameters( $paras, 'embedplus' );
43
- $disablekb = aye_get_parameters( $paras, 'disablekb' );
44
- $ratio = aye_get_parameters( $paras, 'ratio' );
45
- $autohide = aye_get_parameters( $paras, 'autohide' );
46
- $controls = aye_get_parameters( $paras, 'controls' );
47
- $type = aye_get_parameters( $paras, 'type' );
48
- $profile = aye_get_parameters( $paras, 'profile' );
49
- $list = aye_get_parameters( $paras, 'list' );
50
- $audio = aye_get_parameters( $paras, 'audio' );
51
- $template = aye_get_parameters( $paras, 'template' );
52
- $hd = aye_get_parameters( $paras, 'hd' );
53
- $color = aye_get_parameters( $paras, 'color' );
54
- $theme = aye_get_parameters( $paras, 'theme' );
55
- $https = aye_get_parameters( $paras, 'ssl' );
56
- $title = aye_get_parameters( $paras, 'title' );
57
- $dynamic = aye_get_parameters( $paras, 'dynamic' );
58
- $search = aye_get_parameters( $paras, 'search' );
59
- $user = aye_get_parameters( $paras, 'user' );
60
-
61
- // Get Embed type
62
- $type = aye_get_embed_type( $type, $embedplus );
63
-
64
- // Set up Autohide parameter
65
- $autohide = aye_set_autohide( $autohide );
66
-
67
- echo aye_generate_youtube_code( $content, $type, $width, $height, aye_convert( $fullscreen ), aye_convert( $related ), aye_convert( $autoplay ), aye_convert( $loop ), $start, aye_convert( $info ), aye_convert_3( $annotation ), aye_convert( $cc ), $style, aye_convert( $link ), aye_convert( $react ), $stop, aye_convert( $sweetspot ), aye_convert( $disablekb ), $ratio, $autohide, aye_convert( $controls ), $profile, $list, aye_convert( $audio ), $template, aye_convert( $hd ), $color, $theme, aye_convert( $https ), $title, aye_convert( $dynamic ), aye_convert( $search ), aye_convert( $user ) );
68
- return;
69
- }
70
-
71
- /**
72
- * Display a video thumbnail
73
- *
74
- * Display a thumbnail of a video
75
- *
76
- * @since 2.0
77
- *
78
- * @uses aye_get_parameters Extract parameters from a string
79
- * @uses aye_generate_thumbnail_code Get the thumbnail code
80
- *
81
- * @param string $content YouTube video ID
82
- * @param string $paras Parameters
83
- * @param string $style CSS information
84
- * @param string $alt Alt text
85
- */
86
-
87
- function youtube_thumb_embed( $content, $paras = '', $style = '', $alt = '' ) {
88
-
89
- $class = aye_get_parameters( $paras, 'class' );
90
- $rel = aye_get_parameters( $paras, 'rel' );
91
- $target = aye_get_parameters( $paras, 'target' );
92
- $width = aye_get_parameters( $paras, 'width' );
93
- $height = aye_get_parameters( $paras, 'height' );
94
- $version = aye_get_parameters( $paras, 'version' );
95
-
96
- echo aye_generate_thumbnail_code( $content, $style, $class, $rel, $target, $width, $height, $alt, $version );
97
-
98
- return;
99
- }
100
-
101
- /**
102
- * Return video short URL
103
- *
104
- * Return a short URL for the YouTube video
105
- *
106
- * @since 2.0
107
- *
108
- * @uses aye_generate_shorturl_code Display an error
109
- *
110
- * @param string $id YouTube video ID
111
- * @return string Download URL
112
- */
113
-
114
- function youtube_short_url( $id ) {
115
- return aye_generate_shorturl_code( $id );
116
- }
117
-
118
- /**
119
- * Get video download URL
120
- *
121
- * Return a URL for the video so that it can be downloaded
122
- *
123
- * @since 2.0
124
- *
125
- * @uses aye_generate_download_code Get the download URL
126
- *
127
- * @param string $id YouTube video ID
128
- * @return string Download URL
129
- */
130
-
131
- function get_video_download( $id ) {
132
- return aye_generate_download_code( $id );
133
- }
134
-
135
- /**
136
- * Get XML transcript
137
- *
138
- * Return XML formatted YouTube transcript
139
- *
140
- * @since 2.0
141
- *
142
- * @uses aye_error Output an error
143
- * @uses aye_extract_id Extract a video ID
144
- * @uses aye_get_file Get a file
145
- * @uses aye_validate_id Check the video ID is valid
146
- *
147
- * @param string $id YouTube video ID
148
- * @return string Transcript file in XML format
149
- */
150
-
151
- function get_youtube_transcript_xml ( $id ) {
152
-
153
- // Extract the ID if a full URL has been specified
154
- $id = aye_extract_id( $id );
155
-
156
- // Check what type of video it is and whether it's valid
157
- $embed_type = aye_validate_id( $id );
158
- if ( $embed_type != 'v' ) {
159
- if ( strlen( $embed_type ) > 1 ) {
160
- echo aye_error( $embed_type );
161
- } else {
162
- echo aye_error( sprintf( __( 'The YouTube ID of %s is invalid.' ), $id ) );
163
- }
164
- return;
165
- }
166
-
167
- // Get transcript file
168
- $filename = 'http://video.google.com/timedtext?lang=en&v=' . $id;
169
- $xml = aye_get_file( $filename );
170
-
171
- // Check success and return appropriate output
172
- if ( $xml[ 'rc' ] > 0 ) {
173
- echo aye_error( sprintf( __( 'Could not fetch the transcript file %s.' ), $id ) );
174
- return;
175
- } else {
176
- return $xml;
177
- }
178
- }
179
-
180
- /**
181
- * Get transcript
182
- *
183
- * Return XHTML formatted YouTube transcript
184
- *
185
- * @since 2.0
186
- *
187
- * @uses aye_generate_generatE_transcript Generate the transcript output
188
- *
189
- * @param string $id YouTube video ID
190
- * @return string Transcript file in XHTML format
191
- */
192
-
193
- function get_youtube_transcript( $id ) {
194
- return aye_generate_transcript( $id );
195
- }
196
-
197
- /**
198
- * Get Video Name
199
- *
200
- * Function to return the name of a YouTube video
201
- *
202
- * @since 2.0
203
- *
204
- * @uses aye_extract_id Extract the video ID
205
- * @uses aye_validate_id Get the name and video type
206
- * @uses aye_error Return an error
207
- *
208
- * @param string $id Video ID
209
- * @return string Video name
210
- */
211
-
212
- function get_youtube_name( $id ) {
213
-
214
- // Extract the ID if a full URL has been specified
215
- $id = aye_extract_id( $id );
216
-
217
- // Check what type of video it is and whether it's valid
218
- $return = aye_validate_id( $id, true );
219
- $embed_type = $return[ 'type' ];
220
- if ( strlen( $embed_type ) > 1 ) {
221
- echo aye_error( $embed_type );
222
- } else {
223
- echo aye_error( sprintf( __ ( 'The YouTube ID of %s is invalid.' ), $id ) );
224
- }
225
-
226
- // Return the video title
227
- return $return['title'];
228
- }
229
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-generate-download-code.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * Generate Download Code
4
- *
5
- * Create code to allow a YouTube video to be downloaded
6
- *
7
- * @package Artiss-YouTube-Embed
8
- * @since 2.0
9
- *
10
- * @uses aye_extract_id Extract an ID from a string
11
- * @uses aye_validate_id Confirm the type of video
12
- * @uses aye_error Display an error
13
- *
14
- * @param string $id YouTube video ID
15
- * @param string $target Link target
16
- * @param string $nofollow Use rel="nofollow" ?
17
- * @param string $text Text to add link to
18
- * @return string URL
19
- */
20
-
21
- function aye_generate_download_code( $id ) {
22
-
23
- if ( $id == '' ) { return aye_error( __ ( 'No YouTube ID was found.' ) ); }
24
-
25
- // Extract the ID if a full URL has been specified
26
- $id = aye_extract_id( $id );
27
-
28
- // Check what type of video it is and whether it's valid
29
- $embed_type = aye_validate_id( $id );
30
- if ( $embed_type != 'v' ) {
31
- if ( strlen( $embed_type ) > 1 ) {
32
- return aye_error( $embed_type );
33
- } else {
34
- return aye_error( sprintf( __( 'The YouTube ID of %s is invalid.' ), $id ) );
35
- }
36
- }
37
-
38
- // Create the link
39
- return 'http://deturl.com/www.youtube.com/watch?' . $embed_type . '=' . $id;
40
- }
41
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-generate-shorturl-code.php DELETED
@@ -1,41 +0,0 @@
1
- <?php
2
- /**
3
- * Generate video short URL
4
- *
5
- * Create a short URL to a YouTube video
6
- *
7
- * @package Artiss-YouTube-Embed
8
- * @since 2.0
9
- *
10
- * @uses aye_extract_id Extract an ID from a string
11
- * @uses aye_validate_id Confirm the type of video
12
- * @uses aye_error Display an error
13
- *
14
- * @param string $id YouTube video ID
15
- * @return string $youtube_code Code
16
- */
17
-
18
- function aye_generate_shorturl_code( $id ) {
19
-
20
- // Check that an ID has been specified
21
- if ( $id == '' ) {
22
- return aye_error( __( 'No video ID has been supplied' ) );
23
- } else {
24
-
25
- // Extract the ID if a full URL has been specified
26
- $id = aye_extract_id( $id );
27
-
28
- // Check what type of video it is and whether it's valid
29
- $embed_type = aye_validate_id( $id );
30
- if ( $embed_type != 'v' ) {
31
- if ( strlen( $embed_type ) > 1 ) {
32
- return aye_error( $embed_type );
33
- } else {
34
- return aye_error( sprintf( __( 'The YouTube ID of %s is invalid.' ), $id ) );
35
- }
36
- }
37
-
38
- return 'http://youtu.be/' . $id;
39
- }
40
- }
41
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-generate-widgets.php DELETED
@@ -1,158 +0,0 @@
1
- <?php
2
- /**
3
- * Widgets
4
- *
5
- * Create and display widgets
6
- *
7
- * @package Artiss-YouTube-Embed
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 aye_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
- $instance[ 'search' ],
88
- $instance[ 'user' ] );
89
-
90
- // Output the trailer
91
- echo $after_widget;
92
- }
93
-
94
- /**
95
- * Widget update/save function
96
- *
97
- * Update and save widget
98
- *
99
- * @since 2.0
100
- *
101
- * @param string $new_instance New instance
102
- * @param string $old_instance Old instance
103
- * @return string Instance
104
- */
105
-
106
- function update( $new_instance, $old_instance ) {
107
-
108
- $instance = $old_instance;
109
- $instance[ 'titles' ] = strip_tags( $new_instance[ 'titles' ] );
110
- $instance[ 'video_title' ] = strip_tags( $new_instance[ 'video_title' ] );#
111
- $instance[ 'id' ] = $new_instance[ 'id' ];
112
- $instance[ 'profile' ] = $new_instance[ 'profile' ];
113
- $instance[ 'type' ] = $new_instance[ 'type' ];
114
- $instance[ 'template' ] = $new_instance[ 'template' ];
115
- $instance[ 'style' ] = $new_instance[ 'style' ];
116
- $instance[ 'start' ] = $new_instance[ 'start' ];
117
- $instance[ 'autoplay' ] = $new_instance[ 'autoplay' ];
118
- $instance[ 'width' ] = $new_instance[ 'width' ];
119
- $instance[ 'height' ] = $new_instance[ 'height' ];
120
- $instance[ 'dynamic' ] = $new_instance[ 'dynamic' ];
121
- $instance[ 'list' ] = $new_instance[ 'list' ];
122
- $instance[ 'loop' ] = $new_instance[ 'loop' ];
123
- $instance[ 'stop' ] = $new_instance[ 'stop' ];
124
-
125
- if ( $new_instance[ 'id_type' ] == 's' ) { $instance[ 'search' ] = '1'; } else { $instance[ 'search' ] = '1'; }
126
- if ( $new_instance[ 'id_type' ] == 'u' ) { $instance[ 'user' ] = '1'; } else { $instance[ 'user' ] = '1'; }
127
-
128
- return $instance;
129
- }
130
-
131
- /**
132
- * Widget Admin control form
133
- *
134
- * Define admin file
135
- *
136
- * @since 2.0
137
- *
138
- * @param string $instance Instance
139
- */
140
-
141
- function form( $instance ) {
142
- include ( WP_PLUGIN_DIR . '/youtube-embed/includes/aye-options-widgets.php' );
143
- }
144
- }
145
-
146
- /**
147
- * Register Widget
148
- *
149
- * Register widget when loading the WP core
150
- *
151
- * @since 2.0
152
- */
153
-
154
- function youtube_embed_register_widgets() {
155
- register_widget( 'YouTubeEmbedWidget' );
156
- }
157
- add_action( 'widgets_init', 'youtube_embed_register_widgets' );
158
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/aye-options-widgets.php DELETED
@@ -1,162 +0,0 @@
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' => '', 'id_type' => '' );
6
- $instance = wp_parse_args( ( array ) $instance, $default );
7
- $general = aye_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 ID' ) . ': </label><input type="text" class="widefat" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'id' ] ) . '" /></p>';
26
-
27
- echo "<table>\n";
28
-
29
- // ID Type
30
-
31
- $field_id = $this -> get_field_id( 'id_type' );
32
- $field_name = $this -> get_field_name( 'id_type' );
33
- echo "\r\n" . '<tr><td width="100%">' . __( 'ID Type' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value="v"';
34
- if ( attribute_escape( $instance[ 'id_type' ] ) == 'v' ) { echo " selected='selected'"; }
35
- echo '>' . __( 'Video or Playlist' ) . '</option><option value="s"';
36
- if ( attribute_escape( $instance[ 'id_type' ] ) == 's' ) { echo " selected='selected'"; }
37
- echo '>' . __( 'Search' ) . '</option><option value="u"';
38
- if ( attribute_escape( $instance[ 'id_type' ] ) == 'u' ) { echo " selected='selected'"; }
39
- echo '>' . __( 'User' ) . '</option></select></td></tr>';
40
-
41
- echo "</table>\n";
42
-
43
- // Profile field
44
-
45
- $field_id = $this -> get_field_id( 'profile' );
46
- $field_name = $this -> get_field_name( 'profile' );
47
- echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
48
- aye_generate_profile_list( attribute_escape( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
49
- echo '</select></p>';
50
-
51
- // Template
52
-
53
- $field_id = $this -> get_field_id( 'template' );
54
- $field_name = $this -> get_field_name( 'template' );
55
- 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>';
56
-
57
- // Style
58
-
59
- $field_id = $this -> get_field_id( 'style' );
60
- $field_name = $this -> get_field_name( 'style' );
61
- 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>';
62
-
63
- // Size fields
64
-
65
- $field_id = $this -> get_field_id( 'width' );
66
- $field_name = $this -> get_field_name( 'width' );
67
- 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;';
68
-
69
- $field_id = $this -> get_field_id( 'height' );
70
- $field_name = $this -> get_field_name( 'height' );
71
- echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'height' ] ) . '" />&nbsp;pixels</p>';
72
-
73
- echo "<table>\n";
74
-
75
- // Dynamic Resize
76
-
77
- $field_id = $this -> get_field_id( 'dynamic' );
78
- $field_name = $this -> get_field_name( 'dynamic' );
79
- echo "\r\n" . '<tr><td width="100%">' . __( 'Dynamically Resize' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
80
- if ( attribute_escape( $instance[ 'dynamic' ] ) == '' ) { echo " selected='selected'"; }
81
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
82
- if ( attribute_escape( $instance[ 'dynamic' ] ) == '0' ) { echo " selected='selected'"; }
83
- echo '>' . __( 'No' ) . '</option><option value="1"';
84
- if ( attribute_escape( $instance[ 'dynamic' ] ) == '1' ) { echo " selected='selected'"; }
85
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
86
-
87
- // Embed type field
88
-
89
- $field_id = $this -> get_field_id( 'type' );
90
- $field_name = $this -> get_field_name( 'type' );
91
- echo "\r\n" . '<tr><td width="100%">' . __( 'Embed Type' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
92
- if ( attribute_escape( $instance[ 'type' ] ) == '' ) { echo " selected='selected'"; }
93
- echo '>' . __( 'Profile default' ) . '</option><option value="v"';
94
- if ( attribute_escape( $instance[ 'type' ] ) == 'v' ) { echo " selected='selected'"; }
95
- echo '>' . __( 'IFRAME' ) . '</option><option value="p"';
96
- if ( attribute_escape( $instance[ 'type' ] ) == 'p' ) { echo " selected='selected'"; }
97
- echo '>' . __( 'OBJECT' ) . '</option><option value="m"';
98
- if ( attribute_escape( $instance[ 'type' ] ) == 'c' ) { echo " selected='selected'"; }
99
- echo '>' . __( 'Chromeless' ) . '</option><option value="c"';
100
- if ( attribute_escape( $instance[ 'type' ] ) == 'm' ) { echo " selected='selected'"; }
101
- echo '>' . __( 'EmbedPlus' ) . '</option></select></td></tr>';
102
-
103
- // Autoplay field
104
-
105
- $field_id = $this -> get_field_id( 'autoplay' );
106
- $field_name = $this -> get_field_name( 'autoplay' );
107
- echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
108
- if ( attribute_escape( $instance[ 'autoplay' ] ) == '' ) { echo " selected='selected'"; }
109
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
110
- if ( attribute_escape( $instance[ 'autoplay' ] ) == '0' ) { echo " selected='selected'"; }
111
- echo '>' . __( 'No' ) . '</option><option value="1"';
112
- if ( attribute_escape( $instance[ 'autoplay' ] ) == '1' ) { echo " selected='selected'"; }
113
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
114
-
115
- // Start field
116
-
117
- $field_id = $this -> get_field_id( 'start' );
118
- $field_name = $this -> get_field_name( 'start' );
119
- 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>';
120
-
121
- // Stop field
122
-
123
- $field_id = $this -> get_field_id( 'stop' );
124
- $field_name = $this -> get_field_name( 'stop' );
125
- 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>';
126
-
127
- echo "</table>\n";
128
-
129
- ?>
130
- <h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
131
- <?php
132
-
133
- echo "<table>\n";
134
-
135
- // List field
136
-
137
- $field_id = $this -> get_field_id( 'list' );
138
- $field_name = $this -> get_field_name( 'list' );
139
- echo "\r\n" . '<tr><td width="100%">' . __( 'List Playback' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
140
- if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
141
- echo '>' . __( 'Profile default' ) . '</option><option value="order"';
142
- if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
143
- echo '>' . __( 'Play each video in order' ) . '</option><option value="random"';
144
- if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
145
- echo '>' . __( 'Play videos randomly' ) . '</option><option value="single"';
146
- if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
147
- echo '>' . __( 'Play one random video' ) . '</option></select></td></tr>';
148
-
149
- // Loop video field
150
-
151
- $field_id = $this -> get_field_id( 'loop' );
152
- $field_name = $this -> get_field_name( 'loop' );
153
- echo "\r\n" . '<tr><td width="100%">' . __( 'Loop Video' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
154
- if ( attribute_escape( $instance[ 'loop' ] ) == '' ) { echo " selected='selected'"; }
155
- echo '>' . __( 'Profile default' ) . '</option><option value="0"';
156
- if ( attribute_escape( $instance[ 'loop' ] ) == '0' ) { echo " selected='selected'"; }
157
- echo '>' . __( 'No' ) . '</option><option value="1"';
158
- if ( attribute_escape( $instance[ 'loop' ] ) == '1' ) { echo " selected='selected'"; }
159
- echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
160
-
161
- echo "</table>\n";
162
- ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/{aye-update-post-content.php → content.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * Process the post/page content for embed requests
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
 
@@ -14,20 +14,20 @@
14
  * Look through post/page content for various alternative methods of embedding - replace with
15
  * embed code.
16
  *
17
- * @since 2.0
18
  *
19
- * @uses aye_convert_content Convert a URL to the embed code
20
- * @uses aye_generate_youtube_code Generate the YouTube embed code
21
- * @uses aye_set_general_defaults Get general defaults
22
- * @uses aye_validate_id Validate the video ID
23
  *
24
  * @param string $content Post/page content
25
  * @return string Resulting post/page content
26
  */
27
 
28
- function aye_content_search( $content ) {
29
 
30
- $options = aye_set_general_defaults();
31
 
32
  // The following are URL modifications
33
 
@@ -41,29 +41,29 @@ function aye_content_search( $content ) {
41
  // Search for httpv URL
42
  $identifier = 'httpv://www.youtube.com/watch?v=';
43
  $search = strpos( $content, $identifier );
44
- if ( $search !== false ) { $content = aye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), '', '', $options[ 'other_profile' ] ); $changed = true; }
45
 
46
  // Search for httpa URL
47
  $identifier = 'httpa://www.youtube.com/watch?v=';
48
  $search = strpos( $content, $identifier );
49
- if ( $search !== false ) { $content = aye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), 1, '', $options[ 'other_profile' ] ); $changed = true; }
50
 
51
  // Search for httpvh URL
52
  $identifier = 'httpvh://www.youtube.com/watch?v=';
53
  $search = strpos( $content, $identifier );
54
- if ( $search !== false ) { $content = aye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), '', '', $options[ 'other_profile' ] ); $changed = true; }
55
 
56
  // Search for httpvp playlist URL
57
  $identifier = 'httpvp://www.youtube.com/watch?p=';
58
  $search = strpos( $content, $identifier );
59
- if ( $search !== false ) { $content = aye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 16 ), '', '', $options[ 'other_profile' ] ); $changed = true; }
60
 
61
  // Search for youtube:: URL
62
  $identifier = 'youtube::';
63
  $search = strpos( $content, $identifier );
64
  if ( $search !== false ) {
65
  $suffix = substr( $content, $search + strlen( $identifier ) + 11, 2 );
66
- if ( $suffix == '::' ) { $content = aye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), '', '::', $options[ 'other_profile' ] ); $changed = true; }
67
  }
68
  }
69
 
@@ -74,13 +74,12 @@ function aye_content_search( $content ) {
74
  if ( $options[ 'bracket' ] == 1 ) {
75
 
76
  // Loop around content, looking for brackets - possible YouTube URL within!
77
-
78
  $current_pos = 0;
79
  $bracket_found = true;
80
 
81
- while ( $bracket_found ) {
82
  $open_bracket = strpos( $content, '[', $current_pos );
83
-
84
  if ($open_bracket !== false) {
85
  $close_bracket = strpos( $content, ']', $open_bracket );
86
 
@@ -90,18 +89,15 @@ function aye_content_search( $content ) {
90
  $id = $code;
91
 
92
  // Maybe a video ID - validate first
93
-
94
  if ( ( strlen( $code ) == 11 ) && ( !strpos( $code, ' ' ) ) ) {
95
- $type = aye_validate_id( $code );
96
  if ( $type == 'v' ) { $code_found = true; }
97
  }
98
 
99
  // Video URL
100
-
101
  if ( ( strpos ($code, 'youtube.com/watch?v=' ) !== false ) && ( !$code_found ) ) { $code_found = true; }
102
 
103
  // Other URLs
104
-
105
  if ( ( substr( $code, 0, 8 ) == 'watch?v=' ) && ( !$code_found ) ) {
106
  $id = substr( $code, 8 );
107
  $code_found = true;
@@ -112,9 +108,8 @@ function aye_content_search( $content ) {
112
  }
113
 
114
  // If an ID was found, update the code
115
-
116
  if ( $code_found ) {
117
- $ye_code = aye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $options[ 'other_profile' ], '', '' );
118
  $content = str_replace( '[' . $code . ']', $ye_code, $content );
119
  }
120
  }
@@ -124,19 +119,49 @@ function aye_content_search( $content ) {
124
  }
125
  }
126
  }
127
-
128
  return $content;
129
  }
130
- add_filter( 'the_content', 'aye_content_search' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  /**
133
  * Convert the Content
134
  *
135
  * Convert the URL to the embed code
136
  *
137
- * @since 2.0
138
  *
139
- * @uses aye_generate_youtube_code Generate the embed code
140
  *
141
  * @param string $content The post content
142
  * @param string $identifier The text that identifies the embed
@@ -147,11 +172,11 @@ add_filter( 'the_content', 'aye_content_search' );
147
  * @return string Content to return
148
  */
149
 
150
- function aye_convert_content( $content, $identifier, $id, $audio = '', $suffix = '', $profile = '' ) {
151
-
152
- $code = aye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $profile, '', $audio );
153
  $content = str_replace( $identifier.$id.$suffix, $code, $content);
154
-
155
  return $content;
156
  }
157
 
@@ -160,31 +185,30 @@ function aye_convert_content( $content, $identifier, $id, $audio = '', $suffix =
160
  *
161
  * Filter comments and add YouTube embeds
162
  *
163
- * @since 2.0
164
  *
165
- * @uses aye_set_general_defaults Get the general defaults
166
- * @uses aye_generate_youtube_code Generate the YouTube embed code
167
  *
168
  * @param string $content The comments content
169
  * @return string Content to return
170
  */
171
 
172
- function aye_filter_comments( $content ) {
173
-
174
- $options = aye_set_general_defaults();
175
 
 
 
176
  if ( $options[ 'comments' ] == 1 ) {
177
-
178
  $identifier = 'http://www.youtube.com/watch?v=';
179
  $search_pos = 0;
180
  $search = strpos( $content, $identifier, $search_pos );
181
-
182
  while ( $search !== false ) {
183
  $prefix = substr( $content, $search - 1, 1 );
184
  if ( ( $prefix != ']' ) && ( $prefix != '"' ) && ( $prefix != "'" ) ) {
185
 
186
  // Check if link around video. If so, work out how much more needs stripping out
187
-
188
  $anchor_start = 0;
189
  $anchor_end = 0;
190
  if ( $prefix == ">" ) {
@@ -196,12 +220,10 @@ function aye_filter_comments( $content ) {
196
  }
197
 
198
  // Work out video ID and generate code
199
-
200
  $id = substr( $content, $search + strlen( $identifier ), 11 );
201
- $code = aye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $options[ 'comments_profile' ], '', '' );
202
 
203
  // Now replace the URL with the resultant code
204
-
205
  $first_section = $search - 1 - $anchor_start;
206
  if ( $first_section < 1 ) {
207
  $content = $code . substr( $content, $search + strlen( $identifier ) + 11 + $anchor_end );
@@ -218,5 +240,5 @@ function aye_filter_comments( $content ) {
218
  }
219
  return $content;
220
  }
221
- add_filter( 'comment_text', 'aye_filter_comments' );
222
  ?>
4
  *
5
  * Process the post/page content for embed requests
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
 
14
  * Look through post/page content for various alternative methods of embedding - replace with
15
  * embed code.
16
  *
17
+ * @since 2.0
18
  *
19
+ * @uses ye_convert_content Convert a URL to the embed code
20
+ * @uses ye_generate_youtube_code Generate the YouTube embed code
21
+ * @uses ye_set_general_defaults Get general defaults
22
+ * @uses ye_validate_id Validate the video ID
23
  *
24
  * @param string $content Post/page content
25
  * @return string Resulting post/page content
26
  */
27
 
28
+ function ye_content_search( $content ) {
29
 
30
+ $options = ye_set_general_defaults();
31
 
32
  // The following are URL modifications
33
 
41
  // Search for httpv URL
42
  $identifier = 'httpv://www.youtube.com/watch?v=';
43
  $search = strpos( $content, $identifier );
44
+ if ( $search !== false ) { $content = ye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), '', '', $options[ 'other_profile' ] ); $changed = true; }
45
 
46
  // Search for httpa URL
47
  $identifier = 'httpa://www.youtube.com/watch?v=';
48
  $search = strpos( $content, $identifier );
49
+ if ( $search !== false ) { $content = ye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), 1, '', $options[ 'other_profile' ] ); $changed = true; }
50
 
51
  // Search for httpvh URL
52
  $identifier = 'httpvh://www.youtube.com/watch?v=';
53
  $search = strpos( $content, $identifier );
54
+ if ( $search !== false ) { $content = ye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), '', '', $options[ 'other_profile' ] ); $changed = true; }
55
 
56
  // Search for httpvp playlist URL
57
  $identifier = 'httpvp://www.youtube.com/watch?p=';
58
  $search = strpos( $content, $identifier );
59
+ if ( $search !== false ) { $content = ye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 16 ), '', '', $options[ 'other_profile' ] ); $changed = true; }
60
 
61
  // Search for youtube:: URL
62
  $identifier = 'youtube::';
63
  $search = strpos( $content, $identifier );
64
  if ( $search !== false ) {
65
  $suffix = substr( $content, $search + strlen( $identifier ) + 11, 2 );
66
+ if ( $suffix == '::' ) { $content = ye_convert_content( $content, $identifier, substr( $content, $search + strlen( $identifier ), 11 ), '', '::', $options[ 'other_profile' ] ); $changed = true; }
67
  }
68
  }
69
 
74
  if ( $options[ 'bracket' ] == 1 ) {
75
 
76
  // Loop around content, looking for brackets - possible YouTube URL within!
 
77
  $current_pos = 0;
78
  $bracket_found = true;
79
 
80
+ while ( $bracket_found ) {
81
  $open_bracket = strpos( $content, '[', $current_pos );
82
+
83
  if ($open_bracket !== false) {
84
  $close_bracket = strpos( $content, ']', $open_bracket );
85
 
89
  $id = $code;
90
 
91
  // Maybe a video ID - validate first
 
92
  if ( ( strlen( $code ) == 11 ) && ( !strpos( $code, ' ' ) ) ) {
93
+ $type = ye_validate_id( $code );
94
  if ( $type == 'v' ) { $code_found = true; }
95
  }
96
 
97
  // Video URL
 
98
  if ( ( strpos ($code, 'youtube.com/watch?v=' ) !== false ) && ( !$code_found ) ) { $code_found = true; }
99
 
100
  // Other URLs
 
101
  if ( ( substr( $code, 0, 8 ) == 'watch?v=' ) && ( !$code_found ) ) {
102
  $id = substr( $code, 8 );
103
  $code_found = true;
108
  }
109
 
110
  // If an ID was found, update the code
 
111
  if ( $code_found ) {
112
+ $ye_code = ye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $options[ 'other_profile' ], '', '' );
113
  $content = str_replace( '[' . $code . ']', $ye_code, $content );
114
  }
115
  }
119
  }
120
  }
121
  }
122
+
123
  return $content;
124
  }
125
+ add_filter( 'the_content', 'ye_content_search' );
126
+
127
+ /**
128
+ * Embed Handler
129
+ *
130
+ * Override the WP embed handler. Allows address and embed URLS types as well as playlists.
131
+ *
132
+ * @since 2.0
133
+ *
134
+ * @uses ye_set_general_defaults Fetch default profile option
135
+ * @uses ye_generate_youtube_code Generate the embed code
136
+ *
137
+ * @param array $matches The regex matches from the provided regex when calling
138
+ * @param array $attr Embed attributes
139
+ * @param string $url The original URL that was matched by the regex
140
+ * @param array $rawattr The original unmodified attributes
141
+ * @return string The embed HTML
142
+ */
143
+
144
+ function ye_embed_handler( $matches, $attr, $url, $rawattr ) {
145
+
146
+ $options = ye_set_general_defaults();
147
+ $code = ye_generate_youtube_code( $matches[ 1 ], '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $options[ 'url_profile' ], '', '' );
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
  /**
158
  * Convert the Content
159
  *
160
  * Convert the URL to the embed code
161
  *
162
+ * @since 2.0
163
  *
164
+ * @uses ye_generate_youtube_code Generate the embed code
165
  *
166
  * @param string $content The post content
167
  * @param string $identifier The text that identifies the embed
172
  * @return string Content to return
173
  */
174
 
175
+ function ye_convert_content( $content, $identifier, $id, $audio = '', $suffix = '', $profile = '' ) {
176
+
177
+ $code = ye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $profile, '', $audio );
178
  $content = str_replace( $identifier.$id.$suffix, $code, $content);
179
+
180
  return $content;
181
  }
182
 
185
  *
186
  * Filter comments and add YouTube embeds
187
  *
188
+ * @since 2.0
189
  *
190
+ * @uses ye_set_general_defaults Get the general defaults
191
+ * @uses ye_generate_youtube_code Generate the YouTube embed code
192
  *
193
  * @param string $content The comments content
194
  * @return string Content to return
195
  */
196
 
197
+ function ye_filter_comments( $content ) {
 
 
198
 
199
+ $options = ye_set_general_defaults();
200
+
201
  if ( $options[ 'comments' ] == 1 ) {
202
+
203
  $identifier = 'http://www.youtube.com/watch?v=';
204
  $search_pos = 0;
205
  $search = strpos( $content, $identifier, $search_pos );
206
+
207
  while ( $search !== false ) {
208
  $prefix = substr( $content, $search - 1, 1 );
209
  if ( ( $prefix != ']' ) && ( $prefix != '"' ) && ( $prefix != "'" ) ) {
210
 
211
  // Check if link around video. If so, work out how much more needs stripping out
 
212
  $anchor_start = 0;
213
  $anchor_end = 0;
214
  if ( $prefix == ">" ) {
220
  }
221
 
222
  // Work out video ID and generate code
 
223
  $id = substr( $content, $search + strlen( $identifier ), 11 );
224
+ $code = ye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $options[ 'comments_profile' ], '', '' );
225
 
226
  // Now replace the URL with the resultant code
 
227
  $first_section = $search - 1 - $anchor_start;
228
  if ( $first_section < 1 ) {
229
  $content = $code . substr( $content, $search + strlen( $identifier ) + 11 + $anchor_end );
240
  }
241
  return $content;
242
  }
243
+ add_filter( 'comment_text', 'ye_filter_comments' );
244
  ?>
includes/{aye-deprecated.php → deprecated.php} RENAMED
@@ -4,18 +4,18 @@
4
  *
5
  * Various pieces of code, now deprecated, but kept here for backwards compatibility
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
 
11
  // Shortcode for showing playlists - can now use the standard video shortcode
12
  // In fact, this shortcode now simply directs to the video shortcode
13
- add_shortcode( 'youtube_playlist', 'aye_video_shortcode' );
14
 
15
  // Shortcode for downloading playlist - in fact, this never worked as option doesn't
16
  // allow playlists. None-the-less, now diverts to standard download shortcode
17
  // and will display an appropriate error
18
- add_shortcode( 'download_playlist', 'aye_video_download' );
19
 
20
  /**
21
  * Embed a playlist
@@ -52,7 +52,7 @@ function youtube_playlist_embed( $content, $paras, $style = '' ) {
52
  */
53
 
54
  function get_playlist_download( $id = '' ) {
55
- echo aye_error( __( 'This function does not support playlists' ) );
56
  return;
57
  }
58
  ?>
4
  *
5
  * Various pieces of code, now deprecated, but kept here for backwards compatibility
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
 
11
  // Shortcode for showing playlists - can now use the standard video shortcode
12
  // In fact, this shortcode now simply directs to the video shortcode
13
+ add_shortcode( 'youtube_playlist', 'ye_video_shortcode' );
14
 
15
  // Shortcode for downloading playlist - in fact, this never worked as option doesn't
16
  // allow playlists. None-the-less, now diverts to standard download shortcode
17
  // and will display an appropriate error
18
+ add_shortcode( 'download_playlist', 'ye_video_download' );
19
 
20
  /**
21
  * Embed a playlist
52
  */
53
 
54
  function get_playlist_download( $id = '' ) {
55
+ echo ye_error( 'This function does not support playlists' );
56
  return;
57
  }
58
  ?>
includes/function-calls.php ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Function Calls
4
+ *
5
+ * Various function calls that the user may call directly
6
+ *
7
+ * @package YouTubeEmbed
8
+ */
9
+
10
+ /**
11
+ * Embed a YouTube video
12
+ *
13
+ * Write out XHTML to embed a YouTube video
14
+ *
15
+ * @since 2.0
16
+ *
17
+ * @uses ye_get_parameters Extract parameters from input
18
+ * @uses ye_get_embed_type Work out the correct embed type to use
19
+ * @uses ye_set_autohide Set correct autohide parameter
20
+ * @uses ye_generate_youtube_code Generate the YouTube code
21
+ *
22
+ * @param string $content YouTube video ID
23
+ * @param string $paras List of parameters
24
+ * @param string $style Optional CSS
25
+ */
26
+
27
+ function youtube_video_embed( $content, $paras = '', $style = '' ) {
28
+ $width = ye_get_parameters( $paras, 'width' );
29
+ $height = ye_get_parameters( $paras, 'height' );
30
+ $fullscreen = ye_get_parameters( $paras, 'fullscreen' );
31
+ $related = ye_get_parameters( $paras, 'related' );
32
+ $autoplay = ye_get_parameters( $paras, 'autoplay' );
33
+ $loop = ye_get_parameters( $paras, 'loop' );
34
+ $start = ye_get_parameters( $paras, 'start' );
35
+ $info = ye_get_parameters( $paras, 'info' );
36
+ $annotation = ye_get_parameters( $paras, 'annotation' );
37
+ $cc = ye_get_parameters( $paras, 'cc' );
38
+ $link = ye_get_parameters( $paras, 'link' );
39
+ $react = ye_get_parameters( $paras, 'react' );
40
+ $stop = ye_get_parameters( $paras, 'stop' );
41
+ $sweetspot = ye_get_parameters( $paras, 'sweetspot' );
42
+ $embedplus = ye_get_parameters( $paras, 'embedplus' );
43
+ $disablekb = ye_get_parameters( $paras, 'disablekb' );
44
+ $ratio = ye_get_parameters( $paras, 'ratio' );
45
+ $autohide = ye_get_parameters( $paras, 'autohide' );
46
+ $controls = ye_get_parameters( $paras, 'controls' );
47
+ $type = ye_get_parameters( $paras, 'type' );
48
+ $profile = ye_get_parameters( $paras, 'profile' );
49
+ $list = ye_get_parameters( $paras, 'list' );
50
+ $audio = ye_get_parameters( $paras, 'audio' );
51
+ $template = ye_get_parameters( $paras, 'template' );
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 );
59
+
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
+
67
+ /**
68
+ * Display a video thumbnail
69
+ *
70
+ * Display a thumbnail of a video
71
+ *
72
+ * @since 2.0
73
+ *
74
+ * @uses ye_get_parameters Extract parameters from a string
75
+ * @uses ye_generate_thumbnaik_code Get the thumbnail code
76
+ *
77
+ * @param string $content YouTube video ID
78
+ * @param string $paras Parameters
79
+ * @param string $style CSS information
80
+ * @param string $alt Alt text
81
+ */
82
+
83
+ function youtube_thumb_embed( $content, $paras = '', $style = '', $alt = '' ) {
84
+
85
+ $class = ye_get_parameters( $paras, 'class' );
86
+ $rel = ye_get_parameters( $paras, 'rel' );
87
+ $target = ye_get_parameters( $paras, 'target' );
88
+ $width = ye_get_parameters( $paras, 'width' );
89
+ $height = ye_get_parameters( $paras, 'height' );
90
+ $version = ye_get_parameters( $paras, 'version' );
91
+
92
+ echo ye_generate_thumbnail_code( $content, $style, $class, $rel, $target, $width, $height, $alt, $version );
93
+
94
+ return;
95
+ }
96
+
97
+ /**
98
+ * Return video short URL
99
+ *
100
+ * Return a short URL for the YouTube video
101
+ *
102
+ * @since 2.0
103
+ *
104
+ * @uses ye_generate_shorturl_code Display an error
105
+ *
106
+ * @param string $id YouTube video ID
107
+ * @return string Download URL
108
+ */
109
+
110
+ function youtube_short_url( $id ) {
111
+ return ye_generate_shorturl_code( $id );
112
+ }
113
+
114
+ /**
115
+ * Get video download URL
116
+ *
117
+ * Return a URL for the video so that it can be downloaded
118
+ *
119
+ * @since 2.0
120
+ *
121
+ * @uses ye_generate_download_code Get the download URL
122
+ *
123
+ * @param string $id YouTube video ID
124
+ * @return string Download URL
125
+ */
126
+
127
+ function get_video_download( $id ) {
128
+ return ye_generate_download_code( $id );
129
+ }
130
+
131
+ /**
132
+ * Get XML transcript
133
+ *
134
+ * Return XML formatted YouTube transcript
135
+ *
136
+ * @since 2.0
137
+ *
138
+ * @uses ye_error Output an error
139
+ * @uses ye_extract_id Extract a video ID
140
+ * @uses ye_get_file Get a file
141
+ * @uses ye_validate_id Check the video ID is valid
142
+ *
143
+ * @param string $id YouTube video ID
144
+ * @return string Transcript file in XML format
145
+ */
146
+
147
+ function get_youtube_transcript_xml ( $id ) {
148
+
149
+ // Extract the ID if a full URL has been specified
150
+ $id = ye_extract_id( $id );
151
+
152
+ // Check what type of video it is and whether it's valid
153
+ $embed_type = ye_validate_id( $id );
154
+ if ( $embed_type != 'v' ) {
155
+ if ( strlen( $embed_type ) > 1 ) {
156
+ echo ye_error( $embed_type );
157
+ } else {
158
+ echo ye_error( 'The YouTube ID of ' . $id . ' is invalid.' );
159
+ }
160
+ return;
161
+ }
162
+
163
+ // Get transcript file
164
+ $filename = 'http://video.google.com/timedtext?lang=en&v=' . $id;
165
+ $xml = ye_get_file( $filename );
166
+
167
+ // Check success and return appropriate output
168
+ if ( $xml[ 'rc' ] > 0 ) {
169
+ echo ye_error( 'Could not fetch the transcript file ' . $filename . '.' );
170
+ return;
171
+ } else {
172
+ return $xml;
173
+ }
174
+ }
175
+
176
+ /**
177
+ * Get transcript
178
+ *
179
+ * Return XHTML formatted YouTube transcript
180
+ *
181
+ * @since 2.0
182
+ *
183
+ * @uses ye_generate_generatE_transcript Generate the transcript output
184
+ *
185
+ * @param string $id YouTube video ID
186
+ * @return string Transcript file in XHTML format
187
+ */
188
+
189
+ function get_youtube_transcript( $id ) {
190
+ return ye_generate_transcript( $id );
191
+ }
192
+
193
+ /**
194
+ * Get Video Name
195
+ *
196
+ * Function to return the name of a YouTube video
197
+ *
198
+ * @since 2.0
199
+ *
200
+ * @uses ye_extract_id Extract the video ID
201
+ * @uses ye_validate_id Get the name and video type
202
+ * @uses ye_error Return an error
203
+ *
204
+ * @param string $id Video ID
205
+ * @return string Video name
206
+ */
207
+
208
+ function get_youtube_name( $id ) {
209
+
210
+ // Extract the ID if a full URL has been specified
211
+ $id = ye_extract_id( $id );
212
+
213
+ // Check what type of video it is and whether it's valid
214
+ $return = ye_validate_id( $id, true );
215
+ $embed_type = $return[ 'type' ];
216
+ if ( strlen( $embed_type ) > 1 ) {
217
+ echo ye_error( $embed_type );
218
+ } else {
219
+ echo ye_error( 'The YouTube ID of ' . $id . ' is invalid.' );
220
+ }
221
+
222
+ // Return the video title
223
+ return $return['title'];
224
+ }
225
+ ?>
includes/generate-download-code.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Generate Download Code
4
+ *
5
+ * Create code to allow a YouTube video to be downloaded
6
+ *
7
+ * @package YouTubeEmbed
8
+ * @since 2.0
9
+ *
10
+ * @uses ye_extract_id Extract an ID from a string
11
+ * @uses ye_validate_id Confirm the type of video
12
+ * @uses ye_error Display an error
13
+ *
14
+ * @param string $id YouTube video ID
15
+ * @param string $target Link target
16
+ * @param string $nofollow Use rel="nofollow" ?
17
+ * @param string $text Text to add link to
18
+ * @return string URL
19
+ */
20
+
21
+ function ye_generate_download_code( $id ) {
22
+
23
+ if ( $id == '' ) { return ye_error( 'No YouTube ID was found.' ); }
24
+
25
+ // Extract the ID if a full URL has been specified
26
+ $id = ye_extract_id( $id );
27
+
28
+ // Check what type of video it is and whether it's valid
29
+ $embed_type = ye_validate_id( $id );
30
+ if ( $embed_type != 'v' ) {
31
+ if ( strlen( $embed_type ) > 1 ) {
32
+ return ye_error( $embed_type );
33
+ } else {
34
+ return ye_error( 'The YouTube ID of ' . $id . ' is invalid.' );
35
+ }
36
+ }
37
+
38
+ // Create the link
39
+ return 'http://www.savevid.com/?url=http://www.youtube.com/watch?' . $embed_type . '=' . $id;
40
+ }
41
+ ?>
includes/{aye-generate-embed-code.php → generate-embed-code.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * Functions calls to generate the required YouTube code
6
  *
7
- * @package Artiss-YouTube-Embed
8
  */
9
 
10
  /**
@@ -14,13 +14,14 @@
14
  *
15
  * @since 2.0
16
  *
17
- * @uses aye_error Display an error
18
- * @uses aye_extract_id Get the video ID
19
- * @uses aye_validate_list Get the requested listr
20
- * @uses aye_validate_id Validate the video ID
21
- * @uses aye_validate_profile Get the requested profile
22
- * @uses aye_set_general_defaults Get general options
23
- * @uses aye_set_profile_defaults Set default profile options
 
24
  *
25
  * @param string $id Video ID
26
  * @param string $type Embed type
@@ -51,118 +52,91 @@
51
  * @param string $color Progress bar colour
52
  * @param string $theme Use dark or light theme
53
  * @param string $https Use HTTPS for links
54
- * @param string $title Video title
55
- * @param string $dynamic Show dynamic output
56
- * @param string $search Perform a search
57
- * @param string $user Look up user videos
58
  * @return string Code output
59
  */
60
 
61
- function aye_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 = '', $search = '', $user = '' ) {
62
 
63
  // Ensure an ID is passed
64
-
65
- if ( $id == '' ) { return aye_error( __( 'No video/playlist ID has been supplied' ) ); }
66
 
67
  // Get general options
 
68
 
69
- $general = aye_set_general_defaults();
70
-
71
- // Find the profile, if one is specified
72
-
73
- $profile = aye_validate_profile( $profile, $general[ 'profile_no' ] );
74
-
75
- // Get default values if no values are supplied
76
-
77
- $options = aye_set_profile_defaults( $profile );
78
-
79
- // If a user look-up or search has been requested, mis-out looking up list details and
80
- // simple assign it as an IFRAME video
81
-
82
- if ( ( $user == 0 ) && ( $search == 0 ) ) {
83
-
84
- // Check it's not a list
85
-
86
- $playlist_ids = '';
87
- $list = aye_validate_list( $id, $general[ 'list_no' ] );
88
- if ( !is_array( $list ) ) {
89
-
90
- // Check if certain parameters are included in the URL
91
 
92
- $width = aye_get_url_para( $id, 'w', $width );
93
- $height = aye_get_url_para( $id, 'h', $height );
94
 
95
- // Extract the ID if a full URL has been specified
 
 
 
96
 
97
- $id = aye_extract_id( $id );
 
 
98
 
99
- // Is it being previewed? In which case remove any cache
 
100
 
101
- if ( ( preg_match( '/p=([0-9]*)&preview=true/', $_SERVER['QUERY_STRING'] ) == 1 ) && ( $general[ 'preview' ] == 1 ) ) {
102
- delete_transient( 'aye_type_' . $id );
103
- delete_transient( 'aye_title_' . $id );
104
- }
105
-
106
- // Check what type of video it is and whether it's valid
107
-
108
- $return = aye_validate_id( $id, true );
109
- $title = $return['title'];
110
- $embed_type = $return[ 'type' ];
111
-
112
- // If the video is invalid, output an appropriate error
113
-
114
- if ( ( $embed_type == '' ) or ( strlen ( $embed_type ) != 1 ) ) {
115
- if ( $embed_type == '' ) {
116
- $error = 'The YouTube ID of ' . $id . ' is invalid.';
117
- } else {
118
- $error = $embed_type;
119
- }
120
- $result = "\n<!-- YouTube Embed v" . youtube_embed_version . " | http://www.artiss.co.uk/artiss-youtube-embed -->\n";
121
- $result .= "<!-- " . $error . " -->\n" . aye_decode( $general[ 'error_message' ] ) . "\n<!-- End of YouTube Embed code -->\n";
122
- return $result;
123
- }
124
-
125
- } else {
126
-
127
- $embed_type = 'v';
128
-
129
- // Randomize the video
130
 
131
- if ( $list_style == 'random' ) { shuffle( $list ); }
 
 
 
132
 
133
- // Extract one video randomly
 
 
 
 
 
 
 
 
 
 
134
 
135
- if ( $list_style == 'single' ) {
136
- $id = $list[ array_rand( $list, 1 ) ];
137
 
138
- // Build the playlist
139
 
140
- } else {
 
141
 
142
- $id = $list [ 0 ];
143
- $title = '';
 
144
 
145
- // Build the playlist
 
146
 
147
- if ( count( $list ) > 1 ) {
148
- $loop = 1;
149
- while ( $loop < count( $list ) ) {
150
- if ( $playlist_ids != '' ) { $playlist_ids .= ','; }
151
- $list_id = aye_extract_id( $list[ $loop ] );
152
- $playlist_ids .= $list_id;
153
- $loop ++;
154
- }
155
- }
156
- }
157
- }
158
- }
 
 
159
 
160
  // Generate a cache key for the above passed parameters
161
-
162
- $cache_key = 'aye_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 . $search . $user . $title . print_r( $general, true ) . print_r( $options, true ) . print_r( $list, true ) ) );
163
 
164
  // Try and get the output from cache. If it exists, return the code
165
-
166
  if ( ( $general[ 'embed_cache' ] != 0 ) && ( !is_feed() ) ) {
167
  $result = get_transient( $cache_key );
168
  if ( $result !== false) { return $result; }
@@ -171,12 +145,10 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
171
  $metadata = $general[ 'metadata' ];
172
 
173
  // Work out correct protocol to use - HTTP or HTTPS
174
-
175
  if ( $https == '' ) { $https = $options[ 'https' ]; }
176
  if ( $https == 1 ) { $https = 's'; } else { $https = ''; }
177
 
178
  // If this is a feed then display a thumbnail and/or text link to the original video
179
-
180
  if ( is_feed () ) {
181
  $result = '';
182
  if ( $playlist_ids != '' ) {
@@ -184,31 +156,18 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
184
  } else {
185
  $youtube_url = 'http' . $https . '://www.youtube.com/watch?' . $embed_type . '=' . $id;
186
  if ( ( $embed_type == 'v' ) && ( $general[ 'feed' ] != 't' ) ) { $result .= '<p><a href="' . $youtube_url . '"><img src="http://img.youtube.com/vi/' . $id . '/' . $general[ 'thumbnail' ] . ".jpg\"></a></p>\n"; }
187
- if ( ( $general ['feed'] != 'v' ) or ( $embed_type != 'v' ) ) { $result .= '<p><a href="' . $youtube_url . '">' . __( 'Click here to view the video on YouTube' ) . "</a>.</p>\n"; }
188
  }
189
  return $result;
190
  }
191
 
192
- // If a dynamic size has been requested, check whether the width should be fixed
193
-
194
- $fixed = 0;
195
- if ( $dynamic == '' ) {
196
- $dynamic = $options[ 'dynamic' ];
197
- $fixed = $options[ 'fixed' ];
198
- } else {
199
- if ( $width != '' ) { $fixed = 1; }
200
- }
201
-
202
  // Only set width and height from defaults if both are missing
203
-
204
  if ( ( $width == '' ) && ( $height == '' ) ) {
205
-
206
  $width = $options[ 'width' ];
207
  $height = $options[ 'height' ];
208
  }
209
 
210
  // If values have not been pressed, use the default values
211
-
212
  if ( $fullscreen == '' ) { $fullscreen = $options[ 'fullscreen' ]; }
213
  if ( $related == '' ) { $related = $options[ 'related' ]; }
214
  if ( $autoplay == '' ) { $autoplay = $options[ 'autoplay' ]; }
@@ -229,25 +188,20 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
229
  if ( $theme == '' ) { $theme = $options[ 'theme' ]; }
230
 
231
  $wmode = $options[ 'wmode' ];
232
-
233
- if ( $theme == '' ) { $theme = $options[ 'theme' ]; }
234
 
235
  // Build the required template
236
-
237
- if ( $template == '' ) { $template = $options[ 'template' ]; } else { $template = aye_decode( $template ); }
238
  if ( strpos( $template, '%video%' ) === false ) { $template = '%video%'; }
239
 
240
  // If a multi-play list has been specified and EmbedPlus selected, use fallback embedding method instead
241
-
242
  if ( ( $playlist_ids != '' ) && ( $type == 'm' ) && ( $list_style != 'single' ) ) { $type = $options[ 'fallback' ]; }
243
 
244
  // If looping and no playlist has been generated, add the current ID
245
  // This is a workaround for the AS3 player which won't otherwise loop
246
-
247
  if ( ( $loop == 1 ) && ( $embed_type != 'p' ) && ( $playlist_ids == '' ) ) { $playlist_ids = $id; }
248
 
249
  // If no type was specified, depending on whether this is a video or playlist, set the specific default
250
-
251
  if ( $type == '' ) {
252
  if ( $embed_type == 'v' ) {
253
  $type = $options[ 'type' ];
@@ -256,23 +210,15 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
256
  }
257
  }
258
 
259
- // If a playlist, user or search was specified and this is is Chromeless, switch back to IFRAME to allow
260
-
261
- if ( ( ( $embed_type == 'p' ) or ( $user != 0 ) or ( $search != 0 ) ) && ( $type == 'c' ) ) { $type = 'v'; }
262
-
263
  // Set parameters without default values
264
-
265
  if ( $start == '' ) { $start = '0'; }
266
  if ( $stop == '' ) { $stop = '0'; }
267
 
268
  // If height or width is missing, calculate missing parameter using ratio
269
-
270
  if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
271
  $ratio_to_use = '';
272
  if ( $ratio != '' ) {
273
-
274
  // Extract the ratio from the provided string
275
-
276
  $pos = strpos( $ratio, ':', 0 );
277
  if ( $pos !== false ) {
278
  $ratio_l = substr( $ratio, 0, $pos );
@@ -282,63 +228,45 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
282
  }
283
 
284
  // If no, or invalid, ratio supplied, calculate from the default video dimensions
285
-
286
  if ( $ratio_to_use == '' ) { $ratio_to_use = $options[ 'width' ] / $options[ 'height' ]; }
287
 
288
  // Complete the missing width or height using the ratio
289
-
290
  if ( $width == '' ) { $width = round( $height * $ratio_to_use, 0); }
291
  if ( $height == '' ) { $height = round( $width / $ratio_to_use, 0); }
292
  }
293
 
294
- // Set Frameborder output
295
-
296
- if ( isset( $general[ 'frameborder' ] ) ) { if ( $general[ 'frameborder' ] == 1 ) { $frameborder = 'frameborder="0" '; } else { $frameborder = ''; } }
297
-
298
  // If audio playback option is set, restrict the height to just show the player toolbar
299
-
300
  if ( $audio == '1' ) { $height = 27; }
301
 
302
  // Set up embed types
303
-
304
  $tab = '';
305
  $class = 'youtube-player';
306
- $paras = '';
307
 
308
  $embedplus = false;
309
  $swf = false;
310
  $iframe = false;
311
- $chromeless = false;
312
-
313
- if ( ( $type == 'm' ) && ( ( $user != 0 ) or ( $search != 0 ) ) ) { $type = $options[ 'fallback' ]; }
314
 
315
  if ( $type != 'v' ) {
316
- $paras .= '&amp;modestbranding=1';
317
  if ( $type == 'm' ) {
318
- $embedplus = true;
319
- $tab = "\t";
320
- $embedheight = $height + 32;
321
- $class = 'cantembedplus';
322
- $fallback = $options[ 'fallback' ];
323
  } else {
324
- if ( $type == "c" ) {
325
- $chromeless = true;
326
- } else {
327
- $swf = true;
328
- }
329
  }
330
- $paras .= '&amp;version=3';
331
  } else {
332
- $iframe = true;
333
  }
334
 
335
  // Generate parameters to add to URL
336
-
337
  if ( $fullscreen == 1 ) { $paras .= '&amp;fs=1'; } else { $paras .= '&amp;fs=0'; }
338
  if ( $related != 1 ) { $paras .= '&amp;rel=0'; }
339
  if ( $autoplay == 1 ) { $paras .= '&amp;autoplay=1'; $paras_ep .= '&amp;autoplay=1'; }
340
  if ( $loop == 1 ) { $paras .= '&amp;loop=1'; }
341
- if ( $info != 1 ) { $paras .= '&amp;showinfo=0'; }
342
  if ( $annotation != 1 ) { $paras .= '&amp;iv_load_policy=3'; }
343
  if ( $cc == 1 ) { $paras .= '&amp;cc_load_policy=1'; }
344
  if ( $disablekb == 1 ) { $paras .= '&amp;disablekb=1'; }
@@ -346,35 +274,25 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
346
  if ( $controls != 1 ) { $paras .= '&amp;controls=0'; }
347
  if ( strtolower( $color ) != 'red' ) { $paras .= '&amp;color=' . strtolower( $color ); }
348
  if ( strtolower( $theme ) != 'dark' ) { $paras .= '&amp;theme=' . strtolower( $theme ); }
349
- if ( $title != '' ) { $paras .= '&amp;title=' . urlencode( $title ); }
350
 
351
  // If not a playlist, add the playlist parameter
352
-
353
  if ( $playlist_ids != '' ) { $paras .= '&amp;playlist=' . $playlist_ids; }
354
 
355
  // Generate EmbedPlus parameters
356
-
357
  $paras_ep = '&amp;width=' . $width . '&amp;height=' . $height;
358
  if ( $react != 1 ) { $paras_ep .= '&amp;react=0'; }
359
  if ( $sweetspot != 1 ) { $paras_ep .= '&amp;sweetspot=0'; }
360
  if ( $hd == 1 ) { $paras_ep .= '&amp;hd=1'; }
361
 
362
  // Add start & stop parameters
363
-
364
  if ( $start != 0 ) { $paras .= '&amp;start=' . $start; $paras_ep .= '&amp;start=' . $start; }
365
- if ( $stop != 0 ) { $paras_ep .= '&amp;stop=' . $stop; $paras .= '&amp;end=' . $stop; }
366
 
367
- // Generate DIVs to wrap around video
368
-
369
- if ( $dynamic == 1) {
370
- $result = "<div class=\"ye-container\">\n";
371
- if ( $fixed == 1) { $result = '<div style="width: ' . $width . 'px; max-width: 100%">' . $result; }
372
- }
373
 
374
  // Add EmbedPlus code
375
-
376
  if ( $embedplus ) {
377
- $result .= "<object type=\"application/x-shockwave-flash\" width=\"" . $width . "\" height=\"" . $embedheight . "\" data=\"http://getembedplus.com/embedplus.swf\" style=\"" . $style . "\" id=\"" . uniqid( 'ep_', true ) . "\" >\n";
378
  $result .= "\t<param value=\"http://getembedplus.com/embedplus.swf\" name=\"movie\" />\n";
379
  $result .= "\t<param value=\"high\" name=\"quality\" />\n";
380
  $result .= "\t<param value=\"" . $wmode . "\" name=\"wmode\" />\n";
@@ -383,63 +301,13 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
383
  $result .= "\t<param name=\"flashvars\" value=\"ytid=" . $id . $paras_ep . "\" />\n";
384
  }
385
 
386
- // Work out, depending on privacy settings, the main address to use
387
-
388
- $privacy = $general[ 'privacy' ];
389
- if ( $privacy == 1 ) {
390
- $url_privacy = 'youtube-nocookie.com';
391
- } else {
392
- $url_privacy = 'youtube.com';
393
- }
394
-
395
- // Generate the first part of the embed URL along with the ID section
396
-
397
- if ( $chromeless ) {
398
- $embed_url = 'http' . $https . '://www.youtube.com/apiplayer';
399
- $id_paras = '?video_id=' . $id;
400
- } else {
401
- $embed_url = 'http' . $https . '://www.' . $url_privacy . '/';
402
- if ( $type == 'v' ) {
403
- $embed_url .= 'embed';
404
- } else {
405
- $embed_url .= 'v/';
406
- }
407
- $id_paras = $id;
408
- if ( $type == 'v' ) { $id_paras = '/' . $id_paras; }
409
- }
410
-
411
- // If a playlist, user or download build the ID appropriately
412
-
413
- if ( ( $embed_type == 'p' ) or ( $user != 0 ) or ( $search != 0 ) ) {
414
-
415
- $list_type = '';
416
- if ( $embed_type == 'p' ) { $list_type = 'playlist'; }
417
- if ( $user != 0 ) { $list_type = 'user_uploads'; }
418
- if ( $search != 0 ) { $list_type = 'search'; $id = urlencode( $id ); }
419
-
420
- $id_paras = '';
421
- if ( $type == 'p' ) { $id_paras .= 'videoseries'; }
422
- $id_paras .= '?listType=' . $list_type . '&amp;list=';
423
- if ( ( $embed_type == 'p' ) && ( strtolower( substr ( $id, 0, 2 ) ) != 'pl' ) ) { $id_paras .= 'PL'; }
424
- $id_paras .= $id;
425
- }
426
-
427
- // Combine URL parts together
428
-
429
- $embed_url .= $id_paras;
430
- if ( ( !strpos( $embed_url, '?' ) ) && ( substr( $paras, 0, 5 ) == '&amp;' ) ) { $paras = '?' . substr( $paras, 5 ); }
431
- $embed_url .= $paras;
432
-
433
  // Add AS3 YouTube embed code
434
-
435
- if ( ( $swf ) or ( $chromeless ) or ( ( $embedplus ) && ( ( $fallback == 'o' ) or ( $fallback == 'p' ) ) ) ) {
436
-
437
- $result .= $tab . "<object class=\"" . $class . "\" type=\"application/x-shockwave-flash\" data=\"" . $embed_url . "\" width=\"" . $width . "\" height=\"" . $height . "\" style=\"" . $style . "\"";
438
-
439
  if ( $metadata != 0 ) { $result .= " rel=\"media:video\" resource=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id ."\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\""; }
440
- $result .= " >\n";
441
  if ( $metadata != 0 ) { $result .= $tab . "\t<a rel=\"media:thumbnail\" href=\"http://img.youtube.com/vi/" . $id . "/default.jpg\" />\n"; }
442
- $result .= $tab . "\t<param name=\"movie\" value=\"" . $embed_url . "\" />\n";
443
  $result .= $tab . "\t<param name=\"wmode\" value=\"" . $wmode . "\" />\n";
444
  if ( $fullscreen == 1 ) { $result .= $tab . "\t<param name=\"allowFullScreen\" value=\"true\" />\n"; }
445
  if ( ( $link != 1 ) && ( $link != '' ) ) { $result .= $tab . "\t<param name=\"allowNetworking\" value=\"internal\" />\n"; }
@@ -448,34 +316,27 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
448
  }
449
 
450
  // Add IFRAME embed code
451
-
452
  if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
453
  if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
454
- $result .= $tab . '<iframe ' . $frameborder . 'style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="' . $embed_url . '&amp;wmode=' . $wmode . '"';
455
  if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
456
- $result .= " ></iframe>\n";
457
  }
458
 
459
  // If using EmbedPlus, add the OBJECT closure tag
460
-
461
  if ( $embedplus ) { $result .= "</object>\n<!--[if lte IE 6]> <style type=\"text/css\">.cantembedplus{display:none;}</style><![endif]-->\n"; }
462
 
463
- // Now apply the template to the result
 
464
 
465
- $end_tag = '';
466
- if ( $dynamic == 1 ) {
467
- $end_tag .= '</div>';
468
- if ( $fixed == 1 ) { $end_tag .= '</div>'; }
469
- }
470
- $result = str_replace( '%video%', $result . $end_tag . "\n", $template );
471
 
472
  // Now add a commented header and trailer
473
-
474
  $result = "\n<!-- YouTube Embed v" . youtube_embed_version . " | http://www.artiss.co.uk/artiss-youtube-embed -->\n" . $result;
475
  $result .= "<!-- End of YouTube Embed code -->\n";
476
 
477
  // Cache the output
478
-
479
  if ( $general[ 'embed_cache' ] != 0 ) { set_transient( $cache_key, $result, 3600 * $general[ 'embed_cache' ] ); }
480
 
481
  return $result;
@@ -493,7 +354,7 @@ function aye_generate_youtube_code( $id = '', $type = '', $width = '', $height =
493
  * @return string The profile number (defaults to 0)
494
  */
495
 
496
- function aye_validate_profile( $name, $number ) {
497
 
498
  $profile = 0;
499
  $name = strtolower( $name );
@@ -501,7 +362,6 @@ function aye_validate_profile( $name, $number ) {
501
  if ( ( $name != '' ) && ( $name != 'default' ) ) {
502
 
503
  // Loop around, fetching in profile names
504
-
505
  $loop = 1;
506
  while ( ( $loop <= $number ) && ( $profile == 0 ) ) {
507
  if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
@@ -529,24 +389,21 @@ function aye_validate_profile( $name, $number ) {
529
  * @return string The list (defaults to blank)
530
  */
531
 
532
- function aye_validate_list( $name, $number ) {
533
 
534
  $list = '';
535
 
536
  // If the parameter contains commas, assume to be a comma seperated list and move into an array
537
-
538
  if ( strpos( $name, ',' ) !== false ) {
539
  $list = explode( ',', $name );
540
  } else {
541
 
542
  // No comma, so check if this is a named list
543
-
544
  $name = strtolower( $name );
545
 
546
  if ( $name != '' ) {
547
 
548
  // Loop around, fetching in profile names
549
-
550
  $loop = 1;
551
  while ( ( $loop <= $number ) && ( $list == '' ) ) {
552
  $listfiles = get_option( 'youtube_embed_list' . $loop );
@@ -577,21 +434,18 @@ function aye_validate_list( $name, $number ) {
577
  * @return string The parameter value
578
  */
579
 
580
- function aye_get_url_para( $id, $para, $current ) {
581
 
582
  // Look for an ampersand
583
-
584
  $start_pos = false;
585
  if ( strpos( $id, '&amp;' . $para . '=' ) !== false ) { $start_pos = strpos( $id, '&amp;' . $para . '=' ) + 6 + strlen( $para ); }
586
 
587
  // If a parameter was found, look for the end of it
588
-
589
  if ( $start_pos !== false ) {
590
  $end_pos = strpos( $id, '&amp;', $start_pos + 1 );
591
  if ( !$end_pos ) { $end_pos = strlen( $id ); }
592
 
593
  // Extract the parameter and return it
594
-
595
  $current = substr( $id, $start_pos, $end_pos - $start_pos );
596
  }
597
 
@@ -610,12 +464,12 @@ function aye_get_url_para( $id, $para, $current ) {
610
  * @return string The decoded string
611
  */
612
 
613
- function aye_decode( $encoded ) {
614
 
615
  $find = array( '&amp;', '&quot;', '&#039;', '&lt;', '&gt;' );
616
  $replace = array( '&', '"', "'", '<', '>' );
617
 
618
- $decoded = str_replace( $find, $replace, $encoded );
619
 
620
  return $decoded;
621
  }
4
  *
5
  * Functions calls to generate the required YouTube code
6
  *
7
+ * @package YouTubeEmbed
8
  */
9
 
10
  /**
14
  *
15
  * @since 2.0
16
  *
17
+ * @uses ye_convert_id Convert special characters in ID
18
+ * @uses ye_error Display an error
19
+ * @uses ye_extract_id Get the video ID
20
+ * @uses ye_validate_list Get the requested listr
21
+ * @uses ye_validate_id Validate the video ID
22
+ * @uses ye_validate_profile Get the requested profile
23
+ * @uses ye_set_general_defaults Get general options
24
+ * @uses ye_set_profile_defaults Set default profile options
25
  *
26
  * @param string $id Video ID
27
  * @param string $type Embed type
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.';
99
+ } else {
100
+ $error = $embed_type;
101
+ }
102
+ $result = "\n<!-- YouTube Embed v" . youtube_embed_version . " | http://www.artiss.co.uk/artiss-youtube-embed -->\n";
103
+ $result .= "<!-- " . $error . " -->\n" . ye_decode( $general[ 'error_message' ] ) . "\n<!-- End of YouTube Embed code -->\n";
104
+ return $result;
105
+ }
106
 
107
+ } else {
 
108
 
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 ) ) {
127
+ if ( $playlist_ids != '' ) { $playlist_ids .= ','; }
128
+ $list_id = ye_extract_id( $list[ $loop ] );
129
+ $playlist_ids .= $list_id;
130
+ $loop ++;
131
+ }
132
+ }
133
+ }
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
  $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 != '' ) {
156
  } else {
157
  $youtube_url = 'http' . $https . '://www.youtube.com/watch?' . $embed_type . '=' . $id;
158
  if ( ( $embed_type == 'v' ) && ( $general[ 'feed' ] != 't' ) ) { $result .= '<p><a href="' . $youtube_url . '"><img src="http://img.youtube.com/vi/' . $id . '/' . $general[ 'thumbnail' ] . ".jpg\"></a></p>\n"; }
159
+ if ( ( $general ['feed'] != 'v' ) or ( $embed_type != 'v' ) ) { $result .= '<p><a href="' . $youtube_url . '">' . __( 'Click here</a> to view the video on YouTube' ) . ".</p>\n"; }
160
  }
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
  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' ];
210
  }
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
  }
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;
248
  $iframe = false;
 
 
 
249
 
250
  if ( $type != 'v' ) {
 
251
  if ( $type == 'm' ) {
252
+ $embedplus = true;
253
+ $tab = "\t";
254
+ $embedheight = $height + 32;
255
+ $class = 'cantembedplus';
256
+ $fallback = $options[ 'fallback' ];
257
  } else {
258
+ $swf = true;
 
 
 
 
259
  }
 
260
  } else {
261
+ $iframe = true;
262
  }
263
 
264
  // Generate parameters to add to URL
 
265
  if ( $fullscreen == 1 ) { $paras .= '&amp;fs=1'; } else { $paras .= '&amp;fs=0'; }
266
  if ( $related != 1 ) { $paras .= '&amp;rel=0'; }
267
  if ( $autoplay == 1 ) { $paras .= '&amp;autoplay=1'; $paras_ep .= '&amp;autoplay=1'; }
268
  if ( $loop == 1 ) { $paras .= '&amp;loop=1'; }
269
+ if ( $info == 1 ) { $paras .= '&amp;showinfo=1'; }
270
  if ( $annotation != 1 ) { $paras .= '&amp;iv_load_policy=3'; }
271
  if ( $cc == 1 ) { $paras .= '&amp;cc_load_policy=1'; }
272
  if ( $disablekb == 1 ) { $paras .= '&amp;disablekb=1'; }
274
  if ( $controls != 1 ) { $paras .= '&amp;controls=0'; }
275
  if ( strtolower( $color ) != 'red' ) { $paras .= '&amp;color=' . strtolower( $color ); }
276
  if ( strtolower( $theme ) != 'dark' ) { $paras .= '&amp;theme=' . strtolower( $theme ); }
 
277
 
278
  // If not a playlist, add the playlist parameter
 
279
  if ( $playlist_ids != '' ) { $paras .= '&amp;playlist=' . $playlist_ids; }
280
 
281
  // Generate EmbedPlus parameters
 
282
  $paras_ep = '&amp;width=' . $width . '&amp;height=' . $height;
283
  if ( $react != 1 ) { $paras_ep .= '&amp;react=0'; }
284
  if ( $sweetspot != 1 ) { $paras_ep .= '&amp;sweetspot=0'; }
285
  if ( $hd == 1 ) { $paras_ep .= '&amp;hd=1'; }
286
 
287
  // Add start & stop parameters
 
288
  if ( $start != 0 ) { $paras .= '&amp;start=' . $start; $paras_ep .= '&amp;start=' . $start; }
289
+ if ( $stop != 0 ) { $paras_ep .= '&amp;stop=' . $stop; }
290
 
291
+ $result = '';
 
 
 
 
 
292
 
293
  // Add EmbedPlus code
 
294
  if ( $embedplus ) {
295
+ $result .= "<object type=\"application/x-shockwave-flash\" width=\"" . $width . "\" height=\"" . $embedheight . "\" data=\"http://getembedplus.com/embedplus.swf\" style=\"" . $style . "\" id=\"" . uniqid( 'ep_', true ) . "\">\n";
296
  $result .= "\t<param value=\"http://getembedplus.com/embedplus.swf\" name=\"movie\" />\n";
297
  $result .= "\t<param value=\"high\" name=\"quality\" />\n";
298
  $result .= "\t<param value=\"" . $wmode . "\" name=\"wmode\" />\n";
301
  $result .= "\t<param name=\"flashvars\" value=\"ytid=" . $id . $paras_ep . "\" />\n";
302
  }
303
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
304
  // Add AS3 YouTube embed code
305
+ if ( ( $swf ) or ( ( $embedplus ) && ( ( $fallback == 'o' ) or ( $fallback == 'p' ) ) ) ) {
306
+ $result .= $tab . "<object class=\"" . $class . "\" type=\"application/x-shockwave-flash\" data=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id . $paras . "\" width=\"" . $width . "\" height=\"" . $height . "\" style=\"" . $style . "\"";
 
 
 
307
  if ( $metadata != 0 ) { $result .= " rel=\"media:video\" resource=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id ."\" xmlns:media=\"http://search.yahoo.com/searchmonkey/media/\""; }
308
+ $result .= ">\n";
309
  if ( $metadata != 0 ) { $result .= $tab . "\t<a rel=\"media:thumbnail\" href=\"http://img.youtube.com/vi/" . $id . "/default.jpg\" />\n"; }
310
+ $result .= $tab . "\t<param name=\"movie\" value=\"http" . $https . "://www.youtube.com/" . $embed_type . "/" . $id . $paras . "\" />\n";
311
  $result .= $tab . "\t<param name=\"wmode\" value=\"" . $wmode . "\" />\n";
312
  if ( $fullscreen == 1 ) { $result .= $tab . "\t<param name=\"allowFullScreen\" value=\"true\" />\n"; }
313
  if ( ( $link != 1 ) && ( $link != '' ) ) { $result .= $tab . "\t<param name=\"allowNetworking\" value=\"internal\" />\n"; }
316
  }
317
 
318
  // Add IFRAME embed code
 
319
  if ( ( $iframe ) or ( ( $embedplus ) && ( $fallback == "v" ) ) ) {
320
  if ( $embed_type == "p" ) { $playlist_para = "p/"; } else { $playlist_para = ''; }
321
+ $result .= $tab . '<iframe style="border: 0;' . $style . '" class="' . $class . '" width="' . $width . '" height="' . $height . '" src="http' . $https . '://www.youtube.com/embed/' . $playlist_para . $id . '?' . substr( $paras, 1 ) . '&amp;wmode=' . $wmode . '"';
322
  if ( $fullscreen == 1 ) { $result .= ' allowfullscreen="allowfullscreen"'; }
323
+ $result .= "></iframe>\n";
324
  }
325
 
326
  // If using EmbedPlus, add the OBJECT closure tag
 
327
  if ( $embedplus ) { $result .= "</object>\n<!--[if lte IE 6]> <style type=\"text/css\">.cantembedplus{display:none;}</style><![endif]-->\n"; }
328
 
329
+ // Add drop shadow
330
+ if ( ( is_numeric( $shadow ) ) && ( $shadow != 0 ) ) { $result .= "<br/><img src=\"" . plugins_url() . "/youtube-embed/images/shadow.png\" alt=\"\" title=\"\" height=\"" . $shadow . "\" width=\"" . $width . "\" />\n"; }
331
 
332
+ // Now apply the template to the result
333
+ $result = str_replace( '%video%', $result, $template );
 
 
 
 
334
 
335
  // Now add a commented header and trailer
 
336
  $result = "\n<!-- YouTube Embed v" . youtube_embed_version . " | http://www.artiss.co.uk/artiss-youtube-embed -->\n" . $result;
337
  $result .= "<!-- End of YouTube Embed code -->\n";
338
 
339
  // Cache the output
 
340
  if ( $general[ 'embed_cache' ] != 0 ) { set_transient( $cache_key, $result, 3600 * $general[ 'embed_cache' ] ); }
341
 
342
  return $result;
354
  * @return string The profile number (defaults to 0)
355
  */
356
 
357
+ function ye_validate_profile( $name, $number ) {
358
 
359
  $profile = 0;
360
  $name = strtolower( $name );
362
  if ( ( $name != '' ) && ( $name != 'default' ) ) {
363
 
364
  // Loop around, fetching in profile names
 
365
  $loop = 1;
366
  while ( ( $loop <= $number ) && ( $profile == 0 ) ) {
367
  if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
389
  * @return string The list (defaults to blank)
390
  */
391
 
392
+ function ye_validate_list( $name, $number ) {
393
 
394
  $list = '';
395
 
396
  // If the parameter contains commas, assume to be a comma seperated list and move into an array
 
397
  if ( strpos( $name, ',' ) !== false ) {
398
  $list = explode( ',', $name );
399
  } else {
400
 
401
  // No comma, so check if this is a named list
 
402
  $name = strtolower( $name );
403
 
404
  if ( $name != '' ) {
405
 
406
  // Loop around, fetching in profile names
 
407
  $loop = 1;
408
  while ( ( $loop <= $number ) && ( $list == '' ) ) {
409
  $listfiles = get_option( 'youtube_embed_list' . $loop );
434
  * @return string The parameter value
435
  */
436
 
437
+ function ye_get_url_para( $id, $para, $current ) {
438
 
439
  // Look for an ampersand
 
440
  $start_pos = false;
441
  if ( strpos( $id, '&amp;' . $para . '=' ) !== false ) { $start_pos = strpos( $id, '&amp;' . $para . '=' ) + 6 + strlen( $para ); }
442
 
443
  // If a parameter was found, look for the end of it
 
444
  if ( $start_pos !== false ) {
445
  $end_pos = strpos( $id, '&amp;', $start_pos + 1 );
446
  if ( !$end_pos ) { $end_pos = strlen( $id ); }
447
 
448
  // Extract the parameter and return it
 
449
  $current = substr( $id, $start_pos, $end_pos - $start_pos );
450
  }
451
 
464
  * @return string The decoded string
465
  */
466
 
467
+ function ye_decode( $encoded ) {
468
 
469
  $find = array( '&amp;', '&quot;', '&#039;', '&lt;', '&gt;' );
470
  $replace = array( '&', '"', "'", '<', '>' );
471
 
472
+ $decoded = str_replace($find,$replace,$encoded);
473
 
474
  return $decoded;
475
  }
includes/generate-shorturl-code.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Generate video short URL
4
+ *
5
+ * Create a short URL to a YouTube video
6
+ *
7
+ * @package YouTubeEmbed
8
+ * @since 2.0
9
+ *
10
+ * @uses ye_extract_id Extract an ID from a string
11
+ * @uses ye_validate_id Confirm the type of video
12
+ * @uses ye_error Display an error
13
+ *
14
+ * @param string $id YouTube video ID
15
+ * @return string $youtube_code Code
16
+ */
17
+
18
+ function ye_generate_shorturl_code( $id ) {
19
+
20
+ // Check that an ID has been specified
21
+ if ( $id == '' ) {
22
+ return ye_error( 'No video ID has been supplied' );
23
+ } else {
24
+
25
+ // Extract the ID if a full URL has been specified
26
+ $id = ye_extract_id( $id );
27
+
28
+ // Check what type of video it is and whether it's valid
29
+ $embed_type = ye_validate_id( $id );
30
+ if ( $embed_type != 'v' ) {
31
+ if ( strlen( $embed_type ) > 1 ) {
32
+ return ye_error( $embed_type );
33
+ } else {
34
+ return ye_error( 'The YouTube ID of ' . $id . ' is invalid.' );
35
+ }
36
+ }
37
+
38
+ return 'http://youtu.be/' . $id;
39
+ }
40
+ }
41
+ ?>
includes/{aye-generate-thumbnail-code.php → generate-thumbnail-code.php} RENAMED
@@ -4,46 +4,46 @@
4
  *
5
  * Generate XHTML compatible YouTube video thumbnail
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  *
10
- * @uses aye_extract_id Extract an ID from a string
11
- * @uses aye_validate_id Confirm the type of video
12
- * @uses aye_error Display an error
13
  *
14
  * @param string $id YouTube video ID
15
  * @param string $style Link STYLE
16
  * @param string $class Link CLASS
17
  * @param string $rel Link REL
18
- * @param string $target Link target
19
  * @param string $width Width
20
  * @param string $height Height
21
  * @param string $alt ALT text
22
  * @return string $youtube_code Code
23
  */
24
 
25
- function aye_generate_thumbnail_code( $id, $style, $class, $rel, $target, $width, $height, $alt, $version ) {
26
-
27
  // Extract the ID if a full URL has been specified
28
- $id = aye_extract_id( $id );
29
 
30
  // Check what type of video it is and whether it's valid
31
- $embed_type = aye_validate_id( $id );
32
 
33
  if ( $embed_type != 'v' ) {
34
  if ( strlen( $embed_type ) > 1 ) {
35
- return aye_error( $embed_type );
36
  } else {
37
- return aye_error( sprintf( __( 'The YouTube ID of %s is invalid.' ), $id ) );
38
  }
39
  }
40
-
41
  $version = strtolower( $version );
42
  if ( ( $version != 'default' ) && ( $version != 'hq' ) && ( $version != 'start' ) && ( $version != 'middle' ) && ( $version != 'end' ) ) { $version = 'default'; }
43
  if ( $version == 'hq' ) { $version = 'hqdefault'; }
44
  if ( $version == 'start' ) { $version = 1; }
45
  if ( $version == 'middle' ) { $version = 2; }
46
- if ( $version == 'end' ) { $version = 3; }
47
 
48
  // Now create the required code
49
  if ( $alt == '' ) { $alt = 'YouTube Video ' . $id; }
4
  *
5
  * Generate XHTML compatible YouTube video thumbnail
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  *
10
+ * @uses ye_extract_id Extract an ID from a string
11
+ * @uses ye_validate_id Confirm the type of video
12
+ * @uses ye_error Display an error
13
  *
14
  * @param string $id YouTube video ID
15
  * @param string $style Link STYLE
16
  * @param string $class Link CLASS
17
  * @param string $rel Link REL
18
+ * @param string $target Link target
19
  * @param string $width Width
20
  * @param string $height Height
21
  * @param string $alt ALT text
22
  * @return string $youtube_code Code
23
  */
24
 
25
+ function ye_generate_thumbnail_code( $id, $style, $class, $rel, $target, $width, $height, $alt, $version ) {
26
+
27
  // Extract the ID if a full URL has been specified
28
+ $id = ye_extract_id( $id );
29
 
30
  // Check what type of video it is and whether it's valid
31
+ $embed_type = ye_validate_id( $id );
32
 
33
  if ( $embed_type != 'v' ) {
34
  if ( strlen( $embed_type ) > 1 ) {
35
+ return ye_error( $embed_type );
36
  } else {
37
+ return ye_error( 'The YouTube ID of ' . $id . ' is invalid.' );
38
  }
39
  }
40
+
41
  $version = strtolower( $version );
42
  if ( ( $version != 'default' ) && ( $version != 'hq' ) && ( $version != 'start' ) && ( $version != 'middle' ) && ( $version != 'end' ) ) { $version = 'default'; }
43
  if ( $version == 'hq' ) { $version = 'hqdefault'; }
44
  if ( $version == 'start' ) { $version = 1; }
45
  if ( $version == 'middle' ) { $version = 2; }
46
+ if ( $version == 'end' ) { $version = 3; }
47
 
48
  // Now create the required code
49
  if ( $alt == '' ) { $alt = 'YouTube Video ' . $id; }
includes/{aye-generate-transcript-code.php → generate-transcript-code.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * All functions relating to creating YouTube transcripts
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
 
@@ -15,42 +15,39 @@
15
  *
16
  * @since 2.0
17
  *
18
- * @uses aye_extract_id Extract the ID
19
- * @uses aye_get_file Get a file
20
- * @uses aye_set_general_defaults Set default options
21
- * @uses aye_validate_id Validate the ID
22
  *
23
- * @param string $id Video ID
24
- * @return string $output Transcript output
25
  */
26
 
27
- function aye_generate_transcript( $id ) {
28
 
29
  // Extract the ID if a full URL has been specified
30
- $id = aye_extract_id( $id );
31
 
32
  // Check what type of video it is and whether it's valid
33
- $embed_type = aye_validate_id( $id );
34
  if ( $embed_type != 'v' ) {
35
  if ( strlen( $embed_type ) > 1 ) {
36
- return aye_error( $embed_type );
37
  } else {
38
- return aye_error( sprintf( __( 'The YouTube ID of %s is invalid.' ), $id ) );
39
  }
40
- }
41
 
42
  // Get general options
43
- $general = aye_set_general_defaults();
44
 
45
  // Check to see if cache is available
46
  if ( $general[ 'transcript_cache' ] != 0 ) {
47
- $cache_key = 'aye_transcript_'.$id;
48
  $output = get_transient( $cache_key );
49
  if ( $output !== false) { return $output; }
50
  }
51
 
52
  // Get transcript file
53
- $return = aye_get_file( 'http://video.google.com/timedtext?lang=en&v=' . $id );
54
  $xml = $return[ 'file' ];
55
  $output = '';
56
 
@@ -88,7 +85,7 @@ function aye_generate_transcript( $id ) {
88
  $output .= "<!-- End of YouTube Embed code -->\n";
89
  }
90
 
91
- // Save the cache
92
  if ( $general[ 'transcript_cache' ] != 0 ) { set_transient( $cache_key, $output, 3600 * $general[ 'transcript_cache' ] ); }
93
 
94
  return $output;
4
  *
5
  * All functions relating to creating YouTube transcripts
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
 
15
  *
16
  * @since 2.0
17
  *
18
+ * @uses ye_get_file Get a file
 
 
 
19
  *
20
+ * @param string $id Video ID
21
+ * @return string $output Transcript output
22
  */
23
 
24
+ function ye_generate_transcript( $id ) {
25
 
26
  // Extract the ID if a full URL has been specified
27
+ $id = ye_extract_id( $id );
28
 
29
  // Check what type of video it is and whether it's valid
30
+ $embed_type = ye_validate_id( $id );
31
  if ( $embed_type != 'v' ) {
32
  if ( strlen( $embed_type ) > 1 ) {
33
+ return ye_error( $embed_type );
34
  } else {
35
+ return ye_error( 'The YouTube ID of ' . $id . ' is invalid.' );
36
  }
37
+ }
38
 
39
  // Get general options
40
+ $general = ye_set_general_defaults();
41
 
42
  // Check to see if cache is available
43
  if ( $general[ 'transcript_cache' ] != 0 ) {
44
+ $cache_key = 'ye_transcript_'.$id;
45
  $output = get_transient( $cache_key );
46
  if ( $output !== false) { return $output; }
47
  }
48
 
49
  // Get transcript file
50
+ $return = ye_get_file( 'http://video.google.com/timedtext?lang=en&v=' . $id );
51
  $xml = $return[ 'file' ];
52
  $output = '';
53
 
85
  $output .= "<!-- End of YouTube Embed code -->\n";
86
  }
87
 
88
+ // Save the cache
89
  if ( $general[ 'transcript_cache' ] != 0 ) { set_transient( $cache_key, $output, 3600 * $general[ 'transcript_cache' ] ); }
90
 
91
  return $output;
includes/{aye-add-mce-button.php → mcebutton.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * Add extra button(s) to TinyMCE interface
6
  *
7
- * @package Artiss-YouTube-Embed
8
  */
9
 
10
  /**
@@ -12,15 +12,13 @@
12
  *
13
  * Add filters (assuming user is editing) for TinyMCE
14
  *
15
- * @uses aye_set_general_defaults Set default options
16
- *
17
  * @since 2.0
18
  */
19
 
20
  function youtube_embed_button() {
21
-
22
  if ( current_user_can( 'edit_posts' ) ) {
23
- $options = aye_set_general_defaults();
24
 
25
  if ( ( get_user_option( 'rich_editing' ) == 'true' ) && ( $options[ 'editor_button' ] != '' ) ) {
26
  add_filter( 'mce_external_plugins', 'add_youtube_embed_mce_plugin' );
@@ -28,7 +26,7 @@ function youtube_embed_button() {
28
  }
29
  }
30
  }
31
- add_action( 'init', 'youtube_embed_button' );
32
 
33
  /**
34
  * Register new TinyMCE button
@@ -58,7 +56,7 @@ function register_youtube_embed_button( $buttons ) {
58
  */
59
 
60
  function add_youtube_embed_mce_plugin( $plugin_array ) {
61
- $plugin_array[ 'YouTube' ] = plugins_url() . '/youtube-embed/js/aye-mce-button.js';
62
  return $plugin_array;
63
  }
64
  ?>
4
  *
5
  * Add extra button(s) to TinyMCE interface
6
  *
7
+ * @package YouTubeEmbed
8
  */
9
 
10
  /**
12
  *
13
  * Add filters (assuming user is editing) for TinyMCE
14
  *
 
 
15
  * @since 2.0
16
  */
17
 
18
  function youtube_embed_button() {
19
+
20
  if ( current_user_can( 'edit_posts' ) ) {
21
+ $options = ye_set_general_defaults();
22
 
23
  if ( ( get_user_option( 'rich_editing' ) == 'true' ) && ( $options[ 'editor_button' ] != '' ) ) {
24
  add_filter( 'mce_external_plugins', 'add_youtube_embed_mce_plugin' );
26
  }
27
  }
28
  }
29
+ add_action( 'init','youtube_embed_button' );
30
 
31
  /**
32
  * Register new TinyMCE button
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
  ?>
includes/{aye-options-general.php → options-general.php} RENAMED
@@ -4,89 +4,81 @@
4
  *
5
  * Screen for generic options
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
 
11
  ?>
12
- <div class="wrap" style="width: 1010px;">
13
  <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
14
- <h2><?php _e( 'Artiss YouTube Embed Options' ); ?></h2>
15
 
16
  <?php
17
  // If options have been updated on screen, update the database
18
-
19
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'youtube_embed_general_nonce' ) ) ) {
20
 
21
- $options[ 'editor_button' ] = $_POST[ 'youtube_embed_editor_button' ];
22
- $options[ 'admin_bar' ] = $_POST[ 'youtube_embed_admin_bar' ];
23
- if ( !empty( $_POST[ 'youtube_embed_profile_no' ] ) ) { $options[ 'profile_no' ] = $_POST[ 'youtube_embed_profile_no' ]; }
24
 
25
  // If the number of profiles is less than zero, put it to 0
 
26
 
27
- if ( $options[ 'profile_no' ] < 0 ) { $options[ 'profile_no' ] = 0; }
28
-
29
- if ( !empty( $_POST[ 'youtube_embed_list_no' ] ) ) { $options[ 'list_no' ] = $_POST[ 'youtube_embed_list_no' ]; }
30
 
31
  // If the number of lists is less than 1, put it to 1
32
-
33
  if ( $options[ 'list_no' ] < 1 ) { $options[ 'list_no' ] = 1; }
34
 
35
- if ( !empty( $_POST[ 'youtube_embed_embed_cache' ] ) ) { $options[ 'embed_cache' ] = $_POST[ 'youtube_embed_embed_cache' ]; }
36
- if ( !empty( $_POST[ 'youtube_embed_info_cache' ] ) ) { $options[ 'info_cache' ] = $_POST[ 'youtube_embed_info_cache' ]; }
37
- if ( !empty( $_POST[ 'youtube_embed_transcript_cache' ] ) ) { $options[ 'transcript_cache' ] = $_POST[ 'youtube_embed_transcript_cache' ]; }
38
- if ( !empty( $_POST[ 'youtube_embed_fetch_title' ] ) ) { $options[ 'fetch_title' ] = $_POST[ 'youtube_embed_fetch_title' ]; }
39
- if ( !empty( $_POST[ 'youtube_embed_alt_profile' ] ) ) { $options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ]; }
40
- if ( !empty( $_POST[ 'youtube_embed_alt_profile2' ] ) ) { $options[ 'alt_profile2' ] = $_POST[ 'youtube_embed_alt_profile2' ]; }
41
- $options[ 'bracket' ] = $_POST[ 'youtube_embed_bracket' ];
42
- $options[ 'alt' ] = $_POST[ 'youtube_embed_alt' ];
43
- if ( !empty( $_POST[ 'youtube_embed_other_profile' ] ) ) { $options[ 'other_profile' ] = $_POST[ 'youtube_embed_other_profile' ]; }
44
- $options[ 'comments' ] = $_POST[ 'youtube_embed_comments' ];
45
- if ( !empty( $_POST[ 'youtube_embed_comments_profile' ] ) ) { $options[ 'comments_profile' ] = $_POST[ 'youtube_embed_comments_profile' ]; }
46
- $options[ 'metadata' ] = $_POST[ 'youtube_embed_metadata' ];
47
- if ( !empty( $_POST[ 'youtube_embed_feed' ] ) ) { $options[ 'feed' ] = $_POST[ 'youtube_embed_feed' ]; }
48
- if ( !empty( $_POST[ 'youtube_embed_api' ] ) ) { $options[ 'api' ] = $_POST[ 'youtube_embed_api' ]; }
49
- if ( !empty( $_POST[ 'youtube_embed_error_message' ] ) ) { $options[ 'error_message' ] = htmlspecialchars( $_POST[ 'youtube_embed_error_message' ] ); }
50
- if ( !empty( $_POST[ 'youtube_embed_thumbnail' ] ) ) { $options[ 'thumbnail' ] = $_POST[ 'youtube_embed_thumbnail' ]; }
51
- $options[ 'privacy' ] = $_POST[ 'youtube_embed_privacy' ];
52
- $options[ 'frameborder' ] = $_POST[ 'youtube_embed_frameborder' ];
53
 
54
  // Update the options
55
-
56
  update_option( 'youtube_embed_general', $options );
57
- $update_message = __( 'Settings Saved.' );
58
 
59
  // Update the alternative shortcodes
60
-
61
- $shortcode[ 1 ] = $_POST[ 'youtube_embed_shortcode' ];
62
- $shortcode[ 1 ] = trim( $shortcode[ 1 ], '[]' );
63
-
64
- $shortcode[ 2 ] = $_POST[ 'youtube_embed_shortcode2' ];
65
- $shortcode[ 2 ] = trim( $shortcode[ 2 ], '[]' );
66
-
67
  update_option( 'youtube_embed_shortcode', $shortcode );
68
 
69
- // If the option to clear the cache has been ticked run an SQL to clear them down
70
-
71
- if ( !empty( $_POST[ 'youtube_embed_clear_cache' ] ) ) {
72
- global $wpdb;
73
- $wpdb -> query( "DELETE FROM $wpdb->options WHERE option_name LIKE '_transient_%ye_video_%'" );
74
- $update_message .= ' ' . __( 'Cache cleared.' );
75
- }
76
 
77
- echo '<div class="updated fade"><p><strong>' . $update_message . "</strong></p></div>\n";
78
  }
79
 
80
  // Get options
 
 
 
81
 
82
- $options = aye_set_general_defaults();
83
- $shortcode = aye_set_shortcode_option();
84
- $url = aye_set_url_option();
85
- ?>
 
 
86
 
87
- <p><?php _e( 'These are the general settings for Artiss YouTube Embed. Please select <a href="admin.php?page=aye-profile-options">Profiles</a> for default embedding settings.' ); ?></p>
88
 
89
- <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=aye-general-options' ?>">
 
 
90
 
91
  <span class="yt_heading"><?php _e( 'Embedding' ); ?></span>
92
 
@@ -96,6 +88,18 @@ $url = aye_set_url_option();
96
  <td><input type="checkbox" name="youtube_embed_metadata" value="1"<?php if ( $options[ 'metadata' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Allow rich metadata to be added to code. <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-metadata">Learn more</a>' ); ?></span></td>
97
  </tr>
98
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  <tr>
100
  <th scope="row"><?php _e( 'Comment Embedding' ); ?></th>
101
  <td><input type="checkbox" name="youtube_embed_comments" value="1"<?php if ( $options[ 'comments' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Allow YouTube URLs in comments - will display as embedded videos. <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-comments">Learn more</a>' ); ?></span></td>
@@ -104,7 +108,7 @@ $url = aye_set_url_option();
104
  <tr>
105
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
106
  <td><select name="youtube_embed_comments_profile">
107
- <?php aye_generate_profile_list( $options[ 'comments_profile' ], $options[ 'profile_no' ] ) ?>
108
  </select></td>
109
  </tr>
110
 
@@ -129,7 +133,7 @@ $url = aye_set_url_option();
129
  </tr>
130
  </table>
131
 
132
- <br/><span class="yt_heading"><?php _e( 'Alternative Shortcodes' ); ?></span><br/><br/>Specify up to 2 alternative shortcodes to compliment the standard <code>youtube</code> shortcode. <strong>NB: These should be specified without the surrounding square brackets.</strong>
133
 
134
  <table class="form-table">
135
  <tr>
@@ -140,7 +144,7 @@ $url = aye_set_url_option();
140
  <tr>
141
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
142
  <td><select name="youtube_embed_alt_profile">
143
- <?php aye_generate_profile_list( $options[ 'alt_profile' ], $options[ 'profile_no' ] ) ?>
144
  </select></td>
145
  </tr>
146
 
@@ -152,7 +156,7 @@ $url = aye_set_url_option();
152
  <tr>
153
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
154
  <td><select name="youtube_embed_alt_profile2">
155
- <?php aye_generate_profile_list( $options[ 'alt_profile2' ], $options[ 'profile_no' ] ) ?>
156
  </select></td>
157
  </tr>
158
  </table>
@@ -173,7 +177,7 @@ $url = aye_set_url_option();
173
  <tr>
174
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
175
  <td><select name="youtube_embed_other_profile">
176
- <?php aye_generate_profile_list( $options[ 'other_profile' ], $options[ 'profile_no' ] ) ?>
177
  </select>&nbsp;<span class="description"><?php _e( 'For above 2 options' ); ?></span></td>
178
  </tr>
179
  </table>
@@ -223,16 +227,6 @@ $url = aye_set_url_option();
223
  <th scope="row"><?php _e( 'Transcript Cache' ); ?></th>
224
  <td><input type="text" size="3" maxlength="3" name="youtube_embed_transcript_cache" value="<?php echo $options[ 'transcript_cache' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'How many hours to store transcripts for in cache. 0 to switch off' ); ?></span></td>
225
  </tr>
226
-
227
- <?php
228
- global $wpdb;
229
- $numposts = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_name LIKE '_transient_timeout_%ye_video_%'" );
230
- ?>
231
-
232
- <tr>
233
- <th scope="row"><?php _e( 'Clear Cache' ); ?></th>
234
- <td><input type="checkbox" name="youtube_embed_clear_cache" value="1">&nbsp;<span class="description"><?php echo sprintf ( __( 'Select this option to remove all YouTube Embed cache. You currently have %d cached video(s)' ), number_format( $numposts ) ); ?></span></td>
235
- </tr>
236
  </table>
237
 
238
  <br/><span class="yt_heading"><?php _e( 'YouTube API' ); ?></span>
@@ -248,7 +242,7 @@ $numposts = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_
248
  <option value="2"<?php if ( $options[ 'api' ] == "2" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTPS API used and errors are reported' ); ?></option>
249
  <option value="3"<?php if ( $options[ 'api' ] == "3" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTP API used and no errors are reported' ); ?></option>
250
  <option value="4"<?php if ( $options[ 'api' ] == "4" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTPS API used and no errors are reported' ); ?></option>
251
- </select></td>
252
  </tr>
253
  </table>
254
 
@@ -261,20 +255,17 @@ $numposts = $wpdb -> get_var( "SELECT COUNT(*) FROM $wpdb->options WHERE option_
261
  <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>
262
  </tr></table>
263
 
264
- <br/><span class="yt_heading"><?php _e( 'Security' ); ?></span>
265
 
266
- <table class="form-table"><tr>
267
- <th scope="row"><?php _e( 'Privacy-Enhanced Mode' ); ?></th>
268
- <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>
269
- </tr></table>
270
-
271
- <br/><span class="yt_heading"><?php _e( 'Compatability' ); ?></span>
272
 
273
  <table class="form-table"><tr>
274
- <th scope="row"><?php _e( 'Allow Frame Border on IFRAME' ); ?></th>
275
- <td><input type="checkbox" name="youtube_embed_frameborder" value="1"<?php if ( $options[ 'frameborder' ] == '1' ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'FRAMEBORDER is not HTML5 compliant' ); ?></span></td>
276
  </tr></table>
277
 
 
 
278
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
279
 
280
  <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/></p>
4
  *
5
  * Screen for generic options
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
 
11
  ?>
12
+ <div class="wrap">
13
  <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
14
+ <h2>Artiss YouTube Embed Options</h2>
15
 
16
  <?php
17
  // If options have been updated on screen, update the database
 
18
  if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'youtube_embed_general_nonce' ) ) ) {
19
 
20
+ $options[ 'editor_button' ] = $_POST[ 'youtube_embed_editor_button' ];
21
+ $options[ 'admin_bar' ] = $_POST[ 'youtube_embed_admin_bar' ];
22
+ $options[ 'profile_no' ] = $_POST[ 'youtube_embed_profile_no' ];
23
 
24
  // If the number of profiles is less than zero, put it to 0
25
+ if ( $options[ 'profile_no' ] < 0 ) { $options[ 'profile_no' ] = 0; }
26
 
27
+ $options[ 'list_no' ] = $_POST[ 'youtube_embed_list_no' ];
 
 
28
 
29
  // If the number of lists is less than 1, put it to 1
 
30
  if ( $options[ 'list_no' ] < 1 ) { $options[ 'list_no' ] = 1; }
31
 
32
+ $options[ 'embed_cache' ] = $_POST[ 'youtube_embed_embed_cache' ];
33
+ $options[ 'info_cache' ] = $_POST[ 'youtube_embed_info_cache' ];
34
+ $options[ 'transcript_cache' ] = $_POST[ 'youtube_embed_transcript_cache' ];
35
+ $options[ 'fetch_title' ] = $_POST[ 'youtube_embed_fetch_title' ];
36
+ $options[ 'alt_profile' ] = $_POST[ 'youtube_embed_alt_profile' ];
37
+ $options[ 'alt_profile2' ] = $_POST[ 'youtube_embed_alt_profile2' ];
38
+ $options[ 'bracket' ] = $_POST[ 'youtube_embed_bracket' ];
39
+ $options[ 'alt' ] = $_POST[ 'youtube_embed_alt' ];
40
+ $options[ 'other_profile' ] = $_POST[ 'youtube_embed_other_profile' ];
41
+ $options[ 'url_profile' ] = $_POST[ 'youtube_embed_url_profile' ];
42
+ $options[ 'comments' ] = $_POST[ 'youtube_embed_comments' ];
43
+ $options[ 'comments_profile' ] = $_POST[ 'youtube_embed_comments_profile' ];
44
+ $options[ 'metadata' ] = $_POST[ 'youtube_embed_metadata' ];
45
+ $options[ 'feed' ] = $_POST[ 'youtube_embed_feed' ];
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[ 'donation' ] = $_POST[ 'youtube_embed_donation' ];
50
 
51
  // Update the options
 
52
  update_option( 'youtube_embed_general', $options );
 
53
 
54
  // Update the alternative shortcodes
55
+ $shortcode[ 1 ] = $_POST[ 'youtube_embed_shortcode' ];
56
+ $shortcode[ 2 ] = $_POST[ 'youtube_embed_shortcode2' ];
 
 
 
 
 
57
  update_option( 'youtube_embed_shortcode', $shortcode );
58
 
59
+ // Update the URL override
60
+ update_option( 'youtube_embed_url', $_POST[ 'youtube_embed_url' ] );
 
 
 
 
 
61
 
62
+ echo '<div class="updated fade"><p><strong>' . __( 'Settings Saved.' ) . "</strong></p></div>\n";
63
  }
64
 
65
  // Get options
66
+ $options = ye_set_general_defaults();
67
+ $shortcode = ye_set_shortcode_option();
68
+ $url = ye_set_url_option();
69
 
70
+ if ( $options[ 'donation' ] != 1 ) : ?>
71
+
72
+ <br/><div style="text-align: center;"><script type="text/javascript">
73
+ var psHost = (("https:" == document.location.protocol) ? "https://" : "http://");
74
+ document.write(unescape("%3Cscript src='" + psHost + "pluginsponsors.com/direct/spsn/display.php?client=youtube-embed&spot=' type='text/javascript'%3E%3C/script%3E"));
75
+ </script></div>
76
 
77
+ <?php endif; ?>
78
 
79
+ <p><?php _e( 'These are the general settings for Artiss YouTube Embed. Please select <a href="http://www.artiss.co.uk/wp-admin/admin.php?page=youtube-embed-profiles">Profiles</a> for default embedding settings.' ); ?></p>
80
+
81
+ <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=youtube-embed-general' ?>">
82
 
83
  <span class="yt_heading"><?php _e( 'Embedding' ); ?></span>
84
 
88
  <td><input type="checkbox" name="youtube_embed_metadata" value="1"<?php if ( $options[ 'metadata' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Allow rich metadata to be added to code. <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-metadata">Learn more</a>' ); ?></span></td>
89
  </tr>
90
 
91
+ <tr>
92
+ <th scope="row"><?php _e( 'URL Embedding' ); ?></th>
93
+ <td><input type="checkbox" name="youtube_embed_url" value="1"<?php if ( $url == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Override built-in WP processing of YouTube URLs. <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-urls">Learn more</a>' ); ?></span></td>
94
+ </tr>
95
+
96
+ <tr>
97
+ <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
98
+ <td><select name="youtube_embed_url_profile">
99
+ <?php ye_generate_profile_list( $options[ 'url_profile' ], $options[ 'profile_no' ] ) ?>
100
+ </select></td>
101
+ </tr>
102
+
103
  <tr>
104
  <th scope="row"><?php _e( 'Comment Embedding' ); ?></th>
105
  <td><input type="checkbox" name="youtube_embed_comments" value="1"<?php if ( $options[ 'comments' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Allow YouTube URLs in comments - will display as embedded videos. <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-comments">Learn more</a>' ); ?></span></td>
108
  <tr>
109
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
110
  <td><select name="youtube_embed_comments_profile">
111
+ <?php ye_generate_profile_list( $options[ 'comments_profile' ], $options[ 'profile_no' ] ) ?>
112
  </select></td>
113
  </tr>
114
 
133
  </tr>
134
  </table>
135
 
136
+ <br/><span class="yt_heading"><?php _e( 'Alternative Shortcodes' ); ?></span><br/><br/>Specify up to 2 alternative shortcodes to compliment the standard <code>[youtube]</code> shortcode.
137
 
138
  <table class="form-table">
139
  <tr>
144
  <tr>
145
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
146
  <td><select name="youtube_embed_alt_profile">
147
+ <?php ye_generate_profile_list( $options[ 'alt_profile' ], $options[ 'profile_no' ] ) ?>
148
  </select></td>
149
  </tr>
150
 
156
  <tr>
157
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
158
  <td><select name="youtube_embed_alt_profile2">
159
+ <?php ye_generate_profile_list( $options[ 'alt_profile2' ], $options[ 'profile_no' ] ) ?>
160
  </select></td>
161
  </tr>
162
  </table>
177
  <tr>
178
  <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Profile to use' ); ?></th>
179
  <td><select name="youtube_embed_other_profile">
180
+ <?php ye_generate_profile_list( $options[ 'other_profile' ], $options[ 'profile_no' ] ) ?>
181
  </select>&nbsp;<span class="description"><?php _e( 'For above 2 options' ); ?></span></td>
182
  </tr>
183
  </table>
227
  <th scope="row"><?php _e( 'Transcript Cache' ); ?></th>
228
  <td><input type="text" size="3" maxlength="3" name="youtube_embed_transcript_cache" value="<?php echo $options[ 'transcript_cache' ]; ?>"/>&nbsp;<span class="description"><?php _e( 'How many hours to store transcripts for in cache. 0 to switch off' ); ?></span></td>
229
  </tr>
 
 
 
 
 
 
 
 
 
 
230
  </table>
231
 
232
  <br/><span class="yt_heading"><?php _e( 'YouTube API' ); ?></span>
242
  <option value="2"<?php if ( $options[ 'api' ] == "2" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTPS API used and errors are reported' ); ?></option>
243
  <option value="3"<?php if ( $options[ 'api' ] == "3" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTP API used and no errors are reported' ); ?></option>
244
  <option value="4"<?php if ( $options[ 'api' ] == "4" ) { echo " selected='selected'"; } ?>><?php _e ( 'HTTPS API used and no errors are reported' ); ?></option>
245
+ </select>&nbsp;<span class="description"><?php _e( '' ); ?></span></td>
246
  </tr>
247
  </table>
248
 
255
  <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>
256
  </tr></table>
257
 
258
+ <br/><span class="yt_heading"><?php _e( 'Advertising' ); ?></span>
259
 
260
+ <p><?php _e( 'If you have donated to Artiss.co.uk then you may switch off the PluginSponsors.com advertising present in the plugin option screens.' ); ?></p>
 
 
 
 
 
261
 
262
  <table class="form-table"><tr>
263
+ <th scope="row"><?php _e( 'Donated' ); ?></th>
264
+ <td><input type="checkbox" name="youtube_embed_donation" value="1"<?php if ( $options[ 'donation' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Tick if you have donated to Artiss.co.uk' ); ?></span></td>
265
  </tr></table>
266
 
267
+ <br/><a href="http://pluginsponsors.com/lib/privacy/"><?php _e( 'Read the PluginSponsors.com privacy policy.' ); ?></a><br/>
268
+
269
  <?php wp_nonce_field( 'youtube-embed-general','youtube_embed_general_nonce', true, true ); ?>
270
 
271
  <p class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e( 'Save Settings' ); ?>"/></p>
includes/{aye-options-lists.php → options-lists.php} RENAMED
@@ -4,15 +4,15 @@
4
  *
5
  * Screen for specifying different lists and the video IDs within them
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
  ?>
11
- <div class="wrap" style="width: 1010px;">
12
 
13
  <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
14
 
15
- <h2><?php _e( 'Artiss YouTube Embed Lists' ); ?></h2>
16
 
17
  <?php
18
  // Set current list number
@@ -23,12 +23,12 @@ if ( $list_no == '' ) { $list_no = 1; }
23
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-general', 'youtube_embed_general_nonce' ) ) ) {
24
 
25
  $class = 'updated fade';
26
- $message = __( 'Settings Saved.' );
27
  $new_id_list = '';
28
 
29
  if ( ( $_POST[ 'youtube_embed_video_list' ] == '' ) or ( $_POST[ 'youtube_embed_name' ] == '' ) ) {
30
  $class = 'error';
31
- $message = __( 'All fields must be completed.' );
32
  } else {
33
  $id_array = explode( "\n", $_POST[ 'youtube_embed_video_list' ] );
34
  $loop = 0;
@@ -37,10 +37,10 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
37
  // Loop through the video IDs
38
  while ( $loop < count( $id_array ) ) {
39
  // Extract the ID from the provided data
40
- $id = trim( aye_extract_id( $id_array[ $loop ] ) );
41
  // Now check its validity
42
  if ( $id != '' ) {
43
- $video_info = aye_validate_id( $id, true );
44
  if ( $video_info[ 'type' ] != 'v' ) { $valid = false; }
45
  $new_id_list .= $id . "\n";
46
  }
@@ -50,7 +50,7 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
50
  // If one or more IDs weren't valid, output an error
51
  if (!$valid) {
52
  $class = 'error';
53
- $message = __( 'Errors were found with your video list. See the list below for details.' );
54
  }
55
  }
56
 
@@ -70,11 +70,19 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
70
  }
71
 
72
  // Fetch options into an array
73
- if ( $class != "error" ) { $options = aye_set_list_defaults( $list_no ); }
74
- $general = aye_set_general_defaults();
75
- ?>
 
 
 
 
 
 
 
 
76
 
77
- <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=aye-list-options'; ?>">
78
 
79
  <span class="alignright">
80
  <select name="youtube_embed_list_no">
@@ -85,8 +93,8 @@ while ( $loop <= $general[ 'list_no' ] ) {
85
  $listfiles = get_option( 'youtube_embed_list' . $loop );
86
  $listname = $listfiles[ 'name' ];
87
 
88
- if ( $listname == '' ) { $listname = __( 'List' ) . ' ' . $loop; }
89
- if ( strlen( $listname ) > 30 ) { $listname = substr( $listname, 0, 30 ) . '&#8230;'; }
90
  echo '<option value="' . $loop . '"';
91
  if ( $list_no == $loop ) { echo " selected='selected'"; }
92
  echo '>' . __( $listname ) . "</option>\n";
@@ -98,7 +106,7 @@ while ( $loop <= $general[ 'list_no' ] ) {
98
  <input type="submit" name="List" class="button-secondary" value="<?php _e( 'Change list' ); ?>"/>
99
  </span><br/>
100
 
101
- <?php echo sprintf( __( 'These are the options for list ' ), $list_no) . '<br/>' . __( 'Update the name, if required, and specify a list of YouTube video IDs. Use the drop-down on the right hand side to swap between lists.' ); ?>
102
 
103
  <table class="form-table">
104
 
@@ -127,34 +135,34 @@ if ( $options[ 'list' ] != '' ) {
127
 
128
  $id_array = explode( "\n", $options[ 'list' ] );
129
 
130
- echo '<table class=\"widefat\">\n<thead>\n\t<tr>\n\t\t<th>' . __( 'Video ID' ) . '</th>\n\t\t<th>' . __( 'Video Title' ) . '</th>\n\t\t<th>' . __( 'Status' ) . "</th>\n\t</tr>\n</thead>\n<tbody>\n";
131
  $loop = 0;
132
 
133
  while ( $loop < count( $id_array ) ) {
134
 
135
  // Extract the ID from the provided data
136
 
137
- $id = trim( aye_extract_id( $id_array[ $loop ] ) );
138
  if ( $id != '' ) {
139
 
140
  // Validate the video type
141
 
142
- $video_info = aye_validate_id( $id, true );
143
  $type = $video_info[ 'type' ];
144
 
145
  if ( $type == 'p' ) {
146
- $text = __( 'This is a playlist' );
147
  $status = '-1';
148
  } else {
149
  if ( $type == '' ) {
150
- $text = __( 'Invalid video ID' );
151
  $status = '-2';
152
  } else {
153
  if ( strlen( $type ) != 1 ) {
154
- $text = __( 'YouTube API error' );
155
  $status = '-3';
156
  } else {
157
- $text = __( 'Valid video' );
158
  $status = '0';
159
  }
160
  }
@@ -172,11 +180,9 @@ if ( $options[ 'list' ] != '' ) {
172
 
173
  echo '"><img src="' . plugins_url() . '/youtube-embed/images/';
174
  if ( $status == 0 ) {
175
- $alt_text = __( 'The video ID is valid' );
176
- echo 'tick.png" alt="' . $alt_text . '" title="' . $alt_text . '" ';
177
  } else {
178
- $alt_text = __( 'The video ID is invalid' );
179
- echo 'cross.png" alt="' . $alt_text . '" title="' . $alt_text . '" ';
180
  }
181
 
182
  echo "height=\"16px\" width=\"16px\"/>&nbsp;" . $text . "</td>\n\t</tr>\n";
4
  *
5
  * Screen for specifying different lists and the video IDs within them
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
  ?>
11
+ <div class="wrap">
12
 
13
  <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
14
 
15
+ <h2>Artiss YouTube Embed Lists</h2>
16
 
17
  <?php
18
  // Set current list number
23
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-general', 'youtube_embed_general_nonce' ) ) ) {
24
 
25
  $class = 'updated fade';
26
+ $message = 'Settings Saved.';
27
  $new_id_list = '';
28
 
29
  if ( ( $_POST[ 'youtube_embed_video_list' ] == '' ) or ( $_POST[ 'youtube_embed_name' ] == '' ) ) {
30
  $class = 'error';
31
+ $message = 'All fields must be completed.';
32
  } else {
33
  $id_array = explode( "\n", $_POST[ 'youtube_embed_video_list' ] );
34
  $loop = 0;
37
  // Loop through the video IDs
38
  while ( $loop < count( $id_array ) ) {
39
  // Extract the ID from the provided data
40
+ $id = trim( ye_extract_id( $id_array[ $loop ] ) );
41
  // Now check its validity
42
  if ( $id != '' ) {
43
+ $video_info = ye_validate_id( $id, true );
44
  if ( $video_info[ 'type' ] != 'v' ) { $valid = false; }
45
  $new_id_list .= $id . "\n";
46
  }
50
  // If one or more IDs weren't valid, output an error
51
  if (!$valid) {
52
  $class = 'error';
53
+ $message = 'Errors were found with your video list. See the list below for details.';
54
  }
55
  }
56
 
70
  }
71
 
72
  // Fetch options into an array
73
+ if ( $class != "error" ) { $options = ye_set_list_defaults( $list_no ); }
74
+ $general = ye_set_general_defaults();
75
+
76
+ if ( $general[ 'donation' ] != 1 ) : ?>
77
+
78
+ <br/><div style="text-align: center;"><script type="text/javascript">
79
+ var psHost = (("https:" == document.location.protocol) ? "https://" : "http://");
80
+ document.write(unescape("%3Cscript src='" + psHost + "pluginsponsors.com/direct/spsn/display.php?client=youtube-embed&spot=' type='text/javascript'%3E%3C/script%3E"));
81
+ </script></div><br/>
82
+
83
+ <?php endif; ?>
84
 
85
+ <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=youtube-embed-lists'; ?>">
86
 
87
  <span class="alignright">
88
  <select name="youtube_embed_list_no">
93
  $listfiles = get_option( 'youtube_embed_list' . $loop );
94
  $listname = $listfiles[ 'name' ];
95
 
96
+ if ( $listname == '' ) { $listname = 'List ' . $loop; }
97
+ if ( strlen( $listname ) > 20 ) { $listname = strpos( $listname, 0, 20 ) . '&#8230;'; }
98
  echo '<option value="' . $loop . '"';
99
  if ( $list_no == $loop ) { echo " selected='selected'"; }
100
  echo '>' . __( $listname ) . "</option>\n";
106
  <input type="submit" name="List" class="button-secondary" value="<?php _e( 'Change list' ); ?>"/>
107
  </span><br/>
108
 
109
+ <?php echo __( 'These are the options for list ' . $list_no . '.<br/>Update the name, if required, and specify a list of YouTube video IDs. Use the drop-down on the right hand side to swap between lists.' ); ?>
110
 
111
  <table class="form-table">
112
 
135
 
136
  $id_array = explode( "\n", $options[ 'list' ] );
137
 
138
+ echo "<table class=\"widefat\">\n<thead>\n\t<tr>\n\t\t<th>Video ID</th>\n\t\t<th>Video Title</th>\n\t\t<th>Status</th>\n\t</tr>\n</thead>\n<tbody>\n";
139
  $loop = 0;
140
 
141
  while ( $loop < count( $id_array ) ) {
142
 
143
  // Extract the ID from the provided data
144
 
145
+ $id = trim( ye_extract_id( $id_array[ $loop ] ) );
146
  if ( $id != '' ) {
147
 
148
  // Validate the video type
149
 
150
+ $video_info = ye_validate_id( $id, true );
151
  $type = $video_info[ 'type' ];
152
 
153
  if ( $type == 'p' ) {
154
+ $text = 'This is a playlist';
155
  $status = '-1';
156
  } else {
157
  if ( $type == '' ) {
158
+ $text = 'Invalid video ID';
159
  $status = '-2';
160
  } else {
161
  if ( strlen( $type ) != 1 ) {
162
+ $text = 'YouTube API error';
163
  $status = '-3';
164
  } else {
165
+ $text = 'Valid video';
166
  $status = '0';
167
  }
168
  }
180
 
181
  echo '"><img src="' . plugins_url() . '/youtube-embed/images/';
182
  if ( $status == 0 ) {
183
+ echo 'tick.png" alt="The video ID is valid" title="The video ID is valid" ';
 
184
  } else {
185
+ echo 'cross.png" alt="The video ID is invalid" title="The video ID is invalid" ';
 
186
  }
187
 
188
  echo "height=\"16px\" width=\"16px\"/>&nbsp;" . $text . "</td>\n\t</tr>\n";
includes/{aye-options-profiles.php → options-profiles.php} RENAMED
@@ -4,29 +4,15 @@
4
  *
5
  * Screen for specifying different profiles and settings the options for each
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
  ?>
11
- <div class="wrap" style="width: 1010px;">
12
 
13
  <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
14
 
15
- <h2><?php _e( 'Artiss YouTube Embed Profiles' ); ?></h2><br/>
16
-
17
- <div style="width: 990px; height: 220px; border: 1px solid #ddd; padding: 10px;">
18
- <a href="http://themefuse.com/wp-themes-shop/?plugin=youtube-embed" target="_blank"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/themefuse_banner.jpg" alt="ThemeFuse.com - Premium WordPress Themes" title="ThemeFuse.com - Premium WordPress Themes" style="float: left; padding-right: 10px;"></a>
19
- <h3>Donate</h3>
20
- <p>If you like this plugin and appreciate the effort being put into it, <a href="http://www.artiss.co.uk/donate">please consider donating</a>. You can donate via PayPal or purchase something from my Amazon Wish List.</p>
21
- <h3>Follow Me</h3>
22
- <p>Please stay in touch with the latest news via one of the following social streams...</p>
23
- <p align="center">
24
- <a href="http://www.twitter.com/artiss_tech"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/Twitter.png" alt="Follow Artiss.co.uk on Twitter" title="Follow Artiss.co.uk on Twitter" style="margin-right: 20px;"></a>
25
- <a href="http://www.facebook.com/artiss.co.uk"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/Facebook.png" alt="Follow Artiss.co.uk on Facebook" title="Follow Artiss.co.uk on Facebook" style="margin-right: 20px;"></a>
26
- <a href="https://plus.google.com/108446415028687420620?rel=author"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/Google+.png" alt="Follow Artiss.co.uk on Google+" title="Follow Artiss.co.uk on Google+" style="margin-right: 20px;"></a>
27
- <a href="http://www.artiss.co.uk/feed"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/RSS.png" alt="Follow Artiss.co.uk on RSS feed" title="Follow Artiss.co.uk on RSS feed"></a>
28
- </p>
29
- </div><br/>
30
 
31
  <?php
32
  // Set current profile number
@@ -36,64 +22,45 @@ if ( $profile_no == '' ) { $profile_no = 0; }
36
  // If options have been updated on screen, update the database
37
  if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-profile' , 'youtube_embed_profile_nonce' ) ) ) {
38
 
39
- if ( !empty( $_POST[ 'youtube_embed_name' ] ) ) { $options[ 'name' ] = $_POST[ 'youtube_embed_name' ]; }
40
- if ( !empty( $_POST[ 'youtube_embed_type' ] ) ) { $options[ 'type' ] = $_POST[ 'youtube_embed_type' ]; }
41
- if ( !empty( $_POST[ 'youtube_embed_playlist' ] ) ) { $options[ 'playlist' ] = $_POST[ 'youtube_embed_playlist' ]; }
42
  $options[ 'width' ] = $_POST[ 'youtube_embed_width' ];
43
- $options[ 'height' ] = $_POST[ 'youtube_embed_height' ];
44
 
45
- $options[ 'template' ] = htmlspecialchars_decode( $_POST[ 'youtube_embed_template' ] );
46
  if ( strpos( $options[ 'template' ], '%video%' ) === false ) { $options[ 'template' ] = '%video%'; }
47
 
48
- $options[ 'style' ] = $_POST[ 'youtube_embed_style' ];
49
- $options[ 'fullscreen' ] = $_POST[ 'youtube_embed_fullscreen' ];
50
- $options[ 'autoplay'] = $_POST[ 'youtube_embed_autoplay' ];
51
- $options[ 'loop'] = $_POST[ 'youtube_embed_loop' ];
52
- $options[ 'cc'] = $_POST[ 'youtube_embed_cc' ];
53
- $options[ 'annotation'] = $_POST[ 'youtube_embed_annotation' ];
54
- $options[ 'related'] = $_POST[ 'youtube_embed_related' ];
55
- $options[ 'info'] = $_POST[ 'youtube_embed_info' ];
56
- $options[ 'link'] = $_POST[ 'youtube_embed_link' ];
57
- $options[ 'react'] = $_POST[ 'youtube_embed_react' ];
58
- $options[ 'sweetspot'] = $_POST[ 'youtube_embed_sweetspot' ];
59
- $options[ 'disablekb'] = $_POST[ 'youtube_embed_disablekb' ];
60
- if ( !empty( $_POST[ 'youtube_embed_autohide' ] ) ) { $options[ 'autohide'] = $_POST[ 'youtube_embed_autohide' ]; }
61
- $options[ 'controls'] = $_POST[ 'youtube_embed_controls' ];
62
- if ( !empty( $_POST[ 'youtube_embed_fallback' ] ) ) { $options[ 'fallback'] = $_POST[ 'youtube_embed_fallback' ]; }
63
- if ( !empty( $_POST[ 'youtube_embed_wmode' ] ) ) { $options[ 'wmode'] = $_POST[ 'youtube_embed_wmode' ]; }
64
- $options[ 'audio'] = $_POST[ 'youtube_embed_audio' ];
65
- $options[ 'hd'] = $_POST[ 'youtube_embed_hd' ];
66
- if ( !empty( $_POST[ 'youtube_embed_color' ] ) ) { $options[ 'color' ] = $_POST[ 'youtube_embed_color' ]; }
67
- if ( !empty( $_POST[ 'youtube_embed_theme' ] ) ) { $options[ 'theme' ] = $_POST[ 'youtube_embed_theme' ]; }
68
- $options[ 'https' ] = $_POST[ 'youtube_embed_https' ];
69
- $options[ 'modest' ] = $_POST[ 'youtube_embed_modest' ];
70
- $options[ 'dynamic' ] = $_POST[ 'youtube_embed_dynamic' ];
71
- $options[ 'fixed' ] = $_POST[ 'youtube_embed_fixed' ];
72
-
73
- if ( !empty( $_POST[ 'youtube_embed_size' ] ) ) { $default_size = $_POST[ 'youtube_embed_size' ]; }
74
 
75
  if ( $default_size !== '' ) {
76
  $options[ 'width' ] = ltrim( substr( $default_size, 0, 4 ), '0' );
77
  $options[ 'height'] = ltrim( substr( $default_size, -4, 4 ), '0' );
78
  }
79
 
80
- // Set width or height, if missing
81
-
82
- if ( ( $options[ 'width' ] == '' ) && ( $options[ 'height' ] == '' ) ) {
83
- if ( isset( $GLOBALS[ 'content_width' ] ) ) {
84
- $options[ 'width' ] = $GLOBALS[ 'content_width' ];
85
- } else {
86
- $options[ 'width' ] = 560;
87
- }
88
- $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
89
- }
90
- if ( ( $options[ 'width' ] == '' ) && ( $options[ 'height' ] != '' ) ) {
91
- $options[ 'width' ] = round( ( $options[ 'height' ] / 9 ) * 16, 0 );
92
- }
93
- if ( ( $options[ 'width' ] != '' ) && ( $options[ 'height' ] == '' ) ) {
94
- $options[ 'height' ] = 27 + round( ( $options[ 'width' ] / 16 ) * 9, 0 );
95
- }
96
-
97
  update_option( 'youtube_embed_profile' . $profile_no, $options );
98
  echo '<div class="updated fade"><p><strong>' . __( $options[ 'name' ].' Profile Saved.' ) . "</strong></p></div>\n";
99
  } else {
@@ -104,26 +71,31 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
104
  if ( !empty( $_POST[ 'Video' ] ) ) { $video_type = $_POST[ 'youtube_embed_video_type' ]; } else { $video_type = 'd'; }
105
 
106
  // Fetch options into an array
107
- $options = aye_set_profile_defaults( $profile_no );
108
- $general = aye_set_general_defaults();
109
- ?>
 
 
 
 
 
 
110
 
111
- <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=aye-profile-options' ?>">
 
 
112
 
113
  <span class="alignright">
114
  <select name="youtube_embed_profile_no">
115
- <?php aye_generate_profile_list( $profile_no, $general[ 'profile_no' ] ) ?>
116
  </select>
117
  <input type="submit" name="Profile" class="button-secondary" value="<?php _e('Change profile'); ?>"/>
118
  </span><br/>
119
 
120
  <?php
121
- if ( $profile_no == '0' ) {
122
- _e( 'These are the options for the default profile.' );
123
- } else {
124
- sprintf( _e( 'These are the options for profile %s.' ), $profile_no );
125
- }
126
- echo ' ' . __( 'Use the drop-down on the right hand side to swap between profiles.' );
127
  ?>
128
 
129
  <table class="form-table">
@@ -137,23 +109,22 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
137
  <tr valign="top">
138
  <th scope="row"><?php _e( 'Video Embed Type' ); ?></th>
139
  <td><span class="description"><?php _e( 'The type of player to use for videos.' ); ?></span><br/>
140
- <input type="radio" name="youtube_embed_type" value="v"<?php if ( $options[ 'type' ] == "v" ) { echo ' checked="checked"'; } ?>/><?php echo '&nbsp;' . __( 'IFRAME' ); ?><span class="description"><?php echo '&nbsp;' . __( 'Uses HTML5, if available. Alternatively, uses AS3 Flash player. This is the current YouTube default..' ); ?></span><br/>
141
- <input type="radio" name="youtube_embed_type" value="p"<?php if ( $options[ 'type' ] == "p" ) { echo ' checked="checked"'; } ?>/><?php echo '&nbsp;' . __( 'OBJECT' ); ?><span class="description"><?php echo '&nbsp;' . __( 'Use the AS3 Flash player.' ); ?></span><br/>
142
- <input type="radio" name="youtube_embed_type" value="c"<?php if ( $options[ 'type' ] == "c" ) { echo ' checked="checked"'; } ?>/><?php echo '&nbsp;' . __( 'Chromeless' ); ?><span class="description"><?php echo '&nbsp;' . __( 'Use the <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-chromeless">Chromeless</a> version of the AS3 Flash Player.' ); ?></span><br/>
143
- <input type="radio" name="youtube_embed_type" value="m"<?php if ( $options[ 'type' ] == "m" ) { echo ' checked="checked"'; } ?>/><?php echo '&nbsp;' . __( 'EmbedPlus' ); ?><span class="description"><?php echo '&nbsp;' . __( 'Use <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-embedplus">EmbedPlus</a>, if Flash is available.' ); ?></span>
144
  </td>
145
  </tr>
146
 
147
  <tr valign="top">
148
  <th scope="row"><?php _e( 'Playlist Embed Type' ); ?></th>
149
  <td><span class="description"><?php _e( 'The type of player to use when showing playlists.' ); ?></span><br/>
150
- <input type="radio" name="youtube_embed_playlist" value="v"<?php if ( $options[ 'playlist' ] == "v" ) { echo ' checked="checked"'; } ?>/><?php echo '&nbsp;' . __( 'IFRAME' ); ?><br/>
151
- <input type="radio" name="youtube_embed_playlist" value="o"<?php if ( $options[ 'playlist' ] == "o" ) { echo ' checked="checked"'; } ?>/><?php echo '&nbsp;' . __( 'OBJECT' ); ?><br/>
152
  </td>
153
  </tr>
154
  </table>
155
 
156
- <br/><span class="yt_heading"><?php _e( 'Options For All Player Types' ); ?></span>
157
 
158
  <table class="form-table">
159
  <tr>
@@ -177,23 +148,13 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
177
  <th scope="row"><?php _e( 'Default Sizes' ); ?></th>
178
  <td><select name="youtube_embed_size">
179
  <option value=""<?php if ( $default_size == '' ) { echo " selected='selected'"; } ?>><?php _e( 'Use above sizes' ); ?></option>
180
- <option value="04800385"<?php if ( $default_size == "04800385" ) { echo " selected='selected'"; } ?>><?php echo '480x385 4:3'; ?></option>
181
- <option value="05600340"<?php if ( $default_size == "05600340" ) { echo " selected='selected'"; } ?>><?php echo '560x340 16:9'; ?></option>
182
- <option value="06400385"<?php if ( $default_size == "06400385" ) { echo " selected='selected'"; } ?>><?php echo '640x385 16:9'; ?></option>
183
- <option value="08530505"<?php if ( $default_size == "08530505" ) { echo " selected='selected'"; } ?>><?php echo '853x505 16:9'; ?></option>
184
- <option value="12800745"<?php if ( $default_size == "12800745" ) { echo " selected='selected'"; } ?>><?php echo '1280x745 16:9'; ?></option>
185
  </select>&nbsp;<span class="description"><?php _e( 'Select one of these default sizes to override the above video sizes' ); ?></span></td>
186
  </tr>
187
-
188
- <tr>
189
- <th scope="row"><?php _e( 'Dynamically Resize' ); ?></th>
190
- <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>
191
- </tr>
192
-
193
- <tr>
194
- <th scope="row">&nbsp;&nbsp;&nbsp;&nbsp;<?php _e( 'Set Maximum Size' ); ?></th>
195
- <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>
196
- </tr>
197
  </table>
198
 
199
  <table class="form-table">
@@ -208,9 +169,14 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
208
  <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>
209
  </tr>
210
 
 
 
 
 
211
  </table>
212
 
213
- <br/><span class="yt_heading"><?php _e( 'Options Not Supported by EmbedPlus' ); ?></span>
 
214
 
215
  <table class="form-table">
216
 
@@ -229,8 +195,8 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
229
  </tr>
230
 
231
  <tr>
232
- <th scope="row"><?php _e( 'SSL' ); ?></th>
233
- <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>
234
  </tr>
235
 
236
  <tr>
@@ -238,11 +204,6 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
238
  <td><input type="checkbox" name="youtube_embed_loop" value="1"<?php if ( $options[ 'loop' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Play the initial video again and again. In the case of a playlist, this will play the entire playlist and then start again at the first video' ); ?></span></td>
239
  </tr>
240
 
241
- <tr>
242
- <th scope="row"><?php _e( 'Information' ); ?></th>
243
- <td><input type="checkbox" name="youtube_embed_info" value="1"<?php if ( $options[ 'info' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Display the video title and uploader before the video starts' ); ?></span></td>
244
- </tr>
245
-
246
  <tr>
247
  <th scope="row"><?php _e( 'Theme' ); ?></th>
248
  <td><select name="youtube_embed_theme">
@@ -252,7 +213,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
252
  </tr>
253
  </table>
254
 
255
- <br/><span class="yt_heading"><?php _e( 'Options for AS3 Player' ); ?></span>
256
  <br/><br/>The following options are not supported if using EmbedPlus or if the IFRAME player uses HTML5.
257
 
258
  <table class="form-table">
@@ -277,13 +238,13 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
277
  </tr>
278
 
279
  <tr>
280
- <th scope="row"><?php _e( 'Link to YouTube' ); ?></th>
281
- <td><input type="checkbox" name="youtube_embed_link" value="1"<?php if ( $options[ 'link' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Video links back to YouTube when clicked' ); ?></span></td>
282
  </tr>
283
 
284
  <tr>
285
- <th scope="row"><?php _e( 'Modest Branding' ); ?></th>
286
- <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>
287
  </tr>
288
 
289
  <tr>
@@ -300,7 +261,8 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
300
  </tr>
301
  </table>
302
 
303
- <br/><span class="yt_heading"><?php _e( 'Options Not Supported by HTML5 Player' ); ?></span>
 
304
 
305
  <table class="form-table">
306
  <tr valign="top">
@@ -311,17 +273,16 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
311
  <option value="window"<?php if ( $options[ 'wmode' ] == "window" ) { echo " selected='selected'"; } ?>><?php _e( 'Window' ); ?></option>
312
  </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>
313
  </tr>
314
-
315
  </table>
316
 
317
- <br/><span class="yt_heading"><?php _e( 'Options Only Supported By EmbedPlus' ); ?></span>&nbsp;&nbsp;<span class="description"><?php echo '<a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-embedplus">' . __( 'Learn more about EmbedPlus' ) . '</a>'; ?></span>
318
 
319
  <table class="form-table">
320
  <tr valign="top">
321
  <th scope="row"><?php _e( 'Fallback Embed Type' ); ?></th>
322
  <td><span class="description"><?php _e( 'The type of player to use if Flash is not available and EmbedPlus cannot be used.' ); ?></span><br/>
323
- <input type="radio" name="youtube_embed_fallback" value="v"<?php if ( $options[ 'fallback' ] == "v" ) { echo ' checked="checked"'; } ?>/>&nbsp;<?php _e( 'IFRAME' ); ?><br/>
324
- <input type="radio" name="youtube_embed_fallback" value="p"<?php if ( $options[ 'fallback' ] == "p" ) { echo ' checked="checked"'; } ?>/>&nbsp;<?php _e( 'OBJECT' ); ?></td>
325
  </tr>
326
 
327
  <tr>
@@ -346,10 +307,8 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
346
 
347
  </form>
348
 
349
- <div class="updated fade"><p><strong><?php _e( 'Would you like the video below to be yours? <a href="http://www.artiss.co.uk/contact">Contact me</a> for sponsorship information.' ); ?></strong></p></div>
350
-
351
  <a href="#" name="video"></a>
352
- <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=aye-profile-options#video' ?>">
353
  <div class="ytbox_grey">
354
  <h3><?php _e( 'YouTube Video Sample' ); ?></h3>
355
  <p><?php _e( 'This uses the above settings, once they have been saved. <b>Would you like this to be your video? If so, <a href="http://www.artiss.co.uk/contact">contact me</a>!</b>' ); ?></p>
@@ -364,11 +323,11 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
364
  <input type="submit" name="Video" class="button-secondary" value="<?php _e( 'Change video' ); ?>"/></p>
365
 
366
  <p><?php
367
- if ( $video_type == "d" ) { $id = '-0Xa4bHcJu8'; $type = ''; }
368
  if ( $video_type == "p" ) { $id = 'YVvn8dpSAt0'; $type = 'm'; }
369
  if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; $type = ''; ; }
370
  if ( $video_type == "l" ) { $id = '095393D5B42B2266'; $type = ''; }
371
- echo aye_generate_youtube_code( $id, $type, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $profile_no );
372
  ?></p>
373
  </div>
374
 
4
  *
5
  * Screen for specifying different profiles and settings the options for each
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
  ?>
11
+ <div class="wrap">
12
 
13
  <div class="icon32"><img src="<?php echo plugins_url(); ?>/youtube-embed/images/screen_icon.png" alt="" title="" height="32px" width="32px"/><br /></div>
14
 
15
+ <h2>Artiss YouTube Embed Profiles</h2>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  <?php
18
  // Set current profile number
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' ];
28
  $options[ 'width' ] = $_POST[ 'youtube_embed_width' ];
29
+ $options[ 'height' ] = $_POST[ 'youtube_embed_height' ];
30
 
31
+ $options[ 'template' ] = htmlspecialchars_decode( $_POST[ 'youtube_embed_template' ] );
32
  if ( strpos( $options[ 'template' ], '%video%' ) === false ) { $options[ 'template' ] = '%video%'; }
33
 
34
+ $options[ 'style' ] = $_POST[ 'youtube_embed_style' ];
35
+ $options[ 'fullscreen' ] = $_POST[ 'youtube_embed_fullscreen' ];
36
+ $options[ 'autoplay'] = $_POST[ 'youtube_embed_autoplay' ];
37
+ $options[ 'loop'] = $_POST[ 'youtube_embed_loop' ];
38
+ $options[ 'cc'] = $_POST[ 'youtube_embed_cc' ];
39
+ $options[ 'annotation'] = $_POST[ 'youtube_embed_annotation' ];
40
+ $options[ 'related'] = $_POST[ 'youtube_embed_related' ];
41
+ $options[ 'info'] = $_POST[ 'youtube_embed_info' ];
42
+ $options[ 'link'] = $_POST[ 'youtube_embed_link' ];
43
+ $options[ 'react'] = $_POST[ 'youtube_embed_react' ];
44
+ $options[ 'sweetspot'] = $_POST[ 'youtube_embed_sweetspot' ];
45
+ $options[ 'disablekb'] = $_POST[ 'youtube_embed_disablekb' ];
46
+ $options[ 'autohide'] = $_POST[ 'youtube_embed_autohide' ];
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
 
59
  if ( $default_size !== '' ) {
60
  $options[ 'width' ] = ltrim( substr( $default_size, 0, 4 ), '0' );
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 {
71
  if ( !empty( $_POST[ 'Video' ] ) ) { $video_type = $_POST[ 'youtube_embed_video_type' ]; } else { $video_type = 'd'; }
72
 
73
  // Fetch options into an array
74
+ $options = ye_set_profile_defaults( $profile_no );
75
+ $general = ye_set_general_defaults();
76
+
77
+ if ( $general[ 'donation' ] != 1 ) : ?>
78
+
79
+ <br/><div style="text-align: center;"><script type="text/javascript">
80
+ var psHost = (("https:" == document.location.protocol) ? "https://" : "http://");
81
+ document.write(unescape("%3Cscript src='" + psHost + "pluginsponsors.com/direct/spsn/display.php?client=youtube-embed&spot=' type='text/javascript'%3E%3C/script%3E"));
82
+ </script></div><br/>
83
 
84
+ <?php endif; ?>
85
+
86
+ <form method="post" action="<?php echo get_bloginfo( 'wpurl' ) . '/wp-admin/admin.php?page=youtube-embed-profiles' ?>">
87
 
88
  <span class="alignright">
89
  <select name="youtube_embed_profile_no">
90
+ <?php ye_generate_profile_list( $profile_no, $general[ 'profile_no' ] ) ?>
91
  </select>
92
  <input type="submit" name="Profile" class="button-secondary" value="<?php _e('Change profile'); ?>"/>
93
  </span><br/>
94
 
95
  <?php
96
+ _e( 'These are the options for ' );
97
+ if ( $profile_no == "0" ) { _e( 'the default profile.' ); } else { _e( 'profile ' . $profile_no . "." ); }
98
+ _e( '<br/>Use the drop-down on the right hand side to swap between profiles.' );
 
 
 
99
  ?>
100
 
101
  <table class="form-table">
109
  <tr valign="top">
110
  <th scope="row"><?php _e( 'Video Embed Type' ); ?></th>
111
  <td><span class="description"><?php _e( 'The type of player to use for videos.' ); ?></span><br/>
112
+ <input type="radio" name="youtube_embed_type" value="v"<?php if ( $options[ 'type' ] == "v" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;IFRAME' ); ?><span class="description"><?php _e( '&nbsp;Uses HTML5, where available. This is the current YouTube default..' ); ?></span><br/>
113
+ <input type="radio" name="youtube_embed_type" value="p"<?php if ( $options[ 'type' ] == "p" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;OBJECT' ); ?><span class="description"><?php _e( '&nbsp;Use the AS3 Flash player.' ); ?></span><br/>
114
+ <input type="radio" name="youtube_embed_type" value="m"<?php if ( $options[ 'type' ] == "m" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;EmbedPlus' ); ?><span class="description"><?php _e( '&nbsp;Use <a href="http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-embedplus">EmbedPlus</a>, if Flash is available.' ); ?></span>
 
115
  </td>
116
  </tr>
117
 
118
  <tr valign="top">
119
  <th scope="row"><?php _e( 'Playlist Embed Type' ); ?></th>
120
  <td><span class="description"><?php _e( 'The type of player to use when showing playlists.' ); ?></span><br/>
121
+ <input type="radio" name="youtube_embed_playlist" value="v"<?php if ( $options[ 'playlist' ] == "v" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;IFRAME' ); ?><br/>
122
+ <input type="radio" name="youtube_embed_playlist" value="o"<?php if ( $options[ 'playlist' ] == "o" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;OBJECT' ); ?><br/>
123
  </td>
124
  </tr>
125
  </table>
126
 
127
+ <br/><span class="yt_heading"><?php _e( 'All Embed Type Options' ); ?></span>
128
 
129
  <table class="form-table">
130
  <tr>
148
  <th scope="row"><?php _e( 'Default Sizes' ); ?></th>
149
  <td><select name="youtube_embed_size">
150
  <option value=""<?php if ( $default_size == '' ) { echo " selected='selected'"; } ?>><?php _e( 'Use above sizes' ); ?></option>
151
+ <option value="04800385"<?php if ( $default_size == "04800385" ) { echo " selected='selected'"; } ?>><?php _e ( '480x385 4:3' ); ?></option>
152
+ <option value="05600340"<?php if ( $default_size == "05600340" ) { echo " selected='selected'"; } ?>><?php _e( '560x340 16:9' ); ?></option>
153
+ <option value="06400385"<?php if ( $default_size == "06400385" ) { echo " selected='selected'"; } ?>><?php _e( '640x385 16:9' ); ?></option>
154
+ <option value="08530505"<?php if ( $default_size == "08530505" ) { echo " selected='selected'"; } ?>><?php _e( '853x505 16:9' ); ?></option>
155
+ <option value="12800745"<?php if ( $default_size == "12800745" ) { echo " selected='selected'"; } ?>><?php _e( '1280x745 16:9' ); ?></option>
156
  </select>&nbsp;<span class="description"><?php _e( 'Select one of these default sizes to override the above video sizes' ); ?></span></td>
157
  </tr>
 
 
 
 
 
 
 
 
 
 
158
  </table>
159
 
160
  <table class="form-table">
169
  <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>
170
  </tr>
171
 
172
+ <tr>
173
+ <th scope="row"><?php _e( 'Drop Shadow Height' ); ?></th>
174
+ <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>
175
+ </tr>
176
  </table>
177
 
178
+ <br/><span class="yt_heading"><?php _e( 'Non-EmbedPlus Options' ); ?></span>
179
+ <br/><br/>The following options are not supported by EmbedPlus.
180
 
181
  <table class="form-table">
182
 
195
  </tr>
196
 
197
  <tr>
198
+ <th scope="row"><?php _e( 'HTTPS' ); ?></th>
199
+ <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>
200
  </tr>
201
 
202
  <tr>
204
  <td><input type="checkbox" name="youtube_embed_loop" value="1"<?php if ( $options[ 'loop' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Play the initial video again and again. In the case of a playlist, this will play the entire playlist and then start again at the first video' ); ?></span></td>
205
  </tr>
206
 
 
 
 
 
 
207
  <tr>
208
  <th scope="row"><?php _e( 'Theme' ); ?></th>
209
  <td><select name="youtube_embed_theme">
213
  </tr>
214
  </table>
215
 
216
+ <br/><span class="yt_heading"><?php _e( 'Non-EmbedPlus &amp; HTML5 Options' ); ?></span>
217
  <br/><br/>The following options are not supported if using EmbedPlus or if the IFRAME player uses HTML5.
218
 
219
  <table class="form-table">
238
  </tr>
239
 
240
  <tr>
241
+ <th scope="row"><?php _e( 'Information' ); ?></th>
242
+ <td><input type="checkbox" name="youtube_embed_info" value="1"<?php if ( $options[ 'info' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Display the video title and uploader before the video starts' ); ?></span></td>
243
  </tr>
244
 
245
  <tr>
246
+ <th scope="row"><?php _e( 'Link to YouTube' ); ?></th>
247
+ <td><input type="checkbox" name="youtube_embed_link" value="1"<?php if ( $options[ 'link' ] == "1" ) { echo ' checked="checked"'; } ?>/>&nbsp;<span class="description"><?php _e( 'Video links back to YouTube when clicked' ); ?></span></td>
248
  </tr>
249
 
250
  <tr>
261
  </tr>
262
  </table>
263
 
264
+ <br/><span class="yt_heading"><?php _e( 'Non-IFRAME Options' ); ?></span>
265
+ <br/><br/>The following options are not supported if using the IFRAME player.
266
 
267
  <table class="form-table">
268
  <tr valign="top">
273
  <option value="window"<?php if ( $options[ 'wmode' ] == "window" ) { echo " selected='selected'"; } ?>><?php _e( 'Window' ); ?></option>
274
  </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>
275
  </tr>
 
276
  </table>
277
 
278
+ <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>
279
 
280
  <table class="form-table">
281
  <tr valign="top">
282
  <th scope="row"><?php _e( 'Fallback Embed Type' ); ?></th>
283
  <td><span class="description"><?php _e( 'The type of player to use if Flash is not available and EmbedPlus cannot be used.' ); ?></span><br/>
284
+ <input type="radio" name="youtube_embed_fallback" value="v"<?php if ( $options[ 'fallback' ] == "v" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;IFRAME' ); ?><br/>
285
+ <input type="radio" name="youtube_embed_fallback" value="p"<?php if ( $options[ 'fallback' ] == "p" ) { echo ' checked="checked"'; } ?>/><?php _e( '&nbsp;OBJECT' ); ?></td>
286
  </tr>
287
 
288
  <tr>
307
 
308
  </form>
309
 
 
 
310
  <a href="#" name="video"></a>
311
+ <form method="post" action="<?php echo get_bloginfo( 'wpurl' ).'/wp-admin/admin.php?page=youtube-embed-profiles#video' ?>">
312
  <div class="ytbox_grey">
313
  <h3><?php _e( 'YouTube Video Sample' ); ?></h3>
314
  <p><?php _e( 'This uses the above settings, once they have been saved. <b>Would you like this to be your video? If so, <a href="http://www.artiss.co.uk/contact">contact me</a>!</b>' ); ?></p>
323
  <input type="submit" name="Video" class="button-secondary" value="<?php _e( 'Change video' ); ?>"/></p>
324
 
325
  <p><?php
326
+ if ( $video_type == "d" ) { $id = 'TJJJaDMpCn0'; $type = ''; }
327
  if ( $video_type == "p" ) { $id = 'YVvn8dpSAt0'; $type = 'm'; }
328
  if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; $type = ''; ; }
329
  if ( $video_type == "l" ) { $id = '095393D5B42B2266'; $type = ''; }
330
+ echo ye_generate_youtube_code( $id, $type, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $profile_no );
331
  ?></p>
332
  </div>
333
 
includes/options-widgets.php ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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' ] ) == 'm' ) { echo " selected='selected'"; }
35
+ echo '>' . __( 'EmbedPlus' ) . '</option></select></p>';
36
+
37
+ // Template
38
+ $field_id = $this -> get_field_id( 'template' );
39
+ $field_name = $this -> get_field_name( 'template' );
40
+ 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>';
41
+
42
+ // Style
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
+ $field_id = $this -> get_field_id( 'width' );
49
+ $field_name = $this -> get_field_name( 'width' );
50
+ 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;';
51
+
52
+ $field_id = $this -> get_field_id( 'height' );
53
+ $field_name = $this -> get_field_name( 'height' );
54
+ echo '<input type="text" size="3" maxlength="3" id="' . $field_id . '" name="' . $field_name . '" value="' . attribute_escape( $instance[ 'height' ] ) . '" />&nbsp;pixels</p>';
55
+
56
+ echo "<table>\n";
57
+
58
+ // Start field
59
+ $field_id = $this -> get_field_id( 'start' );
60
+ $field_name = $this -> get_field_name( 'start' );
61
+ 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>';
62
+
63
+ // Autoplay field
64
+ $field_id = $this -> get_field_id( 'autoplay' );
65
+ $field_name = $this -> get_field_name( 'autoplay' );
66
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Autoplay' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
67
+ if ( attribute_escape( $instance[ 'autoplay' ] ) == '' ) { echo " selected='selected'"; }
68
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
69
+ if ( attribute_escape( $instance[ 'autoplay' ] ) == '0' ) { echo " selected='selected'"; }
70
+ echo '>' . __( 'No' ) . '</option><option value="1"';
71
+ if ( attribute_escape( $instance[ 'autoplay' ] ) == '1' ) { echo " selected='selected'"; }
72
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
73
+
74
+ echo "</table>\n";
75
+
76
+ ?>
77
+ <h4><?php _e( 'Non-EmbedPlus Options' ); ?></h4>
78
+ <?php
79
+
80
+ // Autohide field
81
+ $field_id = $this -> get_field_id( 'autohide' );
82
+ $field_name = $this -> get_field_name( 'autohide' );
83
+ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Auto hide' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
84
+ if ( attribute_escape( $instance[ 'autohide' ] ) == '' ) { echo " selected='selected'"; }
85
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
86
+ if ( attribute_escape( $instance[ 'autohide' ] ) == '0' ) { echo " selected='selected'"; }
87
+ echo '>' . __( 'Controls &amp; progress bar visible' ) . '</option><option value="1"';
88
+ if ( attribute_escape( $instance[ 'autohide' ] ) == '1' ) { echo " selected='selected'"; }
89
+ echo '>' . __( 'Controls &amp; progress bar fade out' ) . '</option><option value="2"';
90
+ if ( attribute_escape( $instance[ 'autohide' ] ) == '2' ) { echo " selected='selected'"; }
91
+ echo '>' . __( 'Progress bar fades' ) . '</option></select></p>';
92
+
93
+ // List field
94
+ $field_id = $this -> get_field_id( 'list' );
95
+ $field_name = $this -> get_field_name( 'list' );
96
+ echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'List Playback' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '"><option value=""';
97
+ if ( attribute_escape( $instance[ 'list' ] ) == '' ) { echo " selected='selected'"; }
98
+ echo '>' . __( 'Profile default' ) . '</option><option value="order"';
99
+ if ( attribute_escape( $instance[ 'list' ] ) == 'order' ) { echo " selected='selected'"; }
100
+ echo '>' . __( 'Play each video in order' ) . '</option><option value="random"';
101
+ if ( attribute_escape( $instance[ 'list' ] ) == 'random' ) { echo " selected='selected'"; }
102
+ echo '>' . __( 'Play videos randomly' ) . '</option><option value="single"';
103
+ if ( attribute_escape( $instance[ 'list' ] ) == 'single' ) { echo " selected='selected'"; }
104
+ echo '>' . __( 'Play one random video' ) . '</option></select></p>';
105
+
106
+ echo "<table>\n";
107
+
108
+ // Controls field
109
+ $field_id = $this -> get_field_id( 'controls' );
110
+ $field_name = $this -> get_field_name( 'controls' );
111
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Controls' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
112
+ if ( attribute_escape( $instance[ 'controls' ] ) == '' ) { echo " selected='selected'"; }
113
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
114
+ if ( attribute_escape( $instance[ 'controls' ] ) == '0' ) { echo " selected='selected'"; }
115
+ echo '>' . __( 'No' ) . '</option><option value="1"';
116
+ if ( attribute_escape( $instance[ 'controls' ] ) == '1' ) { echo " selected='selected'"; }
117
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
118
+
119
+ // Loop video field
120
+ $field_id = $this -> get_field_id( 'loop' );
121
+ $field_name = $this -> get_field_name( 'loop' );
122
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Loop Video' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
123
+ if ( attribute_escape( $instance[ 'loop' ] ) == '' ) { echo " selected='selected'"; }
124
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
125
+ if ( attribute_escape( $instance[ 'loop' ] ) == '0' ) { echo " selected='selected'"; }
126
+ echo '>' . __( 'No' ) . '</option><option value="1"';
127
+ if ( attribute_escape( $instance[ 'loop' ] ) == '1' ) { echo " selected='selected'"; }
128
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
129
+
130
+ echo "</table>\n";
131
+ ?>
132
+ <h4><?php _e( 'Non-EmbedPlus &amp; HTML5 Options' ); ?></h4>
133
+ <?php
134
+
135
+ echo "<table>\n";
136
+
137
+ // Annotation field
138
+ $field_id = $this -> get_field_id( 'annotation' );
139
+ $field_name = $this -> get_field_name( 'annotation' );
140
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Annotations' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
141
+ if ( attribute_escape( $instance[ 'annotation' ] ) == '' ) { echo " selected='selected'"; }
142
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
143
+ if ( attribute_escape( $instance[ 'annotation' ] ) == '0' ) { echo " selected='selected'"; }
144
+ echo '>' . __( 'No' ) . '</option><option value="1"';
145
+ if ( attribute_escape( $instance[ 'annotation' ] ) == '1' ) { echo " selected='selected'"; }
146
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
147
+
148
+ // Closed Caption field
149
+ $field_id = $this -> get_field_id( 'cc' );
150
+ $field_name = $this -> get_field_name( 'cc' );
151
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Closed Captions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
152
+ if ( attribute_escape( $instance[ 'cc' ] ) == '' ) { echo " selected='selected'"; }
153
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
154
+ if ( attribute_escape( $instance[ 'cc' ] ) == '0' ) { echo " selected='selected'"; }
155
+ echo '>' . __( 'No' ) . '</option><option value="1"';
156
+ if ( attribute_escape( $instance[ 'cc' ] ) == '1' ) { echo " selected='selected'"; }
157
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
158
+
159
+ // Disable keyboard field
160
+ $field_id = $this -> get_field_id( 'disablekb' );
161
+ $field_name = $this -> get_field_name( 'disablekb' );
162
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Disable Keyboard' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
163
+ if ( attribute_escape( $instance[ 'disablekb' ] ) == '' ) { echo " selected='selected'"; }
164
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
165
+ if ( attribute_escape( $instance[ 'disablekb' ] ) == '0' ) { echo " selected='selected'"; }
166
+ echo '>' . __( 'No' ) . '</option><option value="1"';
167
+ if ( attribute_escape( $instance[ 'disablekb' ] ) == '1' ) { echo " selected='selected'"; }
168
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
169
+
170
+ // Fullscreen field
171
+ $field_id = $this -> get_field_id( 'fullscreen' );
172
+ $field_name = $this -> get_field_name( 'fullscreen' );
173
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Fullscreen' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
174
+ if ( attribute_escape( $instance[ 'fullscreen' ] ) == '' ) { echo " selected='selected'"; }
175
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
176
+ if ( attribute_escape( $instance[ 'fullscreen' ] ) == '0' ) { echo " selected='selected'"; }
177
+ echo '>' . __( 'No' ) . '</option><option value="1"';
178
+ if ( attribute_escape( $instance[ 'fullscreen' ] ) == '1' ) { echo " selected='selected'"; }
179
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
180
+
181
+ // Information field
182
+ $field_id = $this -> get_field_id( 'info' );
183
+ $field_name = $this -> get_field_name( 'info' );
184
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Information' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
185
+ if ( attribute_escape( $instance[ 'info' ] ) == '' ) { echo " selected='selected'"; }
186
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
187
+ if ( attribute_escape( $instance[ 'info' ] ) == '0' ) { echo " selected='selected'"; }
188
+ echo '>' . __( 'No' ) . '</option><option value="1"';
189
+ if ( attribute_escape( $instance[ 'info' ] ) == '1' ) { echo " selected='selected'"; }
190
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
191
+
192
+ // YouTube Link field
193
+ $field_id = $this -> get_field_id( 'link' );
194
+ $field_name = $this -> get_field_name( 'link' );
195
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Link to YouTube' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
196
+ if ( attribute_escape( $instance[ 'link' ] ) == '' ) { echo " selected='selected'"; }
197
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
198
+ if ( attribute_escape( $instance[ 'link' ] ) == '0' ) { echo " selected='selected'"; }
199
+ echo '>' . __( 'No' ) . '</option><option value="1"';
200
+ if ( attribute_escape( $instance[ 'link' ] ) == '1' ) { echo " selected='selected'"; }
201
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
202
+
203
+ // Related videos field
204
+ $field_id = $this -> get_field_id( 'related' );
205
+ $field_name = $this -> get_field_name( 'related' );
206
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Related Videos' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
207
+ if ( attribute_escape( $instance[ 'related' ] ) == '' ) { echo " selected='selected'"; }
208
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
209
+ if ( attribute_escape( $instance[ 'related' ] ) == '0' ) { echo " selected='selected'"; }
210
+ echo '>' . __( 'No' ) . '</option><option value="1"';
211
+ if ( attribute_escape( $instance[ 'related' ] ) == '1' ) { echo " selected='selected'"; }
212
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
213
+
214
+ echo "</table>\n";
215
+
216
+ ?>
217
+ <h4><?php _e('EmbedPlus Options'); ?></h4>
218
+ <?php
219
+
220
+ echo "<table>\n";
221
+
222
+ // Stop field
223
+ $field_id = $this -> get_field_id( 'stop' );
224
+ $field_name = $this -> get_field_name( 'stop' );
225
+ 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>';
226
+
227
+ // HD field
228
+ $field_id = $this -> get_field_id( 'hd' );
229
+ $field_name = $this -> get_field_name( 'hd' );
230
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Play HD' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
231
+ if ( attribute_escape( $instance[ 'hd' ] ) == '' ) { echo " selected='selected'"; }
232
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
233
+ if ( attribute_escape( $instance[ 'hd' ] ) == '0' ) { echo " selected='selected'"; }
234
+ echo '>' . __( 'No' ) . '</option><option value="1"';
235
+ if ( attribute_escape( $instance[ 'hd' ] ) == '1' ) { echo " selected='selected'"; }
236
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
237
+
238
+ // Reactions field
239
+ $field_id = $this -> get_field_id( 'react' );
240
+ $field_name = $this -> get_field_name( 'react' );
241
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Real-time Reactions' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
242
+ if ( attribute_escape( $instance[ 'react' ] ) == '' ) { echo " selected='selected'"; }
243
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
244
+ if ( attribute_escape( $instance[ 'react' ] ) == '0' ) { echo " selected='selected'"; }
245
+ echo '>' . __( 'No' ) . '</option><option value="1"';
246
+ if ( attribute_escape( $instance[ 'react' ] ) == '1' ) { echo " selected='selected'"; }
247
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
248
+
249
+ // Sweetspot field
250
+ $field_id = $this -> get_field_id( 'sweetspot' );
251
+ $field_name = $this -> get_field_name( 'sweetspot' );
252
+ echo "\r\n" . '<tr><td width="100%">' . __( 'Sweet Spots' ) . '</td><td><select name="' . $field_name . '" id="' . $field_id . '"><option value=""';
253
+ if ( attribute_escape( $instance[ 'sweetspot' ] ) == '' ) { echo " selected='selected'"; }
254
+ echo '>' . __( 'Profile default' ) . '</option><option value="0"';
255
+ if ( attribute_escape( $instance[ 'sweetspot' ] ) == '0' ) { echo " selected='selected'"; }
256
+ echo '>' . __( 'No' ) . '</option><option value="1"';
257
+ if ( attribute_escape( $instance[ 'sweetspot' ] ) == '1' ) { echo " selected='selected'"; }
258
+ echo '>' . __( 'Yes' ) . '</option></select></td></tr>';
259
+
260
+ echo "</table>\n";
261
+ ?>
includes/{aye-set-defaults.php → set-option-defaults.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * Set up default values for the various options
6
  *
7
- * @package Artiss-YouTube-Embed
8
  */
9
 
10
  /**
@@ -17,12 +17,11 @@
17
  * @return string Alternative Shortcode
18
  */
19
 
20
- function aye_set_shortcode_option() {
21
 
22
  $shortcode = get_option( 'youtube_embed_shortcode' );
23
 
24
  // If setting doesn't exist, set defaults
25
-
26
  if ( $shortcode == '' ) {
27
  $shortcode[ 1 ] = 'youtube_video';
28
  $shortcode[ 2 ] = '';
@@ -42,12 +41,11 @@ function aye_set_shortcode_option() {
42
  * @return string URL override
43
  */
44
 
45
- function aye_set_url_option() {
46
 
47
  $url = get_option( 'youtube_embed_url' );
48
 
49
  // If setting doesn't exist, set defaults
50
-
51
  if ( $url == '' ) { update_option( 'youtube_embed_url', '' ); }
52
 
53
  return $url;
@@ -63,7 +61,7 @@ function aye_set_url_option() {
63
  * @return strings Options array
64
  */
65
 
66
- function aye_set_general_defaults() {
67
  $options = get_option( 'youtube_embed_general' );
68
  $changed = false;
69
  $default_error = htmlspecialchars( '<p>The video cannot be shown at the moment. Please try again later.</p>' );
@@ -77,7 +75,7 @@ function aye_set_general_defaults() {
77
  $changed = true;
78
  } else {
79
  // If array doesn't exist, set defaults
80
- $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, 'other_profile' => 0, 'comments' => '', 'comments_profile' => 0, 'metadata' => 1, 'feed' => 'b', 'api' => 1, 'error_message' => $default_error, 'thumbnail' => 2, 'privacy' => 0, 'frameborder' => 1 );
81
  $changed = true;
82
  }
83
  }
@@ -99,6 +97,7 @@ function aye_set_general_defaults() {
99
  if ( !array_key_exists( 'transcript_cache', $options ) ) { $options[ 'transcript_cache' ] = 24; $changed = true; }
100
  if ( !array_key_exists( 'alt_profile', $options ) ) { $options[ 'alt_profile' ] = 0; $changed = true; }
101
  if ( !array_key_exists( 'alt_profile2', $options ) ) { $options[ 'alt_profile2' ] = 0; $changed = true; }
 
102
  if ( !array_key_exists( 'other_profile', $options ) ) { $options[ 'other_profile' ] = 0; $changed = true; }
103
  if ( !array_key_exists( 'comments_profile', $options ) ) { $options[ 'comments_profile' ] = 0; $changed = true; }
104
  if ( !array_key_exists( 'metadata', $options ) ) { $options[ 'metadata' ] = 1; $changed = true; }
@@ -106,7 +105,6 @@ function aye_set_general_defaults() {
106
  if ( !array_key_exists( 'api', $options ) ) { $options[ 'api' ] = 1; $changed = true; }
107
  if ( !array_key_exists( 'error_message', $options ) ) { $options[ 'error_message' ] = $default_error; $changed = true; }
108
  if ( !array_key_exists( 'thumbnail', $options ) ) { $options[ 'thumbnail' ] = 2; $changed = true; }
109
- if ( !array_key_exists( 'frameborder', $options ) ) { $options[ 'frameborder' ] = 1; $changed = true; }
110
 
111
  // Update the options, if changed, and return the result
112
  if ( $changed ) { update_option( 'youtube_embed_general', $options ); }
@@ -125,7 +123,7 @@ function aye_set_general_defaults() {
125
  * @return string Options array
126
  */
127
 
128
- function aye_set_profile_defaults( $profile ) {
129
  if ( $profile == 0 ) {
130
  $profname = 'Default';
131
  } else {
@@ -135,13 +133,14 @@ function aye_set_profile_defaults( $profile ) {
135
  $changed = false;
136
  $new_user = false;
137
 
 
138
  // Work out default dimensions
139
  if ( isset( $GLOBALS[ 'content_width' ] ) ) {
140
  $width = $GLOBALS[ 'content_width' ];
141
  } else {
142
  $width = 560;
143
  }
144
- $height = 27 + round( ( $width / 16 ) * 9, 0 );
145
 
146
  if ( !is_array( $options ) ) {
147
  if ( ( $profile == 0 ) && ( get_option( 'youtube_embed' ) ) ) {
@@ -152,7 +151,7 @@ function aye_set_profile_defaults( $profile ) {
152
  $changed = true;
153
  } else {
154
  // If array doesn't exist, set defaults
155
- $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' => 'window', 'audio' => '', 'hd' => '1', 'style' => '', 'color' => 'red', 'theme' => 'dark', 'https' => '0', 'modest' => '1', 'dynamic' => '', 'fixed' => '' );
156
  $changed = true;
157
  }
158
  }
@@ -178,12 +177,12 @@ function aye_set_profile_defaults( $profile ) {
178
  if ( !array_key_exists( 'controls', $options ) ) { $options[ 'controls' ] = '1'; $changed = true; }
179
  if ( !array_key_exists( 'playlist', $options ) ) { $options[ 'playlist' ] = 'v'; $changed = true; }
180
  if ( !array_key_exists( 'fallback', $options ) ) { $options[ 'fallback' ] = 'v'; $changed = true; }
181
- if ( !array_key_exists( 'wmode', $options ) ) { $options[ 'wmode' ] = 'window'; $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
- if ( !array_key_exists( 'modest', $options ) ) { $options[ 'modest' ] = 1; $changed = true; }
187
 
188
  // Update the options, if changed, and return the result
189
  if ( $changed ) { update_option( 'youtube_embed_profile' . $profile, $options ); }
@@ -206,7 +205,7 @@ function aye_set_profile_defaults( $profile ) {
206
  * @return string Options array
207
  */
208
 
209
- function aye_set_list_defaults( $list ) {
210
  $options = get_option( 'youtube_embed_list' . $list );
211
  $changed = false;
212
 
4
  *
5
  * Set up default values for the various options
6
  *
7
+ * @package YouTubeEmbed
8
  */
9
 
10
  /**
17
  * @return string Alternative Shortcode
18
  */
19
 
20
+ function ye_set_shortcode_option() {
21
 
22
  $shortcode = get_option( 'youtube_embed_shortcode' );
23
 
24
  // If setting doesn't exist, set defaults
 
25
  if ( $shortcode == '' ) {
26
  $shortcode[ 1 ] = 'youtube_video';
27
  $shortcode[ 2 ] = '';
41
  * @return string URL override
42
  */
43
 
44
+ function ye_set_url_option() {
45
 
46
  $url = get_option( 'youtube_embed_url' );
47
 
48
  // If setting doesn't exist, set defaults
 
49
  if ( $url == '' ) { update_option( 'youtube_embed_url', '' ); }
50
 
51
  return $url;
61
  * @return strings Options array
62
  */
63
 
64
+ function ye_set_general_defaults() {
65
  $options = get_option( 'youtube_embed_general' );
66
  $changed = false;
67
  $default_error = htmlspecialchars( '<p>The video cannot be shown at the moment. Please try again later.</p>' );
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
  }
97
  if ( !array_key_exists( 'transcript_cache', $options ) ) { $options[ 'transcript_cache' ] = 24; $changed = true; }
98
  if ( !array_key_exists( 'alt_profile', $options ) ) { $options[ 'alt_profile' ] = 0; $changed = true; }
99
  if ( !array_key_exists( 'alt_profile2', $options ) ) { $options[ 'alt_profile2' ] = 0; $changed = true; }
100
+ if ( !array_key_exists( 'url_profile', $options ) ) { $options[ 'url_profile' ] = 0; $changed = true; }
101
  if ( !array_key_exists( 'other_profile', $options ) ) { $options[ 'other_profile' ] = 0; $changed = true; }
102
  if ( !array_key_exists( 'comments_profile', $options ) ) { $options[ 'comments_profile' ] = 0; $changed = true; }
103
  if ( !array_key_exists( 'metadata', $options ) ) { $options[ 'metadata' ] = 1; $changed = true; }
105
  if ( !array_key_exists( 'api', $options ) ) { $options[ 'api' ] = 1; $changed = true; }
106
  if ( !array_key_exists( 'error_message', $options ) ) { $options[ 'error_message' ] = $default_error; $changed = true; }
107
  if ( !array_key_exists( 'thumbnail', $options ) ) { $options[ 'thumbnail' ] = 2; $changed = true; }
 
108
 
109
  // Update the options, if changed, and return the result
110
  if ( $changed ) { update_option( 'youtube_embed_general', $options ); }
123
  * @return string Options array
124
  */
125
 
126
+ function ye_set_profile_defaults( $profile ) {
127
  if ( $profile == 0 ) {
128
  $profname = 'Default';
129
  } else {
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
  $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
  }
177
  if ( !array_key_exists( 'controls', $options ) ) { $options[ 'controls' ] = '1'; $changed = true; }
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 ); }
205
  * @return string Options array
206
  */
207
 
208
+ function ye_set_list_defaults( $list ) {
209
  $options = get_option( 'youtube_embed_list' . $list );
210
  $changed = false;
211
 
includes/{aye-shared-functions.php → shared.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * Small utilities shared by a number of other functions
6
  *
7
- * @package Artiss-YouTube-Embed
8
  */
9
 
10
  /**
@@ -19,7 +19,7 @@
19
  * @return string Parameter value (if found)
20
  */
21
 
22
- function aye_get_parameters( $input, $para ) {
23
 
24
  $start = strpos( strtolower( $input ), $para . '=' );
25
  $content = '';
@@ -41,18 +41,17 @@ function aye_get_parameters( $input, $para ) {
41
  *
42
  * @since 2.0
43
  *
44
- * @param string $id Video ID
45
  * @return string Extracted ID
46
  */
47
 
48
- function aye_extract_id( $id ) {
49
-
50
  $id = trim( strip_tags( $id ) );
51
-
52
  // Check if it's the full URL, as found in address bar
53
-
54
  $video_pos = strpos( $id, 'youtube.com/watch?', 0 );
55
-
56
  if ( $video_pos !== false ) {
57
  $video_pos = $video_pos + 20;
58
  $ampersand_pos = strpos( $id, '&', $video_pos );
@@ -66,7 +65,6 @@ function aye_extract_id( $id ) {
66
 
67
  // Now check to see if it's a full URL, as used in the embed code
68
  // Need to check both video and playlist formats
69
-
70
  $video_pos = strpos( $id, 'youtube.com/v/' );
71
  if ($video_pos === false) { $video_pos = strpos( $id, 'youtube.com/p/' ); }
72
 
@@ -82,7 +80,6 @@ function aye_extract_id( $id ) {
82
  } else {
83
 
84
  // Check if it's a shortened URL
85
-
86
  $video_pos = strpos( $id, 'youtu.be/', 0 );
87
 
88
  if ( $video_pos !== false ) {
@@ -93,12 +90,11 @@ function aye_extract_id( $id ) {
93
  } else {
94
  $id = substr( $id, $video_pos, $ampersand_pos - $video_pos );
95
  }
96
- }
97
  }
98
  }
99
 
100
  // Convert video ID characters
101
-
102
  $id = str_replace( '&#8211;', '--', $id );
103
  $id = str_replace( '&#215;', 'x', $id );
104
 
@@ -108,58 +104,50 @@ function aye_extract_id( $id ) {
108
  /**
109
  * Validate video type
110
  *
111
- * Function to work out what type of video has been requested and
112
  * whether it is valid. Also fetches the video title.
113
  *
114
  * @since 2.0
115
  *
116
- * @uses aye_set_general_defaults Get the default settings
117
- *
118
- * @param string $id Video ID
119
  * @param string $title_needed Whether the title requires extracting
120
  * @return string Array containing file details
121
  */
122
 
123
- function aye_validate_id( $id, $title_needed = false ) {
124
 
125
  $type = false;
126
  $title = false;
127
  $options = false;
128
-
129
- $options = aye_set_general_defaults();
130
 
131
  // Attempt to get the video type and title from cache
132
-
133
- if ( $options[ 'info_cache' ] != 0 ) {
134
- $type = get_transient( 'aye_type_' . $id );
135
- $title = get_transient( 'aye_title_' . $id );
136
  }
137
 
138
  // Check if items are cached
139
-
140
  $cache = true;
141
  if ( ( !$type ) or ( !$title ) ) { $cache = false; }
142
 
143
  // Get video information if not cached
144
-
145
  if ( !$cache ) {
146
 
147
  $type = '-';
148
-
149
  if ( $options [ 'api' ] != 0 ) {
150
-
151
  if ( ( $options[ 'api' ] == 2 ) or ( $options[ 'api' ] == 4 ) ) { $https = 's'; } else { $https = ''; }
152
 
153
  // Check with YouTube API as to whether the ID is a video
154
-
155
- $id_check = aye_get_file( 'http' . $https . '://gdata.youtube.com/feeds/api/videos/' . $id . '?v=2', false );
156
  if ( $id_check[ 'rc' ] == 0 ) {
157
  if ( $id_check[ 'response' ] != 200 ) {
158
 
159
  // Check with YouTube API as to whether the ID is a playlist
160
-
161
- if ( strtolower( substr( $id, 0, 2 ) ) == 'pl' ) { $id = substr( $id, 2 ); }
162
- $id_check = aye_get_file( 'http' . $https . '://gdata.youtube.com/feeds/api/playlists/' . $id . '?v=2', false );
163
  if ( $id_check[ 'rc' ] == 0 ) {
164
  if ( $id_check[ 'response' ] != 200 ) {
165
  $type = '';
@@ -174,19 +162,13 @@ function aye_validate_id( $id, $title_needed = false ) {
174
  }
175
 
176
  // If no type has been assigned then an API error must have occured
177
-
178
  if ( $type == '-' ) {
179
-
180
  if ( ( $options[ 'api' ] == 1 ) or ( $options[ 'api' ] == 2 ) ) {
181
-
182
  // If reporting API errors, output it
183
-
184
- $type = sprintf( __('An error occurred accessing the YouTube API for video ID %s - %s' ), $id, $id_check[ 'error' ] );
185
-
186
  } else {
187
-
188
  // If not reporting errors or API switched off, work out whether a video or playlist
189
-
190
  $type = '';
191
  if ( strlen( $id ) == 11 ) {
192
  $type = 'v';
@@ -199,26 +181,22 @@ function aye_validate_id( $id, $title_needed = false ) {
199
  }
200
 
201
  // Update the cache
202
-
203
- set_transient( 'aye_type_' . $id, $type, $options[ 'info_cache' ] * 3600 );
204
 
205
  // If the video is valid extract the title from the XML
206
-
207
  if ( ( $title_needed) && ( $id_check[ 'file' ] != '' ) ) {
208
-
209
  // Find title in XML
210
-
211
- $tag_start = strpos( $id_check[ 'file' ], '<title>', 1 ) + 7;
212
  if ( $tag_start !== false ) {
213
  $tag_end = strpos( $id_check[ 'file' ], '</title>', $tag_start );
214
  if ( $tag_end !== false ) {
215
- $title = substr( $id_check[ 'file' ], $tag_start, $tag_end - $tag_start );
216
  }
217
  }
218
 
219
  // Update the cache
220
-
221
- set_transient( 'aye_title_' . $id, $title, $options[ 'info_cache' ] * 3600 );
222
  }
223
  }
224
 
@@ -240,7 +218,7 @@ function aye_validate_id( $id, $title_needed = false ) {
240
  * @return string Error output
241
  */
242
 
243
- function aye_error( $errorin ) {
244
 
245
  return '<p style="color: #f00; font-weight: bold;">Artiss YouTube Embed: ' . $errorin . "</p>\n";
246
 
@@ -253,15 +231,15 @@ function aye_error( $errorin ) {
253
  *
254
  * @since 2.0
255
  *
256
- * @uses aye_yes_or_no Convert input to a true or false equivalent
257
  *
258
  * @param string $input Input, usually Yes or No
259
  * @return string 1, 0 or blank, depending on input
260
  */
261
 
262
- function aye_convert( $input ) {
263
 
264
- $input = aye_yes_or_no( $input );
265
  $output = '';
266
  if ( $input === true ) { $output = '1'; }
267
  if ( $input === false ) { $output = '0'; }
@@ -276,15 +254,15 @@ function aye_convert( $input ) {
276
  *
277
  * @since 2.0
278
  *
279
- * @uses aye_yes_or_no Convert input to a true or false equivalent
280
  *
281
  * @param string $input Input, usually Yes or No
282
  * @return string 1, 3 or blank, depending on input
283
  */
284
 
285
- function aye_convert_3( $input ) {
286
 
287
- $input = aye_yes_or_no( $input );
288
  $output = '';
289
  if ( $input === true ) { $output = '1'; }
290
  if ( $input === false ) { $output = '3'; }
@@ -304,7 +282,7 @@ function aye_convert_3( $input ) {
304
  * @return string Blank string or boolean true, false
305
  */
306
 
307
- function aye_yes_or_no( $input = '' ) {
308
 
309
  $input = strtolower( $input );
310
  if ( ( $input === true ) or ( $input == 'true' ) or ( $input == '1' ) or ( $input == 'yes' ) or ( $input == 'on' ) ) { return true; }
@@ -326,7 +304,7 @@ function aye_yes_or_no( $input = '' ) {
326
  * @return string Array containing file contents and response
327
  */
328
 
329
- function aye_get_file( $filein, $header = false ) {
330
 
331
  $rc = 0;
332
  $error = '';
@@ -340,7 +318,7 @@ function aye_get_file( $filein, $header = false ) {
340
  $fileout = wp_remote_get( $filein );
341
  if ( is_wp_error( $fileout ) ) {
342
  $error = 'Body: '.$fileout->get_error_message();
343
- $rc = -1;
344
  } else {
345
  if ( isset( $fileout[ 'body' ] ) ) {
346
  $file_return[ 'file' ] = $fileout[ 'body' ];
@@ -366,22 +344,21 @@ function aye_get_file( $filein, $header = false ) {
366
  *
367
  * @since 2.0
368
  *
369
- * @uses aye_convert Convert value to a 0 or 1 equivalent
370
  *
371
  * @param string $type Current embed type
372
  * @param string $embedplus Whether EmbedPlus embedding is required
373
  * @return string The type of embedding to use
374
  */
375
 
376
- function aye_get_embed_type( $type, $embedplus ) {
377
 
378
- $embedplus = aye_convert( $embedplus );
379
  $type = strtolower( $type );
380
 
381
  if ( ( $type == 'embedplus' ) or ( $embedplus == '1' ) ) { $type = 'm'; }
382
  if ( $type == 'iframe' ) { $type = 'v'; }
383
  if ( $type == 'object' ) { $type = 'p'; }
384
- if ( $type == 'chromeless' ) { $type = 'c'; }
385
 
386
  return $type;
387
  }
@@ -397,7 +374,7 @@ function aye_get_embed_type( $type, $embedplus ) {
397
  * @return string Autohide numeric equivalent
398
  */
399
 
400
- function aye_set_autohide( $autohide ) {
401
 
402
  $autohide = strtolower( $autohide );
403
  if ( $autohide == 'no' ) { $autohide = '0'; }
@@ -418,19 +395,19 @@ function aye_set_autohide( $autohide ) {
418
  * @param string $total The total number of profiles
419
  */
420
 
421
- function aye_generate_profile_list( $current, $total ) {
422
-
423
  echo '<option value="0"';
424
  if ( $current == "0" ) { echo " selected='selected'"; }
425
- echo ' >' . __( 'Default' ) . '</option>';
426
  $loop = 1;
427
  while ( $loop <= $total ) {
428
 
429
  $profiles = get_option( 'youtube_embed_profile' . $loop );
430
  $profname = $profiles[ 'name' ];
431
 
432
- if ( $profname == '' ) { $profname = __( 'Profile' ) . ' ' . $loop; }
433
- if ( strlen( $profname ) > 30 ) { $profname = substr( $profname, 0, 30 ) . '&#8230;'; }
434
  echo '<option value="' . $loop . '"';
435
 
436
  if ( $current == $loop ) { echo " selected='selected'"; }
4
  *
5
  * Small utilities shared by a number of other functions
6
  *
7
+ * @package YouTubeEmbed
8
  */
9
 
10
  /**
19
  * @return string Parameter value (if found)
20
  */
21
 
22
+ function ye_get_parameters( $input, $para ) {
23
 
24
  $start = strpos( strtolower( $input ), $para . '=' );
25
  $content = '';
41
  *
42
  * @since 2.0
43
  *
44
+ * @param string $id Video ID
45
  * @return string Extracted ID
46
  */
47
 
48
+ function ye_extract_id( $id ) {
49
+
50
  $id = trim( strip_tags( $id ) );
51
+
52
  // Check if it's the full URL, as found in address bar
 
53
  $video_pos = strpos( $id, 'youtube.com/watch?', 0 );
54
+
55
  if ( $video_pos !== false ) {
56
  $video_pos = $video_pos + 20;
57
  $ampersand_pos = strpos( $id, '&', $video_pos );
65
 
66
  // Now check to see if it's a full URL, as used in the embed code
67
  // Need to check both video and playlist formats
 
68
  $video_pos = strpos( $id, 'youtube.com/v/' );
69
  if ($video_pos === false) { $video_pos = strpos( $id, 'youtube.com/p/' ); }
70
 
80
  } else {
81
 
82
  // Check if it's a shortened URL
 
83
  $video_pos = strpos( $id, 'youtu.be/', 0 );
84
 
85
  if ( $video_pos !== false ) {
90
  } else {
91
  $id = substr( $id, $video_pos, $ampersand_pos - $video_pos );
92
  }
93
+ }
94
  }
95
  }
96
 
97
  // Convert video ID characters
 
98
  $id = str_replace( '&#8211;', '--', $id );
99
  $id = str_replace( '&#215;', 'x', $id );
100
 
104
  /**
105
  * Validate video type
106
  *
107
+ * Function to work out what type of video has been requested and
108
  * whether it is valid. Also fetches the video title.
109
  *
110
  * @since 2.0
111
  *
112
+ * @param string $id Video ID
 
 
113
  * @param string $title_needed Whether the title requires extracting
114
  * @return string Array containing file details
115
  */
116
 
117
+ function ye_validate_id( $id, $title_needed = false ) {
118
 
119
  $type = false;
120
  $title = false;
121
  $options = false;
122
+
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
  }
130
 
131
  // Check if items are cached
 
132
  $cache = true;
133
  if ( ( !$type ) or ( !$title ) ) { $cache = false; }
134
 
135
  // Get video information if not cached
 
136
  if ( !$cache ) {
137
 
138
  $type = '-';
139
+
140
  if ( $options [ 'api' ] != 0 ) {
141
+
142
  if ( ( $options[ 'api' ] == 2 ) or ( $options[ 'api' ] == 4 ) ) { $https = 's'; } else { $https = ''; }
143
 
144
  // Check with YouTube API as to whether the ID is a video
145
+ $id_check = ye_get_file( 'http' . $https . '://gdata.youtube.com/feeds/api/videos/' . $id . '?v=2', false );
 
146
  if ( $id_check[ 'rc' ] == 0 ) {
147
  if ( $id_check[ 'response' ] != 200 ) {
148
 
149
  // Check with YouTube API as to whether the ID is a playlist
150
+ $id_check = ye_get_file( 'http' . $https . '://gdata.youtube.com/feeds/api/playlists/' . $id . '?v=2', false );
 
 
151
  if ( $id_check[ 'rc' ] == 0 ) {
152
  if ( $id_check[ 'response' ] != 200 ) {
153
  $type = '';
162
  }
163
 
164
  // If no type has been assigned then an API error must have occured
 
165
  if ( $type == '-' ) {
166
+
167
  if ( ( $options[ 'api' ] == 1 ) or ( $options[ 'api' ] == 2 ) ) {
 
168
  // If reporting API errors, output it
169
+ $type = 'An error occurred accessing the YouTube API for video ID ' . $id . ' - ' . $id_check[ 'error' ];
 
 
170
  } else {
 
171
  // If not reporting errors or API switched off, work out whether a video or playlist
 
172
  $type = '';
173
  if ( strlen( $id ) == 11 ) {
174
  $type = 'v';
181
  }
182
 
183
  // Update the cache
184
+ set_transient( 'ye_type_' . $id, $type, $options[ 'info_cache' ] * 3600 );
 
185
 
186
  // If the video is valid extract the title from the XML
 
187
  if ( ( $title_needed) && ( $id_check[ 'file' ] != '' ) ) {
188
+
189
  // Find title in XML
190
+ $tag_start = strpos( $id_check[ 'file' ], '<title>', 1 );
 
191
  if ( $tag_start !== false ) {
192
  $tag_end = strpos( $id_check[ 'file' ], '</title>', $tag_start );
193
  if ( $tag_end !== false ) {
194
+ $title = substr( $id_check[ 'file' ], $tag_start + 7, $tag_end - $tag_start + 6 );
195
  }
196
  }
197
 
198
  // Update the cache
199
+ set_transient( 'ye_title_' . $id, $title, $options[ 'info_cache' ] * 3600 );
 
200
  }
201
  }
202
 
218
  * @return string Error output
219
  */
220
 
221
+ function ye_error( $errorin ) {
222
 
223
  return '<p style="color: #f00; font-weight: bold;">Artiss YouTube Embed: ' . $errorin . "</p>\n";
224
 
231
  *
232
  * @since 2.0
233
  *
234
+ * @uses ye_yes_or_no Convert input to a true or false equivalent
235
  *
236
  * @param string $input Input, usually Yes or No
237
  * @return string 1, 0 or blank, depending on input
238
  */
239
 
240
+ function ye_convert( $input ) {
241
 
242
+ $input = ye_yes_or_no( $input );
243
  $output = '';
244
  if ( $input === true ) { $output = '1'; }
245
  if ( $input === false ) { $output = '0'; }
254
  *
255
  * @since 2.0
256
  *
257
+ * @uses ye_yes_or_no Convert input to a true or false equivalent
258
  *
259
  * @param string $input Input, usually Yes or No
260
  * @return string 1, 3 or blank, depending on input
261
  */
262
 
263
+ function ye_convert_3( $input ) {
264
 
265
+ $input = ye_yes_or_no( $input );
266
  $output = '';
267
  if ( $input === true ) { $output = '1'; }
268
  if ( $input === false ) { $output = '3'; }
282
  * @return string Blank string or boolean true, false
283
  */
284
 
285
+ function ye_yes_or_no( $input = '' ) {
286
 
287
  $input = strtolower( $input );
288
  if ( ( $input === true ) or ( $input == 'true' ) or ( $input == '1' ) or ( $input == 'yes' ) or ( $input == 'on' ) ) { return true; }
304
  * @return string Array containing file contents and response
305
  */
306
 
307
+ function ye_get_file( $filein, $header = false ) {
308
 
309
  $rc = 0;
310
  $error = '';
318
  $fileout = wp_remote_get( $filein );
319
  if ( is_wp_error( $fileout ) ) {
320
  $error = 'Body: '.$fileout->get_error_message();
321
+ $rc = -1;
322
  } else {
323
  if ( isset( $fileout[ 'body' ] ) ) {
324
  $file_return[ 'file' ] = $fileout[ 'body' ];
344
  *
345
  * @since 2.0
346
  *
347
+ * @uses ye_convert Convert value to a 0 or 1 equivalent
348
  *
349
  * @param string $type Current embed type
350
  * @param string $embedplus Whether EmbedPlus embedding is required
351
  * @return string The type of embedding to use
352
  */
353
 
354
+ function ye_get_embed_type( $type, $embedplus ) {
355
 
356
+ $embedplus = ye_convert( $embedplus );
357
  $type = strtolower( $type );
358
 
359
  if ( ( $type == 'embedplus' ) or ( $embedplus == '1' ) ) { $type = 'm'; }
360
  if ( $type == 'iframe' ) { $type = 'v'; }
361
  if ( $type == 'object' ) { $type = 'p'; }
 
362
 
363
  return $type;
364
  }
374
  * @return string Autohide numeric equivalent
375
  */
376
 
377
+ function ye_set_autohide( $autohide ) {
378
 
379
  $autohide = strtolower( $autohide );
380
  if ( $autohide == 'no' ) { $autohide = '0'; }
395
  * @param string $total The total number of profiles
396
  */
397
 
398
+ function ye_generate_profile_list( $current, $total ) {
399
+
400
  echo '<option value="0"';
401
  if ( $current == "0" ) { echo " selected='selected'"; }
402
+ echo ' >'.__('Default').'</option>';
403
  $loop = 1;
404
  while ( $loop <= $total ) {
405
 
406
  $profiles = get_option( 'youtube_embed_profile' . $loop );
407
  $profname = $profiles[ 'name' ];
408
 
409
+ if ( $profname == '' ) { $profname = "Profile " . $loop; }
410
+ if ( strlen( $profname ) > 20 ) { $profname = strpos( $profname, 0, 20 ) . '&#8230;'; }
411
  echo '<option value="' . $loop . '"';
412
 
413
  if ( $current == $loop ) { echo " selected='selected'"; }
includes/{aye-shortcodes.php → shortcodes.php} RENAMED
@@ -4,7 +4,7 @@
4
  *
5
  * Define the various shortcodes
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
 
@@ -15,18 +15,17 @@
15
  *
16
  * @since 2.0
17
  *
18
- * @uses aye_video_shortcode Action the shortcode parameters
19
  *
20
  * @param string $paras Shortcode parameters
21
  * @param string $content Shortcode content
22
  * @return string YouTube embed code
23
  */
24
 
25
- function aye_video_shortcode_default( $paras = '', $content = '' ) {
26
- return do_shortcode( aye_video_shortcode( $paras, $content ) );
27
  }
28
-
29
- add_shortcode( 'youtube', 'aye_video_shortcode_default' );
30
 
31
  /**
32
  * Alternative Video shortcode 1
@@ -35,18 +34,18 @@ add_shortcode( 'youtube', 'aye_video_shortcode_default' );
35
  *
36
  * @since 2.0
37
  *
38
- * @uses aye_video_shortcode Action the shortcode parameters
39
  *
40
  * @param string $paras Shortcode parameters
41
  * @param string $content Shortcode content
42
  * @return string YouTube embed code
43
  */
44
 
45
- function aye_video_shortcode_alt1( $paras = '', $content = '' ) {
46
- return do_shortcode( aye_video_shortcode( $paras, $content, '', 1 ) );
47
  }
48
- $shortcode = aye_set_shortcode_option();
49
- if ( $shortcode[ 1 ] != '' ) { add_shortcode( $shortcode[ 1 ], 'aye_video_shortcode_alt1' ); }
50
 
51
  /**
52
  * Alternative Video shortcode 2
@@ -55,17 +54,17 @@ if ( $shortcode[ 1 ] != '' ) { add_shortcode( $shortcode[ 1 ], 'aye_video_shortc
55
  *
56
  * @since 2.0
57
  *
58
- * @uses aye_video_shortcode Action the shortcode parameters
59
  *
60
  * @param string $paras Shortcode parameters
61
  * @param string $content Shortcode content
62
  * @return string YouTube embed code
63
  */
64
 
65
- function aye_video_shortcode_alt2( $paras = '', $content = '' ) {
66
- return do_shortcode( aye_video_shortcode( $paras, $content, '', 2 ) );
67
  }
68
- if ( $shortcode[ 2 ] != '' ) { add_shortcode( $shortcode[ 2 ], 'aye_video_shortcode_alt2' ); }
69
 
70
  /**
71
  * Video shortcode
@@ -74,10 +73,9 @@ if ( $shortcode[ 2 ] != '' ) { add_shortcode( $shortcode[ 2 ], 'aye_video_shortc
74
  *
75
  * @since 2.0
76
  *
77
- * @uses aye_get_embed_type Get the embed type
78
- * @uses aye_set_autohide Get the autohide parameter
79
- * @uses aye_set_general_defaults Set default options
80
- * @uses aye_generate_youtube_code Generate the embed code
81
  *
82
  * @param string $paras Shortcode parameters
83
  * @param string $content Shortcode content
@@ -85,26 +83,20 @@ if ( $shortcode[ 2 ] != '' ) { add_shortcode( $shortcode[ 2 ], 'aye_video_shortc
85
  * @return string YouTube embed code
86
  */
87
 
88
- function aye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_shortcode = '' ) {
89
 
90
- 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' => '', 'search' => '', 'user' => '' ), $paras ) );
91
 
92
  // If no profile specified and an alternative shortcode used, get that shortcodes default profile
93
-
94
  if ( ( $profile == '' ) && ( $alt_shortcode != '' ) ) {
95
-
96
  // Profile is now blank or 2
97
-
98
  if ( $alt_shortcode == '1' ) { $alt_shortcode = ''; }
99
-
100
  // Get general options
101
-
102
- $options = aye_set_general_defaults();
103
- $profile = $options[ 'alt_profile' . $alt_shortcode ];
104
  }
105
 
106
  // If an alternative field is set, use it
107
-
108
  if ( ( $id != '' ) && ( $content == '' ) ) { $content = $id; }
109
  if ( ( $url != '' ) && ( $content == '' ) ) { $content = $url; }
110
  if ( ( $youtubeurl != '' ) && ( $content == '' ) ) { $content = $youtubeurl; }
@@ -119,7 +111,6 @@ function aye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
119
  if ( ( $showinfo != '' ) && ( $info == '' ) ) { $info = $showinfo;}
120
 
121
  // If ID was not passed in the content and the first parameter is set, assume that to be the ID
122
-
123
  if ( ( $content == '' ) && ( $paras[ 0 ] != '' ) ) {
124
  $content = $paras[ 0 ];
125
  if ( (substr( $content, 0, 1 ) == ":" ) or ( substr( $content, 0, 1 ) == "=" ) ) { $content = substr( $content, 1 ); }
@@ -128,18 +119,15 @@ function aye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
128
  }
129
 
130
  // Get Embed type
131
-
132
- $type = aye_get_embed_type( $type, $embedplus );
133
 
134
  // Set up Autohide parameter
135
-
136
- $autohide = aye_set_autohide( $autohide );
137
 
138
  // Create YouTube code
 
139
 
140
- $youtube_code = aye_generate_youtube_code( $content, $type, $width, $height, aye_convert( $fullscreen ), aye_convert( $related ), aye_convert( $autoplay ), aye_convert( $loop ), $start, aye_convert( $info ), aye_convert_3( $annotation ), aye_convert( $cc ), $style, aye_convert( $link ), aye_convert( $react ), $stop, aye_convert( $sweetspot ), aye_convert( $disablekb ), $ratio, $autohide, aye_convert( $controls ), $profile, $list, aye_convert( $audio ), $template, aye_convert( $hd ), $color, $theme, aye_convert( $ssl ), $title, aye_convert( $dynamic ), aye_convert( $search ), aye_convert( $user ) );
141
-
142
- return do_shortcode( $youtube_code );
143
  }
144
 
145
  /**
@@ -149,19 +137,18 @@ function aye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
149
  *
150
  * @since 2.0
151
  *
152
- * @uses aye_generate_thumbnail_code Generate the thumbnail code
153
  *
154
  * @param string $paras Shortcode parameters
155
  * @param string $content Shortcode content
156
  * @return string YouTube thumbnail code
157
  */
158
 
159
- function aye_thumbnail_sc( $paras = '', $content = '' ) {
160
  extract( shortcode_atts( array( 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '' ), $paras ) );
161
- return do_shortcode( aye_generate_thumbnail_code( $content, $style, $class, $rel, $target, $width, $height, $alt, $version ) );
162
  }
163
-
164
- add_shortcode( 'youtube_thumb', 'aye_thumbnail_sc' );
165
 
166
  /**
167
  * Short URL shortcode
@@ -170,19 +157,18 @@ add_shortcode( 'youtube_thumb', 'aye_thumbnail_sc' );
170
  *
171
  * @since 2.0
172
  *
173
- * @uses aye_generate_shorturl_code Generate the code
174
  *
175
  * @param string $paras Shortcode parameters
176
  * @param string $content Shortcode content
177
  * @return string YouTube short URL code
178
  */
179
 
180
- function aye_shorturl_sc( $paras = '', $content = '' ) {
181
  extract( shortcode_atts( array( 'id' => '' ), $paras ) );
182
- return do_shortcode( aye_generate_shorturl_code( $id ) );
183
  }
184
-
185
- add_shortcode( 'youtube_url', 'aye_shorturl_sc' );
186
 
187
  /**
188
  * Download shortcode
@@ -191,23 +177,20 @@ add_shortcode( 'youtube_url', 'aye_shorturl_sc' );
191
  *
192
  * @since 2.0
193
  *
194
- * @uses aye_generate_download_code Generate the download code
195
  *
196
  * @param string $paras Shortcode parameters
197
  * @param string $content Shortcode content
198
  * @return string YouTube download link
199
  */
200
 
201
- function aye_video_download( $paras = '', $content = '' ) {
202
-
203
  extract( shortcode_atts( array( 'id' => '', 'target' => '', 'nofollow' => '' ), $paras ) );
204
 
205
  // Return the URL
206
-
207
- $link = aye_generate_download_code( $id );
208
 
209
  // Now add the HTML to the URL (assuming it's not an error)
210
-
211
  if ( substr( $link, 0, 2 ) != '<p' ) {
212
  $link = '<a href="' . $link . '"';
213
  if ( $target != '' ) { $link .= ' target="' . $target . '"'; }
@@ -215,10 +198,9 @@ function aye_video_download( $paras = '', $content = '' ) {
215
  $link .= '>' . $content . '</a>';
216
  }
217
 
218
- return do_shortcode( $link );
219
  }
220
-
221
- add_shortcode( 'download_video', 'aye_video_download' );
222
 
223
  /**
224
  * Transcript Shortcode
@@ -227,18 +209,17 @@ add_shortcode( 'download_video', 'aye_video_download' );
227
  *
228
  * @since 2.0
229
  *
230
- * @uses aye_generate_transcript Generate the transcript
231
  *
232
  * @param string $paras Shortcode parameters
233
  * @param string $content Shortcode content
234
  * @return string Transcript XHTML
235
  */
236
 
237
- function aye_transcript_sc( $paras = '', $content = '' ) {
238
- return do_shortcode( aye_generate_transcript( $content ) );
239
  }
240
-
241
- add_shortcode( 'transcript', 'aye_transcript_sc' );
242
 
243
  /**
244
  * Video Name Shortcode
@@ -247,31 +228,27 @@ add_shortcode( 'transcript', 'aye_transcript_sc' );
247
  *
248
  * @since 2.0
249
  *
250
- * @uses aye_extract_id Extract the video ID
251
- * @uses aye_validate_id Get the name and video type
252
- * @uses aye_error Return an error
253
  *
254
  * @param string $paras Shortcode parameters
255
  * @param string $content Shortcode content
256
  * @return string Video name
257
  */
258
 
259
- function aye_video_name_shortcode( $paras = '', $content = '' ) {
260
 
261
  // Extract the ID if a full URL has been specified
262
-
263
- $id = aye_extract_id( $content );
264
 
265
  // Check what type of video it is and whether it's valid
266
-
267
- $return = aye_validate_id( $id, true );
268
- if ( !$return[ 'type' ] ) { return aye_error( sprintf( __( 'The YouTube ID of %s is invalid.' ), $id ) ); }
269
- if ( strlen( $return[ 'type' ] ) != 1 ) { return aye_error( $return[ 'type' ] ); }
270
 
271
  // Return the video title
272
-
273
- return do_shortcode( $return['title'] );
274
  }
275
-
276
- add_shortcode( 'youtube_name', 'aye_video_name_shortcode' );
277
  ?>
4
  *
5
  * Define the various shortcodes
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
 
15
  *
16
  * @since 2.0
17
  *
18
+ * @uses ye_video_shortcode Action the shortcode parameters
19
  *
20
  * @param string $paras Shortcode parameters
21
  * @param string $content Shortcode content
22
  * @return string YouTube embed code
23
  */
24
 
25
+ function ye_video_shortcode_default( $paras = '', $content = '' ) {
26
+ return ye_video_shortcode( $paras, $content );
27
  }
28
+ add_shortcode( 'youtube', 'ye_video_shortcode_default' );
 
29
 
30
  /**
31
  * Alternative Video shortcode 1
34
  *
35
  * @since 2.0
36
  *
37
+ * @uses ye_video_shortcode Action the shortcode parameters
38
  *
39
  * @param string $paras Shortcode parameters
40
  * @param string $content Shortcode content
41
  * @return string YouTube embed code
42
  */
43
 
44
+ function ye_video_shortcode_alt1( $paras = '', $content = '' ) {
45
+ return ye_video_shortcode( $paras, $content, '', 1 );
46
  }
47
+ $shortcode = ye_set_shortcode_option();
48
+ if ( $shortcode[ 1 ] != '' ) { add_shortcode( $shortcode[ 1 ], 'ye_video_shortcode_alt1' ); }
49
 
50
  /**
51
  * Alternative Video shortcode 2
54
  *
55
  * @since 2.0
56
  *
57
+ * @uses ye_video_shortcode Action the shortcode parameters
58
  *
59
  * @param string $paras Shortcode parameters
60
  * @param string $content Shortcode content
61
  * @return string YouTube embed code
62
  */
63
 
64
+ function ye_video_shortcode_alt2( $paras = '', $content = '' ) {
65
+ return ye_video_shortcode( $paras, $content, '', 2 );
66
  }
67
+ if ( $shortcode[ 2 ] != '' ) { add_shortcode( $shortcode[ 2 ], 'ye_video_shortcode_alt2' ); }
68
 
69
  /**
70
  * Video shortcode
73
  *
74
  * @since 2.0
75
  *
76
+ * @uses ye_get_embed_type Get the embed type
77
+ * @uses ye_set_autohide Get the autohide parameter
78
+ * @uses ye_generate_youtube_code Generate the embed code
 
79
  *
80
  * @param string $paras Shortcode parameters
81
  * @param string $content Shortcode content
83
  * @return string YouTube embed code
84
  */
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 != '' ) ) {
 
92
  // Profile is now blank or 2
 
93
  if ( $alt_shortcode == '1' ) { $alt_shortcode = ''; }
 
94
  // Get general options
95
+ $options = ye_set_general_defaults();
96
+ $profile = $options[ 'alt_profile'.$alt_shortcode ];
 
97
  }
98
 
99
  // If an alternative field is set, use it
 
100
  if ( ( $id != '' ) && ( $content == '' ) ) { $content = $id; }
101
  if ( ( $url != '' ) && ( $content == '' ) ) { $content = $url; }
102
  if ( ( $youtubeurl != '' ) && ( $content == '' ) ) { $content = $youtubeurl; }
111
  if ( ( $showinfo != '' ) && ( $info == '' ) ) { $info = $showinfo;}
112
 
113
  // If ID was not passed in the content and the first parameter is set, assume that to be the ID
 
114
  if ( ( $content == '' ) && ( $paras[ 0 ] != '' ) ) {
115
  $content = $paras[ 0 ];
116
  if ( (substr( $content, 0, 1 ) == ":" ) or ( substr( $content, 0, 1 ) == "=" ) ) { $content = substr( $content, 1 ); }
119
  }
120
 
121
  // Get Embed type
122
+ $type = ye_get_embed_type( $type, $embedplus );
 
123
 
124
  // Set up Autohide parameter
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
  }
132
 
133
  /**
137
  *
138
  * @since 2.0
139
  *
140
+ * @uses ye_generate_thumbnail_code Generate the thumbnail code
141
  *
142
  * @param string $paras Shortcode parameters
143
  * @param string $content Shortcode content
144
  * @return string YouTube thumbnail code
145
  */
146
 
147
+ function ye_thumbnail_sc( $paras = '', $content = '' ) {
148
  extract( shortcode_atts( array( 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '' ), $paras ) );
149
+ return ye_generate_thumbnail_code( $content, $style, $class, $rel, $target, $width, $height, $alt, $version );
150
  }
151
+ add_shortcode( 'youtube_thumb', 'ye_thumbnail_sc' );
 
152
 
153
  /**
154
  * Short URL shortcode
157
  *
158
  * @since 2.0
159
  *
160
+ * @uses ye_error Show an error
161
  *
162
  * @param string $paras Shortcode parameters
163
  * @param string $content Shortcode content
164
  * @return string YouTube short URL code
165
  */
166
 
167
+ function ye_shorturl_sc( $paras = '', $content = '' ) {
168
  extract( shortcode_atts( array( 'id' => '' ), $paras ) );
169
+ return ye_generate_shorturl_code( $id );
170
  }
171
+ add_shortcode( 'youtube_url', 'ye_shorturl_sc' );
 
172
 
173
  /**
174
  * Download shortcode
177
  *
178
  * @since 2.0
179
  *
180
+ * @uses ye_generate_download_code Generate the download code
181
  *
182
  * @param string $paras Shortcode parameters
183
  * @param string $content Shortcode content
184
  * @return string YouTube download link
185
  */
186
 
187
+ function ye_video_download( $paras = '', $content = '' ) {
 
188
  extract( shortcode_atts( array( 'id' => '', 'target' => '', 'nofollow' => '' ), $paras ) );
189
 
190
  // Return the URL
191
+ $link = ye_generate_download_code( $id );
 
192
 
193
  // Now add the HTML to the URL (assuming it's not an error)
 
194
  if ( substr( $link, 0, 2 ) != '<p' ) {
195
  $link = '<a href="' . $link . '"';
196
  if ( $target != '' ) { $link .= ' target="' . $target . '"'; }
198
  $link .= '>' . $content . '</a>';
199
  }
200
 
201
+ return $link;
202
  }
203
+ add_shortcode( 'download_video', 'ye_video_download' );
 
204
 
205
  /**
206
  * Transcript Shortcode
209
  *
210
  * @since 2.0
211
  *
212
+ * @uses ye_generate_transcript Generate the transcript
213
  *
214
  * @param string $paras Shortcode parameters
215
  * @param string $content Shortcode content
216
  * @return string Transcript XHTML
217
  */
218
 
219
+ function ye_transcript_sc( $paras = '', $content = '' ) {
220
+ return ye_generate_transcript( $content );
221
  }
222
+ add_shortcode( 'transcript', 'ye_transcript_sc' );
 
223
 
224
  /**
225
  * Video Name Shortcode
228
  *
229
  * @since 2.0
230
  *
231
+ * @uses ye_extract_id Extract the video ID
232
+ * @uses ye_validate_id Get the name and video type
233
+ * @uses ye_error Return an error
234
  *
235
  * @param string $paras Shortcode parameters
236
  * @param string $content Shortcode content
237
  * @return string Video name
238
  */
239
 
240
+ function ye_video_name_shortcode( $paras = '', $content = '' ) {
241
 
242
  // Extract the ID if a full URL has been specified
243
+ $id = ye_extract_id( $content );
 
244
 
245
  // Check what type of video it is and whether it's valid
246
+ $return = ye_validate_id( $id, true );
247
+ if ( !$return[ 'type' ] ) { return ye_error( 'The YouTube ID of ' . $id . ' is invalid.' ); }
248
+ if ( strlen( $return[ 'type' ] ) != 1 ) { return ye_error( $return[ 'type' ] ); }
 
249
 
250
  // Return the video title
251
+ return $return['title'];
 
252
  }
253
+ add_shortcode( 'youtube_name', 'ye_video_name_shortcode' );
 
254
  ?>
includes/widgets.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Widgets
4
+ *
5
+ * Create and display widgets
6
+ *
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( plugins_url() . '/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
+ ?>
js/aye-ga-tracker UNCOMPRESSED.js DELETED
@@ -1,3 +0,0 @@
1
- function recordOutboundLink(category, action, label) {
2
- _gaq.push(['_trackEvent', category, action, label]);
3
- }
 
 
 
js/aye-ga-tracker.js DELETED
@@ -1 +0,0 @@
1
- function recordOutboundLink(category,action,label){_gaq.push(['_trackEvent',category,action,label])}
 
js/aye-mce-button.js DELETED
@@ -1 +0,0 @@
1
- (function(){tinymce.create('tinymce.plugins.youtube',{init:function(ed,url){ed.addButton('YouTube',{title:'YouTube Embed',onclick:function(){if(ed.selection.getContent()==''){var yeOut='Insert video URL or ID here'}else{var yeOut=ed.selection.getContent()}ed.selection.setContent('[youtube]'+yeOut+'[/youtube]')}})},createControl:function(n,cm){return null}});tinymce.PluginManager.add('YouTube',tinymce.plugins.youtube)})();
 
js/{aye-mce-button UNCOMPRESSED.js → mcebutton UNCOMPRESSED.js } RENAMED
@@ -4,18 +4,13 @@
4
  ed.addButton('YouTube', {
5
  title : 'YouTube Embed',
6
  onclick : function() {
7
- if (ed.selection.getContent()=='') {
8
- var yeOut = 'Insert video URL or ID here';
9
- } else {
10
- var yeOut = ed.selection.getContent();
11
- }
12
- ed.selection.setContent('[youtube]' + yeOut + '[/youtube]');
13
  }
14
  });
15
  },
16
  createControl : function(n, cm) {
17
  return null;
18
- }
19
  });
20
  tinymce.PluginManager.add('YouTube', tinymce.plugins.youtube);
21
  })();
4
  ed.addButton('YouTube', {
5
  title : 'YouTube Embed',
6
  onclick : function() {
7
+ ed.selection.setContent('[youtube]' + ed.selection.getContent() + '[/youtube]');
 
 
 
 
 
8
  }
9
  });
10
  },
11
  createControl : function(n, cm) {
12
  return null;
13
+ },
14
  });
15
  tinymce.PluginManager.add('YouTube', tinymce.plugins.youtube);
16
  })();
js/mcebutton.js ADDED
@@ -0,0 +1 @@
 
1
+ (function(){tinymce.create('tinymce.plugins.youtube',{init:function(ed,url){ed.addButton('YouTube',{title:'YouTube Embed',onclick:function(){ed.selection.setContent('[youtube]'+ed.selection.getContent()+'[/youtube]')}})},createControl:function(n,cm){return null},});tinymce.PluginManager.add('YouTube',tinymce.plugins.youtube)})();
languages/youtube-embed.mo DELETED
Binary file
languages/youtube-embed.po DELETED
@@ -1,1106 +0,0 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Artiss Currency Converter\n"
4
- "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2012-05-18 16:19-0000\n"
6
- "PO-Revision-Date: 2012-05-18 16:20-0000\n"
7
- "Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
8
- "Language-Team: \n"
9
- "MIME-Version: 1.0\n"
10
- "Content-Type: text/plain; charset=UTF-8\n"
11
- "Content-Transfer-Encoding: 8bit\n"
12
- "X-Poedit-KeywordsList: __;_e;esc_attr__;esc_attr_e;esc_html__;esc_html_e;_x;_ex;esc_attr_x;esc_html_x;_n;_nx;_n_noop;_nx_noop\n"
13
- "X-Poedit-Basepath: ../\n"
14
- "X-Poedit-SearchPath-0: .\n"
15
-
16
- #: includes/aye-add-to-admin-bar.php:36
17
- #: includes/aye-add-to-admin-bar.php:73
18
- msgid "YouTube Embed"
19
- msgstr ""
20
-
21
- #: includes/aye-add-to-admin-bar.php:78
22
- #: includes/aye-admin-config.php:88
23
- msgid "Options"
24
- msgstr ""
25
-
26
- #: includes/aye-add-to-admin-bar.php:85
27
- #: includes/aye-admin-config.php:98
28
- msgid "Profiles"
29
- msgstr ""
30
-
31
- #: includes/aye-add-to-admin-bar.php:92
32
- #: includes/aye-admin-config.php:108
33
- msgid "Lists"
34
- msgstr ""
35
-
36
- #: includes/aye-add-to-admin-bar.php:99
37
- #: includes/aye-admin-config.php:117
38
- msgid "README"
39
- msgstr ""
40
-
41
- #: includes/aye-admin-config.php:29
42
- msgid "Settings"
43
- msgstr ""
44
-
45
- #: includes/aye-admin-config.php:54
46
- msgid "Support"
47
- msgstr ""
48
-
49
- #: includes/aye-admin-config.php:56
50
- msgid "Donate"
51
- msgstr ""
52
-
53
- #: includes/aye-admin-config.php:82
54
- msgid "Artiss YouTube Embed Settings"
55
- msgstr ""
56
-
57
- #: includes/aye-admin-config.php:82
58
- msgid "YouTube"
59
- msgstr ""
60
-
61
- #: includes/aye-admin-config.php:88
62
- msgid "Artiss YouTube Embed Options"
63
- msgstr ""
64
-
65
- #: includes/aye-admin-config.php:98
66
- msgid "Artiss YouTube Embed Profiles"
67
- msgstr ""
68
-
69
- #: includes/aye-admin-config.php:108
70
- msgid "Artiss YouTube Embed Lists"
71
- msgstr ""
72
-
73
- #: includes/aye-admin-config.php:117
74
- msgid "Artiss YouTube Embed README"
75
- msgstr ""
76
-
77
- #: includes/aye-admin-config.php:124
78
- #: includes/aye-display-about.php:14
79
- msgid "About Artiss YouTube Embed"
80
- msgstr ""
81
-
82
- #: includes/aye-admin-config.php:124
83
- msgid "About"
84
- msgstr ""
85
-
86
- #: includes/aye-admin-config.php:246
87
- #: includes/aye-admin-config.php:288
88
- #: includes/aye-admin-config.php:331
89
- #: includes/aye-admin-config.php:373
90
- msgid "Help"
91
- msgstr ""
92
-
93
- #: includes/aye-admin-config.php:261
94
- msgid "This screen allows you to select non-specific options for the Artiss YouTube Embed plugin. For the default embedding settings, please select the <a href=\"admin.php?page=aye-profile-options\">Profiles</a> administration option."
95
- msgstr ""
96
-
97
- #: includes/aye-admin-config.php:262
98
- #: includes/aye-admin-config.php:304
99
- #: includes/aye-admin-config.php:347
100
- msgid "Remember to click the Save Settings button at the bottom of the screen for new settings to take effect."
101
- msgstr ""
102
-
103
- #: includes/aye-admin-config.php:263
104
- #: includes/aye-admin-config.php:305
105
- #: includes/aye-admin-config.php:348
106
- #: includes/aye-admin-config.php:389
107
- msgid "For more information:"
108
- msgstr ""
109
-
110
- #: includes/aye-admin-config.php:264
111
- #: includes/aye-admin-config.php:306
112
- #: includes/aye-admin-config.php:349
113
- #: includes/aye-admin-config.php:390
114
- msgid "Artiss YouTube Embed Plugin Documentation"
115
- msgstr ""
116
-
117
- #: includes/aye-admin-config.php:265
118
- #: includes/aye-admin-config.php:307
119
- #: includes/aye-admin-config.php:350
120
- #: includes/aye-admin-config.php:391
121
- msgid "YouTube Player Documentation"
122
- msgstr ""
123
-
124
- #: includes/aye-admin-config.php:266
125
- #: includes/aye-admin-config.php:309
126
- #: includes/aye-admin-config.php:351
127
- #: includes/aye-admin-config.php:392
128
- #: includes/aye-display-about.php:40
129
- msgid "This plugin, and all support, is supplied for free, but <a title=\"Donate\" href=\"http://artiss.co.uk/donate\" target=\"_blank\">donations</a> are always welcome."
130
- msgstr ""
131
-
132
- #: includes/aye-admin-config.php:303
133
- msgid "This screen allows you to set the options for the default and additional profiles. If you don't specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required."
134
- msgstr ""
135
-
136
- #: includes/aye-admin-config.php:308
137
- msgid "EmbedPlus website"
138
- msgstr ""
139
-
140
- #: includes/aye-admin-config.php:346
141
- msgid "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."
142
- msgstr ""
143
-
144
- #: includes/aye-admin-config.php:388
145
- msgid "This screen provides useful information about this plugin along with methods of support."
146
- msgstr ""
147
-
148
- #: includes/aye-admin-config.php:450
149
- msgid "Welcome to Artiss YouTube Embed"
150
- msgstr ""
151
-
152
- #: includes/aye-admin-config.php:451
153
- msgid "Thank you for installing this plugin."
154
- msgstr ""
155
-
156
- #: includes/aye-admin-config.php:452
157
- msgid "These new menu options will allow you to configure your videos to just how you want them and provide links for help and support."
158
- msgstr ""
159
-
160
- #: includes/aye-admin-config.php:453
161
- msgid "Even if you do nothing else, please visit the Profiles option to check your default video values."
162
- msgstr ""
163
-
164
- #: includes/aye-deprecated.php:55
165
- msgid "This function does not support playlists"
166
- msgstr ""
167
-
168
- #: includes/aye-display-about.php:16
169
- #, php-format
170
- msgid "You are using Artiss YouTube Embed version %s. It was written by David Artiss."
171
- msgstr ""
172
-
173
- #: includes/aye-display-about.php:22
174
- msgid "Copyrights"
175
- msgstr ""
176
-
177
- #: includes/aye-display-about.php:24
178
- msgid "YouTube, and all associated logos, is the copyright of Google Inc."
179
- msgstr ""
180
-
181
- #: includes/aye-display-about.php:26
182
- msgid "EmbedPlus is copyright. Read the <a href=\"http://embedplus.com/terms.aspx\" target=\"_blank\">Terms &amp; Conditions of Use</a>."
183
- msgstr ""
184
-
185
- #: includes/aye-display-about.php:28
186
- msgid "Acknowledgements"
187
- msgstr ""
188
-
189
- #: includes/aye-display-about.php:30
190
- msgid "Images have been compressed with <a href=\"http://www.smushit.com/ysmush.it/\">Smush.it</a>."
191
- msgstr ""
192
-
193
- #: includes/aye-display-about.php:32
194
- msgid "JavaScript has been compressed with <a href=\"http://javascriptcompressor.com/\">JavaScript Compressor</a>."
195
- msgstr ""
196
-
197
- #: includes/aye-display-about.php:34
198
- msgid "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>."
199
- msgstr ""
200
-
201
- #: includes/aye-display-about.php:36
202
- msgid "Support Information"
203
- msgstr ""
204
-
205
- #: includes/aye-display-about.php:38
206
- msgid "Useful support information and links can be found by clicking on the Help tab at the top of each of the Artiss YouTube Embed administration screens."
207
- msgstr ""
208
-
209
- #: includes/aye-display-about.php:42
210
- msgid "Stay in Touch"
211
- msgstr ""
212
-
213
- #: includes/aye-display-about.php:44
214
- msgid "<a href=\"http://www.artiss.co.uk/wp-plugins\">See the full list</a> of Artiss plugins, including beta releases."
215
- msgstr ""
216
-
217
- #: includes/aye-display-about.php:46
218
- msgid "<a href=\"http://www.twitter.com/artiss_tech\">Follow Artiss.co.uk</a> on Twitter."
219
- msgstr ""
220
-
221
- #: includes/aye-display-about.php:48
222
- msgid "<a href=\"http://www.artiss.co.uk/feed\">Subscribe</a> to the Artiss.co.uk news feed."
223
- msgstr ""
224
-
225
- #: includes/aye-display-readme.php:16
226
- msgid " README"
227
- msgstr ""
228
-
229
- #: includes/aye-function-calls.php:162
230
- #: includes/aye-function-calls.php:223
231
- #: includes/aye-generate-download-code.php:34
232
- #: includes/aye-generate-shorturl-code.php:34
233
- #: includes/aye-generate-thumbnail-code.php:37
234
- #: includes/aye-generate-transcript-code.php:38
235
- #, php-format
236
- msgid "The YouTube ID of %s is invalid."
237
- msgstr ""
238
-
239
- #: includes/aye-function-calls.php:173
240
- #, php-format
241
- msgid "Could not fetch the transcript file %s."
242
- msgstr ""
243
-
244
- #: includes/aye-generate-download-code.php:23
245
- msgid "No YouTube ID was found."
246
- msgstr ""
247
-
248
- #: includes/aye-generate-embed-code.php:65
249
- msgid "No video/playlist ID has been supplied"
250
- msgstr ""
251
-
252
- #: includes/aye-generate-embed-code.php:183
253
- msgid "A video list cannot be viewed within this feed - please view the original content"
254
- msgstr ""
255
-
256
- #: includes/aye-generate-embed-code.php:187
257
- msgid "Click here to view the video on YouTube"
258
- msgstr ""
259
-
260
- #: includes/aye-generate-shorturl-code.php:22
261
- msgid "No video ID has been supplied"
262
- msgstr ""
263
-
264
- #: includes/aye-generate-widgets.php:25
265
- msgid "Embed YouTube Widget."
266
- msgstr ""
267
-
268
- #: includes/aye-options-general.php:57
269
- #: includes/aye-options-lists.php:26
270
- msgid "Settings Saved."
271
- msgstr ""
272
-
273
- #: includes/aye-options-general.php:74
274
- msgid "Cache cleared."
275
- msgstr ""
276
-
277
- #: includes/aye-options-general.php:87
278
- msgid "These are the general settings for Artiss YouTube Embed. Please select <a href=\"admin.php?page=aye-profile-options\">Profiles</a> for default embedding settings."
279
- msgstr ""
280
-
281
- #: includes/aye-options-general.php:91
282
- msgid "Embedding"
283
- msgstr ""
284
-
285
- #: includes/aye-options-general.php:95
286
- msgid "Add Metadata"
287
- msgstr ""
288
-
289
- #: includes/aye-options-general.php:96
290
- msgid "Allow rich metadata to be added to code. <a href=\"http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-metadata\">Learn more</a>"
291
- msgstr ""
292
-
293
- #: includes/aye-options-general.php:100
294
- msgid "Comment Embedding"
295
- msgstr ""
296
-
297
- #: includes/aye-options-general.php:101
298
- msgid "Allow YouTube URLs in comments - will display as embedded videos. <a href=\"http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-comments\">Learn more</a>"
299
- msgstr ""
300
-
301
- #: includes/aye-options-general.php:105
302
- #: includes/aye-options-general.php:141
303
- #: includes/aye-options-general.php:153
304
- #: includes/aye-options-general.php:174
305
- msgid "Profile to use"
306
- msgstr ""
307
-
308
- #: includes/aye-options-general.php:112
309
- msgid "Feed"
310
- msgstr ""
311
-
312
- #: includes/aye-options-general.php:114
313
- msgid "Text link"
314
- msgstr ""
315
-
316
- #: includes/aye-options-general.php:115
317
- msgid "Thumbnail"
318
- msgstr ""
319
-
320
- #: includes/aye-options-general.php:116
321
- msgid "Thumbnail &amp; Text Link"
322
- msgstr ""
323
-
324
- #: includes/aye-options-general.php:117
325
- msgid "Videos cannot be embedded in feeds. Select how you wish them to be shown instead"
326
- msgstr ""
327
-
328
- #: includes/aye-options-general.php:121
329
- msgid "Thumbnail to use"
330
- msgstr ""
331
-
332
- #: includes/aye-options-general.php:123
333
- #: includes/aye-shared-functions.php:425
334
- msgid "Default"
335
- msgstr ""
336
-
337
- #: includes/aye-options-general.php:124
338
- msgid "Default (HQ)"
339
- msgstr ""
340
-
341
- #: includes/aye-options-general.php:125
342
- msgid "Start"
343
- msgstr ""
344
-
345
- #: includes/aye-options-general.php:126
346
- msgid "Middle"
347
- msgstr ""
348
-
349
- #: includes/aye-options-general.php:127
350
- msgid "End"
351
- msgstr ""
352
-
353
- #: includes/aye-options-general.php:128
354
- msgid "Which thumbnail to use"
355
- msgstr ""
356
-
357
- #: includes/aye-options-general.php:132
358
- msgid "Alternative Shortcodes"
359
- msgstr ""
360
-
361
- #: includes/aye-options-general.php:136
362
- msgid "Alternative Shortcode 1"
363
- msgstr ""
364
-
365
- #: includes/aye-options-general.php:148
366
- msgid "Alternative Shortcode 2"
367
- msgstr ""
368
-
369
- #: includes/aye-options-general.php:160
370
- msgid "Migration"
371
- msgstr ""
372
-
373
- #: includes/aye-options-general.php:164
374
- msgid "Bracket Embedding"
375
- msgstr ""
376
-
377
- #: includes/aye-options-general.php:165
378
- msgid "Allow embedding using URLs within brackets. Activating impacts performance"
379
- msgstr ""
380
-
381
- #: includes/aye-options-general.php:169
382
- msgid "Alternative Embedding"
383
- msgstr ""
384
-
385
- #: includes/aye-options-general.php:170
386
- msgid "Allow all other types of embedding. Activating impacts performance"
387
- msgstr ""
388
-
389
- #: includes/aye-options-general.php:177
390
- msgid "For above 2 options"
391
- msgstr ""
392
-
393
- #: includes/aye-options-general.php:181
394
- msgid "Admin Options"
395
- msgstr ""
396
-
397
- #: includes/aye-options-general.php:185
398
- msgid "Show YouTube Button"
399
- msgstr ""
400
-
401
- #: includes/aye-options-general.php:186
402
- msgid "Show the YouTube button on the post editor"
403
- msgstr ""
404
-
405
- #: includes/aye-options-general.php:190
406
- msgid "Add to Admin Bar"
407
- msgstr ""
408
-
409
- #: includes/aye-options-general.php:191
410
- msgid "Add link to options screen to Admin Bar"
411
- msgstr ""
412
-
413
- #: includes/aye-options-general.php:195
414
- msgid "Profile &amp; List Sizes"
415
- msgstr ""
416
-
417
- #: includes/aye-options-general.php:199
418
- msgid "Number of Profiles"
419
- msgstr ""
420
-
421
- #: includes/aye-options-general.php:200
422
- msgid "Maximum number of profiles"
423
- msgstr ""
424
-
425
- #: includes/aye-options-general.php:204
426
- msgid "Number of Lists"
427
- msgstr ""
428
-
429
- #: includes/aye-options-general.php:205
430
- msgid "Maximum number of lists"
431
- msgstr ""
432
-
433
- #: includes/aye-options-general.php:209
434
- msgid "Performance"
435
- msgstr ""
436
-
437
- #: includes/aye-options-general.php:213
438
- msgid "Embed Cache"
439
- msgstr ""
440
-
441
- #: includes/aye-options-general.php:214
442
- msgid "How many hours to retain embed output. 0 to switch off"
443
- msgstr ""
444
-
445
- #: includes/aye-options-general.php:218
446
- msgid "Video Information Cache"
447
- msgstr ""
448
-
449
- #: includes/aye-options-general.php:219
450
- msgid "How many hours to retain video information, including it's validity. 0 to switch off"
451
- msgstr ""
452
-
453
- #: includes/aye-options-general.php:223
454
- msgid "Transcript Cache"
455
- msgstr ""
456
-
457
- #: includes/aye-options-general.php:224
458
- msgid "How many hours to store transcripts for in cache. 0 to switch off"
459
- msgstr ""
460
-
461
- #: includes/aye-options-general.php:233
462
- msgid "Clear Cache"
463
- msgstr ""
464
-
465
- #: includes/aye-options-general.php:234
466
- #, php-format
467
- msgid "Select this option to remove all YouTube Embed cache. You currently have %d cached video(s)"
468
- msgstr ""
469
-
470
- #: includes/aye-options-general.php:238
471
- msgid "YouTube API"
472
- msgstr ""
473
-
474
- #: includes/aye-options-general.php:240
475
- msgid "The YouTube API is used to validate video IDs and to determine if it is a video or playlist."
476
- msgstr ""
477
-
478
- #: includes/aye-options-general.php:244
479
- msgid "API State"
480
- msgstr ""
481
-
482
- #: includes/aye-options-general.php:246
483
- msgid "API should not be used"
484
- msgstr ""
485
-
486
- #: includes/aye-options-general.php:247
487
- msgid "HTTP API used and errors are reported"
488
- msgstr ""
489
-
490
- #: includes/aye-options-general.php:248
491
- msgid "HTTPS API used and errors are reported"
492
- msgstr ""
493
-
494
- #: includes/aye-options-general.php:249
495
- msgid "HTTP API used and no errors are reported"
496
- msgstr ""
497
-
498
- #: includes/aye-options-general.php:250
499
- msgid "HTTPS API used and no errors are reported"
500
- msgstr ""
501
-
502
- #: includes/aye-options-general.php:255
503
- msgid "Error Reporting"
504
- msgstr ""
505
-
506
- #: includes/aye-options-general.php:257
507
- msgid "Playback errors are within the XHTML source code as comments - parameter errors and other types are displayed on the post output."
508
- msgstr ""
509
-
510
- #: includes/aye-options-general.php:260
511
- msgid "Video Playback Error Message"
512
- msgstr ""
513
-
514
- #: includes/aye-options-general.php:261
515
- msgid "This is the message that will be shown on the post"
516
- msgstr ""
517
-
518
- #: includes/aye-options-general.php:264
519
- msgid "Security"
520
- msgstr ""
521
-
522
- #: includes/aye-options-general.php:267
523
- msgid "Privacy-Enhanced Mode"
524
- msgstr ""
525
-
526
- #: includes/aye-options-general.php:268
527
- msgid "When on, the player on this site will not store cookies"
528
- msgstr ""
529
-
530
- #: includes/aye-options-general.php:271
531
- msgid "Compatability"
532
- msgstr ""
533
-
534
- #: includes/aye-options-general.php:274
535
- msgid "Allow Frame Border on IFRAME"
536
- msgstr ""
537
-
538
- #: includes/aye-options-general.php:275
539
- msgid "FRAMEBORDER is not HTML5 compliant"
540
- msgstr ""
541
-
542
- #: includes/aye-options-general.php:280
543
- #: includes/aye-options-lists.php:119
544
- #: includes/aye-options-profiles.php:345
545
- msgid "Save Settings"
546
- msgstr ""
547
-
548
- #: includes/aye-options-lists.php:31
549
- msgid "All fields must be completed."
550
- msgstr ""
551
-
552
- #: includes/aye-options-lists.php:53
553
- msgid "Errors were found with your video list. See the list below for details."
554
- msgstr ""
555
-
556
- #: includes/aye-options-lists.php:88
557
- msgid "List"
558
- msgstr ""
559
-
560
- #: includes/aye-options-lists.php:98
561
- msgid "Change list"
562
- msgstr ""
563
-
564
- #: includes/aye-options-lists.php:101
565
- msgid "These are the options for list "
566
- msgstr ""
567
-
568
- #: includes/aye-options-lists.php:101
569
- msgid "Update the name, if required, and specify a list of YouTube video IDs. Use the drop-down on the right hand side to swap between lists."
570
- msgstr ""
571
-
572
- #: includes/aye-options-lists.php:106
573
- msgid "List name"
574
- msgstr ""
575
-
576
- #: includes/aye-options-lists.php:108
577
- msgid "The name you wish to give this list"
578
- msgstr ""
579
-
580
- #: includes/aye-options-lists.php:112
581
- msgid "Video IDs (one per line)"
582
- msgstr ""
583
-
584
- #: includes/aye-options-lists.php:130
585
- #: includes/aye-options-widgets.php:25
586
- msgid "Video ID"
587
- msgstr ""
588
-
589
- #: includes/aye-options-lists.php:130
590
- #: includes/aye-options-widgets.php:19
591
- msgid "Video Title"
592
- msgstr ""
593
-
594
- #: includes/aye-options-lists.php:130
595
- msgid "Status"
596
- msgstr ""
597
-
598
- #: includes/aye-options-lists.php:146
599
- msgid "This is a playlist"
600
- msgstr ""
601
-
602
- #: includes/aye-options-lists.php:150
603
- msgid "Invalid video ID"
604
- msgstr ""
605
-
606
- #: includes/aye-options-lists.php:154
607
- msgid "YouTube API error"
608
- msgstr ""
609
-
610
- #: includes/aye-options-lists.php:157
611
- msgid "Valid video"
612
- msgstr ""
613
-
614
- #: includes/aye-options-lists.php:175
615
- msgid "The video ID is valid"
616
- msgstr ""
617
-
618
- #: includes/aye-options-lists.php:178
619
- msgid "The video ID is invalid"
620
- msgstr ""
621
-
622
- #: includes/aye-options-profiles.php:98
623
- msgid " Profile Saved."
624
- msgstr ""
625
-
626
- #: includes/aye-options-profiles.php:117
627
- msgid "Change profile"
628
- msgstr ""
629
-
630
- #: includes/aye-options-profiles.php:122
631
- msgid "These are the options for the default profile."
632
- msgstr ""
633
-
634
- #: includes/aye-options-profiles.php:124
635
- #, php-format
636
- msgid "These are the options for profile %s."
637
- msgstr ""
638
-
639
- #: includes/aye-options-profiles.php:126
640
- msgid "Use the drop-down on the right hand side to swap between profiles."
641
- msgstr ""
642
-
643
- #: includes/aye-options-profiles.php:132
644
- msgid "Profile name"
645
- msgstr ""
646
-
647
- #: includes/aye-options-profiles.php:134
648
- msgid "The name you wish to give this profile"
649
- msgstr ""
650
-
651
- #: includes/aye-options-profiles.php:138
652
- msgid "Video Embed Type"
653
- msgstr ""
654
-
655
- #: includes/aye-options-profiles.php:139
656
- msgid "The type of player to use for videos."
657
- msgstr ""
658
-
659
- #: includes/aye-options-profiles.php:140
660
- #: includes/aye-options-profiles.php:150
661
- #: includes/aye-options-profiles.php:323
662
- #: includes/aye-options-widgets.php:95
663
- msgid "IFRAME"
664
- msgstr ""
665
-
666
- #: includes/aye-options-profiles.php:140
667
- msgid "Uses HTML5, if available. Alternatively, uses AS3 Flash player. This is the current YouTube default.."
668
- msgstr ""
669
-
670
- #: includes/aye-options-profiles.php:141
671
- #: includes/aye-options-profiles.php:151
672
- #: includes/aye-options-profiles.php:324
673
- #: includes/aye-options-widgets.php:97
674
- msgid "OBJECT"
675
- msgstr ""
676
-
677
- #: includes/aye-options-profiles.php:141
678
- msgid "Use the AS3 Flash player."
679
- msgstr ""
680
-
681
- #: includes/aye-options-profiles.php:142
682
- #: includes/aye-options-widgets.php:99
683
- msgid "Chromeless"
684
- msgstr ""
685
-
686
- #: includes/aye-options-profiles.php:142
687
- msgid "Use the <a href=\"http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-chromeless\">Chromeless</a> version of the AS3 Flash Player."
688
- msgstr ""
689
-
690
- #: includes/aye-options-profiles.php:143
691
- #: includes/aye-options-profiles.php:359
692
- #: includes/aye-options-widgets.php:101
693
- msgid "EmbedPlus"
694
- msgstr ""
695
-
696
- #: includes/aye-options-profiles.php:143
697
- msgid "Use <a href=\"http://www.artiss.co.uk/artiss-youtube-embed/further-help#ye-embedplus\">EmbedPlus</a>, if Flash is available."
698
- msgstr ""
699
-
700
- #: includes/aye-options-profiles.php:148
701
- msgid "Playlist Embed Type"
702
- msgstr ""
703
-
704
- #: includes/aye-options-profiles.php:149
705
- msgid "The type of player to use when showing playlists."
706
- msgstr ""
707
-
708
- #: includes/aye-options-profiles.php:156
709
- msgid "Options For All Player Types"
710
- msgstr ""
711
-
712
- #: includes/aye-options-profiles.php:160
713
- #: includes/aye-options-widgets.php:55
714
- msgid "Template"
715
- msgstr ""
716
-
717
- #: includes/aye-options-profiles.php:165
718
- #: includes/aye-options-widgets.php:61
719
- msgid "Style"
720
- msgstr ""
721
-
722
- #: includes/aye-options-profiles.php:172
723
- msgid "Video size"
724
- msgstr ""
725
-
726
- #: includes/aye-options-profiles.php:173
727
- msgid "The width x height of the video, in pixels"
728
- msgstr ""
729
-
730
- #: includes/aye-options-profiles.php:177
731
- msgid "Default Sizes"
732
- msgstr ""
733
-
734
- #: includes/aye-options-profiles.php:179
735
- msgid "Use above sizes"
736
- msgstr ""
737
-
738
- #: includes/aye-options-profiles.php:185
739
- msgid "Select one of these default sizes to override the above video sizes"
740
- msgstr ""
741
-
742
- #: includes/aye-options-profiles.php:189
743
- #: includes/aye-options-widgets.php:79
744
- msgid "Dynamically Resize"
745
- msgstr ""
746
-
747
- #: includes/aye-options-profiles.php:190
748
- msgid "Show full width and resize with the browser"
749
- msgstr ""
750
-
751
- #: includes/aye-options-profiles.php:194
752
- msgid "Set Maximum Size"
753
- msgstr ""
754
-
755
- #: includes/aye-options-profiles.php:195
756
- msgid "Use above width to define maximum size"
757
- msgstr ""
758
-
759
- #: includes/aye-options-profiles.php:202
760
- msgid "Audio Only"
761
- msgstr ""
762
-
763
- #: includes/aye-options-profiles.php:203
764
- msgid "Only show the toolbar for audio only playback"
765
- msgstr ""
766
-
767
- #: includes/aye-options-profiles.php:207
768
- #: includes/aye-options-widgets.php:107
769
- msgid "Autoplay"
770
- msgstr ""
771
-
772
- #: includes/aye-options-profiles.php:208
773
- msgid "The video will start playing when the player loads"
774
- msgstr ""
775
-
776
- #: includes/aye-options-profiles.php:213
777
- msgid "Options Not Supported by EmbedPlus"
778
- msgstr ""
779
-
780
- #: includes/aye-options-profiles.php:218
781
- msgid "Auto hide"
782
- msgstr ""
783
-
784
- #: includes/aye-options-profiles.php:220
785
- msgid "Controls &amp; progress bar remain visible"
786
- msgstr ""
787
-
788
- #: includes/aye-options-profiles.php:221
789
- msgid "Controls &amp; progress bar fade out"
790
- msgstr ""
791
-
792
- #: includes/aye-options-profiles.php:222
793
- msgid "Progress bar fades"
794
- msgstr ""
795
-
796
- #: includes/aye-options-profiles.php:223
797
- msgid "Video controls will automatically hide after a video begins playing"
798
- msgstr ""
799
-
800
- #: includes/aye-options-profiles.php:227
801
- msgid "Controls"
802
- msgstr ""
803
-
804
- #: includes/aye-options-profiles.php:228
805
- msgid "Video player controls will display"
806
- msgstr ""
807
-
808
- #: includes/aye-options-profiles.php:232
809
- msgid "SSL"
810
- msgstr ""
811
-
812
- #: includes/aye-options-profiles.php:233
813
- msgid "Use SSL? <a href=\"http://www.google.com/support/youtube/bin/answer.py?answer=171780&expand=UseHTTPS#HTTPS\">Read more</a>"
814
- msgstr ""
815
-
816
- #: includes/aye-options-profiles.php:237
817
- #: includes/aye-options-widgets.php:153
818
- msgid "Loop Video"
819
- msgstr ""
820
-
821
- #: includes/aye-options-profiles.php:238
822
- msgid "Play the initial video again and again. In the case of a playlist, this will play the entire playlist and then start again at the first video"
823
- msgstr ""
824
-
825
- #: includes/aye-options-profiles.php:242
826
- msgid "Information"
827
- msgstr ""
828
-
829
- #: includes/aye-options-profiles.php:243
830
- msgid "Display the video title and uploader before the video starts"
831
- msgstr ""
832
-
833
- #: includes/aye-options-profiles.php:247
834
- msgid "Theme"
835
- msgstr ""
836
-
837
- #: includes/aye-options-profiles.php:249
838
- msgid "Dark"
839
- msgstr ""
840
-
841
- #: includes/aye-options-profiles.php:250
842
- msgid "Light"
843
- msgstr ""
844
-
845
- #: includes/aye-options-profiles.php:251
846
- msgid "Display player controls within a dark or light control bar"
847
- msgstr ""
848
-
849
- #: includes/aye-options-profiles.php:255
850
- msgid "Options for AS3 Player"
851
- msgstr ""
852
-
853
- #: includes/aye-options-profiles.php:260
854
- msgid "Annotations"
855
- msgstr ""
856
-
857
- #: includes/aye-options-profiles.php:261
858
- msgid "Video annotations are shown by default"
859
- msgstr ""
860
-
861
- #: includes/aye-options-profiles.php:265
862
- msgid "Closed Captions"
863
- msgstr ""
864
-
865
- #: includes/aye-options-profiles.php:266
866
- msgid "Show closed captions (subtitles) by default, even if the user has turned captions off"
867
- msgstr ""
868
-
869
- #: includes/aye-options-profiles.php:270
870
- msgid "Disable Keyboard"
871
- msgstr ""
872
-
873
- #: includes/aye-options-profiles.php:271
874
- msgid "Disable the player keyboard controls"
875
- msgstr ""
876
-
877
- #: includes/aye-options-profiles.php:275
878
- msgid "Fullscreen"
879
- msgstr ""
880
-
881
- #: includes/aye-options-profiles.php:276
882
- msgid "A button will allow the viewer to watch the video fullscreen"
883
- msgstr ""
884
-
885
- #: includes/aye-options-profiles.php:280
886
- msgid "Link to YouTube"
887
- msgstr ""
888
-
889
- #: includes/aye-options-profiles.php:281
890
- msgid "Video links back to YouTube when clicked"
891
- msgstr ""
892
-
893
- #: includes/aye-options-profiles.php:285
894
- msgid "Modest Branding"
895
- msgstr ""
896
-
897
- #: includes/aye-options-profiles.php:286
898
- msgid "Reduce branding on video."
899
- msgstr ""
900
-
901
- #: includes/aye-options-profiles.php:290
902
- msgid "Progress Bar Colour"
903
- msgstr ""
904
-
905
- #: includes/aye-options-profiles.php:292
906
- msgid "Red"
907
- msgstr ""
908
-
909
- #: includes/aye-options-profiles.php:293
910
- msgid "White (desaturated)"
911
- msgstr ""
912
-
913
- #: includes/aye-options-profiles.php:294
914
- msgid "The colour that will be used in the player's video progress bar to highlight the amount of the video that's already been seen"
915
- msgstr ""
916
-
917
- #: includes/aye-options-profiles.php:298
918
- msgid "Related Videos"
919
- msgstr ""
920
-
921
- #: includes/aye-options-profiles.php:299
922
- msgid "Load related videos once playback starts. Also toggles the search option."
923
- msgstr ""
924
-
925
- #: includes/aye-options-profiles.php:303
926
- msgid "Options Not Supported by HTML5 Player"
927
- msgstr ""
928
-
929
- #: includes/aye-options-profiles.php:307
930
- msgid "Window Mode"
931
- msgstr ""
932
-
933
- #: includes/aye-options-profiles.php:309
934
- msgid "Opaque"
935
- msgstr ""
936
-
937
- #: includes/aye-options-profiles.php:310
938
- msgid "Transparent"
939
- msgstr ""
940
-
941
- #: includes/aye-options-profiles.php:311
942
- msgid "Window"
943
- msgstr ""
944
-
945
- #: includes/aye-options-profiles.php:312
946
- msgid "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>."
947
- msgstr ""
948
-
949
- #: includes/aye-options-profiles.php:317
950
- msgid "Options Only Supported By EmbedPlus"
951
- msgstr ""
952
-
953
- #: includes/aye-options-profiles.php:317
954
- msgid "Learn more about EmbedPlus"
955
- msgstr ""
956
-
957
- #: includes/aye-options-profiles.php:321
958
- msgid "Fallback Embed Type"
959
- msgstr ""
960
-
961
- #: includes/aye-options-profiles.php:322
962
- msgid "The type of player to use if Flash is not available and EmbedPlus cannot be used."
963
- msgstr ""
964
-
965
- #: includes/aye-options-profiles.php:328
966
- msgid "Play HD"
967
- msgstr ""
968
-
969
- #: includes/aye-options-profiles.php:329
970
- msgid "Play the video in HD if possible"
971
- msgstr ""
972
-
973
- #: includes/aye-options-profiles.php:333
974
- msgid "Real-time Reactions"
975
- msgstr ""
976
-
977
- #: includes/aye-options-profiles.php:334
978
- msgid "Show the Real-time Reactions button"
979
- msgstr ""
980
-
981
- #: includes/aye-options-profiles.php:338
982
- msgid "Sweet Spots"
983
- msgstr ""
984
-
985
- #: includes/aye-options-profiles.php:339
986
- msgid "Find sweet spots for the next and previous buttons"
987
- msgstr ""
988
-
989
- #: includes/aye-options-profiles.php:349
990
- msgid "Would you like the video below to be yours? <a href=\"http://www.artiss.co.uk/contact\">Contact me</a> for sponsorship information."
991
- msgstr ""
992
-
993
- #: includes/aye-options-profiles.php:354
994
- msgid "YouTube Video Sample"
995
- msgstr ""
996
-
997
- #: includes/aye-options-profiles.php:355
998
- msgid "This uses the above settings, once they have been saved. <b>Would you like this to be your video? If so, <a href=\"http://www.artiss.co.uk/contact\">contact me</a>!</b>"
999
- msgstr ""
1000
-
1001
- #: includes/aye-options-profiles.php:356
1002
- msgid "Use the drop-down below to change which parameters the video uses - press the Change Video button to update it."
1003
- msgstr ""
1004
-
1005
- #: includes/aye-options-profiles.php:358
1006
- msgid "Standard"
1007
- msgstr ""
1008
-
1009
- #: includes/aye-options-profiles.php:360
1010
- msgid "3D"
1011
- msgstr ""
1012
-
1013
- #: includes/aye-options-profiles.php:361
1014
- msgid "Playlist"
1015
- msgstr ""
1016
-
1017
- #: includes/aye-options-profiles.php:364
1018
- msgid "Change video"
1019
- msgstr ""
1020
-
1021
- #: includes/aye-options-widgets.php:13
1022
- msgid "Widget Title"
1023
- msgstr ""
1024
-
1025
- #: includes/aye-options-widgets.php:33
1026
- msgid "ID Type"
1027
- msgstr ""
1028
-
1029
- #: includes/aye-options-widgets.php:35
1030
- msgid "Video or Playlist"
1031
- msgstr ""
1032
-
1033
- #: includes/aye-options-widgets.php:37
1034
- msgid "Search"
1035
- msgstr ""
1036
-
1037
- #: includes/aye-options-widgets.php:39
1038
- msgid "User"
1039
- msgstr ""
1040
-
1041
- #: includes/aye-options-widgets.php:47
1042
- #: includes/aye-shared-functions.php:432
1043
- msgid "Profile"
1044
- msgstr ""
1045
-
1046
- #: includes/aye-options-widgets.php:67
1047
- msgid "Size"
1048
- msgstr ""
1049
-
1050
- #: includes/aye-options-widgets.php:81
1051
- #: includes/aye-options-widgets.php:93
1052
- #: includes/aye-options-widgets.php:109
1053
- #: includes/aye-options-widgets.php:141
1054
- #: includes/aye-options-widgets.php:155
1055
- msgid "Profile default"
1056
- msgstr ""
1057
-
1058
- #: includes/aye-options-widgets.php:83
1059
- #: includes/aye-options-widgets.php:111
1060
- #: includes/aye-options-widgets.php:157
1061
- msgid "No"
1062
- msgstr ""
1063
-
1064
- #: includes/aye-options-widgets.php:85
1065
- #: includes/aye-options-widgets.php:113
1066
- #: includes/aye-options-widgets.php:159
1067
- msgid "Yes"
1068
- msgstr ""
1069
-
1070
- #: includes/aye-options-widgets.php:91
1071
- msgid "Embed Type"
1072
- msgstr ""
1073
-
1074
- #: includes/aye-options-widgets.php:119
1075
- msgid "Start (seconds)"
1076
- msgstr ""
1077
-
1078
- #: includes/aye-options-widgets.php:125
1079
- msgid "Stop (seconds)"
1080
- msgstr ""
1081
-
1082
- #: includes/aye-options-widgets.php:130
1083
- msgid "Non-EmbedPlus Options"
1084
- msgstr ""
1085
-
1086
- #: includes/aye-options-widgets.php:139
1087
- msgid "List Playback"
1088
- msgstr ""
1089
-
1090
- #: includes/aye-options-widgets.php:143
1091
- msgid "Play each video in order"
1092
- msgstr ""
1093
-
1094
- #: includes/aye-options-widgets.php:145
1095
- msgid "Play videos randomly"
1096
- msgstr ""
1097
-
1098
- #: includes/aye-options-widgets.php:147
1099
- msgid "Play one random video"
1100
- msgstr ""
1101
-
1102
- #: includes/aye-shared-functions.php:184
1103
- #, php-format
1104
- msgid "An error occurred accessing the YouTube API for video ID %s - %s"
1105
- msgstr ""
1106
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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, responsive, search, sidebar, simple, smart, url, user, valid, video, widget, width, xhtml, youtube, youtuber
5
  Requires at least: 2.9
6
- Tested up to: 3.3.1
7
- Stable tag: 2.5
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
 
@@ -13,20 +13,15 @@ A simple to use method of embedding YouTube videos into your posts and pages but
13
  Artiss YouTube Embed (formally YouTube Embed) is an incredibly simple, yet powerful, method of embedding YouTube videos into your WordPress site. Options include:
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
- * Automatically generate playlists based on user name or search text
21
  * Create multiple profiles - use them for different videos to get the exact style that you want
22
  * Google compatible metadata is added to the video output - great for SEO!
23
  * Code is cached for maximum performance
24
  * Using a different YouTube plugin? Documentation and tools are provided to help you migrate to Artiss YouTube Embed
25
- * Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [contact me](http://artiss.co.uk/contact "Contact")**
26
  * And much, much more!
27
 
28
- It has all the features of other similar plugins - Smart YouTube, for instance. In fact if there's a feature in another YouTube embedding plugin that this doesn't have, let me know - I haven't come across it!
29
-
30
  To add a video to a post or page simply use the shortcode `[youtube]video[/youtube]`, where `video` is the ID or URL of the video. Alternatively, you can add one (or more) widgets to your sidebar.
31
 
32
  Within the administration area of your blog you will find a new menu named `YouTube` (see screenshot 1). Click on the `Options` sub-menu to set a number of general options. Alternatively click on the `Profiles` sub-menu to set the default options which define the output of your videos - any videos you display (unless overridden by parameters - more on that later) will use the settings from the Profiles screen.
@@ -51,17 +46,14 @@ The following parameters work with all embed types:
51
 
52
  * **audio** - yes or no, this will hide the video and display just the toolbar (ideal for audio only playback) if switched on
53
  * **autoplay** - yes or no, should the video automatically start playing?
54
- * **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.
55
  * **height** - the video height, in pixels
56
  * **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)
57
  * **profile** - specify a different default profile (see section on Profiles for further details)
58
  * **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
59
- * **ssl** - Use SSL or not? Basically, if set on the URL will be HTTPS rather than HTTP.
60
  * **start** - a number of seconds from where to start the video playing
61
  * **style** - apply CSS elements directly to the video output
62
  * **template** - specify a template (see section on Templates for further details)
63
- * **title** - the title of the video
64
- * **type** - which embedding type to use, this can be `embedplus`, `iframe`, `object` or `chromeless`
65
  * **width** - the video width, in pixels
66
 
67
  The following parameters will not work with EmbedPlus:
@@ -69,7 +61,6 @@ The following parameters will not work with EmbedPlus:
69
  * **autohide** - 0, 1 or 2, this parameter indicates whether the video controls will automatically hide after a video begins playing. The default behaviour, a value of 2, is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible. If this parameter is set to 0, the video progress bar and the video player controls will be visible throughout the video. If this parameter is set to 1, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
70
  * **controls** - yes or no, should the controls be shown?
71
  * **https** - yes or no, whether to use HTTPS for the video
72
- * **info** - yes or no, show video information
73
  * **loop** - yes or no, whether to start the video again once it ends
74
  * **theme** - dark or light, display player controls (like a 'play' button or volume control) within a dark or light control bar
75
 
@@ -80,19 +71,15 @@ The following parameters will not work with EmbedPlus or if IFRAME uses HTML5:
80
  * **color** - white or red, the colour of the progress bar (see the FAQ about having a white progress bar with the light theme)
81
  * **disablekb** - yes or no, disable keyboard controls
82
  * **fullscreen** - yes or no, this will add the fullscreen button to the toolbar. This also works with EmbedPlus.
 
83
  * **link** - yes or no, link video to YouTube
84
  * **related** - yes or no, show related videos
85
- * **search** - yes or no, create a playlist based on a search word. The search word should be specified instead of a video ID. See "Automatically Generate Playlists" option for more details
86
- * **user** - yes or no, create a playlist based on a user's uploads. The search word should be specified instead of a video ID. See "Automatically Generate Playlists" option for more details
87
-
88
- The following parameters will not work if IFRAME uses HTML5:
89
-
90
- * **stop** - this stops the video at a specific time, given in seconds
91
 
92
  The following parameters are only for use with EmbedPlus:
93
 
94
  * **hd** - play the video in HD quality, if available
95
  * **react** - yes or no, this specified whether you wish to show the Real-time Reactions button
 
96
  * **sweetspot** - yes or no, this will find sweet spots for the next/prev buttons
97
 
98
  == Alternative Shortcodes ==
@@ -116,8 +103,6 @@ e.g. `youtube_video_embed( 'Z_sCoHGIpU0', 'width=300&height=200' )`
116
 
117
  Sidebar widgets can be easily added. In Administration simply click on the `Widgets` option under the `Appearance` menu. `YouTube Embed` will be one of the listed widgets. Drag it to the appropriate sidebar on the right hand side and then choose your video options - any that aren't specified are taken from your default profile.
118
 
119
- If you wish to display an automatically generated playlist based on user name or search term, simply change the "ID Type" appropriately and then specify the name or search word(s) where the video ID would normally be entered.
120
-
121
  And that's it! You can use unlimited widgets, so you can add different videos to different sidebars.
122
 
123
  == Playlists ==
@@ -140,7 +125,7 @@ The template consists simply of any HTML that you wish but with `%video%` where
140
 
141
  e.g. `<div align="center">%video%</div>`
142
 
143
- 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.
144
 
145
  == Profiles ==
146
 
@@ -184,12 +169,6 @@ If you wish to use a PHP function call to get the transcript, then you would use
184
 
185
  In all of these cases, the original XML format has been changed to a readable output. If, though, you'd like to return the original XML format, then you can use the call `get_youtube_transcript_xml( ID )`.
186
 
187
- == Automatically Generate Playlists ==
188
-
189
- YouTube now includes options to automatically generate playlists based upon a user name or a search name.
190
-
191
- To use, simply use the `user` or `search` parameter to switch the appropriate option on. Then, instead of a video ID or URL, you should specify either the user name or search word(s).
192
-
193
  == Migration ==
194
 
195
  Within administration, selecting `Options` from the `YouTube` menu will provide a list of general options. One section is named `Migration`. There are 2 boxes that can be ticked to activate 2 different types of alternative embedding - these have been provided to allow easy migration from other similar plugins. You can also assign a specific profile to these migrated options.
@@ -284,11 +263,12 @@ In all cases putting the cache to 0 will switch off caching for that option.
284
 
285
  **Further Embedding Options**
286
 
287
- Under the `YouTube` administration menu is a sub-menu named `Options`. Select this and find the section named `Embedding`. There are 3 options here...
288
 
289
  1. Add Metadata - by default, RDFa metadata is added to video output. This can be switched on or off as required (see the FAQs for more information about metadata usage).
290
- 2. Comment Embedding - tick this to allow YouTube URLs added to comments to be converted to embedded videos.
291
- 3. Feed - videos will not appear in feeds so use this option to decide whether you want them to be converted to links and/or thumbnails.
 
292
 
293
  In the case of URL and Comment embedding a profile can be selected.
294
 
@@ -302,7 +282,7 @@ All of my plugins are supported via [my website](http://www.artiss.co.uk "Artiss
302
 
303
  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).
304
 
305
- 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.
306
 
307
  **This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
308
 
@@ -321,7 +301,7 @@ For problems, suggestions or enhancements for this plugin, there is [a dedicated
321
  1. Upload the entire `youtube-embed` folder to your wp-content/plugins/ directory.
322
  2. Activate the plugin through the 'Plugins' menu in WordPress.
323
  3. If you're updating from version 2.0.1 or before, please read the FAQ on backwards compatibility.
324
- 4. That's it, you're done - you just need to add the shortcode wherever you need.
325
 
326
  == Frequently Asked Questions ==
327
 
@@ -383,35 +363,7 @@ You can [read more about this here](http://www.artiss.co.uk/artiss-youtube-embed
383
 
384
  It uses standard OBJECT and IFRAME coding - this, along with the above standards compliance, means that the output should work on most browsers.
385
 
386
- = The video output is overlapping or stuttering =
387
-
388
- If you go into the Profile screen in Administration there is a "Window Mode" option. This defines how Flash output interacts with any other around it. "Window" is the default and gives good performance but may cause overlapping. If overlapping is causing an issue try "Opaque".
389
-
390
- = No video is showing =
391
-
392
- If you find no video is showing but there's no error either check the source code of the page. Can you find the text "<!--YouTube Error: bad URL entered-->" in the page? If so, you have Jetpack installed and that is displaying the video instead.
393
-
394
- There are two ways around this.
395
-
396
- First, you could disable all the shortcodes in Jetpack - Jetpack allows you to deactivate certain "modules" of the plugin and, if you can live without the other extra shortcodes, deactivating the shortcodes part will restore functionality back to YouTube Embed
397
-
398
- Alternatively, you can use a secondary shortcode - [youtube_video]. Use this instead of [youtube] and YouTube Embed will render the results without a problem
399
-
400
- This second suggestion will work for any plugin that may use the same shortcode.
401
-
402
- = There used to be an option to allow the plugin to work with YouTube URLs. Where did it go? =
403
-
404
- WordPress will, by default, convert YouTube URLs to videos using a very basic default configuration. Earlier versions of this plugin had an option to override this so this plugin would output the results instead (giving you full control of the output). Unfortunately, it stopped working and I do not have enough knowledge on the required WordPress code to work out how to fix it. Rather than leave broken code in place I have removed it.
405
-
406
- If you wish to have full control over your YouTube output I would suggest placing all YouTube URLs within [youtube] shortcodes.
407
-
408
- = My OPTIONS table seems to be full of cache entries for YouTube Embed =
409
-
410
- Cache issues with past versions of the plugin may mean that cache entries have been left behind. The Options menu in YouTube Embed administration now has an additional option in the performance section named "Clear Cache". Simply tick this box and click on the "Save Settings" button to clear out any cache.
411
-
412
- Next to the option it will display how many videos have cache in the database. If this is vastly more than the number of videos on your site it may be necessary to clear the cache down. If you find you keep having to do this please [let me know](http://www.artiss.co.uk/forum "WordPress Plugins Forum").
413
-
414
- Please note - clearing the cache will not just remove any redundant cache as there is no way to identify what is required and what is not. It will therefore remove all cache related to YouTube Embed, therefore having a temporary performance impact on your site as displayed videos are generated and cached again.
415
 
416
  = Which version of PHP does this plugin work with? =
417
 
@@ -419,122 +371,59 @@ It has been syntax checked as PHP 4. However, this does not guarantee PHP 4 comp
419
 
420
  Although I attempt to keep with PHP 4 compatibility there are no guarantees of this.
421
 
 
 
 
 
422
  == Screenshots ==
423
 
424
- 1. Artiss YouTube Embed in the administration menu
425
- 2. The main options screen
426
- 3. The profiles screen
427
- 4. The lists screen - videos have been added and validated. The drop-down help is also shown
428
  5. The About screen
429
  6. The default widget options
430
- 7. The default visual editor options with the YouTube Embed button
431
 
432
  == Changelog ==
433
 
434
- = 2.5 =
435
- * Maintenance: Updated code to work with new playlist options
436
- * Maintenance: Removed embedded URL option due to issues with existing code (see FAQ for details)
437
- * Maintenance: Added further FAQs based on common forum queries
438
- * Maintenance: Wording on options screens changed to better identify differences between players
439
- * Maintenance: Added advertisement to profile screen
440
- * Maintenance: Modified demonstration video and made sponsorship request more visible
441
- * Maintenance: Changes the YouTube admin screen icon
442
- * Enhancement: Download link now uses deturl.com
443
- * Enhancement: Admin Bar link improved in WP 3.3 onwards
444
- * Enhancement: New user upload and search features added
445
- * Enhancement: Now supports ability to specify the time to stop video playback
446
- * Enhancement: Default windowing mode changed to improve performance
447
- * Enhancement: FRAMEBORDER is switchable for the purpose of HTML5 compatibility
448
- * Enhancement: Added internationalisation
449
- * Enhancement: README in admin menu now shows the corresponding README for the version of the plugin you have installed, rather than the latest one
450
- * Enhancement: Added option to admin screen to clear video cache (see FAQ for details)
451
- * Enhancement: Allow recursive shortcodes - that is, shortcodes within the YouTube shortcode
452
- * Bug: Fixed bug in retrieving the video title
453
- * Bug: Resolved various debug messages
454
- * Bug: Fixed bug in MCE button JavaScript
455
-
456
- = 2.4.1 =
457
- * Maintenance: Removed dashboard widget
458
-
459
- = 2.4 =
460
- * Maintenance: Re-sequenced the changelog in the README
461
- * Maintenance: Removed drop shadow option
462
- * Maintenance: Re-design of widgets, reducing number of parameters down to make it easier to use - use profiles to modify missing parameters
463
- * Maintenance: Updated YouTube icons
464
- * Enhancement: Added frameborder="0" to IFRAME code
465
- * Enhancement: Added Privacy-Enhanced mode. Doesn't work with Chromeless player.
466
- * Enhancement: Added `title` option, so you can name the video
467
- * Enhancement: Added `ssl` option, allowing you to override whether HTTP or HTTPS is used for the video
468
- * 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
469
- * Enhancement: Made `modestbranding` a switchable option (switchable in profile options but not on video-by-video basis) due to issues with Apple devices
470
- * Enhancement: Improved matching of URL embedded into post
471
- * 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
472
- * Enhancement: Use WP 3.3 Feature Pointer to highlight new menu when plugin is activated
473
- * Bug: Ensure `showinfo` parameter is set correctly
474
- * Bug: If width or height is missing from Profile screen then fill it in based on widescreen format. Otherwise, causes video to break
475
- * Bug: Video information was being fetched from caching even if option selected to switch it off. Fixed!
476
-
477
- = 2.3.1 =
478
- * Maintenance: Removed the sponsorship
479
-
480
- = 2.3 =
481
- * Enhancement: Editor button will add text between shortcodes if no URL or ID is specified
482
- * Enhancement: Square brackets are stripped from alternative shortcodes on option screen - text added to warn against this too
483
- * Enhancement: Added Chromeless player option
484
- * Enhancement: Increased maximum output length of profile and list names to 30 characters
485
- * Bug: Fixed incorrect listing of long profile or list names
486
- * Bug: Fixed INCLUDE bug in widgets.php
487
 
488
- = 2.2 =
489
- * Maintenance: Updated dashboard widget to latest version
490
- * Maintenance: Added advertising banners to options screen - these can be turned off if you donate
491
- * Enhancement: Replace WP_PLUGIN_URL with plugins_url()
492
- * Enhancement: Added H and W as alternative shortcode parameters to HEIGHT and WIDTH
493
- * Enhancement: Editor button should appear for anyone from editor role upwards
494
- * Enhancement: Removed maximum length from profile and list names. However, only first 20 characters will appear in lists
495
 
496
- = 2.1 =
497
- * Enhancement: New option to switch API options (where HTTP or HTTPS, display messages or not or even switch off)
498
- * Enhancement: Output video playback errors as XHTML comments. Output to post a generic message which can be changed in the options
499
- * Enhancement: Video information is shown in lists screen when first entering (no need to press Save button to display)
500
- * Enhancement: Added new `color` parameter, which allows you to specify the colour of the progress bar
501
- * Enhancement: Added new `theme` parameter, allowing you to specify if the player is dark or light skinned
502
- * Enhancement: Added new `https` parameter, allowing you to use HTTPS instead of HTTP for the video display
503
- * Enhancement: Added new `version` parameter to thumbnails, allowing different versions (including a high resolution one) to be displayed
504
- * Enhancement: Added new administration option to allow the thumbnail used in RSS feeds to be specified
505
- * 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
506
- * Bug: Fixed video title no longer being fetched since 2.0.3 (because of using v2 of API)
507
- * Bug: Fixed some error output - due to changes made in an earlier release some errors would not display
508
 
509
- = 2.0.4 =
510
- * Enhancement: Removed HTTPS access to gdata API - will add a switchable option for this in a later release
511
 
512
- = 2.0.3 =
513
- * Enhancement: Decode any passed `template` parameters, as WP may have encoded the content first
514
- * Enhancement: Improved file handling
515
- * Enhancement: Now using HTTPS and version 2 of YouTube gdata API
516
- * Enhancement: New general option to switch off reporting of API errors - will simply accept ID and work out type
517
- * Maintenance: Added details to the README to cover issues with `style` backwards compatibility and YouTube API
518
 
519
- = 2.0.2 =
520
- * Enhancement: Strip tags from video ID, in case any have crept in
521
- * Enhancement: Tidied some of the widget controls
522
- * Enhancement: You can now specify YouTube short URLs as video IDs
523
- * Bug: Removed reference to jscolor.js script, which isn't used
524
- * Bug: Video IDs beginning with numbers are being confused with list numbers
525
- * Bug: Corrected problem with random single videos being picked from a list
526
- * Bug: Fixed problem with list where one video was being ignored and another repeated
527
- * Bug: Modified widget code to allow for all states to be allowable. Defaults updated
528
- * 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
529
 
530
- = 2.0.1 =
531
- * Enhancement: Changed cache key encoding so that it was compatible with PHP 4
532
- * Enhancement: Added autoplay option to EmbedPlus
533
- * 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
534
- * Maintenance: Updated screens and documentation to show the `start` parameter works with EmbedPlus
535
- * Bug: Fixed incorrect caching of options - was only changing if override parameters were modified
536
- * Bug: Video Information Cache will no longer reset to zero if the Embed cache is greater
537
- * Bug: Added random ID to EmbedPlus output to resolve a bug that can affect IE users
 
 
 
 
 
 
538
 
539
  = 2.0 =
540
  * Maintenance: Renamed to Artiss YouTube Embed from YouTube Embed
@@ -554,106 +443,103 @@ Although I attempt to keep with PHP 4 compatibility there are no guarantees of t
554
  * Enhancement: Improved editor button and link added to admin bar
555
  * Enhancement: Many, many more changes - too many to list!
556
 
557
- = 1.5 =
558
- * Enhancement: Added clone of 'youtube' shortcode, called 'youtube_video'
559
- * Enhancement: Editor now has YouTube button, which inserts the YouTube shortcode (this can be switched off in the options screen)
560
- * Enhancement: Added new option to disable keyboard controls
561
- * Enhancement: Added option to supply a ratio, in case height or width are not supplied - the missing parameter will then be calculated
562
- * Enhancement: Option to create a download link (for video and playlist) using function call or shortcode
563
- * 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.
564
-
565
- = 1.4.2 =
566
- * Enhancement: Added keyboard disable option
567
- * 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
568
 
569
- = 1.4.1 =
570
- * Enhancement: HD option is available with EmbedPlus - updated the admin and widget screen to reflect this
 
 
 
 
 
 
 
 
571
 
572
- = 1.4 =
573
- * Maintenance: Tidied up code
574
- * Enhancement: Now supports multiple widgets - widget code completely re-written
575
- * Enhancement: Support for EmbedPlus added
576
- * Enhancement: Added option to suppress links back to YouTube
577
- * Enhancement: Added functions and shortcodes for returning and outputting available transcripts
578
 
579
- = 1.3.1 =
580
- * Enhancement: New widget option to specify title
581
 
582
- = 1.3 =
583
- * Enhancement: Added transparency option so that videos won't cover up layers
 
 
 
 
 
 
 
 
 
 
584
 
585
- = 1.2 =
586
- * Enhancement: Minor changes to the XHTML code to prevent warnings from certain validators
 
 
 
 
 
587
 
588
- = 1.1 =
589
- * Maintenance: Updated test video on options screen, as previous one had been removed
590
- * Maintenance: Confirmed WP 3.0 compatibility
591
- * Enhancement: Resulting XHTML code is better formatted, with comments identifying code location
592
 
593
  = 1.0 =
594
  * Initial release
595
 
596
- == Upgrade Notice ==
597
-
598
- = 2.5 =
599
- * Upgrade to add a number of new features (including automatic generation of playlists based on user name or search term) and fix some bugs
600
-
601
- = 2.4.1 =
602
- * Upgrade to remove the dashboard widget
603
-
604
- = 2.4 =
605
- * Numerous improvements, including new option for responsive video output
606
-
607
- = 2.3.1 =
608
- * Upgrade to remove the sponsorship
609
-
610
- = 2.3 =
611
- * Assorted bug fixes and minor improvements. Also added Chromeless player.
612
-
613
- = 2.2 =
614
- * Assorted minor improvements
615
 
616
- = 2.1 =
617
- * New options to change player colours, chose your thumbnails and control API usage
618
 
619
- = 2.0.4 =
620
- * Fixed SSL bug by removing HTTPS access to API
621
 
622
- = 2.0.3 =
623
- * Removed secure API access as this was causing some users issues
624
 
625
- = 2.0.2 =
626
- * Further update to fix a few minor bugs found in 2.0. A few small enhancements have also been made
627
 
628
- = 2.0.1 =
629
- * Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
630
 
631
- = 2.0 =
632
- * Upgrade to take advantage of many new features. Code completely re-written
633
 
634
  = 1.5 =
635
  * 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
636
 
637
- = 1.4.2 =
638
- * Upgrade is you upgraded to version 1.4 or 1.4.1 from a previous version, to fix an important bug
639
-
640
- = 1.4.1 =
641
- * Upgrade to make a small correction to the parameter lists
642
 
643
- = 1.4 =
644
- * Update to add EmbedPlus, multi-widgets and transcript output capabilities
645
 
646
- = 1.3.1 =
647
- * Update if you wish to change the widget heading
648
 
649
- = 1.3 =
650
- * Update if you find that the videos are covering up layers
651
 
652
- = 1.2 =
653
- * Update to ensure no warnings are reported by XHTML validators
654
 
655
- = 1.1 =
656
- * Update to get the test video on the options screen working again!
657
 
658
- = 1.0 =
659
- * Initial release
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, 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.2
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
 
13
  Artiss YouTube Embed (formally YouTube Embed) is an incredibly simple, yet powerful, method of embedding YouTube videos into your WordPress site. Options include:
14
 
15
  * XHTML and HTML5 compliant - works with all the latest browsers
16
+ * Multiple embedding methods available - OBJECT, IFRAME 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
20
  * Google compatible metadata is added to the video output - great for SEO!
21
  * Code is cached for maximum performance
22
  * Using a different YouTube plugin? Documentation and tools are provided to help you migrate to Artiss YouTube Embed
 
23
  * And much, much more!
24
 
 
 
25
  To add a video to a post or page simply use the shortcode `[youtube]video[/youtube]`, where `video` is the ID or URL of the video. Alternatively, you can add one (or more) widgets to your sidebar.
26
 
27
  Within the administration area of your blog you will find a new menu named `YouTube` (see screenshot 1). Click on the `Options` sub-menu to set a number of general options. Alternatively click on the `Profiles` sub-menu to set the default options which define the output of your videos - any videos you display (unless overridden by parameters - more on that later) will use the settings from the Profiles screen.
46
 
47
  * **audio** - yes or no, this will hide the video and display just the toolbar (ideal for audio only playback) if switched on
48
  * **autoplay** - yes or no, should the video automatically start playing?
 
49
  * **height** - the video height, in pixels
50
  * **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)
51
  * **profile** - specify a different default profile (see section on Profiles for further details)
52
  * **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
 
53
  * **start** - a number of seconds from where to start the video playing
54
  * **style** - apply CSS elements directly to the video output
55
  * **template** - specify a template (see section on Templates for further details)
56
+ * **type** - which embedding type to use, this can be `embedplus`, `iframe` or `object`
 
57
  * **width** - the video width, in pixels
58
 
59
  The following parameters will not work with EmbedPlus:
61
  * **autohide** - 0, 1 or 2, this parameter indicates whether the video controls will automatically hide after a video begins playing. The default behaviour, a value of 2, is for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible. If this parameter is set to 0, the video progress bar and the video player controls will be visible throughout the video. If this parameter is set to 1, then the video progress bar and the player controls will slide out of view a couple of seconds after the video starts playing. They will only reappear if the user moves her mouse over the video player or presses a key on her keyboard.
62
  * **controls** - yes or no, should the controls be shown?
63
  * **https** - yes or no, whether to use HTTPS for the video
 
64
  * **loop** - yes or no, whether to start the video again once it ends
65
  * **theme** - dark or light, display player controls (like a 'play' button or volume control) within a dark or light control bar
66
 
71
  * **color** - white or red, the colour of the progress bar (see the FAQ about having a white progress bar with the light theme)
72
  * **disablekb** - yes or no, disable keyboard controls
73
  * **fullscreen** - yes or no, this will add the fullscreen button to the toolbar. This also works with EmbedPlus.
74
+ * **info** - yes or no, show video information
75
  * **link** - yes or no, link video to YouTube
76
  * **related** - yes or no, show related videos
 
 
 
 
 
 
77
 
78
  The following parameters are only for use with EmbedPlus:
79
 
80
  * **hd** - play the video in HD quality, if available
81
  * **react** - yes or no, this specified whether you wish to show the Real-time Reactions button
82
+ * **stop** - this stops the video at a specific time, given in seconds
83
  * **sweetspot** - yes or no, this will find sweet spots for the next/prev buttons
84
 
85
  == Alternative Shortcodes ==
103
 
104
  Sidebar widgets can be easily added. In Administration simply click on the `Widgets` option under the `Appearance` menu. `YouTube Embed` will be one of the listed widgets. Drag it to the appropriate sidebar on the right hand side and then choose your video options - any that aren't specified are taken from your default profile.
105
 
 
 
106
  And that's it! You can use unlimited widgets, so you can add different videos to different sidebars.
107
 
108
  == Playlists ==
125
 
126
  e.g. `<div align="center">%video%</div>`
127
 
128
+ 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.
129
 
130
  == Profiles ==
131
 
169
 
170
  In all of these cases, the original XML format has been changed to a readable output. If, though, you'd like to return the original XML format, then you can use the call `get_youtube_transcript_xml( ID )`.
171
 
 
 
 
 
 
 
172
  == Migration ==
173
 
174
  Within administration, selecting `Options` from the `YouTube` menu will provide a list of general options. One section is named `Migration`. There are 2 boxes that can be ticked to activate 2 different types of alternative embedding - these have been provided to allow easy migration from other similar plugins. You can also assign a specific profile to these migrated options.
263
 
264
  **Further Embedding Options**
265
 
266
+ Under the `YouTube` administration menu is a sub-menu named `Options`. Select this and find the section named `Embedding`. There are 4 options here...
267
 
268
  1. Add Metadata - by default, RDFa metadata is added to video output. This can be switched on or off as required (see the FAQs for more information about metadata usage).
269
+ 2. URL Embedding - if you place a YouTube URL directly into a post then WordPress will convert this to a video. This, however, is not performed by Artiss YouTube Embed. Select this option to allow this plugin to take over this functionality.
270
+ 3. Comment Embedding - tick this to allow YouTube URLs added to comments to be converted to embedded videos.
271
+ 4. Feed - videos will not appear in feeds so use this option to decide whether you want them to be converted to links and/or thumbnails.
272
 
273
  In the case of URL and Comment embedding a profile can be selected.
274
 
282
 
283
  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).
284
 
285
+ 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.
286
 
287
  **This plugin, and all support, is supplied for free, but [donations](http://artiss.co.uk/donate "Donate") are always welcome.**
288
 
301
  1. Upload the entire `youtube-embed` folder to your wp-content/plugins/ directory.
302
  2. Activate the plugin through the 'Plugins' menu in WordPress.
303
  3. If you're updating from version 2.0.1 or before, please read the FAQ on backwards compatibility.
304
+ 3. That's it, you're done - you just need to add the shortcode wherever you need.
305
 
306
  == Frequently Asked Questions ==
307
 
363
 
364
  It uses standard OBJECT and IFRAME coding - this, along with the above standards compliance, means that the output should work on most browsers.
365
 
366
+ However, I can confirm that it's been tested in IE7 (IE8 in compatibility mode), IE8, IE9, Firefox 5 and Chrome 12.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
 
368
  = Which version of PHP does this plugin work with? =
369
 
371
 
372
  Although I attempt to keep with PHP 4 compatibility there are no guarantees of this.
373
 
374
+ = A new box has appeared on my dashboard all about Artiss plugins =
375
+
376
+ That's correct - all Artiss plugins will now add this feature to keep you up-to-date with the latest news and support links. If you wish to switch it off simply click on the "Screen Options" tab at the top and untick "Artiss News & Support".
377
+
378
  == Screenshots ==
379
 
380
+ 1. Artiss YouTube Embed in the administration menu.
381
+ 2. The main options screen.
382
+ 3. The profiles screen.
383
+ 4. The lists screen - videos have been added and validated. The drop-down help is also shown.
384
  5. The About screen
385
  6. The default widget options
 
386
 
387
  == Changelog ==
388
 
389
+ = 1.0 =
390
+ * Initial release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
 
392
+ = 1.1 =
393
+ * Maintenance: Updated test video on options screen, as previous one had been removed
394
+ * Maintenance: Confirmed WP 3.0 compatibility
395
+ * Enhancement: Resulting XHTML code is better formatted, with comments identifying code location
 
 
 
396
 
397
+ = 1.2 =
398
+ * Enhancement: Minor changes to the XHTML code to prevent warnings from certain validators
 
 
 
 
 
 
 
 
 
 
399
 
400
+ = 1.3 =
401
+ * Enhancement: Added transparency option so that videos won't cover up layers
402
 
403
+ = 1.3.1 =
404
+ * Enhancement: New widget option to specify title
 
 
 
 
405
 
406
+ = 1.4 =
407
+ * Maintenance: Tidied up code
408
+ * Enhancement: Now supports multiple widgets - widget code completely re-written
409
+ * Enhancement: Support for EmbedPlus added
410
+ * Enhancement: Added option to suppress links back to YouTube
411
+ * Enhancement: Added functions and shortcodes for returning and outputting available transcripts
 
 
 
 
412
 
413
+ = 1.4.1 =
414
+ * Enhancement: HD option is available with EmbedPlus - updated the admin and widget screen to reflect this
415
+
416
+ = 1.4.2 =
417
+ * Enhancement: Added keyboard disable option
418
+ * 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
419
+
420
+ = 1.5 =
421
+ * Enhancement: Added clone of 'youtube' shortcode, called 'youtube_video'
422
+ * Enhancement: Editor now has YouTube button, which inserts the YouTube shortcode (this can be switched off in the options screen)
423
+ * Enhancement: Added new option to disable keyboard controls
424
+ * Enhancement: Added option to supply a ratio, in case height or width are not supplied - the missing parameter will then be calculated
425
+ * Enhancement: Option to create a download link (for video and playlist) using function call or shortcode
426
+ * 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.
427
 
428
  = 2.0 =
429
  * Maintenance: Renamed to Artiss YouTube Embed from YouTube Embed
443
  * Enhancement: Improved editor button and link added to admin bar
444
  * Enhancement: Many, many more changes - too many to list!
445
 
446
+ = 2.0.1 =
447
+ * Enhancement: Changed cache key encoding so that it was compatible with PHP 4
448
+ * Enhancement: Added autoplay option to EmbedPlus
449
+ * 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
450
+ * Maintenance: Updated screens and documentation to show the `start` parameter works with EmbedPlus
451
+ * Bug: Fixed incorrect caching of options - was only changing if override parameters were modified
452
+ * Bug: Video Information Cache will no longer reset to zero if the Embed cache is greater
453
+ * Bug: Added random ID to EmbedPlus output to resolve a bug that can affect IE users
 
 
 
454
 
455
+ = 2.0.2 =
456
+ * Enhancement: Strip tags from video ID, in case any have crept in
457
+ * Enhancement: Tidied some of the widget controls
458
+ * Enhancement: You can now specify YouTube short URLs as video IDs
459
+ * Bug: Removed reference to jscolor.js script, which isn't used
460
+ * Bug: Video IDs beginning with numbers are being confused with list numbers
461
+ * Bug: Corrected problem with random single videos being picked from a list
462
+ * Bug: Fixed problem with list where one video was being ignored and another repeated
463
+ * Bug: Modified widget code to allow for all states to be allowable. Defaults updated
464
+ * 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
465
 
466
+ = 2.0.3 =
467
+ * Enhancement: Decode any passed `template` parameters, as WP may have encoded the content first
468
+ * Enhancement: Improved file handling
469
+ * Enhancement: Now using HTTPS and version 2 of YouTube gdata API
470
+ * Enhancement: New general option to switch off reporting of API errors - will simply accept ID and work out type
471
+ * Maintenance: Added details to the README to cover issues with `style` backwards compatibility and YouTube API
472
 
473
+ = 2.0.4 =
474
+ * Enhancement: Removed HTTPS access to gdata API - will add a switchable option for this in a later release
475
 
476
+ = 2.1 =
477
+ * Enhancement: New option to switch API options (where HTTP or HTTPS, display messages or not or even switch off)
478
+ * Enhancement: Output video playback errors as XHTML comments. Output to post a generic message which can be changed in the options
479
+ * Enhancement: Video information is shown in lists screen when first entering (no need to press Save button to display)
480
+ * Enhancement: Added new `color` parameter, which allows you to specify the colour of the progress bar
481
+ * Enhancement: Added new `theme` parameter, allowing you to specify if the player is dark or light skinned
482
+ * Enhancement: Added new `https` parameter, allowing you to use HTTPS instead of HTTP for the video display
483
+ * Enhancement: Added new `version` parameter to thumbnails, allowing different versions (including a high resolution one) to be displayed
484
+ * Enhancement: Added new administration option to allow the thumbnail used in RSS feeds to be specified
485
+ * 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
486
+ * Bug: Fixed video title no longer being fetched since 2.0.3 (because of using v2 of API)
487
+ * Bug: Fixed some error output - due to changes made in an earlier release some errors would not display
488
 
489
+ = 2.2 =
490
+ * Maintenance: Updated dashboard widget to latest version
491
+ * Maintenance: Added advertising banners to options screen - these can be turned off if you donate
492
+ * Enhancement: Replace WP_PLUGIN_URL with plugins_url()
493
+ * Enhancement: Added H and W as alternative shortcode parameters to HEIGHT and WIDTH
494
+ * Enhancement: Editor button should appear for anyone from editor role upwards
495
+ * Enhancement: Removed maximum length from profile and list names. However, only first 20 characters will appear in lists
496
 
497
+ == Upgrade Notice ==
 
 
 
498
 
499
  = 1.0 =
500
  * Initial release
501
 
502
+ = 1.1 =
503
+ * Update to get the test video on the options screen working again!
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
504
 
505
+ = 1.2 =
506
+ * Update to ensure no warnings are reported by XHTML validators
507
 
508
+ = 1.3 =
509
+ * Update if you find that the videos are covering up layers
510
 
511
+ = 1.3.1 =
512
+ * Update if you wish to change the widget heading
513
 
514
+ = 1.4 =
515
+ * Update to add EmbedPlus, multi-widgets and transcript output capabilities
516
 
517
+ = 1.4.1 =
518
+ * Upgrade to make a small correction to the parameter lists
519
 
520
+ = 1.4.2 =
521
+ * Upgrade is you upgraded to version 1.4 or 1.4.1 from a previous version, to fix an important bug
522
 
523
  = 1.5 =
524
  * 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
525
 
526
+ = 2.0 =
527
+ * Upgrade to take advantage of many new features. Code completely re-written
 
 
 
528
 
529
+ = 2.0.1 =
530
+ * Update to fix a few minor bugs found in 2.0 and add a couple of small enhancements
531
 
532
+ = 2.0.2 =
533
+ * Further update to fix a few minor bugs found in 2.0. A few small enhancements have also been made
534
 
535
+ = 2.0.3 =
536
+ * Removed secure API access as this was causing some users issues
537
 
538
+ = 2.0.4 =
539
+ * Fixed SSL bug by removing HTTPS access to API
540
 
541
+ = 2.1 =
542
+ * New options to change player colours, chose your thumbnails and control API usage
543
 
544
+ = 2.2 =
545
+ * Assorted minor improvements
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 DELETED
Binary file
uninstall.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Uninstall the plugin by removing any options from the database
6
  *
7
- * @package Artiss-YouTube-Embed
8
  * @since 2.0
9
  */
10
 
@@ -43,5 +43,4 @@ if ( is_array( $options ) ) {
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
  ?>
4
  *
5
  * Uninstall the plugin by removing any options from the database
6
  *
7
+ * @package YouTubeEmbed
8
  * @since 2.0
9
  */
10
 
43
  delete_option( 'widget_youtube_embed_widget' );
44
  delete_option( 'youtube_embed_shortcode' );
45
  delete_option( 'youtube_embed_url' );
 
46
  ?>
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.5
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
@@ -13,52 +13,70 @@ Author URI: http://www.artiss.co.uk
13
  *
14
  * Main code - include various functions
15
  *
16
- * @package Artiss-YouTube-Embed
17
  * @since 2.0
18
  */
19
 
20
- define( 'youtube_embed_version', '2.5' );
21
 
22
  $functions_dir = WP_PLUGIN_DIR . '/youtube-embed/includes/';
23
 
24
  // Include all the various functions
25
 
26
- include_once( $functions_dir . 'aye-add-scripts.php' ); // Add various scripts
27
 
28
- include_once( $functions_dir . 'aye-shared-functions.php' ); // Shared routines
29
 
30
- include_once( $functions_dir . 'aye-set-defaults.php' ); // Set default options
31
 
32
- include_once( $functions_dir . 'aye-add-to-admin-bar.php' ); // Add link to the admin bar
33
-
34
- include_once( $functions_dir . 'aye-generate-embed-code.php' ); // Generate YouTube embed code
35
 
36
  if ( is_admin() ) {
37
 
38
- include_once( $functions_dir . 'aye-admin-config.php' ); // Administration configuration
39
-
40
- include_once( $functions_dir . 'aye-add-mce-button.php' ); // Editor button
41
-
42
- } else {
43
-
44
- include_once( $functions_dir . 'aye-update-post-content.php' ); // Process post content
45
 
46
- include_once( $functions_dir . 'aye-function-calls.php' ); // Function calls
 
 
47
 
48
- include_once( $functions_dir . 'aye-generate-download-code.php' ); // Generate download URLs
49
 
50
- include_once( $functions_dir . 'aye-generate-shorturl-code.php' ); // Generate short URLs
51
 
52
- include_once( $functions_dir . 'aye-generate-thumbnail-code.php' ); // Generate thumbnail code
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
- include_once( $functions_dir . 'aye-generate-transcript-code.php' ); // Generate transcripts
55
 
56
- include_once( $functions_dir . 'aye-shortcodes.php' ); // Shortcodes
57
 
58
- include_once( $functions_dir . 'aye-deprecated.php' ); // Deprecated options
 
 
 
 
 
 
 
 
59
 
 
 
 
60
  }
61
-
62
- include_once($functions_dir . 'aye-generate-widgets.php'); // Generate widgets
63
-
64
  ?>
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.2
7
  Author: David Artiss
8
  Author URI: http://www.artiss.co.uk
9
  */
13
  *
14
  * Main code - include various functions
15
  *
16
+ * @package YouTubeEmbed
17
  * @since 2.0
18
  */
19
 
20
+ define( 'youtube_embed_version', '2.2' );
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
29
 
30
+ include_once( $functions_dir . 'admin-bar.php' ); // Admin bar
31
 
32
+ include_once( $functions_dir . 'generate-embed-code.php' ); // Generate YouTube embed code
 
 
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
+
40
+ if ( !has_action( 'wp_dashboard_setup', 'artiss_dashboard_widget' ) ) {
41
 
42
+ include_once( $functions_dir . 'artiss-dashboard-widget.php' ); // Artiss dashboard widget
43
 
44
+ }
45
 
46
+ } else {
47
+
48
+ include_once( $functions_dir . 'content.php' ); // Process post content
49
+
50
+ include_once( $functions_dir . 'function-calls.php' ); // Function calls
51
+
52
+ include_once( $functions_dir . 'generate-download-code.php' ); // Generate download URLs
53
+
54
+ include_once( $functions_dir . 'generate-shorturl-code.php' ); // Generate short URLs
55
+
56
+ include_once( $functions_dir . 'generate-thumbnail-code.php' ); // Generate thumbnail code
57
+
58
+ include_once( $functions_dir . 'generate-transcript-code.php' ); // Generate transcripts
59
+
60
+ include_once( $functions_dir . 'shortcodes.php' ); // Shortcodes
61
+
62
+ include_once( $functions_dir . 'deprecated.php' ); // Deprecated options
63
 
64
+ }
65
 
66
+ include_once($functions_dir . 'widgets.php');
67
 
68
+ /**
69
+ * Output some useful debug information
70
+ *
71
+ * Quick debug task to output version number and plugin directory, in case of queries
72
+ *
73
+ * @since 2.0
74
+ *
75
+ * @return string Plugin version and plugin directory, seperated by double colons
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
  ?>