Video Thumbnails - Version 2.7

Version Description

  • Video Thumbnails is now translation ready and looking for volunteers
Download this release

Release Info

Developer sutherlandboswell
Plugin Icon 128x128 Video Thumbnails
Version 2.7
Comparing to
See all releases

Code changes from version 2.6.3 to 2.7

css/bulk.css CHANGED
@@ -55,10 +55,19 @@
55
  }
56
 
57
  #vt-bulk-scan-results .stats {
 
58
  margin-top: 1em;
59
  text-align: center;
60
  }
61
 
 
 
 
 
 
 
 
 
62
  #vt-bulk-scan-results .log {
63
  overflow: auto;
64
  height: 250px;
55
  }
56
 
57
  #vt-bulk-scan-results .stats {
58
+ width: 100%;
59
  margin-top: 1em;
60
  text-align: center;
61
  }
62
 
63
+ #vt-bulk-scan-results .stats .scanned,
64
+ #vt-bulk-scan-results .stats .found-new,
65
+ #vt-bulk-scan-results .stats .found-existing {
66
+ font-size: 24px;
67
+ font-weight: bold;
68
+ width: 33%;
69
+ }
70
+
71
  #vt-bulk-scan-results .log {
72
  overflow: auto;
73
  height: 250px;
js/bulk.js CHANGED
@@ -12,6 +12,7 @@ jQuery(function ($) {
12
  this.delayTimer = false;
13
  this.logList = $('#vt-bulk-scan-results .log');
14
  this.progressBar = $('#vt-bulk-scan-results .progress-bar');
 
15
  }
16
 
17
  VideoThumbnailsBulkScanner.prototype.log = function(text) {
@@ -34,10 +35,15 @@ jQuery(function ($) {
34
  };
35
  var self = this;
36
  this.disableSubmit();
37
- $('#queue-count').text('working...');
38
  $.post(ajaxurl, data, function(response) {
39
  self.posts = $.parseJSON( response );
40
- $('#queue-count').text(self.posts.length+' posts in queue');
 
 
 
 
 
41
  if ( self.posts.length > 0 ) {
42
  self.enableSubmit();
43
  }
@@ -48,12 +54,12 @@ jQuery(function ($) {
48
  this.disableSubmit();
49
  this.paused = false;
50
  if ( this.currentItem == 0 ) {
51
- this.log( 'Started Scanning' );
52
  this.progressBar.show();
53
  this.resetProgressBar();
54
  $('#video-thumbnails-bulk-scan-options').slideUp();
55
  } else {
56
- this.log( 'Resumed Scanning' );
57
  }
58
  this.scanCurrentItem();
59
  };
@@ -61,7 +67,7 @@ jQuery(function ($) {
61
  VideoThumbnailsBulkScanner.prototype.pauseScan = function() {
62
  this.clearSchedule();
63
  this.paused = true;
64
- this.log( 'Paused Scanning' );
65
  };
66
 
67
  VideoThumbnailsBulkScanner.prototype.toggleScan = function() {
@@ -73,7 +79,12 @@ jQuery(function ($) {
73
  };
74
 
75
  VideoThumbnailsBulkScanner.prototype.scanCompleted = function() {
76
- this.log( 'Done! Scanned ' + this.posts.length + ' posts' );
 
 
 
 
 
77
  };
78
 
79
  VideoThumbnailsBulkScanner.prototype.resetProgressBar = function() {
@@ -88,7 +99,7 @@ jQuery(function ($) {
88
  VideoThumbnailsBulkScanner.prototype.updateProgressBar = function() {
89
  console.log( percentage = ( this.currentItem + 1 ) / this.posts.length );
90
  if ( percentage == 1 ) {
91
- progressText = 'Done!';
92
  this.scanCompleted();
93
  } else {
94
  progressText = Math.round(percentage*100)+'%';
@@ -98,8 +109,9 @@ jQuery(function ($) {
98
  };
99
 
100
  VideoThumbnailsBulkScanner.prototype.updateCounter = function() {
101
- $('#vt-bulk-scan-results .stats .scanned').html( 'Scanned ' + (this.currentItem+1) + ' of ' + this.posts.length );
102
- $('#vt-bulk-scan-results .stats .found').html( 'Found ' + this.newThumbnails + ' new thumbnails and ' + this.existingThumbnails + ' existing thumbnails' );
 
103
  }
104
 
105
  VideoThumbnailsBulkScanner.prototype.updateStats = function() {
@@ -127,7 +139,7 @@ jQuery(function ($) {
127
 
128
  if ( this.currentItem < this.posts.length ) {
129
 
130
- this.log( '[' + this.posts[this.currentItem] + '] Scanning ' + (this.currentItem+1) + ' of ' + this.posts.length );
131
 
132
  var data = {
133
  action: 'video_thumbnails_get_thumbnail_for_post',
@@ -141,9 +153,14 @@ jQuery(function ($) {
141
  success: function(response) {
142
  var result = $.parseJSON( response );
143
  if ( result.length == 0 ) {
144
- self.log( '[' + self.posts[self.currentItem] + '] No thumbnail' );
145
  } else {
146
- self.log( '[' + self.posts[self.currentItem] + '] ' + result.url + ' (' + result.type + ')' );
 
 
 
 
 
147
  if ( result.type == 'new' ) {
148
  self.newThumbnails++;
149
  } else {
@@ -154,7 +171,7 @@ jQuery(function ($) {
154
  self.scheduleNextItem();
155
  },
156
  error: function(jqXHR, textStatus, errorThrown) {
157
- self.log( '[' + self.posts[self.currentItem] + '] Error: ' + errorThrown );
158
  self.updateStats();
159
  self.scheduleNextItem();
160
  }
12
  this.delayTimer = false;
13
  this.logList = $('#vt-bulk-scan-results .log');
14
  this.progressBar = $('#vt-bulk-scan-results .progress-bar');
15
+ this.language = video_thumbnails_bulk_language;
16
  }
17
 
18
  VideoThumbnailsBulkScanner.prototype.log = function(text) {
35
  };
36
  var self = this;
37
  this.disableSubmit();
38
+ $('#queue-count').text(this.language.working);
39
  $.post(ajaxurl, data, function(response) {
40
  self.posts = $.parseJSON( response );
41
+ if ( self.posts.length == 1 ) {
42
+ queueText = self.language.queue_singular;
43
+ } else {
44
+ queueText = self.language.queue_plural.replace('%d',self.posts.length);
45
+ }
46
+ $('#queue-count').text(queueText);
47
  if ( self.posts.length > 0 ) {
48
  self.enableSubmit();
49
  }
54
  this.disableSubmit();
55
  this.paused = false;
56
  if ( this.currentItem == 0 ) {
57
+ this.log( this.language.started );
58
  this.progressBar.show();
59
  this.resetProgressBar();
60
  $('#video-thumbnails-bulk-scan-options').slideUp();
61
  } else {
62
+ this.log( this.language.resumed );
63
  }
64
  this.scanCurrentItem();
65
  };
67
  VideoThumbnailsBulkScanner.prototype.pauseScan = function() {
68
  this.clearSchedule();
69
  this.paused = true;
70
+ this.log( this.language.paused );
71
  };
72
 
73
  VideoThumbnailsBulkScanner.prototype.toggleScan = function() {
79
  };
80
 
81
  VideoThumbnailsBulkScanner.prototype.scanCompleted = function() {
82
+ if ( this.posts.length == 1 ) {
83
+ message = this.language.done + ' ' + this.language.final_count_singular;
84
+ } else {
85
+ message = this.language.done + ' ' + this.language.final_count_plural.replace('%d',this.posts.length);
86
+ }
87
+ this.log( message );
88
  };
89
 
90
  VideoThumbnailsBulkScanner.prototype.resetProgressBar = function() {
99
  VideoThumbnailsBulkScanner.prototype.updateProgressBar = function() {
100
  console.log( percentage = ( this.currentItem + 1 ) / this.posts.length );
101
  if ( percentage == 1 ) {
102
+ progressText = this.language.done;
103
  this.scanCompleted();
104
  } else {
105
  progressText = Math.round(percentage*100)+'%';
109
  };
110
 
111
  VideoThumbnailsBulkScanner.prototype.updateCounter = function() {
112
+ $('#vt-bulk-scan-results .stats .scanned').html( (this.currentItem+1) + '/' + this.posts.length );
113
+ $('#vt-bulk-scan-results .stats .found-new').html( this.newThumbnails );
114
+ $('#vt-bulk-scan-results .stats .found-existing').html( this.existingThumbnails );
115
  }
116
 
117
  VideoThumbnailsBulkScanner.prototype.updateStats = function() {
139
 
140
  if ( this.currentItem < this.posts.length ) {
141
 
142
+ this.log( '[ID: ' + this.posts[this.currentItem] + '] ' + this.language.scanning_of.replace('%1$s',this.currentItem+1).replace('%2$s',this.posts.length) );
143
 
144
  var data = {
145
  action: 'video_thumbnails_get_thumbnail_for_post',
153
  success: function(response) {
154
  var result = $.parseJSON( response );
155
  if ( result.length == 0 ) {
156
+ self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + self.language.no_thumbnail );
157
  } else {
158
+ if ( result.type == 'new' ) {
159
+ resultText = self.language.new_thumbnail;
160
+ } else {
161
+ resultText = self.language.existing_thumbnail;
162
+ }
163
+ self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + resultText + ' ' + result.url );
164
  if ( result.type == 'new' ) {
165
  self.newThumbnails++;
166
  } else {
171
  self.scheduleNextItem();
172
  },
173
  error: function(jqXHR, textStatus, errorThrown) {
174
+ self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + self.language.error + ' ' + errorThrown );
175
  self.updateStats();
176
  self.scheduleNextItem();
177
  }
js/settings.js CHANGED
@@ -10,7 +10,7 @@ jQuery(function ($) {
10
  if (response) {
11
  $('#custom_field').val(response);
12
  } else {
13
- alert('We were unable to find a video in the custom fields of your most recently updated post.');
14
  }
15
  });
16
  });
@@ -22,7 +22,7 @@ function test_video_thumbnail( test_type ) {
22
  var data = {
23
  action: 'video_thumbnail_' + test_type + '_test'
24
  };
25
- document.getElementById( test_type + '-test' ).innerHTML = 'Working...';
26
  jQuery.post(ajaxurl, data, function(response){
27
  document.getElementById( test_type + '-test' ).innerHTML = response;
28
  });
@@ -33,7 +33,7 @@ function test_video_thumbnail_markup_detection() {
33
  action: 'video_thumbnail_markup_detection_test',
34
  markup: jQuery('#markup-input').val()
35
  };
36
- document.getElementById( 'markup-test-result' ).innerHTML = '<p>Working...</p>';
37
  jQuery.post(ajaxurl, data, function(response){
38
  document.getElementById( 'markup-test-result' ).innerHTML = response;
39
  });
@@ -41,13 +41,13 @@ function test_video_thumbnail_markup_detection() {
41
 
42
  // Clear all video thumbnails
43
  function clear_all_video_thumbnails( nonce ) {
44
- var confimation_result = confirm("Are you sure you want to clear all video thumbnails? This cannot be undone.");
45
  if (confimation_result){
46
  var data = {
47
  action: 'clear_all_video_thumbnails',
48
  nonce: nonce
49
  };
50
- document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = '<p>Working...</p>';
51
  jQuery.post(ajaxurl, data, function(response){
52
  document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = response;
53
  });
10
  if (response) {
11
  $('#custom_field').val(response);
12
  } else {
13
+ alert(video_thumbnails_settings_language.detection_failed);
14
  }
15
  });
16
  });
22
  var data = {
23
  action: 'video_thumbnail_' + test_type + '_test'
24
  };
25
+ document.getElementById( test_type + '-test' ).innerHTML = video_thumbnails_settings_language.working;
26
  jQuery.post(ajaxurl, data, function(response){
27
  document.getElementById( test_type + '-test' ).innerHTML = response;
28
  });
33
  action: 'video_thumbnail_markup_detection_test',
34
  markup: jQuery('#markup-input').val()
35
  };
36
+ document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
37
  jQuery.post(ajaxurl, data, function(response){
38
  document.getElementById( 'markup-test-result' ).innerHTML = response;
39
  });
41
 
42
  // Clear all video thumbnails
43
  function clear_all_video_thumbnails( nonce ) {
44
+ var confimation_result = confirm(video_thumbnails_settings_language.clear_all_confirmation);
45
  if (confimation_result){
46
  var data = {
47
  action: 'clear_all_video_thumbnails',
48
  nonce: nonce
49
  };
50
+ document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
51
  jQuery.post(ajaxurl, data, function(response){
52
  document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = response;
53
  });
languages/video-thumbnails.pot ADDED
@@ -0,0 +1,627 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2014 Video Thumbnails
2
+ # This file is distributed under the same license as the Video Thumbnails package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Video Thumbnails 2.6.3\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/video-thumbnails\n"
7
+ "POT-Creation-Date: 2014-03-11 22:51:09+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
+
15
+ #: php/class-video-thumbnails-settings.php:129
16
+ #: php/class-video-thumbnails-settings.php:464
17
+ msgid "Video Thumbnails Options"
18
+ msgstr ""
19
+
20
+ #. #-#-#-#-# plugin.pot (Video Thumbnails 2.6.3) #-#-#-#-#
21
+ #. Plugin Name of the plugin/theme
22
+ #: php/class-video-thumbnails-settings.php:130
23
+ msgid "Video Thumbnails"
24
+ msgstr ""
25
+
26
+ #: php/class-video-thumbnails-settings.php:140
27
+ msgid ""
28
+ "We were unable to find a video in the custom fields of your most recently "
29
+ "updated post."
30
+ msgstr ""
31
+
32
+ #: php/class-video-thumbnails-settings.php:141 video-thumbnails.php:101
33
+ #: video-thumbnails.php:411
34
+ msgid "Working..."
35
+ msgstr ""
36
+
37
+ #: php/class-video-thumbnails-settings.php:142
38
+ msgid ""
39
+ "Are you sure you want to clear all video thumbnails? This cannot be undone."
40
+ msgstr ""
41
+
42
+ #: php/class-video-thumbnails-settings.php:185
43
+ msgid "1 attachment deleted"
44
+ msgid_plural "%s attachments deleted"
45
+ msgstr[0] ""
46
+ msgstr[1] ""
47
+
48
+ #: php/class-video-thumbnails-settings.php:188
49
+ msgid "1 custom field cleared"
50
+ msgid_plural "%s custom fields cleared"
51
+ msgstr[0] ""
52
+ msgstr[1] ""
53
+
54
+ #: php/class-video-thumbnails-settings.php:190
55
+ msgid "<strong>Error</strong>: Could not verify nonce."
56
+ msgstr ""
57
+
58
+ #: php/class-video-thumbnails-settings.php:214
59
+ msgid "Name"
60
+ msgstr ""
61
+
62
+ #: php/class-video-thumbnails-settings.php:215
63
+ msgid "Pass/Fail"
64
+ msgstr ""
65
+
66
+ #: php/class-video-thumbnails-settings.php:216
67
+ msgid "Result"
68
+ msgstr ""
69
+
70
+ #: php/class-video-thumbnails-settings.php:230
71
+ #: php/class-video-thumbnails-settings.php:250
72
+ msgid "Failed"
73
+ msgstr ""
74
+
75
+ #: php/class-video-thumbnails-settings.php:247
76
+ msgid "Passed"
77
+ msgstr ""
78
+
79
+ #: php/class-video-thumbnails-settings.php:255
80
+ msgid "View Image"
81
+ msgstr ""
82
+
83
+ #: php/class-video-thumbnails-settings.php:284
84
+ msgid "Attachment created with an ID of %d"
85
+ msgstr ""
86
+
87
+ #: php/class-video-thumbnails-settings.php:286
88
+ msgid "Attachment with an ID of %d deleted"
89
+ msgstr ""
90
+
91
+ #: php/class-video-thumbnails-settings.php:302
92
+ msgid "No thumbnail found"
93
+ msgstr ""
94
+
95
+ #: php/class-video-thumbnails-settings.php:305
96
+ #: php/class-video-thumbnails-settings.php:312
97
+ #: php/providers/class-video-thumbnails-providers.php:92
98
+ #: video-thumbnails.php:336
99
+ msgid "Error Details:"
100
+ msgstr ""
101
+
102
+ #: php/class-video-thumbnails-settings.php:311
103
+ msgid "Thumbnail found, but there was an error retrieving the URL."
104
+ msgstr ""
105
+
106
+ #: php/class-video-thumbnails-settings.php:315
107
+ msgid ""
108
+ "Thumbnail found, but it may not exist on the source server. If opening the "
109
+ "URL below in your web browser returns an error, the source is providing an "
110
+ "invalid URL."
111
+ msgstr ""
112
+
113
+ #: php/class-video-thumbnails-settings.php:316
114
+ msgid "Thumbnail URL:"
115
+ msgstr ""
116
+
117
+ #: php/class-video-thumbnails-settings.php:319
118
+ msgid "Thumbnail found! Image should appear below."
119
+ msgstr ""
120
+
121
+ #: php/class-video-thumbnails-settings.php:319
122
+ msgid "View full size"
123
+ msgstr ""
124
+
125
+ #: php/class-video-thumbnails-settings.php:330
126
+ msgid "General Settings"
127
+ msgstr ""
128
+
129
+ #: php/class-video-thumbnails-settings.php:336
130
+ msgid "Save Thumbnails to Media Library"
131
+ msgstr ""
132
+
133
+ #: php/class-video-thumbnails-settings.php:337
134
+ msgid "Checking this option will download video thumbnails to your server"
135
+ msgstr ""
136
+
137
+ #: php/class-video-thumbnails-settings.php:341
138
+ msgid "Automatically Set Featured Image"
139
+ msgstr ""
140
+
141
+ #: php/class-video-thumbnails-settings.php:342
142
+ msgid ""
143
+ "Check this option to automatically set video thumbnails as the featured "
144
+ "image (requires saving to media library)"
145
+ msgstr ""
146
+
147
+ #: php/class-video-thumbnails-settings.php:350
148
+ msgid "Post Types"
149
+ msgstr ""
150
+
151
+ #: php/class-video-thumbnails-settings.php:355
152
+ msgid "Custom Field (optional)"
153
+ msgstr ""
154
+
155
+ #: php/class-video-thumbnails-settings.php:356
156
+ msgid "Automatically Detect"
157
+ msgstr ""
158
+
159
+ #: php/class-video-thumbnails-settings.php:356
160
+ msgid ""
161
+ "Enter the name of the custom field where your embed code or video URL is "
162
+ "stored."
163
+ msgstr ""
164
+
165
+ #: php/class-video-thumbnails-settings.php:386
166
+ msgid ""
167
+ "These options configure where the plugin will search for videos and what to "
168
+ "do with thumbnails once found."
169
+ msgstr ""
170
+
171
+ #: php/class-video-thumbnails-settings.php:459 video-thumbnails.php:489
172
+ msgid "You do not have sufficient permissions to access this page."
173
+ msgstr ""
174
+
175
+ #: php/class-video-thumbnails-settings.php:468
176
+ msgid "General"
177
+ msgstr ""
178
+
179
+ #: php/class-video-thumbnails-settings.php:469
180
+ msgid "Providers"
181
+ msgstr ""
182
+
183
+ #: php/class-video-thumbnails-settings.php:470
184
+ msgid "Mass Actions"
185
+ msgstr ""
186
+
187
+ #: php/class-video-thumbnails-settings.php:471
188
+ msgid "Debugging"
189
+ msgstr ""
190
+
191
+ #: php/class-video-thumbnails-settings.php:472
192
+ msgid "Support"
193
+ msgstr ""
194
+
195
+ #: php/class-video-thumbnails-settings.php:479
196
+ msgid "Getting started"
197
+ msgstr ""
198
+
199
+ #: php/class-video-thumbnails-settings.php:481
200
+ msgid ""
201
+ "If your theme supports post thumbnails, just leave \"Save Thumbnails to "
202
+ "Media Library\" and \"Automatically Set Featured Image\" enabled, then "
203
+ "select what post types you'd like scanned for videos."
204
+ msgstr ""
205
+
206
+ #: php/class-video-thumbnails-settings.php:483
207
+ msgid ""
208
+ "For more detailed instructions, check out the page for <a href=\"http://"
209
+ "wordpress.org/extend/plugins/video-thumbnails/\">Video Thumbnails on the "
210
+ "official plugin directory</a>."
211
+ msgstr ""
212
+
213
+ #: php/class-video-thumbnails-settings.php:511
214
+ msgid "Scan All Posts"
215
+ msgstr ""
216
+
217
+ #: php/class-video-thumbnails-settings.php:513
218
+ msgid ""
219
+ "Scan all of your past posts for video thumbnails. Be sure to save any "
220
+ "settings before running the scan."
221
+ msgstr ""
222
+
223
+ #: php/class-video-thumbnails-settings.php:515
224
+ msgid "Scan Past Posts"
225
+ msgstr ""
226
+
227
+ #: php/class-video-thumbnails-settings.php:517
228
+ msgid "Clear all Video Thumbnails"
229
+ msgstr ""
230
+
231
+ #: php/class-video-thumbnails-settings.php:519
232
+ msgid ""
233
+ "This will clear the video thumbnail field for all posts and delete any video "
234
+ "thumbnail attachments. Note: This only works for attachments added using "
235
+ "version 2.0 or later."
236
+ msgstr ""
237
+
238
+ #: php/class-video-thumbnails-settings.php:521
239
+ msgid "Clear Video Thumbnails"
240
+ msgstr ""
241
+
242
+ #: php/class-video-thumbnails-settings.php:532
243
+ msgid ""
244
+ "Use these tests to help diagnose any problems. Please include results when "
245
+ "requesting support."
246
+ msgstr ""
247
+
248
+ #: php/class-video-thumbnails-settings.php:534
249
+ #: php/class-video-thumbnails-settings.php:539
250
+ msgid "Test Video Providers"
251
+ msgstr ""
252
+
253
+ #: php/class-video-thumbnails-settings.php:536
254
+ msgid ""
255
+ "This test automatically searches a sample for every type of video supported "
256
+ "and compares it to the expected value. Sometimes tests may fail due to API "
257
+ "rate limits."
258
+ msgstr ""
259
+
260
+ #: php/class-video-thumbnails-settings.php:542
261
+ msgid "Test Markup for Video"
262
+ msgstr ""
263
+
264
+ #: php/class-video-thumbnails-settings.php:544
265
+ msgid "Copy and paste an embed code below to see if a video is detected."
266
+ msgstr ""
267
+
268
+ #: php/class-video-thumbnails-settings.php:548
269
+ msgid "Scan For Thumbnail"
270
+ msgstr ""
271
+
272
+ #: php/class-video-thumbnails-settings.php:552
273
+ msgid "Test Saving to Media Library"
274
+ msgstr ""
275
+
276
+ #: php/class-video-thumbnails-settings.php:554
277
+ msgid ""
278
+ "This test checks for issues with the process of saving a remote thumbnail to "
279
+ "your local media library."
280
+ msgstr ""
281
+
282
+ #: php/class-video-thumbnails-settings.php:556
283
+ msgid ""
284
+ "Also be sure to test that you can manually upload an image to your site. If "
285
+ "you're unable to upload images, you may need to <a href=\"http://codex."
286
+ "wordpress.org/Changing_File_Permissions\">change file permissions</a>."
287
+ msgstr ""
288
+
289
+ #: php/class-video-thumbnails-settings.php:559
290
+ msgid "Test Image Downloading"
291
+ msgstr ""
292
+
293
+ #: php/class-video-thumbnails-settings.php:562
294
+ msgid "Installation Information"
295
+ msgstr ""
296
+
297
+ #: php/class-video-thumbnails-settings.php:573
298
+ msgid "WordPress Version"
299
+ msgstr ""
300
+
301
+ #: php/class-video-thumbnails-settings.php:578
302
+ msgid "Video Thumbnails Version"
303
+ msgstr ""
304
+
305
+ #: php/class-video-thumbnails-settings.php:583
306
+ msgid "Video Thumbnails Settings Version"
307
+ msgstr ""
308
+
309
+ #: php/class-video-thumbnails-settings.php:588
310
+ msgid "PHP Version"
311
+ msgstr ""
312
+
313
+ #: php/class-video-thumbnails-settings.php:593
314
+ msgid "Post Thumbnails"
315
+ msgstr ""
316
+
317
+ #: php/class-video-thumbnails-settings.php:594
318
+ msgid "Your theme supports post thumbnails."
319
+ msgstr ""
320
+
321
+ #: php/class-video-thumbnails-settings.php:594
322
+ msgid ""
323
+ "Your theme does not support post thumbnails, you'll need to make "
324
+ "modifications or switch to a different theme. <a href=\"http://codex."
325
+ "wordpress.org/Post_Thumbnails\">More info</a>"
326
+ msgstr ""
327
+
328
+ #: php/class-video-thumbnails-settings.php:598
329
+ msgid "Video Providers"
330
+ msgstr ""
331
+
332
+ #: php/class-video-thumbnails-settings.php:637
333
+ msgid "Support video thumbnails and unlock additional features"
334
+ msgstr ""
335
+
336
+ #: php/class-video-thumbnails-settings.php:638
337
+ msgid "Go Pro"
338
+ msgstr ""
339
+
340
+ #: php/providers/class-blip-thumbnails.php:50
341
+ msgid ""
342
+ "Error retrieving video information for <a href=\"%1$s\">%1$s</a>. Check to "
343
+ "be sure this is a valid Blip video URL."
344
+ msgstr ""
345
+
346
+ #: php/providers/class-blip-thumbnails.php:65
347
+ #: php/providers/class-collegehumor-thumbnails.php:67
348
+ #: php/providers/class-rutube-thumbnails.php:62
349
+ #: php/providers/class-twitch-thumbnails.php:62
350
+ #: php/providers/class-youku-thumbnails.php:68
351
+ msgid "Video URL"
352
+ msgstr ""
353
+
354
+ #: php/providers/class-blip-thumbnails.php:71
355
+ #: php/providers/class-collegehumor-thumbnails.php:61
356
+ #: php/providers/class-dailymotion-thumbnails.php:63
357
+ #: php/providers/class-facebook-thumbnails.php:60
358
+ #: php/providers/class-funnyordie-thumbnails.php:62
359
+ #: php/providers/class-googledrive-thumbnails.php:82
360
+ #: php/providers/class-mpora-thumbnails.php:60
361
+ #: php/providers/class-rutube-thumbnails.php:68
362
+ #: php/providers/class-vimeo-thumbnails.php:110
363
+ #: php/providers/class-vk-thumbnails.php:69
364
+ #: php/providers/class-wistia-thumbnails.php:85
365
+ msgid "iFrame Embed"
366
+ msgstr ""
367
+
368
+ #: php/providers/class-dailymotion-thumbnails.php:69
369
+ #: php/providers/class-facebook-thumbnails.php:54
370
+ #: php/providers/class-funnyordie-thumbnails.php:68
371
+ #: php/providers/class-googledrive-thumbnails.php:94
372
+ #: php/providers/class-justintv-thumbnails.php:61
373
+ #: php/providers/class-metacafe-thumbnails.php:62
374
+ #: php/providers/class-mpora-thumbnails.php:54
375
+ #: php/providers/class-twitch-thumbnails.php:68
376
+ #: php/providers/class-vimeo-thumbnails.php:116
377
+ #: php/providers/class-youku-thumbnails.php:62
378
+ msgid "Flash Embed"
379
+ msgstr ""
380
+
381
+ #: php/providers/class-googledrive-thumbnails.php:88
382
+ msgid "iFrame Embed (Apps account)"
383
+ msgstr ""
384
+
385
+ #: php/providers/class-googledrive-thumbnails.php:100
386
+ msgid "Flash Embed (YouTube player)"
387
+ msgstr ""
388
+
389
+ #: php/providers/class-kaltura-thumbnails.php:68
390
+ msgid "Auto Embed"
391
+ msgstr ""
392
+
393
+ #: php/providers/class-video-thumbnails-providers.php:92
394
+ msgid ""
395
+ "Error retrieving video information from the URL <a href=\"%1$s\">%1$s</a> "
396
+ "using <code>wp_remote_get()</code><br />If opening that URL in your web "
397
+ "browser returns anything else than an error page, the problem may be related "
398
+ "to your web server and might be something your host administrator can solve."
399
+ msgstr ""
400
+
401
+ #: php/providers/class-vimeo-thumbnails.php:122
402
+ msgid "Channel URL"
403
+ msgstr ""
404
+
405
+ #: php/providers/class-vine-thumbnails.php:69
406
+ msgid "iFrame Embed/Video URL"
407
+ msgstr ""
408
+
409
+ #: php/providers/class-wistia-thumbnails.php:91
410
+ msgid "JavaScript Embed"
411
+ msgstr ""
412
+
413
+ #: php/providers/class-youtube-thumbnails.php:64
414
+ msgid "iFrame Embed HD"
415
+ msgstr ""
416
+
417
+ #: php/providers/class-youtube-thumbnails.php:70
418
+ msgid "Flash Embed HD"
419
+ msgstr ""
420
+
421
+ #: php/providers/class-youtube-thumbnails.php:76
422
+ msgid "iFrame Embed SD"
423
+ msgstr ""
424
+
425
+ #: php/providers/class-youtube-thumbnails.php:82
426
+ msgid "Flash Embed SD"
427
+ msgstr ""
428
+
429
+ #: video-thumbnails.php:93
430
+ msgid "Bulk Video Thumbnails"
431
+ msgstr ""
432
+
433
+ #: video-thumbnails.php:93
434
+ msgid "Bulk Video Thumbs"
435
+ msgstr ""
436
+
437
+ #: video-thumbnails.php:102
438
+ msgid "Started Scanning"
439
+ msgstr ""
440
+
441
+ #: video-thumbnails.php:103
442
+ msgid "Resumed Scanning"
443
+ msgstr ""
444
+
445
+ #: video-thumbnails.php:104
446
+ msgid "Paused Scanning"
447
+ msgstr ""
448
+
449
+ #: video-thumbnails.php:105
450
+ msgid "Done!"
451
+ msgstr ""
452
+
453
+ #: video-thumbnails.php:106
454
+ msgid "Scanned 1 post"
455
+ msgstr ""
456
+
457
+ #: video-thumbnails.php:107
458
+ msgid "Scanned %d posts"
459
+ msgstr ""
460
+
461
+ #: video-thumbnails.php:108
462
+ msgid "1 post in queue"
463
+ msgstr ""
464
+
465
+ #: video-thumbnails.php:109
466
+ msgid "%d posts in queue"
467
+ msgstr ""
468
+
469
+ #: video-thumbnails.php:110
470
+ msgid "Scanning %1$s of %2$s"
471
+ msgstr ""
472
+
473
+ #: video-thumbnails.php:111
474
+ msgid "No thumbnail"
475
+ msgstr ""
476
+
477
+ #: video-thumbnails.php:112
478
+ msgid "New thumbnail:"
479
+ msgstr ""
480
+
481
+ #: video-thumbnails.php:113
482
+ msgid "Existing thumbnail:"
483
+ msgstr ""
484
+
485
+ #: video-thumbnails.php:114
486
+ msgid "Error:"
487
+ msgstr ""
488
+
489
+ #: video-thumbnails.php:136
490
+ msgid "Troubleshooting Video Thumbnails"
491
+ msgstr ""
492
+
493
+ #: video-thumbnails.php:148 video-thumbnails.php:155
494
+ msgid "Reset Video Thumbnail"
495
+ msgstr ""
496
+
497
+ #: video-thumbnails.php:150 video-thumbnails.php:434
498
+ msgid "No video thumbnail for this post."
499
+ msgstr ""
500
+
501
+ #: video-thumbnails.php:151
502
+ msgid "Search Again"
503
+ msgstr ""
504
+
505
+ #: video-thumbnails.php:151
506
+ msgid "Troubleshoot"
507
+ msgstr ""
508
+
509
+ #: video-thumbnails.php:157
510
+ msgid "A video thumbnail will be found for this post when it is published."
511
+ msgstr ""
512
+
513
+ #: video-thumbnails.php:167
514
+ msgid "Fixing \"No video thumbnail for this post\""
515
+ msgstr ""
516
+
517
+ #: video-thumbnails.php:169
518
+ msgid "Ensure you have saved any changes to your post."
519
+ msgstr ""
520
+
521
+ #: video-thumbnails.php:170
522
+ msgid ""
523
+ "If you are using a a plugin or theme that stores videos in a special "
524
+ "location other than the main post content area, be sure you've entered the "
525
+ "correct custom field on the <a href=\"%s\">settings page</a>. If you don't "
526
+ "know the name of the field your video is being saved in, please contact the "
527
+ "developer of that theme or plugin."
528
+ msgstr ""
529
+
530
+ #: video-thumbnails.php:171
531
+ msgid ""
532
+ "Copy and paste your embed code into the \"Test Markup for Video\" section of "
533
+ "the <a href=\"%1$s\">Debugging page</a>. If this doesn't find the thumbnail, "
534
+ "you'll want to be sure to include the embed code you scanned when you "
535
+ "request support. If it does find a thumbnail, please double check that you "
536
+ "have the Custom Field set correctly in the <a href=\"%2$s\">settings page</"
537
+ "a> if you are using a a plugin or theme that stores videos in a special "
538
+ "location."
539
+ msgstr ""
540
+
541
+ #: video-thumbnails.php:172
542
+ msgid ""
543
+ "Go to the <a href=\"%s\">Debugging page</a> and click \"Test Image "
544
+ "Downloading\" to test your server's ability to save an image from a video "
545
+ "source."
546
+ msgstr ""
547
+
548
+ #: video-thumbnails.php:173
549
+ msgid "Try posting a video from other sources to help narrow down the problem."
550
+ msgstr ""
551
+
552
+ #: video-thumbnails.php:174
553
+ msgid ""
554
+ "Search the <a href=\"http://wordpress.org/support/plugin/video-thumbnails"
555
+ "\">support threads</a> to see if anyone has had the same issue."
556
+ msgstr ""
557
+
558
+ #: video-thumbnails.php:175
559
+ msgid ""
560
+ "If you are still unable to resolve the problem, <a href=\"http://wordpress."
561
+ "org/support/plugin/video-thumbnails\">start a thread</a> with a <strong>good "
562
+ "descriptive</strong> title (\"Error\" or \"No thumbnails\" is a <strong>bad</"
563
+ "strong> title) and be sure to include the results of your testing as well. "
564
+ "Also be sure to include the <strong>name of your theme</strong>, any "
565
+ "<strong>video plugins</strong> you're using, and any other details you can "
566
+ "think of."
567
+ msgstr ""
568
+
569
+ #: video-thumbnails.php:336
570
+ msgid ""
571
+ "Error retrieving a thumbnail from the URL <a href=\"%1$s\">%1$s</a> using "
572
+ "<code>wp_remote_get()</code><br />If opening that URL in your web browser "
573
+ "returns anything else than an error page, the problem may be related to your "
574
+ "web server and might be something your host administrator can solve."
575
+ msgstr ""
576
+
577
+ #: video-thumbnails.php:354
578
+ msgid "Unsupported MIME type:"
579
+ msgstr ""
580
+
581
+ #: video-thumbnails.php:367
582
+ msgid "Error uploading image data:"
583
+ msgstr ""
584
+
585
+ #: video-thumbnails.php:495
586
+ msgid "Bulk Video Thumbnail Generator"
587
+ msgstr ""
588
+
589
+ #: video-thumbnails.php:497
590
+ msgid "Use this tool to scan all of your posts for Video Thumbnails."
591
+ msgstr ""
592
+
593
+ #: video-thumbnails.php:506
594
+ msgid "Scan Now"
595
+ msgstr ""
596
+
597
+ #: video-thumbnails.php:521
598
+ msgid "Scanned"
599
+ msgstr ""
600
+
601
+ #: video-thumbnails.php:522
602
+ msgid "New Thumbnails"
603
+ msgstr ""
604
+
605
+ #: video-thumbnails.php:523
606
+ msgid "Existing"
607
+ msgstr ""
608
+
609
+ #. Plugin URI of the plugin/theme
610
+ msgid "https://refactored.co/plugins/video-thumbnails"
611
+ msgstr ""
612
+
613
+ #. Description of the plugin/theme
614
+ msgid ""
615
+ "Automatically retrieve video thumbnails for your posts and display them in "
616
+ "your theme. Supports YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, "
617
+ "Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, "
618
+ "MPORA, Wistia, Youku, and Rutube."
619
+ msgstr ""
620
+
621
+ #. Author of the plugin/theme
622
+ msgid "Sutherland Boswell"
623
+ msgstr ""
624
+
625
+ #. Author URI of the plugin/theme
626
+ msgid "http://sutherlandboswell.com"
627
+ msgstr ""
php/class-video-thumbnails-settings.php CHANGED
@@ -126,8 +126,8 @@ class Video_Thumbnails_Settings {
126
 
127
  function admin_menu() {
128
  add_options_page(
129
- 'Video Thumbnail Options',
130
- 'Video Thumbnails',
131
  'manage_options',
132
  'video_thumbnails',
133
  array( &$this, 'options_page' )
@@ -136,6 +136,11 @@ class Video_Thumbnails_Settings {
136
 
137
  function admin_scripts() {
138
  wp_enqueue_script( 'video_thumbnails_settings', plugins_url( 'js/settings.js' , VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php' ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
 
 
 
 
 
139
  }
140
 
141
  function custom_field_detection_callback() {
@@ -182,7 +187,7 @@ class Video_Thumbnails_Settings {
182
  $custom_fields_cleared = $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key='_video_thumbnail'" );
183
  echo '<p><span style="color:green">&#10004;</span> ' . sprintf( _n( '1 custom field cleared', '%s custom fields cleared', $custom_fields_cleared, 'video-thumbnails' ), $custom_fields_cleared ) . '</p>';
184
  } else {
185
- echo '<p><span style="color:red">&#10006;</span> <strong>Error</strong>: Could not verify nonce.</p>';
186
  }
187
 
188
  die();
@@ -206,9 +211,9 @@ class Video_Thumbnails_Settings {
206
  <table class="widefat">
207
  <thead>
208
  <tr>
209
- <th>Name</th>
210
- <th>Pass/Fail</th>
211
- <th>Result</th>
212
  </tr>
213
  </thead>
214
  <tbody>
@@ -216,13 +221,13 @@ class Video_Thumbnails_Settings {
216
  $passed = 0;
217
  $failed = 0;
218
  foreach ( $video_thumbnails->providers as $provider ) {
219
- foreach ( $provider->test_cases as $test_case ) {
220
  echo '<tr>';
221
  echo '<td><strong>' . $provider->service_name . '</strong> - ' . $test_case['name'] . '</td>';
222
  $result = $video_thumbnails->get_first_thumbnail_url( $test_case['markup'] );
223
  if ( is_wp_error( $result ) ) {
224
  $error_string = $result->get_error_message();
225
- echo '<td style="color:red;">&#10007; Failed</td>';
226
  echo '<td>';
227
  echo '<div class="error"><p>' . $error_string . '</p></div>';
228
  echo '</td>';
@@ -239,15 +244,15 @@ class Video_Thumbnails_Settings {
239
  }
240
 
241
  if ( $matched ) {
242
- echo '<td style="color:green;">&#10004; Passed</td>';
243
  $passed++;
244
  } else {
245
- echo '<td style="color:red;">&#10007; Failed</td>';
246
  $failed++;
247
  }
248
  echo '<td>';
249
  if ( $result ) {
250
- echo '<a href="' . $result . '">View Image</a>';
251
  }
252
  if ( $result_hash ) {
253
  echo ' <code>' . $result_hash . '</code>';
@@ -276,9 +281,9 @@ class Video_Thumbnails_Settings {
276
  if ( is_wp_error( $attachment_id ) ) {
277
  echo '<p><span style="color:red;">&#10006;</span> ' . $attachment_id->get_error_message() . '</p>';
278
  } else {
279
- echo '<p><span style="color:green;">&#10004;</span>Attachment created with an ID of ' . $attachment_id . '</p>';
280
  wp_delete_attachment( $attachment_id, true );
281
- echo '<p><span style="color:green;">&#10004;</span>Attachment with an ID of ' . $attachment_id . ' deleted</p>';
282
  }
283
 
284
  die();
@@ -294,24 +299,24 @@ class Video_Thumbnails_Settings {
294
 
295
  if ( $new_thumbnail == null ) {
296
  // No thumbnail
297
- echo '<p><span style="color:red;">&#10006;</span> No thumbnail found</p>';
298
  } elseif ( is_wp_error( $new_thumbnail ) ) {
299
  // Error finding thumbnail
300
- echo '<p><span style="color:red;">&#10006;</span> Error: ' . $new_thumbnail->get_error_message() . '</p>';
301
  } else {
302
  // Found a thumbnail
303
  $remote_response = wp_remote_head( $new_thumbnail );
304
  if ( is_wp_error( $remote_response ) ) {
305
  // WP Error trying to read image from remote server
306
- echo '<p><span style="color:red;">&#10006;</span> Thumbnail found, but there was an error retrieving the URL.</p>';
307
- echo '<p>Error Details: ' . $remote_response->get_error_message() . '</p>';
308
  } elseif ( $remote_response['response']['code'] != '200' ) {
309
  // Response code isn't okay
310
- echo '<p><span style="color:red;">&#10006;</span> Thumbnail found, but it may not exist on the source server. If opening the URL below in your web browser returns an error, the source is providing an invalid URL.</p>';
311
- echo '<p>Thumbnail URL: <a href="' . $new_thumbnail . '" target="_blank">' . $new_thumbnail . '</a>';
312
  } else {
313
  // Everything is okay!
314
- echo '<p><span style="color:green;">&#10004;</span> Thumbnail found! Image should appear below. <a href="' . $new_thumbnail . '" target="_blank">View full size</a></p>';
315
  echo '<p><img src="' . $new_thumbnail . '" style="max-width: 500px;"></p>';
316
  }
317
  }
@@ -322,19 +327,19 @@ class Video_Thumbnails_Settings {
322
  function initialize_options() {
323
  add_settings_section(
324
  'general_settings_section',
325
- 'General Settings',
326
  array( &$this, 'general_settings_callback' ),
327
  'video_thumbnails'
328
  );
329
  $this->add_checkbox_setting(
330
  'save_media',
331
- 'Save Thumbnails to Media Library',
332
- 'Checking this option will download video thumbnails to your server'
333
  );
334
  $this->add_checkbox_setting(
335
  'set_featured',
336
- 'Automatically Set Featured Image',
337
- 'Check this option to automatically set video thumbnails as the featured image (requires saving to media library)'
338
  );
339
  // Get post types
340
  $post_types = get_post_types( null, 'names' );
@@ -342,13 +347,13 @@ class Video_Thumbnails_Settings {
342
  $post_types = array_diff( $post_types, array( 'attachment', 'revision', 'nav_menu_item' ) );
343
  $this->add_multicheckbox_setting(
344
  'post_types',
345
- 'Post Types',
346
  $post_types
347
  );
348
  $this->add_text_setting(
349
  'custom_field',
350
- 'Custom Field (optional)',
351
- '<a href="#" class="button" id="vt_detect_custom_field">Automatically Detect</a> Enter the name of the custom field where your embed code or video URL is stored.'
352
  );
353
  register_setting( 'video_thumbnails', 'video_thumbnails', array( &$this, 'sanitize_callback' ) );
354
  }
@@ -378,7 +383,7 @@ class Video_Thumbnails_Settings {
378
  }
379
 
380
  function general_settings_callback() {
381
- echo '<p>These options configure where the plugin will search for videos and what to do with thumbnails once found.</p>';
382
  }
383
 
384
  function add_checkbox_setting( $slug, $name, $description ) {
@@ -451,31 +456,31 @@ class Video_Thumbnails_Settings {
451
  function options_page() {
452
 
453
  if ( ! current_user_can( 'manage_options' ) ) {
454
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
455
  }
456
 
457
  ?><div class="wrap">
458
 
459
- <div id="icon-options-general" class="icon32"></div><h2>Video Thumbnails Options</h2>
460
 
461
  <?php $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general_settings'; ?>
462
  <h2 class="nav-tab-wrapper">
463
- <a href="?page=video_thumbnails&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>">General</a>
464
- <a href="?page=video_thumbnails&tab=provider_settings" class="nav-tab <?php echo $active_tab == 'provider_settings' ? 'nav-tab-active' : ''; ?>">Providers</a>
465
- <a href="?page=video_thumbnails&tab=mass_actions" class="nav-tab <?php echo $active_tab == 'mass_actions' ? 'nav-tab-active' : ''; ?>">Mass Actions</a>
466
- <a href="?page=video_thumbnails&tab=debugging" class="nav-tab <?php echo $active_tab == 'debugging' ? 'nav-tab-active' : ''; ?>">Debugging</a>
467
- <a href="?page=video_thumbnails&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?>">Support</a>
468
  </h2>
469
 
470
  <?php
471
  // Main settings
472
  if ( $active_tab == 'general_settings' ) {
473
  ?>
474
- <h3>Getting started</h3>
475
 
476
- <p>If your theme supports post thumbnails, just leave "Save Thumbnails to Media Library" and "Automatically Set Featured Image" enabled, then select what post types you'd like scanned for videos.</p>
477
 
478
- <p>For more detailed instructions, check out the page for <a href="http://wordpress.org/extend/plugins/video-thumbnails/">Video Thumbnails on the official plugin directory</a>.</p>
479
 
480
  <form method="post" action="options.php">
481
  <?php settings_fields( 'video_thumbnails' ); ?>
@@ -503,17 +508,17 @@ class Video_Thumbnails_Settings {
503
  // Scan all posts
504
  if ( $active_tab == 'mass_actions' ) {
505
  ?>
506
- <h3>Scan All Posts</h3>
507
 
508
- <p>Scan all of your past posts for video thumbnails. Be sure to save any settings before running the scan.</p>
509
 
510
- <p><a class="button-primary" href="<?php echo admin_url( 'tools.php?page=video-thumbnails-bulk' ); ?>">Scan Past Posts</a></p>
511
 
512
- <h3>Clear all Video Thumbnails</h3>
513
 
514
- <p>This will clear the video thumbnail field for all posts and delete any video thumbnail attachments. Note: This only works for attachments added using version 2.0 or later.</p>
515
 
516
- <p><input type="submit" class="button-primary" onclick="clear_all_video_thumbnails('<?php echo wp_create_nonce( 'clear_all_video_thumbnails' ); ?>');" value="Clear Video Thumbnails" /></p>
517
 
518
  <div id="clear-all-video-thumbnails-result"></div>
519
 
@@ -524,37 +529,37 @@ class Video_Thumbnails_Settings {
524
  if ( $active_tab == 'debugging' ) {
525
  ?>
526
 
527
- <p>Use these tests to help diagnose any problems. Please include results when requesting support.</p>
528
 
529
- <h3>Test Thumbnail Providers</h3>
530
 
531
- <p>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.</p>
532
 
533
  <div id="provider-test">
534
- <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('provider');" value="Test Providers" /></p>
535
  </div>
536
 
537
- <h3>Test Markup for Video</h3>
538
 
539
- <p>Copy and paste an embed code below to see if a video is detected.</p>
540
 
541
  <textarea id="markup-input" cols="50" rows="5"></textarea>
542
 
543
- <p><input type="submit" class="button-primary" onclick="test_video_thumbnail_markup_detection();" value="Scan For Thumbnail" /></p>
544
 
545
  <div id="markup-test-result"></div>
546
 
547
- <h3>Test Saving to Media Library</h3>
548
 
549
- <p>This test checks for issues with the process of saving a remote thumbnail to your local media library.</p>
550
 
551
- <p>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>.</p>
552
 
553
  <div id="saving_media-test">
554
- <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('saving_media');" value="Test Image Downloading" /></p>
555
  </div>
556
 
557
- <h3>Installation Information</h3>
558
  <table class="widefat">
559
  <thead>
560
  <tr>
@@ -565,32 +570,32 @@ class Video_Thumbnails_Settings {
565
  </thead>
566
  <tbody>
567
  <tr>
568
- <td><strong>WordPress Version</strong></td>
569
  <td><?php echo get_bloginfo( 'version' ); ?></td>
570
  <td></td>
571
  </tr>
572
  <tr>
573
- <td><strong>Video Thumbnails Version</strong></td>
574
  <td><?php echo VIDEO_THUMBNAILS_VERSION; ?></td>
575
  <td></td>
576
  </tr>
577
  <tr>
578
- <td><strong>Video Thumbnails Settings Version</strong></td>
579
  <td><?php echo $this->options['version']; ?></td>
580
  <td></td>
581
  </tr>
582
  <tr>
583
- <td><strong>PHP Version</strong></td>
584
  <td><?php echo PHP_VERSION; ?></td>
585
  <td></td>
586
  </tr>
587
  <tr>
588
- <td><strong>Post Thumbnails</strong></td>
589
- <td><?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?><span style="color:green">&#10004;</span> Your theme supports post thumbnails.<?php else: ?><span style="color:red">&#10006;</span> Your theme doesn't 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><?php endif; ?></td>
590
  <td></td>
591
  </tr>
592
  <tr>
593
- <td><strong>Providers</strong></td>
594
  <td>
595
  <?php global $video_thumbnails; ?>
596
  <?php $provider_names = array(); foreach ( $video_thumbnails->providers as $provider ) { $provider_names[] = $provider->service_name; }; ?>
@@ -629,8 +634,8 @@ class Video_Thumbnails_Settings {
629
  ?>
630
  <div style="width: 250px; margin: 20px 0; padding: 0 20px; background: #fff; border: 1px solid #dfdfdf; text-align: center;">
631
  <div>
632
- <p>Support video thumbnails and unlock additional features</p>
633
- <p><a href="https://refactored.co/plugins/video-thumbnails" class="button button-primary button-large">Go Pro</a></p>
634
  </div>
635
  </div>
636
  <?php
126
 
127
  function admin_menu() {
128
  add_options_page(
129
+ __( 'Video Thumbnails Options', 'video-thumbnails' ),
130
+ __( 'Video Thumbnails', 'video-thumbnails' ),
131
  'manage_options',
132
  'video_thumbnails',
133
  array( &$this, 'options_page' )
136
 
137
  function admin_scripts() {
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
+ 'clear_all_confirmation' => __( 'Are you sure you want to clear all video thumbnails? This cannot be undone.', 'video-thumbnails' ),
143
+ ) );
144
  }
145
 
146
  function custom_field_detection_callback() {
187
  $custom_fields_cleared = $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key='_video_thumbnail'" );
188
  echo '<p><span style="color:green">&#10004;</span> ' . sprintf( _n( '1 custom field cleared', '%s custom fields cleared', $custom_fields_cleared, 'video-thumbnails' ), $custom_fields_cleared ) . '</p>';
189
  } else {
190
+ echo '<p><span style="color:red">&#10006;</span> ' . __( '<strong>Error</strong>: Could not verify nonce.', 'video-thumbnails' ) . '</p>';
191
  }
192
 
193
  die();
211
  <table class="widefat">
212
  <thead>
213
  <tr>
214
+ <th><?php _e( 'Name', 'video-thumbnails' ); ?></th>
215
+ <th><?php _e( 'Pass/Fail', 'video-thumbnails' ); ?></th>
216
+ <th><?php _e( 'Result', 'video-thumbnails' ); ?></th>
217
  </tr>
218
  </thead>
219
  <tbody>
221
  $passed = 0;
222
  $failed = 0;
223
  foreach ( $video_thumbnails->providers as $provider ) {
224
+ foreach ( $provider->get_test_cases() as $test_case ) {
225
  echo '<tr>';
226
  echo '<td><strong>' . $provider->service_name . '</strong> - ' . $test_case['name'] . '</td>';
227
  $result = $video_thumbnails->get_first_thumbnail_url( $test_case['markup'] );
228
  if ( is_wp_error( $result ) ) {
229
  $error_string = $result->get_error_message();
230
+ echo '<td style="color:red;">&#10007; ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
231
  echo '<td>';
232
  echo '<div class="error"><p>' . $error_string . '</p></div>';
233
  echo '</td>';
244
  }
245
 
246
  if ( $matched ) {
247
+ echo '<td style="color:green;">&#10004; ' . __( 'Passed', 'video-thumbnails' ) . '</td>';
248
  $passed++;
249
  } else {
250
+ echo '<td style="color:red;">&#10007; ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
251
  $failed++;
252
  }
253
  echo '<td>';
254
  if ( $result ) {
255
+ echo '<a href="' . $result . '">' . __( 'View Image', 'video-thumbnails' ) . '</a>';
256
  }
257
  if ( $result_hash ) {
258
  echo ' <code>' . $result_hash . '</code>';
281
  if ( is_wp_error( $attachment_id ) ) {
282
  echo '<p><span style="color:red;">&#10006;</span> ' . $attachment_id->get_error_message() . '</p>';
283
  } else {
284
+ echo '<p><span style="color:green;">&#10004;</span> ' . sprintf( __( 'Attachment created with an ID of %d', 'video-thumbnails' ), $attachment_id ) . '</p>';
285
  wp_delete_attachment( $attachment_id, true );
286
+ echo '<p><span style="color:green;">&#10004;</span> ' . sprintf( __( 'Attachment with an ID of %d deleted', 'video-thumbnails' ), $attachment_id ) . '</p>';
287
  }
288
 
289
  die();
299
 
300
  if ( $new_thumbnail == null ) {
301
  // No thumbnail
302
+ echo '<p><span style="color:red;">&#10006;</span> ' . __( 'No thumbnail found', 'video-thumbnails' ) . '</p>';
303
  } elseif ( is_wp_error( $new_thumbnail ) ) {
304
  // Error finding thumbnail
305
+ echo '<p><span style="color:red;">&#10006;</span> ' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $new_thumbnail->get_error_message() . '</p>';
306
  } else {
307
  // Found a thumbnail
308
  $remote_response = wp_remote_head( $new_thumbnail );
309
  if ( is_wp_error( $remote_response ) ) {
310
  // WP Error trying to read image from remote server
311
+ echo '<p><span style="color:red;">&#10006;</span> ' . __( 'Thumbnail found, but there was an error retrieving the URL.', 'video-thumbnails' ) . '</p>';
312
+ echo '<p>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $remote_response->get_error_message() . '</p>';
313
  } elseif ( $remote_response['response']['code'] != '200' ) {
314
  // Response code isn't okay
315
+ echo '<p><span style="color:red;">&#10006;</span> ' . __( 'Thumbnail found, but it may not exist on the source server. If opening the URL below in your web browser returns an error, the source is providing an invalid URL.', 'video-thumbnails' ) . '</p>';
316
+ echo '<p>' . __( 'Thumbnail URL:', 'video-thumbnails' ) . ' <a href="' . $new_thumbnail . '" target="_blank">' . $new_thumbnail . '</a>';
317
  } else {
318
  // Everything is okay!
319
+ echo '<p><span style="color:green;">&#10004;</span> ' . __( 'Thumbnail found! Image should appear below.', 'video-thumbnails' ) . ' <a href="' . $new_thumbnail . '" target="_blank">' . __( 'View full size', 'video-thumbnails' ) . '</a></p>';
320
  echo '<p><img src="' . $new_thumbnail . '" style="max-width: 500px;"></p>';
321
  }
322
  }
327
  function initialize_options() {
328
  add_settings_section(
329
  'general_settings_section',
330
+ __( 'General Settings', 'video-thumbnails' ),
331
  array( &$this, 'general_settings_callback' ),
332
  'video_thumbnails'
333
  );
334
  $this->add_checkbox_setting(
335
  'save_media',
336
+ __( 'Save Thumbnails to Media Library', 'video-thumbnails' ),
337
+ __( 'Checking this option will download video thumbnails to your server', 'video-thumbnails' )
338
  );
339
  $this->add_checkbox_setting(
340
  'set_featured',
341
+ __( 'Automatically Set Featured Image', 'video-thumbnails' ),
342
+ __( 'Check this option to automatically set video thumbnails as the featured image (requires saving to media library)', 'video-thumbnails' )
343
  );
344
  // Get post types
345
  $post_types = get_post_types( null, 'names' );
347
  $post_types = array_diff( $post_types, array( 'attachment', 'revision', 'nav_menu_item' ) );
348
  $this->add_multicheckbox_setting(
349
  'post_types',
350
+ __( 'Post Types', 'video-thumbnails' ),
351
  $post_types
352
  );
353
  $this->add_text_setting(
354
  'custom_field',
355
+ __( 'Custom Field (optional)', 'video-thumbnails' ),
356
+ '<a href="#" class="button" id="vt_detect_custom_field">' . __( 'Automatically Detect', 'video-thumbnails' ) . '</a> ' . __( 'Enter the name of the custom field where your embed code or video URL is stored.', 'video-thumbnails' )
357
  );
358
  register_setting( 'video_thumbnails', 'video_thumbnails', array( &$this, 'sanitize_callback' ) );
359
  }
383
  }
384
 
385
  function general_settings_callback() {
386
+ echo '<p>' . __( 'These options configure where the plugin will search for videos and what to do with thumbnails once found.', 'video-thumbnails' ) . '</p>';
387
  }
388
 
389
  function add_checkbox_setting( $slug, $name, $description ) {
456
  function options_page() {
457
 
458
  if ( ! current_user_can( 'manage_options' ) ) {
459
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
460
  }
461
 
462
  ?><div class="wrap">
463
 
464
+ <div id="icon-options-general" class="icon32"></div><h2><?php _e( 'Video Thumbnails Options', 'video-thumbnails' ); ?></h2>
465
 
466
  <?php $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general_settings'; ?>
467
  <h2 class="nav-tab-wrapper">
468
+ <a href="?page=video_thumbnails&tab=general_settings" class="nav-tab <?php echo $active_tab == 'general_settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'General', 'video-thumbnails' ); ?></a>
469
+ <a href="?page=video_thumbnails&tab=provider_settings" class="nav-tab <?php echo $active_tab == 'provider_settings' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Providers', 'video-thumbnails' ); ?></a>
470
+ <a href="?page=video_thumbnails&tab=mass_actions" class="nav-tab <?php echo $active_tab == 'mass_actions' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Mass Actions', 'video-thumbnails' ); ?></a>
471
+ <a href="?page=video_thumbnails&tab=debugging" class="nav-tab <?php echo $active_tab == 'debugging' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Debugging', 'video-thumbnails' ); ?></a>
472
+ <a href="?page=video_thumbnails&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Support', 'video-thumbnails' ); ?></a>
473
  </h2>
474
 
475
  <?php
476
  // Main settings
477
  if ( $active_tab == 'general_settings' ) {
478
  ?>
479
+ <h3><?php _e( 'Getting started', 'video-thumbnails' ); ?></h3>
480
 
481
+ <p><?php _e( 'If your theme supports post thumbnails, just leave "Save Thumbnails to Media Library" and "Automatically Set Featured Image" enabled, then select what post types you\'d like scanned for videos.', 'video-thumbnails' ); ?></p>
482
 
483
+ <p><?php _e( 'For more detailed instructions, check out the page for <a href="http://wordpress.org/extend/plugins/video-thumbnails/">Video Thumbnails on the official plugin directory</a>.', 'video-thumbnails' ); ?></p>
484
 
485
  <form method="post" action="options.php">
486
  <?php settings_fields( 'video_thumbnails' ); ?>
508
  // Scan all posts
509
  if ( $active_tab == 'mass_actions' ) {
510
  ?>
511
+ <h3><?php _e( 'Scan All Posts', 'video-thumbnails' ); ?></h3>
512
 
513
+ <p><?php _e( 'Scan all of your past posts for video thumbnails. Be sure to save any settings before running the scan.', 'video-thumbnails' ); ?></p>
514
 
515
+ <p><a class="button-primary" href="<?php echo admin_url( 'tools.php?page=video-thumbnails-bulk' ); ?>"><?php _e( 'Scan Past Posts', 'video-thumbnails' ); ?></a></p>
516
 
517
+ <h3><?php _e( 'Clear all Video Thumbnails', 'video-thumbnails' ); ?></h3>
518
 
519
+ <p><?php _e( 'This will clear the video thumbnail field for all posts and delete any video thumbnail attachments. Note: This only works for attachments added using version 2.0 or later.', 'video-thumbnails' ); ?></p>
520
 
521
+ <p><input type="submit" class="button-primary" onclick="clear_all_video_thumbnails('<?php echo wp_create_nonce( 'clear_all_video_thumbnails' ); ?>');" value="<?php esc_attr_e( 'Clear Video Thumbnails', 'video-thumbnails' ); ?>" /></p>
522
 
523
  <div id="clear-all-video-thumbnails-result"></div>
524
 
529
  if ( $active_tab == 'debugging' ) {
530
  ?>
531
 
532
+ <p><?php _e( 'Use these tests to help diagnose any problems. Please include results when requesting support.', 'video-thumbnails' ); ?></p>
533
 
534
+ <h3><?php _e( 'Test Video Providers', 'video-thumbnails' ); ?></h3>
535
 
536
+ <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>
537
 
538
  <div id="provider-test">
539
+ <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('provider');" value="<?php esc_attr_e( 'Test Video Providers', 'video-thumbnails' ); ?>" /></p>
540
  </div>
541
 
542
+ <h3><?php _e( 'Test Markup for Video', 'video-thumbnails' ); ?></h3>
543
 
544
+ <p><?php _e( 'Copy and paste an embed code below to see if a video is detected.', 'video-thumbnails' ); ?></p>
545
 
546
  <textarea id="markup-input" cols="50" rows="5"></textarea>
547
 
548
+ <p><input type="submit" class="button-primary" onclick="test_video_thumbnail_markup_detection();" value="<?php esc_attr_e( 'Scan For Thumbnail', 'video-thumbnails' ); ?>" /></p>
549
 
550
  <div id="markup-test-result"></div>
551
 
552
+ <h3><?php _e( 'Test Saving to Media Library', 'video-thumbnails' ); ?></h3>
553
 
554
+ <p><?php _e( 'This test checks for issues with the process of saving a remote thumbnail to your local media library.', 'video-thumbnails' ); ?></p>
555
 
556
+ <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>
557
 
558
  <div id="saving_media-test">
559
+ <p><input type="submit" class="button-primary" onclick="test_video_thumbnail('saving_media');" value="<?php esc_attr_e( 'Test Image Downloading', 'video-thumbnails' ); ?>" /></p>
560
  </div>
561
 
562
+ <h3><?php _e( 'Installation Information', 'video-thumbnails' ); ?></h3>
563
  <table class="widefat">
564
  <thead>
565
  <tr>
570
  </thead>
571
  <tbody>
572
  <tr>
573
+ <td><strong><?php _e( 'WordPress Version', 'video-thumbnails' ); ?></strong></td>
574
  <td><?php echo get_bloginfo( 'version' ); ?></td>
575
  <td></td>
576
  </tr>
577
  <tr>
578
+ <td><strong><?php _e( 'Video Thumbnails Version', 'video-thumbnails' ); ?></strong></td>
579
  <td><?php echo VIDEO_THUMBNAILS_VERSION; ?></td>
580
  <td></td>
581
  </tr>
582
  <tr>
583
+ <td><strong><?php _e( 'Video Thumbnails Settings Version', 'video-thumbnails' ); ?></strong></td>
584
  <td><?php echo $this->options['version']; ?></td>
585
  <td></td>
586
  </tr>
587
  <tr>
588
+ <td><strong><?php _e( 'PHP Version', 'video-thumbnails' ); ?></strong></td>
589
  <td><?php echo PHP_VERSION; ?></td>
590
  <td></td>
591
  </tr>
592
  <tr>
593
+ <td><strong><?php _e( 'Post Thumbnails', 'video-thumbnails' ); ?></strong></td>
594
+ <td><?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?><span style="color:green">&#10004;</span> <?php _e( 'Your theme supports post thumbnails.', 'video-thumbnails' ); ?><?php else: ?><span style="color:red">&#10006;</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>
595
  <td></td>
596
  </tr>
597
  <tr>
598
+ <td><strong><?php _e( 'Video Providers', 'video-thumbnails' ); ?></strong></td>
599
  <td>
600
  <?php global $video_thumbnails; ?>
601
  <?php $provider_names = array(); foreach ( $video_thumbnails->providers as $provider ) { $provider_names[] = $provider->service_name; }; ?>
634
  ?>
635
  <div style="width: 250px; margin: 20px 0; padding: 0 20px; background: #fff; border: 1px solid #dfdfdf; text-align: center;">
636
  <div>
637
+ <p><?php _e( 'Support video thumbnails and unlock additional features', 'video-thumbnails' ); ?></p>
638
+ <p><a href="https://refactored.co/plugins/video-thumbnails" class="button button-primary button-large"><?php _e( 'Go Pro', 'video-thumbnails' ); ?></a></p>
639
  </div>
640
  </div>
641
  <?php
php/providers/class-blip-thumbnails.php CHANGED
@@ -43,11 +43,11 @@ class Blip_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "http://blip.tv/oembed?url=$url";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'blip_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $json = json_decode( $response['body'] );
49
  if ( isset( $json->error ) ) {
50
- $result = new WP_Error( 'blip_invalid_url', __( 'Error retrieving video information for <a href="' . $url . '">' . $url . '</a>. Check to be sure this is a valid Blip video URL.' ) );
51
  } else {
52
  $result = $json->thumbnail_url;
53
  }
@@ -56,26 +56,22 @@ class Blip_Thumbnails extends Video_Thumbnails_Providers {
56
  }
57
 
58
  // Test cases
59
- public $test_cases = array(
60
- array(
61
- 'markup' => 'http://blip.tv/cranetv/illustrator-katie-scott-6617917',
62
- 'expected' => 'http://a.images.blip.tv/CraneTV-IllustratorKatieScott610.jpg',
63
- 'expected_hash' => '26a622f72bd4bdb3f8189f85598dd95d',
64
- 'name' => 'Video URL'
65
- ),
66
- array(
67
- 'markup' => '<iframe src="http://blip.tv/play/AYL1uFkC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYL1uFkC" style="display:none"></embed>',
68
- 'expected' => 'http://a.images.blip.tv/ReelScience-TheScientificMethodOfOz139.jpg',
69
- 'expected_hash' => 'bd2f58c2bc874e3a017167e74e5c842f',
70
- 'name' => 'iFrame player'
71
- ),
72
- array(
73
- 'markup' => '<iframe src="http://blip.tv/play/AYLz%2BEsC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYLz+EsC" style="display:none"></embed>',
74
- 'expected' => 'http://a.images.blip.tv/GeekCrashCourse-TheAvengersMarvelMovieCatchUpGeekCrashCourse331.png',
75
- 'expected_hash' => '87efa9f6b0d9111b0826ae4fbdddec1b',
76
- 'name' => 'iFrame player (special characters in ID)'
77
- ),
78
- );
79
 
80
  }
81
 
43
  $request = "http://blip.tv/oembed?url=$url";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $json = json_decode( $response['body'] );
49
  if ( isset( $json->error ) ) {
50
+ $result = new WP_Error( 'blip_invalid_url', sprintf( __( 'Error retrieving video information for <a href="%1$s">%1$s</a>. Check to be sure this is a valid Blip video URL.', 'video-thumbnails' ), $url ) );
51
  } else {
52
  $result = $json->thumbnail_url;
53
  }
56
  }
57
 
58
  // Test cases
59
+ public static function get_test_cases() {
60
+ return array(
61
+ array(
62
+ 'markup' => 'http://blip.tv/cranetv/illustrator-katie-scott-6617917',
63
+ 'expected' => 'http://a.images.blip.tv/CraneTV-IllustratorKatieScott610.jpg',
64
+ 'expected_hash' => '26a622f72bd4bdb3f8189f85598dd95d',
65
+ 'name' => __( 'Video URL', 'video-thumbnails' )
66
+ ),
67
+ array(
68
+ 'markup' => '<iframe src="http://blip.tv/play/AYLz%2BEsC.html?p=1" width="780" height="438" frameborder="0" allowfullscreen></iframe><embed type="application/x-shockwave-flash" src="http://a.blip.tv/api.swf#AYLz+EsC" style="display:none"></embed>',
69
+ 'expected' => 'http://a.images.blip.tv/GeekCrashCourse-TheAvengersMarvelMovieCatchUpGeekCrashCourse331.png',
70
+ 'expected_hash' => '87efa9f6b0d9111b0826ae4fbdddec1b',
71
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
72
+ ),
73
+ );
74
+ }
 
 
 
 
75
 
76
  }
77
 
php/providers/class-collegehumor-thumbnails.php CHANGED
@@ -43,7 +43,7 @@ class CollegeHumor_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "http://www.collegehumor.com/oembed.json?url=http%3A%2F%2Fwww.collegehumor.com%2Fvideo%2F$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'collegehumor_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $result = json_decode( $response['body'] );
49
  $result = $result->thumbnail_url;
@@ -52,20 +52,22 @@ class CollegeHumor_Thumbnails extends Video_Thumbnails_Providers {
52
  }
53
 
54
  // Test cases
55
- public $test_cases = array(
56
- array(
57
- 'markup' => '<iframe src="http://www.collegehumor.com/e/6830834" width="600" height="338" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe><div style="padding:5px 0; text-align:center; width:600px;"><p><a href="http://www.collegehumor.com/videos/most-viewed/this-year">CollegeHumor\'s Favorite Funny Videos</a></p></div>',
58
- 'expected' => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
59
- 'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
60
- 'name' => 'Embed'
61
- ),
62
- array(
63
- 'markup' => 'http://www.collegehumor.com/video/6830834/mitt-romney-style-gangnam-style-parody',
64
- 'expected' => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
65
- 'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
66
- 'name' => 'URL'
67
- ),
68
- );
 
 
69
 
70
  }
71
 
43
  $request = "http://www.collegehumor.com/oembed.json?url=http%3A%2F%2Fwww.collegehumor.com%2Fvideo%2F$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $result = json_decode( $response['body'] );
49
  $result = $result->thumbnail_url;
52
  }
53
 
54
  // Test cases
55
+ public static function get_test_cases() {
56
+ return array(
57
+ array(
58
+ 'markup' => '<iframe src="http://www.collegehumor.com/e/6830834" width="600" height="338" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe><div style="padding:5px 0; text-align:center; width:600px;"><p><a href="http://www.collegehumor.com/videos/most-viewed/this-year">CollegeHumor\'s Favorite Funny Videos</a></p></div>',
59
+ 'expected' => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
60
+ 'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
61
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
62
+ ),
63
+ array(
64
+ 'markup' => 'http://www.collegehumor.com/video/6830834/mitt-romney-style-gangnam-style-parody',
65
+ 'expected' => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
66
+ 'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
67
+ 'name' => __( 'Video URL', 'video-thumbnails' )
68
+ ),
69
+ );
70
+ }
71
 
72
  }
73
 
php/providers/class-dailymotion-thumbnails.php CHANGED
@@ -45,7 +45,7 @@ class Dailymotion_Thumbnails extends Video_Thumbnails_Providers {
45
  $request = "https://api.dailymotion.com/video/$id?fields=thumbnail_url";
46
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
47
  if( is_wp_error( $response ) ) {
48
- $result = new WP_Error( 'dailymotion_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
49
  } else {
50
  $result = json_decode( $response['body'] );
51
  $result = $result->thumbnail_url;
@@ -54,20 +54,22 @@ class Dailymotion_Thumbnails extends Video_Thumbnails_Providers {
54
  }
55
 
56
  // Test cases
57
- public $test_cases = array(
58
- array(
59
- 'markup' => '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xqlhts"></iframe><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
60
- 'expected' => 'http://s1.dmcdn.net/AMjdy.jpg',
61
- 'expected_hash' => '077888b97839254892a377f51c06e642',
62
- 'name' => 'iFrame player'
63
- ),
64
- array(
65
- 'markup' => '<object width="480" height="270"><param name="movie" value="http://www.dailymotion.com/swf/video/xqlhts"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/xqlhts" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"></embed></object><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
66
- 'expected' => 'http://s1.dmcdn.net/AMjdy.jpg',
67
- 'expected_hash' => '077888b97839254892a377f51c06e642',
68
- 'name' => 'Flash player'
69
- ),
70
- );
 
 
71
 
72
  }
73
 
45
  $request = "https://api.dailymotion.com/video/$id?fields=thumbnail_url";
46
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
47
  if( is_wp_error( $response ) ) {
48
+ $result = $this->construct_info_retrieval_error( $request, $response );
49
  } else {
50
  $result = json_decode( $response['body'] );
51
  $result = $result->thumbnail_url;
54
  }
55
 
56
  // Test cases
57
+ public static function get_test_cases() {
58
+ return array(
59
+ array(
60
+ 'markup' => '<iframe frameborder="0" width="480" height="270" src="http://www.dailymotion.com/embed/video/xqlhts"></iframe><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
61
+ 'expected' => 'http://s1.dmcdn.net/AMjdy.jpg',
62
+ 'expected_hash' => '077888b97839254892a377f51c06e642',
63
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
64
+ ),
65
+ array(
66
+ 'markup' => '<object width="480" height="270"><param name="movie" value="http://www.dailymotion.com/swf/video/xqlhts"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><param name="wmode" value="transparent"></param><embed type="application/x-shockwave-flash" src="http://www.dailymotion.com/swf/video/xqlhts" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always"></embed></object><br /><a href="http://www.dailymotion.com/video/xqlhts_adam-yauch-of-the-beastie-boys-dies-at-47_people" target="_blank">Adam Yauch of the Beastie Boys Dies at 47</a> <i>by <a href="http://www.dailymotion.com/associatedpress" target="_blank">associatedpress</a></i>',
67
+ 'expected' => 'http://s1.dmcdn.net/AMjdy.jpg',
68
+ 'expected_hash' => '077888b97839254892a377f51c06e642',
69
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
70
+ ),
71
+ );
72
+ }
73
 
74
  }
75
 
php/providers/class-facebook-thumbnails.php CHANGED
@@ -45,20 +45,22 @@ class Facebook_Thumbnails extends Video_Thumbnails_Providers {
45
  }
46
 
47
  // Test cases
48
- public $test_cases = array(
49
- array(
50
- 'markup' => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
51
- 'expected' => 'https://graph.facebook.com/2560032632599/picture',
52
- 'expected_hash' => '619591ec126ad889799ad992a227c75e',
53
- 'name' => 'Flash Embed'
54
- ),
55
- array(
56
- 'markup' => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
57
- 'expected' => 'https://graph.facebook.com/2560032632599/picture',
58
- 'expected_hash' => '619591ec126ad889799ad992a227c75e',
59
- 'name' => 'iFrame Embed'
60
- ),
61
- );
 
 
62
 
63
  }
64
 
45
  }
46
 
47
  // Test cases
48
+ public static function get_test_cases() {
49
+ return array(
50
+ array(
51
+ 'markup' => '<object width=420 height=180><param name=allowfullscreen value=true></param><param name=allowscriptaccess value=always></param><param name=movie value="http://www.facebook.com/v/2560032632599"></param><embed src="http://www.facebook.com/v/2560032632599" type="application/x-shockwave-flash" allowscriptaccess=always allowfullscreen=true width=420 height=180></embed></object>',
52
+ 'expected' => 'https://graph.facebook.com/2560032632599/picture',
53
+ 'expected_hash' => '619591ec126ad889799ad992a227c75e',
54
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
55
+ ),
56
+ array(
57
+ 'markup' => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
58
+ 'expected' => 'https://graph.facebook.com/2560032632599/picture',
59
+ 'expected_hash' => '619591ec126ad889799ad992a227c75e',
60
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
61
+ ),
62
+ );
63
+ }
64
 
65
  }
66
 
php/providers/class-funnyordie-thumbnails.php CHANGED
@@ -44,7 +44,7 @@ class Funnyordie_Thumbnails extends Video_Thumbnails_Providers {
44
  $request = "http://www.funnyordie.com/oembed.json?url=http%3A%2F%2Fwww.funnyordie.com%2Fvideos%2F$id";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
- $result = new WP_Error( 'funnyordie_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->thumbnail_url;
@@ -53,20 +53,22 @@ class Funnyordie_Thumbnails extends Video_Thumbnails_Providers {
53
  }
54
 
55
  // Test cases
56
- public $test_cases = array(
57
- array(
58
- 'markup' => '<iframe src="http://www.funnyordie.com/embed/5325b03b52" width="640" height="400" frameborder="0"></iframe>',
59
- 'expected' => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
60
- 'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
61
- 'name' => 'iFrame player'
62
- ),
63
- array(
64
- 'markup' => '<object width="640" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="ordie_player_5325b03b52"><param name="movie" value="http://player.ordienetworks.com/flash/fodplayer.swf" /><param name="flashvars" value="key=5325b03b52" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always"><embed width="640" height="400" flashvars="key=5325b03b52" allowfullscreen="true" allowscriptaccess="always" quality="high" src="http://player.ordienetworks.com/flash/fodplayer.swf" name="ordie_player_5325b03b52" type="application/x-shockwave-flash"></embed></object>',
65
- 'expected' => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
66
- 'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
67
- 'name' => 'Flash player'
68
- ),
69
- );
 
 
70
 
71
  }
72
 
44
  $request = "http://www.funnyordie.com/oembed.json?url=http%3A%2F%2Fwww.funnyordie.com%2Fvideos%2F$id";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
+ $result = $this->construct_info_retrieval_error( $request, $response );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->thumbnail_url;
53
  }
54
 
55
  // Test cases
56
+ public static function get_test_cases() {
57
+ return array(
58
+ array(
59
+ 'markup' => '<iframe src="http://www.funnyordie.com/embed/5325b03b52" width="640" height="400" frameborder="0"></iframe>',
60
+ 'expected' => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
61
+ 'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
62
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
63
+ ),
64
+ array(
65
+ 'markup' => '<object width="640" height="400" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" id="ordie_player_5325b03b52"><param name="movie" value="http://player.ordienetworks.com/flash/fodplayer.swf" /><param name="flashvars" value="key=5325b03b52" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always"><embed width="640" height="400" flashvars="key=5325b03b52" allowfullscreen="true" allowscriptaccess="always" quality="high" src="http://player.ordienetworks.com/flash/fodplayer.swf" name="ordie_player_5325b03b52" type="application/x-shockwave-flash"></embed></object>',
66
+ 'expected' => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
67
+ 'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
68
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
69
+ ),
70
+ );
71
+ }
72
 
73
  }
74
 
php/providers/class-googledrive-thumbnails.php CHANGED
@@ -60,45 +60,47 @@ class GoogleDrive_Thumbnails extends Video_Thumbnails_Providers {
60
  $request = "https://www.googleapis.com/drive/v2/files/$id?fields=thumbnailLink&key=$api_key";
61
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
62
  if( is_wp_error( $response ) ) {
63
- $result = new WP_Error( 'googledrive_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
64
  } else {
65
  $json = json_decode( $response['body'] );
66
  $result = $json->thumbnailLink;
67
  $result = str_replace( '=s220', '=s480', $result );
68
  }
69
  } else {
70
- $result = new WP_Error( 'googledrive_api_key', __( 'You must enter an API key in the <a href="' . admin_url( 'options-general.php?page=video_thumbnails&tab=provider_settings' ) . '">provider settings</a> to retrieve thumbnails from Google Drive.' ) );
71
  }
72
  return $result;
73
  }
74
 
75
  // Test cases
76
- public $test_cases = array(
77
- array(
78
- 'markup' => '<iframe src="https://docs.google.com/file/d/0B2tG5YeQL99ZUHNja3l6am9jSGM/preview?pli=1" width="640" height="385"></iframe>',
79
- 'expected' => 'https://lh3.googleusercontent.com/QL3d7Wh7V_qcXnMpXT6bio77RS0veyCZZ0zQbMX6gd-qH7aeIXBkXlcSJVDEyftiiA=s480',
80
- 'expected_hash' => '3bc674d8d77b342e633ab9e93e345462',
81
- 'name' => 'iFrame embed'
82
- ),
83
- array(
84
- 'markup' => '<iframe height="385" src="https://docs.google.com/a/svpanthers.org/file/d/0BxQsabDaO6USYUgxSUJ3T0ZBa3M/preview" width="100%"></iframe>',
85
- 'expected' => 'https://lh6.googleusercontent.com/WeOdCsaplJ3am25To1uLZiVYkyrilAQ5rxzhjnyyFc5GAF4QeCF1eq3EMpbP7O5dFg=s480',
86
- 'expected_hash' => 'f120755bbd1d35e381cb84a829ac0dfa',
87
- 'name' => 'iFrame embed (Apps account)'
88
- ),
89
- array(
90
- 'markup' => '<object width="500" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed width="500" height="385" type="application/x-shockwave-flash" src="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object>',
91
- 'expected' => 'https://lh3.googleusercontent.com/U_lqaX1o7E9iU75XwCrHZ4pdSi-Vch2F_GK5Ib7WAxgwKTvTl0kMHXm2GxKo1Pcp3Q=s480',
92
- 'expected_hash' => '31cf8e05f981c1beb6e04823ad54d267',
93
- 'name' => 'Flash embed'
94
- ),
95
- array(
96
- 'markup' => '<object style="" id="" data="https://youtube.com/get_player?el=leaf" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" height="720px" width="1280px"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess"><param value="opaque" name="wmode"><param value="allow_embed=0&partnerid=30&autoplay=1&showinfo=0&docid=0B9VJd4kStxIVellHZEdXdmdSamM&el=leaf" name="flashvars"></object>',
97
- 'expected' => 'https://lh5.googleusercontent.com/mHn5gESachhZHi-kbPCRbR6RVXZm3bR7oNNXL97LyYjpzV3Eqty71J2Waw0DPnXKKw=s480',
98
- 'expected_hash' => '2d0ad4881e4b38de0510a103d2f40dd1',
99
- 'name' => 'Flash embed (YouTube player)'
100
- ),
101
- );
 
 
102
 
103
  }
104
 
60
  $request = "https://www.googleapis.com/drive/v2/files/$id?fields=thumbnailLink&key=$api_key";
61
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
62
  if( is_wp_error( $response ) ) {
63
+ $result = $this->construct_info_retrieval_error( $request, $response );
64
  } else {
65
  $json = json_decode( $response['body'] );
66
  $result = $json->thumbnailLink;
67
  $result = str_replace( '=s220', '=s480', $result );
68
  }
69
  } else {
70
+ $result = new WP_Error( 'googledrive_api_key', __( 'You must enter an API key in the <a href="' . admin_url( 'options-general.php?page=video_thumbnails&tab=provider_settings' ) . '">provider settings</a> to retrieve thumbnails from Google Drive.', 'video-thumbnails' ) );
71
  }
72
  return $result;
73
  }
74
 
75
  // Test cases
76
+ public static function get_test_cases() {
77
+ return array(
78
+ array(
79
+ 'markup' => '<iframe src="https://docs.google.com/file/d/0B2tG5YeQL99ZUHNja3l6am9jSGM/preview?pli=1" width="640" height="385"></iframe>',
80
+ 'expected' => 'https://lh3.googleusercontent.com/QL3d7Wh7V_qcXnMpXT6bio77RS0veyCZZ0zQbMX6gd-qH7aeIXBkXlcSJVDEyftiiA=s480',
81
+ 'expected_hash' => '3bc674d8d77b342e633ab9e93e345462',
82
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
83
+ ),
84
+ array(
85
+ 'markup' => '<iframe height="385" src="https://docs.google.com/a/svpanthers.org/file/d/0BxQsabDaO6USYUgxSUJ3T0ZBa3M/preview" width="100%"></iframe>',
86
+ 'expected' => 'https://lh6.googleusercontent.com/WeOdCsaplJ3am25To1uLZiVYkyrilAQ5rxzhjnyyFc5GAF4QeCF1eq3EMpbP7O5dFg=s480',
87
+ 'expected_hash' => 'f120755bbd1d35e381cb84a829ac0dfa',
88
+ 'name' => __( 'iFrame Embed (Apps account)', 'video-thumbnails' )
89
+ ),
90
+ array(
91
+ 'markup' => '<object width="500" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="src" value="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><embed width="500" height="385" type="application/x-shockwave-flash" src="https://video.google.com/get_player?docid=0B92WKFCDHyg9NTRqYTFjVkZmNlk&amp;ps=docs&amp;partnerid=30&amp;cc_load_policy=1" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object>',
92
+ 'expected' => 'https://lh3.googleusercontent.com/U_lqaX1o7E9iU75XwCrHZ4pdSi-Vch2F_GK5Ib7WAxgwKTvTl0kMHXm2GxKo1Pcp3Q=s480',
93
+ 'expected_hash' => '31cf8e05f981c1beb6e04823ad54d267',
94
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
95
+ ),
96
+ array(
97
+ 'markup' => '<object style="" id="" data="https://youtube.com/get_player?el=leaf" wmode="opaque" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash" height="720px" width="1280px"><param value="true" name="allowFullScreen"><param value="always" name="allowscriptaccess"><param value="opaque" name="wmode"><param value="allow_embed=0&partnerid=30&autoplay=1&showinfo=0&docid=0B9VJd4kStxIVellHZEdXdmdSamM&el=leaf" name="flashvars"></object>',
98
+ 'expected' => 'https://lh5.googleusercontent.com/mHn5gESachhZHi-kbPCRbR6RVXZm3bR7oNNXL97LyYjpzV3Eqty71J2Waw0DPnXKKw=s480',
99
+ 'expected_hash' => '2d0ad4881e4b38de0510a103d2f40dd1',
100
+ 'name' => __( 'Flash Embed (YouTube player)', 'video-thumbnails' )
101
+ ),
102
+ );
103
+ }
104
 
105
  }
106
 
php/providers/class-justintv-thumbnails.php CHANGED
@@ -43,7 +43,7 @@ class Justintv_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "http://api.justin.tv/api/clip/show/$id.xml";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'justintv_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $xml = new SimpleXMLElement( $response['body'] );
49
  $result = (string) $xml->object->image_url_large;
@@ -52,14 +52,16 @@ class Justintv_Thumbnails extends Video_Thumbnails_Providers {
52
  }
53
 
54
  // Test cases
55
- public $test_cases = array(
56
- array(
57
- 'markup' => '<object type="application/x-shockwave-flash" height="300" width="400" id="clip_embed_player_flash" data="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" bgcolor="#000000"><param name="movie" value="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="auto_play=false&start_volume=25&title=Title&channel=scamschoolbrian&archive_id=392481524" /></object>',
58
- 'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-392481524-320x240.jpg',
59
- 'expected_hash' => '7f260a2ce6ae75a3c2e5012108f161b7',
60
- 'name' => 'Embed'
61
- ),
62
- );
 
 
63
 
64
  }
65
 
43
  $request = "http://api.justin.tv/api/clip/show/$id.xml";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $xml = new SimpleXMLElement( $response['body'] );
49
  $result = (string) $xml->object->image_url_large;
52
  }
53
 
54
  // Test cases
55
+ public static function get_test_cases() {
56
+ return array(
57
+ array(
58
+ 'markup' => '<object type="application/x-shockwave-flash" height="300" width="400" id="clip_embed_player_flash" data="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" bgcolor="#000000"><param name="movie" value="http://www-cdn.justin.tv/widgets/archive_embed_player.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="auto_play=false&start_volume=25&title=Title&channel=scamschoolbrian&archive_id=392481524" /></object>',
59
+ 'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-392481524-320x240.jpg',
60
+ 'expected_hash' => '7f260a2ce6ae75a3c2e5012108f161b7',
61
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
62
+ ),
63
+ );
64
+ }
65
 
66
  }
67
 
php/providers/class-kaltura-thumbnails.php CHANGED
@@ -43,14 +43,14 @@ class Kaltura_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "http://www.kaltura.com/api_v3/?service=thumbAsset&action=getbyentryid&entryId=$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'kaltura_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $xml = new SimpleXMLElement( $response['body'] );
49
  $result = (string) $xml->result->item->id;
50
  $request = "http://www.kaltura.com/api_v3/?service=thumbAsset&action=geturl&id=$result";
51
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
52
  if( is_wp_error( $response ) ) {
53
- $result = new WP_Error( 'kaltura_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
54
  } else {
55
  $xml = new SimpleXMLElement( $response['body'] );
56
  $result = (string) $xml->result;
@@ -60,13 +60,15 @@ class Kaltura_Thumbnails extends Video_Thumbnails_Providers {
60
  }
61
 
62
  // Test cases
63
- public $test_cases = array(
64
- array(
65
- 'markup' => '<script type="text/javascript" src="http://cdnapi.kaltura.com/p/1374841/sp/137484100/embedIframeJs/uiconf_id/12680902/partner_id/1374841?entry_id=1_y7xzqsxw&playerId=kaltura_player_1363589321&cache_st=1363589321&autoembed=true&width=400&height=333&"></script>',
66
- 'expected' => 'http://example.com/thumbnail.jpg',
67
- 'name' => 'Auto embed'
68
- ),
69
- );
 
 
70
 
71
  }
72
 
43
  $request = "http://www.kaltura.com/api_v3/?service=thumbAsset&action=getbyentryid&entryId=$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $xml = new SimpleXMLElement( $response['body'] );
49
  $result = (string) $xml->result->item->id;
50
  $request = "http://www.kaltura.com/api_v3/?service=thumbAsset&action=geturl&id=$result";
51
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
52
  if( is_wp_error( $response ) ) {
53
+ $result = $this->construct_info_retrieval_error( $request, $response );
54
  } else {
55
  $xml = new SimpleXMLElement( $response['body'] );
56
  $result = (string) $xml->result;
60
  }
61
 
62
  // Test cases
63
+ public static function get_test_cases() {
64
+ return array(
65
+ array(
66
+ 'markup' => '<script type="text/javascript" src="http://cdnapi.kaltura.com/p/1374841/sp/137484100/embedIframeJs/uiconf_id/12680902/partner_id/1374841?entry_id=1_y7xzqsxw&playerId=kaltura_player_1363589321&cache_st=1363589321&autoembed=true&width=400&height=333&"></script>',
67
+ 'expected' => 'http://example.com/thumbnail.jpg',
68
+ 'name' => __( 'Auto Embed', 'video-thumbnails' )
69
+ ),
70
+ );
71
+ }
72
 
73
  }
74
 
php/providers/class-metacafe-thumbnails.php CHANGED
@@ -43,7 +43,7 @@ class Metacafe_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "http://www.metacafe.com/api/item/$id/";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'metacafe_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $xml = new SimpleXMLElement( $response['body'] );
49
  $result = $xml->xpath( "/rss/channel/item/media:thumbnail/@url" );
@@ -53,14 +53,16 @@ class Metacafe_Thumbnails extends Video_Thumbnails_Providers {
53
  }
54
 
55
  // Test cases
56
- public $test_cases = array(
57
- array(
58
- 'markup' => '<embed flashVars="playerVars=autoPlay=no" src="http://www.metacafe.com/fplayer/8456223/men_in_black_3_trailer_2.swf" width="440" height="248" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_8456223" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>',
59
- 'expected' => 'http://s4.mcstatic.com/thumb/8456223/22479418/4/catalog_item5/0/1/men_in_black_3_trailer_2.jpg',
60
- 'expected_hash' => 'df46215fef1d9fb68eea64ba3ed9a4fd',
61
- 'name' => 'Embed'
62
- ),
63
- );
 
 
64
 
65
  }
66
 
43
  $request = "http://www.metacafe.com/api/item/$id/";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $xml = new SimpleXMLElement( $response['body'] );
49
  $result = $xml->xpath( "/rss/channel/item/media:thumbnail/@url" );
53
  }
54
 
55
  // Test cases
56
+ public static function get_test_cases() {
57
+ return array(
58
+ array(
59
+ 'markup' => '<embed flashVars="playerVars=autoPlay=no" src="http://www.metacafe.com/fplayer/8456223/men_in_black_3_trailer_2.swf" width="440" height="248" wmode="transparent" allowFullScreen="true" allowScriptAccess="always" name="Metacafe_8456223" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed>',
60
+ 'expected' => 'http://s4.mcstatic.com/thumb/8456223/22479418/4/catalog_item5/0/1/men_in_black_3_trailer_2.jpg',
61
+ 'expected_hash' => 'df46215fef1d9fb68eea64ba3ed9a4fd',
62
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
63
+ ),
64
+ );
65
+ }
66
 
67
  }
68
 
php/providers/class-mpora-thumbnails.php CHANGED
@@ -45,20 +45,23 @@ class Mpora_Thumbnails extends Video_Thumbnails_Providers {
45
  }
46
 
47
  // Test cases
48
- public $test_cases = array(
49
- array(
50
- 'markup' => '<object width="480" height="270" id="mporaplayer_wEr2CBooV_N" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" ><param name="movie" value="http://video.mpora.com/ep/wEr2CBooV/"></param><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><embed src="http://video.mpora.com/ep/wEr2CBooV/" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>',
51
- 'expected' => 'http://ugc4.mporatrons.com/thumbs/wEr2CBooV_640x360_0000.jpg',
52
- 'expected_hash' => '95075bd4941251ebecbab3b436a90c49',
53
- 'name' => 'Flash player'
54
- ),
55
- array(
56
- 'markup' => '<iframe width="640" height="360" src="http://mpora.com/videos/AAdfegovdop0/embed" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
57
- 'expected' => 'http://ugc4.mporatrons.com/thumbs/AAdfegovdop0_640x360_0000.jpg',
58
- 'expected_hash' => '45db22a2ba5ef20163f52ba562b89259',
59
- 'name' => 'iFrame player'
60
- ),
61
- );
 
 
 
62
  }
63
 
64
  // Add to provider array
45
  }
46
 
47
  // Test cases
48
+ public static function get_test_cases() {
49
+ return array(
50
+ array(
51
+ 'markup' => '<object width="480" height="270" id="mporaplayer_wEr2CBooV_N" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" type="application/x-shockwave-flash" ><param name="movie" value="http://video.mpora.com/ep/wEr2CBooV/"></param><param name="wmode" value="transparent"></param><param name="allowScriptAccess" value="always"></param><param name="allowFullScreen" value="true"></param><embed src="http://video.mpora.com/ep/wEr2CBooV/" width="480" height="270" wmode="transparent" allowfullscreen="true" allowscriptaccess="always" type="application/x-shockwave-flash"></embed></object>',
52
+ 'expected' => 'http://ugc4.mporatrons.com/thumbs/wEr2CBooV_640x360_0000.jpg',
53
+ 'expected_hash' => '95075bd4941251ebecbab3b436a90c49',
54
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
55
+ ),
56
+ array(
57
+ 'markup' => '<iframe width="640" height="360" src="http://mpora.com/videos/AAdfegovdop0/embed" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
58
+ 'expected' => 'http://ugc4.mporatrons.com/thumbs/AAdfegovdop0_640x360_0000.jpg',
59
+ 'expected_hash' => '45db22a2ba5ef20163f52ba562b89259',
60
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
61
+ ),
62
+ );
63
+ }
64
+
65
  }
66
 
67
  // Add to provider array
php/providers/class-rutube-thumbnails.php CHANGED
@@ -44,7 +44,7 @@ class Rutube_Thumbnails extends Video_Thumbnails_Providers {
44
  $request = "http://rutube.ru/api/video/$id/?format=json";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
- $result = new WP_Error( 'rutube_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->thumbnail_url;
@@ -53,20 +53,22 @@ class Rutube_Thumbnails extends Video_Thumbnails_Providers {
53
  }
54
 
55
  // Test cases
56
- public $test_cases = array(
57
- array(
58
- 'markup' => 'http://rutube.ru/video/ca8607cd4f7ef28516e043dde0068564/',
59
- 'expected' => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
60
- 'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
61
- 'name' => 'Video link'
62
- ),
63
- array(
64
- 'markup' => '<iframe width="720" height="405" src="//rutube.ru/video/embed/6608735" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
65
- 'expected' => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
66
- 'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
67
- 'name' => 'iFrame embed'
68
- ),
69
- );
 
 
70
 
71
  }
72
 
44
  $request = "http://rutube.ru/api/video/$id/?format=json";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
+ $result = $this->construct_info_retrieval_error( $request, $response );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->thumbnail_url;
53
  }
54
 
55
  // Test cases
56
+ public static function get_test_cases() {
57
+ return array(
58
+ array(
59
+ 'markup' => 'http://rutube.ru/video/ca8607cd4f7ef28516e043dde0068564/',
60
+ 'expected' => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
61
+ 'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
62
+ 'name' => __( 'Video URL', 'video-thumbnails' )
63
+ ),
64
+ array(
65
+ 'markup' => '<iframe width="720" height="405" src="//rutube.ru/video/embed/6608735" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
66
+ 'expected' => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
67
+ 'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
68
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
69
+ ),
70
+ );
71
+ }
72
 
73
  }
74
 
php/providers/class-twitch-thumbnails.php CHANGED
@@ -44,7 +44,7 @@ class Twitch_Thumbnails extends Video_Thumbnails_Providers {
44
  $request = "https://api.twitch.tv/kraken/videos/c$id";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
- $result = new WP_Error( 'twitch_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->preview;
@@ -53,20 +53,22 @@ class Twitch_Thumbnails extends Video_Thumbnails_Providers {
53
  }
54
 
55
  // Test cases
56
- public $test_cases = array(
57
- array(
58
- 'markup' => 'http://www.twitch.tv/vanillatv/c/1537974',
59
- 'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
60
- 'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
61
- 'name' => 'Video link'
62
- ),
63
- array(
64
- 'markup' => '<object bgcolor="#000000" data="http://www.twitch.tv/widgets/archive_embed_player.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/widgets/archive_embed_player.swf"><param name="allowScriptAccess" value="always"><param name="allowNetworking" value="all"><param name="allowFullScreen" value="true"><param name="flashvars" value="title=VanillaTV%2B-%2BSweden%2Bvs%2BRussia%2B-%2BETF2L%2BNations%2BCup%2B-%2BSnakewater%2B%255BMap3%255D%2B-%2BPart%2B3&amp;channel=vanillatv&amp;auto_play=false&amp;start_volume=25&amp;chapter_id=1537974"></object>',
65
- 'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
66
- 'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
67
- 'name' => 'Flash embed'
68
- ),
69
- );
 
 
70
 
71
  }
72
 
44
  $request = "https://api.twitch.tv/kraken/videos/c$id";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
+ $result = $this->construct_info_retrieval_error( $request, $response );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->preview;
53
  }
54
 
55
  // Test cases
56
+ public static function get_test_cases() {
57
+ return array(
58
+ array(
59
+ 'markup' => 'http://www.twitch.tv/vanillatv/c/1537974',
60
+ 'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
61
+ 'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
62
+ 'name' => __( 'Video URL', 'video-thumbnails' )
63
+ ),
64
+ array(
65
+ 'markup' => '<object bgcolor="#000000" data="http://www.twitch.tv/widgets/archive_embed_player.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/widgets/archive_embed_player.swf"><param name="allowScriptAccess" value="always"><param name="allowNetworking" value="all"><param name="allowFullScreen" value="true"><param name="flashvars" value="title=VanillaTV%2B-%2BSweden%2Bvs%2BRussia%2B-%2BETF2L%2BNations%2BCup%2B-%2BSnakewater%2B%255BMap3%255D%2B-%2BPart%2B3&amp;channel=vanillatv&amp;auto_play=false&amp;start_volume=25&amp;chapter_id=1537974"></object>',
66
+ 'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-328087483-320x240.jpg',
67
+ 'expected_hash' => 'f3921b65f799aa648ef6dae29871c137',
68
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
69
+ ),
70
+ );
71
+ }
72
 
73
  }
74
 
php/providers/class-video-thumbnails-providers.php CHANGED
@@ -81,6 +81,18 @@ class Video_Thumbnails_Providers {
81
  return $videos;
82
  }
83
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  // // Requires PHP 5.3.0+
85
  // public static function register_provider( $providers ) {
86
  // $providers[] = new static;
81
  return $videos;
82
  }
83
 
84
+ /**
85
+ * Constructs a WP_Error object after failed API retrieval
86
+ * @param string $request The URL wp_remote_get() failed to retrieve
87
+ * @param WP_Error $response A WP_Error object returned by the failed wp_remote_get()
88
+ * @return WP_Error An error object with a descriptive message including troubleshooting instructions
89
+ */
90
+ function construct_info_retrieval_error( $request, $response ) {
91
+ $code = $this->service_slug . '_info_retrieval';
92
+ $message = sprintf( __( 'Error retrieving video information from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $request ) . '<br />' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message();
93
+ return new WP_Error( $code, $message );
94
+ }
95
+
96
  // // Requires PHP 5.3.0+
97
  // public static function register_provider( $providers ) {
98
  // $providers[] = new static;
php/providers/class-vimeo-thumbnails.php CHANGED
@@ -87,11 +87,11 @@ class Vimeo_Thumbnails extends Video_Thumbnails_Providers {
87
  $request = "http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/$id";
88
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
89
  if( is_wp_error( $response ) ) {
90
- $result = new WP_Error( 'vimeo_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
91
  } elseif ( $response['response']['code'] == 404 ) {
92
- $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 404 error.<br />Details: ' . $response['response']['message'] ) );
93
  } elseif ( $response['response']['code'] == 403 ) {
94
- $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 403 error.<br />This can occur when a video has embedding disabled or restricted to certain domains. Try entering API credentials in the provider settings.' ) );
95
  } else {
96
  $result = json_decode( $response['body'] );
97
  $result = $result->thumbnail_url;
@@ -101,26 +101,28 @@ class Vimeo_Thumbnails extends Video_Thumbnails_Providers {
101
  }
102
 
103
  // Test cases
104
- public $test_cases = array(
105
- array(
106
- 'markup' => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
107
- 'expected' => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
108
- 'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
109
- 'name' => 'iFrame'
110
- ),
111
- array(
112
- 'markup' => '<object width="500" height="281"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
113
- 'expected' => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
114
- 'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
115
- 'name' => 'Old embed'
116
- ),
117
- array(
118
- 'markup' => 'https://vimeo.com/channels/soundworkscollection/44520894',
119
- 'expected' => 'http://b.vimeocdn.com/ts/313/130/313130530_640.jpg',
120
- 'expected_hash' => 'e9fd72872a39272f6c540ee66b1ecf28',
121
- 'name' => 'Channel URL'
122
- ),
123
- );
 
 
124
 
125
  }
126
 
87
  $request = "http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/$id";
88
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
89
  if( is_wp_error( $response ) ) {
90
+ $result = $this->construct_info_retrieval_error( $request, $response );
91
  } elseif ( $response['response']['code'] == 404 ) {
92
+ $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 404 error.<br />Details: ' . $response['response']['message'], 'video-thumbnails' ) );
93
  } elseif ( $response['response']['code'] == 403 ) {
94
+ $result = new WP_Error( 'vimeo_info_retrieval', __( 'The Vimeo endpoint located at <a href="' . $request . '">' . $request . '</a> returned a 403 error.<br />This can occur when a video has embedding disabled or restricted to certain domains. Try entering API credentials in the provider settings.', 'video-thumbnails' ) );
95
  } else {
96
  $result = json_decode( $response['body'] );
97
  $result = $result->thumbnail_url;
101
  }
102
 
103
  // Test cases
104
+ public static function get_test_cases() {
105
+ return array(
106
+ array(
107
+ 'markup' => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
108
+ 'expected' => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
109
+ 'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
110
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
111
+ ),
112
+ array(
113
+ 'markup' => '<object width="500" height="281"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&amp;force_embed=1&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00adef&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
114
+ 'expected' => 'http://b.vimeocdn.com/ts/287/850/287850781_1280.jpg',
115
+ 'expected_hash' => 'c60989d7ef599cfd07ec196c35a43623',
116
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
117
+ ),
118
+ array(
119
+ 'markup' => 'https://vimeo.com/channels/soundworkscollection/44520894',
120
+ 'expected' => 'http://b.vimeocdn.com/ts/313/130/313130530_640.jpg',
121
+ 'expected_hash' => 'e9fd72872a39272f6c540ee66b1ecf28',
122
+ 'name' => __( 'Channel URL', 'video-thumbnails' )
123
+ ),
124
+ );
125
+ }
126
 
127
  }
128
 
php/providers/class-vine-thumbnails.php CHANGED
@@ -43,7 +43,7 @@ class Vine_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "https://vine.co/v/$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'vine_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $doc = new DOMDocument();
49
  @$doc->loadHTML( $response['body'] );
@@ -60,14 +60,16 @@ class Vine_Thumbnails extends Video_Thumbnails_Providers {
60
  }
61
 
62
  // Test cases
63
- public $test_cases = array(
64
- array(
65
- 'markup' => '<iframe class="vine-embed" src="https://vine.co/v/bpj7Km0T3d5/embed/simple" width="600" height="600" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>',
66
- 'expected' => 'https://v.cdn.vine.co/v/thumbs/D6DDE013-F8DA-4929-9BED-49568F424343-184-00000008A20C1AEC_1.0.6.mp4.jpg',
67
- 'expected_hash' => '7cca5921108abe15b8c1c1f884a5b3ac',
68
- 'name' => 'Embed/Video URL'
69
- ),
70
- );
 
 
71
 
72
  }
73
 
43
  $request = "https://vine.co/v/$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $doc = new DOMDocument();
49
  @$doc->loadHTML( $response['body'] );
60
  }
61
 
62
  // Test cases
63
+ public static function get_test_cases() {
64
+ return array(
65
+ array(
66
+ 'markup' => '<iframe class="vine-embed" src="https://vine.co/v/bpj7Km0T3d5/embed/simple" width="600" height="600" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script>',
67
+ 'expected' => 'https://v.cdn.vine.co/v/thumbs/D6DDE013-F8DA-4929-9BED-49568F424343-184-00000008A20C1AEC_1.0.6.mp4.jpg',
68
+ 'expected_hash' => '7cca5921108abe15b8c1c1f884a5b3ac',
69
+ 'name' => __( 'iFrame Embed/Video URL', 'video-thumbnails' )
70
+ ),
71
+ );
72
+ }
73
 
74
  }
75
 
php/providers/class-vk-thumbnails.php CHANGED
@@ -43,7 +43,7 @@ class VK_Thumbnails extends Video_Thumbnails_Providers {
43
  $request = "http:$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
- $result = new WP_Error( 'vk_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
47
  } else {
48
  $doc = new DOMDocument();
49
  @$doc->loadHTML( $response['body'] );
@@ -60,14 +60,16 @@ class VK_Thumbnails extends Video_Thumbnails_Providers {
60
  }
61
 
62
  // Test cases
63
- public $test_cases = array(
64
- array(
65
- 'markup' => '<iframe src="http://vk.com/video_ext.php?oid=157000410&id=164106383&hash=0fdb5f49218be7c2&hd=1" width="607" height="360" frameborder="0"></iframe>',
66
- 'expected' => 'http://cs513416.vk.me/u157000410/video/l_73b292cc.jpg',
67
- 'expected_hash' => '6d4b086ff1a55c9b48f56bc7848e6c84',
68
- 'name' => 'iFrame'
69
- ),
70
- );
 
 
71
 
72
  }
73
 
43
  $request = "http:$id";
44
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
45
  if( is_wp_error( $response ) ) {
46
+ $result = $this->construct_info_retrieval_error( $request, $response );
47
  } else {
48
  $doc = new DOMDocument();
49
  @$doc->loadHTML( $response['body'] );
60
  }
61
 
62
  // Test cases
63
+ public static function get_test_cases() {
64
+ return array(
65
+ array(
66
+ 'markup' => '<iframe src="http://vk.com/video_ext.php?oid=157000410&id=164106383&hash=0fdb5f49218be7c2&hd=1" width="607" height="360" frameborder="0"></iframe>',
67
+ 'expected' => 'http://cs513416.vk.me/u157000410/video/l_73b292cc.jpg',
68
+ 'expected_hash' => '6d4b086ff1a55c9b48f56bc7848e6c84',
69
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
70
+ ),
71
+ );
72
+ }
73
 
74
  }
75
 
php/providers/class-wistia-thumbnails.php CHANGED
@@ -65,7 +65,7 @@ class Wistia_Thumbnails extends Video_Thumbnails_Providers {
65
  $request = "http://fast.wistia.com/oembed?url=$id";
66
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
67
  if( is_wp_error( $response ) ) {
68
- $result = new WP_Error( 'wistia_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
69
  } else {
70
  $result = json_decode( $response['body'] );
71
  $result = $result->thumbnail_url;
@@ -76,20 +76,22 @@ class Wistia_Thumbnails extends Video_Thumbnails_Providers {
76
  }
77
 
78
  // Test cases
79
- public $test_cases = array(
80
- array(
81
- 'markup' => '<iframe src="http://fast.wistia.net/embed/iframe/po4utu3zde?controlsVisibleOnLoad=true&version=v1&videoHeight=360&videoWidth=640&volumeControl=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" width="640" height="360"></iframe>',
82
- 'expected' => 'https://embed-ssl.wistia.com/deliveries/6928fcba8355e38de4d95863a659e1de23cb2071.jpg',
83
- 'expected_hash' => 'bc4a2cec9ac97e2ccdae2c7387a01cb4',
84
- 'name' => 'Inline player'
85
- ),
86
- array(
87
- 'markup' => '<div class=\'wistia_embed\' data-video-height=\'312\' data-video-width=\'499\' id=\'wistia_j1qd2lvys1\'></div> <script charset=\'ISO-8859-1\' src=\'http://fast.wistia.com/static/concat/E-v1.js\'></script> <script> var platform = ( Modernizr.touch ) ? "html5" : "flash"; wistiaEmbed = Wistia.embed("j1qd2lvys1", { version: "v1", videoWidth: 499, videoHeight: 312, playButton: Modernizr.touch, smallPlayButton: Modernizr.touch, playbar: Modernizr.touch, platformPreference: platform, chromeless: Modernizr.touch ? false : true, fullscreenButton: false, autoPlay: !Modernizr.touch, videoFoam: true }); </script>',
88
- 'expected' => 'https://embed-ssl.wistia.com/deliveries/a086707fe096e7f3fbefef1d1dcba1488d23a3e9.jpg',
89
- 'expected_hash' => '4c63d131604bfc07b5178413ab245813',
90
- 'name' => 'JavaScript API embedding'
91
- ),
92
- );
 
 
93
 
94
  }
95
 
65
  $request = "http://fast.wistia.com/oembed?url=$id";
66
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
67
  if( is_wp_error( $response ) ) {
68
+ $result = $this->construct_info_retrieval_error( $request, $response );
69
  } else {
70
  $result = json_decode( $response['body'] );
71
  $result = $result->thumbnail_url;
76
  }
77
 
78
  // Test cases
79
+ public static function get_test_cases() {
80
+ return array(
81
+ array(
82
+ 'markup' => '<iframe src="http://fast.wistia.net/embed/iframe/po4utu3zde?controlsVisibleOnLoad=true&version=v1&videoHeight=360&videoWidth=640&volumeControl=true" allowtransparency="true" frameborder="0" scrolling="no" class="wistia_embed" name="wistia_embed" width="640" height="360"></iframe>',
83
+ 'expected' => 'https://embed-ssl.wistia.com/deliveries/6928fcba8355e38de4d95863a659e1de23cb2071.jpg',
84
+ 'expected_hash' => 'bc4a2cec9ac97e2ccdae2c7387a01cb4',
85
+ 'name' => __( 'iFrame Embed', 'video-thumbnails' )
86
+ ),
87
+ array(
88
+ 'markup' => '<div class=\'wistia_embed\' data-video-height=\'312\' data-video-width=\'499\' id=\'wistia_j1qd2lvys1\'></div> <script charset=\'ISO-8859-1\' src=\'http://fast.wistia.com/static/concat/E-v1.js\'></script> <script> var platform = ( Modernizr.touch ) ? "html5" : "flash"; wistiaEmbed = Wistia.embed("j1qd2lvys1", { version: "v1", videoWidth: 499, videoHeight: 312, playButton: Modernizr.touch, smallPlayButton: Modernizr.touch, playbar: Modernizr.touch, platformPreference: platform, chromeless: Modernizr.touch ? false : true, fullscreenButton: false, autoPlay: !Modernizr.touch, videoFoam: true }); </script>',
89
+ 'expected' => 'https://embed-ssl.wistia.com/deliveries/a086707fe096e7f3fbefef1d1dcba1488d23a3e9.jpg',
90
+ 'expected_hash' => '4c63d131604bfc07b5178413ab245813',
91
+ 'name' => __( 'JavaScript Embed', 'video-thumbnails' )
92
+ ),
93
+ );
94
+ }
95
 
96
  }
97
 
php/providers/class-youku-thumbnails.php CHANGED
@@ -44,7 +44,7 @@ class Youku_Thumbnails extends Video_Thumbnails_Providers {
44
  $request = "http://v.youku.com/player/getPlayList/VideoIDS/$id/";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
- $result = new WP_Error( 'youku_info_retrieval', __( 'Error retrieving video information from the URL <a href="' . $request . '">' . $request . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->data[0]->logo;
@@ -53,20 +53,22 @@ class Youku_Thumbnails extends Video_Thumbnails_Providers {
53
  }
54
 
55
  // Test cases
56
- public $test_cases = array(
57
- array(
58
- 'markup' => '<embed src="http://player.youku.com/player.php/sid/XMzQyMzk5MzQ4/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" allowFullscreen="true" type="application/x-shockwave-flash"></embed>',
59
- 'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
60
- 'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
61
- 'name' => 'Flash embed'
62
- ),
63
- array(
64
- 'markup' => 'http://v.youku.com/v_show/id_XMzQyMzk5MzQ4.html',
65
- 'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
66
- 'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
67
- 'name' => 'Link'
68
- ),
69
- );
 
 
70
 
71
  }
72
 
44
  $request = "http://v.youku.com/player/getPlayList/VideoIDS/$id/";
45
  $response = wp_remote_get( $request, array( 'sslverify' => false ) );
46
  if( is_wp_error( $response ) ) {
47
+ $result = $this->construct_info_retrieval_error( $request, $response );
48
  } else {
49
  $result = json_decode( $response['body'] );
50
  $result = $result->data[0]->logo;
53
  }
54
 
55
  // Test cases
56
+ public static function get_test_cases() {
57
+ return array(
58
+ array(
59
+ 'markup' => '<embed src="http://player.youku.com/player.php/sid/XMzQyMzk5MzQ4/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" allowFullscreen="true" type="application/x-shockwave-flash"></embed>',
60
+ 'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
61
+ 'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
62
+ 'name' => __( 'Flash Embed', 'video-thumbnails' )
63
+ ),
64
+ array(
65
+ 'markup' => 'http://v.youku.com/v_show/id_XMzQyMzk5MzQ4.html',
66
+ 'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
67
+ 'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
68
+ 'name' => __( 'Video URL', 'video-thumbnails' )
69
+ ),
70
+ );
71
+ }
72
 
73
  }
74
 
php/providers/class-youtube-thumbnails.php CHANGED
@@ -55,32 +55,34 @@ class YouTube_Thumbnails extends Video_Thumbnails_Providers {
55
  }
56
 
57
  // Test cases
58
- public $test_cases = array(
59
- array(
60
- 'markup' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/Fp0U2Vglkjw" frameborder="0" allowfullscreen></iframe>',
61
- 'expected' => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
62
- 'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
63
- 'name' => 'iFrame HD'
64
- ),
65
- array(
66
- 'markup' => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
67
- 'expected' => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
68
- 'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
69
- 'name' => 'Old embed HD'
70
- ),
71
- array(
72
- 'markup' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/vv_AitYPjtc" frameborder="0" allowfullscreen></iframe>',
73
- 'expected' => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
74
- 'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
75
- 'name' => 'iFrame SD'
76
- ),
77
- array(
78
- 'markup' => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
79
- 'expected' => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
80
- 'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
81
- 'name' => 'Old embed SD'
82
- ),
83
- );
 
 
84
 
85
  }
86
 
55
  }
56
 
57
  // Test cases
58
+ public static function get_test_cases() {
59
+ return array(
60
+ array(
61
+ 'markup' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/Fp0U2Vglkjw" frameborder="0" allowfullscreen></iframe>',
62
+ 'expected' => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
63
+ 'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
64
+ 'name' => __( 'iFrame Embed HD', 'video-thumbnails' )
65
+ ),
66
+ array(
67
+ 'markup' => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
68
+ 'expected' => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
69
+ 'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
70
+ 'name' => __( 'Flash Embed HD', 'video-thumbnails' )
71
+ ),
72
+ array(
73
+ 'markup' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/vv_AitYPjtc" frameborder="0" allowfullscreen></iframe>',
74
+ 'expected' => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
75
+ 'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
76
+ 'name' => __( 'iFrame Embed SD', 'video-thumbnails' )
77
+ ),
78
+ array(
79
+ 'markup' => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/vv_AitYPjtc?version=3&amp;hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
80
+ 'expected' => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
81
+ 'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
82
+ 'name' => __( 'Flash Embed SD', 'video-thumbnails' )
83
+ ),
84
+ );
85
+ }
86
 
87
  }
88
 
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.8.1
7
- Stable tag: 2.6.3
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
@@ -118,6 +118,9 @@ The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try
118
 
119
  == Changelog ==
120
 
 
 
 
121
  = 2.6.3 =
122
  * Better Google Drive detection (added support for underscores or dashes in the ID)
123
 
4
  Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
5
  Requires at least: 3.2
6
  Tested up to: 3.8.1
7
+ Stable tag: 2.7
8
 
9
  Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
10
 
118
 
119
  == Changelog ==
120
 
121
+ = 2.7 =
122
+ * Video Thumbnails is now translation ready and looking for volunteers
123
+
124
  = 2.6.3 =
125
  * Better Google Drive detection (added support for underscores or dashes in the ID)
126
 
video-thumbnails.php CHANGED
@@ -5,8 +5,10 @@ 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.6.3
9
  License: GPL2
 
 
10
  */
11
  /* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
12
 
@@ -28,7 +30,7 @@ License: GPL2
28
 
29
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
30
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
31
- define( 'VIDEO_THUMBNAILS_VERSION', '2.6.3' );
32
 
33
  // Providers
34
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
@@ -48,6 +50,9 @@ class Video_Thumbnails {
48
 
49
  function __construct() {
50
 
 
 
 
51
  // Create provider array
52
  $this->providers = apply_filters( 'video_thumbnail_providers', $this->providers );
53
 
@@ -84,17 +89,40 @@ class Video_Thumbnails {
84
 
85
  }
86
 
 
 
 
 
 
 
 
87
  /**
88
  * Adds the admin menu items
89
  */
90
  function admin_menu() {
91
- add_management_page( 'Bulk Video Thumbnails', 'Bulk Video Thumbs', 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
92
  }
93
 
94
  function admin_scripts( $hook ) {
95
  // Bulk tool page
96
  if ( 'tools_page_video-thumbnails-bulk' == $hook ) {
97
  wp_enqueue_script( 'video-thumbnails-bulk-js', plugins_url( '/js/bulk.js' , __FILE__ ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  wp_enqueue_style( 'video-thumbnails-bulk-css', plugins_url('/css/bulk.css', __FILE__), false, VIDEO_THUMBNAILS_VERSION );
99
  }
100
  }
@@ -115,7 +143,7 @@ class Video_Thumbnails {
115
  add_thickbox();
116
  ?>
117
  <div id="video-thumbnail-not-found-troubleshooting" style="display:none;">
118
- <h2><?php _e( 'Troubleshooting Video Thumbnails' ); ?></h2>
119
  <?php $this->no_video_thumbnail_troubleshooting_instructions(); ?>
120
  </div>
121
  <?php
@@ -127,16 +155,16 @@ class Video_Thumbnails {
127
 
128
  if ( get_post_status() == 'publish' || get_post_status() == 'private' ) {
129
  if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
130
- echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">Reset Video Thumbnail</a></p>';
131
  } else {
132
- echo '<p id="video-thumbnails-preview">No video thumbnail for this post.</p>';
133
- echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">Search Again</a> <a href="#TB_inline?width=400&height=600&inlineId=video-thumbnail-not-found-troubleshooting" class="thickbox" style="float:right;">Troubleshoot<a/></p>';
134
  }
135
  } else {
136
  if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
137
- echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">Reset Video Thumbnail</a></p>';
138
  } else {
139
- echo '<p>A video thumbnail will be found for this post when it is published.</p>';
140
  }
141
  }
142
  }
@@ -146,15 +174,15 @@ class Video_Thumbnails {
146
  */
147
  public static function no_video_thumbnail_troubleshooting_instructions() {
148
  ?>
149
- <h3>Fixing "No video thumbnail for this post"</h3>
150
  <ol>
151
- <li>Ensure you have saved any changes to your post.</li>
152
- <li>If you are using a a plugin or theme that stores videos in a special location other than the main post content area, be sure you've entered the correct custom field on the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails' ); ?>">settings page</a>. If you don't know the name of the field your video is being saved in, please contact the developer of that theme or plugin.</li>
153
- <li>Copy and paste your embed code into the "Test Markup for Video" section of the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ); ?>">Debugging page</a>. If this doesn't find the thumbnail, you'll want to be sure to include the embed code you scanned when you request support. If it does find a thumbnail, please double check that you have the Custom Field set correctly in the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails' ); ?>">settings page</a> if you are using a a plugin or theme that stores videos in a special location.</li>
154
- <li>Go to the <a href="<?php echo admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ); ?>">Debugging page</a> and click "Test Image Downloading" to test your server's ability to save an image from a video source.</li>
155
- <li>Try posting a video from other sources to help narrow down the problem.</li>
156
- <li>Search the <a href="http://wordpress.org/support/plugin/video-thumbnails">support threads</a> to see if anyone has had the same issue.</li>
157
- <li>If you are still unable to resolve the problem, <a href="http://wordpress.org/support/plugin/video-thumbnails">start a thread</a> with a <strong>good descriptive</strong> title ("Error" or "No thumbnails" is a <strong>bad</strong> title) and be sure to include the results of your testing as well. Also be sure to include the <strong>name of your theme</strong>, any <strong>video plugins</strong> you're using, and any other details you can think of.</li>
158
  </ol>
159
  <?php
160
  }
@@ -315,7 +343,7 @@ class Video_Thumbnails {
315
  $error = '';
316
  $response = wp_remote_get( $image_url, array( 'sslverify' => false ) );
317
  if( is_wp_error( $response ) ) {
318
- $error = new WP_Error( 'thumbnail_retrieval', __( 'Error retrieving a thumbnail from the URL <a href="' . $image_url . '">' . $image_url . '</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.<br />Details: ' . $response->get_error_message() ) );
319
  } else {
320
  $image_contents = $response['body'];
321
  $image_type = wp_remote_retrieve_header( $response, 'content-type' );
@@ -333,7 +361,7 @@ class Video_Thumbnails {
333
  } elseif ( $image_type == 'image/gif' ) {
334
  $image_extension = '.gif';
335
  } else {
336
- return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:' ) . ' ' . $image_type );
337
  }
338
 
339
  // Construct a file name with extension
@@ -346,7 +374,7 @@ class Video_Thumbnails {
346
 
347
  // Stop for any errors while saving the data or else continue adding the image to the media library
348
  if ( $upload['error'] ) {
349
- $error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:' ) . ' ' . $upload['error'] );
350
  return $error;
351
  } else {
352
 
@@ -390,7 +418,7 @@ class Video_Thumbnails {
390
  echo ' action: "reset_video_thumbnail",' . PHP_EOL;
391
  echo ' post_id: id' . PHP_EOL;
392
  echo ' };' . PHP_EOL;
393
- echo ' document.getElementById(\'video-thumbnails-preview\').innerHTML=\'Working... <img src="' . home_url( 'wp-admin/images/loading.gif' ) . '"/>\';' . PHP_EOL;
394
  echo ' jQuery.post(ajaxurl, data, function(response){' . PHP_EOL;
395
  echo ' document.getElementById(\'video-thumbnails-preview\').innerHTML=response;' . PHP_EOL;
396
  echo ' });' . PHP_EOL;
@@ -413,7 +441,7 @@ class Video_Thumbnails {
413
  } else if ( $video_thumbnail != null ) {
414
  echo '<img src="' . $video_thumbnail . '" style="max-width:100%;" />';
415
  } else {
416
- echo 'No video thumbnail for this post.';
417
  }
418
 
419
  die();
@@ -468,15 +496,15 @@ class Video_Thumbnails {
468
  function bulk_scanning_page() {
469
 
470
  if ( ! current_user_can( 'manage_options' ) ) {
471
- wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
472
  }
473
 
474
  ?>
475
  <div class="wrap">
476
 
477
- <div id="icon-tools" class="icon32"></div><h2>Bulk Video Thumbnail Generator</h2>
478
 
479
- <p>Use this tool to scan all of your posts for Video Thumbnails.</p>
480
 
481
  <form id="video-thumbnails-bulk-scan-options">
482
  <table class="form-table">
@@ -485,7 +513,7 @@ class Video_Thumbnails {
485
  <tr valign="top">
486
  <th scope="row"><span id="queue-count">...</span></th>
487
  <td>
488
- <input type="submit" value="Scan Now" class="button button-primary">
489
  </td>
490
  </tr>
491
  </tbody>
@@ -497,10 +525,20 @@ class Video_Thumbnails {
497
  <span class="percentage">0%</span>
498
  <div class="progress-bar">&nbsp;</div>
499
  </div>
500
- <div class="stats">
501
- <div class="scanned"></div>
502
- <div class="found"></div>
503
- </div>
 
 
 
 
 
 
 
 
 
 
504
  <ul class="log"></ul>
505
  </div>
506
 
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.7
9
  License: GPL2
10
+ Text Domain: video-thumbnails
11
+ Domain Path: /languages/
12
  */
13
  /* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
14
 
30
 
31
  define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
32
  define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
33
+ define( 'VIDEO_THUMBNAILS_VERSION', '2.7' );
34
 
35
  // Providers
36
  require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-providers.php' );
50
 
51
  function __construct() {
52
 
53
+ // Load translations
54
+ add_action( 'plugins_loaded', array( &$this, 'plugin_textdomain' ));
55
+
56
  // Create provider array
57
  $this->providers = apply_filters( 'video_thumbnail_providers', $this->providers );
58
 
89
 
90
  }
91
 
92
+ /**
93
+ * Load language files
94
+ */
95
+ function plugin_textdomain() {
96
+ load_plugin_textdomain( 'video-thumbnails', false, VIDEO_THUMBNAILS_PATH . '/languages/' );
97
+ }
98
+
99
  /**
100
  * Adds the admin menu items
101
  */
102
  function admin_menu() {
103
+ add_management_page( __( 'Bulk Video Thumbnails', 'video-thumbnails' ), __( 'Bulk Video Thumbs', 'video-thumbnails' ), 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
104
  }
105
 
106
  function admin_scripts( $hook ) {
107
  // Bulk tool page
108
  if ( 'tools_page_video-thumbnails-bulk' == $hook ) {
109
  wp_enqueue_script( 'video-thumbnails-bulk-js', plugins_url( '/js/bulk.js' , __FILE__ ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
110
+ wp_localize_script( 'video-thumbnails-bulk-js', 'video_thumbnails_bulk_language', array(
111
+ 'working' => __( 'Working...', 'video-thumbnails' ),
112
+ 'started' => __( 'Started Scanning', 'video-thumbnails' ),
113
+ 'resumed' => __( 'Resumed Scanning', 'video-thumbnails' ),
114
+ 'paused' => __( 'Paused Scanning', 'video-thumbnails' ),
115
+ 'done' => __( 'Done!', 'video-thumbnails' ),
116
+ 'final_count_singular' => __( 'Scanned 1 post', 'video-thumbnails' ),
117
+ 'final_count_plural' => __( 'Scanned %d posts', 'video-thumbnails' ),
118
+ 'queue_singular' => __( '1 post in queue', 'video-thumbnails' ),
119
+ 'queue_plural' => __( '%d posts in queue', 'video-thumbnails' ),
120
+ 'scanning_of' => __( 'Scanning %1$s of %2$s', 'video-thumbnails' ),
121
+ 'no_thumbnail' => __( 'No thumbnail', 'video-thumbnails' ),
122
+ 'new_thumbnail' => __( 'New thumbnail:', 'video-thumbnails' ),
123
+ 'existing_thumbnail' => __( 'Existing thumbnail:', 'video-thumbnails' ),
124
+ 'error' => __( 'Error:', 'video-thumbnails' ),
125
+ ) );
126
  wp_enqueue_style( 'video-thumbnails-bulk-css', plugins_url('/css/bulk.css', __FILE__), false, VIDEO_THUMBNAILS_VERSION );
127
  }
128
  }
143
  add_thickbox();
144
  ?>
145
  <div id="video-thumbnail-not-found-troubleshooting" style="display:none;">
146
+ <h2><?php _e( 'Troubleshooting Video Thumbnails', 'video-thumbnails' ); ?></h2>
147
  <?php $this->no_video_thumbnail_troubleshooting_instructions(); ?>
148
  </div>
149
  <?php
155
 
156
  if ( get_post_status() == 'publish' || get_post_status() == 'private' ) {
157
  if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
158
+ echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Reset Video Thumbnail', 'video-thumbnails' ) . '</a></p>';
159
  } else {
160
+ echo '<p id="video-thumbnails-preview">' . __( 'No video thumbnail for this post.', 'video-thumbnails' ) . '</p>';
161
+ echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Search Again', 'video-thumbnails' ) . '</a> <a href="#TB_inline?width=400&height=600&inlineId=video-thumbnail-not-found-troubleshooting" class="thickbox" style="float:right;">' . __( 'Troubleshoot', 'video-thumbnails' ) . '<a/></p>';
162
  }
163
  } else {
164
  if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
165
+ echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Reset Video Thumbnail', 'video-thumbnails' ) . '</a></p>';
166
  } else {
167
+ echo '<p>' . __( 'A video thumbnail will be found for this post when it is published.', 'video-thumbnails' ) . '</p>';
168
  }
169
  }
170
  }
174
  */
175
  public static function no_video_thumbnail_troubleshooting_instructions() {
176
  ?>
177
+ <h3><?php _e( 'Fixing "No video thumbnail for this post"', 'video-thumbnails' ); ?></h3>
178
  <ol>
179
+ <li><?php _e( 'Ensure you have saved any changes to your post.', 'video-thumbnails' ); ?></li>
180
+ <li><?php echo sprintf( __( 'If you are using a a plugin or theme that stores videos in a special location other than the main post content area, be sure you\'ve entered the correct custom field on the <a href="%s">settings page</a>. If you don\'t know the name of the field your video is being saved in, please contact the developer of that theme or plugin.', 'video-thumbnails' ), admin_url( 'options-general.php?page=video_thumbnails' ) ); ?></li>
181
+ <li><?php echo sprintf( __( 'Copy and paste your embed code into the "Test Markup for Video" section of the <a href="%1$s">Debugging page</a>. If this doesn\'t find the thumbnail, you\'ll want to be sure to include the embed code you scanned when you request support. If it does find a thumbnail, please double check that you have the Custom Field set correctly in the <a href="%2$s">settings page</a> if you are using a a plugin or theme that stores videos in a special location.', 'video-thumbnails' ), admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ), admin_url( 'options-general.php?page=video_thumbnails' ) ); ?></li>
182
+ <li><?php echo sprintf( __( 'Go to the <a href="%s">Debugging page</a> and click "Test Image Downloading" to test your server\'s ability to save an image from a video source.', 'video-thumbnails' ), admin_url( 'options-general.php?page=video_thumbnails&tab=debugging' ) ); ?></li>
183
+ <li><?php _e( 'Try posting a video from other sources to help narrow down the problem.', 'video-thumbnails' ); ?></li>
184
+ <li><?php _e( 'Search the <a href="http://wordpress.org/support/plugin/video-thumbnails">support threads</a> to see if anyone has had the same issue.', 'video-thumbnails' ); ?></li>
185
+ <li><?php _e( 'If you are still unable to resolve the problem, <a href="http://wordpress.org/support/plugin/video-thumbnails">start a thread</a> with a <strong>good descriptive</strong> title ("Error" or "No thumbnails" is a <strong>bad</strong> title) and be sure to include the results of your testing as well. Also be sure to include the <strong>name of your theme</strong>, any <strong>video plugins</strong> you\'re using, and any other details you can think of.', 'video-thumbnails' ); ?></li>
186
  </ol>
187
  <?php
188
  }
343
  $error = '';
344
  $response = wp_remote_get( $image_url, array( 'sslverify' => false ) );
345
  if( is_wp_error( $response ) ) {
346
+ $error = new WP_Error( 'thumbnail_retrieval', sprintf( __( 'Error retrieving a thumbnail from the URL <a href="%1$s">%1$s</a> using <code>wp_remote_get()</code><br />If opening that URL in your web browser returns anything else than an error page, the problem may be related to your web server and might be something your host administrator can solve.', 'video-thumbnails' ), $image_url ) . '<br>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $response->get_error_message() );
347
  } else {
348
  $image_contents = $response['body'];
349
  $image_type = wp_remote_retrieve_header( $response, 'content-type' );
361
  } elseif ( $image_type == 'image/gif' ) {
362
  $image_extension = '.gif';
363
  } else {
364
+ return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
365
  }
366
 
367
  // Construct a file name with extension
374
 
375
  // Stop for any errors while saving the data or else continue adding the image to the media library
376
  if ( $upload['error'] ) {
377
+ $error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
378
  return $error;
379
  } else {
380
 
418
  echo ' action: "reset_video_thumbnail",' . PHP_EOL;
419
  echo ' post_id: id' . PHP_EOL;
420
  echo ' };' . PHP_EOL;
421
+ echo ' document.getElementById(\'video-thumbnails-preview\').innerHTML=\'' . __( 'Working...', 'video-thumbnails' ) . ' <img src="' . home_url( 'wp-admin/images/loading.gif' ) . '"/>\';' . PHP_EOL;
422
  echo ' jQuery.post(ajaxurl, data, function(response){' . PHP_EOL;
423
  echo ' document.getElementById(\'video-thumbnails-preview\').innerHTML=response;' . PHP_EOL;
424
  echo ' });' . PHP_EOL;
441
  } else if ( $video_thumbnail != null ) {
442
  echo '<img src="' . $video_thumbnail . '" style="max-width:100%;" />';
443
  } else {
444
+ echo __( 'No video thumbnail for this post.', 'video-thumbnails' );
445
  }
446
 
447
  die();
496
  function bulk_scanning_page() {
497
 
498
  if ( ! current_user_can( 'manage_options' ) ) {
499
+ wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
500
  }
501
 
502
  ?>
503
  <div class="wrap">
504
 
505
+ <div id="icon-tools" class="icon32"></div><h2><?php _e( 'Bulk Video Thumbnail Generator', 'video-thumbnails' ); ?></h2>
506
 
507
+ <p><?php _e( 'Use this tool to scan all of your posts for Video Thumbnails.', 'video-thumbnails' ); ?></p>
508
 
509
  <form id="video-thumbnails-bulk-scan-options">
510
  <table class="form-table">
513
  <tr valign="top">
514
  <th scope="row"><span id="queue-count">...</span></th>
515
  <td>
516
+ <input type="submit" value="<?php esc_attr_e( 'Scan Now', 'video-thumbnails' ); ?>" class="button button-primary">
517
  </td>
518
  </tr>
519
  </tbody>
525
  <span class="percentage">0%</span>
526
  <div class="progress-bar">&nbsp;</div>
527
  </div>
528
+ <table class="stats">
529
+ <thead>
530
+ <tr>
531
+ <th><?php _e( 'Scanned', 'video-thumbnails' ); ?></th>
532
+ <th><?php _e( 'New Thumbnails', 'video-thumbnails' ); ?></th>
533
+ <th><?php _e( 'Existing', 'video-thumbnails' ); ?></th>
534
+ </tr>
535
+ </thead>
536
+ <tr>
537
+ <td class="scanned">0</td>
538
+ <td class="found-new">0</td>
539
+ <td class="found-existing">0</td>
540
+ </tr>
541
+ </table>
542
  <ul class="log"></ul>
543
  </div>
544