Version Description
- Enhancement: Added new "Third Party Plugins" screen, which lists third party plugins that work alongside YouTube Embed, adding extra functionality. You can view, install and see the status of these plugins from this screen
- Maintenance: Moved the settings back to the YouTube Embed menu
- Maintenance: Renamed menus to be more specific
- Maintenance: Updated the function names, which were still using the out-dated "vye" prefix
Download this release
Release Info
Developer | codedart |
Plugin | YouTube Embed |
Version | 4.3 |
Comparing to | |
See all releases |
Code changes from version 4.2.1 to 4.3
- images/cross.png +0 -0
- images/flash.png +0 -0
- images/html5.png +0 -0
- images/tick.png +0 -0
- includes/add-scripts.php +18 -18
- includes/admin-config.php +92 -43
- includes/generate-embed-code.php +30 -30
- includes/generate-other-code.php +21 -21
- includes/generate-widgets.php +4 -4
- includes/options-general.php +7 -7
- includes/options-lists.php +8 -8
- includes/options-plugins.php +132 -0
- includes/options-profiles.php +5 -5
- includes/shared-functions.php +23 -23
- includes/shortcodes.php +39 -39
- js/mce4-button.js +0 -0
- js/mce4-button.min.js +0 -0
- languages/youtube-embed.mo +0 -0
- languages/youtube-embed.po +127 -29
- readme.txt +32 -12
- uninstall.php +6 -0
- youtube-embed.php +2 -2
images/cross.png
CHANGED
File without changes
|
images/flash.png
CHANGED
File without changes
|
images/html5.png
CHANGED
File without changes
|
images/tick.png
CHANGED
File without changes
|
includes/add-scripts.php
CHANGED
@@ -15,7 +15,7 @@
|
|
15 |
* @since 2.5.5
|
16 |
*/
|
17 |
|
18 |
-
function
|
19 |
|
20 |
// Loads the plugin's translated strings
|
21 |
|
@@ -38,10 +38,10 @@ function vye_plugin_init() {
|
|
38 |
|
39 |
// Set up default option values (if not already set)
|
40 |
|
41 |
-
$options =
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
|
46 |
// Update saved version number
|
47 |
|
@@ -49,7 +49,7 @@ function vye_plugin_init() {
|
|
49 |
}
|
50 |
}
|
51 |
|
52 |
-
add_action( 'init', '
|
53 |
|
54 |
/**
|
55 |
* Add scripts to theme
|
@@ -59,15 +59,15 @@ add_action( 'init', 'vye_plugin_init' );
|
|
59 |
* @since 2.4
|
60 |
*/
|
61 |
|
62 |
-
function
|
63 |
|
64 |
-
wp_register_style( '
|
65 |
|
66 |
-
wp_enqueue_style( '
|
67 |
|
68 |
}
|
69 |
|
70 |
-
add_action( 'wp_enqueue_scripts', '
|
71 |
|
72 |
/**
|
73 |
* Add CSS to admin
|
@@ -77,13 +77,13 @@ add_action( 'wp_enqueue_scripts', 'vye_main_scripts' );
|
|
77 |
* @since 2.0
|
78 |
*/
|
79 |
|
80 |
-
function
|
81 |
|
82 |
wp_enqueue_style( 'tinymce_button', plugins_url( 'css/admin.min.css', dirname(__FILE__) ));
|
83 |
|
84 |
}
|
85 |
|
86 |
-
add_action( 'admin_print_styles', '
|
87 |
|
88 |
/**
|
89 |
* Add option to Admin Bar
|
@@ -91,16 +91,16 @@ add_action( 'admin_print_styles', 'vye_admin_css' );
|
|
91 |
* Add link to YouTube Embed profile options to Admin Bar.
|
92 |
* With help from http://technerdia.com/1140_wordpress-admin-bar.html
|
93 |
*
|
94 |
-
* @uses
|
95 |
*
|
96 |
* @since 2.5
|
97 |
*/
|
98 |
|
99 |
-
function
|
100 |
|
101 |
if ( !is_admin() ) {
|
102 |
|
103 |
-
$options =
|
104 |
|
105 |
if ( $options[ 'admin_bar' ] != '' ) {
|
106 |
|
@@ -138,7 +138,7 @@ function vye_admin_bar_render( $meta = TRUE ) {
|
|
138 |
}
|
139 |
}
|
140 |
|
141 |
-
add_action( 'admin_bar_menu', '
|
142 |
|
143 |
/**
|
144 |
* Add to site header
|
@@ -154,7 +154,7 @@ function youtube_embed_add_to_head() {
|
|
154 |
|
155 |
youtube_embed_shortcode_checks( 'site' );
|
156 |
|
157 |
-
$options =
|
158 |
|
159 |
if ( $options[ 'script' ] == 'f' ) {
|
160 |
|
@@ -219,7 +219,7 @@ function youtube_embed_shortcode_checks( $source ) {
|
|
219 |
|
220 |
// All is fine
|
221 |
|
222 |
-
if ( substr( $shortcode_usage, 0,
|
223 |
|
224 |
$shortcode = 0;
|
225 |
|
15 |
* @since 2.5.5
|
16 |
*/
|
17 |
|
18 |
+
function ye_plugin_init() {
|
19 |
|
20 |
// Loads the plugin's translated strings
|
21 |
|
38 |
|
39 |
// Set up default option values (if not already set)
|
40 |
|
41 |
+
$options = ye_set_general_defaults();
|
42 |
+
ye_set_shortcode();
|
43 |
+
ye_set_list( $options[ 'list_no' ] );
|
44 |
+
ye_set_profile( $options[ 'profile_no' ] );
|
45 |
|
46 |
// Update saved version number
|
47 |
|
49 |
}
|
50 |
}
|
51 |
|
52 |
+
add_action( 'init', 'ye_plugin_init' );
|
53 |
|
54 |
/**
|
55 |
* Add scripts to theme
|
59 |
* @since 2.4
|
60 |
*/
|
61 |
|
62 |
+
function ye_main_scripts() {
|
63 |
|
64 |
+
wp_register_style( 'ye_dynamic', plugins_url( 'css/main.min.css', dirname(__FILE__) ) );
|
65 |
|
66 |
+
wp_enqueue_style( 'ye_dynamic' );
|
67 |
|
68 |
}
|
69 |
|
70 |
+
add_action( 'wp_enqueue_scripts', 'ye_main_scripts' );
|
71 |
|
72 |
/**
|
73 |
* Add CSS to admin
|
77 |
* @since 2.0
|
78 |
*/
|
79 |
|
80 |
+
function ye_admin_css() {
|
81 |
|
82 |
wp_enqueue_style( 'tinymce_button', plugins_url( 'css/admin.min.css', dirname(__FILE__) ));
|
83 |
|
84 |
}
|
85 |
|
86 |
+
add_action( 'admin_print_styles', 'ye_admin_css' );
|
87 |
|
88 |
/**
|
89 |
* Add option to Admin Bar
|
91 |
* Add link to YouTube Embed profile options to Admin Bar.
|
92 |
* With help from http://technerdia.com/1140_wordpress-admin-bar.html
|
93 |
*
|
94 |
+
* @uses ye_set_general_default Set default options
|
95 |
*
|
96 |
* @since 2.5
|
97 |
*/
|
98 |
|
99 |
+
function ye_admin_bar_render( $meta = TRUE ) {
|
100 |
|
101 |
if ( !is_admin() ) {
|
102 |
|
103 |
+
$options = ye_get_general_defaults();
|
104 |
|
105 |
if ( $options[ 'admin_bar' ] != '' ) {
|
106 |
|
138 |
}
|
139 |
}
|
140 |
|
141 |
+
add_action( 'admin_bar_menu', 'ye_admin_bar_render', 99 );
|
142 |
|
143 |
/**
|
144 |
* Add to site header
|
154 |
|
155 |
youtube_embed_shortcode_checks( 'site' );
|
156 |
|
157 |
+
$options = ye_get_general_defaults();
|
158 |
|
159 |
if ( $options[ 'script' ] == 'f' ) {
|
160 |
|
219 |
|
220 |
// All is fine
|
221 |
|
222 |
+
if ( substr( $shortcode_usage, 0, 19 ) == 'ye_video_shortcode_' ) {
|
223 |
|
224 |
$shortcode = 0;
|
225 |
|
includes/admin-config.php
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
* @return string Links, now with settings added
|
20 |
*/
|
21 |
|
22 |
-
function
|
23 |
|
24 |
static $this_plugin;
|
25 |
|
@@ -33,7 +33,7 @@ function vye_add_settings_link( $links, $file ) {
|
|
33 |
return $links;
|
34 |
}
|
35 |
|
36 |
-
add_filter( 'plugin_action_links', '
|
37 |
|
38 |
/**
|
39 |
* Add meta to plugin details
|
@@ -47,7 +47,7 @@ add_filter( 'plugin_action_links', 'vye_add_settings_link', 10, 2 );
|
|
47 |
* @return string Links, now with settings added
|
48 |
*/
|
49 |
|
50 |
-
function
|
51 |
|
52 |
if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
|
53 |
|
@@ -58,7 +58,7 @@ function vye_set_plugin_meta( $links, $file ) {
|
|
58 |
return $links;
|
59 |
}
|
60 |
|
61 |
-
add_filter( 'plugin_row_meta', '
|
62 |
|
63 |
/**
|
64 |
* Admin Screen Initialisation
|
@@ -67,14 +67,14 @@ add_filter( 'plugin_row_meta', 'vye_set_plugin_meta', 10, 2 );
|
|
67 |
*
|
68 |
* @since 2.0
|
69 |
*
|
70 |
-
* @uses
|
71 |
*/
|
72 |
|
73 |
-
function
|
74 |
|
75 |
// Get level access for menus
|
76 |
|
77 |
-
$options =
|
78 |
|
79 |
$menu_access = $options[ 'menu_access' ];
|
80 |
|
@@ -82,29 +82,37 @@ function vye_menu_initialise() {
|
|
82 |
|
83 |
$menu_icon = 'dashicons-video-alt3';
|
84 |
|
85 |
-
add_menu_page( __( 'About YouTube Embed', 'youtube-embed' ), __( 'YouTube', 'youtube-embed' ), $menu_access, 'ye-profile-options', '
|
86 |
|
87 |
// Add profiles sub-menu
|
88 |
|
89 |
-
global $
|
90 |
|
91 |
-
$
|
92 |
|
93 |
-
add_action( 'load-' . $
|
94 |
|
95 |
// Add lists sub-menu
|
96 |
|
97 |
-
global $
|
98 |
|
99 |
-
$
|
100 |
|
101 |
-
add_action( 'load-' . $
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
// If installed, add link to Video Overlay Ads plugin
|
104 |
|
105 |
if ( function_exists( 'video_overlay_create_menu' ) ) {
|
106 |
|
107 |
-
add_submenu_page( 'ye-profile-options', __( 'Video Overlay Ads
|
108 |
}
|
109 |
|
110 |
// If installed, add link to Video SEO
|
@@ -115,17 +123,16 @@ function vye_menu_initialise() {
|
|
115 |
|
116 |
}
|
117 |
|
118 |
-
// Add
|
119 |
|
120 |
-
global $
|
121 |
|
122 |
-
$
|
123 |
-
|
124 |
-
add_action( 'load-' . $vye_options_hook, 'vye_add_options_help' );
|
125 |
|
|
|
126 |
}
|
127 |
|
128 |
-
add_action( 'admin_menu', '
|
129 |
|
130 |
/**
|
131 |
* Include general options screen
|
@@ -135,7 +142,7 @@ add_action( 'admin_menu', 'vye_menu_initialise' );
|
|
135 |
* @since 2.0
|
136 |
*/
|
137 |
|
138 |
-
function
|
139 |
|
140 |
include_once( plugin_dir_path( __FILE__ ) . 'options-general.php' );
|
141 |
|
@@ -149,7 +156,7 @@ function vye_general_options() {
|
|
149 |
* @since 2.0
|
150 |
*/
|
151 |
|
152 |
-
function
|
153 |
|
154 |
include_once( plugin_dir_path( __FILE__ ) . 'options-profiles.php' );
|
155 |
|
@@ -163,12 +170,26 @@ function vye_profile_options() {
|
|
163 |
* @since 2.0
|
164 |
*/
|
165 |
|
166 |
-
function
|
167 |
|
168 |
include_once( plugin_dir_path( __FILE__ ) . 'options-lists.php' );
|
169 |
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
/**
|
173 |
* Add Options Help
|
174 |
*
|
@@ -176,15 +197,15 @@ function vye_list_options() {
|
|
176 |
*
|
177 |
* @since 2.5
|
178 |
*
|
179 |
-
* @uses
|
180 |
*/
|
181 |
|
182 |
-
function
|
183 |
|
184 |
-
global $
|
185 |
$screen = get_current_screen();
|
186 |
|
187 |
-
if ( $screen->id != $
|
188 |
|
189 |
$screen -> add_help_tab( array( 'id' => 'options-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'options' ) ) );
|
190 |
|
@@ -198,15 +219,15 @@ function vye_add_options_help() {
|
|
198 |
*
|
199 |
* @since 2.5
|
200 |
*
|
201 |
-
* @uses
|
202 |
*/
|
203 |
|
204 |
-
function
|
205 |
|
206 |
-
global $
|
207 |
$screen = get_current_screen();
|
208 |
|
209 |
-
if ( $screen->id != $
|
210 |
|
211 |
$screen -> add_help_tab( array( 'id' => 'profiles-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'profiles' ) ) );
|
212 |
|
@@ -220,21 +241,42 @@ function vye_add_profiles_help() {
|
|
220 |
*
|
221 |
* @since 2.5
|
222 |
*
|
223 |
-
* @uses
|
224 |
*/
|
225 |
|
226 |
-
function
|
227 |
|
228 |
-
global $
|
229 |
$screen = get_current_screen();
|
230 |
|
231 |
-
if ( $screen->id != $
|
232 |
|
233 |
$screen -> add_help_tab( array( 'id' => 'lists-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'lists' ) ) );
|
234 |
|
235 |
$screen -> add_help_tab( array( 'id' => 'lists-links-tab', 'title' => __( 'Links', 'youtube-embed' ), 'content' => youtube_embed_help( 'lists', 'links' ) ) );
|
236 |
}
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
/**
|
239 |
* Help Screens
|
240 |
*
|
@@ -251,12 +293,12 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
|
|
251 |
|
252 |
$text = '';
|
253 |
|
254 |
-
if (
|
255 |
|
256 |
$text .= '<p>' . __( 'This screen allows you to select non-specific options for the YouTube Embed plugin. For the default embedding settings, please select the <a href="admin.php?page=ye-profile-options">Profiles</a> administration option.', 'youtube-embed' ) . '</p>';
|
257 |
}
|
258 |
|
259 |
-
if (
|
260 |
|
261 |
$text .= '<p>' . __( 'This screen allows you to set the options for the default and additional profiles. If you don\'t specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required.', 'youtube-embed' ) . '</p>';
|
262 |
$text .= '<p>' . __( 'All settings will work whether the Flash or HTML5 player is used, unless one of the following icons is shown, indicating which format the option works with...', 'youtube-embed' ) . '</p>';
|
@@ -264,12 +306,19 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
|
|
264 |
$text .= "<img src='" . plugins_url( 'images/html5.png', dirname(__FILE__) ) . "' width='10px'/> - " . __( 'HTML5 player', 'youtube-embed' ) . '</br>';
|
265 |
}
|
266 |
|
267 |
-
if (
|
268 |
|
269 |
$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.', 'youtube-embed' ) . '</p>';
|
270 |
}
|
271 |
|
272 |
-
if ( $tab == 'help' ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
273 |
$text .= '<p>' . __( 'Remember to click the Save Changes button at the bottom of the screen for any changes to take effect.', 'youtube-embed' ) . '</p>';
|
274 |
}
|
275 |
|
@@ -297,7 +346,7 @@ function youtube_embed_help( $screen, $tab = 'help' ) {
|
|
297 |
*
|
298 |
* Add filters (assuming user is editing) for TinyMCE
|
299 |
*
|
300 |
-
* @uses
|
301 |
*
|
302 |
* @since 2.0
|
303 |
*/
|
@@ -308,7 +357,7 @@ function youtube_embed_button() {
|
|
308 |
|
309 |
if ( get_user_option( 'rich_editing' ) == 'true' ) {
|
310 |
|
311 |
-
$options =
|
312 |
if ( $options[ 'editor_button' ] != '' ) {
|
313 |
|
314 |
// Add filters
|
@@ -374,7 +423,7 @@ function youtube_embed_admin_messages() {
|
|
374 |
|
375 |
if ( ( $shortcode_admin != 0 ) or ( $shortcode_site != 0 ) ) {
|
376 |
|
377 |
-
$options =
|
378 |
|
379 |
if ( $options[ 'prompt' ] == 1 ) {
|
380 |
|
19 |
* @return string Links, now with settings added
|
20 |
*/
|
21 |
|
22 |
+
function ye_add_settings_link( $links, $file ) {
|
23 |
|
24 |
static $this_plugin;
|
25 |
|
33 |
return $links;
|
34 |
}
|
35 |
|
36 |
+
add_filter( 'plugin_action_links', 'ye_add_settings_link', 10, 2 );
|
37 |
|
38 |
/**
|
39 |
* Add meta to plugin details
|
47 |
* @return string Links, now with settings added
|
48 |
*/
|
49 |
|
50 |
+
function ye_set_plugin_meta( $links, $file ) {
|
51 |
|
52 |
if ( strpos( $file, 'youtube-embed.php' ) !== false ) {
|
53 |
|
58 |
return $links;
|
59 |
}
|
60 |
|
61 |
+
add_filter( 'plugin_row_meta', 'ye_set_plugin_meta', 10, 2 );
|
62 |
|
63 |
/**
|
64 |
* Admin Screen Initialisation
|
67 |
*
|
68 |
* @since 2.0
|
69 |
*
|
70 |
+
* @uses ye_contextual_help_type Work out help type
|
71 |
*/
|
72 |
|
73 |
+
function ye_menu_initialise() {
|
74 |
|
75 |
// Get level access for menus
|
76 |
|
77 |
+
$options = ye_get_general_defaults();
|
78 |
|
79 |
$menu_access = $options[ 'menu_access' ];
|
80 |
|
82 |
|
83 |
$menu_icon = 'dashicons-video-alt3';
|
84 |
|
85 |
+
add_menu_page( __( 'About YouTube Embed', 'youtube-embed' ), __( 'YouTube Embed', 'youtube-embed' ), $menu_access, 'ye-profile-options', 'ye_profile_options', $menu_icon, 12 );
|
86 |
|
87 |
// Add profiles sub-menu
|
88 |
|
89 |
+
global $ye_profiles_hook;
|
90 |
|
91 |
+
$ye_profiles_hook = add_submenu_page( 'ye-profile-options', __( 'YouTube Embed Profiles', 'youtube-embed' ), __( 'Profiles', 'youtube-embed' ), $menu_access, 'ye-profile-options', 'ye_profile_options' );
|
92 |
|
93 |
+
add_action( 'load-' . $ye_profiles_hook, 'ye_add_profiles_help' );
|
94 |
|
95 |
// Add lists sub-menu
|
96 |
|
97 |
+
global $ye_lists_hook;
|
98 |
|
99 |
+
$ye_lists_hook = add_submenu_page( 'ye-profile-options', __( 'YouTube Embed Lists', 'youtube-embed' ), __( 'Lists', 'youtube-embed' ), $menu_access, 'ye-list-options', 'ye_list_options' );
|
100 |
|
101 |
+
add_action( 'load-' . $ye_lists_hook, 'ye_add_lists_help' );
|
102 |
+
|
103 |
+
// Add third party plugins sub-menu
|
104 |
+
|
105 |
+
global $ye_plugins_hook;
|
106 |
+
|
107 |
+
$ye_plugins_hook = add_submenu_page( 'ye-profile-options', __( '3rd Party Plugins', 'youtube-embed' ), __( '3rd Party Plugins', 'youtube-embed' ), $menu_access, 'ye-plugins-options', 'ye_plugins_options' );
|
108 |
+
|
109 |
+
add_action( 'load-' . $ye_plugins_hook, 'ye_add_plugins_help' );
|
110 |
|
111 |
// If installed, add link to Video Overlay Ads plugin
|
112 |
|
113 |
if ( function_exists( 'video_overlay_create_menu' ) ) {
|
114 |
|
115 |
+
add_submenu_page( 'ye-profile-options', __( 'Video Overlay Ads', 'youtube-embed' ), __( 'Video Overlay Ads', 'youtube-embed' ), 'administrator', 'ye-video-overlay', 'video_overlay_settings_page' );
|
116 |
}
|
117 |
|
118 |
// If installed, add link to Video SEO
|
123 |
|
124 |
}
|
125 |
|
126 |
+
// Add settings sub-menu
|
127 |
|
128 |
+
global $ye_options_hook;
|
129 |
|
130 |
+
$ye_options_hook = add_submenu_page( 'ye-profile-options', __( 'General Settings', 'youtube-embed' ), __( 'General Settings', 'youtube-embed' ), $menu_access, 'ye-general-options', 'ye_general_options' );
|
|
|
|
|
131 |
|
132 |
+
add_action( 'load-' . $ye_options_hook, 'ye_add_options_help' );
|
133 |
}
|
134 |
|
135 |
+
add_action( 'admin_menu', 'ye_menu_initialise' );
|
136 |
|
137 |
/**
|
138 |
* Include general options screen
|
142 |
* @since 2.0
|
143 |
*/
|
144 |
|
145 |
+
function ye_general_options() {
|
146 |
|
147 |
include_once( plugin_dir_path( __FILE__ ) . 'options-general.php' );
|
148 |
|
156 |
* @since 2.0
|
157 |
*/
|
158 |
|
159 |
+
function ye_profile_options() {
|
160 |
|
161 |
include_once( plugin_dir_path( __FILE__ ) . 'options-profiles.php' );
|
162 |
|
170 |
* @since 2.0
|
171 |
*/
|
172 |
|
173 |
+
function ye_list_options() {
|
174 |
|
175 |
include_once( plugin_dir_path( __FILE__ ) . 'options-lists.php' );
|
176 |
|
177 |
}
|
178 |
|
179 |
+
/**
|
180 |
+
* Include plugins options screen
|
181 |
+
*
|
182 |
+
* XHTML options screen to view and install third party plugins
|
183 |
+
*
|
184 |
+
* @since 4.3
|
185 |
+
*/
|
186 |
+
|
187 |
+
function ye_plugins_options() {
|
188 |
+
|
189 |
+
include_once( plugin_dir_path( __FILE__ ) . 'options-plugins.php' );
|
190 |
+
|
191 |
+
}
|
192 |
+
|
193 |
/**
|
194 |
* Add Options Help
|
195 |
*
|
197 |
*
|
198 |
* @since 2.5
|
199 |
*
|
200 |
+
* @uses ye_options_help Return help text
|
201 |
*/
|
202 |
|
203 |
+
function ye_add_options_help() {
|
204 |
|
205 |
+
global $ye_options_hook;
|
206 |
$screen = get_current_screen();
|
207 |
|
208 |
+
if ( $screen->id != $ye_options_hook ) { return; }
|
209 |
|
210 |
$screen -> add_help_tab( array( 'id' => 'options-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'options' ) ) );
|
211 |
|
219 |
*
|
220 |
* @since 2.5
|
221 |
*
|
222 |
+
* @uses ye_profiles_help Return help text
|
223 |
*/
|
224 |
|
225 |
+
function ye_add_profiles_help() {
|
226 |
|
227 |
+
global $ye_profiles_hook;
|
228 |
$screen = get_current_screen();
|
229 |
|
230 |
+
if ( $screen->id != $ye_profiles_hook ) { return; }
|
231 |
|
232 |
$screen -> add_help_tab( array( 'id' => 'profiles-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'profiles' ) ) );
|
233 |
|
241 |
*
|
242 |
* @since 2.5
|
243 |
*
|
244 |
+
* @uses ye_lists_help Return help text
|
245 |
*/
|
246 |
|
247 |
+
function ye_add_lists_help() {
|
248 |
|
249 |
+
global $ye_lists_hook;
|
250 |
$screen = get_current_screen();
|
251 |
|
252 |
+
if ( $screen->id != $ye_lists_hook ) { return; }
|
253 |
|
254 |
$screen -> add_help_tab( array( 'id' => 'lists-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'lists' ) ) );
|
255 |
|
256 |
$screen -> add_help_tab( array( 'id' => 'lists-links-tab', 'title' => __( 'Links', 'youtube-embed' ), 'content' => youtube_embed_help( 'lists', 'links' ) ) );
|
257 |
}
|
258 |
|
259 |
+
/**
|
260 |
+
* Add Plugins Help
|
261 |
+
*
|
262 |
+
* Add help tab to third party plugins screen
|
263 |
+
*
|
264 |
+
* @since 4.3
|
265 |
+
*
|
266 |
+
* @uses ye_lists_help Return help text
|
267 |
+
*/
|
268 |
+
|
269 |
+
function ye_add_plugins_help() {
|
270 |
+
|
271 |
+
global $ye_plugins_hook;
|
272 |
+
$screen = get_current_screen();
|
273 |
+
|
274 |
+
if ( $screen->id != $ye_plugins_hook ) { return; }
|
275 |
+
|
276 |
+
$screen -> add_help_tab( array( 'id' => 'lists-help-tab', 'title' => __( 'Help', 'youtube-embed' ), 'content' => youtube_embed_help( 'plugins' ) ) );
|
277 |
+
|
278 |
+
}
|
279 |
+
|
280 |
/**
|
281 |
* Help Screens
|
282 |
*
|
293 |
|
294 |
$text = '';
|
295 |
|
296 |
+
if ( $screen == 'options' && $tab == 'help' ) {
|
297 |
|
298 |
$text .= '<p>' . __( 'This screen allows you to select non-specific options for the YouTube Embed plugin. For the default embedding settings, please select the <a href="admin.php?page=ye-profile-options">Profiles</a> administration option.', 'youtube-embed' ) . '</p>';
|
299 |
}
|
300 |
|
301 |
+
if ( $screen == 'profiles' && $tab == 'help' ) {
|
302 |
|
303 |
$text .= '<p>' . __( 'This screen allows you to set the options for the default and additional profiles. If you don\'t specify a specific parameter when displaying your YouTube video then the default profile option will be used instead. Additional profiles, which you may name, can be used as well and used as required.', 'youtube-embed' ) . '</p>';
|
304 |
$text .= '<p>' . __( 'All settings will work whether the Flash or HTML5 player is used, unless one of the following icons is shown, indicating which format the option works with...', 'youtube-embed' ) . '</p>';
|
306 |
$text .= "<img src='" . plugins_url( 'images/html5.png', dirname(__FILE__) ) . "' width='10px'/> - " . __( 'HTML5 player', 'youtube-embed' ) . '</br>';
|
307 |
}
|
308 |
|
309 |
+
if ( $screen == 'lists' && $tab == 'help' ) {
|
310 |
|
311 |
$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.', 'youtube-embed' ) . '</p>';
|
312 |
}
|
313 |
|
314 |
+
if ( $screen == 'plugins' && $tab == 'help' ) {
|
315 |
+
|
316 |
+
$text .= '<p>' . __( 'This screen lists plugins which have all been tested for compatibility with YouTube Embed (and in some cases, specific changes have been made by their authors to ensure compatibility. From here you can view their details and even install the plugins (where hosted at WordPress.org).', 'youtube-embed' ) . '</p>';
|
317 |
+
$text .= '<p><strong>' . __( 'NB. Inclusion here does not provide any guarantee for third party software, which includes any support.', 'youtube-embed' ) . '</strong></p>';
|
318 |
+
$text .= '<p>' . __( 'Some of these plugins will also appear under the YouTube Admin administration menu, once activated.', 'youtube-embed' ) . '</p>';
|
319 |
+
}
|
320 |
+
|
321 |
+
if ( $tab == 'help' && $screen != 'plugins' ) {
|
322 |
$text .= '<p>' . __( 'Remember to click the Save Changes button at the bottom of the screen for any changes to take effect.', 'youtube-embed' ) . '</p>';
|
323 |
}
|
324 |
|
346 |
*
|
347 |
* Add filters (assuming user is editing) for TinyMCE
|
348 |
*
|
349 |
+
* @uses ye_get_general_defaults Set default options
|
350 |
*
|
351 |
* @since 2.0
|
352 |
*/
|
357 |
|
358 |
if ( get_user_option( 'rich_editing' ) == 'true' ) {
|
359 |
|
360 |
+
$options = ye_get_general_defaults();
|
361 |
if ( $options[ 'editor_button' ] != '' ) {
|
362 |
|
363 |
// Add filters
|
423 |
|
424 |
if ( ( $shortcode_admin != 0 ) or ( $shortcode_site != 0 ) ) {
|
425 |
|
426 |
+
$options = ye_get_general_defaults();
|
427 |
|
428 |
if ( $options[ 'prompt' ] == 1 ) {
|
429 |
|
includes/generate-embed-code.php
CHANGED
@@ -14,14 +14,14 @@
|
|
14 |
*
|
15 |
* @since 2.0
|
16 |
*
|
17 |
-
* @uses
|
18 |
-
* @uses
|
19 |
-
* @uses
|
20 |
-
* @uses
|
21 |
-
* @uses
|
22 |
-
* @uses
|
23 |
-
* @uses
|
24 |
-
* @uses
|
25 |
*
|
26 |
* @param string $id Video ID
|
27 |
* @param string $width Video width
|
@@ -54,7 +54,7 @@
|
|
54 |
* @return string Code output
|
55 |
*/
|
56 |
|
57 |
-
function
|
58 |
|
59 |
// Initialisation
|
60 |
|
@@ -64,20 +64,20 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
64 |
|
65 |
// Ensure an ID is passed
|
66 |
|
67 |
-
if ( $id == '' ) { return
|
68 |
|
69 |
// Get general options
|
70 |
|
71 |
-
$general =
|
72 |
|
73 |
// Find the profile, if one is specified. Otherwise use default
|
74 |
|
75 |
if ( $profile != '' ) {
|
76 |
-
$profile =
|
77 |
} else {
|
78 |
$profile = 0;
|
79 |
}
|
80 |
-
$options =
|
81 |
|
82 |
// If a user look-up or search has been requested, miss out looking up list details and
|
83 |
// simple assign it as an IFRAME video
|
@@ -93,7 +93,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
93 |
if ( $general[ 'list' ] == 1 ) {
|
94 |
if ( $list_style != '' ) { $list_found = true; }
|
95 |
} else {
|
96 |
-
$list =
|
97 |
if ( is_array( $list ) ) { $list_found = true; }
|
98 |
}
|
99 |
|
@@ -103,17 +103,17 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
103 |
|
104 |
// Check if certain parameters are included in the URL
|
105 |
|
106 |
-
$width =
|
107 |
-
$height =
|
108 |
|
109 |
// Extract the ID if a full URL has been specified
|
110 |
|
111 |
-
$id =
|
112 |
|
113 |
// Check what type of video it is and whether it's valid
|
114 |
// Should be 'v' (video), 'p' (playlist) or blank (not known)
|
115 |
|
116 |
-
$embed_type =
|
117 |
|
118 |
// If the video is invalid, output an error
|
119 |
|
@@ -151,7 +151,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
151 |
$loop = 1;
|
152 |
while ( $loop < count( $list ) ) {
|
153 |
if ( $playlist_ids != '' ) { $playlist_ids .= ','; }
|
154 |
-
$list_id =
|
155 |
$playlist_ids .= $list_id;
|
156 |
$loop ++;
|
157 |
}
|
@@ -198,7 +198,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
198 |
// If height or width is missing, calculate missing parameter using ratio
|
199 |
|
200 |
if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
|
201 |
-
$new_sizes =
|
202 |
$width = $new_sizes[ 'width' ];
|
203 |
$height = $new_sizes[ 'height' ];
|
204 |
}
|
@@ -316,7 +316,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
316 |
// Work out, depending on privacy settings, the main address to use
|
317 |
|
318 |
if ( $privacy == 2 ) {
|
319 |
-
$do_not_track =
|
320 |
if ( $do_not_track ) { $privacy = 1; } else { $privacy = 0; }
|
321 |
}
|
322 |
|
@@ -349,7 +349,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
349 |
|
350 |
// Check length of URL to ensure it doesn't exceed 2000 characters
|
351 |
|
352 |
-
if ( strlen( $embed_url ) > 2000 ) { return
|
353 |
|
354 |
// Add IFRAME embed code
|
355 |
|
@@ -371,7 +371,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
371 |
// Add the download link, if required
|
372 |
|
373 |
if ( ( $options[ 'download' ] == 1 ) && ( $embed_type == 'v' ) ) {
|
374 |
-
$result .= '<div style="' . $options[ 'download_style' ] . '" class="aye_download">' . $newline . $tab . '<a href="' .
|
375 |
}
|
376 |
|
377 |
// Now add a commented header and trailer
|
@@ -397,7 +397,7 @@ function vye_generate_youtube_code( $id = '', $width = '', $height = '', $fullsc
|
|
397 |
* @return string The profile number (defaults to 0)
|
398 |
*/
|
399 |
|
400 |
-
function
|
401 |
|
402 |
$profile = 0;
|
403 |
$name = strtolower( $name );
|
@@ -411,7 +411,7 @@ function vye_validate_profile( $name, $number ) {
|
|
411 |
if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
|
412 |
$profile = $loop;
|
413 |
} else {
|
414 |
-
$profiles =
|
415 |
$profname = strtolower( $profiles[ 'name' ] );
|
416 |
if ( $profname == $name ) { $profile = $loop; }
|
417 |
}
|
@@ -433,7 +433,7 @@ function vye_validate_profile( $name, $number ) {
|
|
433 |
* @return string The list (defaults to blank)
|
434 |
*/
|
435 |
|
436 |
-
function
|
437 |
|
438 |
$list = '';
|
439 |
|
@@ -453,7 +453,7 @@ function vye_validate_list( $name, $number ) {
|
|
453 |
|
454 |
$loop = 1;
|
455 |
while ( ( $loop <= $number ) && ( $list == '' ) ) {
|
456 |
-
$listfiles =
|
457 |
if ( is_array( $listfiles) ) {
|
458 |
if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
|
459 |
$list = $listfiles[ 'list' ];
|
@@ -483,7 +483,7 @@ function vye_validate_list( $name, $number ) {
|
|
483 |
* @return string The parameter value
|
484 |
*/
|
485 |
|
486 |
-
function
|
487 |
|
488 |
// Look for an ampersand
|
489 |
|
@@ -515,7 +515,7 @@ function vye_get_url_para( $id, $para, $current ) {
|
|
515 |
* @return string True or false
|
516 |
*/
|
517 |
|
518 |
-
function
|
519 |
|
520 |
if ( isset( $_SERVER[ 'HTTP_DNT' ] ) ) {
|
521 |
if ( $_SERVER[ 'HTTP_DNT' ] == 1 ) { return true; }
|
@@ -544,7 +544,7 @@ function vye_do_not_track() {
|
|
544 |
* @return array Array of new width and height
|
545 |
*/
|
546 |
|
547 |
-
function
|
548 |
|
549 |
$ratio_to_use = '';
|
550 |
|
14 |
*
|
15 |
* @since 2.0
|
16 |
*
|
17 |
+
* @uses ye_add_links Add links under video
|
18 |
+
* @uses ye_error Display an error
|
19 |
+
* @uses ye_extract_id Get the video ID
|
20 |
+
* @uses ye_validate_list Get the requested listr
|
21 |
+
* @uses ye_validate_id Validate the video ID
|
22 |
+
* @uses ye_validate_profile Get the requested profile
|
23 |
+
* @uses ye_get_general_defaults Get general options
|
24 |
+
* @uses ye_get_profile Set default profile options
|
25 |
*
|
26 |
* @param string $id Video ID
|
27 |
* @param string $width Video width
|
54 |
* @return string Code output
|
55 |
*/
|
56 |
|
57 |
+
function ye_generate_youtube_code( $id = '', $width = '', $height = '', $fullscreen = '', $related = '', $autoplay = '', $loop = '', $start = '', $info = '', $annotation = '', $cc = '', $style = '', $stop = '', $disablekb = '', $ratio = '', $autohide = '', $controls = '', $profile = '', $list_style = '', $template = '', $color = '', $theme = '', $responsive = '', $search = '', $user = '', $modest = '', $playsinline = '', $html5 = '' ) {
|
58 |
|
59 |
// Initialisation
|
60 |
|
64 |
|
65 |
// Ensure an ID is passed
|
66 |
|
67 |
+
if ( $id == '' ) { return ye_error( __( 'No video/playlist ID has been supplied', 'youtube-embed' ) ); }
|
68 |
|
69 |
// Get general options
|
70 |
|
71 |
+
$general = ye_get_general_defaults();
|
72 |
|
73 |
// Find the profile, if one is specified. Otherwise use default
|
74 |
|
75 |
if ( $profile != '' ) {
|
76 |
+
$profile = ye_validate_profile( $profile, $general[ 'profile_no' ] );
|
77 |
} else {
|
78 |
$profile = 0;
|
79 |
}
|
80 |
+
$options = ye_get_profile( $profile );
|
81 |
|
82 |
// If a user look-up or search has been requested, miss out looking up list details and
|
83 |
// simple assign it as an IFRAME video
|
93 |
if ( $general[ 'list' ] == 1 ) {
|
94 |
if ( $list_style != '' ) { $list_found = true; }
|
95 |
} else {
|
96 |
+
$list = ye_validate_list( $id, $general[ 'list_no' ] );
|
97 |
if ( is_array( $list ) ) { $list_found = true; }
|
98 |
}
|
99 |
|
103 |
|
104 |
// Check if certain parameters are included in the URL
|
105 |
|
106 |
+
$width = ye_get_url_para( $id, 'w', $width );
|
107 |
+
$height = ye_get_url_para( $id, 'h', $height );
|
108 |
|
109 |
// Extract the ID if a full URL has been specified
|
110 |
|
111 |
+
$id = ye_extract_id( $id );
|
112 |
|
113 |
// Check what type of video it is and whether it's valid
|
114 |
// Should be 'v' (video), 'p' (playlist) or blank (not known)
|
115 |
|
116 |
+
$embed_type = ye_validate_id( $id );
|
117 |
|
118 |
// If the video is invalid, output an error
|
119 |
|
151 |
$loop = 1;
|
152 |
while ( $loop < count( $list ) ) {
|
153 |
if ( $playlist_ids != '' ) { $playlist_ids .= ','; }
|
154 |
+
$list_id = ye_extract_id( $list[ $loop ] );
|
155 |
$playlist_ids .= $list_id;
|
156 |
$loop ++;
|
157 |
}
|
198 |
// If height or width is missing, calculate missing parameter using ratio
|
199 |
|
200 |
if ( ( ( $width == '' ) or ( $height == '' ) ) && ( ( $width != '' ) or ( $height != '' ) ) ) {
|
201 |
+
$new_sizes = ye_calculate_video_size( $width, $height, $options[ 'width' ], $options[ 'height' ], $ratio);
|
202 |
$width = $new_sizes[ 'width' ];
|
203 |
$height = $new_sizes[ 'height' ];
|
204 |
}
|
316 |
// Work out, depending on privacy settings, the main address to use
|
317 |
|
318 |
if ( $privacy == 2 ) {
|
319 |
+
$do_not_track = ye_do_not_track();
|
320 |
if ( $do_not_track ) { $privacy = 1; } else { $privacy = 0; }
|
321 |
}
|
322 |
|
349 |
|
350 |
// Check length of URL to ensure it doesn't exceed 2000 characters
|
351 |
|
352 |
+
if ( strlen( $embed_url ) > 2000 ) { return ye_error( __( 'The maximum URL length has been exceeded. Please reduce your parameter and/or playlist.', 'youtube-embed' ) ); }
|
353 |
|
354 |
// Add IFRAME embed code
|
355 |
|
371 |
// Add the download link, if required
|
372 |
|
373 |
if ( ( $options[ 'download' ] == 1 ) && ( $embed_type == 'v' ) ) {
|
374 |
+
$result .= '<div style="' . $options[ 'download_style' ] . '" class="aye_download">' . $newline . $tab . '<a href="' . ye_generate_download_code( $id ) . "\">" . $options[ 'download_text' ] . '</a>' . $newline . '</div>' . $newline;
|
375 |
}
|
376 |
|
377 |
// Now add a commented header and trailer
|
397 |
* @return string The profile number (defaults to 0)
|
398 |
*/
|
399 |
|
400 |
+
function ye_validate_profile( $name, $number ) {
|
401 |
|
402 |
$profile = 0;
|
403 |
$name = strtolower( $name );
|
411 |
if ( ( $name == $loop ) or ( $name == 'Profile ' . $loop ) ) {
|
412 |
$profile = $loop;
|
413 |
} else {
|
414 |
+
$profiles = ye_get_profile( $loop );
|
415 |
$profname = strtolower( $profiles[ 'name' ] );
|
416 |
if ( $profname == $name ) { $profile = $loop; }
|
417 |
}
|
433 |
* @return string The list (defaults to blank)
|
434 |
*/
|
435 |
|
436 |
+
function ye_validate_list( $name, $number ) {
|
437 |
|
438 |
$list = '';
|
439 |
|
453 |
|
454 |
$loop = 1;
|
455 |
while ( ( $loop <= $number ) && ( $list == '' ) ) {
|
456 |
+
$listfiles = ye_get_list( $loop );
|
457 |
if ( is_array( $listfiles) ) {
|
458 |
if ( ( $name == strval( $loop ) ) or ( $name == 'List ' . $loop ) ) {
|
459 |
$list = $listfiles[ 'list' ];
|
483 |
* @return string The parameter value
|
484 |
*/
|
485 |
|
486 |
+
function ye_get_url_para( $id, $para, $current ) {
|
487 |
|
488 |
// Look for an ampersand
|
489 |
|
515 |
* @return string True or false
|
516 |
*/
|
517 |
|
518 |
+
function ye_do_not_track() {
|
519 |
|
520 |
if ( isset( $_SERVER[ 'HTTP_DNT' ] ) ) {
|
521 |
if ( $_SERVER[ 'HTTP_DNT' ] == 1 ) { return true; }
|
544 |
* @return array Array of new width and height
|
545 |
*/
|
546 |
|
547 |
+
function ye_calculate_video_size( $width, $height, $default_width, $default_height, $ratio ) {
|
548 |
|
549 |
$ratio_to_use = '';
|
550 |
|
includes/generate-other-code.php
CHANGED
@@ -7,15 +7,15 @@
|
|
7 |
* @package YouTube-Embed
|
8 |
* @since 2.0
|
9 |
*
|
10 |
-
* @uses
|
11 |
-
* @uses
|
12 |
-
* @uses
|
13 |
*
|
14 |
* @param string $id YouTube video ID
|
15 |
* @return string Download HTML
|
16 |
*/
|
17 |
|
18 |
-
function
|
19 |
|
20 |
return 'http://keepvid.com/?url=https://www.youtube.com/watch?v=' . $id;
|
21 |
|
@@ -29,31 +29,31 @@ function vye_generate_download_code( $id ) {
|
|
29 |
* @package YouTube-Embed
|
30 |
* @since 2.0
|
31 |
*
|
32 |
-
* @uses
|
33 |
-
* @uses
|
34 |
-
* @uses
|
35 |
*
|
36 |
* @param string $id YouTube video ID
|
37 |
* @return string $youtube_code Code
|
38 |
*/
|
39 |
|
40 |
-
function
|
41 |
|
42 |
// Check that an ID has been specified
|
43 |
if ( $id == '' ) {
|
44 |
-
return
|
45 |
} else {
|
46 |
|
47 |
// Extract the ID if a full URL has been specified
|
48 |
-
$id =
|
49 |
|
50 |
// Check what type of video it is and whether it's valid
|
51 |
-
$embed_type =
|
52 |
if ( $embed_type != 'v' ) {
|
53 |
if ( strlen( $embed_type ) > 1 ) {
|
54 |
-
return
|
55 |
} else {
|
56 |
-
return
|
57 |
}
|
58 |
}
|
59 |
|
@@ -69,9 +69,9 @@ function vye_generate_shorturl_code( $id ) {
|
|
69 |
* @package YouTube-Embed
|
70 |
* @since 2.0
|
71 |
*
|
72 |
-
* @uses
|
73 |
-
* @uses
|
74 |
-
* @uses
|
75 |
*
|
76 |
* @param string $id YouTube video ID
|
77 |
* @param string $style Link STYLE
|
@@ -86,19 +86,19 @@ function vye_generate_shorturl_code( $id ) {
|
|
86 |
* @return string $youtube_code Code
|
87 |
*/
|
88 |
|
89 |
-
function
|
90 |
|
91 |
// Extract the ID if a full URL has been specified
|
92 |
-
$id =
|
93 |
|
94 |
// Check what type of video it is and whether it's valid
|
95 |
-
$embed_type =
|
96 |
|
97 |
if ( $embed_type != 'v' ) {
|
98 |
if ( strlen( $embed_type ) > 1 ) {
|
99 |
-
return
|
100 |
} else {
|
101 |
-
return
|
102 |
}
|
103 |
}
|
104 |
|
7 |
* @package YouTube-Embed
|
8 |
* @since 2.0
|
9 |
*
|
10 |
+
* @uses ye_extract_id Extract an ID from a string
|
11 |
+
* @uses ye_validate_id Confirm the type of video
|
12 |
+
* @uses ye_error Display an error
|
13 |
*
|
14 |
* @param string $id YouTube video ID
|
15 |
* @return string Download HTML
|
16 |
*/
|
17 |
|
18 |
+
function ye_generate_download_code( $id ) {
|
19 |
|
20 |
return 'http://keepvid.com/?url=https://www.youtube.com/watch?v=' . $id;
|
21 |
|
29 |
* @package YouTube-Embed
|
30 |
* @since 2.0
|
31 |
*
|
32 |
+
* @uses ye_extract_id Extract an ID from a string
|
33 |
+
* @uses ye_validate_id Confirm the type of video
|
34 |
+
* @uses ye_error Display an error
|
35 |
*
|
36 |
* @param string $id YouTube video ID
|
37 |
* @return string $youtube_code Code
|
38 |
*/
|
39 |
|
40 |
+
function ye_generate_shorturl_code( $id ) {
|
41 |
|
42 |
// Check that an ID has been specified
|
43 |
if ( $id == '' ) {
|
44 |
+
return ye_error( __( 'No video ID has been supplied', 'youtube-embed' ) );
|
45 |
} else {
|
46 |
|
47 |
// Extract the ID if a full URL has been specified
|
48 |
+
$id = ye_extract_id( $id );
|
49 |
|
50 |
// Check what type of video it is and whether it's valid
|
51 |
+
$embed_type = ye_validate_id( $id );
|
52 |
if ( $embed_type != 'v' ) {
|
53 |
if ( strlen( $embed_type ) > 1 ) {
|
54 |
+
return ye_error( $embed_type );
|
55 |
} else {
|
56 |
+
return ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) );
|
57 |
}
|
58 |
}
|
59 |
|
69 |
* @package YouTube-Embed
|
70 |
* @since 2.0
|
71 |
*
|
72 |
+
* @uses ye_extract_id Extract an ID from a string
|
73 |
+
* @uses ye_validate_id Confirm the type of video
|
74 |
+
* @uses ye_error Display an error
|
75 |
*
|
76 |
* @param string $id YouTube video ID
|
77 |
* @param string $style Link STYLE
|
86 |
* @return string $youtube_code Code
|
87 |
*/
|
88 |
|
89 |
+
function ye_generate_thumbnail_code( $id, $style, $class, $rel, $target, $width, $height, $alt, $version, $nolink = false ) {
|
90 |
|
91 |
// Extract the ID if a full URL has been specified
|
92 |
+
$id = ye_extract_id( $id );
|
93 |
|
94 |
// Check what type of video it is and whether it's valid
|
95 |
+
$embed_type = ye_validate_id( $id );
|
96 |
|
97 |
if ( $embed_type != 'v' ) {
|
98 |
if ( strlen( $embed_type ) > 1 ) {
|
99 |
+
return ye_error( $embed_type );
|
100 |
} else {
|
101 |
+
return ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) );
|
102 |
}
|
103 |
}
|
104 |
|
includes/generate-widgets.php
CHANGED
@@ -60,7 +60,7 @@ class YouTubeEmbedWidget extends WP_Widget {
|
|
60 |
// Generate the video and output it
|
61 |
|
62 |
echo apply_filters( 'a3_lazy_load_html',
|
63 |
-
|
64 |
'',
|
65 |
'',
|
66 |
'',
|
@@ -125,7 +125,7 @@ class YouTubeEmbedWidget extends WP_Widget {
|
|
125 |
*
|
126 |
* @since 2.0
|
127 |
*
|
128 |
-
* @uses
|
129 |
*
|
130 |
* @param string $instance Instance
|
131 |
*/
|
@@ -136,7 +136,7 @@ class YouTubeEmbedWidget extends WP_Widget {
|
|
136 |
|
137 |
$default = array( 'titles' => 'YouTube', 'id' => '', 'profile' => '', 'start' => '', 'list' => '', 'stop' => '', 'id_type' => 'v' );
|
138 |
$instance = wp_parse_args( ( array ) $instance, $default );
|
139 |
-
$general =
|
140 |
|
141 |
// Widget Title field
|
142 |
|
@@ -171,7 +171,7 @@ class YouTubeEmbedWidget extends WP_Widget {
|
|
171 |
$field_id = $this -> get_field_id( 'profile' );
|
172 |
$field_name = $this -> get_field_name( 'profile' );
|
173 |
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile', 'youtube-embed' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
|
174 |
-
|
175 |
echo '</select></p>';
|
176 |
|
177 |
echo "<table>\n";
|
60 |
// Generate the video and output it
|
61 |
|
62 |
echo apply_filters( 'a3_lazy_load_html',
|
63 |
+
ye_generate_youtube_code ( $instance[ 'id' ],
|
64 |
'',
|
65 |
'',
|
66 |
'',
|
125 |
*
|
126 |
* @since 2.0
|
127 |
*
|
128 |
+
* @uses ye_get_general_defaults Fetch general options
|
129 |
*
|
130 |
* @param string $instance Instance
|
131 |
*/
|
136 |
|
137 |
$default = array( 'titles' => 'YouTube', 'id' => '', 'profile' => '', 'start' => '', 'list' => '', 'stop' => '', 'id_type' => 'v' );
|
138 |
$instance = wp_parse_args( ( array ) $instance, $default );
|
139 |
+
$general = ye_get_general_defaults();
|
140 |
|
141 |
// Widget Title field
|
142 |
|
171 |
$field_id = $this -> get_field_id( 'profile' );
|
172 |
$field_name = $this -> get_field_name( 'profile' );
|
173 |
echo "\r\n" . '<p><label for="' . $field_id . '">' . __( 'Profile', 'youtube-embed' ) . ': </label><select name="' . $field_name . '" class="widefat" id="' . $field_id . '">';
|
174 |
+
ye_generate_profile_list( esc_attr( $instance[ 'profile' ] ), $general[ 'profile_no' ] );
|
175 |
echo '</select></p>';
|
176 |
|
177 |
echo "<table>\n";
|
includes/options-general.php
CHANGED
@@ -13,7 +13,7 @@
|
|
13 |
global $wp_version;
|
14 |
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
15 |
?>
|
16 |
-
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed
|
17 |
|
18 |
<?php
|
19 |
|
@@ -24,12 +24,12 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
|
|
24 |
// If the number of profiles or lists have changed check that they all have
|
25 |
// correct values assigned (if at all)
|
26 |
|
27 |
-
$options =
|
28 |
if ( isset( $options[ 'list_no' ] ) && isset( $_POST[ 'youtube_embed_list_no' ] ) && $options[ 'list_no' ] != $_POST[ 'youtube_embed_list_no' ] ) {
|
29 |
-
|
30 |
}
|
31 |
if ( isset( $options[ 'profile_no' ] ) && isset( $_POST[ 'youtube_embed_list_no' ] ) && $options[ 'profile_no' ] != $_POST[ 'youtube_embed_list_no' ] ) {
|
32 |
-
|
33 |
}
|
34 |
|
35 |
// Update options
|
@@ -76,8 +76,8 @@ if ( ( !empty( $_POST ) ) && ( check_admin_referer( 'youtube-embed-general', 'yo
|
|
76 |
|
77 |
// Get options
|
78 |
|
79 |
-
$options =
|
80 |
-
$shortcode =
|
81 |
?>
|
82 |
|
83 |
<p><?php _e( 'These are the general settings for YouTube Embed. Please select <a href="admin.php?page=ye-profile-options">Profiles</a> for default embedding settings.', 'youtube-embed' ); ?></p>
|
@@ -156,7 +156,7 @@ $shortcode = vye_get_shortcode();
|
|
156 |
<tr>
|
157 |
<th scope="row"> <?php _e( 'Profile to use', 'youtube-embed' ); ?></th>
|
158 |
<td><label for="youtube_embed_alt_profile"><select name="youtube_embed_alt_profile">
|
159 |
-
<?php
|
160 |
</select></label></td>
|
161 |
</tr>
|
162 |
|
13 |
global $wp_version;
|
14 |
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
15 |
?>
|
16 |
+
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed Settings', 'youtube-embed' ); ?></h<?php echo $heading; ?>>
|
17 |
|
18 |
<?php
|
19 |
|
24 |
// If the number of profiles or lists have changed check that they all have
|
25 |
// correct values assigned (if at all)
|
26 |
|
27 |
+
$options = ye_get_general_defaults();
|
28 |
if ( isset( $options[ 'list_no' ] ) && isset( $_POST[ 'youtube_embed_list_no' ] ) && $options[ 'list_no' ] != $_POST[ 'youtube_embed_list_no' ] ) {
|
29 |
+
ye_set_list( sanitize_text_field( $_POST[ 'youtube_embed_list_no' ] ) );
|
30 |
}
|
31 |
if ( isset( $options[ 'profile_no' ] ) && isset( $_POST[ 'youtube_embed_list_no' ] ) && $options[ 'profile_no' ] != $_POST[ 'youtube_embed_list_no' ] ) {
|
32 |
+
ye_set_profile( sanitize_text_field( $_POST[ 'youtube_embed_profile_no' ] ) );
|
33 |
}
|
34 |
|
35 |
// Update options
|
76 |
|
77 |
// Get options
|
78 |
|
79 |
+
$options = ye_get_general_defaults();
|
80 |
+
$shortcode = ye_get_shortcode();
|
81 |
?>
|
82 |
|
83 |
<p><?php _e( 'These are the general settings for YouTube Embed. Please select <a href="admin.php?page=ye-profile-options">Profiles</a> for default embedding settings.', 'youtube-embed' ); ?></p>
|
156 |
<tr>
|
157 |
<th scope="row"> <?php _e( 'Profile to use', 'youtube-embed' ); ?></th>
|
158 |
<td><label for="youtube_embed_alt_profile"><select name="youtube_embed_alt_profile">
|
159 |
+
<?php ye_generate_profile_list( $options[ 'alt_profile' ], $options[ 'profile_no' ] ) ?>
|
160 |
</select></label></td>
|
161 |
</tr>
|
162 |
|
includes/options-lists.php
CHANGED
@@ -36,12 +36,12 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
|
|
36 |
|
37 |
// Extract the ID from the provided data
|
38 |
|
39 |
-
$id = trim(
|
40 |
|
41 |
// Now check its validity
|
42 |
|
43 |
if ( $id != '' ) {
|
44 |
-
$type =
|
45 |
if ( $type != 'v' ) { $valid = false; }
|
46 |
$new_id_list .= $id . "\n";
|
47 |
}
|
@@ -74,8 +74,8 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-g
|
|
74 |
|
75 |
// Fetch options into an array
|
76 |
|
77 |
-
if ( $class != "error" ) { $options =
|
78 |
-
$general =
|
79 |
|
80 |
// Get number of lists in use
|
81 |
|
@@ -83,7 +83,7 @@ $loop = 1;
|
|
83 |
$max_list = 0;
|
84 |
while ( $loop <= $general[ 'list_no' ] ) {
|
85 |
|
86 |
-
$list =
|
87 |
|
88 |
if ( $list[ 'list' ] == '' ) {
|
89 |
$max_list = $loop - 1;
|
@@ -117,7 +117,7 @@ if ( $message != '' ) { echo '<div class="' . $class . '"><p><strong>' . $messag
|
|
117 |
$loop = 1;
|
118 |
while ( $loop <= $general[ 'list_no' ] ) {
|
119 |
|
120 |
-
$listfiles =
|
121 |
if ( $listfiles[ 'list' ] != '' ) {
|
122 |
$listname = $listfiles[ 'name' ];
|
123 |
$list_found = true;
|
@@ -179,12 +179,12 @@ if ( $options[ 'list' ] != '' ) {
|
|
179 |
|
180 |
// Extract the ID from the provided data
|
181 |
|
182 |
-
$id = trim(
|
183 |
if ( $id != '' ) {
|
184 |
|
185 |
// Validate the video type
|
186 |
|
187 |
-
$type =
|
188 |
|
189 |
if ( $type == 'p' ) {
|
190 |
$text = __( 'This is a playlist', 'youtube-embed' );
|
36 |
|
37 |
// Extract the ID from the provided data
|
38 |
|
39 |
+
$id = trim( ye_extract_id( $id_array[ $loop ] ) );
|
40 |
|
41 |
// Now check its validity
|
42 |
|
43 |
if ( $id != '' ) {
|
44 |
+
$type = ye_validate_id( $id );
|
45 |
if ( $type != 'v' ) { $valid = false; }
|
46 |
$new_id_list .= $id . "\n";
|
47 |
}
|
74 |
|
75 |
// Fetch options into an array
|
76 |
|
77 |
+
if ( $class != "error" ) { $options = ye_get_list( $list_no ); }
|
78 |
+
$general = ye_get_general_defaults();
|
79 |
|
80 |
// Get number of lists in use
|
81 |
|
83 |
$max_list = 0;
|
84 |
while ( $loop <= $general[ 'list_no' ] ) {
|
85 |
|
86 |
+
$list = ye_get_list( $loop );
|
87 |
|
88 |
if ( $list[ 'list' ] == '' ) {
|
89 |
$max_list = $loop - 1;
|
117 |
$loop = 1;
|
118 |
while ( $loop <= $general[ 'list_no' ] ) {
|
119 |
|
120 |
+
$listfiles = ye_get_list( $loop );
|
121 |
if ( $listfiles[ 'list' ] != '' ) {
|
122 |
$listname = $listfiles[ 'name' ];
|
123 |
$list_found = true;
|
179 |
|
180 |
// Extract the ID from the provided data
|
181 |
|
182 |
+
$id = trim( ye_extract_id( $id_array[ $loop ] ) );
|
183 |
if ( $id != '' ) {
|
184 |
|
185 |
// Validate the video type
|
186 |
|
187 |
+
$type = ye_validate_id( $id );
|
188 |
|
189 |
if ( $type == 'p' ) {
|
190 |
$text = __( 'This is a playlist', 'youtube-embed' );
|
includes/options-plugins.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Third Party Plugins Page
|
4 |
+
*
|
5 |
+
* Screen for allowing users to view and install third party plugins
|
6 |
+
*
|
7 |
+
* @package youtube-embed
|
8 |
+
* @since 4.3
|
9 |
+
*/
|
10 |
+
?>
|
11 |
+
<?php add_thickbox(); ?>
|
12 |
+
<div class="wrap">
|
13 |
+
<?php
|
14 |
+
global $wp_version;
|
15 |
+
if ( ( float ) $wp_version >= 4.3 ) { $heading = '1'; } else { $heading = '2'; }
|
16 |
+
?>
|
17 |
+
<h<?php echo $heading; ?>><?php _e( 'YouTube Embed 3rd Party Plugins', 'youtube-embed' ); ?></h<?php echo $heading; ?>>
|
18 |
+
|
19 |
+
<form method="post">
|
20 |
+
|
21 |
+
<table class="form-table">
|
22 |
+
|
23 |
+
<?php
|
24 |
+
|
25 |
+
// Turn Off The Lights
|
26 |
+
|
27 |
+
?><tr>
|
28 |
+
<th scope="row"><label for="ye_plugins_turnoff"><?php _e( 'Turn Off The Lights', 'youtube-embed' ); ?></th>
|
29 |
+
<td><a href="https://www.stefanvd.net/project/turnoffthelights.htm"><?php _e( 'Install Turn Out The Lights on your browser', 'youtube-embed' ); ?></a></label>
|
30 |
+
<p class="description"><?php _e( 'A browser extension that, with a single click on the lamp button, will fade the page dark, with the exception of the embedded video. By clicking on it again, the page will return to normal.', 'youtube-embed' ); ?></p>
|
31 |
+
</td></tr><?php
|
32 |
+
|
33 |
+
// a3 lazy load
|
34 |
+
|
35 |
+
ye_plugin_status( 'a3-lazy-load', __( 'a3 Lazy Load', 'youtube-embed' ), __( 'Speed up your site and enhance frontend user\'s visual experience. Fully updated to support YouTube Embed.', 'youtube-embed' ), 'a3_lazy_load' );
|
36 |
+
|
37 |
+
// Video Overlay Ads
|
38 |
+
|
39 |
+
ye_plugin_status( 'wpseo-video', __( 'Video SEO', 'youtube-embed' ), __( 'Premium plugin from Yoast to add your video to Google and other search engines.', 'youtube-embed' ), 'video_seo', 'video-seo.php', 'https://yoast.com/wordpress/plugins/video-seo/' );
|
40 |
+
|
41 |
+
// Video Overlay Ads
|
42 |
+
|
43 |
+
ye_plugin_status( 'video-overlay-ads', __( 'WordPress Video Overlay Ads', 'youtube-embed' ), __( 'This plugin creates an lightbox area over Youtube video embeds. You can insert all kinds of html content including banner ads, texts, polls, and add any kind of html and javascript code you like.', 'youtube-embed' ), 'video_overlay_ads', 'main.php' );
|
44 |
+
|
45 |
+
// YouTube Channel Gallery
|
46 |
+
|
47 |
+
ye_plugin_status( 'youtube-channel-gallery', __( 'YouTube Channel Gallery', 'youtube-embed' ), __( 'Adds a widget to show a YouTube video and a gallery of thumbnails for a YouTube channel.', 'youtube-embed' ), 'channel-gallery' );
|
48 |
+
|
49 |
+
// YouTube subscribe Button
|
50 |
+
|
51 |
+
ye_plugin_status( 'youtube-subscribe-button', __( 'YouTube Subscribe Button', 'youtube-embed' ), __( 'Adds a YouTube subscribe button to your blog so people can subscribe to your YouTube channel without leaving your site.', 'youtube-embed' ), 'subscribe-button' );
|
52 |
+
?>
|
53 |
+
|
54 |
+
</table></form>
|
55 |
+
|
56 |
+
</div>
|
57 |
+
|
58 |
+
<?php
|
59 |
+
/**
|
60 |
+
* Output plugin status
|
61 |
+
*
|
62 |
+
* Show details of current plugin installation
|
63 |
+
*
|
64 |
+
* @since 4.3
|
65 |
+
*
|
66 |
+
* @param $plugin_name string The name of the plugin, as in the WordPress directory
|
67 |
+
* @param $title string The title of the plugin
|
68 |
+
* @param $description string The plugin description
|
69 |
+
* @param $id string A unique ID for the form field
|
70 |
+
* @param $code_name string The filename of the main plugin code (optional)
|
71 |
+
* @param $link_url string URL to plugin, if not hosted on WordPress (optional)
|
72 |
+
*/
|
73 |
+
|
74 |
+
function ye_plugin_status( $plugin_name, $title, $description, $id, $code_name = '', $url = '' ) {
|
75 |
+
|
76 |
+
$status = ye_check_plugin( $plugin_name, $code_name );
|
77 |
+
|
78 |
+
echo '<tr><th scope="row"><label for="ye_plugins_' . $id . '">' . $title . '</th>';
|
79 |
+
echo '<td><input disabled="disabled" type="checkbox" name="ye_plugins_' . $id . '" value="1"';
|
80 |
+
if ( $status == 2) { echo ' checked="checked"'; }
|
81 |
+
echo '/>';
|
82 |
+
|
83 |
+
if ( $status == 0 ) {
|
84 |
+
$text = __( 'Install the plugin', 'youtube-embed' );
|
85 |
+
} else {
|
86 |
+
if ( $status == 1 ) {
|
87 |
+
$text = __( 'Plugin installed but not active', 'youtube-embed' );
|
88 |
+
} else {
|
89 |
+
$text = __( 'Plugin installed and active', 'youtube-embed' );
|
90 |
+
}
|
91 |
+
}
|
92 |
+
|
93 |
+
echo '<a href="';
|
94 |
+
if ( $url == '' ) {
|
95 |
+
echo admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_name . '&TB_iframe=true&width=772&height=565' );
|
96 |
+
} else {
|
97 |
+
echo $url . '?TB_iframe=true&width=772&height=565';
|
98 |
+
}
|
99 |
+
echo '" class="thickbox">' . $text . '</a>';
|
100 |
+
|
101 |
+
echo '</label><p class="description">' . $description . '</p></td></tr>';
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Check if plugin exists
|
106 |
+
*
|
107 |
+
* Check status of plugin - if it installed and, if so, is it active?
|
108 |
+
*
|
109 |
+
* @since 4.3
|
110 |
+
*
|
111 |
+
* @param $plugin_dir string The directory of the plugin
|
112 |
+
* @param $plugin_name string The name of the plugin (optional)
|
113 |
+
* @return $status string The status of the plugin (0=not installed / 1=installed, not active / 2 = installed, active
|
114 |
+
*/
|
115 |
+
|
116 |
+
function ye_check_plugin( $plugin_dir, $plugin_name = '' ) {
|
117 |
+
|
118 |
+
if ( $plugin_name == '' ) { $plugin_name = $plugin_dir . '.php'; }
|
119 |
+
|
120 |
+
$plugins = get_plugins( '/' . $plugin_dir );
|
121 |
+
if ( $plugins ) {
|
122 |
+
if ( is_plugin_active( $plugin_dir . '/' . $plugin_name ) ) {
|
123 |
+
$status = 2;
|
124 |
+
} else {
|
125 |
+
$status = 1;
|
126 |
+
}
|
127 |
+
} else {
|
128 |
+
$status = 0;
|
129 |
+
}
|
130 |
+
return $status;
|
131 |
+
}
|
132 |
+
?>
|
includes/options-profiles.php
CHANGED
@@ -86,8 +86,8 @@ if ( ( !empty( $_POST[ 'Submit' ] ) ) && ( check_admin_referer( 'youtube-embed-p
|
|
86 |
|
87 |
// Fetch options into an array
|
88 |
|
89 |
-
$options =
|
90 |
-
$general =
|
91 |
|
92 |
// Get number of lists in use
|
93 |
|
@@ -95,7 +95,7 @@ $loop = 0;
|
|
95 |
$max_list = $general[ 'list_no' ];
|
96 |
while ( $loop <= $general[ 'list_no' ] ) {
|
97 |
|
98 |
-
$list =
|
99 |
|
100 |
if ( $list[ 'default' ] ) {
|
101 |
$max_list = $loop;
|
@@ -131,7 +131,7 @@ if ( !empty( $_POST[ 'Video' ] ) ) { $video_type = $_POST[ 'youtube_embed_video_
|
|
131 |
|
132 |
<span class="alignright">
|
133 |
<select name="youtube_embed_profile_no">
|
134 |
-
<?php
|
135 |
</select>
|
136 |
<input type="submit" name="Profile" class="button-secondary" value="<?php _e( 'Change profile', 'youtube-embed' ); ?>"/>
|
137 |
</span><br/>
|
@@ -426,7 +426,7 @@ echo ' ' . __( 'Use the drop-down on the right hand side to swap between profile
|
|
426 |
if ( $video_type == "d" ) { $id = $demo_video; }
|
427 |
if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; }
|
428 |
if ( $video_type == "l" ) { $id = '095393D5B42B2266'; }
|
429 |
-
echo
|
430 |
?></p>
|
431 |
|
432 |
</form></div>
|
86 |
|
87 |
// Fetch options into an array
|
88 |
|
89 |
+
$options = ye_get_profile( $profile_no );
|
90 |
+
$general = ye_get_general_defaults();
|
91 |
|
92 |
// Get number of lists in use
|
93 |
|
95 |
$max_list = $general[ 'list_no' ];
|
96 |
while ( $loop <= $general[ 'list_no' ] ) {
|
97 |
|
98 |
+
$list = ye_get_profile( $loop );
|
99 |
|
100 |
if ( $list[ 'default' ] ) {
|
101 |
$max_list = $loop;
|
131 |
|
132 |
<span class="alignright">
|
133 |
<select name="youtube_embed_profile_no">
|
134 |
+
<?php ye_generate_profile_list( $profile_no, $general[ 'profile_no' ], true ) ?>
|
135 |
</select>
|
136 |
<input type="submit" name="Profile" class="button-secondary" value="<?php _e( 'Change profile', 'youtube-embed' ); ?>"/>
|
137 |
</span><br/>
|
426 |
if ( $video_type == "d" ) { $id = $demo_video; }
|
427 |
if ( $video_type == "3" ) { $id = 'NR5UoBY87GM'; }
|
428 |
if ( $video_type == "l" ) { $id = '095393D5B42B2266'; }
|
429 |
+
echo ye_generate_youtube_code( $id, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', $profile_no );
|
430 |
?></p>
|
431 |
|
432 |
</form></div>
|
includes/shared-functions.php
CHANGED
@@ -18,7 +18,7 @@
|
|
18 |
* @return string Extracted ID
|
19 |
*/
|
20 |
|
21 |
-
function
|
22 |
|
23 |
// Convert and trim video ID characters
|
24 |
|
@@ -93,7 +93,7 @@ function vye_extract_id( $id ) {
|
|
93 |
* @return string Array containing file details
|
94 |
*/
|
95 |
|
96 |
-
function
|
97 |
|
98 |
$type = '';
|
99 |
if ( strlen( $id ) == 11 ) {
|
@@ -122,7 +122,7 @@ function vye_validate_id( $id ) {
|
|
122 |
* @return string Error output
|
123 |
*/
|
124 |
|
125 |
-
function
|
126 |
|
127 |
return '<p style="color: #f00; font-weight: bold;">YouTube Embed: ' . $errorin . "</p>\n";
|
128 |
|
@@ -135,15 +135,15 @@ function vye_error( $errorin ) {
|
|
135 |
*
|
136 |
* @since 2.0
|
137 |
*
|
138 |
-
* @uses
|
139 |
*
|
140 |
* @param string $input Input, usually Yes or No
|
141 |
* @return string 1, 0 or blank, depending on input
|
142 |
*/
|
143 |
|
144 |
-
function
|
145 |
|
146 |
-
$input =
|
147 |
$output = '';
|
148 |
if ( $input === true ) { $output = '1'; }
|
149 |
if ( $input === false ) { $output = '0'; }
|
@@ -163,14 +163,14 @@ function vye_convert( $input ) {
|
|
163 |
* @param string $full_list Show the full list or just those defined?
|
164 |
*/
|
165 |
|
166 |
-
function
|
167 |
|
168 |
$loop = 0;
|
169 |
while ( $loop <= $total ) {
|
170 |
|
171 |
// Attempt to get profile
|
172 |
|
173 |
-
$profiles =
|
174 |
|
175 |
// If list is undefined, give it a default name
|
176 |
|
@@ -205,7 +205,7 @@ function vye_generate_profile_list( $current, $total, $full_list = false ) {
|
|
205 |
* @return strings Alternative shortcode name
|
206 |
*/
|
207 |
|
208 |
-
function
|
209 |
|
210 |
return get_option( 'youtube_embed_shortcode' );
|
211 |
|
@@ -221,7 +221,7 @@ function vye_get_shortcode() {
|
|
221 |
* @return string Alternative Shortcode
|
222 |
*/
|
223 |
|
224 |
-
function
|
225 |
|
226 |
$shortcode = get_option( 'youtube_embed_shortcode' );
|
227 |
|
@@ -246,7 +246,7 @@ function vye_set_shortcode() {
|
|
246 |
* @return strings Options array
|
247 |
*/
|
248 |
|
249 |
-
function
|
250 |
|
251 |
return get_option( 'youtube_embed_general' );
|
252 |
|
@@ -262,7 +262,7 @@ function vye_get_general_defaults() {
|
|
262 |
* @return string Options array
|
263 |
*/
|
264 |
|
265 |
-
function
|
266 |
|
267 |
$options = get_option( 'youtube_embed_general' );
|
268 |
|
@@ -319,14 +319,14 @@ function vye_set_general_defaults() {
|
|
319 |
* @return strings Profile array
|
320 |
*/
|
321 |
|
322 |
-
function
|
323 |
|
324 |
$options = get_option( 'youtube_embed_profile' . $profile );
|
325 |
|
326 |
// If there is no profile set up, set to default values and save
|
327 |
|
328 |
if ( !is_array( $options ) ) {
|
329 |
-
$options =
|
330 |
$options[ 'default' ] = true;
|
331 |
} else {
|
332 |
$options[ 'default' ] = false;
|
@@ -351,7 +351,7 @@ function vye_get_profile( $profile ) {
|
|
351 |
* @return string Options array
|
352 |
*/
|
353 |
|
354 |
-
function
|
355 |
|
356 |
$profile = 0;
|
357 |
while ( $profile <= $profiles ) {
|
@@ -364,7 +364,7 @@ function vye_set_profile( $profiles ) {
|
|
364 |
|
365 |
// Because of upgrading, check each option - if not set, apply default
|
366 |
|
367 |
-
$default_array =
|
368 |
|
369 |
$new_options = array_merge( $default_array, $options );
|
370 |
|
@@ -395,7 +395,7 @@ function vye_set_profile( $profiles ) {
|
|
395 |
* @return array Profile array
|
396 |
*/
|
397 |
|
398 |
-
function
|
399 |
|
400 |
// Set profile name
|
401 |
|
@@ -461,13 +461,13 @@ function vye_set_profile_defaults( $profile ) {
|
|
461 |
* @return strings Options array
|
462 |
*/
|
463 |
|
464 |
-
function
|
465 |
|
466 |
$options = get_option( 'youtube_embed_list' . $list );
|
467 |
|
468 |
// If there is no list set up, set to default values and save
|
469 |
|
470 |
-
if ( !is_array( $options ) ) { $options =
|
471 |
|
472 |
return $options;
|
473 |
}
|
@@ -483,7 +483,7 @@ function vye_get_list( $list ) {
|
|
483 |
* @param string $list Number of lists
|
484 |
*/
|
485 |
|
486 |
-
function
|
487 |
|
488 |
$list = 1;
|
489 |
while ( $list <= $lists ) {
|
@@ -496,7 +496,7 @@ function vye_set_list( $lists ) {
|
|
496 |
|
497 |
// Because of upgrading, check each option - if not set, apply default
|
498 |
|
499 |
-
$default_array =
|
500 |
|
501 |
$new_options = array_merge( $default_array, $options );
|
502 |
|
@@ -524,7 +524,7 @@ function vye_set_list( $lists ) {
|
|
524 |
* @return array List array
|
525 |
*/
|
526 |
|
527 |
-
function
|
528 |
|
529 |
$default = array(
|
530 |
'name' => 'List ' . $list,
|
@@ -539,7 +539,7 @@ function vye_set_list_defaults( $list ) {
|
|
539 |
*
|
540 |
* Used by the author for testing purposes
|
541 |
*
|
542 |
-
* @since
|
543 |
*
|
544 |
* @param string $checkpoint The last time
|
545 |
* @param string $name The name of the checkpoint
|
18 |
* @return string Extracted ID
|
19 |
*/
|
20 |
|
21 |
+
function ye_extract_id( $id ) {
|
22 |
|
23 |
// Convert and trim video ID characters
|
24 |
|
93 |
* @return string Array containing file details
|
94 |
*/
|
95 |
|
96 |
+
function ye_validate_id( $id ) {
|
97 |
|
98 |
$type = '';
|
99 |
if ( strlen( $id ) == 11 ) {
|
122 |
* @return string Error output
|
123 |
*/
|
124 |
|
125 |
+
function ye_error( $errorin ) {
|
126 |
|
127 |
return '<p style="color: #f00; font-weight: bold;">YouTube Embed: ' . $errorin . "</p>\n";
|
128 |
|
135 |
*
|
136 |
* @since 2.0
|
137 |
*
|
138 |
+
* @uses ye_yes_or_no Convert input to a true or false equivalent
|
139 |
*
|
140 |
* @param string $input Input, usually Yes or No
|
141 |
* @return string 1, 0 or blank, depending on input
|
142 |
*/
|
143 |
|
144 |
+
function ye_convert( $input ) {
|
145 |
|
146 |
+
$input = ye_yes_or_no( $input );
|
147 |
$output = '';
|
148 |
if ( $input === true ) { $output = '1'; }
|
149 |
if ( $input === false ) { $output = '0'; }
|
163 |
* @param string $full_list Show the full list or just those defined?
|
164 |
*/
|
165 |
|
166 |
+
function ye_generate_profile_list( $current, $total, $full_list = false ) {
|
167 |
|
168 |
$loop = 0;
|
169 |
while ( $loop <= $total ) {
|
170 |
|
171 |
// Attempt to get profile
|
172 |
|
173 |
+
$profiles = ye_get_profile( $loop );
|
174 |
|
175 |
// If list is undefined, give it a default name
|
176 |
|
205 |
* @return strings Alternative shortcode name
|
206 |
*/
|
207 |
|
208 |
+
function ye_get_shortcode() {
|
209 |
|
210 |
return get_option( 'youtube_embed_shortcode' );
|
211 |
|
221 |
* @return string Alternative Shortcode
|
222 |
*/
|
223 |
|
224 |
+
function ye_set_shortcode() {
|
225 |
|
226 |
$shortcode = get_option( 'youtube_embed_shortcode' );
|
227 |
|
246 |
* @return strings Options array
|
247 |
*/
|
248 |
|
249 |
+
function ye_get_general_defaults() {
|
250 |
|
251 |
return get_option( 'youtube_embed_general' );
|
252 |
|
262 |
* @return string Options array
|
263 |
*/
|
264 |
|
265 |
+
function ye_set_general_defaults() {
|
266 |
|
267 |
$options = get_option( 'youtube_embed_general' );
|
268 |
|
319 |
* @return strings Profile array
|
320 |
*/
|
321 |
|
322 |
+
function ye_get_profile( $profile ) {
|
323 |
|
324 |
$options = get_option( 'youtube_embed_profile' . $profile );
|
325 |
|
326 |
// If there is no profile set up, set to default values and save
|
327 |
|
328 |
if ( !is_array( $options ) ) {
|
329 |
+
$options = ye_set_profile_defaults( $profile );
|
330 |
$options[ 'default' ] = true;
|
331 |
} else {
|
332 |
$options[ 'default' ] = false;
|
351 |
* @return string Options array
|
352 |
*/
|
353 |
|
354 |
+
function ye_set_profile( $profiles ) {
|
355 |
|
356 |
$profile = 0;
|
357 |
while ( $profile <= $profiles ) {
|
364 |
|
365 |
// Because of upgrading, check each option - if not set, apply default
|
366 |
|
367 |
+
$default_array = ye_set_profile_defaults( $profile );
|
368 |
|
369 |
$new_options = array_merge( $default_array, $options );
|
370 |
|
395 |
* @return array Profile array
|
396 |
*/
|
397 |
|
398 |
+
function ye_set_profile_defaults( $profile ) {
|
399 |
|
400 |
// Set profile name
|
401 |
|
461 |
* @return strings Options array
|
462 |
*/
|
463 |
|
464 |
+
function ye_get_list( $list ) {
|
465 |
|
466 |
$options = get_option( 'youtube_embed_list' . $list );
|
467 |
|
468 |
// If there is no list set up, set to default values and save
|
469 |
|
470 |
+
if ( !is_array( $options ) ) { $options = ye_set_list_defaults( $list ); }
|
471 |
|
472 |
return $options;
|
473 |
}
|
483 |
* @param string $list Number of lists
|
484 |
*/
|
485 |
|
486 |
+
function ye_set_list( $lists ) {
|
487 |
|
488 |
$list = 1;
|
489 |
while ( $list <= $lists ) {
|
496 |
|
497 |
// Because of upgrading, check each option - if not set, apply default
|
498 |
|
499 |
+
$default_array = ye_set_list_defaults( $list );
|
500 |
|
501 |
$new_options = array_merge( $default_array, $options );
|
502 |
|
524 |
* @return array List array
|
525 |
*/
|
526 |
|
527 |
+
function ye_set_list_defaults( $list ) {
|
528 |
|
529 |
$default = array(
|
530 |
'name' => 'List ' . $list,
|
539 |
*
|
540 |
* Used by the author for testing purposes
|
541 |
*
|
542 |
+
* @since 4.1
|
543 |
*
|
544 |
* @param string $checkpoint The last time
|
545 |
* @param string $name The name of the checkpoint
|
includes/shortcodes.php
CHANGED
@@ -15,20 +15,20 @@
|
|
15 |
*
|
16 |
* @since 2.0
|
17 |
*
|
18 |
-
* @uses
|
19 |
*
|
20 |
* @param string $paras Shortcode parameters
|
21 |
* @param string $content Shortcode content
|
22 |
* @return string YouTube embed code
|
23 |
*/
|
24 |
|
25 |
-
function
|
26 |
|
27 |
-
return do_shortcode(
|
28 |
|
29 |
}
|
30 |
|
31 |
-
add_shortcode( 'youtube', '
|
32 |
|
33 |
/**
|
34 |
* Alternative Video shortcode 1
|
@@ -37,22 +37,22 @@ add_shortcode( 'youtube', 'vye_video_shortcode_default' );
|
|
37 |
*
|
38 |
* @since 2.0
|
39 |
*
|
40 |
-
* @uses
|
41 |
*
|
42 |
* @param string $paras Shortcode parameters
|
43 |
* @param string $content Shortcode content
|
44 |
* @return string YouTube embed code
|
45 |
*/
|
46 |
|
47 |
-
function
|
48 |
|
49 |
-
return do_shortcode(
|
50 |
|
51 |
}
|
52 |
|
53 |
-
$shortcode =
|
54 |
|
55 |
-
if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, '
|
56 |
|
57 |
/**
|
58 |
* Video shortcode
|
@@ -61,10 +61,10 @@ if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'vye
|
|
61 |
*
|
62 |
* @since 2.0
|
63 |
*
|
64 |
-
* @uses
|
65 |
-
* @uses
|
66 |
-
* @uses
|
67 |
-
* @uses
|
68 |
*
|
69 |
* @param string $paras Shortcode parameters
|
70 |
* @param string $content Shortcode content
|
@@ -72,7 +72,7 @@ if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'vye
|
|
72 |
* @return string YouTube embed code
|
73 |
*/
|
74 |
|
75 |
-
function
|
76 |
|
77 |
extract( shortcode_atts( array( 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'id' => '', 'url' => '', 'rel' => '', 'fs' => '', 'cc_load_policy' => '', 'iv_load_policy' => '', 'showinfo' => '', 'youtubeurl' => '', 'template' => '', 'list' => '', 'color' => '', 'theme' => '', 'height' => '', 'width' => '', 'dynamic' => '', 'responsive' => '', 'h' => '', 'w' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'html5' => '' ), $paras ) );
|
78 |
|
@@ -82,7 +82,7 @@ function vye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
|
|
82 |
|
83 |
// Get general options
|
84 |
|
85 |
-
$options =
|
86 |
$profile = $options[ 'alt_profile' ];
|
87 |
}
|
88 |
|
@@ -121,11 +121,11 @@ function vye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
|
|
121 |
|
122 |
// Set up Autohide parameter
|
123 |
|
124 |
-
$autohide =
|
125 |
|
126 |
// Create YouTube code
|
127 |
|
128 |
-
$youtube_code =
|
129 |
|
130 |
return apply_filters( 'a3_lazy_load_html', do_shortcode( $youtube_code ) );
|
131 |
}
|
@@ -137,22 +137,22 @@ function vye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_s
|
|
137 |
*
|
138 |
* @since 2.0
|
139 |
*
|
140 |
-
* @uses
|
141 |
*
|
142 |
* @param string $paras Shortcode parameters
|
143 |
* @param string $content Shortcode content
|
144 |
* @return string YouTube thumbnail code
|
145 |
*/
|
146 |
|
147 |
-
function
|
148 |
|
149 |
extract( shortcode_atts( array( 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '', 'nolink' => '' ), $paras ) );
|
150 |
|
151 |
-
return do_shortcode(
|
152 |
|
153 |
}
|
154 |
|
155 |
-
add_shortcode( 'youtube_thumb', '
|
156 |
|
157 |
/**
|
158 |
* Short URL shortcode
|
@@ -161,22 +161,22 @@ add_shortcode( 'youtube_thumb', 'vye_thumbnail_sc' );
|
|
161 |
*
|
162 |
* @since 2.0
|
163 |
*
|
164 |
-
* @uses
|
165 |
*
|
166 |
* @param string $paras Shortcode parameters
|
167 |
* @param string $content Shortcode content
|
168 |
* @return string YouTube short URL code
|
169 |
*/
|
170 |
|
171 |
-
function
|
172 |
|
173 |
extract( shortcode_atts( array( 'id' => '' ), $paras ) );
|
174 |
|
175 |
-
return do_shortcode(
|
176 |
|
177 |
}
|
178 |
|
179 |
-
add_shortcode( 'youtube_url', '
|
180 |
|
181 |
/**
|
182 |
* Download shortcode
|
@@ -185,47 +185,47 @@ add_shortcode( 'youtube_url', 'vye_shorturl_sc' );
|
|
185 |
*
|
186 |
* @since 2.0
|
187 |
*
|
188 |
-
* @uses
|
189 |
*
|
190 |
* @param string $paras Shortcode parameters
|
191 |
* @param string $content Shortcode content
|
192 |
* @return string YouTube download link
|
193 |
*/
|
194 |
|
195 |
-
function
|
196 |
|
197 |
extract( shortcode_atts( array( 'id' => '' ), $paras ) );
|
198 |
|
199 |
-
if ( $id == '' ) { return do_shortcode(
|
200 |
|
201 |
// Extract the ID if a full URL has been specified
|
202 |
|
203 |
-
$id =
|
204 |
|
205 |
// Check what type of video it is and whether it's valid
|
206 |
|
207 |
-
$embed_type =
|
208 |
|
209 |
if ( $embed_type != 'v' ) {
|
210 |
|
211 |
if ( strlen( $embed_type ) > 1 ) {
|
212 |
-
return do_shortcode(
|
213 |
} else {
|
214 |
-
return do_shortcode(
|
215 |
}
|
216 |
|
217 |
}
|
218 |
|
219 |
// Get the download code
|
220 |
|
221 |
-
$link =
|
222 |
|
223 |
// Now return the HTML
|
224 |
|
225 |
return do_shortcode( $link );
|
226 |
}
|
227 |
|
228 |
-
add_shortcode( 'download_video', '
|
229 |
|
230 |
/**
|
231 |
* Convert input to a 1 or 3 equivalent
|
@@ -234,15 +234,15 @@ add_shortcode( 'download_video', 'vye_video_download' );
|
|
234 |
*
|
235 |
* @since 2.0
|
236 |
*
|
237 |
-
* @uses
|
238 |
*
|
239 |
* @param string $input Input, usually Yes or No
|
240 |
* @return string 1, 3 or blank, depending on input
|
241 |
*/
|
242 |
|
243 |
-
function
|
244 |
|
245 |
-
$input =
|
246 |
$output = '';
|
247 |
if ( $input === true ) { $output = '1'; }
|
248 |
if ( $input === false ) { $output = '3'; }
|
@@ -262,7 +262,7 @@ function vye_convert_3( $input ) {
|
|
262 |
* @return string Blank string or boolean true, false
|
263 |
*/
|
264 |
|
265 |
-
function
|
266 |
|
267 |
$input = strtolower( $input );
|
268 |
if ( ( $input === true ) or ( $input == 'true' ) or ( $input == '1' ) or ( $input == 'yes' ) or ( $input == 'on' ) ) { return true; }
|
@@ -282,7 +282,7 @@ function vye_yes_or_no( $input = '' ) {
|
|
282 |
* @return string Autohide numeric equivalent
|
283 |
*/
|
284 |
|
285 |
-
function
|
286 |
|
287 |
$autohide = strtolower( $autohide );
|
288 |
if ( $autohide == 'no' ) { $autohide = '0'; }
|
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 |
|
27 |
+
return do_shortcode( ye_video_shortcode( $paras, $content ) );
|
28 |
|
29 |
}
|
30 |
|
31 |
+
add_shortcode( 'youtube', 'ye_video_shortcode_default' );
|
32 |
|
33 |
/**
|
34 |
* Alternative Video shortcode 1
|
37 |
*
|
38 |
* @since 2.0
|
39 |
*
|
40 |
+
* @uses ye_video_shortcode Action the shortcode parameters
|
41 |
*
|
42 |
* @param string $paras Shortcode parameters
|
43 |
* @param string $content Shortcode content
|
44 |
* @return string YouTube embed code
|
45 |
*/
|
46 |
|
47 |
+
function ye_video_shortcode_alt( $paras = '', $content = '' ) {
|
48 |
|
49 |
+
return do_shortcode( ye_video_shortcode( $paras, $content, '', true ) );
|
50 |
|
51 |
}
|
52 |
|
53 |
+
$shortcode = ye_get_shortcode();
|
54 |
|
55 |
+
if ( isset( $shortcode ) && $shortcode != '' ) { add_shortcode( $shortcode, 'ye_video_shortcode_alt' ); }
|
56 |
|
57 |
/**
|
58 |
* Video shortcode
|
61 |
*
|
62 |
* @since 2.0
|
63 |
*
|
64 |
+
* @uses ye_get_embed_type Get the embed type
|
65 |
+
* @uses ye_set_autohide Get the autohide parameter
|
66 |
+
* @uses ye_get_general_defaults Set default options
|
67 |
+
* @uses ye_generate_youtube_code Generate the embed code
|
68 |
*
|
69 |
* @param string $paras Shortcode parameters
|
70 |
* @param string $content Shortcode content
|
72 |
* @return string YouTube embed code
|
73 |
*/
|
74 |
|
75 |
+
function ye_video_shortcode( $paras = '', $content = '', $callback = '', $alt_shortcode = false ) {
|
76 |
|
77 |
extract( shortcode_atts( array( 'width' => '', 'height' => '', 'fullscreen' => '', 'related' => '', 'autoplay' => '', 'loop' => '', 'start' => '', 'info' => '', 'annotation' => '', 'cc' => '', 'style' => '', 'stop' => '', 'disablekb' => '', 'ratio' => '', 'autohide' => '', 'controls' => '', 'profile' => '', 'id' => '', 'url' => '', 'rel' => '', 'fs' => '', 'cc_load_policy' => '', 'iv_load_policy' => '', 'showinfo' => '', 'youtubeurl' => '', 'template' => '', 'list' => '', 'color' => '', 'theme' => '', 'height' => '', 'width' => '', 'dynamic' => '', 'responsive' => '', 'h' => '', 'w' => '', 'search' => '', 'user' => '', 'modest' => '', 'playsinline' => '', 'html5' => '' ), $paras ) );
|
78 |
|
82 |
|
83 |
// Get general options
|
84 |
|
85 |
+
$options = ye_get_general_defaults();
|
86 |
$profile = $options[ 'alt_profile' ];
|
87 |
}
|
88 |
|
121 |
|
122 |
// Set up Autohide parameter
|
123 |
|
124 |
+
$autohide = ye_set_autohide( $autohide );
|
125 |
|
126 |
// Create YouTube code
|
127 |
|
128 |
+
$youtube_code = ye_generate_youtube_code( $content, $width, $height, ye_convert( $fullscreen ), ye_convert( $related ), ye_convert( $autoplay ), ye_convert( $loop ), $start, ye_convert( $info ), ye_convert_3( $annotation ), ye_convert( $cc ), $style, $stop, ye_convert( $disablekb ), $ratio, $autohide, $controls, $profile, $list, $template, $color, $theme, ye_convert( $responsive ), ye_convert( $search ), ye_convert( $user ), ye_convert( $modest ), ye_convert( $playsinline ), ye_convert( $html5 ) );
|
129 |
|
130 |
return apply_filters( 'a3_lazy_load_html', do_shortcode( $youtube_code ) );
|
131 |
}
|
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 |
|
149 |
extract( shortcode_atts( array( 'style' => '', 'class' => '', 'rel' => '', 'target' => '', 'width' => '', 'height' => '', 'alt' => '', 'version' => '', 'nolink' => '' ), $paras ) );
|
150 |
|
151 |
+
return do_shortcode( ye_generate_thumbnail_code( $content, $style, $class, $rel, $target, $width, $height, $alt, $version, $nolink ) );
|
152 |
|
153 |
}
|
154 |
|
155 |
+
add_shortcode( 'youtube_thumb', 'ye_thumbnail_sc' );
|
156 |
|
157 |
/**
|
158 |
* Short URL shortcode
|
161 |
*
|
162 |
* @since 2.0
|
163 |
*
|
164 |
+
* @uses ye_generate_shorturl_code Generate the code
|
165 |
*
|
166 |
* @param string $paras Shortcode parameters
|
167 |
* @param string $content Shortcode content
|
168 |
* @return string YouTube short URL code
|
169 |
*/
|
170 |
|
171 |
+
function ye_shorturl_sc( $paras = '', $content = '' ) {
|
172 |
|
173 |
extract( shortcode_atts( array( 'id' => '' ), $paras ) );
|
174 |
|
175 |
+
return do_shortcode( ye_generate_shorturl_code( $id ) );
|
176 |
|
177 |
}
|
178 |
|
179 |
+
add_shortcode( 'youtube_url', 'ye_shorturl_sc' );
|
180 |
|
181 |
/**
|
182 |
* Download shortcode
|
185 |
*
|
186 |
* @since 2.0
|
187 |
*
|
188 |
+
* @uses ye_generate_download_code Generate the download code
|
189 |
*
|
190 |
* @param string $paras Shortcode parameters
|
191 |
* @param string $content Shortcode content
|
192 |
* @return string YouTube download link
|
193 |
*/
|
194 |
|
195 |
+
function ye_video_download( $paras = '', $content = '' ) {
|
196 |
|
197 |
extract( shortcode_atts( array( 'id' => '' ), $paras ) );
|
198 |
|
199 |
+
if ( $id == '' ) { return do_shortcode( ye_error( __ ( 'No YouTube ID was found.', 'youtube-embed' ) ) ); }
|
200 |
|
201 |
// Extract the ID if a full URL has been specified
|
202 |
|
203 |
+
$id = ye_extract_id( $id );
|
204 |
|
205 |
// Check what type of video it is and whether it's valid
|
206 |
|
207 |
+
$embed_type = ye_validate_id( $id );
|
208 |
|
209 |
if ( $embed_type != 'v' ) {
|
210 |
|
211 |
if ( strlen( $embed_type ) > 1 ) {
|
212 |
+
return do_shortcode( ye_error( $embed_type ) );
|
213 |
} else {
|
214 |
+
return do_shortcode( ye_error( sprintf( __( 'The YouTube ID of %s is invalid.', 'youtube-embed' ), $id ) ) );
|
215 |
}
|
216 |
|
217 |
}
|
218 |
|
219 |
// Get the download code
|
220 |
|
221 |
+
$link = ye_generate_download_code( $id );
|
222 |
|
223 |
// Now return the HTML
|
224 |
|
225 |
return do_shortcode( $link );
|
226 |
}
|
227 |
|
228 |
+
add_shortcode( 'download_video', 'ye_video_download' );
|
229 |
|
230 |
/**
|
231 |
* Convert input to a 1 or 3 equivalent
|
234 |
*
|
235 |
* @since 2.0
|
236 |
*
|
237 |
+
* @uses ye_yes_or_no Convert input to a true or false equivalent
|
238 |
*
|
239 |
* @param string $input Input, usually Yes or No
|
240 |
* @return string 1, 3 or blank, depending on input
|
241 |
*/
|
242 |
|
243 |
+
function ye_convert_3( $input ) {
|
244 |
|
245 |
+
$input = ye_yes_or_no( $input );
|
246 |
$output = '';
|
247 |
if ( $input === true ) { $output = '1'; }
|
248 |
if ( $input === false ) { $output = '3'; }
|
262 |
* @return string Blank string or boolean true, false
|
263 |
*/
|
264 |
|
265 |
+
function ye_yes_or_no( $input = '' ) {
|
266 |
|
267 |
$input = strtolower( $input );
|
268 |
if ( ( $input === true ) or ( $input == 'true' ) or ( $input == '1' ) or ( $input == 'yes' ) or ( $input == 'on' ) ) { return true; }
|
282 |
* @return string Autohide numeric equivalent
|
283 |
*/
|
284 |
|
285 |
+
function ye_set_autohide( $autohide ) {
|
286 |
|
287 |
$autohide = strtolower( $autohide );
|
288 |
if ( $autohide == 'no' ) { $autohide = '0'; }
|
js/mce4-button.js
CHANGED
File without changes
|
js/mce4-button.min.js
CHANGED
File without changes
|
languages/youtube-embed.mo
CHANGED
Binary file
|
languages/youtube-embed.po
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Vixy YouTube Embed\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2016-
|
6 |
-
"PO-Revision-Date: 2016-
|
7 |
"Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: en_GB\n"
|
@@ -17,7 +17,7 @@ msgstr ""
|
|
17 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
"X-Poedit-SearchPath-0: .\n"
|
19 |
|
20 |
-
#: includes/add-scripts.php:115 includes/admin-config.php:
|
21 |
#: includes/generate-widgets.php:25
|
22 |
msgid "YouTube Embed"
|
23 |
msgstr ""
|
@@ -46,10 +46,6 @@ msgstr ""
|
|
46 |
msgid "About YouTube Embed"
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: includes/admin-config.php:85
|
50 |
-
msgid "YouTube"
|
51 |
-
msgstr ""
|
52 |
-
|
53 |
#: includes/admin-config.php:91 includes/options-profiles.php:116
|
54 |
msgid "YouTube Embed Profiles"
|
55 |
msgstr ""
|
@@ -59,39 +55,39 @@ msgid "YouTube Embed Lists"
|
|
59 |
msgstr ""
|
60 |
|
61 |
#: includes/admin-config.php:107
|
62 |
-
msgid "
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: includes/admin-config.php:
|
66 |
msgid "Video Overlay Ads"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: includes/admin-config.php:
|
70 |
msgid "Video SEO"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: includes/admin-config.php:
|
74 |
-
msgid "
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: includes/admin-config.php:
|
78 |
-
#: includes/admin-config.php:
|
79 |
msgid "Help"
|
80 |
msgstr ""
|
81 |
|
82 |
-
#: includes/admin-config.php:
|
83 |
-
#: includes/admin-config.php:
|
84 |
msgid "Links"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: includes/admin-config.php:
|
88 |
msgid ""
|
89 |
"This screen allows you to select non-specific options for the YouTube Embed "
|
90 |
"plugin. For the default embedding settings, please select the <a href="
|
91 |
"\"admin.php?page=ye-profile-options\">Profiles</a> administration option."
|
92 |
msgstr ""
|
93 |
|
94 |
-
#: includes/admin-config.php:
|
95 |
msgid ""
|
96 |
"This screen allows you to set the options for the default and additional "
|
97 |
"profiles. If you don't specify a specific parameter when displaying your "
|
@@ -100,56 +96,76 @@ msgid ""
|
|
100 |
"required."
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: includes/admin-config.php:
|
104 |
msgid ""
|
105 |
"All settings will work whether the Flash or HTML5 player is used, unless one "
|
106 |
"of the following icons is shown, indicating which format the option works "
|
107 |
"with..."
|
108 |
msgstr ""
|
109 |
|
110 |
-
#: includes/admin-config.php:
|
111 |
msgid "Flash player"
|
112 |
msgstr ""
|
113 |
|
114 |
-
#: includes/admin-config.php:
|
115 |
msgid "HTML5 player"
|
116 |
msgstr ""
|
117 |
|
118 |
-
#: includes/admin-config.php:
|
119 |
msgid ""
|
120 |
"This screen allows you to create lists of YouTube videos, which may be "
|
121 |
"named. These lists can then be used in preference to a single video ID."
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: includes/admin-config.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
msgid ""
|
126 |
"Remember to click the Save Changes button at the bottom of the screen for "
|
127 |
"any changes to take effect."
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: includes/admin-config.php:
|
131 |
msgid "For more information:"
|
132 |
msgstr ""
|
133 |
|
134 |
-
#: includes/admin-config.php:
|
135 |
msgid "YouTube Embed Plugin Documentation"
|
136 |
msgstr ""
|
137 |
|
138 |
-
#: includes/admin-config.php:
|
139 |
msgid "YouTube Player Documentation"
|
140 |
msgstr ""
|
141 |
|
142 |
-
#: includes/admin-config.php:
|
143 |
msgid ""
|
144 |
"For some reason the shortcode <strong>[youtube]</strong> is not working on "
|
145 |
"the main site"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: includes/admin-config.php:
|
149 |
msgid "An alternative plugin is using the <strong>[youtube]</strong> shortcode"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: includes/admin-config.php:
|
153 |
msgid ""
|
154 |
", possibly the <a href=\"admin.php?page=jetpack_modules&activated=true"
|
155 |
"\">Shortcode Embeds module</a> in Jetpack"
|
@@ -254,6 +270,10 @@ msgstr ""
|
|
254 |
msgid "Play one random video"
|
255 |
msgstr ""
|
256 |
|
|
|
|
|
|
|
|
|
257 |
#: includes/options-general.php:65 includes/options-lists.php:22
|
258 |
msgid "Settings Saved."
|
259 |
msgstr ""
|
@@ -598,6 +618,84 @@ msgstr ""
|
|
598 |
msgid "The video ID is invalid"
|
599 |
msgstr ""
|
600 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
601 |
#: includes/options-profiles.php:122
|
602 |
msgid " Profile Saved."
|
603 |
msgstr ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Vixy YouTube Embed\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2016-02-04 12:49-0000\n"
|
6 |
+
"PO-Revision-Date: 2016-02-04 12:49-0000\n"
|
7 |
"Last-Translator: David Artiss <david.artiss@artiss.co.uk>\n"
|
8 |
"Language-Team: \n"
|
9 |
"Language: en_GB\n"
|
17 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
18 |
"X-Poedit-SearchPath-0: .\n"
|
19 |
|
20 |
+
#: includes/add-scripts.php:115 includes/admin-config.php:85
|
21 |
#: includes/generate-widgets.php:25
|
22 |
msgid "YouTube Embed"
|
23 |
msgstr ""
|
46 |
msgid "About YouTube Embed"
|
47 |
msgstr ""
|
48 |
|
|
|
|
|
|
|
|
|
49 |
#: includes/admin-config.php:91 includes/options-profiles.php:116
|
50 |
msgid "YouTube Embed Profiles"
|
51 |
msgstr ""
|
55 |
msgstr ""
|
56 |
|
57 |
#: includes/admin-config.php:107
|
58 |
+
msgid "3rd Party Plugins"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: includes/admin-config.php:115
|
62 |
msgid "Video Overlay Ads"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: includes/admin-config.php:122 includes/options-plugins.php:39
|
66 |
msgid "Video SEO"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: includes/admin-config.php:130
|
70 |
+
msgid "General Settings"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: includes/admin-config.php:210 includes/admin-config.php:232
|
74 |
+
#: includes/admin-config.php:254 includes/admin-config.php:276
|
75 |
msgid "Help"
|
76 |
msgstr ""
|
77 |
|
78 |
+
#: includes/admin-config.php:212 includes/admin-config.php:234
|
79 |
+
#: includes/admin-config.php:256
|
80 |
msgid "Links"
|
81 |
msgstr ""
|
82 |
|
83 |
+
#: includes/admin-config.php:298
|
84 |
msgid ""
|
85 |
"This screen allows you to select non-specific options for the YouTube Embed "
|
86 |
"plugin. For the default embedding settings, please select the <a href="
|
87 |
"\"admin.php?page=ye-profile-options\">Profiles</a> administration option."
|
88 |
msgstr ""
|
89 |
|
90 |
+
#: includes/admin-config.php:303
|
91 |
msgid ""
|
92 |
"This screen allows you to set the options for the default and additional "
|
93 |
"profiles. If you don't specify a specific parameter when displaying your "
|
96 |
"required."
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: includes/admin-config.php:304
|
100 |
msgid ""
|
101 |
"All settings will work whether the Flash or HTML5 player is used, unless one "
|
102 |
"of the following icons is shown, indicating which format the option works "
|
103 |
"with..."
|
104 |
msgstr ""
|
105 |
|
106 |
+
#: includes/admin-config.php:305
|
107 |
msgid "Flash player"
|
108 |
msgstr ""
|
109 |
|
110 |
+
#: includes/admin-config.php:306
|
111 |
msgid "HTML5 player"
|
112 |
msgstr ""
|
113 |
|
114 |
+
#: includes/admin-config.php:311
|
115 |
msgid ""
|
116 |
"This screen allows you to create lists of YouTube videos, which may be "
|
117 |
"named. These lists can then be used in preference to a single video ID."
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: includes/admin-config.php:316
|
121 |
+
msgid ""
|
122 |
+
"This screen lists plugins which have all been tested for compatibility with "
|
123 |
+
"YouTube Embed (and in some cases, specific changes have been made by their "
|
124 |
+
"authors to ensure compatibility. From here you can view their details and "
|
125 |
+
"even install the plugins (where hosted at WordPress.org)."
|
126 |
+
msgstr ""
|
127 |
+
|
128 |
+
#: includes/admin-config.php:317
|
129 |
+
msgid ""
|
130 |
+
"NB. Inclusion here does not provide any guarantee for third party software, "
|
131 |
+
"which includes any support."
|
132 |
+
msgstr ""
|
133 |
+
|
134 |
+
#: includes/admin-config.php:318
|
135 |
+
msgid ""
|
136 |
+
"Some of these plugins will also appear under the YouTube Admin "
|
137 |
+
"administration menu, once activated."
|
138 |
+
msgstr ""
|
139 |
+
|
140 |
+
#: includes/admin-config.php:322
|
141 |
msgid ""
|
142 |
"Remember to click the Save Changes button at the bottom of the screen for "
|
143 |
"any changes to take effect."
|
144 |
msgstr ""
|
145 |
|
146 |
+
#: includes/admin-config.php:327
|
147 |
msgid "For more information:"
|
148 |
msgstr ""
|
149 |
|
150 |
+
#: includes/admin-config.php:328
|
151 |
msgid "YouTube Embed Plugin Documentation"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: includes/admin-config.php:331
|
155 |
msgid "YouTube Player Documentation"
|
156 |
msgstr ""
|
157 |
|
158 |
+
#: includes/admin-config.php:431
|
159 |
msgid ""
|
160 |
"For some reason the shortcode <strong>[youtube]</strong> is not working on "
|
161 |
"the main site"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: includes/admin-config.php:434
|
165 |
msgid "An alternative plugin is using the <strong>[youtube]</strong> shortcode"
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: includes/admin-config.php:441
|
169 |
msgid ""
|
170 |
", possibly the <a href=\"admin.php?page=jetpack_modules&activated=true"
|
171 |
"\">Shortcode Embeds module</a> in Jetpack"
|
270 |
msgid "Play one random video"
|
271 |
msgstr ""
|
272 |
|
273 |
+
#: includes/options-general.php:16
|
274 |
+
msgid "YouTube Embed Settings"
|
275 |
+
msgstr ""
|
276 |
+
|
277 |
#: includes/options-general.php:65 includes/options-lists.php:22
|
278 |
msgid "Settings Saved."
|
279 |
msgstr ""
|
618 |
msgid "The video ID is invalid"
|
619 |
msgstr ""
|
620 |
|
621 |
+
#: includes/options-plugins.php:17
|
622 |
+
msgid "YouTube Embed 3rd Party Plugins"
|
623 |
+
msgstr ""
|
624 |
+
|
625 |
+
#: includes/options-plugins.php:28
|
626 |
+
msgid "Turn Off The Lights"
|
627 |
+
msgstr ""
|
628 |
+
|
629 |
+
#: includes/options-plugins.php:29
|
630 |
+
msgid "Install Turn Out The Lights on your browser"
|
631 |
+
msgstr ""
|
632 |
+
|
633 |
+
#: includes/options-plugins.php:30
|
634 |
+
msgid ""
|
635 |
+
"A browser extension that, with a single click on the lamp button, will fade "
|
636 |
+
"the page dark, with the exception of the embedded video. By clicking on it "
|
637 |
+
"again, the page will return to normal."
|
638 |
+
msgstr ""
|
639 |
+
|
640 |
+
#: includes/options-plugins.php:35
|
641 |
+
msgid "a3 Lazy Load"
|
642 |
+
msgstr ""
|
643 |
+
|
644 |
+
#: includes/options-plugins.php:35
|
645 |
+
msgid ""
|
646 |
+
"Speed up your site and enhance frontend user's visual experience. Fully "
|
647 |
+
"updated to support YouTube Embed."
|
648 |
+
msgstr ""
|
649 |
+
|
650 |
+
#: includes/options-plugins.php:39
|
651 |
+
msgid ""
|
652 |
+
"Premium plugin from Yoast to add your video to Google and other search "
|
653 |
+
"engines."
|
654 |
+
msgstr ""
|
655 |
+
|
656 |
+
#: includes/options-plugins.php:43
|
657 |
+
msgid "WordPress Video Overlay Ads"
|
658 |
+
msgstr ""
|
659 |
+
|
660 |
+
#: includes/options-plugins.php:43
|
661 |
+
msgid ""
|
662 |
+
"This plugin creates an lightbox area over Youtube video embeds. You can "
|
663 |
+
"insert all kinds of html content including banner ads, texts, polls, and add "
|
664 |
+
"any kind of html and javascript code you like."
|
665 |
+
msgstr ""
|
666 |
+
|
667 |
+
#: includes/options-plugins.php:47
|
668 |
+
msgid "YouTube Channel Gallery"
|
669 |
+
msgstr ""
|
670 |
+
|
671 |
+
#: includes/options-plugins.php:47
|
672 |
+
msgid ""
|
673 |
+
"Adds a widget to show a YouTube video and a gallery of thumbnails for a "
|
674 |
+
"YouTube channel."
|
675 |
+
msgstr ""
|
676 |
+
|
677 |
+
#: includes/options-plugins.php:51
|
678 |
+
msgid "YouTube Subscribe Button"
|
679 |
+
msgstr ""
|
680 |
+
|
681 |
+
#: includes/options-plugins.php:51
|
682 |
+
msgid ""
|
683 |
+
"Adds a YouTube subscribe button to your blog so people can subscribe to your "
|
684 |
+
"YouTube channel without leaving your site."
|
685 |
+
msgstr ""
|
686 |
+
|
687 |
+
#: includes/options-plugins.php:84
|
688 |
+
msgid "Install the plugin"
|
689 |
+
msgstr ""
|
690 |
+
|
691 |
+
#: includes/options-plugins.php:87
|
692 |
+
msgid "Plugin installed but not active"
|
693 |
+
msgstr ""
|
694 |
+
|
695 |
+
#: includes/options-plugins.php:89
|
696 |
+
msgid "Plugin installed and active"
|
697 |
+
msgstr ""
|
698 |
+
|
699 |
#: includes/options-profiles.php:122
|
700 |
msgid " Profile Saved."
|
701 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
|
2 |
Contributors: codedart
|
3 |
Tags: download, embed, embedding, iframe, media, play, playlist, responsive, seo, video, widget, youtube
|
4 |
Requires at least: 3.9
|
5 |
-
Tested up to: 4.4.
|
6 |
-
Stable tag: 4.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -21,9 +21,9 @@ YouTube Embed is an incredibly simple, yet powerful, method of embedding YouTube
|
|
21 |
* Automatically generate playlists based on user name or search text
|
22 |
* Create multiple profiles - use them for different videos to get the exact style that you want
|
23 |
* Google compatible metadata is added to the video output - great for SEO!
|
24 |
-
* Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [
|
25 |
* Support for Do Not Track
|
26 |
-
* Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress"), [a3 lazy load](https://wordpress.org/plugins/a3-lazy-load/ "a3 lazy load") and [WordPress Video Overlay Ads](https://wordpress.org/plugins/video-overlay-ads/ "WordPress Video Overlay Ads"). In the case of Video SEO and WordPress Video Overlay Ads, their options will even appear under the YouTube Embed menu for total simplicity!
|
27 |
* Use [Turn Off The Lights](https://www.turnoffthelights.com/ "Turn Off The Lights")? This plugin works with it beautifully.
|
28 |
* [iFrame Resizer](https://github.com/davidjbradshaw/iframe-resizer "iFrame Resizer") and [FitVids.js](https://github.com/davatron5000/FitVids.js "FitVids.js") supported to improve content resizing
|
29 |
* Works "out of the box" with 4K, 60FPS and Chromecast - stream your embedded videos to your TV!
|
@@ -37,7 +37,7 @@ https://www.youtube.com/watch?v=Wc7cvpQS-xQ
|
|
37 |
|
38 |
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.
|
39 |
|
40 |
-
Within the
|
41 |
|
42 |
Although this document contains a lot of information more is available from a series of linked pages, plus as much information as possible is provided on the various administration pages. Whilst on the administration pages, click on the "Help" button in the top right for some useful tips and links. If anything isn't covered and you're unsure of what it does please ask [on the forum](https://wordpress.org/support/plugin/youtube-embed "WordPress Plugins Forum").
|
43 |
|
@@ -79,7 +79,7 @@ Which options are available depends upon the embedding type you're using as well
|
|
79 |
|
80 |
== Alternative Shortcodes ==
|
81 |
|
82 |
-
Within administration, selecting `
|
83 |
|
84 |
There are 2 reasons why you might want to do this...
|
85 |
|
@@ -124,7 +124,7 @@ Be wary that when adding template via a parameter that any HTML included may cau
|
|
124 |
|
125 |
== Profiles ==
|
126 |
|
127 |
-
You've probably already had a look at the default profile, accessible by selecting `Profiles` from the `YouTube` administration menu option. Here you can specify the default option which will apply to any embedded video.
|
128 |
|
129 |
However, in the top right hand corner is a drop-down box and a button marked `Change profile`. Simply select an alternative profile and click the button and you can then edit the options for this alternative profile. You can even name it as well.
|
130 |
|
@@ -136,7 +136,7 @@ By default you have 5 extra profiles - if you wish to have more (or less) this n
|
|
136 |
|
137 |
== Lists ==
|
138 |
|
139 |
-
Although this plugin will play standard YouTube playlists their playback options are limited. Instead you can create your own video lists. Under the `YouTube` administration menu is a sub-menu named `Lists`. Select this and you will be shown a screen where you can type in a list of video IDs (or URLS). You can also provide a name for the list.
|
140 |
|
141 |
When saving the list each video is validated.
|
142 |
|
@@ -152,7 +152,7 @@ An option within the general options screen allows you to change whether this pa
|
|
152 |
|
153 |
== Automatically Generated Playlists ==
|
154 |
|
155 |
-
YouTube
|
156 |
|
157 |
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).
|
158 |
|
@@ -226,11 +226,21 @@ e.g. `[download_video id="Z_sCoHGIpU0" target="_blank"]Download the video[/downl
|
|
226 |
|
227 |
== Further Embedding Options ==
|
228 |
|
229 |
-
Under the `YouTube` administration menu is a sub-menu named `
|
230 |
|
231 |
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).
|
232 |
2. Feed - videos will not appear in feeds so use this option to decide whether you want them to be converted to links and/or thumbnails.
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
== Reviews & Mentions ==
|
235 |
|
236 |
[Your YouTube Plugin is fantastic-it just saved my life on this site. Thank you!](https://twitter.com/AaronWatters/status/237957701605404672?uid=16257815&iid=am-130280753913455685118891763&nid=4+248 "Twitter - Aaron Watters") - Sonic Clamp.
|
@@ -315,10 +325,17 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
|
|
315 |
3. The profiles screen
|
316 |
4. The lists screen - videos have been added and validated. The drop-down help is also shown
|
317 |
5. The default widget options
|
318 |
-
6. The default visual editor options with the YouTube Embed button
|
|
|
319 |
|
320 |
== Changelog ==
|
321 |
|
|
|
|
|
|
|
|
|
|
|
|
|
322 |
= 4.2.1 =
|
323 |
* Bug fix: Quotes were not being dealt with correctly in the template field. Now corrected.
|
324 |
|
@@ -691,6 +708,9 @@ Before reporting it please bear in mind that this plugin uses the standard YouTu
|
|
691 |
|
692 |
== Upgrade Notice ==
|
693 |
|
|
|
|
|
|
|
694 |
= 4.2.1 =
|
695 |
* Important update to fix a bug with the template field
|
696 |
|
1 |
+
=== YouTube Embed ===
|
2 |
Contributors: codedart
|
3 |
Tags: download, embed, embedding, iframe, media, play, playlist, responsive, seo, video, widget, youtube
|
4 |
Requires at least: 3.9
|
5 |
+
Tested up to: 4.4.2
|
6 |
+
Stable tag: 4.3
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
21 |
* Automatically generate playlists based on user name or search text
|
22 |
* Create multiple profiles - use them for different videos to get the exact style that you want
|
23 |
* Google compatible metadata is added to the video output - great for SEO!
|
24 |
+
* Fully internationalized ready for translations. **If you would like to add a translation to his plugin then please [get in touch](http://www.artiss.co.uk/plugin-contact "Contact")**
|
25 |
* Support for Do Not Track
|
26 |
+
* Compatible with [Video SEO for WordPress](http://yoast.com/wordpress/video-seo/ "Video SEO for WordPress"), [a3 lazy load](https://wordpress.org/plugins/a3-lazy-load/ "a3 lazy load") and [WordPress Video Overlay Ads](https://wordpress.org/plugins/video-overlay-ads/ "WordPress Video Overlay Ads") and many more. In the case of Video SEO and WordPress Video Overlay Ads, their options will even appear under the YouTube Embed menu for total simplicity!
|
27 |
* Use [Turn Off The Lights](https://www.turnoffthelights.com/ "Turn Off The Lights")? This plugin works with it beautifully.
|
28 |
* [iFrame Resizer](https://github.com/davidjbradshaw/iframe-resizer "iFrame Resizer") and [FitVids.js](https://github.com/davatron5000/FitVids.js "FitVids.js") supported to improve content resizing
|
29 |
* Works "out of the box" with 4K, 60FPS and Chromecast - stream your embedded videos to your TV!
|
37 |
|
38 |
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.
|
39 |
|
40 |
+
Within the administration area, click on YouTube Embed and then General Settings to view and edit default generic settings for the plugin. Also under the `YouTube Embed` menu (see screenshot 1) you can click on the `Profiles` sub-menu to set the default options which define the output of your videos. Any videos you display (unless overridden by parameters - more on that later) will use the settings from the Profiles screen.
|
41 |
|
42 |
Although this document contains a lot of information more is available from a series of linked pages, plus as much information as possible is provided on the various administration pages. Whilst on the administration pages, click on the "Help" button in the top right for some useful tips and links. If anything isn't covered and you're unsure of what it does please ask [on the forum](https://wordpress.org/support/plugin/youtube-embed "WordPress Plugins Forum").
|
43 |
|
79 |
|
80 |
== Alternative Shortcodes ==
|
81 |
|
82 |
+
Within administration, selecting `General Settings` from the `YouTube Embed` menu will provide a list of general options. One option is named `Alternative Shortcode` and allows you to specify another shortcode that will work exactly the same as the standard shortcode of `[youtube]`.
|
83 |
|
84 |
There are 2 reasons why you might want to do this...
|
85 |
|
124 |
|
125 |
== Profiles ==
|
126 |
|
127 |
+
You've probably already had a look at the default profile, accessible by selecting `Profiles` from the `YouTube Embed` administration menu option. Here you can specify the default option which will apply to any embedded video.
|
128 |
|
129 |
However, in the top right hand corner is a drop-down box and a button marked `Change profile`. Simply select an alternative profile and click the button and you can then edit the options for this alternative profile. You can even name it as well.
|
130 |
|
136 |
|
137 |
== Lists ==
|
138 |
|
139 |
+
Although this plugin will play standard YouTube playlists their playback options are limited. Instead you can create your own video lists. Under the `YouTube Embed` administration menu is a sub-menu named `Lists`. Select this and you will be shown a screen where you can type in a list of video IDs (or URLS). You can also provide a name for the list.
|
140 |
|
141 |
When saving the list each video is validated.
|
142 |
|
152 |
|
153 |
== Automatically Generated Playlists ==
|
154 |
|
155 |
+
YouTube includes options to automatically generate playlists based upon a user name or a search name.
|
156 |
|
157 |
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).
|
158 |
|
226 |
|
227 |
== Further Embedding Options ==
|
228 |
|
229 |
+
Under the `YouTube Embed` administration menu is a sub-menu named `General Settings`. Select this and find the section named `Embedding`. There are 2 options here...
|
230 |
|
231 |
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).
|
232 |
2. Feed - videos will not appear in feeds so use this option to decide whether you want them to be converted to links and/or thumbnails.
|
233 |
|
234 |
+
== Third Party Plugins ==
|
235 |
+
|
236 |
+
From the `YouTube Embed` administration menu there is a `3rd Party Plugins` sub-menu. This will list a number of WordPress plugins that can work alongside YouTube Embed to add extra functionality. From this screen you can view, install and see the status of each plugin.
|
237 |
+
|
238 |
+
In some cases activating these plugins will cause their settings screen to also appear under the `YouTube Embed` menu, for extra convenience.
|
239 |
+
|
240 |
+
**By listing these plugins, we provide no guarantees that they work correctly and we certainly don't provide any support for them.**
|
241 |
+
|
242 |
+
If you'd like your own plugin adding to this list then please [get in touch](http://www.artiss.co.uk/plugin-contact "Contact").
|
243 |
+
|
244 |
== Reviews & Mentions ==
|
245 |
|
246 |
[Your YouTube Plugin is fantastic-it just saved my life on this site. Thank you!](https://twitter.com/AaronWatters/status/237957701605404672?uid=16257815&iid=am-130280753913455685118891763&nid=4+248 "Twitter - Aaron Watters") - Sonic Clamp.
|
325 |
3. The profiles screen
|
326 |
4. The lists screen - videos have been added and validated. The drop-down help is also shown
|
327 |
5. The default widget options
|
328 |
+
6. The default visual editor options with the YouTube Embed button
|
329 |
+
7. The third party plugins menu
|
330 |
|
331 |
== Changelog ==
|
332 |
|
333 |
+
= 4.3 =
|
334 |
+
* Enhancement: Added new "Third Party Plugins" screen, which lists third party plugins that work alongside YouTube Embed, adding extra functionality. You can view, install and see the status of these plugins from this screen
|
335 |
+
* Maintenance: Moved the settings back to the YouTube Embed menu
|
336 |
+
* Maintenance: Renamed menus to be more specific
|
337 |
+
* Maintenance: Updated the function names, which were still using the out-dated "vye" prefix
|
338 |
+
|
339 |
= 4.2.1 =
|
340 |
* Bug fix: Quotes were not being dealt with correctly in the template field. Now corrected.
|
341 |
|
708 |
|
709 |
== Upgrade Notice ==
|
710 |
|
711 |
+
= 4.3 =
|
712 |
+
* Upgrade to add a new third party plugin screen
|
713 |
+
|
714 |
= 4.2.1 =
|
715 |
* Important update to fix a bug with the template field
|
716 |
|
uninstall.php
CHANGED
@@ -45,6 +45,12 @@ if ( is_array( $options ) ) {
|
|
45 |
|
46 |
// Delete all other options
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
delete_site_option( 'youtube_embed_general' );
|
49 |
delete_site_option( 'youtube_embed_shortcode' );
|
50 |
delete_site_option( 'youtube_embed_shortcode_admin' );
|
45 |
|
46 |
// Delete all other options
|
47 |
|
48 |
+
delete_option( 'youtube_embed_general' );
|
49 |
+
delete_option( 'youtube_embed_shortcode' );
|
50 |
+
delete_option( 'youtube_embed_shortcode_admin' );
|
51 |
+
delete_option( 'youtube_embed_shortcode_site' );
|
52 |
+
delete_option( 'youtube_embed_version' );
|
53 |
+
|
54 |
delete_site_option( 'youtube_embed_general' );
|
55 |
delete_site_option( 'youtube_embed_shortcode' );
|
56 |
delete_site_option( 'youtube_embed_shortcode_admin' );
|
youtube-embed.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: YouTube Embed
|
4 |
Plugin URI: https://wordpress.org/plugins/youtube-embed/
|
5 |
Description: Embed YouTube Videos in WordPress
|
6 |
-
Version: 4.
|
7 |
Author: Coded Art
|
8 |
Author URI: http://codedart.co
|
9 |
Text Domain: youtube-embed
|
@@ -19,7 +19,7 @@ Domain Path: /languages
|
|
19 |
* @since 2.0
|
20 |
*/
|
21 |
|
22 |
-
define( 'youtube_embed_version', '4.
|
23 |
|
24 |
$functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
|
25 |
|
3 |
Plugin Name: YouTube Embed
|
4 |
Plugin URI: https://wordpress.org/plugins/youtube-embed/
|
5 |
Description: Embed YouTube Videos in WordPress
|
6 |
+
Version: 4.3
|
7 |
Author: Coded Art
|
8 |
Author URI: http://codedart.co
|
9 |
Text Domain: youtube-embed
|
19 |
* @since 2.0
|
20 |
*/
|
21 |
|
22 |
+
define( 'youtube_embed_version', '4.3' );
|
23 |
|
24 |
$functions_dir = plugin_dir_path( __FILE__ ) . 'includes/';
|
25 |
|