Version Description
- Improved debugging page
Download this release
Release Info
Developer | sutherlandboswell |
Plugin | Video Thumbnails |
Version | 2.10 |
Comparing to | |
See all releases |
Code changes from version 2.9.1 to 2.10
- css/settings.css +80 -0
- js/settings.js +113 -40
- php/class-video-thumbnails-settings.php +145 -99
- readme.txt +4 -1
- screenshot-1.gif +0 -0
- screenshot-2.gif +0 -0
- video-thumbnails.php +2 -2
css/settings.css
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Tests
|
3 |
+
*/
|
4 |
+
|
5 |
+
.video-thumbnails-test {
|
6 |
+
border-bottom: 1px solid #ccc;
|
7 |
+
}
|
8 |
+
|
9 |
+
.video-thumbnails-test .widefat:last-child {
|
10 |
+
margin-bottom: 1em;
|
11 |
+
}
|
12 |
+
|
13 |
+
.video-thumbnails-test .title-test-link {
|
14 |
+
text-decoration: none;
|
15 |
+
}
|
16 |
+
|
17 |
+
.video-thumbnails-test h3.test-title {
|
18 |
+
padding-left: 16px;
|
19 |
+
}
|
20 |
+
|
21 |
+
.video-thumbnails-test h3.test-title::before {
|
22 |
+
content: "\25bc";
|
23 |
+
color: #888;
|
24 |
+
font-size: 75%;
|
25 |
+
display: block;
|
26 |
+
position: absolute;
|
27 |
+
left: 0;
|
28 |
+
-webkit-transition: 0.1s all ease-in-out;
|
29 |
+
-o-transition: 0.1s all ease-in-out;
|
30 |
+
transition: 0.1s all ease-in-out;
|
31 |
+
}
|
32 |
+
.video-thumbnails-test.closed h3.test-title::before {
|
33 |
+
/*content: "\25b6";*/
|
34 |
+
-webkit-transform: rotate(-90deg);
|
35 |
+
-moz-transform: rotate(-90deg);
|
36 |
+
-ms-transform: rotate(-90deg);
|
37 |
+
-o-transform: rotate(-90deg);
|
38 |
+
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
39 |
+
}
|
40 |
+
|
41 |
+
.video-thumbnails-test .video-thumbnails-test-content {
|
42 |
+
display: block;
|
43 |
+
}
|
44 |
+
.video-thumbnails-test.closed .video-thumbnails-test-content {
|
45 |
+
display: none;
|
46 |
+
}
|
47 |
+
|
48 |
+
.video-thumbnails-test .show-hide-test-link {
|
49 |
+
float: right;
|
50 |
+
}
|
51 |
+
|
52 |
+
.video-thumbnails-test .show-hide-test-link .show {
|
53 |
+
display: none;
|
54 |
+
}
|
55 |
+
.video-thumbnails-test .show-hide-test-link .hide {
|
56 |
+
display: inline;
|
57 |
+
}
|
58 |
+
|
59 |
+
.video-thumbnails-test.closed .show-hide-test-link .show {
|
60 |
+
display: inline;
|
61 |
+
}
|
62 |
+
.video-thumbnails-test.closed .show-hide-test-link .hide {
|
63 |
+
display: none;
|
64 |
+
}
|
65 |
+
|
66 |
+
.test-working .test-results {
|
67 |
+
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
68 |
+
filter: alpha(opacity=50);
|
69 |
+
-moz-opacity: 0.5;
|
70 |
+
-khtml-opacity: 0.5;
|
71 |
+
opacity: 0.5;
|
72 |
+
}
|
73 |
+
|
74 |
+
.single-provider-test-results {
|
75 |
+
border-top: 1px solid #e4e4e4;
|
76 |
+
}
|
77 |
+
|
78 |
+
.retest-video-provider {
|
79 |
+
float: right;
|
80 |
+
}
|
js/settings.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
-
// Custom field detection
|
2 |
jQuery(function ($) {
|
3 |
|
|
|
|
|
|
|
4 |
$('#vt_detect_custom_field').on('click',function(e) {
|
5 |
e.preventDefault();
|
6 |
var data = {
|
@@ -23,7 +25,109 @@ jQuery(function ($) {
|
|
23 |
});
|
24 |
});
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
$('#test-video-thumbnail-saving-media').on('click',function(e) {
|
|
|
27 |
$('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
|
28 |
e.preventDefault();
|
29 |
var data = {
|
@@ -35,14 +139,17 @@ jQuery(function ($) {
|
|
35 |
data: data,
|
36 |
success: function(response){
|
37 |
$('#media-test-result').html(response);
|
|
|
38 |
},
|
39 |
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
40 |
$('#media-test-result').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
|
|
41 |
}
|
42 |
});
|
43 |
});
|
44 |
|
45 |
$('#delete-video-thumbnail-test-images').on('click',function(e) {
|
|
|
46 |
$('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
|
47 |
e.preventDefault();
|
48 |
var data = {
|
@@ -54,54 +161,20 @@ jQuery(function ($) {
|
|
54 |
data: data,
|
55 |
success: function(response){
|
56 |
$('#media-test-result').html(response);
|
|
|
57 |
},
|
58 |
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
59 |
$('#media-test-result').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
|
|
60 |
}
|
61 |
});
|
62 |
});
|
63 |
|
64 |
});
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
action: 'video_thumbnail_' + test_type + '_test'
|
70 |
-
};
|
71 |
-
document.getElementById( test_type + '-test' ).innerHTML = video_thumbnails_settings_language.working;
|
72 |
-
jQuery.ajax({
|
73 |
-
type: "POST",
|
74 |
-
url: ajaxurl,
|
75 |
-
data: data,
|
76 |
-
success: function(response){
|
77 |
-
document.getElementById( test_type + '-test' ).innerHTML = response;
|
78 |
-
},
|
79 |
-
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
80 |
-
document.getElementById( test_type + '-test' ).innerHTML = '<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>';
|
81 |
-
}
|
82 |
-
});
|
83 |
-
};
|
84 |
-
|
85 |
-
function test_video_thumbnail_markup_detection() {
|
86 |
-
var data = {
|
87 |
-
action: 'video_thumbnail_markup_detection_test',
|
88 |
-
markup: jQuery('#markup-input').val()
|
89 |
-
};
|
90 |
-
document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
|
91 |
-
jQuery.ajax({
|
92 |
-
type: "POST",
|
93 |
-
url: ajaxurl,
|
94 |
-
data: data,
|
95 |
-
success: function(response){
|
96 |
-
document.getElementById( 'markup-test-result' ).innerHTML = response;
|
97 |
-
},
|
98 |
-
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
99 |
-
document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>';
|
100 |
-
}
|
101 |
-
});
|
102 |
-
}
|
103 |
-
|
104 |
-
// Clear all video thumbnails
|
105 |
function clear_all_video_thumbnails( nonce ) {
|
106 |
var confimation_result = confirm(video_thumbnails_settings_language.clear_all_confirmation);
|
107 |
if (confimation_result){
|
|
|
1 |
jQuery(function ($) {
|
2 |
|
3 |
+
/**
|
4 |
+
* Custom field detection
|
5 |
+
*/
|
6 |
$('#vt_detect_custom_field').on('click',function(e) {
|
7 |
e.preventDefault();
|
8 |
var data = {
|
25 |
});
|
26 |
});
|
27 |
|
28 |
+
/**
|
29 |
+
* Debugging tests
|
30 |
+
*/
|
31 |
+
$('a.toggle-video-thumbnails-test-content').on('click',function(e) {
|
32 |
+
e.preventDefault();
|
33 |
+
$(this).closest('.video-thumbnails-test').toggleClass('closed');
|
34 |
+
});
|
35 |
+
|
36 |
+
function enable_video_thumbnails_tests() {
|
37 |
+
$('.video-thumbnails-test-button').attr('disabled',false);
|
38 |
+
}
|
39 |
+
|
40 |
+
function disable_video_thumbnails_tests() {
|
41 |
+
$('.video-thumbnails-test-button').attr('disabled',true);
|
42 |
+
}
|
43 |
+
|
44 |
+
/* Provider testing */
|
45 |
+
|
46 |
+
function test_single_provider(provider_slug) {
|
47 |
+
disable_video_thumbnails_tests();
|
48 |
+
$('#'+provider_slug+'-provider-test').addClass('test-working');
|
49 |
+
$('#'+provider_slug+'-provider-test .retest-video-provider').val(video_thumbnails_settings_language.working);
|
50 |
+
var data = {
|
51 |
+
action: 'video_thumbnail_provider_test',
|
52 |
+
provider_slug: provider_slug
|
53 |
+
};
|
54 |
+
$.ajax({
|
55 |
+
type: "POST",
|
56 |
+
url: ajaxurl,
|
57 |
+
data: data,
|
58 |
+
success: function(response){
|
59 |
+
$('#'+provider_slug+'-provider-test .test-results').html(response);
|
60 |
+
$('#'+provider_slug+'-provider-test .retest-video-provider').val(video_thumbnails_settings_language.retest);
|
61 |
+
$('#'+provider_slug+'-provider-test').removeClass('test-working');
|
62 |
+
done_testing_single_provider();
|
63 |
+
},
|
64 |
+
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
65 |
+
$('#'+provider_slug+'-provider-test .test-results').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
66 |
+
$('#'+provider_slug+'-provider-test .retest-video-provider').val(video_thumbnails_settings_language.retest);
|
67 |
+
$('#'+provider_slug+'-provider-test').removeClass('test-working');
|
68 |
+
done_testing_single_provider();
|
69 |
+
}
|
70 |
+
});
|
71 |
+
}
|
72 |
+
|
73 |
+
var provider_index = 0;
|
74 |
+
var testing_all_providers = false;
|
75 |
+
|
76 |
+
function done_testing_single_provider() {
|
77 |
+
// If we aren't testing providers, don't do anything
|
78 |
+
if (testing_all_providers==false) {
|
79 |
+
enable_video_thumbnails_tests();
|
80 |
+
}
|
81 |
+
provider_index = provider_index + 1;
|
82 |
+
if (provider_index>=video_thumbnails_provider_slugs.provider_slugs.length) {
|
83 |
+
testing_all_providers = false;
|
84 |
+
enable_video_thumbnails_tests();
|
85 |
+
return;
|
86 |
+
} else {
|
87 |
+
test_single_provider(video_thumbnails_provider_slugs.provider_slugs[provider_index]);
|
88 |
+
}
|
89 |
+
}
|
90 |
+
|
91 |
+
$('#test-all-video-thumbnail-providers').on('click',function(e) {
|
92 |
+
e.preventDefault();
|
93 |
+
$('#provider-test-results').removeClass('hidden');
|
94 |
+
$(this).parent().remove();
|
95 |
+
testing_all_providers = true;
|
96 |
+
test_single_provider(video_thumbnails_provider_slugs.provider_slugs[provider_index]);
|
97 |
+
});
|
98 |
+
|
99 |
+
$('.retest-video-provider').on('click',function(e) {
|
100 |
+
e.preventDefault();
|
101 |
+
test_single_provider( $(this).data('provider-slug') );
|
102 |
+
});
|
103 |
+
|
104 |
+
/* Markup detection testing */
|
105 |
+
$('#test-markup-detection').on('click',function(e) {
|
106 |
+
disable_video_thumbnails_tests();
|
107 |
+
e.preventDefault();
|
108 |
+
var data = {
|
109 |
+
action: 'video_thumbnail_markup_detection_test',
|
110 |
+
markup: $('#markup-input').val()
|
111 |
+
};
|
112 |
+
document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
|
113 |
+
$.ajax({
|
114 |
+
type: "POST",
|
115 |
+
url: ajaxurl,
|
116 |
+
data: data,
|
117 |
+
success: function(response){
|
118 |
+
document.getElementById( 'markup-test-result' ).innerHTML = response;
|
119 |
+
enable_video_thumbnails_tests();
|
120 |
+
},
|
121 |
+
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
122 |
+
document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>';
|
123 |
+
enable_video_thumbnails_tests();
|
124 |
+
}
|
125 |
+
});
|
126 |
+
});
|
127 |
+
|
128 |
+
/* Media download testing */
|
129 |
$('#test-video-thumbnail-saving-media').on('click',function(e) {
|
130 |
+
disable_video_thumbnails_tests();
|
131 |
$('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
|
132 |
e.preventDefault();
|
133 |
var data = {
|
139 |
data: data,
|
140 |
success: function(response){
|
141 |
$('#media-test-result').html(response);
|
142 |
+
enable_video_thumbnails_tests();
|
143 |
},
|
144 |
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
145 |
$('#media-test-result').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
146 |
+
enable_video_thumbnails_tests();
|
147 |
}
|
148 |
});
|
149 |
});
|
150 |
|
151 |
$('#delete-video-thumbnail-test-images').on('click',function(e) {
|
152 |
+
disable_video_thumbnails_tests();
|
153 |
$('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
|
154 |
e.preventDefault();
|
155 |
var data = {
|
161 |
data: data,
|
162 |
success: function(response){
|
163 |
$('#media-test-result').html(response);
|
164 |
+
enable_video_thumbnails_tests();
|
165 |
},
|
166 |
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
167 |
$('#media-test-result').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
168 |
+
enable_video_thumbnails_tests();
|
169 |
}
|
170 |
});
|
171 |
});
|
172 |
|
173 |
});
|
174 |
|
175 |
+
/**
|
176 |
+
* Clear all video thumbnails
|
177 |
+
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
178 |
function clear_all_video_thumbnails( nonce ) {
|
179 |
var confimation_result = confirm(video_thumbnails_settings_language.clear_all_confirmation);
|
180 |
if (confimation_result){
|
php/class-video-thumbnails-settings.php
CHANGED
@@ -46,11 +46,8 @@ class Video_Thumbnails_Settings {
|
|
46 |
add_action( 'wp_ajax_video_thumbnail_image_download_test', array( &$this, 'image_download_test_callback' ) ); // Saving media test
|
47 |
add_action( 'wp_ajax_video_thumbnail_delete_test_images', array( &$this, 'delete_test_images_callback' ) ); // Delete test images
|
48 |
add_action( 'wp_ajax_video_thumbnail_markup_detection_test', array( &$this, 'markup_detection_test_callback' ) ); // Markup input test
|
49 |
-
//
|
50 |
-
|
51 |
-
// Admin scripts
|
52 |
-
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts' ) );
|
53 |
-
}
|
54 |
// Add "Go Pro" call to action to settings footer
|
55 |
add_action( 'video_thumbnails/settings_footer', array( 'Video_Thumbnails_Settings', 'settings_footer' ) );
|
56 |
}
|
@@ -135,14 +132,26 @@ class Video_Thumbnails_Settings {
|
|
135 |
);
|
136 |
}
|
137 |
|
138 |
-
function admin_scripts() {
|
139 |
-
|
140 |
-
|
141 |
-
'
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
146 |
}
|
147 |
|
148 |
function custom_field_detection_callback() {
|
@@ -222,13 +231,11 @@ class Video_Thumbnails_Settings {
|
|
222 |
</tr>
|
223 |
</thead>
|
224 |
<tbody>
|
225 |
-
|
226 |
-
|
227 |
-
$failed = 0;
|
228 |
-
foreach ( $video_thumbnails->providers as $provider ) {
|
229 |
foreach ( $provider->get_test_cases() as $test_case ) {
|
230 |
echo '<tr>';
|
231 |
-
echo '<td><strong>' . $
|
232 |
$markup = apply_filters( 'the_content', $test_case['markup'] );
|
233 |
$result = $video_thumbnails->get_first_thumbnail_url( $markup );
|
234 |
if ( is_wp_error( $result ) ) {
|
@@ -251,10 +258,8 @@ class Video_Thumbnails_Settings {
|
|
251 |
|
252 |
if ( $matched ) {
|
253 |
echo '<td style="color:green;">✔ ' . __( 'Passed', 'video-thumbnails' ) . '</td>';
|
254 |
-
$passed++;
|
255 |
} else {
|
256 |
echo '<td style="color:red;">✗ ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
|
257 |
-
$failed++;
|
258 |
}
|
259 |
echo '<td>';
|
260 |
if ( $result ) {
|
@@ -266,16 +271,8 @@ class Video_Thumbnails_Settings {
|
|
266 |
echo '</td>';
|
267 |
}
|
268 |
echo '</tr>';
|
269 |
-
}
|
270 |
-
} ?>
|
271 |
<tbody>
|
272 |
-
<tfoot>
|
273 |
-
<tr>
|
274 |
-
<th></th>
|
275 |
-
<th><span style="color:green;">✔ <?php echo $passed; ?></span> / <span style="color:red;">✗ <?php echo $failed; ?></span></th>
|
276 |
-
<th></th>
|
277 |
-
</tr>
|
278 |
-
</tfoot>
|
279 |
</table>
|
280 |
<?php die();
|
281 |
} // End provider test callback
|
@@ -496,6 +493,8 @@ class Video_Thumbnails_Settings {
|
|
496 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
|
497 |
}
|
498 |
|
|
|
|
|
499 |
?><div class="wrap">
|
500 |
|
501 |
<div id="icon-options-general" class="icon32"></div><h2><?php _e( 'Video Thumbnails Options', 'video-thumbnails' ); ?></h2>
|
@@ -568,90 +567,137 @@ class Video_Thumbnails_Settings {
|
|
568 |
|
569 |
<p><?php _e( 'Use these tests to help diagnose any problems. Please include results when requesting support.', 'video-thumbnails' ); ?></p>
|
570 |
|
571 |
-
<
|
572 |
|
573 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
574 |
|
575 |
-
<div id="provider-test">
|
576 |
-
<p><input type="submit" class="button-primary" onclick="test_video_thumbnail('provider');" value="<?php esc_attr_e( 'Test Video Providers', 'video-thumbnails' ); ?>" /></p>
|
577 |
</div>
|
|
|
578 |
|
579 |
-
|
580 |
|
581 |
-
|
582 |
|
583 |
-
|
584 |
|
585 |
-
|
586 |
|
587 |
-
|
588 |
|
589 |
-
|
590 |
|
591 |
-
|
592 |
|
593 |
-
|
594 |
|
595 |
-
|
596 |
-
|
597 |
-
<input type="submit" id="delete-video-thumbnail-test-images" class="button" value="<?php esc_attr_e( 'Delete Test Images', 'video-thumbnails' ); ?>" />
|
598 |
-
</p>
|
599 |
|
600 |
-
|
601 |
|
602 |
-
|
603 |
-
|
604 |
-
<
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
-
|
611 |
-
|
612 |
-
|
613 |
-
|
614 |
-
|
615 |
-
|
616 |
-
|
617 |
-
|
618 |
-
|
619 |
-
|
620 |
-
|
621 |
-
|
622 |
-
|
623 |
-
|
624 |
-
|
625 |
-
|
626 |
-
|
627 |
-
|
628 |
-
|
629 |
-
<
|
630 |
-
|
631 |
-
|
632 |
-
|
633 |
-
|
634 |
-
|
635 |
-
|
636 |
-
|
637 |
-
|
638 |
-
|
639 |
-
|
640 |
-
|
641 |
-
|
642 |
-
<
|
643 |
-
|
644 |
-
|
645 |
-
|
646 |
-
|
647 |
-
|
648 |
-
|
649 |
-
|
650 |
-
|
651 |
-
|
652 |
-
|
653 |
-
|
654 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
655 |
|
656 |
<?php
|
657 |
// End debugging
|
46 |
add_action( 'wp_ajax_video_thumbnail_image_download_test', array( &$this, 'image_download_test_callback' ) ); // Saving media test
|
47 |
add_action( 'wp_ajax_video_thumbnail_delete_test_images', array( &$this, 'delete_test_images_callback' ) ); // Delete test images
|
48 |
add_action( 'wp_ajax_video_thumbnail_markup_detection_test', array( &$this, 'markup_detection_test_callback' ) ); // Markup input test
|
49 |
+
// Admin scripts
|
50 |
+
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts' ) );
|
|
|
|
|
|
|
51 |
// Add "Go Pro" call to action to settings footer
|
52 |
add_action( 'video_thumbnails/settings_footer', array( 'Video_Thumbnails_Settings', 'settings_footer' ) );
|
53 |
}
|
132 |
);
|
133 |
}
|
134 |
|
135 |
+
function admin_scripts( $hook ) {
|
136 |
+
if ( 'settings_page_video_thumbnails' == $hook ) {
|
137 |
+
wp_enqueue_style( 'video-thumbnails-settings-css', plugins_url( '/css/settings.css', VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php' ), false, VIDEO_THUMBNAILS_VERSION );
|
138 |
+
wp_enqueue_script( 'video_thumbnails_settings', plugins_url( 'js/settings.js' , VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php' ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
|
139 |
+
wp_localize_script( 'video_thumbnails_settings', 'video_thumbnails_settings_language', array(
|
140 |
+
'detection_failed' => __( 'We were unable to find a video in the custom fields of your most recently updated post.', 'video-thumbnails' ),
|
141 |
+
'working' => __( 'Working...', 'video-thumbnails' ),
|
142 |
+
'retest' => __( 'Retest', 'video-thumbnails' ),
|
143 |
+
'ajax_error' => __( 'AJAX Error:', 'video-thumbnails' ),
|
144 |
+
'clear_all_confirmation' => __( 'Are you sure you want to clear all video thumbnails? This cannot be undone.', 'video-thumbnails' ),
|
145 |
+
) );
|
146 |
+
global $video_thumbnails;
|
147 |
+
$provider_slugs = array();
|
148 |
+
foreach ( $video_thumbnails->providers as $provider ) {
|
149 |
+
$provider_slugs[] = $provider->service_slug;
|
150 |
+
}
|
151 |
+
wp_localize_script( 'video_thumbnails_settings', 'video_thumbnails_provider_slugs', array(
|
152 |
+
'provider_slugs' => $provider_slugs
|
153 |
+
) );
|
154 |
+
}
|
155 |
}
|
156 |
|
157 |
function custom_field_detection_callback() {
|
231 |
</tr>
|
232 |
</thead>
|
233 |
<tbody>
|
234 |
+
<?php
|
235 |
+
$provider = $video_thumbnails->providers[$_POST['provider_slug']];
|
|
|
|
|
236 |
foreach ( $provider->get_test_cases() as $test_case ) {
|
237 |
echo '<tr>';
|
238 |
+
echo '<td><strong>' . $test_case['name'] . '</strong></td>';
|
239 |
$markup = apply_filters( 'the_content', $test_case['markup'] );
|
240 |
$result = $video_thumbnails->get_first_thumbnail_url( $markup );
|
241 |
if ( is_wp_error( $result ) ) {
|
258 |
|
259 |
if ( $matched ) {
|
260 |
echo '<td style="color:green;">✔ ' . __( 'Passed', 'video-thumbnails' ) . '</td>';
|
|
|
261 |
} else {
|
262 |
echo '<td style="color:red;">✗ ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
|
|
|
263 |
}
|
264 |
echo '<td>';
|
265 |
if ( $result ) {
|
271 |
echo '</td>';
|
272 |
}
|
273 |
echo '</tr>';
|
274 |
+
} ?>
|
|
|
275 |
<tbody>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
</table>
|
277 |
<?php die();
|
278 |
} // End provider test callback
|
493 |
wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
|
494 |
}
|
495 |
|
496 |
+
global $video_thumbnails;
|
497 |
+
|
498 |
?><div class="wrap">
|
499 |
|
500 |
<div id="icon-options-general" class="icon32"></div><h2><?php _e( 'Video Thumbnails Options', 'video-thumbnails' ); ?></h2>
|
567 |
|
568 |
<p><?php _e( 'Use these tests to help diagnose any problems. Please include results when requesting support.', 'video-thumbnails' ); ?></p>
|
569 |
|
570 |
+
<div class="video-thumbnails-test closed">
|
571 |
|
572 |
+
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
573 |
+
|
574 |
+
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Test Video Providers', 'video-thumbnails' ); ?></h3></a>
|
575 |
+
|
576 |
+
<div class="video-thumbnails-test-content">
|
577 |
+
|
578 |
+
<p><?php _e( 'This test automatically searches a sample for every type of video supported and compares it to the expected value. Sometimes tests may fail due to API rate limits.', 'video-thumbnails' ); ?></p>
|
579 |
+
|
580 |
+
<p><input type="submit" class="button-primary video-thumbnails-test-button" id="test-all-video-thumbnail-providers" value="<?php esc_attr_e( 'Test Video Providers', 'video-thumbnails' ); ?>" /></p>
|
581 |
+
|
582 |
+
<div id="provider-test-results" class="hidden">
|
583 |
+
<?php
|
584 |
+
foreach ( $video_thumbnails->providers as $provider ) {
|
585 |
+
echo '<div id="' . $provider->service_slug . '-provider-test" class="single-provider-test-results">';
|
586 |
+
echo '<h3>' . $provider->service_name . ' <input type="submit" data-provider-slug="' . $provider->service_slug . '" class="button-primary retest-video-provider video-thumbnails-test-button" value="' . esc_attr__( 'Waiting...', 'video-thumbnails' ) . '" /></h3>';
|
587 |
+
echo '<div class="test-results"></div>';
|
588 |
+
echo '</div>';
|
589 |
+
}
|
590 |
+
?>
|
591 |
+
</div>
|
592 |
+
|
593 |
+
</div><!-- /.video-thumbnails-test-content -->
|
594 |
|
|
|
|
|
595 |
</div>
|
596 |
+
<div class="video-thumbnails-test closed">
|
597 |
|
598 |
+
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
599 |
|
600 |
+
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Test Markup for Video', 'video-thumbnails' ); ?></h3></a>
|
601 |
|
602 |
+
<div class="video-thumbnails-test-content">
|
603 |
|
604 |
+
<p><?php _e( 'Copy and paste an embed code below to see if a video is detected.', 'video-thumbnails' ); ?></p>
|
605 |
|
606 |
+
<textarea id="markup-input" cols="50" rows="5"></textarea>
|
607 |
|
608 |
+
<p><input type="submit" id="test-markup-detection" class="button-primary video-thumbnails-test-button" value="<?php esc_attr_e( 'Scan For Thumbnail', 'video-thumbnails' ); ?>" /></p>
|
609 |
|
610 |
+
<div id="markup-test-result"></div>
|
611 |
|
612 |
+
</div><!-- /.video-thumbnails-test-content -->
|
613 |
|
614 |
+
</div>
|
615 |
+
<div class="video-thumbnails-test closed">
|
|
|
|
|
616 |
|
617 |
+
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
618 |
|
619 |
+
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Test Saving to Media Library', 'video-thumbnails' ); ?></h3></a>
|
620 |
+
|
621 |
+
<div class="video-thumbnails-test-content">
|
622 |
+
|
623 |
+
<p><?php _e( 'This test checks for issues with the process of saving a remote thumbnail to your local media library.', 'video-thumbnails' ); ?></p>
|
624 |
+
|
625 |
+
<p><?php _e( 'Also be sure to test that you can manually upload an image to your site. If you\'re unable to upload images, you may need to <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a>.', 'video-thumbnails' ); ?></p>
|
626 |
+
|
627 |
+
<p>
|
628 |
+
<input type="submit" id="test-video-thumbnail-saving-media" class="button-primary video-thumbnails-test-button" value="<?php esc_attr_e( 'Download Test Image', 'video-thumbnails' ); ?>" />
|
629 |
+
<input type="submit" id="delete-video-thumbnail-test-images" class="button video-thumbnails-test-button" value="<?php esc_attr_e( 'Delete Test Images', 'video-thumbnails' ); ?>" />
|
630 |
+
</p>
|
631 |
+
|
632 |
+
<div id="media-test-result"></div>
|
633 |
+
|
634 |
+
</div><!-- /.video-thumbnails-test-content -->
|
635 |
+
|
636 |
+
</div>
|
637 |
+
<div class="video-thumbnails-test closed">
|
638 |
+
|
639 |
+
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
640 |
+
|
641 |
+
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Installation Information', 'video-thumbnails' ); ?></h3></a>
|
642 |
+
|
643 |
+
<div class="video-thumbnails-test-content">
|
644 |
+
|
645 |
+
<table class="widefat">
|
646 |
+
<thead>
|
647 |
+
<tr>
|
648 |
+
<th></th>
|
649 |
+
<th></th>
|
650 |
+
<th></th>
|
651 |
+
</tr>
|
652 |
+
</thead>
|
653 |
+
<tbody>
|
654 |
+
<tr>
|
655 |
+
<td><strong><?php _e( 'WordPress Version', 'video-thumbnails' ); ?></strong></td>
|
656 |
+
<td><?php echo get_bloginfo( 'version' ); ?></td>
|
657 |
+
<td></td>
|
658 |
+
</tr>
|
659 |
+
<tr>
|
660 |
+
<td><strong><?php _e( 'Video Thumbnails Version', 'video-thumbnails' ); ?></strong></td>
|
661 |
+
<td><?php echo VIDEO_THUMBNAILS_VERSION; ?></td>
|
662 |
+
<td></td>
|
663 |
+
</tr>
|
664 |
+
<tr>
|
665 |
+
<td><strong><?php _e( 'Video Thumbnails Settings Version', 'video-thumbnails' ); ?></strong></td>
|
666 |
+
<td><?php echo $this->options['version']; ?></td>
|
667 |
+
<td></td>
|
668 |
+
</tr>
|
669 |
+
<tr>
|
670 |
+
<td><strong><?php _e( 'PHP Version', 'video-thumbnails' ); ?></strong></td>
|
671 |
+
<td><?php echo PHP_VERSION; ?></td>
|
672 |
+
<td></td>
|
673 |
+
</tr>
|
674 |
+
<tr>
|
675 |
+
<td><strong><?php _e( 'Post Thumbnails', 'video-thumbnails' ); ?></strong></td>
|
676 |
+
<td><?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?><span style="color:green">✔</span> <?php _e( 'Your theme supports post thumbnails.', 'video-thumbnails' ); ?><?php else: ?><span style="color:red">✖</span> <?php _e( 'Your theme does not support post thumbnails, you\'ll need to make modifications or switch to a different theme. <a href="http://codex.wordpress.org/Post_Thumbnails">More info</a>', 'video-thumbnails' ); ?><?php endif; ?></td>
|
677 |
+
<td></td>
|
678 |
+
</tr>
|
679 |
+
<tr>
|
680 |
+
<td><strong><?php _e( 'Video Providers', 'video-thumbnails' ); ?></strong></td>
|
681 |
+
<td>
|
682 |
+
<?php global $video_thumbnails; ?>
|
683 |
+
<?php $provider_names = array(); foreach ( $video_thumbnails->providers as $provider ) { $provider_names[] = $provider->service_name; }; ?>
|
684 |
+
<strong><?php echo count( $video_thumbnails->providers ); ?></strong>: <?php echo implode( ', ', $provider_names ); ?>
|
685 |
+
</td>
|
686 |
+
<td></td>
|
687 |
+
</tr>
|
688 |
+
</tbody>
|
689 |
+
<tfoot>
|
690 |
+
<tr>
|
691 |
+
<th></th>
|
692 |
+
<th></th>
|
693 |
+
<th></th>
|
694 |
+
</tr>
|
695 |
+
</tfoot>
|
696 |
+
</table>
|
697 |
+
|
698 |
+
</div><!-- /.video-thumbnails-test-content -->
|
699 |
+
|
700 |
+
</div>
|
701 |
|
702 |
<?php
|
703 |
// End debugging
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wie.ly/u/donate
|
|
4 |
Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.9
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
@@ -132,6 +132,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
|
|
132 |
|
133 |
== Changelog ==
|
134 |
|
|
|
|
|
|
|
135 |
= 2.9.1 =
|
136 |
* Improved provider class extensibility
|
137 |
|
4 |
Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.9
|
7 |
+
Stable tag: 2.10
|
8 |
|
9 |
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
10 |
|
132 |
|
133 |
== Changelog ==
|
134 |
|
135 |
+
= 2.10 =
|
136 |
+
* Improved debugging page
|
137 |
+
|
138 |
= 2.9.1 =
|
139 |
* Improved provider class extensibility
|
140 |
|
screenshot-1.gif
DELETED
Binary file
|
screenshot-2.gif
DELETED
Binary file
|
video-thumbnails.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://refactored.co/plugins/video-thumbnails
|
|
5 |
Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku, and Rutube.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
-
Version: 2.
|
9 |
License: GPL2
|
10 |
Text Domain: video-thumbnails
|
11 |
Domain Path: /languages/
|
@@ -30,7 +30,7 @@ Domain Path: /languages/
|
|
30 |
|
31 |
define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
|
32 |
define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
|
33 |
-
define( 'VIDEO_THUMBNAILS_VERSION', '2.
|
34 |
|
35 |
// Providers
|
36 |
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );
|
5 |
Description: Automatically retrieve video thumbnails for your posts and display them in your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku, and Rutube.
|
6 |
Author: Sutherland Boswell
|
7 |
Author URI: http://sutherlandboswell.com
|
8 |
+
Version: 2.10
|
9 |
License: GPL2
|
10 |
Text Domain: video-thumbnails
|
11 |
Domain Path: /languages/
|
30 |
|
31 |
define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
|
32 |
define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
|
33 |
+
define( 'VIDEO_THUMBNAILS_VERSION', '2.10' );
|
34 |
|
35 |
// Providers
|
36 |
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );
|