Featured Image From URL - Version 4.0.8

Version Description

  • Fix: CDN + Optimized Thumbnails (conflict with images from other CDNs); fix: conflict with Multisite Global Media plugin.
Download this release

Release Info

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

Code changes from version 4.0.7 to 4.0.8

admin/db.php CHANGED
@@ -495,6 +495,20 @@ class FifuDb {
495
  }
496
 
497
  function delete_thumbnail_id_without_attachment() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
498
  $this->wpdb->get_results("
499
  DELETE FROM " . $this->postmeta . "
500
  WHERE meta_key = '_thumbnail_id'
495
  }
496
 
497
  function delete_thumbnail_id_without_attachment() {
498
+ if (fifu_is_multisite_global_media_active()) {
499
+ $this->wpdb->get_results("
500
+ DELETE FROM " . $this->postmeta . "
501
+ WHERE meta_key = '_thumbnail_id'
502
+ AND meta_value NOT LIKE '100000%'
503
+ AND NOT EXISTS (
504
+ SELECT 1
505
+ FROM " . $this->posts . " p
506
+ WHERE p.id = meta_value
507
+ )"
508
+ );
509
+ return;
510
+ }
511
+
512
  $this->wpdb->get_results("
513
  DELETE FROM " . $this->postmeta . "
514
  WHERE meta_key = '_thumbnail_id'
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: 4.0.7
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
- * WC tested up to: 6.8.0
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: 4.0.8
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
+ * WC tested up to: 6.8.1
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
@@ -200,11 +200,6 @@ function fifu_get_photon_url($image, $size, $att_id) {
200
 
201
  }
202
 
203
- // Remove CDN prefix
204
- $matches = preg_split('/https:\/\//', $image[0]);
205
- if ($matches && count($matches) > 2)
206
- $image[0] = str_replace('https://' . $matches[1], '', $image[0]);
207
-
208
  $image[0] = fifu_jetpack_photon_url($image[0], $args);
209
  $image[0] = fifu_process_external_url($image[0], $att_id, $size);
210
 
200
 
201
  }
202
 
 
 
 
 
 
203
  $image[0] = fifu_jetpack_photon_url($image[0], $args);
204
  $image[0] = fifu_process_external_url($image[0], $att_id, $size);
205
 
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('amazon-adsystem.com', 'sapo.io', 'unsplash.com', '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', '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');
44
  foreach ($list as $domain) {
45
  if (strpos($url, $domain) !== false)
46
  return true;
@@ -67,7 +67,6 @@ function fifu_jetpack_photon_url($url, $args) {
67
  if (fifu_jetpack_ssl($url))
68
  $args['ssl'] = 1;
69
 
70
- $url = fifu_remove_cdn_prefix($url);
71
  $image_url_parts = wp_parse_url($url);
72
  if (!is_array($image_url_parts) || empty($image_url_parts['host']) || empty($image_url_parts['path']))
73
  return $url;
@@ -80,18 +79,3 @@ function fifu_jetpack_photon_url($url, $args) {
80
  return $photon_url;
81
  }
82
 
83
- function fifu_remove_cdn_prefix($url) {
84
- if (strpos($url, '%3A%2F%2F') !== false)
85
- $url = urldecode($url);
86
-
87
- $aux = preg_split('/[\/=]https:\/\//', $url);
88
- if (sizeof($aux) > 1)
89
- return 'https://' . $aux[1];
90
-
91
- $aux = preg_split('/[\/=]http:\/\//', $url);
92
- if (sizeof($aux) > 1)
93
- return 'http://' . $aux[1];
94
-
95
- return $url;
96
- }
97
-
31
  if (fifu_is_photon_url($url))
32
  return true;
33
 
34
+ $blocklist = array('amazon-adsystem.com', 'sapo.io', 'unsplash.com', '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
  }
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;
67
  if (fifu_jetpack_ssl($url))
68
  $args['ssl'] = 1;
69
 
 
70
  $image_url_parts = wp_parse_url($url);
71
  if (!is_array($image_url_parts) || empty($image_url_parts['host']) || empty($image_url_parts['path']))
72
  return $url;
79
  return $photon_url;
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/util.php CHANGED
@@ -173,6 +173,10 @@ function fifu_is_gravity_forms_active() {
173
  return is_plugin_active('gravityforms/gravityforms.php');
174
  }
175
 
 
 
 
 
176
  // active themes
177
 
178
  function fifu_is_flatsome_active() {
173
  return is_plugin_active('gravityforms/gravityforms.php');
174
  }
175
 
176
+ function fifu_is_multisite_global_media_active() {
177
+ return class_exists('\MultisiteGlobalMedia\Plugin');
178
+ }
179
+
180
  // active themes
181
 
182
  function fifu_is_flatsome_active() {
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.1
7
- Stable tag: 4.0.7
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -257,20 +257,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
257
 
258
  == Changelog ==
259
 
 
 
 
260
  = 4.0.7 =
261
  * Fix: integration with WCFM plugin was not working anymore.
262
 
263
  = 4.0.6 =
264
  * Fix: notice (Trying to get property ID of non-object).
265
 
266
- = 4.0.5 =
267
- * Fix: Auto Set Image Title (AUTO-DRAFT value was being saved for products without title).
268
-
269
  = others =
270
  * [more](https://fifu.app/changelog)
271
 
272
 
273
  == Upgrade Notice ==
274
 
275
- = 4.0.7 =
276
- * Fix: integration with WCFM plugin was not working anymore.
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 6.0.1
7
+ Stable tag: 4.0.8
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
257
 
258
  == Changelog ==
259
 
260
+ = 4.0.8 =
261
+ * Fix: CDN + Optimized Thumbnails (conflict with images from other CDNs); fix: conflict with Multisite Global Media plugin.
262
+
263
  = 4.0.7 =
264
  * Fix: integration with WCFM plugin was not working anymore.
265
 
266
  = 4.0.6 =
267
  * Fix: notice (Trying to get property ID of non-object).
268
 
 
 
 
269
  = others =
270
  * [more](https://fifu.app/changelog)
271
 
272
 
273
  == Upgrade Notice ==
274
 
275
+ = 4.0.8 =
276
+ * Fix: CDN + Optimized Thumbnails (conflict with images from other CDNs); fix: conflict with Multisite Global Media plugin.