Featured Image From URL - Version 3.8.5

Version Description

  • New feature: Page Redirection; enhancement: integration with CyberSEO plugin; enhancement: integration functions return boolean now.
Download this release

Release Info

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

Code changes from version 3.8.4 to 3.8.5

admin/db.php CHANGED
@@ -770,6 +770,9 @@ class FifuDb {
770
  } else {
771
  // update
772
  $alt = get_post_meta($post_id, 'fifu_image_alt', true);
 
 
 
773
  if ($has_fifu_attachment) {
774
  update_post_meta($att_id, '_wp_attached_file', $url);
775
  update_post_meta($att_id, '_wp_attachment_image_alt', $alt);
770
  } else {
771
  // update
772
  $alt = get_post_meta($post_id, 'fifu_image_alt', true);
773
+ if (!$alt && fifu_is_on('fifu_auto_alt'))
774
+ $alt = get_the_title($post_id);
775
+
776
  if ($has_fifu_attachment) {
777
  update_post_meta($att_id, '_wp_attached_file', $url);
778
  update_post_meta($att_id, '_wp_attachment_image_alt', $alt);
admin/html/menu.html CHANGED
@@ -930,6 +930,21 @@
930
  https://...
931
  </th>
932
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
933
  <tr class="color">
934
  <th>
935
  <?php $fifu['tab']['image']() ?>
@@ -3351,6 +3366,27 @@
3351
  </div>
3352
  </div>
3353
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3354
  <div class="box">
3355
  <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
3356
  <h2><?php $fifu['title']['hover']() ?></h2>
@@ -5635,7 +5671,8 @@
5635
  <h2><?php $fifu['title']['dev']() ?></h2>
5636
  <div class="greybox">
5637
  <?php $fifu['dev']['function']() ?><br>
5638
- <?php $fifu['dev']['args']() ?><br><br>
 
5639
  <table style="width:100%">
5640
  <tr>
5641
  <td style="width:14%;vertical-align:unset;">
930
  https://...
931
  </th>
932
  </tr>
933
+ <tr class="color">
934
+ <th>
935
+ <?php $fifu['tab']['image']() ?>
936
+ </th>
937
+ <th>
938
+ <?php $fifu['title']['redirection']() ?>
939
+ </th>
940
+ <th></th>
941
+ <th>
942
+ wp fifu image --redirection &lt;toggle&gt;
943
+ </th>
944
+ <th>
945
+ on, off
946
+ </th>
947
+ </tr>
948
  <tr class="color">
949
  <th>
950
  <?php $fifu['tab']['image']() ?>
3366
  </div>
3367
  </div>
3368
 
3369
+ <div class="box">
3370
+ <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
3371
+ <h2><?php $fifu['title']['redirection']() ?></h2>
3372
+ <div class="greybox" id="grad2">
3373
+ <?php $fifu['redirection']['desc']() ?>
3374
+ </div>
3375
+ <br>
3376
+ <table style="text-align:left">
3377
+ <tr>
3378
+ <th>
3379
+ <input
3380
+ type="submit"
3381
+ href="javascript:void(0)"
3382
+ class="toggleoff"
3383
+ value=""
3384
+ style="display:block;border:none">
3385
+ </th>
3386
+ </tr>
3387
+ </table>
3388
+ </div>
3389
+
3390
  <div class="box">
3391
  <div class="fifu-pro"><div class="fifu-pro-out"><a class="fifu-pro-link" href="https://fifu.app/" target="_blank" title="Unlock all features"><h4 class="fifu-pro-text"><span class="dashicons dashicons-lock fifu-pro-icon"></span>PRO</h4></a></div></div>
3392
  <h2><?php $fifu['title']['hover']() ?></h2>
5671
  <h2><?php $fifu['title']['dev']() ?></h2>
5672
  <div class="greybox">
5673
  <?php $fifu['dev']['function']() ?><br>
5674
+ <?php $fifu['dev']['args']() ?><br>
5675
+ <?php $fifu['dev']['plugins']() ?> <a target="_blank" href='https://www.cyberseo.net/'>CyberSEO</a>, <a target="_blank" href='https://wordpress.org/plugins/wpematico/'>WPeMatico</a><br><br>
5676
  <table style="width:100%">
5677
  <tr>
5678
  <td style="width:14%;vertical-align:unset;">
admin/html/troubleshooting.html CHANGED
@@ -9,6 +9,19 @@
9
  <div id="tabs-top" style="float:left">
10
  <ul>
11
  <div id="tabs-t" style="padding:1em 1.4em; position: relative; top: -25px;">
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  <div class="box">
13
  <table>
14
  <tr>
9
  <div id="tabs-top" style="float:left">
10
  <ul>
11
  <div id="tabs-t" style="padding:1em 1.4em; position: relative; top: -25px;">
12
+ <div class="box">
13
+ <table>
14
+ <tr>
15
+ <td style="border-bottom:none">2022-02-09</td>
16
+ <td style="border-bottom:none"><h3>CyberSEO</h3></td>
17
+ <td style="border-bottom:none">plugin</td>
18
+ </tr>
19
+ </table>
20
+ <div class="greybox" style="position: relative; top: -10px">
21
+ Using external featured images:<br>
22
+ 1) access CyberSEO settings and check "Use FIFU"<br>
23
+ </div>
24
+ </div>
25
  <div class="box">
26
  <table>
27
  <tr>
admin/strings.php CHANGED
@@ -252,6 +252,9 @@ function fifu_get_strings_settings() {
252
  $fifu['title']['hide'] = function() {
253
  _e("Hide Featured Media", FIFU_SLUG);
254
  };
 
 
 
255
  $fifu['title']['hover'] = function() {
256
  _e("Hover Effects", FIFU_SLUG);
257
  };
@@ -483,6 +486,9 @@ function fifu_get_strings_settings() {
483
  $fifu['dev']['args'] = function() {
484
  _e("All you need is to inform the post id and the image url(s). And FIFU will set the custom fields and create the metadata.", FIFU_SLUG);
485
  };
 
 
 
486
  $fifu['dev']['field']['image'] = function() {
487
  _e("Featured image", FIFU_SLUG);
488
  };
@@ -758,12 +764,16 @@ function fifu_get_strings_settings() {
758
  _e("Set images from Unsplash as featured images automatically. FIFU will check every minute if there are post types without featured images and will perform Unsplash searches based on the tags to get the image URLs.", FIFU_SLUG);
759
  };
760
 
761
-
762
  // block
763
  $fifu['block']['desc'] = function() {
764
  _e("Disable right-click on images.", FIFU_SLUG);
765
  };
766
 
 
 
 
 
 
767
  // giphy
768
  $fifu['giphy']['desc'] = function() {
769
  _e("Enable keyword gif search at featured image box.", FIFU_SLUG);
@@ -1654,6 +1664,9 @@ function fifu_get_strings_meta_box_php() {
1654
  $fifu['title']['post']['finder'] = function() {
1655
  return __("Media finder", FIFU_SLUG);
1656
  };
 
 
 
1657
 
1658
  // variation
1659
  $fifu['variation']['field'] = function() {
252
  $fifu['title']['hide'] = function() {
253
  _e("Hide Featured Media", FIFU_SLUG);
254
  };
255
+ $fifu['title']['redirection'] = function() {
256
+ _e("Page Redirection", FIFU_SLUG);
257
+ };
258
  $fifu['title']['hover'] = function() {
259
  _e("Hover Effects", FIFU_SLUG);
260
  };
486
  $fifu['dev']['args'] = function() {
487
  _e("All you need is to inform the post id and the image url(s). And FIFU will set the custom fields and create the metadata.", FIFU_SLUG);
488
  };
489
+ $fifu['dev']['plugins'] = function() {
490
+ _e("Plugins that make use of FIFU integration functions:", FIFU_SLUG);
491
+ };
492
  $fifu['dev']['field']['image'] = function() {
493
  _e("Featured image", FIFU_SLUG);
494
  };
764
  _e("Set images from Unsplash as featured images automatically. FIFU will check every minute if there are post types without featured images and will perform Unsplash searches based on the tags to get the image URLs.", FIFU_SLUG);
765
  };
766
 
 
767
  // block
768
  $fifu['block']['desc'] = function() {
769
  _e("Disable right-click on images.", FIFU_SLUG);
770
  };
771
 
772
+ // redirection
773
+ $fifu['redirection']['desc'] = function() {
774
+ _e("Adds a new meta box in the post editor where you can specify a forwarding URL. Then, when accessing a post and clicking on the featured image, the user will be redirected to the specified address.", FIFU_SLUG);
775
+ };
776
+
777
  // giphy
778
  $fifu['giphy']['desc'] = function() {
779
  _e("Enable keyword gif search at featured image box.", FIFU_SLUG);
1664
  $fifu['title']['post']['finder'] = function() {
1665
  return __("Media finder", FIFU_SLUG);
1666
  };
1667
+ $fifu['title']['post']['redirection'] = function() {
1668
+ return __("Page redirection", FIFU_SLUG);
1669
+ };
1670
 
1671
  // variation
1672
  $fifu['variation']['field'] = function() {
featured-image-from-url.php CHANGED
@@ -4,11 +4,11 @@
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.4
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
- * WC tested up to: 6.1
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
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
11
+ * WC tested up to: 6.2
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
includes/attachment.php CHANGED
@@ -267,8 +267,10 @@ function fifu_callback($buffer) {
267
  $subDelimiter = substr(explode('url(', $imgItem)[1], 0, 1);
268
  if (in_array($subDelimiter, array('"', "'", ' ')))
269
  $url = preg_split('/[\'\" ]{1}\)/', preg_split('/url\([\'\" ]{1}/', $imgItem, -1)[1], -1)[0];
270
- else
271
  $url = preg_split('/\)/', preg_split('/url\(/', $imgItem, -1)[1], -1)[0];
 
 
272
 
273
  $newImgItem = $imgItem;
274
 
267
  $subDelimiter = substr(explode('url(', $imgItem)[1], 0, 1);
268
  if (in_array($subDelimiter, array('"', "'", ' ')))
269
  $url = preg_split('/[\'\" ]{1}\)/', preg_split('/url\([\'\" ]{1}/', $imgItem, -1)[1], -1)[0];
270
+ else {
271
  $url = preg_split('/\)/', preg_split('/url\(/', $imgItem, -1)[1], -1)[0];
272
+ $subDelimiter = '';
273
+ }
274
 
275
  $newImgItem = $imgItem;
276
 
includes/html/js/image.js CHANGED
@@ -43,6 +43,9 @@ var observer = new MutationObserver(function (mutations) {
43
  if (jQuery(node).find('img').length > 0) {
44
  fifu_lazy_ajax();
45
  return;
 
 
 
46
  }
47
  });
48
  });
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
  });
51
  });
includes/html/js/lazySizesConfig.js CHANGED
@@ -13,17 +13,16 @@
13
  // 1920x1: https://png-pixel.com/
14
  const FIFU_PLACEHOLDER = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAJxAAAAABCAQAAADS13yAAAAAK0lEQVR42u3BIQEAAAACIP1/2hsGoAEAAAAAAAAAAAAAAAAAAAAAAADgwgCcQgACWbaCCgAAAABJRU5ErkJggg==';
15
 
16
- function fifu_lazy() {
17
- var phMap = new Map();
18
 
19
- jQuery('img').each(function (index) {
20
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
21
  return;
22
 
23
  // remove wp lazy load
24
  jQuery(this).removeAttr('loading');
25
 
26
- fifu_add_placeholder(this, phMap);
27
 
28
  // dont touch on slider
29
  if (!jQuery(this).hasClass('fifu'))
@@ -36,7 +35,7 @@ function fifu_add_lazyload($) {
36
  jQuery($).addClass('lazyload');
37
  }
38
 
39
- function fifu_add_placeholder($, phMap) {
40
  src = jQuery($).attr('src');
41
  datasrc = jQuery($).attr('data-src');
42
  if (!src && datasrc)
@@ -93,12 +92,12 @@ function fifu_get_delimited_url(url, delimiter) {
93
  return delimiter + url + delimiter;
94
  }
95
 
96
- function fifu_lazy_ajax() {
97
- jQuery('img').each(function () {
98
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
99
  return;
100
  jQuery(this).attr('data-src', jQuery(this).attr('src'));
101
  jQuery(this).removeAttr('src');
102
  });
103
- fifu_lazy();
104
  }
13
  // 1920x1: https://png-pixel.com/
14
  const FIFU_PLACEHOLDER = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAJxAAAAABCAQAAADS13yAAAAAK0lEQVR42u3BIQEAAAACIP1/2hsGoAEAAAAAAAAAAAAAAAAAAAAAAADgwgCcQgACWbaCCgAAAABJRU5ErkJggg==';
15
 
16
+ function fifu_lazy(selector = 'img') {
 
17
 
18
+ jQuery(selector).each(function (index) {
19
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
20
  return;
21
 
22
  // remove wp lazy load
23
  jQuery(this).removeAttr('loading');
24
 
25
+ fifu_add_placeholder(this);
26
 
27
  // dont touch on slider
28
  if (!jQuery(this).hasClass('fifu'))
35
  jQuery($).addClass('lazyload');
36
  }
37
 
38
+ function fifu_add_placeholder($) {
39
  src = jQuery($).attr('src');
40
  datasrc = jQuery($).attr('data-src');
41
  if (!src && datasrc)
92
  return delimiter + url + delimiter;
93
  }
94
 
95
+ function fifu_lazy_ajax(selector = 'img') {
96
+ jQuery(selector).each(function () {
97
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
98
  return;
99
  jQuery(this).attr('data-src', jQuery(this).attr('src'));
100
  jQuery(this).removeAttr('src');
101
  });
102
+ fifu_lazy(selector);
103
  }
includes/util.php CHANGED
@@ -118,8 +118,14 @@ function fifu_is_valid_default_cpt($post_id) {
118
  // developers
119
 
120
  function fifu_dev_set_image($post_id, $image_url) {
121
- fifu_update_or_delete($post_id, 'fifu_image_url', esc_url_raw(rtrim($image_url)));
122
- fifu_update_fake_attach_id($post_id);
 
 
 
 
 
 
123
  }
124
 
125
  // active plugins
118
  // developers
119
 
120
  function fifu_dev_set_image($post_id, $image_url) {
121
+ try {
122
+ fifu_update_or_delete($post_id, 'fifu_image_url', esc_url_raw(rtrim($image_url)));
123
+ fifu_update_fake_attach_id($post_id);
124
+ return true;
125
+ } catch (Exception $e) {
126
+ error_log($e->getMessage());
127
+ return false;
128
+ }
129
  }
130
 
131
  // active plugins
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.4
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -38,6 +38,7 @@ Use an external image as featured image of your post, page or custom post type.
38
  * **[PRO]** Hover effects
39
  * **[PRO]** Replace not found image
40
  * **[PRO]** Image validation
 
41
 
42
  #### AUTOMATIC FEATURED MEDIA
43
 
@@ -226,20 +227,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
226
 
227
  == Changelog ==
228
 
 
 
 
229
  = 3.8.4 =
230
  * 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).
231
 
232
  = 3.8.3 =
233
  * 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).
234
 
235
- = 3.8.2 =
236
- * Fix: conflict with WP Super Cache plugin (cache not working); fix: Lazy Load (conflict with themes that use LazySizes library).
237
-
238
  = others =
239
  * [more](https://fifu.app/changelog)
240
 
241
 
242
  == Upgrade Notice ==
243
 
244
- = 3.8.4 =
245
- * 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).
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
 
38
  * **[PRO]** Hover effects
39
  * **[PRO]** Replace not found image
40
  * **[PRO]** Image validation
41
+ * **[PRO]** Page redirection
42
 
43
  #### AUTOMATIC FEATURED MEDIA
44
 
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.