Version Description
Download this release
Release Info
Developer | a.hoereth |
Plugin | Featured Video Plus |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.2 to 2.2.0
- CHANGELOG.md +15 -4
- README.md +0 -14
- featured-video-plus.php +3 -2
- js/frontend.js +23 -10
- js/frontend.min.js +1 -1
- js/html.js +1 -1
- js/html.min.js +1 -1
- js/post.js +4 -0
- js/post.min.js +1 -1
- php/class-backend.php +59 -15
- php/class-main.php +44 -4
- php/class-oembed.php +58 -0
- php/class-settings.php +32 -4
- php/inc-upgrade.php +13 -0
- readme.txt +16 -5
CHANGELOG.md
CHANGED
@@ -1,17 +1,28 @@
|
|
1 |
# Changelog #
|
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
## 2.1.2: 2015-06-16 ##
|
4 |
* Fix bug which resulted in missing featured images when a post did not have a featured video. ([*](https://wordpress.org/support/topic/cookie-send-to-you-and-video-yes-image-no), [*](https://wordpress.org/support/topic/version-221-featured-image-not-diplayed))
|
5 |
|
6 |
## 2.1.1: 2015-06-15 ##
|
7 |
-
* Fix play and loading featured image overlay for some themes ([*](https://wordpress.org/support/topic/play-icon-missing))
|
8 |
* Fix broken `remove featured image` link. ([*](https://wordpress.org/support/topic/cant-remove-featured-image-2), [*](https://wordpress.org/support/topic/version-210-conflict-with-wp-featured-image), [*](https://wordpress.org/support/topic/fvp-not-working-after-210-update))
|
9 |
|
10 |
## 2.1.0: 2015-06-11 ##
|
11 |
* Display options are now chained using OR - if one of them holds, the replace mode is used.
|
12 |
-
* Added `always use replace mode when viewing single posts and pages` option, was implicitly true since 2.0.0. ([*](https://wordpress.org/support/topic/featured-video-overrides-featured-image))
|
13 |
-
* Fixed undefined warnings when using `WP_DEBUG
|
14 |
-
* Fixed double-wrapped .post-thumbnails ([*](https://wordpress.org/support/topic/video-no-longer-appearing))
|
15 |
* Lazy loading a video no longer breaks other videos. ([*](https://wordpress.org/support/topic/blank-screen-after-the-video-is-played))
|
16 |
|
17 |
## 2.0.3: 2015-06-01 ##
|
1 |
# Changelog #
|
2 |
|
3 |
+
## 2.2.0: 2015-07-20 ##
|
4 |
+
* Shortcodes can now be used as featured content (e.g. `[gallery]`).
|
5 |
+
* Added fine tuned autoplay options.
|
6 |
+
* New option for hiding YouTube video annotations. ([*](https://wordpress.org/support/topic/add-feature-to-hide-youtube-screen-annotation))
|
7 |
+
* Expose a JS function to manually re-initialize the plugin's JS behavior like responsive sizing and overlays. Specifically interesting when using FVP in combination with a infinite scroll plugin. ([*](https://wordpress.org/support/topic/open-video-overlay-when-featured-image-is-clicked-in-loop))
|
8 |
+
* Fetch high quality thumbnails for YouTube and Dailymotion. ([*](https://wordpress.org/support/topic/featured-image-size-42))
|
9 |
+
* Fix bug which suppressed the removal of foreign featured images. ([*](https://wordpress.org/support/topic/cannot-remove-featured-image-if-a-featured-video-is-set))
|
10 |
+
* Fix 'undefined function exif_imagetype' error. ([*](https://wordpress.org/support/topic/cant-add-featured-video-1), [*](https://wordpress.org/support/topic/infinite-spinning-wheel-all-previous-videos-not-working-anymore), [*](https://wordpress.org/support/topic/error-message-444))
|
11 |
+
* Implement a workaround for a bug with iframes in Google Chrome, see [[0](https://code.google.com/p/chromium/issues/detail?id=395533)], [[1](https://code.google.com/p/chromium/issues/detail?id=395791)]. ([*](https://wordpress.org/support/topic/found-a-huge-critical-bug-videos-vanish-after-using-back))
|
12 |
+
* Fix bug which resulted in a invisible video playing in the background when using autoplay and overlay mode. ([*](https://wordpress.org/support/topic/video-overlay-with-autoplay-causes-two-videos-to-play))
|
13 |
+
|
14 |
## 2.1.2: 2015-06-16 ##
|
15 |
* Fix bug which resulted in missing featured images when a post did not have a featured video. ([*](https://wordpress.org/support/topic/cookie-send-to-you-and-video-yes-image-no), [*](https://wordpress.org/support/topic/version-221-featured-image-not-diplayed))
|
16 |
|
17 |
## 2.1.1: 2015-06-15 ##
|
18 |
+
* Fix play and loading featured image overlay for some themes. ([*](https://wordpress.org/support/topic/play-icon-missing))
|
19 |
* Fix broken `remove featured image` link. ([*](https://wordpress.org/support/topic/cant-remove-featured-image-2), [*](https://wordpress.org/support/topic/version-210-conflict-with-wp-featured-image), [*](https://wordpress.org/support/topic/fvp-not-working-after-210-update))
|
20 |
|
21 |
## 2.1.0: 2015-06-11 ##
|
22 |
* Display options are now chained using OR - if one of them holds, the replace mode is used.
|
23 |
+
* Added `always use replace mode when viewing single posts and pages` option, was implicitly true since 2.0.0. ([*](https://wordpress.org/support/topic/featured-video-overrides-featured-image))
|
24 |
+
* Fixed undefined warnings when using `WP_DEBUG`. ([*](https://wordpress.org/support/topic/debug-error-16))
|
25 |
+
* Fixed double-wrapped .post-thumbnails. ([*](https://wordpress.org/support/topic/video-no-longer-appearing))
|
26 |
* Lazy loading a video no longer breaks other videos. ([*](https://wordpress.org/support/topic/blank-screen-after-the-video-is-played))
|
27 |
|
28 |
## 2.0.3: 2015-06-01 ##
|
README.md
CHANGED
@@ -63,17 +63,3 @@ When editing your theme's sourcecode keep in mind that a future update through W
|
|
63 |
|
64 |
|
65 |
|
66 |
-
## Screenshots ##
|
67 |
-
|
68 |
-
1. A Featured Video in the Twenty Fifteen theme on [yrnxt.com](http://yrnxt.com/wordpress/featured-video-plus).
|
69 |
-
![1. A Featured Video in the Twenty Fifteen theme on [yrnxt.com](http://yrnxt.com/wordpress/featured-video-plus).](https://ps.w.org/featured-video-plus/assets/screenshot-1.jpg)
|
70 |
-
|
71 |
-
2. Featured Video and Featured Image boxes on the post edit screen.
|
72 |
-
![2. Featured Video and Featured Image boxes on the post edit screen.](https://ps.w.org/featured-video-plus/assets/screenshot-2.jpg)
|
73 |
-
|
74 |
-
3. Featured Video settings on the `Settings -> Media` administration screen.
|
75 |
-
![3. Featured Video settings on the `Settings -> Media` administration screen.](https://ps.w.org/featured-video-plus/assets/screenshot-3.jpg)
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
63 |
|
64 |
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
featured-video-plus.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Featured Video Plus
|
4 |
Plugin URI: http://yrnxt.com/wordpress/featured-video-plus/
|
5 |
Description: Add Featured Videos to your posts and pages.
|
6 |
-
Version: 2.
|
7 |
Author: Alexander Höreth
|
8 |
Author URI: http://yrnxt.com
|
9 |
Text Domain: featured-video-plus
|
@@ -32,7 +32,7 @@ License: GPL2
|
|
32 |
// ********************
|
33 |
// CONSTANTS
|
34 |
if ( ! defined( 'FVP_VERSION' ) ) {
|
35 |
-
define( 'FVP_VERSION', '2.
|
36 |
}
|
37 |
|
38 |
$pathinfo = pathinfo( dirname( plugin_basename( __FILE__ ) ) );
|
@@ -72,6 +72,7 @@ if ( ! is_admin() ) {
|
|
72 |
$featured_video_plus = new FVP_Frontend();
|
73 |
}
|
74 |
|
|
|
75 |
// ********************
|
76 |
// PUBLIC API
|
77 |
include_once( FVP_DIR . 'php/functions.php' );
|
3 |
Plugin Name: Featured Video Plus
|
4 |
Plugin URI: http://yrnxt.com/wordpress/featured-video-plus/
|
5 |
Description: Add Featured Videos to your posts and pages.
|
6 |
+
Version: 2.2.0
|
7 |
Author: Alexander Höreth
|
8 |
Author URI: http://yrnxt.com
|
9 |
Text Domain: featured-video-plus
|
32 |
// ********************
|
33 |
// CONSTANTS
|
34 |
if ( ! defined( 'FVP_VERSION' ) ) {
|
35 |
+
define( 'FVP_VERSION', '2.2.0' );
|
36 |
}
|
37 |
|
38 |
$pathinfo = pathinfo( dirname( plugin_basename( __FILE__ ) ) );
|
72 |
$featured_video_plus = new FVP_Frontend();
|
73 |
}
|
74 |
|
75 |
+
|
76 |
// ********************
|
77 |
// PUBLIC API
|
78 |
include_once( FVP_DIR . 'php/functions.php' );
|
js/frontend.js
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
(function($) {
|
2 |
'use strict';
|
3 |
/* global fvpdata */
|
@@ -7,6 +9,7 @@
|
|
7 |
var playBg = 'url(\'' + fvpdata.playicon + '\')';
|
8 |
var loadBg = 'url(\'' + fvpdata.loadicon + '\')';
|
9 |
var bgState;
|
|
|
10 |
|
11 |
|
12 |
/**
|
@@ -151,18 +154,16 @@
|
|
151 |
|
152 |
$('#DOMWindow').css({ backgroundImage: loadBg });
|
153 |
|
154 |
-
var $cache = $('#fvp-cache-' + id);
|
155 |
-
|
156 |
// Check if the result is already cached
|
157 |
-
if (
|
158 |
$.post(fvpdata.ajaxurl, {
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
}, function(response) {
|
163 |
if (response.success) {
|
164 |
// cache the result to not reload when opened again
|
165 |
-
|
166 |
|
167 |
$('#DOMWindow').html(response.data);
|
168 |
sizeLocal();
|
@@ -171,14 +172,13 @@
|
|
171 |
});
|
172 |
} else {
|
173 |
// From cache
|
174 |
-
$('#DOMWindow').html(
|
175 |
$(window).trigger('scroll');
|
176 |
}
|
177 |
}
|
178 |
|
179 |
|
180 |
-
|
181 |
-
$(document).ready(function() {
|
182 |
// remove wrapping anchors
|
183 |
// doing this twice with a 1 second delay to fix wrapped local video posters
|
184 |
unwrap();
|
@@ -198,5 +198,18 @@
|
|
198 |
|
199 |
// overlay click handler
|
200 |
$('.fvp-overlay').click(overlayTrigger);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
});
|
202 |
})(jQuery);
|
1 |
+
var initFeaturedVideoPlus;
|
2 |
+
|
3 |
(function($) {
|
4 |
'use strict';
|
5 |
/* global fvpdata */
|
9 |
var playBg = 'url(\'' + fvpdata.playicon + '\')';
|
10 |
var loadBg = 'url(\'' + fvpdata.loadicon + '\')';
|
11 |
var bgState;
|
12 |
+
var cache = {};
|
13 |
|
14 |
|
15 |
/**
|
154 |
|
155 |
$('#DOMWindow').css({ backgroundImage: loadBg });
|
156 |
|
|
|
|
|
157 |
// Check if the result is already cached
|
158 |
+
if (! cache[id]) {
|
159 |
$.post(fvpdata.ajaxurl, {
|
160 |
+
'action' : 'fvp_get_embed',
|
161 |
+
'fvp_nonce' : fvpdata.nonce,
|
162 |
+
'id' : id
|
163 |
}, function(response) {
|
164 |
if (response.success) {
|
165 |
// cache the result to not reload when opened again
|
166 |
+
cache[id] = response.data;
|
167 |
|
168 |
$('#DOMWindow').html(response.data);
|
169 |
sizeLocal();
|
172 |
});
|
173 |
} else {
|
174 |
// From cache
|
175 |
+
$('#DOMWindow').html( cache[id] );
|
176 |
$(window).trigger('scroll');
|
177 |
}
|
178 |
}
|
179 |
|
180 |
|
181 |
+
initFeaturedVideoPlus = function() {
|
|
|
182 |
// remove wrapping anchors
|
183 |
// doing this twice with a 1 second delay to fix wrapped local video posters
|
184 |
unwrap();
|
198 |
|
199 |
// overlay click handler
|
200 |
$('.fvp-overlay').click(overlayTrigger);
|
201 |
+
};
|
202 |
+
|
203 |
+
// Initialization after DOM is completly loaded.
|
204 |
+
$(document).ready(function() {
|
205 |
+
// Wordaround for chrome bug
|
206 |
+
// See https://code.google.com/p/chromium/issues/detail?id=395791
|
207 |
+
if (!! window.chrome) {
|
208 |
+
$('.featured-video-plus iframe').each(function() {
|
209 |
+
this.src = this.src;
|
210 |
+
});
|
211 |
+
}
|
212 |
+
|
213 |
+
initFeaturedVideoPlus();
|
214 |
});
|
215 |
})(jQuery);
|
js/frontend.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
|
1 |
+
var initFeaturedVideoPlus;!function(a){"use strict";function t(){a(".has-post-video a>.featured-video-plus,.has-post-video a>.fvp-dynamic,.has-post-video a>.fvp-overlay,.has-post-video a>.wp-video,.has-post-video a>.wp-video-shortcode").unwrap(),a(".has-post-video .post-thumbnail>.post-thumbnail").removeClass("post-thumbnail"),a("a.post-thumbnail:empty").not(".fvp-dynamic, .fvp-overlay").remove()}function e(){fvpdata.fitvids&&a(".featured-video-plus.fvp-responsive").fitVids({customSelector:["iframe","object","embed"]})}function i(){if(fvpdata.width&&!fvpdata.fitvids){a(".fvp-local .wp-video").css({width:fvpdata.width,height:"auto"});var t=a(".fvp-local .wp-video .wp-video-shortcode");t.attr({width:fvpdata.width,height:fvpdata.width/t.attr("width")*t.attr("heigth")})}}function o(){void 0===p&&[fvpdata.playicon,fvpdata.loadicon].forEach(function(t){a("body").append(a("<img/>",{src:t}).hide())}),p=p===s?v:s,c.css({backgroundImage:p})}function d(t){var e=a(t.currentTarget).children("img");0===e.siblings(".fvp-loader").length?(c.addClass(e.attr("class")).css({height:e.height(),width:e.width(),margin:e.css("margin")}),e.animate({opacity:fvpdata.opacity}).before(c)):p!==v&&(e.animate({opacity:1}),c.remove())}function n(i){i.preventDefault();var d=a(i.currentTarget),n=parseInt(d.attr("data-id"),10);o(),a.post(fvpdata.ajaxurl,{action:"fvp_get_embed",fvp_nonce:fvpdata.nonce,id:n},function(a){if(a.success){var i=d.parent();d.replaceWith(a.data),i.find(".wp-audio-shortcode, .wp-video-shortcode").mediaelementplayer(),e(),t()}o()})}function r(t){t.preventDefault();var e=a(t.currentTarget),o=parseInt(e.attr("data-id"),10);e.openDOMWindow({eventType:null,windowPadding:0,borderSize:0,windowBGColor:"transparent",overlayOpacity:100*fvpdata.opacity,width:"100%",height:"100%"}),a("#DOMWindow").css({backgroundImage:v}),f[o]?(a("#DOMWindow").html(f[o]),a(window).trigger("scroll")):a.post(fvpdata.ajaxurl,{action:"fvp_get_embed",fvp_nonce:fvpdata.nonce,id:o},function(t){t.success&&(f[o]=t.data,a("#DOMWindow").html(t.data),i(),a(window).trigger("scroll"))})}var p,c=a("<div />").addClass("fvp-loader"),s="url('"+fvpdata.playicon+"')",v="url('"+fvpdata.loadicon+"')",f={};initFeaturedVideoPlus=function(){t(),setTimeout(t,1e3),e(),i(),a(".fvp-overlay, .fvp-dynamic").hover(d,d),o(),a(".fvp-dynamic").click(n),a(".fvp-overlay").click(r)},a(document).ready(function(){window.chrome&&a(".featured-video-plus iframe").each(function(){this.src=this.src}),initFeaturedVideoPlus()})}(jQuery);
|
js/html.js
CHANGED
@@ -68,7 +68,7 @@
|
|
68 |
var $target = $( targets[i] );
|
69 |
|
70 |
var targetNames = $target.data('names').split('|');
|
71 |
-
var targetValues = $target.data('values').split('|');
|
72 |
|
73 |
var index = $.inArray($trigger.attr('name'), targetNames);
|
74 |
if (-1 === index) {
|
68 |
var $target = $( targets[i] );
|
69 |
|
70 |
var targetNames = $target.data('names').split('|');
|
71 |
+
var targetValues = ("" + $target.data('values')).split('|');
|
72 |
|
73 |
var index = $.inArray($trigger.attr('name'), targetNames);
|
74 |
if (-1 === index) {
|
js/html.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(t){"use strict";var i=function(){var i=t(this),e=i.siblings("[data-hook='"+i.data("hook")+"']");i.hasClass("active")&&e.hasClass("active")||(i.siblings(fvphtml.prefix+"tab-title").removeClass("active"),i.siblings(fvphtml.prefix+"tab-body").slideUp(),i.addClass("active"),e.addClass("active").slideDown())};t(document).ready(function(){for(var e=t(fvphtml.prefix+"tabs"),r=e.length-1;r>=0;r--){var n=t(e[r]),a=n.children(fvphtml.prefix+"tab-title"),s=n.children(fvphtml.prefix+"tab-body");a.first().addClass("active"),s.first().addClass("active"),n.prepend(a),s.filter(":not(.active)").hide(),n.children(fvphtml.prefix+"tab-title").click(i)}})}(jQuery),function(t){"use strict";var i={},e=function(){for(var e=t(this),r=i[e.attr("name")],n=0;n<r.length;n++){var a=t(r[n]),s=a.data("names").split("|"),l=a.data("values").split("|"),o=t.inArray(e.attr("name"),s);if(-1!==o){var c=!0,f=l[o],h="checkbox"!==e.attr("type")||e.prop("checked")?e.val():null;"string"==typeof f&&"!"===f.charAt(0)&&(c=!1,f=f.substr(1)),c&&h!==f||!c&&h===f?a.addClass("hidden"):a.removeClass("hidden")}}};t(document).ready(function(){for(var r=t(fvphtml.prefix+"conditional"),n=0;n<r.length;n++)for(var a=t(r[n]),s=a.data("names").split("|"),l=0;l<s.length;l++){var o=s[l];i.hasOwnProperty(o)||(i[o]=[]),i[o].push(a)}for(var c in i){var f=t("[name='"+c+"']");f.change(e)}})}(jQuery),function(t){"use strict";function i(t){t=t?t:"#fffff",t="#"===t.charAt(0)?t.substr(1):t;var i=parseInt(t.substr(0,2),16),e=parseInt(t.substr(2,2),16),r=parseInt(t.substr(4,2),16),n=(299*i+587*e+114*r)/1e3;return n>=128?"#000":"#fff"}function e(t){return 3===t.length&&"#"!==t.charAt(0)&&(t="#"+t),4===t.length&&"#"===t.charAt(0)&&(t="#"+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3)),7===t.length?t:!1}var r,n=function(r,n){var a=t(this),s=n&&n.color?n.color.toString():a.val();s=e(s),a.css({backgroundColor:s?s:"#ffffff",color:i(s)}),s?a.siblings(fvphtml.prefix+"reset").show():a.siblings(fvphtml.prefix+"reset").hide()},a=function(){var i=t(this);r.not(i).iris("hide"),i.iris("show")},s=function(i){i&&i.preventDefault();var e=t(this);""===e.val()&&e.siblings(fvphtml.prefix+"reset").hide()},l=function(i){i&&i.preventDefault(),r.iris("hide"),t(this).siblings(fvphtml.prefix+"colorpicker").val("").each(n)};t(document).ready(function(){r=t(fvphtml.prefix+"colorpicker"),r.iris({change:n}),r.bind("input",n),r.click(a),r.blur(s),r.siblings(fvphtml.prefix+"reset").click(l),r.each(n)})}(jQuery),function(t){"use strict";function i(i){var r=i.title||"",n=i.content||"",a=i.position||{edge:"right",align:"middle"};t(i.target).pointer({pointer_id:i.identifier,content:"<h3>"+r+"</h3><p>"+n+"</p>",position:a,close:e}).pointer("open")}var e=function(){var i=t(this).data("wpPointer").options.pointer_id;t.post(ajaxurl,{pointer:i,action:"dismiss-wp-pointer"})};t(document).ready(function(){for(var t=fvphtml.pointers||[],e=0;e<t.length;e++)i(fvphtml.pointers[e])})}(jQuery),jQuery(document).ready(function(t){"use strict";t(fvphtml.prefix+"help-link, .help-link").click(function(){t("#contextual-help-link").trigger("click")})});
|
1 |
+
!function(t){"use strict";var i=function(){var i=t(this),e=i.siblings("[data-hook='"+i.data("hook")+"']");i.hasClass("active")&&e.hasClass("active")||(i.siblings(fvphtml.prefix+"tab-title").removeClass("active"),i.siblings(fvphtml.prefix+"tab-body").slideUp(),i.addClass("active"),e.addClass("active").slideDown())};t(document).ready(function(){for(var e=t(fvphtml.prefix+"tabs"),r=e.length-1;r>=0;r--){var n=t(e[r]),a=n.children(fvphtml.prefix+"tab-title"),s=n.children(fvphtml.prefix+"tab-body");a.first().addClass("active"),s.first().addClass("active"),n.prepend(a),s.filter(":not(.active)").hide(),n.children(fvphtml.prefix+"tab-title").click(i)}})}(jQuery),function(t){"use strict";var i={},e=function(){for(var e=t(this),r=i[e.attr("name")],n=0;n<r.length;n++){var a=t(r[n]),s=a.data("names").split("|"),l=(""+a.data("values")).split("|"),o=t.inArray(e.attr("name"),s);if(-1!==o){var c=!0,f=l[o],h="checkbox"!==e.attr("type")||e.prop("checked")?e.val():null;"string"==typeof f&&"!"===f.charAt(0)&&(c=!1,f=f.substr(1)),c&&h!==f||!c&&h===f?a.addClass("hidden"):a.removeClass("hidden")}}};t(document).ready(function(){for(var r=t(fvphtml.prefix+"conditional"),n=0;n<r.length;n++)for(var a=t(r[n]),s=a.data("names").split("|"),l=0;l<s.length;l++){var o=s[l];i.hasOwnProperty(o)||(i[o]=[]),i[o].push(a)}for(var c in i){var f=t("[name='"+c+"']");f.change(e)}})}(jQuery),function(t){"use strict";function i(t){t=t?t:"#fffff",t="#"===t.charAt(0)?t.substr(1):t;var i=parseInt(t.substr(0,2),16),e=parseInt(t.substr(2,2),16),r=parseInt(t.substr(4,2),16),n=(299*i+587*e+114*r)/1e3;return n>=128?"#000":"#fff"}function e(t){return 3===t.length&&"#"!==t.charAt(0)&&(t="#"+t),4===t.length&&"#"===t.charAt(0)&&(t="#"+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3)),7===t.length?t:!1}var r,n=function(r,n){var a=t(this),s=n&&n.color?n.color.toString():a.val();s=e(s),a.css({backgroundColor:s?s:"#ffffff",color:i(s)}),s?a.siblings(fvphtml.prefix+"reset").show():a.siblings(fvphtml.prefix+"reset").hide()},a=function(){var i=t(this);r.not(i).iris("hide"),i.iris("show")},s=function(i){i&&i.preventDefault();var e=t(this);""===e.val()&&e.siblings(fvphtml.prefix+"reset").hide()},l=function(i){i&&i.preventDefault(),r.iris("hide"),t(this).siblings(fvphtml.prefix+"colorpicker").val("").each(n)};t(document).ready(function(){r=t(fvphtml.prefix+"colorpicker"),r.iris({change:n}),r.bind("input",n),r.click(a),r.blur(s),r.siblings(fvphtml.prefix+"reset").click(l),r.each(n)})}(jQuery),function(t){"use strict";function i(i){var r=i.title||"",n=i.content||"",a=i.position||{edge:"right",align:"middle"};t(i.target).pointer({pointer_id:i.identifier,content:"<h3>"+r+"</h3><p>"+n+"</p>",position:a,close:e}).pointer("open")}var e=function(){var i=t(this).data("wpPointer").options.pointer_id;t.post(ajaxurl,{pointer:i,action:"dismiss-wp-pointer"})};t(document).ready(function(){for(var t=fvphtml.pointers||[],e=0;e<t.length;e++)i(fvphtml.pointers[e])})}(jQuery),jQuery(document).ready(function(t){"use strict";t(fvphtml.prefix+"help-link, .help-link").click(function(){t("#contextual-help-link").trigger("click")})});
|
js/post.js
CHANGED
@@ -108,6 +108,10 @@
|
|
108 |
|
109 |
// new video data
|
110 |
} else {
|
|
|
|
|
|
|
|
|
111 |
$container
|
112 |
.css({height: ''})
|
113 |
.html(data.video);
|
108 |
|
109 |
// new video data
|
110 |
} else {
|
111 |
+
// Suppress autoplay in admin interface. Cannot do this on the server
|
112 |
+
// side because ajax requests from frontend and backend look the same.
|
113 |
+
data.video = data.video.replace(/autoplay(?:=.?)?&?/i, '');
|
114 |
+
|
115 |
$container
|
116 |
.css({height: ''})
|
117 |
.html(data.video);
|
js/post.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){"use strict";function t(t){var i=e("#postimagediv .inside");t=t||i.html(),i.html(t),0<i.find(".fvp-remove-image").length&&(i.find("#remove-post-thumbnail").parent("p").hide(),i.find(".fvp-remove-image").parent("p").show())}function i(e){n(e,!0)}function a(i){i.preventDefault(),r.css({backgroundImage:f}),e.post(ajaxurl,{action:"fvp_remove_img",id:e("#post_ID").val(),fvp_nonce:e("#fvp_nonce").val()},function(e){e.success&&(t(e.data),r.css({backgroundImage:c}))},"json")}function n(i,a){if(i.preventDefault(),a=a||!1,o.val(e.trim(o.val())).trigger("autosize"),s!==o.val()||a){r.css({backgroundImage:f}),s=o.val();var n={action:"fvp_save",id:e("#post_ID").val(),fvp_nonce:e("#fvp_nonce").val(),fvp_video:o.val(),fvp_set_featimg:a};e.post(ajaxurl,n,function(i){if(!i.success)return!1;var a=i.data,n=e(".fvp-current-video");r.css({backgroundImage:c}),"remove"===a.task?n.css({height:n.height()}).html("").animate({height:0}):n.css({height:""}).html(a.video),t(a.img)},"json")}}var o,r,s,c,v=fvpPost,f="url("+v.loading_gif+")";e(document).ready(function(){o=e(".fvp-video"),r=o.siblings(".fvp-video-choose").children(".fvp-media-icon"),s=o.val(),c=r.css("backgroundImage"),o.blur(n),o.autosize().trigger("blur").keypress(function(t){13===t.keyCode&&(t.preventDefault(),e(this).trigger("blur"))}).click(function(){e(this).select()}),e("#postimagediv").on("click",".fvp-set-image",i).on("click",".fvp-remove-image",a),t();var v,f={frame:function(){return this._frame?this._frame:(this._frame=wp.media({title:v.data("title"),library:{type:"video"},button:{text:v.data("button")},multiple:!1}),this._frame.on("open",this.updateFrame).state("library").on("select",this.select),this._frame)},select:function(){var t=this.get("selection"),i="url",a=v.data("target");e(a).val(t.pluck(i)).change().trigger("blur")},updateFrame:function(){},init:function(){e("#wpbody").on("click",".fvp-video-choose",function(t){t.preventDefault(),v=e(this).closest(".fvp-input-wrapper"),f.frame().open()})}};f.init()})}(jQuery);
|
1 |
+
!function(e){"use strict";function t(t){var i=e("#postimagediv .inside");t=t||i.html(),i.html(t),0<i.find(".fvp-remove-image").length&&(i.find("#remove-post-thumbnail").parent("p").hide(),i.find(".fvp-remove-image").parent("p").show())}function i(e){n(e,!0)}function a(i){i.preventDefault(),r.css({backgroundImage:f}),e.post(ajaxurl,{action:"fvp_remove_img",id:e("#post_ID").val(),fvp_nonce:e("#fvp_nonce").val()},function(e){e.success&&(t(e.data),r.css({backgroundImage:c}))},"json")}function n(i,a){if(i.preventDefault(),a=a||!1,o.val(e.trim(o.val())).trigger("autosize"),s!==o.val()||a){r.css({backgroundImage:f}),s=o.val();var n={action:"fvp_save",id:e("#post_ID").val(),fvp_nonce:e("#fvp_nonce").val(),fvp_video:o.val(),fvp_set_featimg:a};e.post(ajaxurl,n,function(i){if(!i.success)return!1;var a=i.data,n=e(".fvp-current-video");r.css({backgroundImage:c}),"remove"===a.task?n.css({height:n.height()}).html("").animate({height:0}):(a.video=a.video.replace(/autoplay(?:=.?)?&?/i,""),n.css({height:""}).html(a.video)),t(a.img)},"json")}}var o,r,s,c,v=fvpPost,f="url("+v.loading_gif+")";e(document).ready(function(){o=e(".fvp-video"),r=o.siblings(".fvp-video-choose").children(".fvp-media-icon"),s=o.val(),c=r.css("backgroundImage"),o.blur(n),o.autosize().trigger("blur").keypress(function(t){13===t.keyCode&&(t.preventDefault(),e(this).trigger("blur"))}).click(function(){e(this).select()}),e("#postimagediv").on("click",".fvp-set-image",i).on("click",".fvp-remove-image",a),t();var v,f={frame:function(){return this._frame?this._frame:(this._frame=wp.media({title:v.data("title"),library:{type:"video"},button:{text:v.data("button")},multiple:!1}),this._frame.on("open",this.updateFrame).state("library").on("select",this.select),this._frame)},select:function(){var t=this.get("selection"),i="url",a=v.data("target");e(a).val(t.pluck(i)).change().trigger("blur")},updateFrame:function(){},init:function(){e("#wpbody").on("click",".fvp-video-choose",function(t){t.preventDefault(),v=e(this).closest(".fvp-input-wrapper"),f.frame().open()})}};f.init()})}(jQuery);
|
php/class-backend.php
CHANGED
@@ -329,7 +329,9 @@ class FVP_Backend extends Featured_Video_Plus {
|
|
329 |
// there was a video and we want to delete it
|
330 |
if ( ! empty( $meta['full'] ) && empty( $url ) ) {
|
331 |
delete_post_meta( $post['id'], '_fvp_video' );
|
332 |
-
|
|
|
|
|
333 |
return false;
|
334 |
}
|
335 |
|
@@ -402,8 +404,18 @@ class FVP_Backend extends Featured_Video_Plus {
|
|
402 |
'author' => ! empty( $raw->author_name ) ? $raw->author_name : null,
|
403 |
'description' => ! empty( $raw->description ) ? $raw->description : null,
|
404 |
'img_url' => ! empty( $raw->thumbnail_url ) ? $raw->thumbnail_url : null,
|
405 |
-
'filename' => ! empty( $raw->title ) ?
|
406 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
407 |
}
|
408 |
|
409 |
$data['parameters'] = $this->oembed->get_args( $url, $provider );
|
@@ -447,22 +459,33 @@ class FVP_Backend extends Featured_Video_Plus {
|
|
447 |
$img = self::get_post_by_custom_meta( '_fvp_image_url', $data['img_url'] );
|
448 |
|
449 |
if ( empty( $img ) ) {
|
450 |
-
$file = array(
|
451 |
-
|
452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
453 |
|
454 |
-
//
|
455 |
-
$file['tmp_name']
|
456 |
-
|
457 |
-
|
|
|
|
|
458 |
}
|
459 |
|
460 |
// Insert into media library
|
461 |
-
$
|
462 |
-
|
463 |
false
|
464 |
);
|
465 |
-
$
|
|
|
|
|
466 |
$img = media_handle_sideload( $file, $post_id );
|
467 |
|
468 |
// save picture source url in post meta
|
@@ -488,13 +511,15 @@ class FVP_Backend extends Featured_Video_Plus {
|
|
488 |
* the FVP image attachment ID.
|
489 |
*/
|
490 |
private function delete_featured_image( $post_id, $meta ) {
|
|
|
|
|
|
|
|
|
|
|
491 |
if ( empty( $meta['img'] ) ) {
|
492 |
return false;
|
493 |
}
|
494 |
|
495 |
-
// Unset featured image if it is from this video
|
496 |
-
delete_post_meta( $post_id, '_thumbnail_id', $meta['img'] );
|
497 |
-
|
498 |
// Check if other posts use the image, if not we can delete it completely
|
499 |
$other = self::get_post_by_custom_meta( '_thumbnail_id', $meta['img'] );
|
500 |
if ( empty( $other ) && ! empty( $meta['img_url'] ) ) {
|
@@ -739,4 +764,23 @@ class FVP_Backend extends Featured_Video_Plus {
|
|
739 |
}
|
740 |
|
741 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
742 |
}
|
329 |
// there was a video and we want to delete it
|
330 |
if ( ! empty( $meta['full'] ) && empty( $url ) ) {
|
331 |
delete_post_meta( $post['id'], '_fvp_video' );
|
332 |
+
if ( get_post_thumbnail_id( $post['id'] ) == $meta['img'] ) {
|
333 |
+
$this->delete_featured_image( $post['id'], $meta );
|
334 |
+
}
|
335 |
return false;
|
336 |
}
|
337 |
|
404 |
'author' => ! empty( $raw->author_name ) ? $raw->author_name : null,
|
405 |
'description' => ! empty( $raw->description ) ? $raw->description : null,
|
406 |
'img_url' => ! empty( $raw->thumbnail_url ) ? $raw->thumbnail_url : null,
|
407 |
+
'filename' => ! empty( $raw->title ) ? $raw->title : null,
|
408 |
);
|
409 |
+
|
410 |
+
switch ( $provider ) {
|
411 |
+
case 'dailymotion':
|
412 |
+
$data['id'] = $this->oembed->get_video_id( $url );
|
413 |
+
$img_url = $this->oembed->get_thumbnail_url( $provider, $data['id'] );
|
414 |
+
if ( false !== $img_url ) {
|
415 |
+
$data['img_url'] = $img_url;
|
416 |
+
}
|
417 |
+
break;
|
418 |
+
}
|
419 |
}
|
420 |
|
421 |
$data['parameters'] = $this->oembed->get_args( $url, $provider );
|
459 |
$img = self::get_post_by_custom_meta( '_fvp_image_url', $data['img_url'] );
|
460 |
|
461 |
if ( empty( $img ) ) {
|
462 |
+
$file = array();
|
463 |
+
|
464 |
+
// Handle YouTube max res image
|
465 |
+
if ( false !== strpos( $data['img_url'], 'hqdefault' ) ) {
|
466 |
+
$file['tmp_name'] = download_url( str_replace(
|
467 |
+
'hqdefault',
|
468 |
+
'maxresdefault',
|
469 |
+
$data['img_url']
|
470 |
+
) );
|
471 |
+
}
|
472 |
|
473 |
+
// Handle all others or try normal youtube thumb again on error.
|
474 |
+
if ( ! isset($file['tmp_name'] ) || is_wp_error( $file['tmp_name'] ) ) {
|
475 |
+
$file['tmp_name'] = download_url( $data['img_url'] );
|
476 |
+
if ( is_wp_error( $file['tmp_name'] ) ) {
|
477 |
+
return false;
|
478 |
+
}
|
479 |
}
|
480 |
|
481 |
// Insert into media library
|
482 |
+
$type = image_type_to_extension(
|
483 |
+
self::get_image_type( $file['tmp_name'] ),
|
484 |
false
|
485 |
);
|
486 |
+
$title = ! empty( $data['title'] ) ?
|
487 |
+
$data['title'] : basename( $data['img_url'], $type );
|
488 |
+
$file['name'] = sanitize_file_name( $title . '.' . $type );
|
489 |
$img = media_handle_sideload( $file, $post_id );
|
490 |
|
491 |
// save picture source url in post meta
|
511 |
* the FVP image attachment ID.
|
512 |
*/
|
513 |
private function delete_featured_image( $post_id, $meta ) {
|
514 |
+
// Remove featured image.
|
515 |
+
delete_post_meta( $post_id, '_thumbnail_id' );
|
516 |
+
|
517 |
+
// If the image is a featured video thumbnail we might want to remove it
|
518 |
+
// completely from the media library.
|
519 |
if ( empty( $meta['img'] ) ) {
|
520 |
return false;
|
521 |
}
|
522 |
|
|
|
|
|
|
|
523 |
// Check if other posts use the image, if not we can delete it completely
|
524 |
$other = self::get_post_by_custom_meta( '_thumbnail_id', $meta['img'] );
|
525 |
if ( empty( $other ) && ! empty( $meta['img_url'] ) ) {
|
764 |
}
|
765 |
|
766 |
|
767 |
+
/**
|
768 |
+
* exif_imagetype function is not available on all systems - fallback wrapper.
|
769 |
+
*
|
770 |
+
* @param {string} $filename
|
771 |
+
* @return Image mime type.
|
772 |
+
*/
|
773 |
+
private static function get_image_type( $filename ) {
|
774 |
+
if ( function_exists( 'exif_imagetype' ) ) {
|
775 |
+
return exif_imagetype( $filename );
|
776 |
+
} else {
|
777 |
+
$img = getimagesize( $filename );
|
778 |
+
if ( !empty( $img[2] ) ) {
|
779 |
+
return image_type_to_mime_type( $img[2] );
|
780 |
+
}
|
781 |
+
}
|
782 |
+
return false;
|
783 |
+
}
|
784 |
+
|
785 |
+
|
786 |
}
|
php/class-main.php
CHANGED
@@ -43,9 +43,7 @@ class Featured_Video_Plus {
|
|
43 |
$general = ! empty( $defaults['general'] ) ? $defaults['general'] : array();
|
44 |
|
45 |
// Autoplay option. Suppressed when viewing admin.
|
46 |
-
$general['autoplay'] =
|
47 |
-
( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || ! is_admin() ) &&
|
48 |
-
! empty( $general['autoplay'] ) && $general['autoplay'] ? '1' : null;
|
49 |
|
50 |
// Responsive scaling option. Not used when viewing the admin screen.
|
51 |
$responsive =
|
@@ -86,7 +84,7 @@ class Featured_Video_Plus {
|
|
86 |
break;
|
87 |
|
88 |
case 'raw':
|
89 |
-
$embed = $meta['full'];
|
90 |
break;
|
91 |
|
92 |
default:
|
@@ -190,6 +188,48 @@ class Featured_Video_Plus {
|
|
190 |
}
|
191 |
|
192 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
/**
|
194 |
* Gets a post by an meta_key meta_value pair. Returns it's post_id.
|
195 |
*
|
43 |
$general = ! empty( $defaults['general'] ) ? $defaults['general'] : array();
|
44 |
|
45 |
// Autoplay option. Suppressed when viewing admin.
|
46 |
+
$general['autoplay'] = self::parse_autoplay_options($options) ? true : null;
|
|
|
|
|
47 |
|
48 |
// Responsive scaling option. Not used when viewing the admin screen.
|
49 |
$responsive =
|
84 |
break;
|
85 |
|
86 |
case 'raw':
|
87 |
+
$embed = do_shortcode( $meta['full'] );
|
88 |
break;
|
89 |
|
90 |
default:
|
188 |
}
|
189 |
|
190 |
|
191 |
+
/**
|
192 |
+
* Parse the autoplay options to determine if video should or should not
|
193 |
+
* autoplay.
|
194 |
+
*
|
195 |
+
* @param {assoic} $options
|
196 |
+
* @return {bool}
|
197 |
+
*/
|
198 |
+
private static function parse_autoplay_options( $options ) {
|
199 |
+
if ( empty( $options['autoplay'] ) ) {
|
200 |
+
return false;
|
201 |
+
}
|
202 |
+
|
203 |
+
if (
|
204 |
+
! empty( $options['autoplay']['always'] ) &&
|
205 |
+
$options['autoplay']['always']
|
206 |
+
) {
|
207 |
+
return true;
|
208 |
+
};
|
209 |
+
|
210 |
+
$mode = ! empty( $options['mode'] ) ? $options['mode'] : null;
|
211 |
+
//$islazy = 'overlay' === $mode || 'dynamic' === $mode;
|
212 |
+
$isajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
|
213 |
+
|
214 |
+
if (
|
215 |
+
! empty( $options['autoplay']['lazy'] ) &&
|
216 |
+
$options['autoplay']['lazy'] &&
|
217 |
+
$isajax
|
218 |
+
) {
|
219 |
+
return true;
|
220 |
+
}
|
221 |
+
|
222 |
+
if (
|
223 |
+
! empty( $options['autoplay']['single'] ) &&
|
224 |
+
$options['autoplay']['single'] &&
|
225 |
+
is_single()
|
226 |
+
) {
|
227 |
+
return true;
|
228 |
+
}
|
229 |
+
|
230 |
+
return false;
|
231 |
+
}
|
232 |
+
|
233 |
/**
|
234 |
* Gets a post by an meta_key meta_value pair. Returns it's post_id.
|
235 |
*
|
php/class-oembed.php
CHANGED
@@ -259,6 +259,64 @@ class FVP_oEmbed {
|
|
259 |
}
|
260 |
|
261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
262 |
/**
|
263 |
* Only keeps key value pairs of the source $array if their keys are listed
|
264 |
* in the $filter array.
|
259 |
}
|
260 |
|
261 |
|
262 |
+
/**
|
263 |
+
* Get video id from url.
|
264 |
+
*
|
265 |
+
* @param {string} $url
|
266 |
+
* @return {string/bool} Video ID or false on error.
|
267 |
+
*/
|
268 |
+
public function get_video_id( $url ) {
|
269 |
+
if ( empty( $url ) ) {
|
270 |
+
return false;
|
271 |
+
}
|
272 |
+
|
273 |
+
$provider = $this->get_provider_name( $url );
|
274 |
+
if ( empty( $provider ) ) {
|
275 |
+
return false;
|
276 |
+
}
|
277 |
+
|
278 |
+
switch ( $provider ) {
|
279 |
+
case 'dailymotion':
|
280 |
+
return strtok( basename( $url ), '_' );
|
281 |
+
break;
|
282 |
+
}
|
283 |
+
|
284 |
+
return false;
|
285 |
+
}
|
286 |
+
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Get video thumbnail url by provider and video id.
|
290 |
+
*
|
291 |
+
* @param {string} $provider
|
292 |
+
* @param {string} $id
|
293 |
+
* @return {string/bool} Video URL or false on error.
|
294 |
+
*/
|
295 |
+
public function get_thumbnail_url( $provider, $id ) {
|
296 |
+
static $thumbnail_apis = array(
|
297 |
+
'dailymotion' =>
|
298 |
+
'https://api.dailymotion.com/video/%s?fields=thumbnail_url,poster_url',
|
299 |
+
);
|
300 |
+
|
301 |
+
if ( empty( $provider ) || empty( $id ) ) {
|
302 |
+
return false;
|
303 |
+
}
|
304 |
+
|
305 |
+
$result = @file_get_contents( sprintf( $thumbnail_apis[$provider], $id ) );
|
306 |
+
if ( ! empty( $result ) ) {
|
307 |
+
switch ( $provider ) {
|
308 |
+
case 'dailymotion':
|
309 |
+
$data = json_decode( $result, true );
|
310 |
+
return ! empty( $data['thumbnail_url'] ) ?
|
311 |
+
$data['thumbnail_url'] : $data['poster_url'];
|
312 |
+
break;
|
313 |
+
}
|
314 |
+
}
|
315 |
+
|
316 |
+
return false;
|
317 |
+
}
|
318 |
+
|
319 |
+
|
320 |
/**
|
321 |
* Only keeps key value pairs of the source $array if their keys are listed
|
322 |
* in the $filter array.
|
php/class-settings.php
CHANGED
@@ -333,6 +333,7 @@ class FVP_Settings {
|
|
333 |
*/
|
334 |
public function arguments() {
|
335 |
$options = get_option( 'fvp-settings' );
|
|
|
336 |
$args = ! empty( $options['default_args'] ) ? $options['default_args'] : array();
|
337 |
$vimeo = ! empty( $args['vimeo'] ) ? $args['vimeo'] : array();
|
338 |
$youtube = ! empty( $args['youtube'] ) ? $args['youtube'] : array();
|
@@ -349,11 +350,29 @@ class FVP_Settings {
|
|
349 |
FVP_HTML::checkboxes(
|
350 |
'fvp-settings[default_args][general]',
|
351 |
array(
|
352 |
-
'
|
353 |
-
'loop' => esc_html__( 'Loop', 'featured-video-plus' )
|
354 |
),
|
355 |
! empty( $args['general'] ) ? $args['general'] : array()
|
356 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
357 |
),
|
358 |
|
359 |
'vimeo' => array(
|
@@ -401,6 +420,10 @@ class FVP_Settings {
|
|
401 |
'label' => esc_html__( 'White highlight color', 'featured-video-plus' )
|
402 |
),
|
403 |
'modestbranding' => esc_html__( 'Hide YouTube logo', 'featured-video-plus' ),
|
|
|
|
|
|
|
|
|
404 |
'rel' => array(
|
405 |
'value' => '0',
|
406 |
'label' => esc_html__( 'Hide related videos', 'featured-video-plus' )
|
@@ -526,10 +549,14 @@ class FVP_Settings {
|
|
526 |
'responsive' => 'BOOLEAN',
|
527 |
'width' => $patterns['number'],
|
528 |
),
|
|
|
|
|
|
|
|
|
|
|
529 |
'default_args' => array(
|
530 |
'general' => array(
|
531 |
-
'
|
532 |
-
'loop' => $patterns['digit'],
|
533 |
),
|
534 |
'vimeo' => array(
|
535 |
'portrait' => $patterns['digit'],
|
@@ -541,6 +568,7 @@ class FVP_Settings {
|
|
541 |
'theme' => $patterns['word'],
|
542 |
'color' => $patterns['word'],
|
543 |
'modestbranding' => $patterns['digit'],
|
|
|
544 |
'fs' => $patterns['digit'],
|
545 |
'rel' => $patterns['digit'],
|
546 |
'showinfo' => $patterns['digit'],
|
333 |
*/
|
334 |
public function arguments() {
|
335 |
$options = get_option( 'fvp-settings' );
|
336 |
+
$autoplay = ! empty( $options['autoplay'] ) ? $options['autoplay'] : array();
|
337 |
$args = ! empty( $options['default_args'] ) ? $options['default_args'] : array();
|
338 |
$vimeo = ! empty( $args['vimeo'] ) ? $args['vimeo'] : array();
|
339 |
$youtube = ! empty( $args['youtube'] ) ? $args['youtube'] : array();
|
350 |
FVP_HTML::checkboxes(
|
351 |
'fvp-settings[default_args][general]',
|
352 |
array(
|
353 |
+
'loop' => esc_html__( 'Loop', 'featured-video-plus' ),
|
|
|
354 |
),
|
355 |
! empty( $args['general'] ) ? $args['general'] : array()
|
356 |
),
|
357 |
+
FVP_HTML::radios(
|
358 |
+
'fvp-settings[autoplay][always]',
|
359 |
+
array(
|
360 |
+
'1' => esc_html__( 'Always autoplay.', 'featured-video-plus' ),
|
361 |
+
'0' => esc_html__( 'Autoplay when...', 'featured-video-plus' ),
|
362 |
+
),
|
363 |
+
! empty( $autoplay['always'] ) ? $autoplay['always'] : '0'
|
364 |
+
),
|
365 |
+
FVP_HTML::checkboxes(
|
366 |
+
'fvp-settings[autoplay]',
|
367 |
+
array(
|
368 |
+
'lazy' => esc_html__( '... lazy loading videos.', 'featured-video-plus' ),
|
369 |
+
'single' => sprintf(
|
370 |
+
esc_html__( '... viewing %ssingle%s posts and pages.', 'featured-video-plus' ),
|
371 |
+
'<a href="http://codex.wordpress.org/Function_Reference/is_single" target="_blank">', '</a>'
|
372 |
+
),
|
373 |
+
),
|
374 |
+
! empty( $autoplay ) ? $autoplay : array()
|
375 |
+
)
|
376 |
),
|
377 |
|
378 |
'vimeo' => array(
|
420 |
'label' => esc_html__( 'White highlight color', 'featured-video-plus' )
|
421 |
),
|
422 |
'modestbranding' => esc_html__( 'Hide YouTube logo', 'featured-video-plus' ),
|
423 |
+
'iv_load_policy' => array(
|
424 |
+
'value' => '3',
|
425 |
+
'label' => esc_html__( 'Hide annotations', 'featured-video-plus' )
|
426 |
+
),
|
427 |
'rel' => array(
|
428 |
'value' => '0',
|
429 |
'label' => esc_html__( 'Hide related videos', 'featured-video-plus' )
|
549 |
'responsive' => 'BOOLEAN',
|
550 |
'width' => $patterns['number'],
|
551 |
),
|
552 |
+
'autoplay' => array(
|
553 |
+
'always' => 'BOOLEAN',
|
554 |
+
'lazy' => 'BOOLEAN',
|
555 |
+
'single' => 'BOOLEAN',
|
556 |
+
),
|
557 |
'default_args' => array(
|
558 |
'general' => array(
|
559 |
+
'loop' => $patterns['digit'],
|
|
|
560 |
),
|
561 |
'vimeo' => array(
|
562 |
'portrait' => $patterns['digit'],
|
568 |
'theme' => $patterns['word'],
|
569 |
'color' => $patterns['word'],
|
570 |
'modestbranding' => $patterns['digit'],
|
571 |
+
'iv_load_policy' => $patterns['digit'],
|
572 |
'fs' => $patterns['digit'],
|
573 |
'rel' => $patterns['digit'],
|
574 |
'showinfo' => $patterns['digit'],
|
php/inc-upgrade.php
CHANGED
@@ -207,6 +207,19 @@ switch ( $version ) {
|
|
207 |
$options['conditions'][ $key ] = (bool) $value;
|
208 |
}
|
209 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
default:
|
212 |
update_option( 'fvp-settings', $options );
|
207 |
$options['conditions'][ $key ] = (bool) $value;
|
208 |
}
|
209 |
|
210 |
+
case '2.1.2':
|
211 |
+
$options['autoplay'] = array(
|
212 |
+
'lazy' => true
|
213 |
+
);
|
214 |
+
|
215 |
+
if (
|
216 |
+
! empty( $options['default_args']['general']['autoplay'] ) &&
|
217 |
+
$options['default_args']['general']['autoplay']
|
218 |
+
) {
|
219 |
+
$options['autoplay']['always'] = true;
|
220 |
+
}
|
221 |
+
unset( $options['default_args']['general']['autoplay'] );
|
222 |
+
|
223 |
|
224 |
default:
|
225 |
update_option( 'fvp-settings', $options );
|
readme.txt
CHANGED
@@ -10,7 +10,7 @@ License: GPLv2 or later
|
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
Requires at least: 3.7
|
12 |
Tested up to: 4.2.2
|
13 |
-
Stable tag: 2.
|
14 |
|
15 |
Add Featured Videos to your posts and pages. Works like magic with most themes which use Featured Images. Local Media, YouTube, Vimeo and many more.
|
16 |
|
@@ -107,18 +107,29 @@ Yes, please! Check out the public [Featured Video Plus Translation Project](http
|
|
107 |
|
108 |
== Changelog ==
|
109 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
= 2.1.2: 2015-06-16 =
|
111 |
* Fix bug which resulted in missing featured images when a post did not have a featured video. ([*](https://wordpress.org/support/topic/cookie-send-to-you-and-video-yes-image-no), [*](https://wordpress.org/support/topic/version-221-featured-image-not-diplayed))
|
112 |
|
113 |
= 2.1.1: 2015-06-15 =
|
114 |
-
* Fix play and loading featured image overlay for some themes ([*](https://wordpress.org/support/topic/play-icon-missing))
|
115 |
* Fix broken `remove featured image` link. ([*](https://wordpress.org/support/topic/cant-remove-featured-image-2), [*](https://wordpress.org/support/topic/version-210-conflict-with-wp-featured-image), [*](https://wordpress.org/support/topic/fvp-not-working-after-210-update))
|
116 |
|
117 |
= 2.1.0: 2015-06-11 =
|
118 |
* Display options are now chained using OR - if one of them holds, the replace mode is used.
|
119 |
-
* Added `always use replace mode when viewing single posts and pages` option, was implicitly true since 2.0.0. ([*](https://wordpress.org/support/topic/featured-video-overrides-featured-image))
|
120 |
-
* Fixed undefined warnings when using `WP_DEBUG
|
121 |
-
* Fixed double-wrapped .post-thumbnails ([*](https://wordpress.org/support/topic/video-no-longer-appearing))
|
122 |
* Lazy loading a video no longer breaks other videos. ([*](https://wordpress.org/support/topic/blank-screen-after-the-video-is-played))
|
123 |
|
124 |
= 2.0.3: 2015-06-01 =
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
Requires at least: 3.7
|
12 |
Tested up to: 4.2.2
|
13 |
+
Stable tag: 2.2.0
|
14 |
|
15 |
Add Featured Videos to your posts and pages. Works like magic with most themes which use Featured Images. Local Media, YouTube, Vimeo and many more.
|
16 |
|
107 |
|
108 |
== Changelog ==
|
109 |
|
110 |
+
= 2.2.0: 2015-07-20 =
|
111 |
+
* Shortcodes can now be used as featured content (e.g. `[gallery]`).
|
112 |
+
* Added fine tuned autoplay options.
|
113 |
+
* New option for hiding YouTube video annotations. ([*](https://wordpress.org/support/topic/add-feature-to-hide-youtube-screen-annotation))
|
114 |
+
* Expose a JS function to manually re-initialize the plugin's JS behavior like responsive sizing and overlays. Specifically interesting when using FVP in combination with a infinite scroll plugin. ([*](https://wordpress.org/support/topic/open-video-overlay-when-featured-image-is-clicked-in-loop))
|
115 |
+
* Fetch high quality thumbnails for YouTube and Dailymotion. ([*](https://wordpress.org/support/topic/featured-image-size-42))
|
116 |
+
* Fix bug which suppressed the removal of foreign featured images. ([*](https://wordpress.org/support/topic/cannot-remove-featured-image-if-a-featured-video-is-set))
|
117 |
+
* Fix 'undefined function exif_imagetype' error. ([*](https://wordpress.org/support/topic/cant-add-featured-video-1), [*](https://wordpress.org/support/topic/infinite-spinning-wheel-all-previous-videos-not-working-anymore), [*](https://wordpress.org/support/topic/error-message-444))
|
118 |
+
* Implement a workaround for a bug with iframes in Google Chrome, see [[0](https://code.google.com/p/chromium/issues/detail?id=395533)], [[1](https://code.google.com/p/chromium/issues/detail?id=395791)]. ([*](https://wordpress.org/support/topic/found-a-huge-critical-bug-videos-vanish-after-using-back))
|
119 |
+
* Fix bug which resulted in a invisible video playing in the background when using autoplay and overlay mode. ([*](https://wordpress.org/support/topic/video-overlay-with-autoplay-causes-two-videos-to-play))
|
120 |
+
|
121 |
= 2.1.2: 2015-06-16 =
|
122 |
* Fix bug which resulted in missing featured images when a post did not have a featured video. ([*](https://wordpress.org/support/topic/cookie-send-to-you-and-video-yes-image-no), [*](https://wordpress.org/support/topic/version-221-featured-image-not-diplayed))
|
123 |
|
124 |
= 2.1.1: 2015-06-15 =
|
125 |
+
* Fix play and loading featured image overlay for some themes. ([*](https://wordpress.org/support/topic/play-icon-missing))
|
126 |
* Fix broken `remove featured image` link. ([*](https://wordpress.org/support/topic/cant-remove-featured-image-2), [*](https://wordpress.org/support/topic/version-210-conflict-with-wp-featured-image), [*](https://wordpress.org/support/topic/fvp-not-working-after-210-update))
|
127 |
|
128 |
= 2.1.0: 2015-06-11 =
|
129 |
* Display options are now chained using OR - if one of them holds, the replace mode is used.
|
130 |
+
* Added `always use replace mode when viewing single posts and pages` option, was implicitly true since 2.0.0. ([*](https://wordpress.org/support/topic/featured-video-overrides-featured-image))
|
131 |
+
* Fixed undefined warnings when using `WP_DEBUG`. ([*](https://wordpress.org/support/topic/debug-error-16))
|
132 |
+
* Fixed double-wrapped .post-thumbnails. ([*](https://wordpress.org/support/topic/video-no-longer-appearing))
|
133 |
* Lazy loading a video no longer breaks other videos. ([*](https://wordpress.org/support/topic/blank-screen-after-the-video-is-played))
|
134 |
|
135 |
= 2.0.3: 2015-06-01 =
|