Featured Image From URL - Version 3.8.6

Version Description

  • Fix: Auto set featured media from post content > hide the image/video from content.
Download this release

Release Info

Developer marceljm
Plugin Icon 128x128 Featured Image From URL
Version 3.8.6
Comparing to
See all releases

Code changes from version 3.8.5 to 3.8.6

admin/menu.php CHANGED
@@ -28,7 +28,7 @@ function fifu_insert_menu() {
28
  ]);
29
  }
30
 
31
- add_menu_page('Featured Image from URL', 'Featured Image from URL', 'manage_options', 'featured-image-from-url', 'fifu_get_menu_html', 'dashicons-camera', 57);
32
  add_submenu_page('featured-image-from-url', 'FIFU Settings', __('Settings'), 'manage_options', 'featured-image-from-url');
33
  add_submenu_page('featured-image-from-url', 'FIFU Cloud', __('Cloud'), 'manage_options', 'fifu-cloud', 'fifu_cloud');
34
  add_submenu_page('featured-image-from-url', 'FIFU Troubleshooting', __('Troubleshooting'), 'manage_options', 'fifu-troubleshooting', 'fifu_troubleshooting');
28
  ]);
29
  }
30
 
31
+ add_menu_page('Featured Image from URL', 'FIFU', 'manage_options', 'featured-image-from-url', 'fifu_get_menu_html', 'dashicons-camera', 57);
32
  add_submenu_page('featured-image-from-url', 'FIFU Settings', __('Settings'), 'manage_options', 'featured-image-from-url');
33
  add_submenu_page('featured-image-from-url', 'FIFU Cloud', __('Cloud'), 'manage_options', 'fifu-cloud', 'fifu_cloud');
34
  add_submenu_page('featured-image-from-url', 'FIFU Troubleshooting', __('Troubleshooting'), 'manage_options', 'fifu-troubleshooting', 'fifu_troubleshooting');
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image/video as featured image/video of a post or WooCommerce product.
7
- * Version: 3.8.5
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image/video as featured image/video of a post or WooCommerce product.
7
+ * Version: 3.8.6
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
includes/external-post.php CHANGED
@@ -65,6 +65,7 @@ function fifu_show_all_images($content) {
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);
65
 
66
  function fifu_hide_media($img) {
67
  $img = fifu_is_on('fifu_decode') ? html_entity_decode($img) : $img;
68
+ $img = stripslashes($img);
69
  if (strpos($img, 'style=') !== false)
70
  return preg_replace('/style=[\'\"][^\'\"]*[\'\"]/', 'style="display:none"', $img);
71
  return preg_replace('/[\/]*>/', ' style="display:none">', $img);
includes/html/js/image.js CHANGED
@@ -41,10 +41,17 @@ var observer = new MutationObserver(function (mutations) {
41
  mutations.forEach(function (mutation) {
42
  mutation.addedNodes.forEach(function (node) {
43
  if (jQuery(node).find('img').length > 0) {
44
- fifu_lazy_ajax();
 
 
 
 
 
45
  return;
46
  } else if (jQuery(node).prop('tagName') == 'IMG') {
47
- fifu_lazy_ajax(node);
 
 
48
  return;
49
  }
50
  });
41
  mutations.forEach(function (mutation) {
42
  mutation.addedNodes.forEach(function (node) {
43
  if (jQuery(node).find('img').length > 0) {
44
+ // ignore WooCommerce zoom
45
+ if (!jQuery(node).hasClass('pswp__zoom-wrap')) {
46
+ jQuery(node).find('img').each(function (index) {
47
+ fifu_lazy_ajax(this);
48
+ });
49
+ }
50
  return;
51
  } else if (jQuery(node).prop('tagName') == 'IMG') {
52
+ // ignore WooCommerce zoom
53
+ if (!jQuery(node).hasClass('zoomImg'))
54
+ fifu_lazy_ajax(node);
55
  return;
56
  }
57
  });
includes/html/js/lazySizesConfig.js CHANGED
@@ -28,7 +28,7 @@ function fifu_lazy(selector = 'img') {
28
  if (!jQuery(this).hasClass('fifu'))
29
  fifu_add_lazyload(this);
30
  });
31
- fifu_add_srcset();
32
  }
33
 
34
  function fifu_add_lazyload($) {
@@ -38,11 +38,15 @@ function fifu_add_lazyload($) {
38
  function fifu_add_placeholder($) {
39
  src = jQuery($).attr('src');
40
  datasrc = jQuery($).attr('data-src');
41
- if (!src && datasrc)
42
- jQuery($).attr('src', FIFU_PLACEHOLDER);
 
 
 
 
43
  }
44
 
45
- function fifu_add_srcset() {
46
  types = ['src', 'data-src'];
47
  for (i = 0; i < types.length; i++) {
48
  // jetpack
28
  if (!jQuery(this).hasClass('fifu'))
29
  fifu_add_lazyload(this);
30
  });
31
+ fifu_add_srcset(selector);
32
  }
33
 
34
  function fifu_add_lazyload($) {
38
  function fifu_add_placeholder($) {
39
  src = jQuery($).attr('src');
40
  datasrc = jQuery($).attr('data-src');
41
+ if (!src && datasrc) {
42
+ if (fifuLazyVars.fifu_is_product && jQuery($).hasClass('lazyload')) {
43
+ if (jQuery($).parents('.woocommerce-product-gallery__wrapper').length == 0)
44
+ jQuery($).attr('src', FIFU_PLACEHOLDER);
45
+ }
46
+ }
47
  }
48
 
49
+ function fifu_add_srcset(selector) {
50
  types = ['src', 'data-src'];
51
  for (i = 0; i < types.length; i++) {
52
  // jetpack
includes/thumbnail.php CHANGED
@@ -35,6 +35,10 @@ function fifu_add_js() {
35
  wp_enqueue_script('unveilhooks', 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/plugins/unveilhooks/ls.unveilhooks.min.js');
36
  wp_enqueue_script('bgset', 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/plugins/bgset/ls.bgset.min.js');
37
  wp_enqueue_script('lazysizes', 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/lazysizes.min.js');
 
 
 
 
38
  }
39
 
40
  if (class_exists('WooCommerce')) {
35
  wp_enqueue_script('unveilhooks', 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/plugins/unveilhooks/ls.unveilhooks.min.js');
36
  wp_enqueue_script('bgset', 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/plugins/bgset/ls.bgset.min.js');
37
  wp_enqueue_script('lazysizes', 'https://cdnjs.cloudflare.com/ajax/libs/lazysizes/5.3.2/lazysizes.min.js');
38
+
39
+ wp_localize_script('lazysizes-config', 'fifuLazyVars', [
40
+ 'fifu_is_product' => class_exists('WooCommerce') && is_product(),
41
+ ]);
42
  }
43
 
44
  if (class_exists('WooCommerce')) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 5.9
7
- Stable tag: 3.8.5
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -227,20 +227,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
227
 
228
  == Changelog ==
229
 
 
 
 
230
  = 3.8.5 =
231
  * New feature: Page Redirection; enhancement: integration with CyberSEO plugin; enhancement: integration functions return boolean now.
232
 
233
  = 3.8.4 =
234
  * Enhancement: integration with WP Automatic (supports external images in the WooCommerce gallery now); enhancement: Auto set featured media from post content > hide the image/video from content (the hidden media is also removed on page load now).
235
 
236
- = 3.8.3 =
237
- * Fix: CDN + Optimized thumbnails (not working for images loaded via ajax); fix: Hide Featured Media (no images in related posts); fix: conflict with BuddyBoss App (lightbox not opening); fix: conflict with Wolmart theme (fatal error).
238
-
239
  = others =
240
  * [more](https://fifu.app/changelog)
241
 
242
 
243
  == Upgrade Notice ==
244
 
245
- = 3.8.5 =
246
- * New feature: Page Redirection; enhancement: integration with CyberSEO plugin; enhancement: integration functions return boolean now.
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 5.9
7
+ Stable tag: 3.8.6
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
227
 
228
  == Changelog ==
229
 
230
+ = 3.8.6 =
231
+ * Fix: Auto set featured media from post content > hide the image/video from content.
232
+
233
  = 3.8.5 =
234
  * New feature: Page Redirection; enhancement: integration with CyberSEO plugin; enhancement: integration functions return boolean now.
235
 
236
  = 3.8.4 =
237
  * Enhancement: integration with WP Automatic (supports external images in the WooCommerce gallery now); enhancement: Auto set featured media from post content > hide the image/video from content (the hidden media is also removed on page load now).
238
 
 
 
 
239
  = others =
240
  * [more](https://fifu.app/changelog)
241
 
242
 
243
  == Upgrade Notice ==
244
 
245
+ = 3.8.6 =
246
+ * Fix: Auto set featured media from post content > hide the image/video from content.