Version Description
- New option: Content URL > decode HTML entities; conflict fixes: Jetpack + WooCommerce lightbox, Save Image Dimensions + svg images; style issue: Flatsome + WooCommerce gallery.
Download this release
Release Info
Developer | marceljm |
Plugin | Featured Image From URL |
Version | 3.3.3 |
Comparing to | |
See all releases |
Code changes from version 3.3.2 to 3.3.3
- admin/api.php +5 -0
- admin/html/js/menu.js +6 -5
- admin/html/menu.html +27 -0
- admin/html/support-data.html +1 -0
- admin/menu.php +4 -1
- admin/strings.php +3 -0
- featured-image-from-url.php +2 -1
- includes/attachment.php +8 -1
- includes/external-post.php +5 -5
- includes/html/js/image.js +14 -14
- includes/html/js/lazySizesConfig.js +3 -2
- includes/thumbnail.php +1 -0
- includes/util.php +10 -0
- includes/woo.php +4 -2
- readme.txt +8 -8
admin/api.php
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
|
|
3 |
function fifu_enable_fake_api(WP_REST_Request $request) {
|
4 |
update_option('fifu_fake_stop', false, 'no');
|
5 |
fifu_enable_fake();
|
1 |
<?php
|
2 |
|
3 |
+
function fifu_is_local() {
|
4 |
+
$query = 'http://localhost';
|
5 |
+
return substr(get_home_url(), 0, strlen($query)) === $query;
|
6 |
+
}
|
7 |
+
|
8 |
function fifu_enable_fake_api(WP_REST_Request $request) {
|
9 |
update_option('fifu_fake_stop', false, 'no');
|
10 |
fifu_enable_fake();
|
admin/html/js/menu.js
CHANGED
@@ -229,12 +229,13 @@ function fifu_save_dimensions_all_js() {
|
|
229 |
var attempts = 0;
|
230 |
var image = new Image();
|
231 |
jQuery(image).attr('src', data[i]['guid']);
|
|
|
232 |
|
233 |
var poll = setInterval(function () {
|
234 |
-
if (image.naturalWidth || attempts > 100) {
|
235 |
attempts = 0;
|
236 |
clearInterval(poll);
|
237 |
-
fifu_get_sizes(image, data[i]['ID'], data[i]['guid']);
|
238 |
image = null;
|
239 |
i++;
|
240 |
if (i < data.length) {
|
@@ -274,9 +275,9 @@ function fifu_save_dimensions_all_js() {
|
|
274 |
});
|
275 |
}
|
276 |
|
277 |
-
function fifu_get_sizes($, att_id) {
|
278 |
-
width = jQuery($)[0].naturalWidth;
|
279 |
-
height = jQuery($)[0].naturalHeight;
|
280 |
|
281 |
if (width == 1 && height == 1)
|
282 |
return;
|
229 |
var attempts = 0;
|
230 |
var image = new Image();
|
231 |
jQuery(image).attr('src', data[i]['guid']);
|
232 |
+
is_svg = data[i]['guid'].endsWith('.svg');
|
233 |
|
234 |
var poll = setInterval(function () {
|
235 |
+
if (image.naturalWidth || attempts > 100 || is_svg) {
|
236 |
attempts = 0;
|
237 |
clearInterval(poll);
|
238 |
+
fifu_get_sizes(image, data[i]['ID'], data[i]['guid'], is_svg);
|
239 |
image = null;
|
240 |
i++;
|
241 |
if (i < data.length) {
|
275 |
});
|
276 |
}
|
277 |
|
278 |
+
function fifu_get_sizes($, att_id, is_svg) {
|
279 |
+
width = is_svg ? 1920 : jQuery($)[0].naturalWidth;
|
280 |
+
height = is_svg ? 1920 : jQuery($)[0].naturalHeight;
|
281 |
|
282 |
if (width == 1 && height == 1)
|
283 |
return;
|
admin/html/menu.html
CHANGED
@@ -257,6 +257,33 @@
|
|
257 |
<?php $fifu['configuration']['overwrite']() ?>
|
258 |
</th>
|
259 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
</table>
|
261 |
</div>
|
262 |
<div class="box">
|
257 |
<?php $fifu['configuration']['overwrite']() ?>
|
258 |
</th>
|
259 |
</tr>
|
260 |
+
<tr>
|
261 |
+
<th>
|
262 |
+
<form
|
263 |
+
id="fifu_form_decode"
|
264 |
+
action="javascript:void(0)"
|
265 |
+
method="post">
|
266 |
+
<input
|
267 |
+
type="submit"
|
268 |
+
href="javascript:void(0)"
|
269 |
+
id="fifu_toggle_decode"
|
270 |
+
onclick="invert('decode')"
|
271 |
+
name="fifu_toggle_decode"
|
272 |
+
class="<?php echo $enable_decode; ?>"
|
273 |
+
value=""
|
274 |
+
style="display:block;border:none">
|
275 |
+
|
276 |
+
<input
|
277 |
+
type="hidden"
|
278 |
+
id="fifu_input_decode"
|
279 |
+
name="fifu_input_decode"
|
280 |
+
value="" >
|
281 |
+
</form>
|
282 |
+
</th>
|
283 |
+
<th>
|
284 |
+
<?php $fifu['configuration']['decode']() ?>
|
285 |
+
</th>
|
286 |
+
</tr>
|
287 |
</table>
|
288 |
</div>
|
289 |
<div class="box">
|
admin/html/support-data.html
CHANGED
@@ -28,6 +28,7 @@ fifu_confirm_delete_all_time:<?php echo $enable_confirm_delete_all_time ?>;
|
|
28 |
fifu_content:<?php echo $enable_content ?>;
|
29 |
fifu_content_page:<?php echo $enable_content_page ?>;
|
30 |
fifu_data_clean:<?php echo $enable_data_clean ?>;
|
|
|
31 |
fifu_default_url:<?php echo $default_url ?>;
|
32 |
fifu_dynamic_alt:<?php echo $enable_dynamic_alt ?>;
|
33 |
fifu_enable_default_url:<?php echo $enable_default_url ?>;
|
28 |
fifu_content:<?php echo $enable_content ?>;
|
29 |
fifu_content_page:<?php echo $enable_content_page ?>;
|
30 |
fifu_data_clean:<?php echo $enable_data_clean ?>;
|
31 |
+
fifu_decode:<?php echo $enable_decode ?>;
|
32 |
fifu_default_url:<?php echo $default_url ?>;
|
33 |
fifu_dynamic_alt:<?php echo $enable_dynamic_alt ?>;
|
34 |
fifu_enable_default_url:<?php echo $enable_default_url ?>;
|
admin/menu.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_lazy', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
|
4 |
|
5 |
define('FIFU_SLUG', 'featured-image-from-url');
|
6 |
|
@@ -64,6 +64,7 @@ function fifu_support_data() {
|
|
64 |
$enable_run_delete_all = get_option('fifu_run_delete_all');
|
65 |
$enable_run_delete_all_time = get_option('fifu_run_delete_all_time');
|
66 |
$column_height = get_option('fifu_column_height');
|
|
|
67 |
$enable_grid_category = get_option('fifu_grid_category');
|
68 |
$enable_auto_alt = get_option('fifu_auto_alt');
|
69 |
$enable_dynamic_alt = get_option('fifu_dynamic_alt');
|
@@ -115,6 +116,7 @@ function fifu_get_menu_html() {
|
|
115 |
$enable_run_delete_all = get_option('fifu_run_delete_all');
|
116 |
$enable_run_delete_all_time = get_option('fifu_run_delete_all_time');
|
117 |
$column_height = get_option('fifu_column_height');
|
|
|
118 |
$enable_grid_category = get_option('fifu_grid_category');
|
119 |
$enable_auto_alt = get_option('fifu_auto_alt');
|
120 |
$enable_dynamic_alt = get_option('fifu_dynamic_alt');
|
@@ -196,6 +198,7 @@ function fifu_update_menu_options() {
|
|
196 |
fifu_update_option('fifu_input_confirm_delete_all', 'fifu_confirm_delete_all');
|
197 |
fifu_update_option('fifu_input_run_delete_all', 'fifu_run_delete_all');
|
198 |
fifu_update_option('fifu_input_column_height', 'fifu_column_height');
|
|
|
199 |
fifu_update_option('fifu_input_grid_category', 'fifu_grid_category');
|
200 |
fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
|
201 |
fifu_update_option('fifu_input_dynamic_alt', 'fifu_dynamic_alt');
|
1 |
<?php
|
2 |
|
3 |
+
define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_lazy', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_decode', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
|
4 |
|
5 |
define('FIFU_SLUG', 'featured-image-from-url');
|
6 |
|
64 |
$enable_run_delete_all = get_option('fifu_run_delete_all');
|
65 |
$enable_run_delete_all_time = get_option('fifu_run_delete_all_time');
|
66 |
$column_height = get_option('fifu_column_height');
|
67 |
+
$enable_decode = get_option('fifu_decode');
|
68 |
$enable_grid_category = get_option('fifu_grid_category');
|
69 |
$enable_auto_alt = get_option('fifu_auto_alt');
|
70 |
$enable_dynamic_alt = get_option('fifu_dynamic_alt');
|
116 |
$enable_run_delete_all = get_option('fifu_run_delete_all');
|
117 |
$enable_run_delete_all_time = get_option('fifu_run_delete_all_time');
|
118 |
$column_height = get_option('fifu_column_height');
|
119 |
+
$enable_decode = get_option('fifu_decode');
|
120 |
$enable_grid_category = get_option('fifu_grid_category');
|
121 |
$enable_auto_alt = get_option('fifu_auto_alt');
|
122 |
$enable_dynamic_alt = get_option('fifu_dynamic_alt');
|
198 |
fifu_update_option('fifu_input_confirm_delete_all', 'fifu_confirm_delete_all');
|
199 |
fifu_update_option('fifu_input_run_delete_all', 'fifu_run_delete_all');
|
200 |
fifu_update_option('fifu_input_column_height', 'fifu_column_height');
|
201 |
+
fifu_update_option('fifu_input_decode', 'fifu_decode');
|
202 |
fifu_update_option('fifu_input_grid_category', 'fifu_grid_category');
|
203 |
fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
|
204 |
fifu_update_option('fifu_input_dynamic_alt', 'fifu_dynamic_alt');
|
admin/strings.php
CHANGED
@@ -614,6 +614,9 @@ function fifu_get_strings_settings() {
|
|
614 |
$fifu['configuration']['prioritize'] = function() {
|
615 |
_e("prioritize video than image (if both exist)", FIFU_SLUG);
|
616 |
};
|
|
|
|
|
|
|
617 |
|
618 |
// all
|
619 |
$fifu['all']['desc'] = function() {
|
614 |
$fifu['configuration']['prioritize'] = function() {
|
615 |
_e("prioritize video than image (if both exist)", FIFU_SLUG);
|
616 |
};
|
617 |
+
$fifu['configuration']['decode'] = function() {
|
618 |
+
_e("decode HTML entities", FIFU_SLUG);
|
619 |
+
};
|
620 |
|
621 |
// all
|
622 |
$fifu['all']['desc'] = function() {
|
featured-image-from-url.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Featured Image from URL
|
5 |
* Plugin URI: https://fifu.app/
|
6 |
* Description: Use an external image as featured image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
|
7 |
-
* Version: 3.3.
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
@@ -19,6 +19,7 @@ define('FIFU_INCLUDES_DIR', FIFU_PLUGIN_DIR . 'includes');
|
|
19 |
define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . 'admin');
|
20 |
define('FIFU_ELEMENTOR_DIR', FIFU_PLUGIN_DIR . 'elementor');
|
21 |
define('FIFU_DELETE_ALL_URLS', false);
|
|
|
22 |
|
23 |
require_once (FIFU_INCLUDES_DIR . '/attachment.php');
|
24 |
require_once (FIFU_INCLUDES_DIR . '/convert-url.php');
|
4 |
* Plugin Name: Featured Image from URL
|
5 |
* Plugin URI: https://fifu.app/
|
6 |
* Description: Use an external image as featured image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
|
7 |
+
* Version: 3.3.3
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
19 |
define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . 'admin');
|
20 |
define('FIFU_ELEMENTOR_DIR', FIFU_PLUGIN_DIR . 'elementor');
|
21 |
define('FIFU_DELETE_ALL_URLS', false);
|
22 |
+
define('FIFU_DEV_DEBUG', false);
|
23 |
|
24 |
require_once (FIFU_INCLUDES_DIR . '/attachment.php');
|
25 |
require_once (FIFU_INCLUDES_DIR . '/convert-url.php');
|
includes/attachment.php
CHANGED
@@ -93,7 +93,7 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
|
|
93 |
|
94 |
// photon
|
95 |
if (fifu_is_jetpack_active())
|
96 |
-
|
97 |
|
98 |
// use saved dimensions
|
99 |
if ($image[1] > 1 && $image[2] > 1)
|
@@ -118,6 +118,10 @@ function fifu_fix_dimensions($image, $size) {
|
|
118 |
}
|
119 |
|
120 |
function fifu_add_size($image, $size) {
|
|
|
|
|
|
|
|
|
121 |
if (!is_array($size)) {
|
122 |
if (function_exists('wp_get_registered_image_subsizes')) {
|
123 |
if (isset(wp_get_registered_image_subsizes()[$size]['width']))
|
@@ -148,6 +152,9 @@ function fifu_get_photon_url($image, $size, $att_id) {
|
|
148 |
$args['resize'] = array($w, null);
|
149 |
}
|
150 |
|
|
|
|
|
|
|
151 |
$image[0] = jetpack_photon_url($image[0], $args, null);
|
152 |
$image[0] = fifu_process_external_url($image[0], $att_id);
|
153 |
|
93 |
|
94 |
// photon
|
95 |
if (fifu_is_jetpack_active())
|
96 |
+
$image = fifu_get_photon_url($image, $size, $att_id);
|
97 |
|
98 |
// use saved dimensions
|
99 |
if ($image[1] > 1 && $image[2] > 1)
|
118 |
}
|
119 |
|
120 |
function fifu_add_size($image, $size) {
|
121 |
+
// fix lightbox
|
122 |
+
if ($size == 'woocommerce_single')
|
123 |
+
return $image;
|
124 |
+
|
125 |
if (!is_array($size)) {
|
126 |
if (function_exists('wp_get_registered_image_subsizes')) {
|
127 |
if (isset(wp_get_registered_image_subsizes()[$size]['width']))
|
152 |
$args['resize'] = array($w, null);
|
153 |
}
|
154 |
|
155 |
+
if (defined('FIFU_DEV_DEBUG') && !defined('IS_WPCOM') && FIFU_DEV_DEBUG && fifu_is_local())
|
156 |
+
define('IS_WPCOM', true);
|
157 |
+
|
158 |
$image[0] = jetpack_photon_url($image[0], $args, null);
|
159 |
$image[0] = fifu_process_external_url($image[0], $att_id);
|
160 |
|
includes/external-post.php
CHANGED
@@ -43,7 +43,7 @@ function fifu_save_properties_ext($post_id) {
|
|
43 |
}
|
44 |
|
45 |
function fifu_first_img_in_content($content) {
|
46 |
-
$content = html_entity_decode($content);
|
47 |
$nth = get_option('fifu_spinner_nth') - 1;
|
48 |
|
49 |
preg_match_all('/<img[^>]*>/', $content, $matches);
|
@@ -54,7 +54,7 @@ function fifu_first_img_in_content($content) {
|
|
54 |
}
|
55 |
|
56 |
function fifu_show_all_images($content) {
|
57 |
-
$content = html_entity_decode($content);
|
58 |
$matches = array();
|
59 |
preg_match_all('/<img[^>]*display:[ ]*none[^>]*>/', $content, $matches);
|
60 |
foreach ($matches[0] as $img) {
|
@@ -64,20 +64,20 @@ function fifu_show_all_images($content) {
|
|
64 |
}
|
65 |
|
66 |
function fifu_hide_media($img) {
|
67 |
-
$img = html_entity_decode($img);
|
68 |
if (strpos($img, 'style=') !== false)
|
69 |
return preg_replace('/style=[\'\"][^\'\"]*[\'\"]/', 'style="display:none"', $img);
|
70 |
return preg_replace('/[\/]*>/', ' style="display:none">', $img);
|
71 |
}
|
72 |
|
73 |
function fifu_show_media($img) {
|
74 |
-
$img = html_entity_decode($img);
|
75 |
return preg_replace('/style=[\\\]*.display:[ ]*none[\\\]*./', '', $img);
|
76 |
}
|
77 |
|
78 |
function fifu_first_url_in_content($post_id) {
|
79 |
$content = get_post_field('post_content', $post_id);
|
80 |
-
$content = html_entity_decode($content);
|
81 |
if (!$content)
|
82 |
return;
|
83 |
|
43 |
}
|
44 |
|
45 |
function fifu_first_img_in_content($content) {
|
46 |
+
$content = fifu_is_on('fifu_decode') ? html_entity_decode($content) : $content;
|
47 |
$nth = get_option('fifu_spinner_nth') - 1;
|
48 |
|
49 |
preg_match_all('/<img[^>]*>/', $content, $matches);
|
54 |
}
|
55 |
|
56 |
function fifu_show_all_images($content) {
|
57 |
+
$content = fifu_is_on('fifu_decode') ? html_entity_decode($content) : $content;
|
58 |
$matches = array();
|
59 |
preg_match_all('/<img[^>]*display:[ ]*none[^>]*>/', $content, $matches);
|
60 |
foreach ($matches[0] as $img) {
|
64 |
}
|
65 |
|
66 |
function fifu_hide_media($img) {
|
67 |
+
$img = fifu_is_on('fifu_decode') ? html_entity_decode($img) : $img;
|
68 |
if (strpos($img, 'style=') !== false)
|
69 |
return preg_replace('/style=[\'\"][^\'\"]*[\'\"]/', 'style="display:none"', $img);
|
70 |
return preg_replace('/[\/]*>/', ' style="display:none">', $img);
|
71 |
}
|
72 |
|
73 |
function fifu_show_media($img) {
|
74 |
+
$img = fifu_is_on('fifu_decode') ? html_entity_decode($img) : $img;
|
75 |
return preg_replace('/style=[\\\]*.display:[ ]*none[\\\]*./', '', $img);
|
76 |
}
|
77 |
|
78 |
function fifu_first_url_in_content($post_id) {
|
79 |
$content = get_post_field('post_content', $post_id);
|
80 |
+
$content = fifu_is_on('fifu_decode') ? html_entity_decode($content) : $content;
|
81 |
if (!$content)
|
82 |
return;
|
83 |
|
includes/html/js/image.js
CHANGED
@@ -1,10 +1,7 @@
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
// lazy load
|
3 |
-
if (fifuImageVars.fifu_lazy)
|
4 |
-
|
5 |
-
fifu_lazy();
|
6 |
-
}, 1);
|
7 |
-
}
|
8 |
|
9 |
// woocommerce lightbox/zoom
|
10 |
disableClick($);
|
@@ -26,15 +23,6 @@ jQuery(window).on('ajaxComplete', function () {
|
|
26 |
fifu_lazy();
|
27 |
});
|
28 |
|
29 |
-
// fix space between product image and gallery caused by lazy load
|
30 |
-
if (fifuImageVars.fifu_is_product) {
|
31 |
-
jQuery('img[fifu-featured="1"]').on('load', function () {
|
32 |
-
mainImage = jQuery('.flex-viewport').find('img[fifu-featured="1"]')[0];
|
33 |
-
if (mainImage)
|
34 |
-
jQuery('.flex-viewport').css('height', mainImage.clientHeight + 'px');
|
35 |
-
});
|
36 |
-
}
|
37 |
-
|
38 |
function disableClick($) {
|
39 |
if (!fifuImageVars.fifu_woo_lbox_enabled) {
|
40 |
firstParentClass = '';
|
@@ -71,3 +59,15 @@ function disableLink($) {
|
|
71 |
});
|
72 |
}
|
73 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
jQuery(document).ready(function ($) {
|
2 |
// lazy load
|
3 |
+
if (fifuImageVars.fifu_lazy)
|
4 |
+
fifu_lazy();
|
|
|
|
|
|
|
5 |
|
6 |
// woocommerce lightbox/zoom
|
7 |
disableClick($);
|
23 |
fifu_lazy();
|
24 |
});
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
function disableClick($) {
|
27 |
if (!fifuImageVars.fifu_woo_lbox_enabled) {
|
28 |
firstParentClass = '';
|
59 |
});
|
60 |
}
|
61 |
}
|
62 |
+
|
63 |
+
jQuery(document).click(function ($) {
|
64 |
+
fifu_fix_gallery_height();
|
65 |
+
})
|
66 |
+
|
67 |
+
function fifu_fix_gallery_height() {
|
68 |
+
if (fifuImageVars.fifu_is_flatsome_active) {
|
69 |
+
mainImage = jQuery('.woocommerce-product-gallery__wrapper div.flickity-viewport').find('img')[0];
|
70 |
+
if (mainImage)
|
71 |
+
jQuery('.woocommerce-product-gallery__wrapper div.flickity-viewport').css('height', mainImage.clientHeight + 'px');
|
72 |
+
}
|
73 |
+
}
|
includes/html/js/lazySizesConfig.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
window.lazySizesConfig.throttleDelay = 0;
|
8 |
})();
|
9 |
|
10 |
-
const FIFU_PLACEHOLDER = 'data:image/gif;base64,
|
11 |
|
12 |
function fifu_lazy() {
|
13 |
jQuery('img').each(function (index) {
|
@@ -38,10 +38,11 @@ function fifu_add_srcset() {
|
|
38 |
// jetpack
|
39 |
jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
|
40 |
if (jQuery(this).attr('fifu-featured')) {
|
|
|
41 |
src = jQuery(this).attr(types[i])
|
42 |
srcset = jQuery(this).attr(types[i] + 'set');
|
43 |
|
44 |
-
if (!srcset) {
|
45 |
srcset = '';
|
46 |
sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
|
47 |
for (j = 0; j < sizes.length; j++)
|
7 |
window.lazySizesConfig.throttleDelay = 0;
|
8 |
})();
|
9 |
|
10 |
+
const FIFU_PLACEHOLDER = 'data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAABCAQAAABeK7cBAAAAC0lEQVR42mNkAAIAAAoAAv/lxKUAAAAASUVORK5CYII=';
|
11 |
|
12 |
function fifu_lazy() {
|
13 |
jQuery('img').each(function (index) {
|
38 |
// jetpack
|
39 |
jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
|
40 |
if (jQuery(this).attr('fifu-featured')) {
|
41 |
+
isMain = jQuery(this).parents('.woocommerce-product-gallery__image').length == 1;
|
42 |
src = jQuery(this).attr(types[i])
|
43 |
srcset = jQuery(this).attr(types[i] + 'set');
|
44 |
|
45 |
+
if (!srcset && !isMain) {
|
46 |
srcset = '';
|
47 |
sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
|
48 |
for (j = 0; j < sizes.length; j++)
|
includes/thumbnail.php
CHANGED
@@ -43,6 +43,7 @@ function fifu_add_js() {
|
|
43 |
'fifu_woo_lbox_enabled' => fifu_woo_lbox(),
|
44 |
'fifu_woo_zoom' => fifu_woo_zoom(),
|
45 |
'fifu_is_product' => class_exists('WooCommerce') && is_product(),
|
|
|
46 |
'fifu_rest_url' => esc_url_raw(rest_url()),
|
47 |
'fifu_nonce' => wp_create_nonce('wp_rest'),
|
48 |
]);
|
43 |
'fifu_woo_lbox_enabled' => fifu_woo_lbox(),
|
44 |
'fifu_woo_zoom' => fifu_woo_zoom(),
|
45 |
'fifu_is_product' => class_exists('WooCommerce') && is_product(),
|
46 |
+
'fifu_is_flatsome_active' => fifu_is_flatsome_active(),
|
47 |
'fifu_rest_url' => esc_url_raw(rest_url()),
|
48 |
'fifu_nonce' => wp_create_nonce('wp_rest'),
|
49 |
]);
|
includes/util.php
CHANGED
@@ -91,11 +91,21 @@ function fifu_is_elementor_editor() {
|
|
91 |
}
|
92 |
|
93 |
function fifu_is_jetpack_active() {
|
|
|
|
|
|
|
|
|
|
|
|
|
94 |
return function_exists('jetpack_photon_url') && class_exists('Jetpack') && method_exists('Jetpack', 'get_active_modules') && in_array('photon', Jetpack::get_active_modules());
|
95 |
}
|
96 |
|
97 |
// active themes
|
98 |
|
|
|
|
|
|
|
|
|
99 |
function fifu_is_avada_active() {
|
100 |
return 'avada' == strtolower(get_option('template'));
|
101 |
}
|
91 |
}
|
92 |
|
93 |
function fifu_is_jetpack_active() {
|
94 |
+
if (!is_plugin_active('jetpack/jetpack.php'))
|
95 |
+
return false;
|
96 |
+
|
97 |
+
if (defined('FIFU_DEV_DEBUG'))
|
98 |
+
return true;
|
99 |
+
|
100 |
return function_exists('jetpack_photon_url') && class_exists('Jetpack') && method_exists('Jetpack', 'get_active_modules') && in_array('photon', Jetpack::get_active_modules());
|
101 |
}
|
102 |
|
103 |
// active themes
|
104 |
|
105 |
+
function fifu_is_flatsome_active() {
|
106 |
+
return 'flatsome' == get_option('template');
|
107 |
+
}
|
108 |
+
|
109 |
function fifu_is_avada_active() {
|
110 |
return 'avada' == strtolower(get_option('template'));
|
111 |
}
|
includes/woo.php
CHANGED
@@ -15,7 +15,7 @@ function fifu_woo_theme() {
|
|
15 |
define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS', "
|
16 |
function fix_images_without_dimensions() {
|
17 |
jQuery('img[data-large_image_height=0]').each(function () {
|
18 |
-
if (jQuery(this)[0].naturalWidth <=
|
19 |
return;
|
20 |
|
21 |
jQuery(this)
|
@@ -28,8 +28,10 @@ define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS', "
|
|
28 |
|
29 |
function fifu_woocommerce_gallery_image_html_attachment_image_params($params, $attachment_id, $image_size, $main_image) {
|
30 |
// fix zoom
|
31 |
-
if ($params['data-large_image_width'] == 0)
|
32 |
$params['data-large_image_width'] = 1920;
|
|
|
|
|
33 |
|
34 |
// fix lightbox
|
35 |
if (is_product())
|
15 |
define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS', "
|
16 |
function fix_images_without_dimensions() {
|
17 |
jQuery('img[data-large_image_height=0]').each(function () {
|
18 |
+
if (jQuery(this)[0].naturalWidth <= 2)
|
19 |
return;
|
20 |
|
21 |
jQuery(this)
|
28 |
|
29 |
function fifu_woocommerce_gallery_image_html_attachment_image_params($params, $attachment_id, $image_size, $main_image) {
|
30 |
// fix zoom
|
31 |
+
if ($params['data-large_image_width'] == 0) {
|
32 |
$params['data-large_image_width'] = 1920;
|
33 |
+
$params['data-large_image_height'] = 0;
|
34 |
+
}
|
35 |
|
36 |
// fix lightbox
|
37 |
if (is_product())
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
|
|
4 |
Tags: featured, image, url, woocommerce, thumbnail
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 5.5
|
7 |
-
Stable tag: 3.3.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -22,16 +22,16 @@ If you are tired of wasting time and resources with thumbnail regeneration, imag
|
|
22 |
Use an external image as featured image of your post, page or custom post type.
|
23 |
|
24 |
* External featured image
|
25 |
-
* Elementor widget
|
26 |
* Free CDN (with Jetpack)
|
|
|
27 |
* Unsplash image search
|
28 |
* Lazy load
|
29 |
* Default featured image
|
30 |
* Hide featured media
|
31 |
* Featured image in content
|
|
|
32 |
* Save image dimensions
|
33 |
* Featured image column
|
34 |
-
* Optimized external thumbnails (with Jetpack)
|
35 |
* **[Premium]** Giphy image search
|
36 |
* **[Premium]** Unsplash image size
|
37 |
* **[Premium]** Same height
|
@@ -188,20 +188,20 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr and Publiti
|
|
188 |
|
189 |
== Changelog ==
|
190 |
|
|
|
|
|
|
|
191 |
= 3.3.2 =
|
192 |
* Fix: notices (due FIFU widget for Elementor).
|
193 |
|
194 |
= 3.3.1 =
|
195 |
* New feature: FIFU widget for Elementor; improvement: integration with WP All Import (taxonomies); style issue: conflict between FIFU Settings and plugins/themes CSS (jQuery-ui).
|
196 |
|
197 |
-
= 3.3.0 =
|
198 |
-
* Improvement: responsive external images with Jetpack; bug fix: cropped Jetpack images; deprecated: Add Class and jQuery options.
|
199 |
-
|
200 |
= others =
|
201 |
* [more](https://fifu.app/changelog/)
|
202 |
|
203 |
|
204 |
== Upgrade Notice ==
|
205 |
|
206 |
-
= 3.3.
|
207 |
-
*
|
4 |
Tags: featured, image, url, woocommerce, thumbnail
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 5.5
|
7 |
+
Stable tag: 3.3.3
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
22 |
Use an external image as featured image of your post, page or custom post type.
|
23 |
|
24 |
* External featured image
|
|
|
25 |
* Free CDN (with Jetpack)
|
26 |
+
* Optimized external thumbnails (with Jetpack)
|
27 |
* Unsplash image search
|
28 |
* Lazy load
|
29 |
* Default featured image
|
30 |
* Hide featured media
|
31 |
* Featured image in content
|
32 |
+
* Elementor widget
|
33 |
* Save image dimensions
|
34 |
* Featured image column
|
|
|
35 |
* **[Premium]** Giphy image search
|
36 |
* **[Premium]** Unsplash image size
|
37 |
* **[Premium]** Same height
|
188 |
|
189 |
== Changelog ==
|
190 |
|
191 |
+
= 3.3.3 =
|
192 |
+
* New option: Content URL > decode HTML entities; conflict fixes: Jetpack + WooCommerce lightbox, Save Image Dimensions + svg images; style issue: Flatsome + WooCommerce gallery.
|
193 |
+
|
194 |
= 3.3.2 =
|
195 |
* Fix: notices (due FIFU widget for Elementor).
|
196 |
|
197 |
= 3.3.1 =
|
198 |
* New feature: FIFU widget for Elementor; improvement: integration with WP All Import (taxonomies); style issue: conflict between FIFU Settings and plugins/themes CSS (jQuery-ui).
|
199 |
|
|
|
|
|
|
|
200 |
= others =
|
201 |
* [more](https://fifu.app/changelog/)
|
202 |
|
203 |
|
204 |
== Upgrade Notice ==
|
205 |
|
206 |
+
= 3.3.3 =
|
207 |
+
* New option: Content URL > decode HTML entities; conflict fixes: Jetpack + WooCommerce lightbox, Save Image Dimensions + svg images; style issue: Flatsome + WooCommerce gallery.
|