Featured Image From URL - Version 4.1.2

Version Description

  • Fix: CDN + Optimized Thumbnails (conflict with Facebook images); fix: Lazy Load (conflict with Image and Video Gallery from Google Drive plugin).
Download this release

Release Info

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

Code changes from version 4.1.1 to 4.1.2

admin/db.php CHANGED
@@ -308,7 +308,7 @@ class FifuDb {
308
  // get last (images/videos/sliders/shortcodes)
309
  function get_last($meta_key) {
310
  return $this->wpdb->get_results("
311
- SELECT p.guid, pm.meta_value
312
  FROM " . $this->posts . " p
313
  INNER JOIN " . $this->postmeta . " pm ON p.id = pm.post_id
314
  WHERE pm.meta_key = '" . $meta_key . "'
308
  // get last (images/videos/sliders/shortcodes)
309
  function get_last($meta_key) {
310
  return $this->wpdb->get_results("
311
+ SELECT p.id, pm.meta_value
312
  FROM " . $this->posts . " p
313
  INNER JOIN " . $this->postmeta . " pm ON p.id = pm.post_id
314
  WHERE pm.meta_key = '" . $meta_key . "'
admin/menu.php CHANGED
@@ -477,7 +477,7 @@ function fifu_su_get_email() {
477
  function fifu_get_last($meta_key) {
478
  $list = '';
479
  foreach (fifu_db_get_last($meta_key) as $key => $row) {
480
- $aux = $row->meta_value . ' 
 |__ ' . $row->guid;
481
  $list .= '
 | ' . $aux;
482
  }
483
  return $list;
477
  function fifu_get_last($meta_key) {
478
  $list = '';
479
  foreach (fifu_db_get_last($meta_key) as $key => $row) {
480
+ $aux = $row->meta_value . ' 
 |__ ' . get_permalink($row->id);
481
  $list .= '
 | ' . $aux;
482
  }
483
  return $list;
admin/strings.php CHANGED
@@ -1419,7 +1419,7 @@ function fifu_get_strings_settings() {
1419
 
1420
  // category
1421
  $fifu['category']['desc'] = function () {
1422
- _e("Set one image to each category. The chosen image is the featured image from the most recent product from that category.", FIFU_SLUG);
1423
  };
1424
 
1425
  // grid
1419
 
1420
  // category
1421
  $fifu['category']['desc'] = function () {
1422
+ _e("Set one image for each category. The chosen image is the featured image from the most recent product from that category.", FIFU_SLUG);
1423
  };
1424
 
1425
  // grid
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/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
11
- * WC tested up to: 6.8.2
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/audio as featured image/video/audio of a post or WooCommerce product.
7
+ * Version: 4.1.2
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
+ * WC tested up to: 6.9.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
@@ -235,6 +235,7 @@ function fifu_callback($buffer) {
235
  $post_id = $data['post_id'];
236
  $att_id = $data['att_id'];
237
  $featured = $data['featured'];
 
238
  $theme_width = isset($data['theme-width']) ? $data['theme-width'] : null;
239
  $theme_height = isset($data['theme-height']) ? $data['theme-height'] : null;
240
 
@@ -242,6 +243,10 @@ function fifu_callback($buffer) {
242
  // add featured
243
  $newImgItem = str_replace('<img ', '<img fifu-featured="' . $featured . '" ', $imgItem);
244
 
 
 
 
 
245
  // add post_id
246
  if (get_post_type($post_id) == 'product')
247
  $newImgItem = str_replace('<img ', '<img product-id="' . $post_id . '" ', $newImgItem);
@@ -337,6 +342,10 @@ function fifu_filter_wp_get_attachment_metadata($data, $att_id) {
337
  }
338
 
339
  function fifu_add_url_parameters($url, $att_id, $size) {
 
 
 
 
340
  $post_id = get_post($att_id)->post_parent;
341
 
342
  if (!$post_id)
@@ -347,7 +356,14 @@ function fifu_add_url_parameters($url, $att_id, $size) {
347
  return fifu_optimized_column_image($url);
348
 
349
  $post_thumbnail_id = get_post_thumbnail_id($post_id);
350
- $post_thumbnail_id = $post_thumbnail_id ? $post_thumbnail_id : get_term_meta($post_id, 'thumbnail_id', true);
 
 
 
 
 
 
 
351
  $featured = $post_thumbnail_id == $att_id ? 1 : 0;
352
 
353
  if (!$featured)
@@ -361,6 +377,7 @@ function fifu_add_url_parameters($url, $att_id, $size) {
361
  $parameters['att_id'] = $att_id;
362
  $parameters['post_id'] = $post_id;
363
  $parameters['featured'] = $featured;
 
364
 
365
  // theme size
366
  if ($size && !is_array($size) && function_exists('wp_get_registered_image_subsizes')) {
235
  $post_id = $data['post_id'];
236
  $att_id = $data['att_id'];
237
  $featured = $data['featured'];
238
+ $is_category = $data['category'];
239
  $theme_width = isset($data['theme-width']) ? $data['theme-width'] : null;
240
  $theme_height = isset($data['theme-height']) ? $data['theme-height'] : null;
241
 
243
  // add featured
244
  $newImgItem = str_replace('<img ', '<img fifu-featured="' . $featured . '" ', $imgItem);
245
 
246
+ // add category
247
+ if ($is_category)
248
+ $newImgItem = str_replace('<img ', '<img fifu-category="1" ', $newImgItem);
249
+
250
  // add post_id
251
  if (get_post_type($post_id) == 'product')
252
  $newImgItem = str_replace('<img ', '<img product-id="' . $post_id . '" ', $newImgItem);
342
  }
343
 
344
  function fifu_add_url_parameters($url, $att_id, $size) {
345
+ // avoid duplicated call
346
+ if (isset($_SESSION[$url]))
347
+ return $url;
348
+
349
  $post_id = get_post($att_id)->post_parent;
350
 
351
  if (!$post_id)
356
  return fifu_optimized_column_image($url);
357
 
358
  $post_thumbnail_id = get_post_thumbnail_id($post_id);
359
+
360
+ $is_category = false;
361
+ if (!$post_thumbnail_id) {
362
+ $post_thumbnail_id = get_term_meta($post_id, 'thumbnail_id', true);
363
+ if ($post_thumbnail_id)
364
+ $is_category = true;
365
+ }
366
+
367
  $featured = $post_thumbnail_id == $att_id ? 1 : 0;
368
 
369
  if (!$featured)
377
  $parameters['att_id'] = $att_id;
378
  $parameters['post_id'] = $post_id;
379
  $parameters['featured'] = $featured;
380
+ $parameters['category'] = $is_category;
381
 
382
  // theme size
383
  if ($size && !is_array($size) && function_exists('wp_get_registered_image_subsizes')) {
includes/html/js/lazySizesConfig.js CHANGED
@@ -188,10 +188,14 @@ function fifu_lazy_ajax(selector = 'img') {
188
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
189
  return;
190
 
191
- // Flickr Album Gallery plugin
192
  if (jQuery(this).hasClass('flickr-img-responsive') || jQuery(this).hasClass('gall-img-responsive'))
193
  return;
194
 
 
 
 
 
195
  src = jQuery(this).attr('src');
196
  if (src && src.includes('cloud.fifu.app'))
197
  return;
188
  if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
189
  return;
190
 
191
+ // "Flickr Album Gallery" plugin
192
  if (jQuery(this).hasClass('flickr-img-responsive') || jQuery(this).hasClass('gall-img-responsive'))
193
  return;
194
 
195
+ // "Image and video gallery from Google Drive" plugin
196
+ if (jQuery(this).hasClass('sgdg-grid-img'))
197
+ return;
198
+
199
  src = jQuery(this).attr('src');
200
  if (src && src.includes('cloud.fifu.app'))
201
  return;
includes/html/og-image.html CHANGED
@@ -1 +1,3 @@
1
- <meta property="og:image" content="<?php echo $url ?>" />
 
 
1
+ <!-- FIFU: social tags for featured image (begin) -->
2
+ <meta property="og:image" content="<?php echo $url ?>" />
3
+ <!-- FIFU: social tags for featured image (end) -->
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', 'images.placeholders.dev');
35
  foreach ($blocklist as $domain) {
36
  if (strpos($url, $domain) !== false)
37
  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', 'fbcdn.net', 'cdn.fifu.app', 'cloud.fifu.app', 'images.placeholders.dev');
35
  foreach ($blocklist as $domain) {
36
  if (strpos($url, $domain) !== false)
37
  return true;
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.1
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.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.
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.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
262
 
263
  == Changelog ==
264
 
265
+ = 4.1.2 =
266
+ * Fix: CDN + Optimized Thumbnails (conflict with Facebook images); fix: Lazy Load (conflict with Image and Video Gallery from Google Drive plugin).
267
+
268
  = 4.1.1 =
269
  * 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.
270
 
271
  = 4.1.0 =
272
  * 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).
273
 
 
 
 
274
  = others =
275
  * [more](https://fifu.app/changelog)
276
 
277
 
278
  == Upgrade Notice ==
279
 
280
+ = 4.1.2 =
281
+ * Fix: CDN + Optimized Thumbnails (conflict with Facebook images); fix: Lazy Load (conflict with Image and Video Gallery from Google Drive plugin).