Featured Image From URL - Version 4.1.1

Version Description

  • Enhancement: FIFU Cloud (performance optimization for mobile); fix: CDN + Optimized Thumbnails > crop featured images; fix: CDN + Optimized Thumbnails > apply to content images; fix: incompatibility with AMP plugin.
Download this release

Release Info

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

Code changes from version 4.1.0 to 4.1.1

admin/html/menu.html CHANGED
@@ -15,13 +15,13 @@
15
  <li><a href="#tabs-c"><i class="fas fa-play"></i> <?php $fifu['tab']['video']() ?></a></li>
16
  <li><a href="#tabs-m"><i class="fas fa-images"></i> <?php $fifu['tab']['slider']() ?></a></li>
17
  <li><a href="#tabs-e"><i class="fas fa-volume-high"></i> <?php $fifu['tab']['audio']() ?></a></li>
18
- <li><a href="#tabs-l"><i class="fas fa-code"></i> <?php $fifu['tab']['shortcode']() ?></a></li>
19
  <li><a href="#tabs-b"><i class="fas fa-robot"></i> <?php $fifu['tab']['auto']() ?></a></li>
20
  <li><a href="#tabs-n"><i class="fas fa-share-alt"></i> <?php $fifu['tab']['social']() ?></a></li>
21
  <li><a href="#tabs-i"><i class="fas fa-tachometer-alt"></i> <?php $fifu['tab']['performance']() ?></a></li>
22
  <li><a href="#tabs-o"><i class="fas fa-shopping-cart"></i> <?php $fifu['tab']['woo']() ?></a></li>
23
  <li><a href="#tabs-p"><i class="fas fa-file-export"></i> <?php $fifu['tab']['wai']() ?></a></li>
24
  <li><a href="#tabs-q"><i class="fas fa-keyboard"></i> <?php $fifu['tab']['api']() ?></a></li>
 
25
  <li><a href="#tabs-k"><i class="fas fa-user-cog"></i> <?php $fifu['tab']['admin']() ?></a></li>
26
  <li><a href="#tabs-j"><i class="fas fa-database"></i> <?php $fifu['tab']['metadata']() ?></a></li>
27
  <br>
15
  <li><a href="#tabs-c"><i class="fas fa-play"></i> <?php $fifu['tab']['video']() ?></a></li>
16
  <li><a href="#tabs-m"><i class="fas fa-images"></i> <?php $fifu['tab']['slider']() ?></a></li>
17
  <li><a href="#tabs-e"><i class="fas fa-volume-high"></i> <?php $fifu['tab']['audio']() ?></a></li>
 
18
  <li><a href="#tabs-b"><i class="fas fa-robot"></i> <?php $fifu['tab']['auto']() ?></a></li>
19
  <li><a href="#tabs-n"><i class="fas fa-share-alt"></i> <?php $fifu['tab']['social']() ?></a></li>
20
  <li><a href="#tabs-i"><i class="fas fa-tachometer-alt"></i> <?php $fifu['tab']['performance']() ?></a></li>
21
  <li><a href="#tabs-o"><i class="fas fa-shopping-cart"></i> <?php $fifu['tab']['woo']() ?></a></li>
22
  <li><a href="#tabs-p"><i class="fas fa-file-export"></i> <?php $fifu['tab']['wai']() ?></a></li>
23
  <li><a href="#tabs-q"><i class="fas fa-keyboard"></i> <?php $fifu['tab']['api']() ?></a></li>
24
+ <li><a href="#tabs-l"><i class="fas fa-code"></i> <?php $fifu['tab']['shortcode']() ?></a></li>
25
  <li><a href="#tabs-k"><i class="fas fa-user-cog"></i> <?php $fifu['tab']['admin']() ?></a></li>
26
  <li><a href="#tabs-j"><i class="fas fa-database"></i> <?php $fifu['tab']['metadata']() ?></a></li>
27
  <br>
admin/html/troubleshooting.html CHANGED
@@ -9,6 +9,59 @@
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-09-07</td>
16
+ <td style="border-bottom:none"><h3> WP Content Pilot</h3></td>
17
+ <td style="border-bottom:none">plugin</td>
18
+ </tr>
19
+ </table>
20
+ <div class="greybox" style="position: relative; top: -10px">
21
+ "Don't save the featured image in server" option doesn't work: <br>
22
+ x) please contact its support, because WP Content Pilot developed that.<br>
23
+ </div>
24
+ </div>
25
+ <div class="box">
26
+ <table>
27
+ <tr>
28
+ <td style="border-bottom:none">2022-09-06</td>
29
+ <td style="border-bottom:none"><h3> WP Crontrol</h3></td>
30
+ <td style="border-bottom:none">plugin</td>
31
+ </tr>
32
+ </table>
33
+ <div class="greybox" style="position: relative; top: -10px">
34
+ Integration with "FIFU > Settings > Auto set featured media from post content > Run for all posts":<br>
35
+ 1) go to "Tools > Cron Events > Add New"<br>
36
+ 2) select "Standard cron event" for "Event Type"<br>
37
+ 3) set "fifu_event" as "Hook Name"<br>
38
+ 4) choose a "Recurrence"<br>
39
+ 5) click on "Add Event"<br>
40
+ </div>
41
+ </div>
42
+ <div class="box">
43
+ <table>
44
+ <tr>
45
+ <td style="border-bottom:none">2022-09-05</td>
46
+ <td style="border-bottom:none"><h3> Knawat WooCommerce DropShipping</h3></td>
47
+ <td style="border-bottom:none">plugin</td>
48
+ </tr>
49
+ </table>
50
+ <div class="greybox" style="position: relative; top: -10px">
51
+ Integration with FIFU:<br>
52
+ 1) open "dropshipping-woocommerce/includes/class-dropshipping-woocommerce-importer.php"<br>
53
+ 2) add the code below immediately after the line "// Formatting Image Data":<br>
54
+ <textarea style="width:100%;height:135px;overflow:hidden" disabled>
55
+ if (is_plugin_active('fifu-premium/fifu-premium.php') && isset($product->images) && !empty($product->images)) {
56
+ $images = $product->images;
57
+ $new_product['meta_data'][] = array(
58
+ 'key' => 'fifu_list_url',
59
+ 'value' => implode('|', $product->images),
60
+ );
61
+ } else
62
+ </textarea>
63
+ </div>
64
+ </div>
65
  <div class="box">
66
  <table>
67
  <tr>
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/audio as featured image/video/audio of a post or WooCommerce product.
7
- * Version: 4.1.0
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/audio as featured image/video/audio of a post or WooCommerce product.
7
+ * Version: 4.1.1
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
includes/html/js/lazySizesConfig.js CHANGED
@@ -90,24 +90,24 @@ function fifu_add_placeholder($) {
90
  }
91
 
92
  function fifu_add_srcset(selector) {
93
- types = ['src', 'data-src'];
94
- for (i = 0; i < types.length; i++) {
95
- // speedup
96
- new_selector = selector != 'img' ? selector : 'img[' + types[i] + '^="https://cdn.fifu.app/"]';
97
- jQuery(new_selector).each(function (index) {
98
- src = jQuery(this).attr(types[i]);
99
- srcset = jQuery(this).attr(types[i] + 'set');
100
-
101
- if (!srcset && src && src.includes('cdn.fifu.app')) {
102
- srcset = fifuCloudVars.srcsets[src];
103
- srcset = srcset ? srcset : fifuCloudVars.srcsets[src.split('?')[0]];
104
- if (srcset) {
105
- jQuery(this).attr(types[i] + 'set', srcset);
106
- jQuery(this).attr('data-sizes', 'auto');
107
- }
108
  }
109
- });
 
110
 
 
 
111
  // jetpack
112
  jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
113
  if (jQuery(this).attr('srcset') && jQuery(this).attr('data-srcset'))
@@ -122,7 +122,18 @@ function fifu_add_srcset(selector) {
122
  sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
123
  for (j = 0; j < sizes.length; j++) {
124
  ssl = src.includes('ssl=1') ? '&ssl=1' : '';
125
- srcset += ((j != 0) ? ', ' : '') + src.replace(src.split('?')[1], 'w=' + sizes[j] + '&resize=' + sizes[j] + ssl) + ' ' + sizes[j] + 'w';
 
 
 
 
 
 
 
 
 
 
 
126
  }
127
  jQuery(this).attr(types[i] + 'set', srcset);
128
  jQuery(this).attr('data-sizes', 'auto');
90
  }
91
 
92
  function fifu_add_srcset(selector) {
93
+ // speedup
94
+ new_selector = selector != 'img' ? selector : 'img[data-src^="https://cdn.fifu.app/"]';
95
+ jQuery(new_selector).each(function (index) {
96
+ src = jQuery(this).attr('data-src');
97
+ srcset = jQuery(this).attr('data-srcset');
98
+
99
+ if (!srcset && src && src.includes('cdn.fifu.app')) {
100
+ srcset = fifuCloudVars.srcsets[src];
101
+ srcset = srcset ? srcset : fifuCloudVars.srcsets[src.split('?')[0]];
102
+ if (srcset) {
103
+ jQuery(this).attr('data-srcset', srcset);
104
+ jQuery(this).attr('data-sizes', 'auto');
 
 
 
105
  }
106
+ }
107
+ });
108
 
109
+ types = ['src', 'data-src'];
110
+ for (i = 0; i < types.length; i++) {
111
  // jetpack
112
  jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
113
  if (jQuery(this).attr('srcset') && jQuery(this).attr('data-srcset'))
122
  sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
123
  for (j = 0; j < sizes.length; j++) {
124
  ssl = src.includes('ssl=1') ? '&ssl=1' : '';
125
+
126
+ resize = src.match(/\?resize=[0-9,]+/)[0].split('=')[1].split(',');
127
+ resizeW = Number(resize[0]);
128
+ resizeH = Number(resize[1]);
129
+ newResizeW = sizes[j];
130
+ if (resizeH) {
131
+ newResizeH = Math.trunc(sizes[j] * resizeH / resizeW);
132
+ newResize = `${newResizeW},${newResizeH}`;
133
+ } else
134
+ newResize = newResizeW;
135
+
136
+ srcset += ((j != 0) ? ', ' : '') + src.replace(src.split('?')[1], 'w=' + sizes[j] + '&resize=' + newResize + ssl) + ' ' + sizes[j] + 'w';
137
  }
138
  jQuery(this).attr(types[i] + 'set', srcset);
139
  jQuery(this).attr('data-sizes', 'auto');
includes/jetpack.php CHANGED
@@ -31,7 +31,7 @@ function fifu_jetpack_blocked($url) {
31
  if (fifu_is_photon_url($url))
32
  return true;
33
 
34
- $blocklist = array('localhost', 'amazon-adsystem.com', 'sapo.io', 'i.guim.co.uk', 's.yimg.com', 's1.yimg.com', 'www.washingtonpost.com', 'pbs.twimg.com', 'www.aljazeera.com', 'image.influenster.com', 'api.screenshotmachine.com', 'rackcdn.com', 'googleusercontent.com', 'drive.google.com', 'img.brownsfashion.com', 'accounts.parrotproducts.biz', 'www.dropbox.com', 'cdn.fifu.app', 'cloud.fifu.app');
35
  foreach ($blocklist as $domain) {
36
  if (strpos($url, $domain) !== false)
37
  return true;
@@ -40,7 +40,7 @@ function fifu_jetpack_blocked($url) {
40
  }
41
 
42
  function fifu_jetpack_ssl($url) {
43
- $list = array('m.media-amazon.com', 'images-na.ssl-images-amazon.com', 'image.blockchain.news', 'static.news.bitcoin.com', 'thenewscrypto.com');
44
  foreach ($list as $domain) {
45
  if (strpos($url, $domain) !== false)
46
  return true;
31
  if (fifu_is_photon_url($url))
32
  return true;
33
 
34
+ $blocklist = array('localhost', 'amazon-adsystem.com', 'sapo.io', 'i.guim.co.uk', 's.yimg.com', 's1.yimg.com', 'www.washingtonpost.com', 'pbs.twimg.com', 'www.aljazeera.com', 'image.influenster.com', 'api.screenshotmachine.com', 'rackcdn.com', 'googleusercontent.com', 'drive.google.com', 'img.brownsfashion.com', 'accounts.parrotproducts.biz', 'www.dropbox.com', 'cdn.fifu.app', 'cloud.fifu.app', 'images.placeholders.dev');
35
  foreach ($blocklist as $domain) {
36
  if (strpos($url, $domain) !== false)
37
  return true;
40
  }
41
 
42
  function fifu_jetpack_ssl($url) {
43
+ $list = array('m.media-amazon.com', 'images-na.ssl-images-amazon.com', 'image.blockchain.news', 'static.news.bitcoin.com', 'thenewscrypto.com', 'cdn.coolstuff.com');
44
  foreach ($list as $domain) {
45
  if (strpos($url, $domain) !== false)
46
  return true;
includes/thumbnail.php CHANGED
@@ -20,6 +20,9 @@ if (!in_array($pagenow, array('post.php', 'post-new.php', 'admin-ajax.php', 'wp-
20
  add_filter('wp_head', 'fifu_apply_css');
21
 
22
  function fifu_add_js() {
 
 
 
23
  if (fifu_su_sign_up_complete()) {
24
  echo '<link rel="preconnect" href="https://cloud.fifu.app">';
25
  echo '<link rel="preconnect" href="https://cdn.fifu.app">';
@@ -240,7 +243,7 @@ function fifu_remove_content_image($content) {
240
  add_filter('the_content', 'fifu_optimize_content');
241
 
242
  function fifu_optimize_content($content) {
243
- if (fifu_is_off('fifu_cdn_content') || empty($content))
244
  return $content;
245
 
246
  $srcType = "src";
@@ -317,3 +320,12 @@ function fifu_get_default_url() {
317
  return wp_get_attachment_url(get_option('fifu_default_attach_id'));
318
  }
319
 
 
 
 
 
 
 
 
 
 
20
  add_filter('wp_head', 'fifu_apply_css');
21
 
22
  function fifu_add_js() {
23
+ if (fifu_is_amp_request())
24
+ return;
25
+
26
  if (fifu_su_sign_up_complete()) {
27
  echo '<link rel="preconnect" href="https://cloud.fifu.app">';
28
  echo '<link rel="preconnect" href="https://cdn.fifu.app">';
243
  add_filter('the_content', 'fifu_optimize_content');
244
 
245
  function fifu_optimize_content($content) {
246
+ if (fifu_is_off('fifu_cdn_content') || empty($content) || fifu_is_off('fifu_lazy'))
247
  return $content;
248
 
249
  $srcType = "src";
320
  return wp_get_attachment_url(get_option('fifu_default_attach_id'));
321
  }
322
 
323
+ add_filter('style_loader_tag', 'fifu_style_loader_tag', 10, 2);
324
+
325
+ function fifu_style_loader_tag($html, $handle) {
326
+ if (strcmp($handle, 'lazyload-spinner') == 0) {
327
+ $html = str_replace("rel='stylesheet'", "rel='preload' as='style'", $html);
328
+ }
329
+ return $html;
330
+ }
331
+
includes/util.php CHANGED
@@ -128,6 +128,10 @@ function fifu_is_landscape($width, $height) {
128
  return $width >= $height;
129
  }
130
 
 
 
 
 
131
  // developers
132
 
133
  function fifu_dev_set_image($post_id, $image_url) {
128
  return $width >= $height;
129
  }
130
 
131
+ function fifu_is_amp_request() {
132
+ return function_exists('amp_is_request') && amp_is_request();
133
+ }
134
+
135
  // developers
136
 
137
  function fifu_dev_set_image($post_id, $image_url) {
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: 6.0.2
7
- Stable tag: 4.1.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -262,20 +262,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
262
 
263
  == Changelog ==
264
 
 
 
 
265
  = 4.1.0 =
266
  * Enhancement: Featured Video (supports external video files now as mp4, ogg and webm); enhancement: Fast Buy (new settings and improvements); enhancement: CDN + Optimized Thumbnails (serves Unsplash images now).
267
 
268
  = 4.0.9 =
269
  * New feature: Featured Audio; new feature: Featured video > Privacy Enhanced Mode; new option: Featured Slider > load slider on singular post types only; fix: CDN + Optimized Thumbnails > apply to content images (should skip images that cannot be served).
270
 
271
- = 4.0.8 =
272
- * Fix: CDN + Optimized Thumbnails (conflict with images from other CDNs); fix: conflict with Multisite Global Media plugin.
273
-
274
  = others =
275
  * [more](https://fifu.app/changelog)
276
 
277
 
278
  == Upgrade Notice ==
279
 
280
- = 4.1.0 =
281
- * Enhancement: Featured Video (supports external video files now as mp4, ogg and webm); enhancement: Fast Buy (new settings and improvements); enhancement: CDN + Optimized Thumbnails (serves Unsplash images now).
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 6.0.2
7
+ Stable tag: 4.1.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
262
 
263
  == Changelog ==
264
 
265
+ = 4.1.1 =
266
+ * Enhancement: FIFU Cloud (performance optimization for mobile); fix: CDN + Optimized Thumbnails > crop featured images; fix: CDN + Optimized Thumbnails > apply to content images; fix: incompatibility with AMP plugin.
267
+
268
  = 4.1.0 =
269
  * Enhancement: Featured Video (supports external video files now as mp4, ogg and webm); enhancement: Fast Buy (new settings and improvements); enhancement: CDN + Optimized Thumbnails (serves Unsplash images now).
270
 
271
  = 4.0.9 =
272
  * New feature: Featured Audio; new feature: Featured video > Privacy Enhanced Mode; new option: Featured Slider > load slider on singular post types only; fix: CDN + Optimized Thumbnails > apply to content images (should skip images that cannot be served).
273
 
 
 
 
274
  = others =
275
  * [more](https://fifu.app/changelog)
276
 
277
 
278
  == Upgrade Notice ==
279
 
280
+ = 4.1.1 =
281
+ * Enhancement: FIFU Cloud (performance optimization for mobile); fix: CDN + Optimized Thumbnails > crop featured images; fix: CDN + Optimized Thumbnails > apply to content images; fix: incompatibility with AMP plugin.