initial commit
This commit is contained in:
@ -0,0 +1,90 @@
|
||||
#vt-bulk-scan-results {
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .progress-bar-container {
|
||||
position: relative;
|
||||
height: 30px;
|
||||
background-color: #ddd;
|
||||
width: 100%;
|
||||
border-radius: 5px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .percentage {
|
||||
display: block;
|
||||
position: absolute;
|
||||
line-height: 20px;
|
||||
top: 5px;
|
||||
width: 100%;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
text-shadow: 0 -1px 0 rgba(255,255,255,.3);
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .progress-bar {
|
||||
display: none;
|
||||
box-sizing: border-box;
|
||||
background-color: #739c21;
|
||||
height: 30px;
|
||||
background-image: -webkit-gradient(linear,left top,left bottom,from(#91c429),to(#739c21));
|
||||
background-image: -webkit-linear-gradient(top,#91c429,#739c21);
|
||||
background-image: -moz-linear-gradient(top,#91c429,#739c21);
|
||||
background-image: -ms-linear-gradient(top,#91c429,#739c21);
|
||||
background-image: -o-linear-gradient(top,#91c429,#739c21);
|
||||
background-image: linear-gradient(to bottom,#91c429,#739c21);
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #739c21;
|
||||
border-bottom-color: #678c1d;
|
||||
-webkit-box-shadow: inset 0 1px 0 rgba(193,229,119,.5);
|
||||
box-shadow: inset 0 1px 0 rgba(193,229,119,.5);
|
||||
width: 0;
|
||||
background-position: initial initial;
|
||||
background-repeat: initial initial;
|
||||
border-radius: 5px;
|
||||
-webkit-transition: width 0.2s linear;
|
||||
-moz-transition: width 0.2s linear;
|
||||
transition: width 0.2s linear;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .progress-bar.disable-animation {
|
||||
-webkit-transition: none;
|
||||
-moz-transition: none;
|
||||
transition: none;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .stats {
|
||||
width: 100%;
|
||||
margin-top: 1em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .stats .scanned,
|
||||
#vt-bulk-scan-results .stats .found-new,
|
||||
#vt-bulk-scan-results .stats .found-existing {
|
||||
font-size: 24px;
|
||||
font-weight: bold;
|
||||
width: 33%;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .log {
|
||||
overflow: auto;
|
||||
height: 250px;
|
||||
background: #eee;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
box-shadow: inset 0 0 4px #ccc;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .log li {
|
||||
border-top: 1px solid #ccc;
|
||||
padding: 10px;
|
||||
margin-bottom: 0;
|
||||
box-shadow: inset 0 1px 0 #fff;
|
||||
}
|
||||
|
||||
#vt-bulk-scan-results .log li:first-child {
|
||||
border-top: 0;
|
||||
box-shadow: none;
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Tests
|
||||
*/
|
||||
|
||||
.video-thumbnails-test {
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
.video-thumbnails-test .widefat:last-child {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.video-thumbnails-test .title-test-link {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.video-thumbnails-test h3.test-title {
|
||||
padding-left: 16px;
|
||||
}
|
||||
|
||||
.video-thumbnails-test h3.test-title::before {
|
||||
content: "\25bc";
|
||||
color: #888;
|
||||
font-size: 75%;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
-webkit-transition: 0.1s all ease-in-out;
|
||||
-o-transition: 0.1s all ease-in-out;
|
||||
transition: 0.1s all ease-in-out;
|
||||
}
|
||||
.video-thumbnails-test.closed h3.test-title::before {
|
||||
/*content: "\25b6";*/
|
||||
-webkit-transform: rotate(-90deg);
|
||||
-moz-transform: rotate(-90deg);
|
||||
-ms-transform: rotate(-90deg);
|
||||
-o-transform: rotate(-90deg);
|
||||
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);
|
||||
}
|
||||
|
||||
.video-thumbnails-test .video-thumbnails-test-content {
|
||||
display: block;
|
||||
}
|
||||
.video-thumbnails-test.closed .video-thumbnails-test-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.video-thumbnails-test .show-hide-test-link {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.video-thumbnails-test .show-hide-test-link .show {
|
||||
display: none;
|
||||
}
|
||||
.video-thumbnails-test .show-hide-test-link .hide {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.video-thumbnails-test.closed .show-hide-test-link .show {
|
||||
display: inline;
|
||||
}
|
||||
.video-thumbnails-test.closed .show-hide-test-link .hide {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.test-working .test-results {
|
||||
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
|
||||
filter: alpha(opacity=50);
|
||||
-moz-opacity: 0.5;
|
||||
-khtml-opacity: 0.5;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
.single-provider-test-results {
|
||||
border-top: 1px solid #e4e4e4;
|
||||
}
|
||||
|
||||
.retest-video-provider {
|
||||
float: right;
|
||||
}
|
BIN
hamrokhaanpaan/wp-content/plugins/video-thumbnails/default.jpg
Normal file
BIN
hamrokhaanpaan/wp-content/plugins/video-thumbnails/default.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 60 KiB |
199
hamrokhaanpaan/wp-content/plugins/video-thumbnails/js/bulk.js
Normal file
199
hamrokhaanpaan/wp-content/plugins/video-thumbnails/js/bulk.js
Normal file
@ -0,0 +1,199 @@
|
||||
var video_thumbnails_bulk_scanner;
|
||||
|
||||
jQuery(function ($) {
|
||||
|
||||
function VideoThumbnailsBulkScanner( posts ) {
|
||||
this.currentItem = 0;
|
||||
this.posts = posts;
|
||||
this.paused = false;
|
||||
this.newThumbnails = 0;
|
||||
this.existingThumbnails = 0;
|
||||
this.delay = 1000;
|
||||
this.delayTimer = false;
|
||||
this.logList = $('#vt-bulk-scan-results .log');
|
||||
this.progressBar = $('#vt-bulk-scan-results .progress-bar');
|
||||
this.language = video_thumbnails_bulk_language;
|
||||
}
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.log = function(text) {
|
||||
$('<li>'+text+'</li>').prependTo(this.logList).hide().slideDown(200);
|
||||
console.log(text);
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.disableSubmit = function(text) {
|
||||
$('#video-thumbnails-bulk-scan-options input[type="submit"]').attr('disabled','disabled');
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.enableSubmit = function(text) {
|
||||
$('#video-thumbnails-bulk-scan-options input[type="submit"]').removeAttr('disabled');
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.findPosts = function(text) {
|
||||
var data = {
|
||||
action: 'video_thumbnails_bulk_posts_query',
|
||||
params: $('#video-thumbnails-bulk-scan-options').serialize()
|
||||
};
|
||||
var self = this;
|
||||
this.disableSubmit();
|
||||
$('#queue-count').text(this.language.working);
|
||||
$.post(ajaxurl, data, function(response) {
|
||||
self.posts = $.parseJSON( response );
|
||||
if ( self.posts.length == 1 ) {
|
||||
queueText = self.language.queue_singular;
|
||||
} else {
|
||||
queueText = self.language.queue_plural.replace('%d',self.posts.length);
|
||||
}
|
||||
$('#queue-count').text(queueText);
|
||||
if ( self.posts.length > 0 ) {
|
||||
self.enableSubmit();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.startScan = function() {
|
||||
this.disableSubmit();
|
||||
this.paused = false;
|
||||
if ( this.currentItem == 0 ) {
|
||||
this.log( this.language.started );
|
||||
this.progressBar.show();
|
||||
this.resetProgressBar();
|
||||
$('#video-thumbnails-bulk-scan-options').slideUp();
|
||||
} else {
|
||||
this.log( this.language.resumed );
|
||||
}
|
||||
this.scanCurrentItem();
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.pauseScan = function() {
|
||||
this.clearSchedule();
|
||||
this.paused = true;
|
||||
this.log( this.language.paused );
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.toggleScan = function() {
|
||||
if ( this.paused ) {
|
||||
this.startScan();
|
||||
} else {
|
||||
this.pauseScan();
|
||||
}
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.scanCompleted = function() {
|
||||
if ( this.posts.length == 1 ) {
|
||||
message = this.language.done + ' ' + this.language.final_count_singular;
|
||||
} else {
|
||||
message = this.language.done + ' ' + this.language.final_count_plural.replace('%d',this.posts.length);
|
||||
}
|
||||
this.log( message );
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.resetProgressBar = function() {
|
||||
$('#vt-bulk-scan-results .percentage').html('0%');
|
||||
this.progressBar
|
||||
.addClass('disable-animation')
|
||||
.css('width','0')
|
||||
this.progressBar.height();
|
||||
this.progressBar.removeClass('disable-animation');
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.updateProgressBar = function() {
|
||||
console.log( percentage = ( this.currentItem + 1 ) / this.posts.length );
|
||||
if ( percentage == 1 ) {
|
||||
progressText = this.language.done;
|
||||
this.scanCompleted();
|
||||
} else {
|
||||
progressText = Math.round(percentage*100)+'%';
|
||||
}
|
||||
$('#vt-bulk-scan-results .percentage').html(progressText);
|
||||
this.progressBar.css('width',(percentage*100)+'%');
|
||||
};
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.updateCounter = function() {
|
||||
$('#vt-bulk-scan-results .stats .scanned').html( (this.currentItem+1) + '/' + this.posts.length );
|
||||
$('#vt-bulk-scan-results .stats .found-new').html( this.newThumbnails );
|
||||
$('#vt-bulk-scan-results .stats .found-existing').html( this.existingThumbnails );
|
||||
}
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.updateStats = function() {
|
||||
this.updateProgressBar();
|
||||
this.updateCounter();
|
||||
}
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.scheduleNextItem = function() {
|
||||
if ( ( this.currentItem + 1 ) < this.posts.length ) {
|
||||
var self = this;
|
||||
self.currentItem++;
|
||||
this.delayTimer = setTimeout(function() {
|
||||
self.scanCurrentItem();
|
||||
}, this.delay);
|
||||
}
|
||||
}
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.clearSchedule = function() {
|
||||
clearTimeout( this.delayTimer );
|
||||
}
|
||||
|
||||
VideoThumbnailsBulkScanner.prototype.scanCurrentItem = function() {
|
||||
|
||||
if ( this.paused ) return false;
|
||||
|
||||
if ( this.currentItem < this.posts.length ) {
|
||||
|
||||
this.log( '[ID: ' + this.posts[this.currentItem] + '] ' + this.language.scanning_of.replace('%1$s',this.currentItem+1).replace('%2$s',this.posts.length) );
|
||||
|
||||
var data = {
|
||||
action: 'video_thumbnails_get_thumbnail_for_post',
|
||||
post_id: this.posts[this.currentItem]
|
||||
};
|
||||
var self = this;
|
||||
$.ajax({
|
||||
url: ajaxurl,
|
||||
type: "POST",
|
||||
data: data,
|
||||
success: function(response) {
|
||||
var result = $.parseJSON( response );
|
||||
if ( result.length == 0 ) {
|
||||
self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + self.language.no_thumbnail );
|
||||
} else {
|
||||
if ( result.type == 'new' ) {
|
||||
resultText = self.language.new_thumbnail;
|
||||
} else {
|
||||
resultText = self.language.existing_thumbnail;
|
||||
}
|
||||
self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + resultText + ' ' + result.url );
|
||||
if ( result.type == 'new' ) {
|
||||
self.newThumbnails++;
|
||||
} else {
|
||||
self.existingThumbnails++;
|
||||
}
|
||||
}
|
||||
self.updateStats();
|
||||
self.scheduleNextItem();
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
self.log( '[ID: ' + self.posts[self.currentItem] + '] ' + self.language.error + ' ' + errorThrown );
|
||||
self.updateStats();
|
||||
self.scheduleNextItem();
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
this.updateStats();
|
||||
this.currentItem = 0;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
video_thumbnails_bulk_scanner = new VideoThumbnailsBulkScanner();
|
||||
video_thumbnails_bulk_scanner.findPosts();
|
||||
|
||||
$('#video-thumbnails-bulk-scan-options').on('change',function(e){
|
||||
video_thumbnails_bulk_scanner.findPosts();
|
||||
});
|
||||
|
||||
$('#video-thumbnails-bulk-scan-options').on('submit',function(e){
|
||||
e.preventDefault();
|
||||
video_thumbnails_bulk_scanner.startScan();
|
||||
});
|
||||
|
||||
});
|
@ -0,0 +1,201 @@
|
||||
jQuery(function ($) {
|
||||
|
||||
/**
|
||||
* Custom field detection
|
||||
*/
|
||||
$('#vt_detect_custom_field').on('click',function(e) {
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
action: 'video_thumbnail_custom_field_detection'
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: data,
|
||||
success: function(response){
|
||||
if (response) {
|
||||
$('#custom_field').val(response);
|
||||
} else {
|
||||
alert(video_thumbnails_settings_language.detection_failed);
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
alert(video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Debugging tests
|
||||
*/
|
||||
$('a.toggle-video-thumbnails-test-content').on('click',function(e) {
|
||||
e.preventDefault();
|
||||
$(this).closest('.video-thumbnails-test').toggleClass('closed');
|
||||
});
|
||||
|
||||
function enable_video_thumbnails_tests() {
|
||||
$('.video-thumbnails-test-button').attr('disabled',false);
|
||||
}
|
||||
|
||||
function disable_video_thumbnails_tests() {
|
||||
$('.video-thumbnails-test-button').attr('disabled',true);
|
||||
}
|
||||
|
||||
/* Provider testing */
|
||||
|
||||
function test_single_provider(provider_slug) {
|
||||
disable_video_thumbnails_tests();
|
||||
$('#'+provider_slug+'-provider-test').addClass('test-working');
|
||||
$('#'+provider_slug+'-provider-test .retest-video-provider').val(video_thumbnails_settings_language.working);
|
||||
var data = {
|
||||
action: 'video_thumbnail_provider_test',
|
||||
provider_slug: provider_slug
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$('#'+provider_slug+'-provider-test .test-results').html(response);
|
||||
$('#'+provider_slug+'-provider-test .retest-video-provider').val(video_thumbnails_settings_language.retest);
|
||||
$('#'+provider_slug+'-provider-test').removeClass('test-working');
|
||||
done_testing_single_provider();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$('#'+provider_slug+'-provider-test .test-results').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
||||
$('#'+provider_slug+'-provider-test .retest-video-provider').val(video_thumbnails_settings_language.retest);
|
||||
$('#'+provider_slug+'-provider-test').removeClass('test-working');
|
||||
done_testing_single_provider();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var provider_index = 0;
|
||||
var testing_all_providers = false;
|
||||
|
||||
function done_testing_single_provider() {
|
||||
// If we aren't testing providers, don't do anything
|
||||
if (testing_all_providers==false) {
|
||||
enable_video_thumbnails_tests();
|
||||
}
|
||||
provider_index = provider_index + 1;
|
||||
if (provider_index>=video_thumbnails_provider_slugs.provider_slugs.length) {
|
||||
testing_all_providers = false;
|
||||
enable_video_thumbnails_tests();
|
||||
return;
|
||||
} else {
|
||||
test_single_provider(video_thumbnails_provider_slugs.provider_slugs[provider_index]);
|
||||
}
|
||||
}
|
||||
|
||||
$('#test-all-video-thumbnail-providers').on('click',function(e) {
|
||||
e.preventDefault();
|
||||
$('#provider-test-results').removeClass('hidden');
|
||||
$(this).parent().remove();
|
||||
testing_all_providers = true;
|
||||
test_single_provider(video_thumbnails_provider_slugs.provider_slugs[provider_index]);
|
||||
});
|
||||
|
||||
$('.retest-video-provider').on('click',function(e) {
|
||||
e.preventDefault();
|
||||
test_single_provider( $(this).data('provider-slug') );
|
||||
});
|
||||
|
||||
/* Markup detection testing */
|
||||
$('#test-markup-detection').on('click',function(e) {
|
||||
disable_video_thumbnails_tests();
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
action: 'video_thumbnail_markup_detection_test',
|
||||
markup: $('#markup-input').val()
|
||||
};
|
||||
document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: data,
|
||||
success: function(response){
|
||||
document.getElementById( 'markup-test-result' ).innerHTML = response;
|
||||
enable_video_thumbnails_tests();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
document.getElementById( 'markup-test-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>';
|
||||
enable_video_thumbnails_tests();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* Media download testing */
|
||||
$('#test-video-thumbnail-saving-media').on('click',function(e) {
|
||||
disable_video_thumbnails_tests();
|
||||
$('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
action: 'video_thumbnail_image_download_test'
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$('#media-test-result').html(response);
|
||||
enable_video_thumbnails_tests();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$('#media-test-result').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
||||
enable_video_thumbnails_tests();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#delete-video-thumbnail-test-images').on('click',function(e) {
|
||||
disable_video_thumbnails_tests();
|
||||
$('#media-test-result').html( '<p>' + video_thumbnails_settings_language.working + '</p>' );
|
||||
e.preventDefault();
|
||||
var data = {
|
||||
action: 'video_thumbnail_delete_test_images'
|
||||
};
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: data,
|
||||
success: function(response){
|
||||
$('#media-test-result').html(response);
|
||||
enable_video_thumbnails_tests();
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$('#media-test-result').html('<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>');
|
||||
enable_video_thumbnails_tests();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Clear all video thumbnails
|
||||
*/
|
||||
function clear_all_video_thumbnails( nonce ) {
|
||||
var confimation_result = confirm(video_thumbnails_settings_language.clear_all_confirmation);
|
||||
if (confimation_result){
|
||||
var data = {
|
||||
action: 'clear_all_video_thumbnails',
|
||||
nonce: nonce
|
||||
};
|
||||
document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.working + '</p>';
|
||||
jQuery.ajax({
|
||||
type: "POST",
|
||||
url: ajaxurl,
|
||||
data: data,
|
||||
success: function(response){
|
||||
document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = response;
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
document.getElementById( 'clear-all-video-thumbnails-result' ).innerHTML = '<p>' + video_thumbnails_settings_language.ajax_error + ' ' + XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText + '</p>';
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
//
|
||||
}
|
||||
};
|
Binary file not shown.
@ -0,0 +1,552 @@
|
||||
# Translation of Video Thumbnails in German
|
||||
# This file is distributed under the same license as the Video Thumbnails package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"PO-Revision-Date: 2014-04-25 22:43:16+0000\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
"X-Generator: GlotPress/0.1\n"
|
||||
"Project-Id-Version: Video Thumbnails\n"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:130
|
||||
#: php/class-video-thumbnails-settings.php:500
|
||||
msgid "Video Thumbnails Options"
|
||||
msgstr "Video Thumbnails Einstellungen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:131
|
||||
msgid "Video Thumbnails"
|
||||
msgstr "Video Thumbnails"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:141
|
||||
msgid "We were unable to find a video in the custom fields of your most recently updated post."
|
||||
msgstr "Es konnte im benutzerdefinierten Feld von deinem zuletzt aktualisierten Beitrag kein Video gefunden werden."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:142 video-thumbnails.php:111
|
||||
#: video-thumbnails.php:421
|
||||
msgid "Working..."
|
||||
msgstr "Laden..."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:143
|
||||
msgid "Are you sure you want to clear all video thumbnails? This cannot be undone."
|
||||
msgstr "Bist du sicher, dass du alle Video-Thumbnails löschen willst? Das kann nicht rückgängig gemacht werden."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:187
|
||||
#: php/class-video-thumbnails-settings.php:319
|
||||
msgid "1 attachment deleted"
|
||||
msgid_plural "%s attachments deleted"
|
||||
msgstr[0] "1 Anhang entfernt"
|
||||
msgstr[1] "%s Anhänge entfernt"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:190
|
||||
msgid "1 custom field cleared"
|
||||
msgid_plural "%s custom fields cleared"
|
||||
msgstr[0] "1 benutzerdefiniertes Feld geleert"
|
||||
msgstr[1] "%s benutzerdefinierte Felder geleert"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:192
|
||||
msgid "<strong>Error</strong>: Could not verify nonce."
|
||||
msgstr "<strong>Fehler</strong>: Nonce konnte nicht erkannt werden."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:218
|
||||
msgid "Name"
|
||||
msgstr "Name"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:219
|
||||
msgid "Pass/Fail"
|
||||
msgstr "Ausgeführt/Fehlgeschlagen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:220
|
||||
msgid "Result"
|
||||
msgstr "Ergebnis"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:235
|
||||
#: php/class-video-thumbnails-settings.php:255
|
||||
msgid "Failed"
|
||||
msgstr "Fehlgeschlagen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:252
|
||||
msgid "Passed"
|
||||
msgstr "Ausgeführt"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:260
|
||||
msgid "View Image"
|
||||
msgstr "Bild ansehen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:294
|
||||
msgid "Attachment created"
|
||||
msgstr "Dateianhang erstellt"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:295
|
||||
msgid "View in Media Library"
|
||||
msgstr "In Medienbibliothek ansehen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:296
|
||||
#: php/class-video-thumbnails-settings.php:355
|
||||
msgid "View full size"
|
||||
msgstr "Bild in voller Größe anzeigen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:338
|
||||
msgid "No thumbnail found"
|
||||
msgstr "Kein Thumbnail gefunden"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:341
|
||||
#: php/class-video-thumbnails-settings.php:348
|
||||
#: php/providers/class-video-thumbnails-providers.php:92
|
||||
#: video-thumbnails.php:346
|
||||
msgid "Error Details:"
|
||||
msgstr "Fehlerdetails:"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:347
|
||||
msgid "Thumbnail found, but there was an error retrieving the URL."
|
||||
msgstr "Thumbnail gefunden, aber die URL konnte nicht erreicht werden."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:351
|
||||
msgid "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."
|
||||
msgstr "Thumbnail gefunden, aber es existiert nicht auf dem Server. Wenn die URL im Browser eingegeben einen Fehler ausgibt, ist die URL falsch."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:352
|
||||
msgid "Thumbnail URL:"
|
||||
msgstr "Thumbnail-URL:"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:355
|
||||
msgid "Thumbnail found! Image should appear below."
|
||||
msgstr "Thumbnail gefunden! Das Bild sollte unten angezeigt werden."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:366
|
||||
msgid "General Settings"
|
||||
msgstr "Allgemeine Einstellungen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:372
|
||||
msgid "Save Thumbnails to Media Library"
|
||||
msgstr "Thumbnails in der Medienbibliothek abspeichern"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:373
|
||||
msgid "Checking this option will download video thumbnails to your server"
|
||||
msgstr "Diese Option aktivert das Downloaden der Bilder auf deinen Server"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:377
|
||||
msgid "Automatically Set Featured Image"
|
||||
msgstr "Automatisch als Beitragsbild festlegen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:378
|
||||
msgid "Check this option to automatically set video thumbnails as the featured image (requires saving to media library)"
|
||||
msgstr "Diese Option lässt das Video-Thumbnail automatisch als Beitragsbild festlegen (erfordert das Abspeichern in die Medienbibliothek)"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:386
|
||||
msgid "Post Types"
|
||||
msgstr "Beitragstypen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:391
|
||||
msgid "Custom Field (optional)"
|
||||
msgstr "Benutzerdefiniertes Feld (optional)"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:392
|
||||
msgid "Automatically Detect"
|
||||
msgstr "Automatisch Erkennen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:392
|
||||
msgid "Enter the name of the custom field where your embed code or video URL is stored."
|
||||
msgstr "Namen des benutzerdefinierten Felds eingeben, in dem die Video-URL vermerkt ist."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:422
|
||||
msgid "These options configure where the plugin will search for videos and what to do with thumbnails once found."
|
||||
msgstr "Diese Optionen stellen ein, wo das Plugin nach Videos sucht und was mit den Thumbnails gemacht wird."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:495 video-thumbnails.php:499
|
||||
msgid "You do not have sufficient permissions to access this page."
|
||||
msgstr "Du hast keine Berechtigung, um diese Seite aufzurufen."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:504
|
||||
msgid "General"
|
||||
msgstr "Allgemein"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:505
|
||||
msgid "Providers"
|
||||
msgstr "Videoanbieter"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:506
|
||||
msgid "Mass Actions"
|
||||
msgstr "Großaufträge"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:507
|
||||
msgid "Debugging"
|
||||
msgstr "Debugging"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:508
|
||||
msgid "Support"
|
||||
msgstr "Support"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:515
|
||||
msgid "Getting started"
|
||||
msgstr "Loslegen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:517
|
||||
msgid "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."
|
||||
msgstr "Wenn dein Theme Thumbnails in Beiträgen unterstützt, lasse \"Thumbnails in der Medienbibliothek abspeichern\" und \"Automatisch als Beitragsbild festlegen\" aktiviert und wähle dann, welche Beitragstypen du nach Videos scannen möchtest."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:519
|
||||
msgid "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>."
|
||||
msgstr "Für detailiertere Anweisungen, besuche <a href=\"http://wordpress.org/extend/plugins/video-thumbnails/\">Video Thumbnails offizielle Plugin-Website</a> (englisch)."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:547
|
||||
msgid "Scan All Posts"
|
||||
msgstr "Alle Beiträge durchsuchen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:549
|
||||
msgid "Scan all of your past posts for video thumbnails. Be sure to save any settings before running the scan."
|
||||
msgstr "Alle Beiträge nach Video-Thumbnails durchsuchen. Vergewissere dich, dass du davor speicherst."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:551
|
||||
msgid "Scan Past Posts"
|
||||
msgstr "Alte Beiträge durchsuchen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:553
|
||||
msgid "Clear all Video Thumbnails"
|
||||
msgstr "Alle Video-Thumbnails entfernen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:555
|
||||
msgid "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."
|
||||
msgstr "Hiermit leerst du das Video-Thumbnail-Feld für alle Beiträge und löschst alle Video Thumbnails. Hinweis: Es können nur Thumbnails gelöscht werden, die mit Version 2.0 oder neuer hinzugefügt worden sind."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:557
|
||||
msgid "Clear Video Thumbnails"
|
||||
msgstr "Video-Thumbnails entfernen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:568
|
||||
msgid "Use these tests to help diagnose any problems. Please include results when requesting support."
|
||||
msgstr "Verwende diese Tests, um Probleme zu analysieren. Bitte gib diese Ergebnisse bei Supportanfragen mit an."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:570
|
||||
#: php/class-video-thumbnails-settings.php:575
|
||||
msgid "Test Video Providers"
|
||||
msgstr "Videoanbieter testen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:572
|
||||
msgid "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."
|
||||
msgstr "Dieser Test sucht automatisch ein Beispielvideo und vergleicht das Ergebnis mit dem Erwarteten. Tests können wegen API-Limits fehlschlagen."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:578
|
||||
msgid "Test Markup for Video"
|
||||
msgstr "Markup für Videos testen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:580
|
||||
msgid "Copy and paste an embed code below to see if a video is detected."
|
||||
msgstr "Kopiere und füge einen Video-Einbettungscode ein, um zu sehen, ob das Video erkannt wird."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:584
|
||||
msgid "Scan For Thumbnail"
|
||||
msgstr "Nach Thumbnail suchen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:588
|
||||
msgid "Test Saving to Media Library"
|
||||
msgstr "Speichern in Medienbibliothek testen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:590
|
||||
msgid "This test checks for issues with the process of saving a remote thumbnail to your local media library."
|
||||
msgstr "Dieser Test überprüft, ob der Vorgang des Abspeicherns von Thumbnails zu deiner lokalen Medienbibliothek funktioniert."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:592
|
||||
msgid "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>."
|
||||
msgstr "Vergewissere dich, dass du ein Bild manuell zu deiner Website hochladen kannst. Wenn nicht, musst du möglicherweise die <a href=\"http://codex.wordpress.org/Changing_File_Permissions\">Dateiberechtigungen ändern</a>."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:595
|
||||
msgid "Download Test Image"
|
||||
msgstr "Test-Bild herunterladen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:596
|
||||
msgid "Delete Test Images"
|
||||
msgstr "Test-Bilder löschen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:601
|
||||
msgid "Installation Information"
|
||||
msgstr "Informationen über Installation"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:612
|
||||
msgid "WordPress Version"
|
||||
msgstr "WordPress-Version"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:617
|
||||
msgid "Video Thumbnails Version"
|
||||
msgstr "Video-Thumbnails-Version"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:622
|
||||
msgid "Video Thumbnails Settings Version"
|
||||
msgstr "Video-Thumbnails-Einstellungsversion"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:627
|
||||
msgid "PHP Version"
|
||||
msgstr "PHP-Version"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:632
|
||||
msgid "Post Thumbnails"
|
||||
msgstr "Thumbnails in Beiträgen"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:633
|
||||
msgid "Your theme supports post thumbnails."
|
||||
msgstr "Dein Theme unterstützt Thumbnails in Beiträgen."
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:633
|
||||
msgid "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>"
|
||||
msgstr "Dein Theme unterstützt keine Beitragsthumbnails, du musst es deshalb modifizieren oder ein anderes Theme verwenden. <a href=\"http://codex.wordpress.org/Post_Thumbnails\">Mehr Info (englisch)</a>"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:637
|
||||
msgid "Video Providers"
|
||||
msgstr "Videoanbieter"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:676
|
||||
msgid "Support video thumbnails and unlock additional features"
|
||||
msgstr "Video Thumbnails unterstützen und zusätzliche Features freischalten"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:677
|
||||
msgid "Go Pro"
|
||||
msgstr "Pro-Version kaufen"
|
||||
|
||||
#: php/providers/class-blip-thumbnails.php:50
|
||||
msgid "Error retrieving video information for <a href=\"%1$s\">%1$s</a>. Check to be sure this is a valid Blip video URL."
|
||||
msgstr "Fehler beim Abruf der Videoinformationen von <a href=\"%1$s\">%1$s</a>. Überprüfe, ob es eine gültige Blip-Video-URL ist."
|
||||
|
||||
#: php/providers/class-blip-thumbnails.php:65
|
||||
#: php/providers/class-collegehumor-thumbnails.php:67
|
||||
#: php/providers/class-rutube-thumbnails.php:62
|
||||
#: php/providers/class-twitch-thumbnails.php:62
|
||||
#: php/providers/class-youku-thumbnails.php:75
|
||||
msgid "Video URL"
|
||||
msgstr "Video-URL"
|
||||
|
||||
#: php/providers/class-blip-thumbnails.php:71
|
||||
#: php/providers/class-collegehumor-thumbnails.php:61
|
||||
#: php/providers/class-dailymotion-thumbnails.php:63
|
||||
#: php/providers/class-facebook-thumbnails.php:60
|
||||
#: php/providers/class-funnyordie-thumbnails.php:62
|
||||
#: php/providers/class-googledrive-thumbnails.php:82
|
||||
#: php/providers/class-mpora-thumbnails.php:60
|
||||
#: php/providers/class-rutube-thumbnails.php:68
|
||||
#: php/providers/class-vimeo-thumbnails.php:110
|
||||
#: php/providers/class-vk-thumbnails.php:70
|
||||
#: php/providers/class-wistia-thumbnails.php:85
|
||||
#: php/providers/class-youku-thumbnails.php:63
|
||||
msgid "iFrame Embed"
|
||||
msgstr "iFrame-Einbetten"
|
||||
|
||||
#: php/providers/class-dailymotion-thumbnails.php:69
|
||||
#: php/providers/class-facebook-thumbnails.php:54
|
||||
#: php/providers/class-funnyordie-thumbnails.php:68
|
||||
#: php/providers/class-googledrive-thumbnails.php:94
|
||||
#: php/providers/class-justintv-thumbnails.php:61
|
||||
#: php/providers/class-metacafe-thumbnails.php:62
|
||||
#: php/providers/class-mpora-thumbnails.php:54
|
||||
#: php/providers/class-twitch-thumbnails.php:68
|
||||
#: php/providers/class-vimeo-thumbnails.php:116
|
||||
#: php/providers/class-youku-thumbnails.php:69
|
||||
msgid "Flash Embed"
|
||||
msgstr "Flash-Einbetten"
|
||||
|
||||
#: php/providers/class-googledrive-thumbnails.php:88
|
||||
msgid "iFrame Embed (Apps account)"
|
||||
msgstr "iFrame-Einbetten (Apps-Konto)"
|
||||
|
||||
#: php/providers/class-googledrive-thumbnails.php:100
|
||||
msgid "Flash Embed (YouTube player)"
|
||||
msgstr "Flash-Einbetten (YouTube-Player)"
|
||||
|
||||
#: php/providers/class-kaltura-thumbnails.php:68
|
||||
msgid "Auto Embed"
|
||||
msgstr "Auto-Einbetten"
|
||||
|
||||
#: php/providers/class-video-thumbnails-providers.php:92
|
||||
msgid "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."
|
||||
msgstr "Fehler beim Abruf der Videoinformationen von der URL <a href=\"%1$s\">%1$s</a> mithilfe von <code>wp_remote_get()</code><br />Wenn das Öffnen der URL keinen Fehler verursacht, könnte das Problem mit deinem Webserver zusammenhängen. Bitte kontaktiere dann deinen Administrator oder Anbieter."
|
||||
|
||||
#: php/providers/class-vimeo-thumbnails.php:122
|
||||
msgid "Channel URL"
|
||||
msgstr "Kanal-URL"
|
||||
|
||||
#: php/providers/class-vine-thumbnails.php:69
|
||||
msgid "iFrame Embed/Video URL"
|
||||
msgstr "iFrame-Einbetten/Video-URL"
|
||||
|
||||
#: php/providers/class-wistia-thumbnails.php:91
|
||||
msgid "JavaScript Embed"
|
||||
msgstr "JavaScript-Einbetten"
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:64
|
||||
msgid "iFrame Embed HD"
|
||||
msgstr "iFrame-Einbetten (HD)"
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:70
|
||||
msgid "Flash Embed HD"
|
||||
msgstr "Flash-Einbetten (HD)"
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:76
|
||||
msgid "iFrame Embed SD"
|
||||
msgstr "iFrame-Einbetten (SD)"
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:82
|
||||
msgid "Flash Embed SD"
|
||||
msgstr "Flash-Einbetten (SD)"
|
||||
|
||||
#: video-thumbnails.php:103
|
||||
msgid "Bulk Video Thumbnails"
|
||||
msgstr "Alle Video-Thumbnails finden"
|
||||
|
||||
#: video-thumbnails.php:103
|
||||
msgid "Bulk Video Thumbs"
|
||||
msgstr "Alle Video-Thumbnails finden"
|
||||
|
||||
#: video-thumbnails.php:112
|
||||
msgid "Started Scanning"
|
||||
msgstr "Durchsuchen gestartet"
|
||||
|
||||
#: video-thumbnails.php:113
|
||||
msgid "Resumed Scanning"
|
||||
msgstr "Durchsuchen fortgeführt"
|
||||
|
||||
#: video-thumbnails.php:114
|
||||
msgid "Paused Scanning"
|
||||
msgstr "Durchsuchen pausiert"
|
||||
|
||||
#: video-thumbnails.php:115
|
||||
msgid "Done!"
|
||||
msgstr "Fertig!"
|
||||
|
||||
#: video-thumbnails.php:116
|
||||
msgid "Scanned 1 post"
|
||||
msgstr "1 Beitrag durchsucht"
|
||||
|
||||
#: video-thumbnails.php:117
|
||||
msgid "Scanned %d posts"
|
||||
msgstr "%d Beiträge durchsucht"
|
||||
|
||||
#: video-thumbnails.php:118
|
||||
msgid "1 post in queue"
|
||||
msgstr "1 Beitrag in Warteschlange"
|
||||
|
||||
#: video-thumbnails.php:119
|
||||
msgid "%d posts in queue"
|
||||
msgstr "%d Beiträge in Warteschlange"
|
||||
|
||||
#: video-thumbnails.php:120
|
||||
msgid "Scanning %1$s of %2$s"
|
||||
msgstr "Durchsuche %1$s von %2$s..."
|
||||
|
||||
#: video-thumbnails.php:121
|
||||
msgid "No thumbnail"
|
||||
msgstr "Kein Thumbnail"
|
||||
|
||||
#: video-thumbnails.php:122
|
||||
msgid "New thumbnail:"
|
||||
msgstr "Neues Thumbnail:"
|
||||
|
||||
#: video-thumbnails.php:123
|
||||
msgid "Existing thumbnail:"
|
||||
msgstr "Aktuelles Thumbnail:"
|
||||
|
||||
#: video-thumbnails.php:124
|
||||
msgid "Error:"
|
||||
msgstr "Fehler:"
|
||||
|
||||
#: video-thumbnails.php:146
|
||||
msgid "Troubleshooting Video Thumbnails"
|
||||
msgstr "Fehlersuche"
|
||||
|
||||
#: video-thumbnails.php:158 video-thumbnails.php:165
|
||||
msgid "Reset Video Thumbnail"
|
||||
msgstr "Video-Thumbnail zurücksetzen"
|
||||
|
||||
#: video-thumbnails.php:160 video-thumbnails.php:444
|
||||
msgid "No video thumbnail for this post."
|
||||
msgstr "Kein Video-Thumbnail im Beitrag gefunden"
|
||||
|
||||
#: video-thumbnails.php:161
|
||||
msgid "Search Again"
|
||||
msgstr "Erneut suchen"
|
||||
|
||||
#: video-thumbnails.php:161
|
||||
msgid "Troubleshoot"
|
||||
msgstr "Fehlersuche"
|
||||
|
||||
#: video-thumbnails.php:167
|
||||
msgid "A video thumbnail will be found for this post when it is published."
|
||||
msgstr "Ein Video-Thumbnail wird nach der Beitragsveröffentlichung angezeigt."
|
||||
|
||||
#: video-thumbnails.php:177
|
||||
msgid "Fixing \"No video thumbnail for this post\""
|
||||
msgstr "Fehlerbehebung \"Kein Video-Thumbnail im Beitrag gefunden\""
|
||||
|
||||
#: video-thumbnails.php:179
|
||||
msgid "Ensure you have saved any changes to your post."
|
||||
msgstr "Vergewissere dich, dass du alle Änderungen gespeichert hast."
|
||||
|
||||
#: video-thumbnails.php:180
|
||||
msgid "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."
|
||||
msgstr "Falls du ein Theme oder Plugin verwendest, dass Videos in einem speziellen Ort außerhalb des Beitrags speichert, vergewissere dich, dass du das korrekte benutzerdefinierte Feld in den <a href=\"%s\">Einstellungen</a> eingegeben hast. Falls du den Namen des Feldes nicht kennst, nimm Kontakt mit dem Theme/Plugin-Autor auf."
|
||||
|
||||
#: video-thumbnails.php:181
|
||||
msgid "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."
|
||||
msgstr "Kopiere und füge deinen Einbettungscode in das \"Markup für Videos testen\"-Feld auf der <a href=\"%1$s\">Debugging-Seite</a> ein. Fallls kein Video erkannt wird, kontaktiere uns und teile uns deinen Einbettungscode mit. Wenn ein Thumbnail gefunden wird, vergewissere dich, dass du ggf. das benutzerdefinierte Feld in den <a href=\"%2$s\">Einstellungen</a> korrekt eingegeben hast."
|
||||
|
||||
#: video-thumbnails.php:182
|
||||
msgid "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."
|
||||
msgstr "Gehe zur <a href=\"%s\">Debugging-Seite</a> und klicke auf \"Bild-Download testen\", um das Abspeichern von Bildern zu testen."
|
||||
|
||||
#: video-thumbnails.php:183
|
||||
msgid "Try posting a video from other sources to help narrow down the problem."
|
||||
msgstr "Versuche ein Video von anderen Videoseiten, um das Problem einzugrenzen."
|
||||
|
||||
#: video-thumbnails.php:184
|
||||
msgid "Search the <a href=\"http://wordpress.org/support/plugin/video-thumbnails\">support threads</a> to see if anyone has had the same issue."
|
||||
msgstr "Durchsuche die <a href=\"http://wordpress.org/support/plugin/video-thumbnails\">Support-Beiträge</a>, um ähnliche Fehler zu finden."
|
||||
|
||||
#: video-thumbnails.php:185
|
||||
msgid "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."
|
||||
msgstr "Wenn das Problem immer noch nicht lösbar ist, <a href=\"http://wordpress.org/support/plugin/video-thumbnails\">eröffne einen Thread</a> mit einem <strong>aussagekräftigen</strong> Titel (\"Fehler\" or \"Keine Thumbnails\" sind <strong>schlechte</strong> Titel) und deinen Testergebnissen. Füge außerdem den <strong>Themenamen</strong>, deine <strong>Video-Plugins</strong> und andere Details, die helfen können, hinzu."
|
||||
|
||||
#: video-thumbnails.php:346
|
||||
msgid "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."
|
||||
msgstr "Fehler beim Abruf des Videothumbnails von der URL <a href=\"%1$s\">%1$s</a> mithilfe von <code>wp_remote_get()</code><br />Wenn das Öffnen der URL keinen Fehler verursacht, könnte das Problem mit deinem Webserver zusammenhängen. Bitte kontaktiere dann deinen Administrator oder Anbieter."
|
||||
|
||||
#: video-thumbnails.php:364
|
||||
msgid "Unsupported MIME type:"
|
||||
msgstr "Nicht unterstütztes Dateiformat:"
|
||||
|
||||
#: video-thumbnails.php:377
|
||||
msgid "Error uploading image data:"
|
||||
msgstr "Fehler beim Hochladen der Bilddatei:"
|
||||
|
||||
#: video-thumbnails.php:505
|
||||
msgid "Bulk Video Thumbnail Generator"
|
||||
msgstr "Alle Video-Thumbnails generieren"
|
||||
|
||||
#: video-thumbnails.php:507
|
||||
msgid "Use this tool to scan all of your posts for Video Thumbnails."
|
||||
msgstr "Benutze das Tool um alle deine Beiträge nach Video-Thumbnails zu durchsuchen."
|
||||
|
||||
#: video-thumbnails.php:516
|
||||
msgid "Scan Now"
|
||||
msgstr "Jetzt durchsuchen"
|
||||
|
||||
#: video-thumbnails.php:531
|
||||
msgid "Scanned"
|
||||
msgstr "Suche abgeschlossen"
|
||||
|
||||
#: video-thumbnails.php:532
|
||||
msgid "New Thumbnails"
|
||||
msgstr "Neue Thumbnails"
|
||||
|
||||
#: video-thumbnails.php:533
|
||||
msgid "Existing"
|
||||
msgstr "Bereits vorhanden"
|
||||
|
||||
msgid "https://refactored.co/plugins/video-thumbnails"
|
||||
msgstr "https://refactored.co/plugins/video-thumbnails"
|
||||
|
||||
msgid "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."
|
||||
msgstr "Automatisches Abrufen von Video Thumbnails deiner Beiträge und das Anzeigen dieser im Theme. Unterstützt YouTube, Vimeo, Facebook, Vine, Justin.tv, Twitch, Dailymotion, Metacafe, VK, Blip, Google Drive, Funny or Die, CollegeHumor, MPORA, Wistia, Youku und Rutube."
|
||||
|
||||
msgid "Sutherland Boswell"
|
||||
msgstr "Sutherland Boswell"
|
||||
|
||||
msgid "http://sutherlandboswell.com"
|
||||
msgstr "http://sutherlandboswell.com"
|
@ -0,0 +1,627 @@
|
||||
# Copyright (C) 2014 Video Thumbnails
|
||||
# This file is distributed under the same license as the Video Thumbnails package.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Video Thumbnails 2.6.3\n"
|
||||
"Report-Msgid-Bugs-To: http://wordpress.org/tag/video-thumbnails\n"
|
||||
"POT-Creation-Date: 2014-03-11 22:51:09+00:00\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:129
|
||||
#: php/class-video-thumbnails-settings.php:464
|
||||
msgid "Video Thumbnails Options"
|
||||
msgstr ""
|
||||
|
||||
#. #-#-#-#-# plugin.pot (Video Thumbnails 2.6.3) #-#-#-#-#
|
||||
#. Plugin Name of the plugin/theme
|
||||
#: php/class-video-thumbnails-settings.php:130
|
||||
msgid "Video Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:140
|
||||
msgid ""
|
||||
"We were unable to find a video in the custom fields of your most recently "
|
||||
"updated post."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:141 video-thumbnails.php:101
|
||||
#: video-thumbnails.php:411
|
||||
msgid "Working..."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:142
|
||||
msgid ""
|
||||
"Are you sure you want to clear all video thumbnails? This cannot be undone."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:185
|
||||
msgid "1 attachment deleted"
|
||||
msgid_plural "%s attachments deleted"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:188
|
||||
msgid "1 custom field cleared"
|
||||
msgid_plural "%s custom fields cleared"
|
||||
msgstr[0] ""
|
||||
msgstr[1] ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:190
|
||||
msgid "<strong>Error</strong>: Could not verify nonce."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:214
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:215
|
||||
msgid "Pass/Fail"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:216
|
||||
msgid "Result"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:230
|
||||
#: php/class-video-thumbnails-settings.php:250
|
||||
msgid "Failed"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:247
|
||||
msgid "Passed"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:255
|
||||
msgid "View Image"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:284
|
||||
msgid "Attachment created with an ID of %d"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:286
|
||||
msgid "Attachment with an ID of %d deleted"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:302
|
||||
msgid "No thumbnail found"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:305
|
||||
#: php/class-video-thumbnails-settings.php:312
|
||||
#: php/providers/class-video-thumbnails-providers.php:92
|
||||
#: video-thumbnails.php:336
|
||||
msgid "Error Details:"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:311
|
||||
msgid "Thumbnail found, but there was an error retrieving the URL."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:315
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:316
|
||||
msgid "Thumbnail URL:"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:319
|
||||
msgid "Thumbnail found! Image should appear below."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:319
|
||||
msgid "View full size"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:330
|
||||
msgid "General Settings"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:336
|
||||
msgid "Save Thumbnails to Media Library"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:337
|
||||
msgid "Checking this option will download video thumbnails to your server"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:341
|
||||
msgid "Automatically Set Featured Image"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:342
|
||||
msgid ""
|
||||
"Check this option to automatically set video thumbnails as the featured "
|
||||
"image (requires saving to media library)"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:350
|
||||
msgid "Post Types"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:355
|
||||
msgid "Custom Field (optional)"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:356
|
||||
msgid "Automatically Detect"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:356
|
||||
msgid ""
|
||||
"Enter the name of the custom field where your embed code or video URL is "
|
||||
"stored."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:386
|
||||
msgid ""
|
||||
"These options configure where the plugin will search for videos and what to "
|
||||
"do with thumbnails once found."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:459 video-thumbnails.php:489
|
||||
msgid "You do not have sufficient permissions to access this page."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:468
|
||||
msgid "General"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:469
|
||||
msgid "Providers"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:470
|
||||
msgid "Mass Actions"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:471
|
||||
msgid "Debugging"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:472
|
||||
msgid "Support"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:479
|
||||
msgid "Getting started"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:481
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:483
|
||||
msgid ""
|
||||
"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>."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:511
|
||||
msgid "Scan All Posts"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:513
|
||||
msgid ""
|
||||
"Scan all of your past posts for video thumbnails. Be sure to save any "
|
||||
"settings before running the scan."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:515
|
||||
msgid "Scan Past Posts"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:517
|
||||
msgid "Clear all Video Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:519
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:521
|
||||
msgid "Clear Video Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:532
|
||||
msgid ""
|
||||
"Use these tests to help diagnose any problems. Please include results when "
|
||||
"requesting support."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:534
|
||||
#: php/class-video-thumbnails-settings.php:539
|
||||
msgid "Test Video Providers"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:536
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:542
|
||||
msgid "Test Markup for Video"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:544
|
||||
msgid "Copy and paste an embed code below to see if a video is detected."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:548
|
||||
msgid "Scan For Thumbnail"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:552
|
||||
msgid "Test Saving to Media Library"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:554
|
||||
msgid ""
|
||||
"This test checks for issues with the process of saving a remote thumbnail to "
|
||||
"your local media library."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:556
|
||||
msgid ""
|
||||
"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>."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:559
|
||||
msgid "Test Image Downloading"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:562
|
||||
msgid "Installation Information"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:573
|
||||
msgid "WordPress Version"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:578
|
||||
msgid "Video Thumbnails Version"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:583
|
||||
msgid "Video Thumbnails Settings Version"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:588
|
||||
msgid "PHP Version"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:593
|
||||
msgid "Post Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:594
|
||||
msgid "Your theme supports post thumbnails."
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:594
|
||||
msgid ""
|
||||
"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>"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:598
|
||||
msgid "Video Providers"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:637
|
||||
msgid "Support video thumbnails and unlock additional features"
|
||||
msgstr ""
|
||||
|
||||
#: php/class-video-thumbnails-settings.php:638
|
||||
msgid "Go Pro"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-blip-thumbnails.php:50
|
||||
msgid ""
|
||||
"Error retrieving video information for <a href=\"%1$s\">%1$s</a>. Check to "
|
||||
"be sure this is a valid Blip video URL."
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-blip-thumbnails.php:65
|
||||
#: php/providers/class-collegehumor-thumbnails.php:67
|
||||
#: php/providers/class-rutube-thumbnails.php:62
|
||||
#: php/providers/class-twitch-thumbnails.php:62
|
||||
#: php/providers/class-youku-thumbnails.php:68
|
||||
msgid "Video URL"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-blip-thumbnails.php:71
|
||||
#: php/providers/class-collegehumor-thumbnails.php:61
|
||||
#: php/providers/class-dailymotion-thumbnails.php:63
|
||||
#: php/providers/class-facebook-thumbnails.php:60
|
||||
#: php/providers/class-funnyordie-thumbnails.php:62
|
||||
#: php/providers/class-googledrive-thumbnails.php:82
|
||||
#: php/providers/class-mpora-thumbnails.php:60
|
||||
#: php/providers/class-rutube-thumbnails.php:68
|
||||
#: php/providers/class-vimeo-thumbnails.php:110
|
||||
#: php/providers/class-vk-thumbnails.php:69
|
||||
#: php/providers/class-wistia-thumbnails.php:85
|
||||
msgid "iFrame Embed"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-dailymotion-thumbnails.php:69
|
||||
#: php/providers/class-facebook-thumbnails.php:54
|
||||
#: php/providers/class-funnyordie-thumbnails.php:68
|
||||
#: php/providers/class-googledrive-thumbnails.php:94
|
||||
#: php/providers/class-justintv-thumbnails.php:61
|
||||
#: php/providers/class-metacafe-thumbnails.php:62
|
||||
#: php/providers/class-mpora-thumbnails.php:54
|
||||
#: php/providers/class-twitch-thumbnails.php:68
|
||||
#: php/providers/class-vimeo-thumbnails.php:116
|
||||
#: php/providers/class-youku-thumbnails.php:62
|
||||
msgid "Flash Embed"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-googledrive-thumbnails.php:88
|
||||
msgid "iFrame Embed (Apps account)"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-googledrive-thumbnails.php:100
|
||||
msgid "Flash Embed (YouTube player)"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-kaltura-thumbnails.php:68
|
||||
msgid "Auto Embed"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-video-thumbnails-providers.php:92
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-vimeo-thumbnails.php:122
|
||||
msgid "Channel URL"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-vine-thumbnails.php:69
|
||||
msgid "iFrame Embed/Video URL"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-wistia-thumbnails.php:91
|
||||
msgid "JavaScript Embed"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:64
|
||||
msgid "iFrame Embed HD"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:70
|
||||
msgid "Flash Embed HD"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:76
|
||||
msgid "iFrame Embed SD"
|
||||
msgstr ""
|
||||
|
||||
#: php/providers/class-youtube-thumbnails.php:82
|
||||
msgid "Flash Embed SD"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:93
|
||||
msgid "Bulk Video Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:93
|
||||
msgid "Bulk Video Thumbs"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:102
|
||||
msgid "Started Scanning"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:103
|
||||
msgid "Resumed Scanning"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:104
|
||||
msgid "Paused Scanning"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:105
|
||||
msgid "Done!"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:106
|
||||
msgid "Scanned 1 post"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:107
|
||||
msgid "Scanned %d posts"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:108
|
||||
msgid "1 post in queue"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:109
|
||||
msgid "%d posts in queue"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:110
|
||||
msgid "Scanning %1$s of %2$s"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:111
|
||||
msgid "No thumbnail"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:112
|
||||
msgid "New thumbnail:"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:113
|
||||
msgid "Existing thumbnail:"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:114
|
||||
msgid "Error:"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:136
|
||||
msgid "Troubleshooting Video Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:148 video-thumbnails.php:155
|
||||
msgid "Reset Video Thumbnail"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:150 video-thumbnails.php:434
|
||||
msgid "No video thumbnail for this post."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:151
|
||||
msgid "Search Again"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:151
|
||||
msgid "Troubleshoot"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:157
|
||||
msgid "A video thumbnail will be found for this post when it is published."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:167
|
||||
msgid "Fixing \"No video thumbnail for this post\""
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:169
|
||||
msgid "Ensure you have saved any changes to your post."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:170
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:171
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:172
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:173
|
||||
msgid "Try posting a video from other sources to help narrow down the problem."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:174
|
||||
msgid ""
|
||||
"Search the <a href=\"http://wordpress.org/support/plugin/video-thumbnails"
|
||||
"\">support threads</a> to see if anyone has had the same issue."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:175
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:336
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:354
|
||||
msgid "Unsupported MIME type:"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:367
|
||||
msgid "Error uploading image data:"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:495
|
||||
msgid "Bulk Video Thumbnail Generator"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:497
|
||||
msgid "Use this tool to scan all of your posts for Video Thumbnails."
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:506
|
||||
msgid "Scan Now"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:521
|
||||
msgid "Scanned"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:522
|
||||
msgid "New Thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#: video-thumbnails.php:523
|
||||
msgid "Existing"
|
||||
msgstr ""
|
||||
|
||||
#. Plugin URI of the plugin/theme
|
||||
msgid "https://refactored.co/plugins/video-thumbnails"
|
||||
msgstr ""
|
||||
|
||||
#. Description of the plugin/theme
|
||||
msgid ""
|
||||
"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."
|
||||
msgstr ""
|
||||
|
||||
#. Author of the plugin/theme
|
||||
msgid "Sutherland Boswell"
|
||||
msgstr ""
|
||||
|
||||
#. Author URI of the plugin/theme
|
||||
msgid "http://sutherlandboswell.com"
|
||||
msgstr ""
|
@ -0,0 +1,730 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2013 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
class Video_Thumbnails_Settings {
|
||||
|
||||
public $options;
|
||||
|
||||
var $default_options = array(
|
||||
'save_media' => 1,
|
||||
'set_featured' => 1,
|
||||
'post_types' => array( 'post' ),
|
||||
'custom_field' => ''
|
||||
);
|
||||
|
||||
function __construct() {
|
||||
// Activation and deactivation hooks
|
||||
register_activation_hook( VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php', array( &$this, 'plugin_activation' ) );
|
||||
register_deactivation_hook( VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php', array( &$this, 'plugin_deactivation' ) );
|
||||
// Set current options
|
||||
add_action( 'plugins_loaded', array( &$this, 'set_options' ) );
|
||||
// Add options page to menu
|
||||
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
|
||||
// Initialize options
|
||||
add_action( 'admin_init', array( &$this, 'initialize_options' ) );
|
||||
// Custom field detection callback
|
||||
add_action( 'wp_ajax_video_thumbnail_custom_field_detection', array( &$this, 'custom_field_detection_callback' ) );
|
||||
// Ajax clear all callback
|
||||
add_action( 'wp_ajax_clear_all_video_thumbnails', array( &$this, 'ajax_clear_all_callback' ) );
|
||||
// Ajax test callbacks
|
||||
add_action( 'wp_ajax_video_thumbnail_provider_test', array( &$this, 'provider_test_callback' ) ); // Provider test
|
||||
add_action( 'wp_ajax_video_thumbnail_image_download_test', array( &$this, 'image_download_test_callback' ) ); // Saving media test
|
||||
add_action( 'wp_ajax_video_thumbnail_delete_test_images', array( &$this, 'delete_test_images_callback' ) ); // Delete test images
|
||||
add_action( 'wp_ajax_video_thumbnail_markup_detection_test', array( &$this, 'markup_detection_test_callback' ) ); // Markup input test
|
||||
// Admin scripts
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts' ) );
|
||||
// Add "Go Pro" call to action to settings footer
|
||||
add_action( 'video_thumbnails/settings_footer', array( 'Video_Thumbnails_Settings', 'settings_footer' ) );
|
||||
}
|
||||
|
||||
// Activation hook
|
||||
function plugin_activation() {
|
||||
add_option( 'video_thumbnails', $this->default_options );
|
||||
}
|
||||
|
||||
// Deactivation hook
|
||||
function plugin_deactivation() {
|
||||
delete_option( 'video_thumbnails' );
|
||||
}
|
||||
|
||||
// Set options & possibly upgrade
|
||||
function set_options() {
|
||||
// Get the current options from the database
|
||||
$options = get_option( 'video_thumbnails' );
|
||||
// If there aren't any options, load the defaults
|
||||
if ( ! $options ) $options = $this->default_options;
|
||||
// Check if our options need upgrading
|
||||
$options = $this->upgrade_options( $options );
|
||||
// Set the options class variable
|
||||
$this->options = $options;
|
||||
}
|
||||
|
||||
function upgrade_options( $options ) {
|
||||
|
||||
// Boolean for if options need updating
|
||||
$options_need_updating = false;
|
||||
|
||||
// If there isn't a settings version we need to check for pre 2.0 settings
|
||||
if ( ! isset( $options['version'] ) ) {
|
||||
|
||||
// Check for post type setting
|
||||
$post_types = get_option( 'video_thumbnails_post_types' );
|
||||
|
||||
// If there is a a post type option we know there should be others
|
||||
if ( $post_types !== false ) {
|
||||
|
||||
$options['post_types'] = $post_types;
|
||||
delete_option( 'video_thumbnails_post_types' );
|
||||
|
||||
$options['save_media'] = get_option( 'video_thumbnails_save_media' );
|
||||
delete_option( 'video_thumbnails_save_media' );
|
||||
|
||||
$options['set_featured'] = get_option( 'video_thumbnails_set_featured' );
|
||||
delete_option( 'video_thumbnails_set_featured' );
|
||||
|
||||
$options['custom_field'] = get_option( 'video_thumbnails_custom_field' );
|
||||
delete_option( 'video_thumbnails_custom_field' );
|
||||
|
||||
}
|
||||
|
||||
// Updates the options version to 2.0
|
||||
$options['version'] = '2.0';
|
||||
$options_need_updating = true;
|
||||
|
||||
}
|
||||
|
||||
if ( version_compare( $options['version'], VIDEO_THUMBNAILS_VERSION, '<' ) ) {
|
||||
$options['version'] = VIDEO_THUMBNAILS_VERSION;
|
||||
$options_need_updating = true;
|
||||
}
|
||||
|
||||
// Save options to database if they've been updated
|
||||
if ( $options_need_updating ) {
|
||||
update_option( 'video_thumbnails', $options );
|
||||
}
|
||||
|
||||
return $options;
|
||||
|
||||
}
|
||||
|
||||
function admin_menu() {
|
||||
add_options_page(
|
||||
__( 'Video Thumbnails Options', 'video-thumbnails' ),
|
||||
__( 'Video Thumbnails', 'video-thumbnails' ),
|
||||
'manage_options',
|
||||
'video_thumbnails',
|
||||
array( &$this, 'options_page' )
|
||||
);
|
||||
}
|
||||
|
||||
function admin_scripts( $hook ) {
|
||||
if ( 'settings_page_video_thumbnails' == $hook ) {
|
||||
wp_enqueue_style( 'video-thumbnails-settings-css', plugins_url( '/css/settings.css', VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php' ), false, VIDEO_THUMBNAILS_VERSION );
|
||||
wp_enqueue_script( 'video_thumbnails_settings', plugins_url( 'js/settings.js' , VIDEO_THUMBNAILS_PATH . '/video-thumbnails.php' ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
|
||||
wp_localize_script( 'video_thumbnails_settings', 'video_thumbnails_settings_language', array(
|
||||
'detection_failed' => __( 'We were unable to find a video in the custom fields of your most recently updated post.', 'video-thumbnails' ),
|
||||
'working' => __( 'Working...', 'video-thumbnails' ),
|
||||
'retest' => __( 'Retest', 'video-thumbnails' ),
|
||||
'ajax_error' => __( 'AJAX Error:', 'video-thumbnails' ),
|
||||
'clear_all_confirmation' => __( 'Are you sure you want to clear all video thumbnails? This cannot be undone.', 'video-thumbnails' ),
|
||||
) );
|
||||
global $video_thumbnails;
|
||||
$provider_slugs = array();
|
||||
foreach ( $video_thumbnails->providers as $provider ) {
|
||||
$provider_slugs[] = $provider->service_slug;
|
||||
}
|
||||
wp_localize_script( 'video_thumbnails_settings', 'video_thumbnails_provider_slugs', array(
|
||||
'provider_slugs' => $provider_slugs
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
function custom_field_detection_callback() {
|
||||
if ( current_user_can( 'manage_options' ) ) {
|
||||
echo $this->detect_custom_field();
|
||||
}
|
||||
die();
|
||||
}
|
||||
|
||||
function detect_custom_field() {
|
||||
global $video_thumbnails;
|
||||
$latest_post = get_posts( array(
|
||||
'posts_per_page' => 1,
|
||||
'post_type' => $this->options['post_types'],
|
||||
'orderby' => 'modified',
|
||||
) );
|
||||
$latest_post = $latest_post[0];
|
||||
$custom = get_post_meta( $latest_post->ID );
|
||||
foreach ( $custom as $name => $values ) {
|
||||
foreach ($values as $value) {
|
||||
if ( $video_thumbnails->get_first_thumbnail_url( $value ) ) {
|
||||
return $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ajax_clear_all_callback() {
|
||||
if ( !current_user_can( 'manage_options' ) ) die();
|
||||
if ( wp_verify_nonce( $_POST['nonce'], 'clear_all_video_thumbnails' ) ) {
|
||||
global $wpdb;
|
||||
// Clear images from media library
|
||||
$media_library_items = get_posts( array(
|
||||
'showposts' => -1,
|
||||
'post_type' => 'attachment',
|
||||
'meta_key' => 'video_thumbnail',
|
||||
'meta_value' => '1',
|
||||
'fields' => 'ids'
|
||||
) );
|
||||
foreach ( $media_library_items as $item ) {
|
||||
wp_delete_attachment( $item, true );
|
||||
}
|
||||
echo '<p><span style="color:green">✔</span> ' . sprintf( _n( '1 attachment deleted', '%s attachments deleted', count( $media_library_items ), 'video-thumbnails' ), count( $media_library_items ) ) . '</p>';
|
||||
// Clear custom fields
|
||||
$custom_fields_cleared = $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_key='_video_thumbnail'" );
|
||||
echo '<p><span style="color:green">✔</span> ' . sprintf( _n( '1 custom field cleared', '%s custom fields cleared', $custom_fields_cleared, 'video-thumbnails' ), $custom_fields_cleared ) . '</p>';
|
||||
} else {
|
||||
echo '<p><span style="color:red">✖</span> ' . __( '<strong>Error</strong>: Could not verify nonce.', 'video-thumbnails' ) . '</p>';
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
function get_file_hash( $url ) {
|
||||
$response = wp_remote_get( $url );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = false;
|
||||
} else {
|
||||
$result = md5( $response['body'] );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
function provider_test_callback() {
|
||||
|
||||
if ( !current_user_can( 'manage_options' ) ) die();
|
||||
|
||||
global $video_thumbnails;
|
||||
|
||||
?>
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Name', 'video-thumbnails' ); ?></th>
|
||||
<th><?php _e( 'Pass/Fail', 'video-thumbnails' ); ?></th>
|
||||
<th><?php _e( 'Result', 'video-thumbnails' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$provider = $video_thumbnails->providers[$_POST['provider_slug']];
|
||||
foreach ( $provider->get_test_cases() as $test_case ) {
|
||||
echo '<tr>';
|
||||
echo '<td><strong>' . $test_case['name'] . '</strong></td>';
|
||||
$markup = apply_filters( 'the_content', $test_case['markup'] );
|
||||
$result = $video_thumbnails->get_first_thumbnail_url( $markup );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
$error_string = $result->get_error_message();
|
||||
echo '<td style="color:red;">✗ ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
|
||||
echo '<td>';
|
||||
echo '<div class="error"><p>' . $error_string . '</p></div>';
|
||||
echo '</td>';
|
||||
$failed++;
|
||||
} else {
|
||||
$result_hash = false;
|
||||
if ( $result == $test_case['expected'] ) {
|
||||
$matched = true;
|
||||
} else {
|
||||
$result_hash = $this->get_file_hash( $result );
|
||||
$matched = ( $result_hash == $test_case['expected_hash'] ? true : false );
|
||||
}
|
||||
|
||||
if ( $matched ) {
|
||||
echo '<td style="color:green;">✔ ' . __( 'Passed', 'video-thumbnails' ) . '</td>';
|
||||
} else {
|
||||
echo '<td style="color:red;">✗ ' . __( 'Failed', 'video-thumbnails' ) . '</td>';
|
||||
}
|
||||
echo '<td>';
|
||||
if ( $result ) {
|
||||
echo '<a href="' . $result . '">' . __( 'View Image', 'video-thumbnails' ) . '</a>';
|
||||
}
|
||||
if ( $result_hash ) {
|
||||
echo ' <code>' . $result_hash . '</code>';
|
||||
}
|
||||
echo '</td>';
|
||||
}
|
||||
echo '</tr>';
|
||||
} ?>
|
||||
<tbody>
|
||||
</table>
|
||||
<?php die();
|
||||
} // End provider test callback
|
||||
|
||||
function image_download_test_callback() {
|
||||
|
||||
if ( !current_user_can( 'manage_options' ) ) die();
|
||||
|
||||
// Try saving 'http://img.youtube.com/vi/aKAGU2jkaNg/maxresdefault.jpg' to media library
|
||||
$attachment_id = Video_Thumbnails::save_to_media_library( 'http://img.youtube.com/vi/aKAGU2jkaNg/maxresdefault.jpg', 1 );
|
||||
if ( is_wp_error( $attachment_id ) ) {
|
||||
echo '<p><span style="color:red;">✖</span> ' . $attachment_id->get_error_message() . '</p>';
|
||||
} else {
|
||||
update_post_meta( $attachment_id, 'video_thumbnail_test_image', '1' );
|
||||
$image = wp_get_attachment_image_src( $attachment_id, 'full' );
|
||||
echo '<img src="' . $image[0] . '" style="float:left; max-width: 250px; margin-right: 10px;">';
|
||||
echo '<p><span style="color:green;">✔</span> ' . __( 'Attachment created', 'video-thumbnails' ) . '</p>';
|
||||
echo '<p><a href="' . get_edit_post_link( $attachment_id ) . '">' . __( 'View in Media Library', 'video-thumbnails' ) . '</a></p>';
|
||||
echo '<a href="' . $image[0] . '" target="_blank">' . __( 'View full size', 'video-thumbnails' ) . '</a>';
|
||||
echo '<span style="display:block;clear:both;"></span>';
|
||||
}
|
||||
|
||||
die();
|
||||
} // End saving media test callback
|
||||
|
||||
function delete_test_images_callback() {
|
||||
|
||||
if ( !current_user_can( 'manage_options' ) ) die();
|
||||
|
||||
global $wpdb;
|
||||
// Clear images from media library
|
||||
$media_library_items = get_posts( array(
|
||||
'showposts' => -1,
|
||||
'post_type' => 'attachment',
|
||||
'meta_key' => 'video_thumbnail_test_image',
|
||||
'meta_value' => '1',
|
||||
'fields' => 'ids'
|
||||
) );
|
||||
foreach ( $media_library_items as $item ) {
|
||||
wp_delete_attachment( $item, true );
|
||||
}
|
||||
echo '<p><span style="color:green">✔</span> ' . sprintf( _n( '1 attachment deleted', '%s attachments deleted', count( $media_library_items ), 'video-thumbnails' ), count( $media_library_items ) ) . '</p>';
|
||||
|
||||
die();
|
||||
} // End delete test images callback
|
||||
|
||||
function markup_detection_test_callback() {
|
||||
|
||||
if ( !current_user_can( 'manage_options' ) ) die();
|
||||
|
||||
$new_thumbnail = null;
|
||||
|
||||
global $video_thumbnails;
|
||||
|
||||
$markup = apply_filters( 'the_content', stripslashes( $_POST['markup'] ) );
|
||||
|
||||
$new_thumbnail = $video_thumbnails->get_first_thumbnail_url( $markup );
|
||||
|
||||
if ( $new_thumbnail == null ) {
|
||||
// No thumbnail
|
||||
echo '<p><span style="color:red;">✖</span> ' . __( 'No thumbnail found', 'video-thumbnails' ) . '</p>';
|
||||
} elseif ( is_wp_error( $new_thumbnail ) ) {
|
||||
// Error finding thumbnail
|
||||
echo '<p><span style="color:red;">✖</span> ' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $new_thumbnail->get_error_message() . '</p>';
|
||||
} else {
|
||||
// Found a thumbnail
|
||||
$remote_response = wp_remote_head( $new_thumbnail );
|
||||
if ( is_wp_error( $remote_response ) ) {
|
||||
// WP Error trying to read image from remote server
|
||||
echo '<p><span style="color:red;">✖</span> ' . __( 'Thumbnail found, but there was an error retrieving the URL.', 'video-thumbnails' ) . '</p>';
|
||||
echo '<p>' . __( 'Error Details:', 'video-thumbnails' ) . ' ' . $remote_response->get_error_message() . '</p>';
|
||||
} elseif ( $remote_response['response']['code'] != '200' ) {
|
||||
// Response code isn't okay
|
||||
echo '<p><span style="color:red;">✖</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>';
|
||||
echo '<p>' . __( 'Thumbnail URL:', 'video-thumbnails' ) . ' <a href="' . $new_thumbnail . '" target="_blank">' . $new_thumbnail . '</a>';
|
||||
} else {
|
||||
// Everything is okay!
|
||||
echo '<p><span style="color:green;">✔</span> ' . __( 'Thumbnail found! Image should appear below.', 'video-thumbnails' ) . ' <a href="' . $new_thumbnail . '" target="_blank">' . __( 'View full size', 'video-thumbnails' ) . '</a></p>';
|
||||
echo '<p><img src="' . $new_thumbnail . '" style="max-width: 500px;"></p>';
|
||||
}
|
||||
}
|
||||
|
||||
die();
|
||||
} // End markup detection test callback
|
||||
|
||||
function initialize_options() {
|
||||
add_settings_section(
|
||||
'general_settings_section',
|
||||
__( 'General Settings', 'video-thumbnails' ),
|
||||
array( &$this, 'general_settings_callback' ),
|
||||
'video_thumbnails'
|
||||
);
|
||||
$this->add_checkbox_setting(
|
||||
'save_media',
|
||||
__( 'Save Thumbnails to Media Library', 'video-thumbnails' ),
|
||||
__( 'Checking this option will download video thumbnails to your server', 'video-thumbnails' )
|
||||
);
|
||||
$this->add_checkbox_setting(
|
||||
'set_featured',
|
||||
__( 'Automatically Set Featured Image', 'video-thumbnails' ),
|
||||
__( 'Check this option to automatically set video thumbnails as the featured image (requires saving to media library)', 'video-thumbnails' )
|
||||
);
|
||||
// Get post types
|
||||
$post_types = get_post_types( null, 'names' );
|
||||
// Remove certain post types from array
|
||||
$post_types = array_diff( $post_types, array( 'attachment', 'revision', 'nav_menu_item' ) );
|
||||
$this->add_multicheckbox_setting(
|
||||
'post_types',
|
||||
__( 'Post Types', 'video-thumbnails' ),
|
||||
$post_types
|
||||
);
|
||||
$this->add_text_setting(
|
||||
'custom_field',
|
||||
__( 'Custom Field (optional)', 'video-thumbnails' ),
|
||||
'<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' )
|
||||
);
|
||||
register_setting( 'video_thumbnails', 'video_thumbnails', array( &$this, 'sanitize_callback' ) );
|
||||
}
|
||||
|
||||
function sanitize_callback( $input ) {
|
||||
$current_settings = get_option( 'video_thumbnails' );
|
||||
$output = array();
|
||||
// General settings
|
||||
if ( !isset( $input['provider_options'] ) ) {
|
||||
foreach( $current_settings as $key => $value ) {
|
||||
if ( $key == 'version' OR $key == 'providers' ) {
|
||||
$output[$key] = $current_settings[$key];
|
||||
} elseif ( isset( $input[$key] ) ) {
|
||||
$output[$key] = $input[$key];
|
||||
} else {
|
||||
$output[$key] = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Provider settings
|
||||
else {
|
||||
$output = $current_settings;
|
||||
unset( $output['providers'] );
|
||||
$output['providers'] = $input['providers'];
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
function general_settings_callback() {
|
||||
echo '<p>' . __( 'These options configure where the plugin will search for videos and what to do with thumbnails once found.', 'video-thumbnails' ) . '</p>';
|
||||
}
|
||||
|
||||
function add_checkbox_setting( $slug, $name, $description ) {
|
||||
add_settings_field(
|
||||
$slug,
|
||||
$name,
|
||||
array( &$this, 'checkbox_callback' ),
|
||||
'video_thumbnails',
|
||||
'general_settings_section',
|
||||
array(
|
||||
'slug' => $slug,
|
||||
'description' => $description
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function checkbox_callback( $args ) {
|
||||
$html = '<label for="' . $args['slug'] . '"><input type="checkbox" id="' . $args['slug'] . '" name="video_thumbnails[' . $args['slug'] . ']" value="1" ' . checked( 1, $this->options[$args['slug']], false ) . '/> ' . $args['description'] . '</label>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
function add_multicheckbox_setting( $slug, $name, $options ) {
|
||||
add_settings_field(
|
||||
$slug,
|
||||
$name,
|
||||
array( &$this, 'multicheckbox_callback' ),
|
||||
'video_thumbnails',
|
||||
'general_settings_section',
|
||||
array(
|
||||
'slug' => $slug,
|
||||
'options' => $options
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function multicheckbox_callback( $args ) {
|
||||
if ( is_array( $this->options[$args['slug']] ) ) {
|
||||
$selected_types = $this->options[$args['slug']];
|
||||
} else {
|
||||
$selected_types = array();
|
||||
}
|
||||
$html = '';
|
||||
foreach ( $args['options'] as $option ) {
|
||||
$checked = ( in_array( $option, $selected_types ) ? 'checked="checked"' : '' );
|
||||
$html .= '<label for="' . $args['slug'] . '_' . $option . '"><input type="checkbox" id="' . $args['slug'] . '_' . $option . '" name="video_thumbnails[' . $args['slug'] . '][]" value="' . $option . '" ' . $checked . '/> ' . $option . '</label><br>';
|
||||
}
|
||||
echo $html;
|
||||
}
|
||||
|
||||
function add_text_setting( $slug, $name, $description ) {
|
||||
add_settings_field(
|
||||
$slug,
|
||||
$name,
|
||||
array( &$this, 'text_field_callback' ),
|
||||
'video_thumbnails',
|
||||
'general_settings_section',
|
||||
array(
|
||||
'slug' => $slug,
|
||||
'description' => $description
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
function text_field_callback( $args ) {
|
||||
$html = '<input type="text" id="' . $args['slug'] . '" name="video_thumbnails[' . $args['slug'] . ']" value="' . $this->options[$args['slug']] . '"/>';
|
||||
$html .= '<label for="' . $args['slug'] . '"> ' . $args['description'] . '</label>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
function options_page() {
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
|
||||
}
|
||||
|
||||
global $video_thumbnails;
|
||||
|
||||
?><div class="wrap">
|
||||
|
||||
<div id="icon-options-general" class="icon32"></div><h2><?php _e( 'Video Thumbnails Options', 'video-thumbnails' ); ?></h2>
|
||||
|
||||
<?php $active_tab = isset( $_GET[ 'tab' ] ) ? $_GET[ 'tab' ] : 'general_settings'; ?>
|
||||
<h2 class="nav-tab-wrapper">
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<a href="?page=video_thumbnails&tab=debugging" class="nav-tab <?php echo $active_tab == 'debugging' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Debugging', 'video-thumbnails' ); ?></a>
|
||||
<a href="?page=video_thumbnails&tab=support" class="nav-tab <?php echo $active_tab == 'support' ? 'nav-tab-active' : ''; ?>"><?php _e( 'Support', 'video-thumbnails' ); ?></a>
|
||||
</h2>
|
||||
|
||||
<?php
|
||||
// Main settings
|
||||
if ( $active_tab == 'general_settings' ) {
|
||||
?>
|
||||
<h3><?php _e( 'Getting started', 'video-thumbnails' ); ?></h3>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<?php settings_fields( 'video_thumbnails' ); ?>
|
||||
<?php do_settings_sections( 'video_thumbnails' ); ?>
|
||||
<?php submit_button(); ?>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
// End main settings
|
||||
}
|
||||
// Provider Settings
|
||||
if ( $active_tab == 'provider_settings' ) {
|
||||
?>
|
||||
|
||||
<form method="post" action="options.php">
|
||||
<input type="hidden" name="video_thumbnails[provider_options]" value="1" />
|
||||
<?php settings_fields( 'video_thumbnails' ); ?>
|
||||
<?php do_settings_sections( 'video_thumbnails_providers' ); ?>
|
||||
<?php submit_button(); ?>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
// End provider settings
|
||||
}
|
||||
// Scan all posts
|
||||
if ( $active_tab == 'mass_actions' ) {
|
||||
?>
|
||||
<h3><?php _e( 'Scan All Posts', 'video-thumbnails' ); ?></h3>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<h3><?php _e( 'Clear all Video Thumbnails', 'video-thumbnails' ); ?></h3>
|
||||
|
||||
<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>
|
||||
|
||||
<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>
|
||||
|
||||
<div id="clear-all-video-thumbnails-result"></div>
|
||||
|
||||
<?php
|
||||
// End scan all posts
|
||||
}
|
||||
// Debugging
|
||||
if ( $active_tab == 'debugging' ) {
|
||||
?>
|
||||
|
||||
<p><?php _e( 'Use these tests to help diagnose any problems. Please include results when requesting support.', 'video-thumbnails' ); ?></p>
|
||||
|
||||
<div class="video-thumbnails-test closed">
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Test Video Providers', 'video-thumbnails' ); ?></h3></a>
|
||||
|
||||
<div class="video-thumbnails-test-content">
|
||||
|
||||
<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>
|
||||
|
||||
<p><input type="submit" class="button-primary video-thumbnails-test-button" id="test-all-video-thumbnail-providers" value="<?php esc_attr_e( 'Test Video Providers', 'video-thumbnails' ); ?>" /></p>
|
||||
|
||||
<div id="provider-test-results" class="hidden">
|
||||
<?php
|
||||
foreach ( $video_thumbnails->providers as $provider ) {
|
||||
echo '<div id="' . $provider->service_slug . '-provider-test" class="single-provider-test-results">';
|
||||
echo '<h3>' . $provider->service_name . ' <input type="submit" data-provider-slug="' . $provider->service_slug . '" class="button-primary retest-video-provider video-thumbnails-test-button" value="' . esc_attr__( 'Waiting...', 'video-thumbnails' ) . '" /></h3>';
|
||||
echo '<div class="test-results"></div>';
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div><!-- /.video-thumbnails-test-content -->
|
||||
|
||||
</div>
|
||||
<div class="video-thumbnails-test closed">
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Test Markup for Video', 'video-thumbnails' ); ?></h3></a>
|
||||
|
||||
<div class="video-thumbnails-test-content">
|
||||
|
||||
<p><?php _e( 'Copy and paste an embed code below to see if a video is detected.', 'video-thumbnails' ); ?></p>
|
||||
|
||||
<textarea id="markup-input" cols="50" rows="5"></textarea>
|
||||
|
||||
<p><input type="submit" id="test-markup-detection" class="button-primary video-thumbnails-test-button" value="<?php esc_attr_e( 'Scan For Thumbnail', 'video-thumbnails' ); ?>" /></p>
|
||||
|
||||
<div id="markup-test-result"></div>
|
||||
|
||||
</div><!-- /.video-thumbnails-test-content -->
|
||||
|
||||
</div>
|
||||
<div class="video-thumbnails-test closed">
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Test Saving to Media Library', 'video-thumbnails' ); ?></h3></a>
|
||||
|
||||
<div class="video-thumbnails-test-content">
|
||||
|
||||
<p><?php _e( 'This test checks for issues with the process of saving a remote thumbnail to your local media library.', 'video-thumbnails' ); ?></p>
|
||||
|
||||
<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>
|
||||
|
||||
<p>
|
||||
<input type="submit" id="test-video-thumbnail-saving-media" class="button-primary video-thumbnails-test-button" value="<?php esc_attr_e( 'Download Test Image', 'video-thumbnails' ); ?>" />
|
||||
<input type="submit" id="delete-video-thumbnail-test-images" class="button video-thumbnails-test-button" value="<?php esc_attr_e( 'Delete Test Images', 'video-thumbnails' ); ?>" />
|
||||
</p>
|
||||
|
||||
<div id="media-test-result"></div>
|
||||
|
||||
</div><!-- /.video-thumbnails-test-content -->
|
||||
|
||||
</div>
|
||||
<div class="video-thumbnails-test closed">
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content show-hide-test-link"><span class="show"><?php _e( 'Show', 'video-thumbnails' ); ?></span> <span class="hide"><?php _e( 'Hide', 'video-thumbnails' ); ?></span></a>
|
||||
|
||||
<a href="#" class="toggle-video-thumbnails-test-content title-test-link"><h3 class="test-title"><?php _e( 'Installation Information', 'video-thumbnails' ); ?></h3></a>
|
||||
|
||||
<div class="video-thumbnails-test-content">
|
||||
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong><?php _e( 'WordPress Version', 'video-thumbnails' ); ?></strong></td>
|
||||
<td><?php echo get_bloginfo( 'version' ); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php _e( 'Video Thumbnails Version', 'video-thumbnails' ); ?></strong></td>
|
||||
<td><?php echo VIDEO_THUMBNAILS_VERSION; ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php _e( 'Video Thumbnails Settings Version', 'video-thumbnails' ); ?></strong></td>
|
||||
<td><?php echo $this->options['version']; ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php _e( 'PHP Version', 'video-thumbnails' ); ?></strong></td>
|
||||
<td><?php echo PHP_VERSION; ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php _e( 'Post Thumbnails', 'video-thumbnails' ); ?></strong></td>
|
||||
<td><?php if ( current_theme_supports( 'post-thumbnails' ) ) : ?><span style="color:green">✔</span> <?php _e( 'Your theme supports post thumbnails.', 'video-thumbnails' ); ?><?php else: ?><span style="color:red">✖</span> <?php _e( 'Your theme does not support post thumbnails, you\'ll need to make modifications or switch to a different theme. <a href="http://codex.wordpress.org/Post_Thumbnails">More info</a>', 'video-thumbnails' ); ?><?php endif; ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php _e( 'Video Providers', 'video-thumbnails' ); ?></strong></td>
|
||||
<td>
|
||||
<?php global $video_thumbnails; ?>
|
||||
<?php $provider_names = array(); foreach ( $video_thumbnails->providers as $provider ) { $provider_names[] = $provider->service_name; }; ?>
|
||||
<strong><?php echo count( $video_thumbnails->providers ); ?></strong>: <?php echo implode( ', ', $provider_names ); ?>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
</div><!-- /.video-thumbnails-test-content -->
|
||||
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// End debugging
|
||||
}
|
||||
// Support
|
||||
if ( $active_tab == 'support' ) {
|
||||
|
||||
Video_Thumbnails::no_video_thumbnail_troubleshooting_instructions();
|
||||
|
||||
// End support
|
||||
}
|
||||
?>
|
||||
|
||||
<?php do_action( 'video_thumbnails/settings_footer' ); ?>
|
||||
|
||||
</div><?php
|
||||
}
|
||||
|
||||
public static function settings_footer() {
|
||||
?>
|
||||
<div style="width: 250px; margin: 20px 0; padding: 0 20px; background: #fff; border: 1px solid #dfdfdf; text-align: center;">
|
||||
<div>
|
||||
<p><?php _e( 'Support video thumbnails and unlock additional features', 'video-thumbnails' ); ?></p>
|
||||
<p><a href="https://refactored.co/plugins/video-thumbnails" class="button button-primary button-large"><?php _e( 'Go Pro', 'video-thumbnails' ); ?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require YouTube provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-youtube-thumbnails.php' );
|
||||
|
||||
/**
|
||||
* Checks if AYVP is importing
|
||||
* @return boolean True if importing, false if not
|
||||
*/
|
||||
function is_ayvp_importing() {
|
||||
// Global variables used by AYVP
|
||||
global $getWP, $tern_wp_youtube_options, $tern_wp_youtube_o;
|
||||
// Check for the class used by AYVP
|
||||
if ( class_exists( 'ternWP' ) && isset( $getWP ) ) {
|
||||
// Load the AYVP options
|
||||
$tern_wp_youtube_o = $getWP->getOption( 'tern_wp_youtube', $tern_wp_youtube_options );
|
||||
if ( $tern_wp_youtube_o['is_importing'] && $tern_wp_youtube_o['is_importing'] !== false ) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function ayvp_new_video_thumbnail_url_filter( $new_thumbnail, $post_id ) {
|
||||
global $video_thumbnails;
|
||||
if ( !isset( $video_thumbnails->providers['youtube'] ) ) return false;
|
||||
// When publishing a post during import, use the global variable to generate thumbnail
|
||||
if ( $new_thumbnail == null && is_ayvp_importing() ) {
|
||||
global $tern_wp_youtube_array;
|
||||
if ( isset( $tern_wp_youtube_array['_tern_wp_youtube_video'] ) && $tern_wp_youtube_array['_tern_wp_youtube_video'] != '' ) {
|
||||
$new_thumbnail = $video_thumbnails->providers['youtube']->get_thumbnail_url( $tern_wp_youtube_array['_tern_wp_youtube_video'] );
|
||||
}
|
||||
}
|
||||
// When automatic publishing is disabled or rescanning an existing post, use custom field data to generate thumbnail
|
||||
if ( $new_thumbnail == null ) {
|
||||
$youtube_id = get_post_meta( $post_id, '_tern_wp_youtube_video', true );
|
||||
if ( $youtube_id != '' ) {
|
||||
$new_thumbnail = $video_thumbnails->providers['youtube']->get_thumbnail_url( $youtube_id );
|
||||
}
|
||||
}
|
||||
return $new_thumbnail;
|
||||
}
|
||||
|
||||
// Make sure we can use is_plugin_active()
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
|
||||
// If AYVP is active, add filter
|
||||
if ( is_plugin_active( 'automatic-youtube-video-posts/tern_wp_youtube.php' ) ) {
|
||||
add_filter( 'new_video_thumbnail_url', 'ayvp_new_video_thumbnail_url_filter', 10, 2 );
|
||||
remove_filter( 'post_thumbnail_html', 'WP_ayvpp_thumbnail' );
|
||||
remove_filter( 'post_thumbnail_size', 'WP_ayvpp_thumbnail_size' );
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/automatic-youtube-video-posts.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/simple-video-embedder.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/wp-robot.php' );
|
||||
|
||||
?>
|
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
function simple_video_embedder_video_thumbnail_markup_filter( $markup, $post_id ) {
|
||||
if ( function_exists( 'p75HasVideo' ) ) {
|
||||
if ( p75HasVideo( $post_id ) ) {
|
||||
$markup .= ' ' . p75GetVideo( $post_id );
|
||||
}
|
||||
}
|
||||
return $markup;
|
||||
}
|
||||
|
||||
// Add filter to modify markup
|
||||
add_filter( 'video_thumbnail_markup', 'simple_video_embedder_video_thumbnail_markup_filter', 10, 2 );
|
||||
|
||||
?>
|
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
function video_thumbnails_wpr_after_post_action( $post_id ) {
|
||||
// Don't save video thumbnails during autosave or for unpublished posts
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return null;
|
||||
if ( get_post_status( $post_id ) != 'publish' ) return null;
|
||||
// Check that Video Thumbnails are enabled for current post type
|
||||
$post_type = get_post_type( $post_id );
|
||||
global $video_thumbnails;
|
||||
if ( in_array( $post_type, (array) $video_thumbnails->settings->options['post_types'] ) || $post_type == $video_thumbnails->settings->options['post_types'] ) {
|
||||
$video_thumbnails->get_video_thumbnail( $post_id );
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wpr_after_post', 'video_thumbnails_wpr_after_post_action', 10, 1 );
|
||||
|
||||
?>
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Blip_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Blip';
|
||||
const service_name = 'Blip';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'blip';
|
||||
const service_slug = 'blip';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(https?\:\/\/blip\.tv\/[^\r\n\'\"]+)#' // Blip URL
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $url ) {
|
||||
$request = "http://blip.tv/oembed?url=$url";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$json = json_decode( $response['body'] );
|
||||
if ( isset( $json->error ) ) {
|
||||
$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 ) );
|
||||
} else {
|
||||
$result = $json->thumbnail_url;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => 'http://blip.tv/cranetv/illustrator-katie-scott-6617917',
|
||||
'expected' => 'http://a.images.blip.tv/CraneTV-IllustratorKatieScott610.jpg',
|
||||
'expected_hash' => '26a622f72bd4bdb3f8189f85598dd95d',
|
||||
'name' => __( 'Video URL', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://a.images.blip.tv/GeekCrashCourse-TheAvengersMarvelMovieCatchUpGeekCrashCourse331.png',
|
||||
'expected_hash' => '87efa9f6b0d9111b0826ae4fbdddec1b',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class CollegeHumor_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'CollegeHumor';
|
||||
const service_name = 'CollegeHumor';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'collegehumor';
|
||||
const service_slug = 'collegehumor';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#https?://(?:www\.)?collegehumor\.com/(?:video|e)/([0-9]+)#' // URL
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://www.collegehumor.com/oembed.json?url=http%3A%2F%2Fwww.collegehumor.com%2Fvideo%2F$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->thumbnail_url;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
|
||||
'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => 'http://www.collegehumor.com/video/6830834/mitt-romney-style-gangnam-style-parody',
|
||||
'expected' => 'http://2.media.collegehumor.cvcdn.com/62/99/20502ca0d5b2172421002b52f437dcf8-mitt-romney-style-gangnam-style-parody.jpg',
|
||||
'expected_hash' => 'ceac16f6ee1fa5d8707e813226060a15',
|
||||
'name' => __( 'Video URL', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Dailymotion_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Dailymotion';
|
||||
const service_name = 'Dailymotion';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'dailymotion';
|
||||
const service_slug = 'dailymotion';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#<object[^>]+>.+?http://www\.dailymotion\.com/swf/video/([A-Za-z0-9]+).+?</object>#s', // Dailymotion flash
|
||||
'#//www\.dailymotion\.com/embed/video/([A-Za-z0-9]+)#', // Dailymotion iframe
|
||||
'#(?:https?://)?(?:www\.)?dailymotion\.com/video/([A-Za-z0-9]+)#' // Dailymotion URL
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "https://api.dailymotion.com/video/$id?fields=thumbnail_url";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->thumbnail_url;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://s1.dmcdn.net/AMjdy.jpg',
|
||||
'expected_hash' => '077888b97839254892a377f51c06e642',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://s1.dmcdn.net/AMjdy.jpg',
|
||||
'expected_hash' => '077888b97839254892a377f51c06e642',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Facebook_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Facebook';
|
||||
const service_name = 'Facebook';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'facebook';
|
||||
const service_slug = 'facebook';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(?://|\%2F\%2F)(?:www\.)?facebook\.com(?:/|\%2F)(?:[a-zA-Z0-9]+)(?:/|\%2F)videos(?:/|\%2F)([0-9]+)#', // URL Embed
|
||||
'#http://www\.facebook\.com/v/([0-9]+)#', // Flash Embed
|
||||
'#https?://www\.facebook\.com/video/embed\?video_id=([0-9]+)#', // iFrame Embed
|
||||
'#https?://www\.facebook\.com/video\.php\?v=([0-9]+)#'
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = 'https://graph.facebook.com/' . $id . '/picture?redirect=false';
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->data->url;
|
||||
$high_res = str_replace( '_t.jpg', '_b.jpg', $result);
|
||||
if ( $high_res != $result ) {
|
||||
$response = wp_remote_head( $high_res );
|
||||
if ( !is_wp_error( $response ) && $response['response']['code'] == '200' ) {
|
||||
$result = $high_res;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xap1/v/t15.0-10/p160x160/50796_2560034672650_2560032632599_65313_313_b.jpg?oh=e8c767b1efafa6d8a4b672bad7be38d6&oe=55364081&__gda__=1428807476_a4d83140019b11ad602f2ef9960a364e',
|
||||
'expected_hash' => '6b033d8f16dbf273048c5771d32ede64',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<iframe src="https://www.facebook.com/video/embed?video_id=2560032632599" width="960" height="720" frameborder="0"></iframe>',
|
||||
'expected' => 'https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xap1/v/t15.0-10/p160x160/50796_2560034672650_2560032632599_65313_313_b.jpg?oh=e8c767b1efafa6d8a4b672bad7be38d6&oe=55364081&__gda__=1428807476_a4d83140019b11ad602f2ef9960a364e',
|
||||
'expected_hash' => '6b033d8f16dbf273048c5771d32ede64',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, \'script\', \'facebook-jssdk\'));</script><div class="fb-post" data-href="https://www.facebook.com/video.php?v=10150326323406807" data-width="466"><div class="fb-xfbml-parse-ignore"><a href="https://www.facebook.com/video.php?v=10150326323406807">Post</a> by <a href="https://www.facebook.com/PeterJacksonNZ">Peter Jackson</a>.</div></div>',
|
||||
'expected' => 'https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-xfa1/v/t15.0-10/p128x128/244423_10150326375786807_10150326323406807_4366_759_b.jpg?oh=013ce21bb54de51c383071598b269a91&oe=552CD270&__gda__=1428479462_339647870ec32227c391e98000935aec',
|
||||
'expected_hash' => '184d20db21ac8edef9c9cee291be5ee6',
|
||||
'name' => __( 'FBML Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Funnyordie_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Funny or Die';
|
||||
const service_name = 'Funny or Die';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'funnyordie';
|
||||
const service_slug = 'funnyordie';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#http://www\.funnyordie\.com/embed/([A-Za-z0-9]+)#', // Iframe src
|
||||
'#id="ordie_player_([A-Za-z0-9]+)"#' // Flash object
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://www.funnyordie.com/oembed.json?url=http%3A%2F%2Fwww.funnyordie.com%2Fvideos%2F$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->thumbnail_url;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="http://www.funnyordie.com/embed/5325b03b52" width="640" height="400" frameborder="0"></iframe>',
|
||||
'expected' => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
|
||||
'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://t.fod4.com/t/5325b03b52/c480x270_17.jpg',
|
||||
'expected_hash' => '5aafa4a5f27bd4aead574db38a9e8b2b',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Googledrive_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Google Drive';
|
||||
const service_name = 'Google Drive';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'googledrive';
|
||||
const service_slug = 'googledrive';
|
||||
|
||||
public $options_section = array(
|
||||
'description' => '<p><strong>Optional</strong>: Only required if using videos from Google Drive.</p><p><strong>Directions</strong>: Go to the <a href="https://cloud.google.com/console/project">Google Developers Console</a>, create a project, then enable the Drive API. Next go to the credentials section and create a new public API access key. Choose server key, then leave allowed IPs blank and click create. Copy and paste your new API key below.</p>',
|
||||
'fields' => array(
|
||||
'api_key' => array(
|
||||
'name' => 'API Key',
|
||||
'type' => 'text',
|
||||
'description' => ''
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(?:https?:)?//docs\.google\.com/(?:a/[^/]+/)?file/d/([A-Za-z0-9\-_]+)/preview#', // iFrame URL
|
||||
'#(?:https?:)?//video\.google\.com/get_player\?docid=([A-Za-z0-9\-_]+)#', // Flash URL
|
||||
'#<param value="(?:[^"]+)?docid=([A-Za-z0-9\-_]+)(?:[^"]+)?" name="flashvars">#', // Flash (YouTube player)
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
// Get our API key
|
||||
$api_key = ( isset( $this->options['api_key'] ) && $this->options['api_key'] != '' ? $this->options['api_key'] : false );
|
||||
|
||||
if ( $api_key ) {
|
||||
$request = "https://www.googleapis.com/drive/v2/files/$id?fields=thumbnailLink&key=$api_key";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$json = json_decode( $response['body'] );
|
||||
if ( isset( $json->error ) ) {
|
||||
$result = new WP_Error( 'googledrive_info_retrieval', $json->error->message );
|
||||
} else {
|
||||
$result = $json->thumbnailLink;
|
||||
$result = str_replace( '=s220', '=s480', $result );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$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' ) );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="https://docs.google.com/file/d/0B2tG5YeQL99ZUHNja3l6am9jSGM/preview?pli=1" width="640" height="385"></iframe>',
|
||||
'expected' => 'https://lh3.googleusercontent.com/QL3d7Wh7V_qcXnMpXT6bio77RS0veyCZZ0zQbMX6gd-qH7aeIXBkXlcSJVDEyftiiA=s480',
|
||||
'expected_hash' => '3bc674d8d77b342e633ab9e93e345462',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<iframe height="385" src="https://docs.google.com/a/svpanthers.org/file/d/0BxQsabDaO6USYUgxSUJ3T0ZBa3M/preview" width="100%"></iframe>',
|
||||
'expected' => 'https://lh6.googleusercontent.com/WeOdCsaplJ3am25To1uLZiVYkyrilAQ5rxzhjnyyFc5GAF4QeCF1eq3EMpbP7O5dFg=s480',
|
||||
'expected_hash' => 'f120755bbd1d35e381cb84a829ac0dfa',
|
||||
'name' => __( 'iFrame Embed (Apps account)', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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&ps=docs&partnerid=30&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&ps=docs&partnerid=30&cc_load_policy=1" allowFullScreen="true" allowScriptAccess="always" allowfullscreen="true" allowscriptaccess="always" /></object>',
|
||||
'expected' => 'https://lh3.googleusercontent.com/U_lqaX1o7E9iU75XwCrHZ4pdSi-Vch2F_GK5Ib7WAxgwKTvTl0kMHXm2GxKo1Pcp3Q=s480',
|
||||
'expected_hash' => '31cf8e05f981c1beb6e04823ad54d267',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'https://lh5.googleusercontent.com/mHn5gESachhZHi-kbPCRbR6RVXZm3bR7oNNXL97LyYjpzV3Eqty71J2Waw0DPnXKKw=s480',
|
||||
'expected_hash' => '2d0ad4881e4b38de0510a103d2f40dd1',
|
||||
'name' => __( 'Flash Embed (YouTube player)', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Kaltura_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Kaltura';
|
||||
const service_name = 'Kaltura';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'kaltura';
|
||||
const service_slug = 'kaltura';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#http://cdnapi\.kaltura\.com/p/[0-9]+/sp/[0-9]+/embedIframeJs/uiconf_id/[0-9]+/partner_id/[0-9]+\?entry_id=([a-z0-9_]+)#' // Hosted
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://www.kaltura.com/api_v3/?service=thumbAsset&action=getbyentryid&entryId=$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$xml = new SimpleXMLElement( $response['body'] );
|
||||
$result = (string) $xml->result->item->id;
|
||||
$request = "http://www.kaltura.com/api_v3/?service=thumbAsset&action=geturl&id=$result";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$xml = new SimpleXMLElement( $response['body'] );
|
||||
$result = (string) $xml->result;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://example.com/thumbnail.jpg',
|
||||
'name' => __( 'Auto Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2015 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Livestream_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Livestream';
|
||||
const service_name = 'Livestream';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'livestream';
|
||||
const service_slug = 'livestream';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#\/\/cdn\.livestream\.com\/embed\/([A-Za-z0-9_]+)#', // Embed SRC
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$result = 'http://thumbnail.api.livestream.com/thumbnail?name=' . $id;
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe width="560" height="340" src="http://cdn.livestream.com/embed/WFMZ_Traffic?layout=4&height=340&width=560&autoplay=false" style="border:0;outline:0" frameborder="0" scrolling="no"></iframe>',
|
||||
'expected' => 'http://thumbnail.api.livestream.com/thumbnail?name=WFMZ_Traffic',
|
||||
'expected_hash' => '1be02799b2fab7a4749b2187f7687412',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Metacafe_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Metacafe';
|
||||
const service_name = 'Metacafe';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'metacafe';
|
||||
const service_slug = 'metacafe';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#http://www\.metacafe\.com/fplayer/([A-Za-z0-9\-_]+)/#' // Metacafe embed
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://www.metacafe.com/api/item/$id/";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$xml = new SimpleXMLElement( $response['body'] );
|
||||
$result = $xml->xpath( "/rss/channel/item/media:thumbnail/@url" );
|
||||
$result = (string) $result[0]['url'];
|
||||
$result = $this->drop_url_parameters( $result );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://s4.mcstatic.com/thumb/8456223/22479418/4/catalog_item5/0/1/men_in_black_3_trailer_2.jpg',
|
||||
'expected_hash' => '977187bfb00df55b39724d7de284f617',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Mpora_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'MPORA';
|
||||
const service_name = 'MPORA';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'mpora';
|
||||
const service_slug = 'mpora';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#http://(?:video\.|www\.)?mpora\.com/(?:ep|videos)/([A-Za-z0-9]+)#', // Flash or iFrame src
|
||||
'#mporaplayer_([A-Za-z0-9]+)_#' // Object ID
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
return 'http://ugc4.mporatrons.com/thumbs/' . $id . '_640x360_0000.jpg';
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://ugc4.mporatrons.com/thumbs/wEr2CBooV_640x360_0000.jpg',
|
||||
'expected_hash' => '95075bd4941251ebecbab3b436a90c49',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<iframe width="640" height="360" src="http://mpora.com/videos/AAdfegovdop0/embed" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
|
||||
'expected' => 'http://ugc4.mporatrons.com/thumbs/AAdfegovdop0_640x360_0000.jpg',
|
||||
'expected_hash' => '45db22a2ba5ef20163f52ba562b89259',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Rutube_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Rutube';
|
||||
const service_name = 'Rutube';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'rutube';
|
||||
const service_slug = 'rutube';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(?:https?://)?(?:www\.)?rutube\.ru/video/(?:embed/)?([A-Za-z0-9]+)#', // Video link/Embed src
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
if ( strlen( $id ) < 32 ) {
|
||||
$request = "http://rutube.ru/api/oembed/?url=http%3A//rutube.ru/tracks/$id.html&format=json";
|
||||
} else {
|
||||
$request = "http://rutube.ru/api/video/$id/?format=json";
|
||||
}
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->thumbnail_url;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => 'http://rutube.ru/video/ca8607cd4f7ef28516e043dde0068564/',
|
||||
'expected' => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
|
||||
'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
|
||||
'name' => __( 'Video URL', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<iframe width="720" height="405" src="//rutube.ru/video/embed/6608735" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>',
|
||||
'expected' => 'http://pic.rutube.ru/video/3a/c8/3ac8c1ded16501002d20fa3ba3ed3d61.jpg',
|
||||
'expected_hash' => '85ad79c118ee82c7c2a756ba29a96354',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Sapo_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'SAPO';
|
||||
const service_name = 'SAPO';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'sapo';
|
||||
const service_slug = 'sapo';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#videos\.sapo\.pt/([A-Za-z0-9]+)/mov#', // iFrame SRC
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://videos.sapo.pt/$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML( $response['body'] );
|
||||
$metas = $doc->getElementsByTagName( 'meta' );
|
||||
for ( $i = 0; $i < $metas->length; $i++ ) {
|
||||
$meta = $metas->item( $i );
|
||||
if ( $meta->getAttribute( 'property' ) == 'og:image' ) {
|
||||
$og_image = $meta->getAttribute( 'content' );
|
||||
parse_str( parse_url( $og_image, PHP_URL_QUERY ), $image_array );
|
||||
$result = $image_array['pic'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="http://rd3.videos.sapo.pt/playhtml?file=http://rd3.videos.sapo.pt/ddACsFSuDEZZRWfNHTTy/mov/1" frameborder="0" scrolling="no" width="640" height="360" webkitallowfullscreen mozallowfullscreen allowfullscreen ></iframe>',
|
||||
'expected' => 'http://cache02.stormap.sapo.pt/vidstore14/thumbnais/e9/08/37/7038489_l5VMt.jpg',
|
||||
'expected_hash' => 'd8a74c3d4e054263a37abe9ceed782fd',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Ted_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'TED';
|
||||
const service_name = 'TED';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'ted';
|
||||
const service_slug = 'ted';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#//embed(?:\-ssl)?\.ted\.com/talks/(?:lang/[A-Za-z_-]+/)?([A-Za-z0-9_-]+)\.html#', // iFrame SRC
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://www.ted.com/talks/oembed.json?url=http%3A%2F%2Fwww.ted.com%2Ftalks%2F$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = str_replace( '240x180.jpg', '480x360.jpg', $result->thumbnail_url );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="http://embed.ted.com/talks/kitra_cahana_stories_of_the_homeless_and_hidden.html" width="640" height="360" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
|
||||
'expected' => 'http://images.ted.com/images/ted/341053090f8bac8c324c75be3114b673b4355e8a_480x360.jpg?lang=en',
|
||||
'expected_hash' => 'f2a5f6af49e841b4f9c7b95d6ca0372a',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<iframe src="https://embed-ssl.ted.com/talks/lang/fr-ca/shimpei_takahashi_play_this_game_to_come_up_with_original_ideas.html" width="640" height="360" frameborder="0" scrolling="no" allowfullscreen="allowfullscreen"></iframe>',
|
||||
'expected' => 'http://images.ted.com/images/ted/b1f1183311cda4df9e1b65f2b363e0b806bff914_480x360.jpg?lang=en',
|
||||
'expected_hash' => 'ff47c99c9eb95e3d6c4b986b18991f22',
|
||||
'name' => __( 'Custom Language', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,92 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Tudou_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Tudou';
|
||||
const service_name = 'Tudou';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'tudou';
|
||||
const service_slug = 'tudou';
|
||||
|
||||
public $options_section = array(
|
||||
'description' => '<p><strong>Optional</strong>: Only required if using videos from Tudou.</p><p><strong>Directions</strong>: Go to <a href="http://open.tudou.com/">open.tudou.com</a> and create an application, then copy and paste your app key below.</p>',
|
||||
'fields' => array(
|
||||
'app_key' => array(
|
||||
'name' => 'App Key',
|
||||
'type' => 'text',
|
||||
'description' => ''
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#//(?:www\.)?tudou\.com/programs/view/html5embed\.action\?type=(?:[0-9]+)(?:&|&\#038;|&)code=([A-Za-z0-9\-_]+)#', // iFrame SRC
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
// Get our API key
|
||||
$app_key = ( isset( $this->options['app_key'] ) && $this->options['app_key'] != '' ? $this->options['app_key'] : false );
|
||||
|
||||
if ( $app_key ) {
|
||||
$request = "http://api.tudou.com/v6/video/info?app_key=$app_key&format=json&itemCodes=$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
if ( isset( $result->error_info ) ) {
|
||||
$result = new WP_Error( 'tudou_api_error', $result->error_info );
|
||||
} elseif ( !isset( $result->results[0]->bigPicUrl ) ) {
|
||||
$result = new WP_Error( 'tudou_not_found', sprintf( __( 'Unable to retrieve thumbnail for Tudou video with an ID of %s', 'video-thumbnails' ), $id ) );
|
||||
} else {
|
||||
$result = $result->results[0]->bigPicUrl;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$result = new WP_Error( 'tudou_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 Tudou.', 'video-thumbnails' ) );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="http://www.tudou.com/programs/view/html5embed.action?type=1&code=V-TeNdhKVCA&lcode=eNoG-G9OkrQ&resourceId=0_06_05_99" allowtransparency="true" scrolling="no" border="0" frameborder="0" style="width:480px;height:400px;"></iframe>',
|
||||
'expected' => 'http://g3.tdimg.com/83fedbc41cf9055dce9182a0c07da601/w_2.jpg',
|
||||
'expected_hash' => '3a5e656f8c302ae5b23665f22d296ae1',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Twitch_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Twitch';
|
||||
const service_name = 'Twitch';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'twitch';
|
||||
const service_slug = 'twitch';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(?:www\.)?twitch\.tv/(?:[A-Za-z0-9_]+)/c/([0-9]+)#', // Video URL
|
||||
'#<object[^>]+>.+?http://www\.twitch\.tv/widgets/archive_embed_player\.swf.+?chapter_id=([0-9]+).+?</object>#s', // Flash embed
|
||||
'#<object[^>]+>.+?http://www\.twitch\.tv/swflibs/TwitchPlayer\.swf.+?videoId=c([0-9]+).+?</object>#s', // Newer Flash embed
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "https://api.twitch.tv/kraken/videos/c$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->preview;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => 'http://www.twitch.tv/jodenstone/c/5793313',
|
||||
'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-605904705-320x240.jpg',
|
||||
'expected_hash' => '1b2c51fc7380c74d1b2d34751d73e4cb',
|
||||
'name' => __( 'Video URL', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<object bgcolor="#000000" data="http://www.twitch.tv/swflibs/TwitchPlayer.swf" height="378" id="clip_embed_player_flash" type="application/x-shockwave-flash" width="620"><param name="movie" value="http://www.twitch.tv/swflibs/TwitchPlayer.swf" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="allowFullScreen" value="true" /><param name="flashvars" value="channel=jodenstone&auto_play=false&start_volume=25&videoId=c5793313&device_id=bbe9fbac133ab340" /></object>',
|
||||
'expected' => 'http://static-cdn.jtvnw.net/jtv.thumbs/archive-605904705-320x240.jpg',
|
||||
'expected_hash' => '1b2c51fc7380c74d1b2d34751d73e4cb',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
class Video_Thumbnails_Provider {
|
||||
|
||||
public $options = array();
|
||||
|
||||
function __construct() {
|
||||
// If options are defined add the settings section
|
||||
if ( isset( $this->options_section ) ) add_action( 'admin_init', array( &$this, 'initialize_options' ) );
|
||||
// Get current settings for this provider
|
||||
$options = get_option( 'video_thumbnails' );
|
||||
if ( isset( $options['providers'][$this->service_slug] ) ) {
|
||||
$this->options = $options['providers'][$this->service_slug];
|
||||
}
|
||||
}
|
||||
|
||||
function initialize_options() {
|
||||
add_settings_section(
|
||||
$this->service_slug . '_provider_settings_section',
|
||||
$this->service_name . ' Settings',
|
||||
array( &$this, 'settings_section_callback' ),
|
||||
'video_thumbnails_providers'
|
||||
);
|
||||
foreach ( $this->options_section['fields'] as $key => $value ) {
|
||||
add_settings_field(
|
||||
$key,
|
||||
$value['name'],
|
||||
array( &$this, $value['type'] . '_setting_callback' ),
|
||||
'video_thumbnails_providers',
|
||||
$this->service_slug . '_provider_settings_section',
|
||||
array(
|
||||
'slug' => $key,
|
||||
'description' => $value['description']
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function settings_section_callback() {
|
||||
echo $this->options_section['description'];
|
||||
}
|
||||
|
||||
function text_setting_callback( $args ) {
|
||||
$value = ( isset( $this->options[$args['slug']] ) ? $this->options[$args['slug']] : '' );
|
||||
$html = '<input type="text" id="' . $args['slug'] . '" name="video_thumbnails[providers][' . $this->service_slug . '][' . $args['slug'] . ']" value="' . $value . '"/>';
|
||||
$html .= '<label for="' . $args['slug'] . '"> ' . $args['description'] . '</label>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
public function scan_for_thumbnail( $markup ) {
|
||||
foreach ( $this->regexes as $regex ) {
|
||||
if ( preg_match( $regex, $markup, $matches ) ) {
|
||||
return $this->get_thumbnail_url( $matches[1] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function scan_for_videos( $markup ) {
|
||||
$videos = array();
|
||||
foreach ( $this->regexes as $regex ) {
|
||||
if ( preg_match_all( $regex, $markup, $matches, PREG_OFFSET_CAPTURE ) ) {
|
||||
$videos = array_merge( $videos, $matches[1] );
|
||||
}
|
||||
}
|
||||
return $videos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Drops the parameters from a thumbnail URL
|
||||
* @param string $url
|
||||
* @return string
|
||||
*/
|
||||
static function drop_url_parameters( $url ) {
|
||||
$url = explode( '?', $url );
|
||||
return $url[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a WP_Error object after failed API retrieval
|
||||
* @param string $request The URL wp_remote_get() failed to retrieve
|
||||
* @param WP_Error $response A WP_Error object returned by the failed wp_remote_get()
|
||||
* @return WP_Error An error object with a descriptive message including troubleshooting instructions
|
||||
*/
|
||||
function construct_info_retrieval_error( $request, $response ) {
|
||||
$code = $this->service_slug . '_info_retrieval';
|
||||
$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();
|
||||
return new WP_Error( $code, $message );
|
||||
}
|
||||
|
||||
// // Requires PHP 5.3.0+
|
||||
// public static function register_provider( $providers ) {
|
||||
// $providers[] = new static;
|
||||
// return $providers;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,677 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Vimeo_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Vimeo';
|
||||
const service_name = 'Vimeo';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'vimeo';
|
||||
const service_slug = 'vimeo';
|
||||
|
||||
public $options_section = array(
|
||||
'description' => '<p><strong>Optional</strong>: Only required for accessing private videos. <a href="https://developer.vimeo.com/apps">Register an app with Vimeo</a> then fill in the appropriate keys below. Requires cURL to authenticate.</p>',
|
||||
'fields' => array(
|
||||
'client_id' => array(
|
||||
'name' => 'Client ID',
|
||||
'type' => 'text',
|
||||
'description' => ''
|
||||
),
|
||||
'client_secret' => array(
|
||||
'name' => 'Client Secret',
|
||||
'type' => 'text',
|
||||
'description' => ''
|
||||
),
|
||||
'access_token' => array(
|
||||
'name' => 'Access token',
|
||||
'type' => 'text',
|
||||
'description' => ''
|
||||
),
|
||||
'access_token_secret' => array(
|
||||
'name' => 'Access token secret',
|
||||
'type' => 'text',
|
||||
'description' => ''
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#<object[^>]+>.+?http://vimeo\.com/moogaloop.swf\?clip_id=([A-Za-z0-9\-_]+)&.+?</object>#s', // Standard Vimeo embed code
|
||||
'#(?:https?:)?//player\.vimeo\.com/video/([0-9]+)#', // Vimeo iframe player
|
||||
'#\[vimeo id=([A-Za-z0-9\-_]+)]#', // JR_embed shortcode
|
||||
'#\[vimeo clip_id="([A-Za-z0-9\-_]+)"[^>]*]#', // Another shortcode
|
||||
'#\[vimeo video_id="([A-Za-z0-9\-_]+)"[^>]*]#', // Yet another shortcode
|
||||
'#(?:https?://)?(?:www\.)?vimeo\.com/([0-9]+)#', // Vimeo URL
|
||||
'#(?:https?://)?(?:www\.)?vimeo\.com/channels/(?:[A-Za-z0-9]+)/([0-9]+)#' // Channel URL
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
// Get our settings
|
||||
$client_id = ( isset( $this ) && isset( $this->options['client_id'] ) && $this->options['client_id'] != '' ? $this->options['client_id'] : false );
|
||||
$client_secret = ( isset( $this ) && isset( $this->options['client_secret'] ) && $this->options['client_secret'] != '' ? $this->options['client_secret'] : false );
|
||||
$access_token = ( isset( $this ) && isset( $this->options['access_token'] ) && $this->options['access_token'] != '' ? $this->options['access_token'] : false );
|
||||
$access_token_secret = ( isset( $this ) && isset( $this->options['access_token_secret'] ) && $this->options['access_token_secret'] != '' ? $this->options['access_token_secret'] : false );
|
||||
// If API credentials are entered, use the API
|
||||
if ( $client_id && $client_secret && $access_token && $access_token_secret ) {
|
||||
$vimeo = new phpVimeo( $this->options['client_id'], $this->options['client_secret'] );
|
||||
$vimeo->setToken( $this->options['access_token'], $this->options['access_token_secret'] );
|
||||
$response = $vimeo->call('vimeo.videos.getThumbnailUrls', array('video_id'=>$id));
|
||||
$result = $response->thumbnails->thumbnail[count($response->thumbnails->thumbnail)-1]->_content;
|
||||
} else {
|
||||
$request = "http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} elseif ( $response['response']['code'] == 404 ) {
|
||||
$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' ) );
|
||||
} elseif ( $response['response']['code'] == 403 ) {
|
||||
$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' ) );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->thumbnail_url;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="http://player.vimeo.com/video/41504360" width="500" height="281" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>',
|
||||
'expected' => 'http://i.vimeocdn.com/video/287850781_1280.jpg',
|
||||
'expected_hash' => '5388e0d772b827b0837444b636c9676c',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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&force_embed=1&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00adef&fullscreen=1&autoplay=0&loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=41504360&force_embed=1&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00adef&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="500" height="281"></embed></object>',
|
||||
'expected' => 'http://i.vimeocdn.com/video/287850781_1280.jpg',
|
||||
'expected_hash' => '5388e0d772b827b0837444b636c9676c',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => 'https://vimeo.com/channels/soundworkscollection/44520894',
|
||||
'expected' => 'http://i.vimeocdn.com/video/502998892_1280.jpg',
|
||||
'expected_hash' => 'fde254d7ef7b6463cbd2451a99f2ddb1',
|
||||
'name' => __( 'Channel URL', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Vimeo API class
|
||||
if( !class_exists( 'phpVimeo' ) ) :
|
||||
class phpVimeo
|
||||
{
|
||||
const API_REST_URL = 'http://vimeo.com/api/rest/v2';
|
||||
const API_AUTH_URL = 'http://vimeo.com/oauth/authorize';
|
||||
const API_ACCESS_TOKEN_URL = 'http://vimeo.com/oauth/access_token';
|
||||
const API_REQUEST_TOKEN_URL = 'http://vimeo.com/oauth/request_token';
|
||||
|
||||
const CACHE_FILE = 'file';
|
||||
|
||||
private $_consumer_key = false;
|
||||
private $_consumer_secret = false;
|
||||
private $_cache_enabled = false;
|
||||
private $_cache_dir = false;
|
||||
private $_token = false;
|
||||
private $_token_secret = false;
|
||||
private $_upload_md5s = array();
|
||||
|
||||
public function __construct($consumer_key, $consumer_secret, $token = null, $token_secret = null)
|
||||
{
|
||||
$this->_consumer_key = $consumer_key;
|
||||
$this->_consumer_secret = $consumer_secret;
|
||||
|
||||
if ($token && $token_secret) {
|
||||
$this->setToken($token, $token_secret);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache a response.
|
||||
*
|
||||
* @param array $params The parameters for the response.
|
||||
* @param string $response The serialized response data.
|
||||
*/
|
||||
private function _cache($params, $response)
|
||||
{
|
||||
// Remove some unique things
|
||||
unset($params['oauth_nonce']);
|
||||
unset($params['oauth_signature']);
|
||||
unset($params['oauth_timestamp']);
|
||||
|
||||
$hash = md5(serialize($params));
|
||||
|
||||
if ($this->_cache_enabled == self::CACHE_FILE) {
|
||||
$file = $this->_cache_dir.'/'.$hash.'.cache';
|
||||
if (file_exists($file)) {
|
||||
unlink($file);
|
||||
}
|
||||
return file_put_contents($file, $response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the authorization header for a set of params.
|
||||
*
|
||||
* @param array $oauth_params The OAuth parameters for the call.
|
||||
* @return string The OAuth Authorization header.
|
||||
*/
|
||||
private function _generateAuthHeader($oauth_params)
|
||||
{
|
||||
$auth_header = 'Authorization: OAuth realm=""';
|
||||
|
||||
foreach ($oauth_params as $k => $v) {
|
||||
$auth_header .= ','.self::url_encode_rfc3986($k).'="'.self::url_encode_rfc3986($v).'"';
|
||||
}
|
||||
|
||||
return $auth_header;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a nonce for the call.
|
||||
*
|
||||
* @return string The nonce
|
||||
*/
|
||||
private function _generateNonce()
|
||||
{
|
||||
return md5(uniqid(microtime()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the OAuth signature.
|
||||
*
|
||||
* @param array $args The full list of args to generate the signature for.
|
||||
* @param string $request_method The request method, either POST or GET.
|
||||
* @param string $url The base URL to use.
|
||||
* @return string The OAuth signature.
|
||||
*/
|
||||
private function _generateSignature($params, $request_method = 'GET', $url = self::API_REST_URL)
|
||||
{
|
||||
uksort($params, 'strcmp');
|
||||
$params = self::url_encode_rfc3986($params);
|
||||
|
||||
// Make the base string
|
||||
$base_parts = array(
|
||||
strtoupper($request_method),
|
||||
$url,
|
||||
urldecode(http_build_query($params, '', '&'))
|
||||
);
|
||||
$base_parts = self::url_encode_rfc3986($base_parts);
|
||||
$base_string = implode('&', $base_parts);
|
||||
|
||||
// Make the key
|
||||
$key_parts = array(
|
||||
$this->_consumer_secret,
|
||||
($this->_token_secret) ? $this->_token_secret : ''
|
||||
);
|
||||
$key_parts = self::url_encode_rfc3986($key_parts);
|
||||
$key = implode('&', $key_parts);
|
||||
|
||||
// Generate signature
|
||||
return base64_encode(hash_hmac('sha1', $base_string, $key, true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unserialized contents of the cached request.
|
||||
*
|
||||
* @param array $params The full list of api parameters for the request.
|
||||
*/
|
||||
private function _getCached($params)
|
||||
{
|
||||
// Remove some unique things
|
||||
unset($params['oauth_nonce']);
|
||||
unset($params['oauth_signature']);
|
||||
unset($params['oauth_timestamp']);
|
||||
|
||||
$hash = md5(serialize($params));
|
||||
|
||||
if ($this->_cache_enabled == self::CACHE_FILE) {
|
||||
$file = $this->_cache_dir.'/'.$hash.'.cache';
|
||||
if (file_exists($file)) {
|
||||
return unserialize(file_get_contents($file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call an API method.
|
||||
*
|
||||
* @param string $method The method to call.
|
||||
* @param array $call_params The parameters to pass to the method.
|
||||
* @param string $request_method The HTTP request method to use.
|
||||
* @param string $url The base URL to use.
|
||||
* @param boolean $cache Whether or not to cache the response.
|
||||
* @param boolean $use_auth_header Use the OAuth Authorization header to pass the OAuth params.
|
||||
* @return string The response from the method call.
|
||||
*/
|
||||
private function _request($method, $call_params = array(), $request_method = 'GET', $url = self::API_REST_URL, $cache = true, $use_auth_header = true)
|
||||
{
|
||||
// Prepare oauth arguments
|
||||
$oauth_params = array(
|
||||
'oauth_consumer_key' => $this->_consumer_key,
|
||||
'oauth_version' => '1.0',
|
||||
'oauth_signature_method' => 'HMAC-SHA1',
|
||||
'oauth_timestamp' => time(),
|
||||
'oauth_nonce' => $this->_generateNonce()
|
||||
);
|
||||
|
||||
// If we have a token, include it
|
||||
if ($this->_token) {
|
||||
$oauth_params['oauth_token'] = $this->_token;
|
||||
}
|
||||
|
||||
// Regular args
|
||||
$api_params = array('format' => 'php');
|
||||
if (!empty($method)) {
|
||||
$api_params['method'] = $method;
|
||||
}
|
||||
|
||||
// Merge args
|
||||
foreach ($call_params as $k => $v) {
|
||||
if (strpos($k, 'oauth_') === 0) {
|
||||
$oauth_params[$k] = $v;
|
||||
}
|
||||
else if ($call_params[$k] !== null) {
|
||||
$api_params[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate the signature
|
||||
$oauth_params['oauth_signature'] = $this->_generateSignature(array_merge($oauth_params, $api_params), $request_method, $url);
|
||||
|
||||
// Merge all args
|
||||
$all_params = array_merge($oauth_params, $api_params);
|
||||
|
||||
// Returned cached value
|
||||
if ($this->_cache_enabled && ($cache && $response = $this->_getCached($all_params))) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
// Curl options
|
||||
if ($use_auth_header) {
|
||||
$params = $api_params;
|
||||
}
|
||||
else {
|
||||
$params = $all_params;
|
||||
}
|
||||
|
||||
if (strtoupper($request_method) == 'GET') {
|
||||
$curl_url = $url.'?'.http_build_query($params, '', '&');
|
||||
$curl_opts = array(
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 30
|
||||
);
|
||||
}
|
||||
else if (strtoupper($request_method) == 'POST') {
|
||||
$curl_url = $url;
|
||||
$curl_opts = array(
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => http_build_query($params, '', '&')
|
||||
);
|
||||
}
|
||||
|
||||
// Authorization header
|
||||
if ($use_auth_header) {
|
||||
$curl_opts[CURLOPT_HTTPHEADER] = array($this->_generateAuthHeader($oauth_params));
|
||||
}
|
||||
|
||||
// Call the API
|
||||
$curl = curl_init($curl_url);
|
||||
curl_setopt_array($curl, $curl_opts);
|
||||
$response = curl_exec($curl);
|
||||
$curl_info = curl_getinfo($curl);
|
||||
curl_close($curl);
|
||||
|
||||
// Cache the response
|
||||
if ($this->_cache_enabled && $cache) {
|
||||
$this->_cache($all_params, $response);
|
||||
}
|
||||
|
||||
// Return
|
||||
if (!empty($method)) {
|
||||
$response = unserialize($response);
|
||||
if ($response->stat == 'ok') {
|
||||
return $response;
|
||||
}
|
||||
else if ($response->err) {
|
||||
throw new VimeoAPIException($response->err->msg, $response->err->code);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the user to Vimeo to authorize your app.
|
||||
* http://www.vimeo.com/api/docs/oauth
|
||||
*
|
||||
* @param string $perms The level of permissions to request: read, write, or delete.
|
||||
*/
|
||||
public function auth($permission = 'read', $callback_url = 'oob')
|
||||
{
|
||||
$t = $this->getRequestToken($callback_url);
|
||||
$this->setToken($t['oauth_token'], $t['oauth_token_secret'], 'request', true);
|
||||
$url = $this->getAuthorizeUrl($this->_token, $permission);
|
||||
header("Location: {$url}");
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a method.
|
||||
*
|
||||
* @param string $method The name of the method to call.
|
||||
* @param array $params The parameters to pass to the method.
|
||||
* @param string $request_method The HTTP request method to use.
|
||||
* @param string $url The base URL to use.
|
||||
* @param boolean $cache Whether or not to cache the response.
|
||||
* @return array The response from the API method
|
||||
*/
|
||||
public function call($method, $params = array(), $request_method = 'GET', $url = self::API_REST_URL, $cache = true)
|
||||
{
|
||||
$method = (substr($method, 0, 6) != 'vimeo.') ? "vimeo.{$method}" : $method;
|
||||
return $this->_request($method, $params, $request_method, $url, $cache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable the cache.
|
||||
*
|
||||
* @param string $type The type of cache to use (phpVimeo::CACHE_FILE is built in)
|
||||
* @param string $path The path to the cache (the directory for CACHE_FILE)
|
||||
* @param int $expire The amount of time to cache responses (default 10 minutes)
|
||||
*/
|
||||
public function enableCache($type, $path, $expire = 600)
|
||||
{
|
||||
$this->_cache_enabled = $type;
|
||||
if ($this->_cache_enabled == self::CACHE_FILE) {
|
||||
$this->_cache_dir = $path;
|
||||
$files = scandir($this->_cache_dir);
|
||||
foreach ($files as $file) {
|
||||
$last_modified = filemtime($this->_cache_dir.'/'.$file);
|
||||
if (substr($file, -6) == '.cache' && ($last_modified + $expire) < time()) {
|
||||
unlink($this->_cache_dir.'/'.$file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an access token. Make sure to call setToken() with the
|
||||
* request token before calling this function.
|
||||
*
|
||||
* @param string $verifier The OAuth verifier returned from the authorization page or the user.
|
||||
*/
|
||||
public function getAccessToken($verifier)
|
||||
{
|
||||
$access_token = $this->_request(null, array('oauth_verifier' => $verifier), 'GET', self::API_ACCESS_TOKEN_URL, false, true);
|
||||
parse_str($access_token, $parsed);
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the URL of the authorization page.
|
||||
*
|
||||
* @param string $token The request token.
|
||||
* @param string $permission The level of permissions to request: read, write, or delete.
|
||||
* @param string $callback_url The URL to redirect the user back to, or oob for the default.
|
||||
* @return string The Authorization URL.
|
||||
*/
|
||||
public function getAuthorizeUrl($token, $permission = 'read')
|
||||
{
|
||||
return self::API_AUTH_URL."?oauth_token={$token}&permission={$permission}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a request token.
|
||||
*/
|
||||
public function getRequestToken($callback_url = 'oob')
|
||||
{
|
||||
$request_token = $this->_request(
|
||||
null,
|
||||
array('oauth_callback' => $callback_url),
|
||||
'GET',
|
||||
self::API_REQUEST_TOKEN_URL,
|
||||
false,
|
||||
false
|
||||
);
|
||||
|
||||
parse_str($request_token, $parsed);
|
||||
return $parsed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the stored auth token.
|
||||
*
|
||||
* @return array An array with the token and token secret.
|
||||
*/
|
||||
public function getToken()
|
||||
{
|
||||
return array($this->_token, $this->_token_secret);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the OAuth token.
|
||||
*
|
||||
* @param string $token The OAuth token
|
||||
* @param string $token_secret The OAuth token secret
|
||||
* @param string $type The type of token, either request or access
|
||||
* @param boolean $session_store Store the token in a session variable
|
||||
* @return boolean true
|
||||
*/
|
||||
public function setToken($token, $token_secret, $type = 'access', $session_store = false)
|
||||
{
|
||||
$this->_token = $token;
|
||||
$this->_token_secret = $token_secret;
|
||||
|
||||
if ($session_store) {
|
||||
$_SESSION["{$type}_token"] = $token;
|
||||
$_SESSION["{$type}_token_secret"] = $token_secret;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a video in one piece.
|
||||
*
|
||||
* @param string $file_path The full path to the file
|
||||
* @param boolean $use_multiple_chunks Whether or not to split the file up into smaller chunks
|
||||
* @param string $chunk_temp_dir The directory to store the chunks in
|
||||
* @param int $size The size of each chunk in bytes (defaults to 2MB)
|
||||
* @return int The video ID
|
||||
*/
|
||||
public function upload($file_path, $use_multiple_chunks = false, $chunk_temp_dir = '.', $size = 2097152, $replace_id = null)
|
||||
{
|
||||
if (!file_exists($file_path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Figure out the filename and full size
|
||||
$path_parts = pathinfo($file_path);
|
||||
$file_name = $path_parts['basename'];
|
||||
$file_size = filesize($file_path);
|
||||
|
||||
// Make sure we have enough room left in the user's quota
|
||||
$quota = $this->call('vimeo.videos.upload.getQuota');
|
||||
if ($quota->user->upload_space->free < $file_size) {
|
||||
throw new VimeoAPIException('The file is larger than the user\'s remaining quota.', 707);
|
||||
}
|
||||
|
||||
// Get an upload ticket
|
||||
$params = array();
|
||||
|
||||
if ($replace_id) {
|
||||
$params['video_id'] = $replace_id;
|
||||
}
|
||||
|
||||
$rsp = $this->call('vimeo.videos.upload.getTicket', $params, 'GET', self::API_REST_URL, false);
|
||||
$ticket = $rsp->ticket->id;
|
||||
$endpoint = $rsp->ticket->endpoint;
|
||||
|
||||
// Make sure we're allowed to upload this size file
|
||||
if ($file_size > $rsp->ticket->max_file_size) {
|
||||
throw new VimeoAPIException('File exceeds maximum allowed size.', 710);
|
||||
}
|
||||
|
||||
// Split up the file if using multiple pieces
|
||||
$chunks = array();
|
||||
if ($use_multiple_chunks) {
|
||||
if (!is_writeable($chunk_temp_dir)) {
|
||||
throw new Exception('Could not write chunks. Make sure the specified folder has write access.');
|
||||
}
|
||||
|
||||
// Create pieces
|
||||
$number_of_chunks = ceil(filesize($file_path) / $size);
|
||||
for ($i = 0; $i < $number_of_chunks; $i++) {
|
||||
$chunk_file_name = "{$chunk_temp_dir}/{$file_name}.{$i}";
|
||||
|
||||
// Break it up
|
||||
$chunk = file_get_contents($file_path, FILE_BINARY, null, $i * $size, $size);
|
||||
$file = file_put_contents($chunk_file_name, $chunk);
|
||||
|
||||
$chunks[] = array(
|
||||
'file' => realpath($chunk_file_name),
|
||||
'size' => filesize($chunk_file_name)
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$chunks[] = array(
|
||||
'file' => realpath($file_path),
|
||||
'size' => filesize($file_path)
|
||||
);
|
||||
}
|
||||
|
||||
// Upload each piece
|
||||
foreach ($chunks as $i => $chunk) {
|
||||
$params = array(
|
||||
'oauth_consumer_key' => $this->_consumer_key,
|
||||
'oauth_token' => $this->_token,
|
||||
'oauth_signature_method' => 'HMAC-SHA1',
|
||||
'oauth_timestamp' => time(),
|
||||
'oauth_nonce' => $this->_generateNonce(),
|
||||
'oauth_version' => '1.0',
|
||||
'ticket_id' => $ticket,
|
||||
'chunk_id' => $i
|
||||
);
|
||||
|
||||
// Generate the OAuth signature
|
||||
$params = array_merge($params, array(
|
||||
'oauth_signature' => $this->_generateSignature($params, 'POST', self::API_REST_URL),
|
||||
'file_data' => '@'.$chunk['file'] // don't include the file in the signature
|
||||
));
|
||||
|
||||
// Post the file
|
||||
$curl = curl_init($endpoint);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $params);
|
||||
$rsp = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
// Verify
|
||||
$verify = $this->call('vimeo.videos.upload.verifyChunks', array('ticket_id' => $ticket));
|
||||
|
||||
// Make sure our file sizes match up
|
||||
foreach ($verify->ticket->chunks as $chunk_check) {
|
||||
$chunk = $chunks[$chunk_check->id];
|
||||
|
||||
if ($chunk['size'] != $chunk_check->size) {
|
||||
// size incorrect, uh oh
|
||||
echo "Chunk {$chunk_check->id} is actually {$chunk['size']} but uploaded as {$chunk_check->size}<br>";
|
||||
}
|
||||
}
|
||||
|
||||
// Complete the upload
|
||||
$complete = $this->call('vimeo.videos.upload.complete', array(
|
||||
'filename' => $file_name,
|
||||
'ticket_id' => $ticket
|
||||
));
|
||||
|
||||
// Clean up
|
||||
if (count($chunks) > 1) {
|
||||
foreach ($chunks as $chunk) {
|
||||
unlink($chunk['file']);
|
||||
}
|
||||
}
|
||||
|
||||
// Confirmation successful, return video id
|
||||
if ($complete->stat == 'ok') {
|
||||
return $complete->ticket->video_id;
|
||||
}
|
||||
else if ($complete->err) {
|
||||
throw new VimeoAPIException($complete->err->msg, $complete->err->code);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a video in multiple pieces.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public function uploadMulti($file_name, $size = 1048576)
|
||||
{
|
||||
// for compatibility with old library
|
||||
return $this->upload($file_name, true, '.', $size);
|
||||
}
|
||||
|
||||
/**
|
||||
* URL encode a parameter or array of parameters.
|
||||
*
|
||||
* @param array/string $input A parameter or set of parameters to encode.
|
||||
*/
|
||||
public static function url_encode_rfc3986($input)
|
||||
{
|
||||
if (is_array($input)) {
|
||||
return array_map(array('phpVimeo', 'url_encode_rfc3986'), $input);
|
||||
}
|
||||
else if (is_scalar($input)) {
|
||||
return str_replace(array('+', '%7E'), array(' ', '~'), rawurlencode($input));
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
if( !class_exists( 'VimeoAPIException' ) ) {
|
||||
class VimeoAPIException extends Exception {}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Vine_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Vine';
|
||||
const service_name = 'Vine';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'vine';
|
||||
const service_slug = 'vine';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(?:www\.)?vine\.co/v/([A-Za-z0-9_]+)#', // URL
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "https://vine.co/v/$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML( $response['body'] );
|
||||
$metas = $doc->getElementsByTagName( 'meta' );
|
||||
for ( $i = 0; $i < $metas->length; $i++ ) {
|
||||
$meta = $metas->item( $i );
|
||||
if ( $meta->getAttribute( 'property' ) == 'og:image' ) {
|
||||
$result = $meta->getAttribute( 'content' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'https://v.cdn.vine.co/v/thumbs/D6DDE013-F8DA-4929-9BED-49568F424343-184-00000008A20C1AEC_1.0.6.mp4.jpg',
|
||||
'expected_hash' => '7cca5921108abe15b8c1c1f884a5b3ac',
|
||||
'name' => __( 'iFrame Embed/Video URL', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Vk_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'VK';
|
||||
const service_name = 'VK';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'vk';
|
||||
const service_slug = 'vk';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(//(?:www\.)?vk\.com/video_ext\.php\?oid=\-?[0-9]+(?:&|&\#038;|&)id=\-?[0-9]+(?:&|&\#038;|&)hash=[0-9a-zA-Z]+)#', // URL
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http:$id";
|
||||
$request = html_entity_decode( $request );
|
||||
$response = wp_remote_get( $request );
|
||||
$result = false;
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$doc = new DOMDocument();
|
||||
@$doc->loadHTML( $response['body'] );
|
||||
$metas = $doc->getElementsByTagName( 'img' );
|
||||
for ( $i = 0; $i < $metas->length; $i++ ) {
|
||||
$meta = $metas->item( $i );
|
||||
if ( $meta->getAttribute( 'id' ) == 'player_thumb' ) {
|
||||
$result = $meta->getAttribute( 'src' );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe src="http://vk.com/video_ext.php?oid=220943440&id=168591360&hash=75a37bd3930f4fab&hd=1" width="607" height="360" frameborder="0"></iframe>',
|
||||
'expected' => 'http://cs540302.vk.me/u220943440/video/l_afc9770f.jpg',
|
||||
'expected_hash' => 'fd8c2af4ad5cd4e55afe129d80b42d8b',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Wistia_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Wistia';
|
||||
const service_name = 'Wistia';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'wistia';
|
||||
const service_slug = 'wistia';
|
||||
|
||||
// public $options_section = array(
|
||||
// 'description' => '<p><strong>Optional</strong>: Only required if you have a CNAME record set up to use a custom domain.</p>',
|
||||
// 'fields' => array(
|
||||
// 'domain' => array(
|
||||
// 'name' => 'Custom Wistia Domain',
|
||||
// 'type' => 'text',
|
||||
// 'description' => 'Enter the domain corresponding to your CNAME record for Wistia. Ex: videos.example.com'
|
||||
// )
|
||||
// )
|
||||
// );
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#Wistia\.embed\("([0-9a-zA-Z]+)"#', // JavaScript API embedding
|
||||
'#(https?://(?:.+)?(?:wistia\.com|wistia\.net|wi\.st)/(?:medias|embed)/(?:[\+~%\/\.\w\-]*))#', // Embed URL
|
||||
'#(https://wistia\.sslcs\.cdngc\.net/deliveries/[0-9a-zA-Z]+\.jpg)#' // Thumbnail image
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
|
||||
// ID is an image URL, return it
|
||||
if ( substr( $id, -4 ) == '.jpg' ) return $id;
|
||||
|
||||
// ID is actually an ID, convert it to a URL
|
||||
if ( substr( $id, 0, 4 ) != 'http' ) $id = 'http://fast.wistia.net/embed/iframe/' . $id;
|
||||
|
||||
// ID should now be an embed URL, use oEmbed to find thumbnail URL
|
||||
$id = urlencode( $id );
|
||||
$request = "http://fast.wistia.com/oembed?url=$id";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $this->drop_url_parameters( $result->thumbnail_url );
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'https://embed-ssl.wistia.com/deliveries/6928fcba8355e38de4d95863a659e1de23cb2071.jpg',
|
||||
'expected_hash' => 'bc4a2cec9ac97e2ccdae2c7387a01cb4',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'https://embed-ssl.wistia.com/deliveries/a086707fe096e7f3fbefef1d1dcba1488d23a3e9.jpg',
|
||||
'expected_hash' => '4c63d131604bfc07b5178413ab245813',
|
||||
'name' => __( 'JavaScript Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2015 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Yahooscreen_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Yahoo Screen';
|
||||
const service_name = 'Yahoo Screen';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'yahooscreen';
|
||||
const service_slug = 'yahooscreen';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(\/\/screen\.yahoo\.com\/[^.]+\.html)#' // iFrame SRC
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $url ) {
|
||||
$request = "http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20html%20WHERE%20url%3D%22" . urlencode( 'http:' . $url ) . "%22%20AND%20xpath%3D%22%2F%2Fmeta%5B%40property%3D'og%3Aimage'%5D%22%20and%20compat%3D%22html5%22&format=json&callback=";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$json = json_decode( $response['body'] );
|
||||
if ( empty( $json->query->results ) ) {
|
||||
$result = new WP_Error( 'yahooscreen_invalid_url', sprintf( __( 'Error retrieving video information for <a href="http:%1$s">http:%1$s</a>. Check to be sure this is a valid Yahoo Screen URL.', 'video-thumbnails' ), $url ) );
|
||||
} else {
|
||||
$result = $json->query->results->meta->content;
|
||||
$result_array = explode( 'http://', $result );
|
||||
if ( count( $result_array ) > 1 ) {
|
||||
$result = 'http://' . $result_array[count( $result_array )-1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe width="640" height="360" scrolling="no" frameborder="0" src="https://screen.yahoo.com/first-u-bitcoin-exchange-opens-140857495.html?format=embed" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true" allowtransparency="true"></iframe>',
|
||||
'expected' => 'http://media.zenfs.com/en-US/video/video.abcnewsplus.com/7c70071008e3711818517f19b6ad9629',
|
||||
'expected_hash' => '22c2b172b297cf09511d832ddab7b9f5',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Youku_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'Youku';
|
||||
const service_name = 'Youku';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'youku';
|
||||
const service_slug = 'youku';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#http://player\.youku\.com/embed/([A-Za-z0-9]+)#', // iFrame
|
||||
'#http://player\.youku\.com/player\.php/sid/([A-Za-z0-9]+)/v\.swf#', // Flash
|
||||
'#http://v\.youku\.com/v_show/id_([A-Za-z0-9]+)\.html#' // Link
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$request = "http://v.youku.com/player/getPlayList/VideoIDS/$id/";
|
||||
$response = wp_remote_get( $request );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$result = $this->construct_info_retrieval_error( $request, $response );
|
||||
} else {
|
||||
$result = json_decode( $response['body'] );
|
||||
$result = $result->data[0]->logo;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe height=498 width=510 src="http://player.youku.com/embed/XMzQyMzk5MzQ4" frameborder=0 allowfullscreen></iframe>',
|
||||
'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
|
||||
'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
|
||||
'name' => __( 'iFrame Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'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>',
|
||||
'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
|
||||
'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
|
||||
'name' => __( 'Flash Embed', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => 'http://v.youku.com/v_show/id_XMzQyMzk5MzQ4.html',
|
||||
'expected' => 'http://g1.ykimg.com/1100641F464F0FB57407E2053DFCBC802FBBC4-E4C5-7A58-0394-26C366F10493',
|
||||
'expected_hash' => 'deac7bb89058a8c46ae2350da9d33ba8',
|
||||
'name' => __( 'Video URL', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Require thumbnail provider class
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-video-thumbnails-provider.php' );
|
||||
|
||||
class Youtube_Thumbnails extends Video_Thumbnails_Provider {
|
||||
|
||||
// Human-readable name of the video provider
|
||||
public $service_name = 'YouTube';
|
||||
const service_name = 'YouTube';
|
||||
// Slug for the video provider
|
||||
public $service_slug = 'youtube';
|
||||
const service_slug = 'youtube';
|
||||
|
||||
public static function register_provider( $providers ) {
|
||||
$providers[self::service_slug] = new self;
|
||||
return $providers;
|
||||
}
|
||||
|
||||
// Regex strings
|
||||
public $regexes = array(
|
||||
'#(?:https?:)?//www\.youtube(?:\-nocookie)?\.com/(?:v|e|embed)/([A-Za-z0-9\-_]+)#', // Comprehensive search for both iFrame and old school embeds
|
||||
'#(?:https?(?:a|vh?)?://)?(?:www\.)?youtube(?:\-nocookie)?\.com/watch\?.*v=([A-Za-z0-9\-_]+)#', // Any YouTube URL. After http(s) support a or v for Youtube Lyte and v or vh for Smart Youtube plugin
|
||||
'#(?:https?(?:a|vh?)?://)?youtu\.be/([A-Za-z0-9\-_]+)#', // Any shortened youtu.be URL. After http(s) a or v for Youtube Lyte and v or vh for Smart Youtube plugin
|
||||
'#<div class="lyte" id="([A-Za-z0-9\-_]+)"#', // YouTube Lyte
|
||||
'#data-youtube-id="([A-Za-z0-9\-_]+)"#' // LazyYT.js
|
||||
);
|
||||
|
||||
// Thumbnail URL
|
||||
public function get_thumbnail_url( $id ) {
|
||||
$maxres = 'http://img.youtube.com/vi/' . $id . '/maxresdefault.jpg';
|
||||
$response = wp_remote_head( $maxres );
|
||||
if ( !is_wp_error( $response ) && $response['response']['code'] == '200' ) {
|
||||
$result = $maxres;
|
||||
} else {
|
||||
$result = 'http://img.youtube.com/vi/' . $id . '/0.jpg';
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Test cases
|
||||
public static function get_test_cases() {
|
||||
return array(
|
||||
array(
|
||||
'markup' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/Fp0U2Vglkjw" frameborder="0" allowfullscreen></iframe>',
|
||||
'expected' => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
|
||||
'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
|
||||
'name' => __( 'iFrame Embed HD', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/Fp0U2Vglkjw?version=3&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&hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
|
||||
'expected' => 'http://img.youtube.com/vi/Fp0U2Vglkjw/maxresdefault.jpg',
|
||||
'expected_hash' => 'c66256332969c38790c2b9f26f725e7a',
|
||||
'name' => __( 'Flash Embed HD', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<iframe width="560" height="315" src="http://www.youtube.com/embed/vv_AitYPjtc" frameborder="0" allowfullscreen></iframe>',
|
||||
'expected' => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
|
||||
'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
|
||||
'name' => __( 'iFrame Embed SD', 'video-thumbnails' )
|
||||
),
|
||||
array(
|
||||
'markup' => '<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/vv_AitYPjtc?version=3&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&hl=en_US" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>',
|
||||
'expected' => 'http://img.youtube.com/vi/vv_AitYPjtc/0.jpg',
|
||||
'expected_hash' => '6c00b9ab335a6ea00b0fb964c39a6dc9',
|
||||
'name' => __( 'Flash Embed SD', 'video-thumbnails' )
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/* Copyright 2014 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Include provider classes
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-youtube-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-vimeo-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-facebook-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-vine-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-blip-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-dailymotion-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-metacafe-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-vk-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-funnyordie-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-mpora-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-wistia-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-youku-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-tudou-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-collegehumor-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-rutube-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-sapo-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-ted-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-twitch-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-googledrive-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-yahooscreen-thumbnails.php' );
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-livestream-thumbnails.php' );
|
||||
// require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/class-kaltura-thumbnails.php' );
|
||||
|
||||
// Register providers
|
||||
add_filter( 'video_thumbnail_providers', array( 'Youtube_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Vimeo_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Facebook_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Vine_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Blip_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Dailymotion_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Metacafe_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Vk_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Funnyordie_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Mpora_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Wistia_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Youku_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Tudou_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Collegehumor_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Rutube_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Sapo_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Ted_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Twitch_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Googledrive_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Yahooscreen_Thumbnails', 'register_provider' ) );
|
||||
add_filter( 'video_thumbnail_providers', array( 'Livestream_Thumbnails', 'register_provider' ) );
|
||||
// add_filter( 'video_thumbnail_providers', array( 'Kaltura_Thumbnails', 'register_provider' ) );
|
||||
|
||||
?>
|
498
hamrokhaanpaan/wp-content/plugins/video-thumbnails/readme.txt
Normal file
498
hamrokhaanpaan/wp-content/plugins/video-thumbnails/readme.txt
Normal file
@ -0,0 +1,498 @@
|
||||
=== Video Thumbnails ===
|
||||
Contributors: sutherlandboswell
|
||||
Donate link: http://wie.ly/u/donate
|
||||
Tags: Video, Thumbnails, YouTube, Vimeo, Vine, Twitch, Dailymotion, Youku, Rutube, Featured Image
|
||||
Requires at least: 3.2
|
||||
Tested up to: 4.5
|
||||
Stable tag: 2.12.3
|
||||
|
||||
Video Thumbnails simplifies the process of automatically displaying video thumbnails in your WordPress template.
|
||||
|
||||
== Description ==
|
||||
|
||||
Video Thumbnails makes it easy to automatically display video thumbnails in your template. When you publish a post, this plugin will find the first video embedded and retrieve a thumbnail for you. Thumbnails can be saved to your media library and set as a featured image automatically. There's even support for custom post types and custom fields!
|
||||
|
||||
**Version 3.0** is on the way soon!
|
||||
|
||||
= Video Thumbnails Pro =
|
||||
|
||||
[Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) adds new options like maximum image sizes, widescreen cropping, more powerful bulk scanning, a customizable upload directory, and more!
|
||||
|
||||
= Supported Sites =
|
||||
|
||||
* YouTube
|
||||
* Vimeo
|
||||
* Facebook
|
||||
* Vine
|
||||
* Twitch
|
||||
* Dailymotion
|
||||
* Metacafe
|
||||
* TED
|
||||
* VK
|
||||
* Blip
|
||||
* Google Drive
|
||||
* Funny or Die
|
||||
* CollegeHumor
|
||||
* MPORA
|
||||
* Livestream
|
||||
* Yahoo Screen
|
||||
* Wistia
|
||||
* Youku
|
||||
* Tudou
|
||||
* SAPO
|
||||
* Rutube
|
||||
|
||||
Video Thumbnails even works with most video plugins, including:
|
||||
|
||||
* [Refactored Video Importer](https://refactored.co/plugins/video-importer)
|
||||
* Viper's Video Quicktags
|
||||
|
||||
= Help Translate =
|
||||
|
||||
[Register on our translation site](http://translate.refactored.co/blog/) to help bring Video Thumbnails to more languages.
|
||||
|
||||
= Our Other Plugins =
|
||||
|
||||
[Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails) | [Video Importer](https://refactored.co/plugins/video-importer) | [Retinamatic](http://retinamatic.com/)
|
||||
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Upload the `/video-thumbnails/` directory to the `/wp-content/plugins/` directory
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress
|
||||
|
||||
Some functions are available to advanced users who want to customize their theme:
|
||||
|
||||
* `<?php video_thumbnail(); ?>` will echo a thumbnail URL or the default image located at `wp-content/plugins/video-thumbnails/default.jpg` if a thumbnail cannot be found. Here is an example: `<img src="<?php video_thumbnail(); ?>" width="300" />`
|
||||
* `<?php $video_thumbnail = get_video_thumbnail(); ?>` will return the thumbnail URL or return NULL if none is found. In this example, a thumbnail is only shown if one is found: `<?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>`
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
= No video thumbnail for this post =
|
||||
|
||||
1. Ensure you have saved any changes to your post.
|
||||
1. 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 settings page. 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.
|
||||
1. Copy and paste your embed code into the "Test Markup for Video" section of the Debugging page. 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 settings page if you are using a a plugin or theme that stores videos in a special location.
|
||||
1. Go to the Debugging page and click "Test Image Downloading" to test your server's ability to save an image from a video source.
|
||||
1. Try posting a video from other sources to help narrow down the problem.
|
||||
1. Check the support threads to see if anyone has had the same issue.
|
||||
1. If you are still unable to resolve the problem, start a thread with a good descriptive title ("Error" or "No thumbnails" is a bad title) and be sure to include the results of your testing as well. Also be sure to include the name of your theme, any video plugins you're using, and any other details you can think of.
|
||||
|
||||
= Why are there black bars on some YouTube thumbnails? =
|
||||
|
||||
Video Thumbnails uses high-resolution widescreen thumbnails whenever they are available. If a video is not in HD, a fullscreen thumbnail is used. This can result in letterboxing when the video is actually widescreen. Users of the [pro version](https://refactored.co/plugins/video-thumbnails) can select an aspect ratio in the settings if this is a constant problem. [More info](https://refactored.co/blog/remove-black-bars-youtube-thumbnails).
|
||||
|
||||
= Can I get thumbnails from a specific time? =
|
||||
|
||||
No, Video Thumbnails only uses thumbnails provided by the source. If you're posting videos from your own account, many providers allow you to choose the thumbnail.
|
||||
|
||||
= Can it get thumbnails for my self-hosted videos? =
|
||||
|
||||
No, it will only fetch thumbnails for videos from the list of supported sites. Decoding local video files to create thumbnails would require server resources and packages unavailable to most users, so we only focus on supporting major video sites.
|
||||
|
||||
= My theme isn't showing thumbnails, what's wrong? =
|
||||
|
||||
The most likely problem is that your theme doesn't support post thumbnails. If thumbnails are supported, you should see a box titled "Featured Image" on the edit post page. If thumbnails aren't supported, your theme will have to be modified to support Featured Images or to support one of our custom functions.
|
||||
|
||||
= How can I use Video Thumbnails if I use a custom field to store the video? =
|
||||
|
||||
On the Video Thumbnails settings page just enter the name of the custom field and the plugin will scan it.
|
||||
|
||||
= Can I use the functions outside of a loop? =
|
||||
|
||||
Yes, but be sure to include the post ID as a parameter. For example: `<?php $thumbnail = get_video_thumbnail(25); ?>`
|
||||
|
||||
= My video service/embedding plugin isn't included, can you add it? =
|
||||
|
||||
If the service allows a way to retrieve thumbnails, I'll do my best to add it.
|
||||
|
||||
= How do I use this plugin with custom post types? =
|
||||
|
||||
The settings page includes a checklist of all your post types so you can pick and choose.
|
||||
|
||||
= I am editing my theme and only want to display a thumbnail if one is found. How do I do this? =
|
||||
|
||||
`<?php if( ( $video_thumbnail = get_video_thumbnail() ) != null ) { echo "<img src='" . $video_thumbnail . "' />"; } ?>` will only display a thumbnail when one exists, but I recommend using the Featured Image setting and [the_post_thumbnail](http://codex.wordpress.org/Function_Reference/the_post_thumbnail) template tag.
|
||||
|
||||
= I edited my theme and now I'm getting huge thumbnails, how can I resize them? =
|
||||
|
||||
The best solution is to use the Featured Image setting and [the_post_thumbnail](http://codex.wordpress.org/Function_Reference/the_post_thumbnail) template tag.
|
||||
|
||||
As an alternative you could assign a class to the element and style it with CSS.
|
||||
|
||||
= I edited my theme and now I'm seeing the thumbnail and the video, how do I only display the thumbnail? =
|
||||
|
||||
Every theme is different, so this can be tricky if you aren't familiar with WordPress theme development. You need to edit your template in the appropriate place, replacing `<?php the_content(); >` with `<?php the_excerpt(); >` so that only an excerpt of the post is shown on the home page or wherever you would like to display the video thumbnail.
|
||||
|
||||
= Why did it stop finding thumbnails for Vimeo? =
|
||||
|
||||
The Vimeo API has a rate limit, so in rare cases you may exceed this limit. Try again after a few hours.
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. The Video Thumbnail meta box on the Edit Post page
|
||||
1. Settings page
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 2.12.3 =
|
||||
* Fixed HTML bug
|
||||
|
||||
= 2.12.2 =
|
||||
* Added support for new Facebook embed code
|
||||
* Documentation prep for release of version 3.0
|
||||
|
||||
= 2.12.1 =
|
||||
* Support for TED when using foreign languages
|
||||
|
||||
= 2.12 =
|
||||
* Added support for Yahoo Screen
|
||||
|
||||
= 2.11 =
|
||||
* Added support for Livestream
|
||||
* Support for latest TED embed code
|
||||
|
||||
= 2.10.3 =
|
||||
* Various updates to providers
|
||||
* Removed "sslverify" => false in wp_remote_get() (may cause errors on WordPress versions before 3.7)
|
||||
* Better error messages for Google Drive
|
||||
|
||||
= 2.10.2 =
|
||||
* Added actions hooks before and after generating attachment metadata
|
||||
|
||||
= 2.10.1 =
|
||||
* Removed Justin.tv due to their shutdown
|
||||
|
||||
= 2.10 =
|
||||
* Improved debugging page
|
||||
|
||||
= 2.9.1 =
|
||||
* Improved provider class extensibility
|
||||
|
||||
= 2.9 =
|
||||
* Added Tudou support
|
||||
* Added SAPO support
|
||||
* Updated Justin.tv to support the live player now that archives are being removed
|
||||
|
||||
= 2.8 =
|
||||
* Added support for TED Talks
|
||||
* Improved error handling for AJAX on settings page
|
||||
|
||||
= 2.7.9 =
|
||||
* Better compatibility with image plugins
|
||||
* Better Rutube support
|
||||
* Fixed bug that prevented API retrieval error messages
|
||||
|
||||
= 2.7.8 =
|
||||
* Improved Facebook detection
|
||||
* Higher resolution Facebook thumbnails (when available)
|
||||
|
||||
= 2.7.7 =
|
||||
* Improved error handling
|
||||
* Fixed bugs
|
||||
* Updated German translation
|
||||
|
||||
= 2.7.6 =
|
||||
* Added Dailymotion support for protocol-relative embeds
|
||||
|
||||
= 2.7.5 =
|
||||
* Better support for WP Robot
|
||||
* Fixed bug related to Automatic YouTube Video Posts
|
||||
* Reorganized video thumbnail extensions
|
||||
|
||||
= 2.7.4 =
|
||||
* Improved VK detection
|
||||
* Added German translation (thanks [applewerbung](http://wordpress.org/support/profile/applewerbung))
|
||||
* Improved provider and markup tests by applying "the_content" filter
|
||||
* Improved permissions checks for debugging
|
||||
|
||||
= 2.7.3 =
|
||||
* Improved image download test
|
||||
* Updated Vimeo and VK tests
|
||||
|
||||
= 2.7.2 =
|
||||
* Added support for Youku iFrame embed code
|
||||
* Fixed Vimeo channel URL test
|
||||
|
||||
= 2.7.1 =
|
||||
* Fixed load_plugin_textdomain() path
|
||||
|
||||
= 2.7 =
|
||||
* Video Thumbnails is now translation ready and looking for volunteers
|
||||
|
||||
= 2.6.3 =
|
||||
* Better Google Drive detection (added support for underscores or dashes in the ID)
|
||||
|
||||
= 2.6.2 =
|
||||
* Added feature to settings page that automatically detects the custom field
|
||||
* Switched to JSON for Vimeo's oEmbed endpoint
|
||||
* Added support for the "image/gif" MIME type
|
||||
|
||||
= 2.6.1 =
|
||||
* Fixed VK bug caused by IDs with a negative int
|
||||
|
||||
= 2.6 =
|
||||
* Added support for VK iFrame embeds
|
||||
* Minor bugfixes and improvements
|
||||
|
||||
= 2.5.3 =
|
||||
* Fixed bug with Automatic YouTube Video Posts when automatic publishing is disabled or when rescanning existing posts
|
||||
* Fixed bug with bulk scanner when 0 posts are queued
|
||||
* Improved markup test by checking if server can reach the resulting thumbnail URL
|
||||
|
||||
= 2.5.2 =
|
||||
* Better support for Automatic YouTube Video Posts
|
||||
* Added support tab to settings page
|
||||
|
||||
= 2.5.1 =
|
||||
* Fixed improper error handling
|
||||
|
||||
= 2.5 =
|
||||
* Added support for [Video Thumbnails Pro](https://refactored.co/plugins/video-thumbnails), our new solution for power users and professional bloggers
|
||||
* Various bugfixes and improvements
|
||||
|
||||
= 2.4.2 =
|
||||
* Fixed bug with image download test
|
||||
|
||||
= 2.4.1 =
|
||||
* Added support for YouTube videos using LazyYT.js
|
||||
* Better Google Drive support
|
||||
* Filenames now have non-latin characters removed and use the post ID as a fallback
|
||||
* Fixed bug caused by internal server error during bulk scans
|
||||
* Improved performance of provider tests
|
||||
|
||||
= 2.4 =
|
||||
* Added support for Vine
|
||||
* Added support for Google Drive videos
|
||||
* Rewritten bulk video thumbnail scanner
|
||||
* Added troubleshooting link in meta box when no video thumbnail is found
|
||||
* Changed provider test to compare file hashes in case thumbnail URLs change
|
||||
|
||||
= 2.3 =
|
||||
* Added support for archived Twitch videos
|
||||
* Fixed issue with Funny or Die thumbnails
|
||||
|
||||
= 2.2 =
|
||||
* Added support for Rutube
|
||||
|
||||
= 2.1 =
|
||||
* Changes under the hood to ensure the first video is found
|
||||
* Improved YouTube regex
|
||||
|
||||
= 2.0.10 =
|
||||
* Reduced overhead on settings pages
|
||||
|
||||
= 2.0.9 =
|
||||
* Fixed Vimeo protocol-relative embeds
|
||||
* Fixed bug with PNG image types
|
||||
|
||||
= 2.0.8 =
|
||||
* Better fix for AYVP featured image bug
|
||||
|
||||
= 2.0.7 =
|
||||
* Fix for bug that prevented featured images from being set for posts imported by AYVP
|
||||
|
||||
= 2.0.6 =
|
||||
* Fix for "Fatal error: Cannot use object of type WP_Error as array" bug
|
||||
|
||||
= 2.0.5 =
|
||||
* Added support for Blip URLs
|
||||
|
||||
= 2.0.4 =
|
||||
* Fixed bug with file names when the post title uses non-latin characters
|
||||
|
||||
= 2.0.3 =
|
||||
* Fixed problem caused by YouTube removing http: or https: from their default embed code
|
||||
|
||||
= 2.0.2 =
|
||||
* Added descriptive messages for errors during provider tests
|
||||
* Fix possible fatal error on activation when VimeoAPIException is already declared
|
||||
* Fix possible undefined index warnings for provider settings
|
||||
|
||||
= 2.0.1 =
|
||||
* Added support for Facebook's iFrame player
|
||||
|
||||
= 2.0 =
|
||||
* Completely rewritten for better performance, more organized code, and easier maintenance
|
||||
* Added support for Funny or Die
|
||||
* Added support for MPORA
|
||||
* Added support for Wistia
|
||||
* Added support for Facebook videos
|
||||
* Added support for CollegeHumor
|
||||
* Added support for Youku
|
||||
* Added support for HD YouTube thumbnails
|
||||
* Added support for higher resolution Vimeo thumbnails
|
||||
* Added support for private Vimeo videos (API credentials required)
|
||||
* Added support for Vimeo channel URLs
|
||||
* Added support for [Automatic Youtube Video Posts Plugin](http://wordpress.org/extend/plugins/automatic-youtube-video-posts/)
|
||||
* Added filters to make plugin extensible
|
||||
* Removed cURL requirement (still requires ability to make external requests)
|
||||
* Better checks for blank thumbnails before added to media library
|
||||
* Adds 'video_thumbnail' field to video thumbnails saved in the media library
|
||||
* Option to clear all video thumbnails (clears custom field from posts and deletes video thumbnails added after 2.0 from library)
|
||||
* Better file names
|
||||
* Added provider tests on debugging page to help troubleshoot
|
||||
* Added a markup detection on debugging page
|
||||
* Added "Installation Information" section to debugging page with helpful troubleshooting info
|
||||
* Settings improvements
|
||||
* Bug fixes
|
||||
|
||||
= 1.8.2 =
|
||||
* Fixes issue where some servers were unable to download thumbnails from YouTube
|
||||
* Fixes possible issue setting new thumbnail as featured image
|
||||
|
||||
= 1.8.1 =
|
||||
* Plugin now scans posts added using XML-RPC which makes posting videos from iOS or other apps work smoothly
|
||||
|
||||
= 1.8 =
|
||||
* Added support for custom fields via a new setting
|
||||
* Added support for YouTube's privacy-enhanced domain (youtube-nocookie.com)
|
||||
* Fixed image duplication bug
|
||||
* Now more consistent with [WordPress Coding Standards](http://codex.wordpress.org/WordPress_Coding_Standards) (thanks [Daedalon](http://wordpress.org/support/profile/daedalon))
|
||||
|
||||
= 1.7.7 =
|
||||
* Better cURL error handling
|
||||
* Better regex matching
|
||||
* Bug fixes
|
||||
* Thanks to [Daedalon](http://wordpress.org/support/profile/daedalon) for many of these changes
|
||||
|
||||
= 1.7.6 =
|
||||
* Fixed plugin link
|
||||
* Added donate button
|
||||
|
||||
= 1.7.5 =
|
||||
* Bugfix for array error on line 408
|
||||
|
||||
= 1.7.4 =
|
||||
* Fixed Dailymotion bug (thanks [Gee](http://wordpress.org/support/profile/geekxx))
|
||||
* Added detection for Dailymotion URLs (thanks [Gee](http://wordpress.org/support/profile/geekxx))
|
||||
* Added support for [WP YouTube Lyte](http://wordpress.org/extend/plugins/wp-youtube-lyte/)
|
||||
|
||||
= 1.7.3 =
|
||||
* More comprehensive search for embedded YouTube videos
|
||||
|
||||
= 1.7.2 =
|
||||
* Added support for Dailymotion and Metacafe
|
||||
|
||||
= 1.7 =
|
||||
* Added new option to scan past posts for video thumbnails
|
||||
|
||||
= 1.6 =
|
||||
* Added support for custom post types
|
||||
|
||||
= 1.5 =
|
||||
* Video thumbnails are now only saved when a post's status changes to published.
|
||||
* Removed URL field from the Video Thumbnail meta box on the Edit Post Page
|
||||
* Added a "Reset Video Thumbnail" button to the meta box
|
||||
* Accidental duplicate images should no longer be problem
|
||||
|
||||
= 1.1.1 =
|
||||
* Fixed a bug related to scheduled posts sometimes not saving thumbnail URL to the meta field
|
||||
|
||||
= 1.1 =
|
||||
* Fixed bug created by a change in YouTube's embed codes
|
||||
|
||||
= 1.0.9 =
|
||||
* More work on fixing the duplicate image bug
|
||||
|
||||
= 1.0.8 =
|
||||
* (Attempted to) fix another bug that could create duplicate images when updating a post
|
||||
|
||||
= 1.0.7 =
|
||||
* Fixed a bug that could create duplicate images on auto-save
|
||||
|
||||
= 1.0.6 =
|
||||
* Improved Blip.tv support
|
||||
|
||||
= 1.0.5 =
|
||||
* Now using cURL to help save thumbnails locally instead of file_get_contents()
|
||||
|
||||
= 1.0.4 =
|
||||
* Added compatibility with YouTube's new iframe embedding
|
||||
* Now supports most embedding plugins
|
||||
|
||||
= 1.0.3 =
|
||||
* Fixed an issue where existing thumbnails (such as ones manually set by the user) would be replaced by Video Thumbnails
|
||||
* Added a checks to see if cURL is running
|
||||
|
||||
= 1.0.1 =
|
||||
* Removed "Scan for Video Thumbnails" button from settings page until improvements can be made
|
||||
|
||||
= 1.0 =
|
||||
* Video Thumbnails can now be stored in the local WordPress media library
|
||||
* Video Thumbnails stored locally can automatically be set as the featured image, making it support many themes automatically
|
||||
* Added an options page to enable/disable local storage and enable/disable automatically setting that thumbnail as the featured image
|
||||
* Settings page also includes a button to scan all posts for video thumbnails
|
||||
|
||||
= 0.6 =
|
||||
* Added support for Justin.tv
|
||||
* Fixed bug that could cause a conflict with other plugins
|
||||
|
||||
= 0.5.5 =
|
||||
* Video thumbnails are now found at the time the post is saved
|
||||
|
||||
= 0.5.4 =
|
||||
* Video thumbnails can be retrieved for a specific post ID by passing a parameter to the `video_thumbnail()` or `get_video_thumbnail()` function. For example: `<?php $id = 25; $thumbnail = get_video_thumbnail($id); if($thumbnail!=null) echo $thumbnail; ?>`
|
||||
|
||||
= 0.5.3 =
|
||||
* Better support for Vimeo Shortcode (thanks to Darren for the tip)
|
||||
|
||||
= 0.5.2 =
|
||||
* Added support for [Simple Video Embedder](http://wordpress.org/extend/plugins/simple-video-embedder/)
|
||||
|
||||
= 0.5.1 =
|
||||
* Added a test to make sure the YouTube thumbnail actually exists. This prevents you from getting that ugly default thumbnail from YouTube.
|
||||
|
||||
= 0.5 =
|
||||
* Thumbnail URLs are now stored in a custom field with each post, meaning the plugin only has to interact with outside APIs once per post.
|
||||
* Added a "Video Thumbnail" meta box to the edit screen for each post, which can be manually set or will be set automatically once `video_thumbnail()` or `get_video_thumbnail()` is called in a loop for that post.
|
||||
|
||||
= 0.3 =
|
||||
* Added basic support for Blip.tv auto embedded using URLs in this format: http://blip.tv/file/12345
|
||||
|
||||
= 0.2.3 =
|
||||
* Added support for any Vimeo URL
|
||||
|
||||
= 0.2.2 =
|
||||
* Added support for [Vimeo Shortcode](http://blog.esimplestudios.com/2010/08/embedding-vimeo-videos-in-wordpress/)
|
||||
|
||||
= 0.2.1 =
|
||||
* Added support for Vimeo players embedded using an iframe
|
||||
|
||||
= 0.2 =
|
||||
* Added `get_video_thumbnail()` to return the URL without echoing or return null if no thumbnail is found, making it possible to only display a thumbnail if one is found.
|
||||
|
||||
= 0.1.3 =
|
||||
* Fixed an issue where no URL was returned when Vimeo's rate limit had been exceeded. The default image URL is now returned, but a future version of the plugin will store thumbnails locally for a better fix.
|
||||
|
||||
= 0.1.2 =
|
||||
* Fixed a possible issue with how the default image URL is created
|
||||
|
||||
= 0.1.1 =
|
||||
* Fixed an issue with the plugin directory's name that caused the default URL to be broken
|
||||
* Added support for YouTube URLs
|
||||
|
||||
= 0.1 =
|
||||
* Initial release
|
||||
|
||||
== Upgrade Notice ==
|
||||
|
||||
= 2.1 =
|
||||
Changes to the scanning process may affect any custom code you've developed for Video Thumbnails
|
||||
|
||||
= 2.0 =
|
||||
Despite being a major upgrade, your settings should remain intact. Please report any problems so they can be fixed quickly!
|
||||
|
||||
= 1.0 =
|
||||
This is the single biggest update to Video Thumbnails so far, so be sure to check out the new settings page and documentation.
|
||||
|
||||
= 0.5 =
|
||||
This version adds the thumbnail URL to the post's meta data, meaning any outside APIs only have to be queried once per post. Vimeo's rate limit was easily exceeded, so this should fix that problem.
|
||||
|
||||
== Known Issues ==
|
||||
|
||||
* In some cases you may have to manually search for thumbnails on the post editor
|
||||
|
||||
== Roadmap ==
|
||||
|
||||
Version 3.0 is being finished up for release soon.
|
@ -0,0 +1,611 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Video Thumbnails
|
||||
Plugin URI: https://refactored.co/plugins/video-thumbnails
|
||||
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.
|
||||
Author: Sutherland Boswell
|
||||
Author URI: http://sutherlandboswell.com
|
||||
Version: 2.12.3
|
||||
License: GPL2
|
||||
Text Domain: video-thumbnails
|
||||
Domain Path: /languages/
|
||||
*/
|
||||
/* Copyright 2015 Sutherland Boswell (email : sutherland.boswell@gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License, version 2, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Define
|
||||
|
||||
define( 'VIDEO_THUMBNAILS_PATH', dirname(__FILE__) );
|
||||
define( 'VIDEO_THUMBNAILS_FIELD', '_video_thumbnail' );
|
||||
define( 'VIDEO_THUMBNAILS_VERSION', '2.12.3' );
|
||||
|
||||
// Providers
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/providers/providers.php' );
|
||||
|
||||
// Extensions
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/extensions/extensions.php' );
|
||||
|
||||
// Settings
|
||||
require_once( VIDEO_THUMBNAILS_PATH . '/php/class-video-thumbnails-settings.php' );
|
||||
|
||||
// Class
|
||||
|
||||
class Video_Thumbnails {
|
||||
|
||||
var $providers = array();
|
||||
var $settings;
|
||||
|
||||
function __construct() {
|
||||
|
||||
// Load translations
|
||||
add_action( 'plugins_loaded', array( &$this, 'plugin_textdomain' ));
|
||||
|
||||
// Create provider array
|
||||
$this->providers = apply_filters( 'video_thumbnail_providers', $this->providers );
|
||||
|
||||
// Settings
|
||||
$this->settings = new Video_Thumbnails_Settings();
|
||||
|
||||
// Initialize meta box
|
||||
add_action( 'admin_init', array( &$this, 'meta_box_init' ) );
|
||||
|
||||
// Add actions to save video thumbnails when saving
|
||||
add_action( 'save_post', array( &$this, 'save_video_thumbnail' ), 100, 1 );
|
||||
|
||||
// Add actions to save video thumbnails when posting from XML-RPC (this action passes the post ID as an argument so 'get_video_thumbnail' is used instead)
|
||||
add_action( 'xmlrpc_publish_post', 'get_video_thumbnail', 10, 1 );
|
||||
|
||||
// Add action for Ajax reset script on edit pages
|
||||
if ( in_array( basename( $_SERVER['PHP_SELF'] ), apply_filters( 'video_thumbnails_editor_pages', array( 'post-new.php', 'page-new.php', 'post.php', 'page.php' ) ) ) ) {
|
||||
add_action( 'admin_head', array( &$this, 'ajax_reset_script' ) );
|
||||
}
|
||||
|
||||
// Add action for Ajax reset callback
|
||||
add_action( 'wp_ajax_reset_video_thumbnail', array( &$this, 'ajax_reset_callback' ) );
|
||||
|
||||
// Add admin menus
|
||||
add_action( 'admin_menu', array( &$this, 'admin_menu' ) );
|
||||
|
||||
// Add JavaScript and CSS to admin pages
|
||||
add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts' ), 20 );
|
||||
|
||||
// Get the posts to be scanned in bulk
|
||||
add_action('wp_ajax_video_thumbnails_bulk_posts_query', array( &$this, 'bulk_posts_query_callback' ) );
|
||||
// Get the thumbnail for an individual post
|
||||
add_action('wp_ajax_video_thumbnails_get_thumbnail_for_post', array( &$this, 'get_thumbnail_for_post_callback' ) );
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load language files
|
||||
*/
|
||||
function plugin_textdomain() {
|
||||
load_plugin_textdomain( 'video-thumbnails', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the admin menu items
|
||||
*/
|
||||
function admin_menu() {
|
||||
add_management_page( __( 'Bulk Video Thumbnails', 'video-thumbnails' ), __( 'Bulk Video Thumbs', 'video-thumbnails' ), 'manage_options', 'video-thumbnails-bulk', array( &$this, 'bulk_scanning_page' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Enqueues necessary admin scripts
|
||||
* @param string $hook A hook for the current admin page
|
||||
*/
|
||||
function admin_scripts( $hook ) {
|
||||
// Bulk tool page
|
||||
if ( 'tools_page_video-thumbnails-bulk' == $hook ) {
|
||||
wp_enqueue_script( 'video-thumbnails-bulk-js', plugins_url( '/js/bulk.js' , __FILE__ ), array( 'jquery' ), VIDEO_THUMBNAILS_VERSION );
|
||||
wp_localize_script( 'video-thumbnails-bulk-js', 'video_thumbnails_bulk_language', array(
|
||||
'working' => __( 'Working...', 'video-thumbnails' ),
|
||||
'started' => __( 'Started Scanning', 'video-thumbnails' ),
|
||||
'resumed' => __( 'Resumed Scanning', 'video-thumbnails' ),
|
||||
'paused' => __( 'Paused Scanning', 'video-thumbnails' ),
|
||||
'done' => __( 'Done!', 'video-thumbnails' ),
|
||||
'final_count_singular' => __( 'Scanned 1 post', 'video-thumbnails' ),
|
||||
'final_count_plural' => __( 'Scanned %d posts', 'video-thumbnails' ),
|
||||
'queue_singular' => __( '1 post in queue', 'video-thumbnails' ),
|
||||
'queue_plural' => __( '%d posts in queue', 'video-thumbnails' ),
|
||||
'scanning_of' => __( 'Scanning %1$s of %2$s', 'video-thumbnails' ),
|
||||
'no_thumbnail' => __( 'No thumbnail', 'video-thumbnails' ),
|
||||
'new_thumbnail' => __( 'New thumbnail:', 'video-thumbnails' ),
|
||||
'existing_thumbnail' => __( 'Existing thumbnail:', 'video-thumbnails' ),
|
||||
'error' => __( 'Error:', 'video-thumbnails' ),
|
||||
) );
|
||||
wp_enqueue_style( 'video-thumbnails-bulk-css', plugins_url('/css/bulk.css', __FILE__), false, VIDEO_THUMBNAILS_VERSION );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize meta box on edit page
|
||||
*/
|
||||
function meta_box_init() {
|
||||
if ( is_array( $this->settings->options['post_types'] ) ) {
|
||||
foreach ( $this->settings->options['post_types'] as $type ) {
|
||||
add_meta_box( 'video_thumbnail', 'Video Thumbnail', array( &$this, 'meta_box' ), $type, 'side', 'low' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders the video thumbnail meta box
|
||||
*/
|
||||
function meta_box() {
|
||||
global $post;
|
||||
// Add hidden troubleshooting info
|
||||
add_thickbox();
|
||||
?>
|
||||
<div id="video-thumbnail-not-found-troubleshooting" style="display:none;">
|
||||
<h2><?php _e( 'Troubleshooting Video Thumbnails', 'video-thumbnails' ); ?></h2>
|
||||
<?php $this->no_video_thumbnail_troubleshooting_instructions(); ?>
|
||||
</div>
|
||||
<?php
|
||||
$custom = get_post_custom( $post->ID );
|
||||
if ( isset( $custom[VIDEO_THUMBNAILS_FIELD][0] ) ) $video_thumbnail = $custom[VIDEO_THUMBNAILS_FIELD][0];
|
||||
|
||||
if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
|
||||
echo '<p id="video-thumbnails-preview"><img src="' . $video_thumbnail . '" style="max-width:100%;" /></p>'; }
|
||||
|
||||
if ( get_post_status() == 'publish' || get_post_status() == 'private' ) {
|
||||
if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
|
||||
echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Reset Video Thumbnail', 'video-thumbnails' ) . '</a></p>';
|
||||
} else {
|
||||
echo '<p id="video-thumbnails-preview">' . __( 'No video thumbnail for this post.', 'video-thumbnails' ) . '</p>';
|
||||
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>';
|
||||
}
|
||||
} else {
|
||||
if ( isset( $video_thumbnail ) && $video_thumbnail != '' ) {
|
||||
echo '<p><a href="#" id="video-thumbnails-reset" onclick="video_thumbnails_reset(\'' . $post->ID . '\' );return false;">' . __( 'Reset Video Thumbnail', 'video-thumbnails' ) . '</a></p>';
|
||||
} else {
|
||||
echo '<p>' . __( 'A video thumbnail will be found for this post when it is published.', 'video-thumbnails' ) . '</p>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints a guide for troubleshooting no video thumbnails
|
||||
*/
|
||||
public static function no_video_thumbnail_troubleshooting_instructions() {
|
||||
?>
|
||||
<h3><?php _e( 'Fixing "No video thumbnail for this post"', 'video-thumbnails' ); ?></h3>
|
||||
<ol>
|
||||
<li><?php _e( 'Ensure you have saved any changes to your post.', 'video-thumbnails' ); ?></li>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
<li><?php _e( 'Try posting a video from other sources to help narrow down the problem.', 'video-thumbnails' ); ?></li>
|
||||
<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>
|
||||
<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>
|
||||
</ol>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* A usort() callback that sorts videos by offset
|
||||
*/
|
||||
function compare_by_offset( $a, $b ) {
|
||||
return $a['offset'] - $b['offset'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all the videos in a post
|
||||
* @param string $markup Markup to scan for videos
|
||||
* @return array An array of video information
|
||||
*/
|
||||
function find_videos( $markup ) {
|
||||
|
||||
$videos = array();
|
||||
|
||||
// Filter to modify providers immediately before scanning
|
||||
$providers = apply_filters( 'video_thumbnail_providers_pre_scan', $this->providers );
|
||||
|
||||
foreach ( $providers as $key => $provider ) {
|
||||
|
||||
$provider_videos = $provider->scan_for_videos( $markup );
|
||||
|
||||
if ( empty( $provider_videos ) ) continue;
|
||||
|
||||
foreach ( $provider_videos as $video ) {
|
||||
$videos[] = array(
|
||||
'id' => $video[0],
|
||||
'provider' => $key,
|
||||
'offset' => $video[1]
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
usort( $videos, array( &$this, 'compare_by_offset' ) );
|
||||
|
||||
return $videos;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first video in markup and retrieves a thumbnail
|
||||
* @param string $markup Post markup to scan
|
||||
* @return mixed Null if no thumbnail or a string with a remote URL
|
||||
*/
|
||||
function get_first_thumbnail_url( $markup ) {
|
||||
$thumbnail = null;
|
||||
$videos = $this->find_videos( $markup );
|
||||
foreach ( $videos as $video ) {
|
||||
$thumbnail = $this->providers[$video['provider']]->get_thumbnail_url( $video['id'] );
|
||||
if ( $thumbnail != null ) break;
|
||||
}
|
||||
return $thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the video thumbnail for a post, saves/sets as featured image if enabled, saves image URL to custom field and then returns the URL
|
||||
* @param int $post_id An optional post ID (can be left blank in a loop)
|
||||
* @return mixed A string with an image URL if successful or null if there is no video thumbnail
|
||||
*/
|
||||
function get_video_thumbnail( $post_id = null ) {
|
||||
|
||||
// Get the post ID if none is provided
|
||||
if ( $post_id == null OR $post_id == '' ) $post_id = get_the_ID();
|
||||
|
||||
// Check to see if thumbnail has already been found
|
||||
if( ( $thumbnail_meta = get_post_meta( $post_id, VIDEO_THUMBNAILS_FIELD, true ) ) != '' ) {
|
||||
return $thumbnail_meta;
|
||||
}
|
||||
// If the thumbnail isn't stored in custom meta, fetch a thumbnail
|
||||
else {
|
||||
|
||||
$new_thumbnail = null;
|
||||
// Filter for extensions to set thumbnail
|
||||
$new_thumbnail = apply_filters( 'new_video_thumbnail_url', $new_thumbnail, $post_id );
|
||||
|
||||
if ( $new_thumbnail == null ) {
|
||||
// Get the post or custom field to search
|
||||
if ( $this->settings->options['custom_field'] ) {
|
||||
$markup = get_post_meta( $post_id, $this->settings->options['custom_field'], true );
|
||||
} else {
|
||||
$post_array = get_post( $post_id );
|
||||
$markup = $post_array->post_content;
|
||||
$markup = apply_filters( 'the_content', $markup );
|
||||
}
|
||||
|
||||
// Filter for extensions to modify what markup is scanned
|
||||
$markup = apply_filters( 'video_thumbnail_markup', $markup, $post_id );
|
||||
|
||||
$new_thumbnail = $this->get_first_thumbnail_url( $markup );
|
||||
}
|
||||
|
||||
// Return the new thumbnail variable and update meta if one is found
|
||||
if ( $new_thumbnail != null && !is_wp_error( $new_thumbnail ) ) {
|
||||
|
||||
// Save as Attachment if enabled
|
||||
if ( $this->settings->options['save_media'] == 1 ) {
|
||||
$attachment_id = $this->save_to_media_library( $new_thumbnail, $post_id );
|
||||
if ( is_wp_error( $attachment_id ) ) {
|
||||
return $attachment_id;
|
||||
}
|
||||
$new_thumbnail = wp_get_attachment_image_src( $attachment_id, 'full' );
|
||||
$new_thumbnail = $new_thumbnail[0];
|
||||
}
|
||||
|
||||
// Add hidden custom field with thumbnail URL
|
||||
if ( !update_post_meta( $post_id, VIDEO_THUMBNAILS_FIELD, $new_thumbnail ) ) add_post_meta( $post_id, VIDEO_THUMBNAILS_FIELD, $new_thumbnail, true );
|
||||
|
||||
// Set attachment as featured image if enabled
|
||||
if ( $this->settings->options['set_featured'] == 1 && $this->settings->options['save_media'] == 1 ) {
|
||||
// Make sure there isn't already a post thumbnail
|
||||
if ( !ctype_digit( get_post_thumbnail_id( $post_id ) ) ) {
|
||||
set_post_thumbnail( $post_id, $attachment_id );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $new_thumbnail;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a video thumbnail when a published post is saved
|
||||
* @param int $post_id The post ID
|
||||
*/
|
||||
function save_video_thumbnail( $post_id ) {
|
||||
// Don't save video thumbnails during autosave or for unpublished posts
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return null;
|
||||
if ( get_post_status( $post_id ) != 'publish' ) return null;
|
||||
// Check that Video Thumbnails are enabled for current post type
|
||||
$post_type = get_post_type( $post_id );
|
||||
if ( in_array( $post_type, (array) $this->settings->options['post_types'] ) || $post_type == $this->settings->options['post_types'] ) {
|
||||
$this->get_video_thumbnail( $post_id );
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a file name for use when saving an image to the media library.
|
||||
* It will either use a sanitized version of the title or the post ID.
|
||||
* @param int $post_id The ID of the post to create the filename for
|
||||
* @return string A filename (without the extension)
|
||||
*/
|
||||
static function construct_filename( $post_id ) {
|
||||
$filename = get_the_title( $post_id );
|
||||
$filename = sanitize_title( $filename, $post_id );
|
||||
$filename = urldecode( $filename );
|
||||
$filename = preg_replace( '/[^a-zA-Z0-9\-]/', '', $filename );
|
||||
$filename = substr( $filename, 0, 32 );
|
||||
$filename = trim( $filename, '-' );
|
||||
if ( $filename == '' ) $filename = (string) $post_id;
|
||||
return $filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves a remote image to the media library
|
||||
* @param string $image_url URL of the image to save
|
||||
* @param int $post_id ID of the post to attach image to
|
||||
* @return int ID of the attachment
|
||||
*/
|
||||
public static function save_to_media_library( $image_url, $post_id ) {
|
||||
|
||||
$error = '';
|
||||
$response = wp_remote_get( $image_url );
|
||||
if( is_wp_error( $response ) ) {
|
||||
$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() );
|
||||
} else {
|
||||
$image_contents = $response['body'];
|
||||
$image_type = wp_remote_retrieve_header( $response, 'content-type' );
|
||||
}
|
||||
|
||||
if ( $error != '' ) {
|
||||
return $error;
|
||||
} else {
|
||||
|
||||
// Translate MIME type into an extension
|
||||
if ( $image_type == 'image/jpeg' ) {
|
||||
$image_extension = '.jpg';
|
||||
} elseif ( $image_type == 'image/png' ) {
|
||||
$image_extension = '.png';
|
||||
} elseif ( $image_type == 'image/gif' ) {
|
||||
$image_extension = '.gif';
|
||||
} else {
|
||||
return new WP_Error( 'thumbnail_upload', __( 'Unsupported MIME type:', 'video-thumbnails' ) . ' ' . $image_type );
|
||||
}
|
||||
|
||||
// Construct a file name with extension
|
||||
$new_filename = self::construct_filename( $post_id ) . $image_extension;
|
||||
|
||||
// Save the image bits using the new filename
|
||||
do_action( 'video_thumbnails/pre_upload_bits', $image_contents );
|
||||
$upload = wp_upload_bits( $new_filename, null, $image_contents );
|
||||
do_action( 'video_thumbnails/after_upload_bits', $upload );
|
||||
|
||||
// Stop for any errors while saving the data or else continue adding the image to the media library
|
||||
if ( $upload['error'] ) {
|
||||
$error = new WP_Error( 'thumbnail_upload', __( 'Error uploading image data:', 'video-thumbnails' ) . ' ' . $upload['error'] );
|
||||
return $error;
|
||||
} else {
|
||||
|
||||
do_action( 'video_thumbnails/image_downloaded', $upload['file'] );
|
||||
|
||||
$wp_filetype = wp_check_filetype( basename( $upload['file'] ), null );
|
||||
|
||||
$upload = apply_filters( 'wp_handle_upload', array(
|
||||
'file' => $upload['file'],
|
||||
'url' => $upload['url'],
|
||||
'type' => $wp_filetype['type']
|
||||
), 'sideload' );
|
||||
|
||||
// Contstruct the attachment array
|
||||
$attachment = array(
|
||||
'post_mime_type' => $upload['type'],
|
||||
'post_title' => get_the_title( $post_id ),
|
||||
'post_content' => '',
|
||||
'post_status' => 'inherit'
|
||||
);
|
||||
// Insert the attachment
|
||||
$attach_id = wp_insert_attachment( $attachment, $upload['file'], $post_id );
|
||||
|
||||
// you must first include the image.php file
|
||||
// for the function wp_generate_attachment_metadata() to work
|
||||
require_once( ABSPATH . 'wp-admin/includes/image.php' );
|
||||
do_action( 'video_thumbnails/pre_generate_attachment_metadata', $attach_id, $upload['file'] );
|
||||
$attach_data = wp_generate_attachment_metadata( $attach_id, $upload['file'] );
|
||||
do_action( 'video_thumbnails/after_generate_attachment_metadata', $attach_id, $upload['file'] );
|
||||
wp_update_attachment_metadata( $attach_id, $attach_data );
|
||||
|
||||
// Add field to mark image as a video thumbnail
|
||||
update_post_meta( $attach_id, 'video_thumbnail', '1' );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $attach_id;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax reset script for post editor
|
||||
*/
|
||||
function ajax_reset_script() {
|
||||
echo '<!-- Video Thumbnails Ajax Search -->' . PHP_EOL;
|
||||
echo '<script type="text/javascript">' . PHP_EOL;
|
||||
echo 'function video_thumbnails_reset(id) {' . PHP_EOL;
|
||||
echo ' var data = {' . PHP_EOL;
|
||||
echo ' action: "reset_video_thumbnail",' . PHP_EOL;
|
||||
echo ' post_id: id' . PHP_EOL;
|
||||
echo ' };' . PHP_EOL;
|
||||
echo ' document.getElementById(\'video-thumbnails-preview\').innerHTML=\'' . __( 'Working...', 'video-thumbnails' ) . ' <img src="' . home_url( 'wp-admin/images/loading.gif' ) . '"/>\';' . PHP_EOL;
|
||||
echo ' jQuery.post(ajaxurl, data, function(response){' . PHP_EOL;
|
||||
echo ' document.getElementById(\'video-thumbnails-preview\').innerHTML=response;' . PHP_EOL;
|
||||
echo ' });' . PHP_EOL;
|
||||
echo '};' . PHP_EOL;
|
||||
echo '</script>' . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback for resetting a video thumbnail in the post editor
|
||||
*/
|
||||
function ajax_reset_callback() {
|
||||
global $wpdb; // this is how you get access to the database
|
||||
|
||||
$post_id = $_POST['post_id'];
|
||||
|
||||
delete_post_meta( $post_id, VIDEO_THUMBNAILS_FIELD );
|
||||
|
||||
$video_thumbnail = get_video_thumbnail( $post_id );
|
||||
|
||||
if ( is_wp_error( $video_thumbnail ) ) {
|
||||
echo $video_thumbnail->get_error_message();
|
||||
} else if ( $video_thumbnail != null ) {
|
||||
echo '<img src="' . $video_thumbnail . '" style="max-width:100%;" />';
|
||||
} else {
|
||||
echo __( 'No video thumbnail for this post.', 'video-thumbnails' );
|
||||
}
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback used to get all the post IDs to be scanned in bulk
|
||||
*/
|
||||
function bulk_posts_query_callback() {
|
||||
// Some default args
|
||||
$args = array(
|
||||
'posts_per_page' => -1,
|
||||
'post_type' => $this->settings->options['post_types'],
|
||||
'fields' => 'ids'
|
||||
);
|
||||
// Setup an array for any form data and parse the jQuery serialized data
|
||||
$form_data = array();
|
||||
parse_str( $_POST['params'], $form_data );
|
||||
|
||||
$args = apply_filters( 'video_thumbnails/bulk_posts_query', $args, $form_data );
|
||||
|
||||
$query = new WP_Query( $args );
|
||||
echo json_encode( $query->posts );
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* Ajax callback used to get the video thumbnail for an individual post in the process of running the bulk tool
|
||||
*/
|
||||
function get_thumbnail_for_post_callback() {
|
||||
|
||||
$post_id = $_POST['post_id'];
|
||||
$thumb = get_post_meta( $post_id, VIDEO_THUMBNAILS_FIELD, true );
|
||||
|
||||
if ( $thumb == '' ) {
|
||||
global $video_thumbnails;
|
||||
$thumb = $video_thumbnails->get_video_thumbnail( $post_id );
|
||||
if ( $thumb ) {
|
||||
$type = 'new';
|
||||
}
|
||||
} else {
|
||||
$type = 'existing';
|
||||
}
|
||||
|
||||
if ( $thumb != '' ) {
|
||||
$result = array(
|
||||
'type' => $type,
|
||||
'url' => $thumb
|
||||
);
|
||||
} else {
|
||||
$result = array();
|
||||
}
|
||||
|
||||
echo json_encode( $result );
|
||||
die();
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that renders the bulk scanning page
|
||||
*/
|
||||
function bulk_scanning_page() {
|
||||
|
||||
if ( ! current_user_can( 'manage_options' ) ) {
|
||||
wp_die( __( 'You do not have sufficient permissions to access this page.', 'video-thumbnails' ) );
|
||||
}
|
||||
|
||||
?>
|
||||
<div class="wrap">
|
||||
|
||||
<div id="icon-tools" class="icon32"></div><h2><?php _e( 'Bulk Video Thumbnail Generator', 'video-thumbnails' ); ?></h2>
|
||||
|
||||
<p><?php _e( 'Use this tool to scan all of your posts for Video Thumbnails.', 'video-thumbnails' ); ?></p>
|
||||
|
||||
<form id="video-thumbnails-bulk-scan-options">
|
||||
<table class="form-table">
|
||||
<tbody>
|
||||
<?php do_action( 'video_thumbnails/bulk_options_form'); ?>
|
||||
<tr valign="top">
|
||||
<th scope="row"><span id="queue-count">...</span></th>
|
||||
<td>
|
||||
<input type="submit" value="<?php esc_attr_e( 'Scan Now', 'video-thumbnails' ); ?>" class="button button-primary">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<div id="vt-bulk-scan-results">
|
||||
<div class="progress-bar-container">
|
||||
<span class="percentage">0%</span>
|
||||
<div class="progress-bar"> </div>
|
||||
</div>
|
||||
<table class="stats">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php _e( 'Scanned', 'video-thumbnails' ); ?></th>
|
||||
<th><?php _e( 'New Thumbnails', 'video-thumbnails' ); ?></th>
|
||||
<th><?php _e( 'Existing', 'video-thumbnails' ); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<td class="scanned">0</td>
|
||||
<td class="found-new">0</td>
|
||||
<td class="found-existing">0</td>
|
||||
</tr>
|
||||
</table>
|
||||
<ul class="log"></ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$video_thumbnails = new Video_Thumbnails();
|
||||
|
||||
do_action( 'video_thumbnails_plugin_loaded' );
|
||||
|
||||
// End class
|
||||
|
||||
// Get video thumbnail function
|
||||
function get_video_thumbnail( $post_id = null ) {
|
||||
global $video_thumbnails;
|
||||
return $video_thumbnails->get_video_thumbnail( $post_id );
|
||||
}
|
||||
|
||||
// Echo thumbnail
|
||||
function video_thumbnail( $post_id = null ) {
|
||||
if ( ( $video_thumbnail = get_video_thumbnail( $post_id ) ) == null ) { echo plugins_url() . '/video-thumbnails/default.jpg'; }
|
||||
else { echo $video_thumbnail; }
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user