Featured Image From URL - Version 2.4.3

Version Description

  • Bug fixes: lightbox image size; metadata cache and lockscreen.
Download this release

Release Info

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

Code changes from version 2.4.2 to 2.4.3

admin/api.php CHANGED
@@ -18,6 +18,13 @@ function fifu_data_clean_api(WP_REST_Request $request) {
18
  update_option('fifu_data_clean', 'toggleoff', 'no');
19
  }
20
 
 
 
 
 
 
 
 
21
  add_action('rest_api_init', function () {
22
  register_rest_route('featured-image-from-url/v2', '/enable_fake_api/', array(
23
  'methods' => 'POST',
18
  update_option('fifu_data_clean', 'toggleoff', 'no');
19
  }
20
 
21
+ function fifu_test_execution_time() {
22
+ for ($i = 0; $i <= 120; $i++) {
23
+ error_log($i);
24
+ sleep(1);
25
+ }
26
+ }
27
+
28
  add_action('rest_api_init', function () {
29
  register_rest_route('featured-image-from-url/v2', '/enable_fake_api/', array(
30
  'methods' => 'POST',
admin/db.php CHANGED
@@ -484,6 +484,7 @@ class FifuDb {
484
  $aux = $this->get_formatted_value(fifu_main_image_url($res->post_id), get_post_meta($res->post_id, 'fifu_image_alt', true), $res->post_id);
485
  $value = ($i == 1) ? $aux : ($value . "," . $aux);
486
  if ($value && (($i % $this->MAX_INSERT == 0) || ($i % $this->MAX_INSERT != 0 && count($result) == $count))) {
 
487
  $this->insert_attachment_by($value);
488
  $this->insert_thumbnail_id($ids);
489
  $this->insert_attachment_meta_url($ids);
@@ -501,24 +502,40 @@ class FifuDb {
501
 
502
  function delete_attachment() {
503
  $ids = null;
504
- $i = 0;
 
505
  // delete fake attachments and _thumbnail_ids
506
- foreach ($this->get_fake_attachments() as $res)
507
- $ids = ($i++ == 0) ? $res->id : ($ids . "," . $res->id);
508
- if ($ids) {
509
- $this->delete_thumbnail_ids($ids);
510
- $this->delete_attachments($ids);
 
 
 
 
 
 
 
511
  }
512
 
513
  $ids = null;
514
- $i = 0;
 
515
  // delete attachment data and more _thumbnail_ids
516
- foreach ($this->get_posts_with_url() as $res)
517
- $ids = ($i++ == 0) ? $res->post_id : ($ids . "," . $res->post_id);
518
- if ($ids) {
519
- $this->delete_invalid_thumbnail_ids($ids);
520
- $this->delete_fake_thumbnail_id($ids);
521
- $this->delete_attachment_meta_url($ids);
 
 
 
 
 
 
 
522
  }
523
 
524
  // delete data without attachment
484
  $aux = $this->get_formatted_value(fifu_main_image_url($res->post_id), get_post_meta($res->post_id, 'fifu_image_alt', true), $res->post_id);
485
  $value = ($i == 1) ? $aux : ($value . "," . $aux);
486
  if ($value && (($i % $this->MAX_INSERT == 0) || ($i % $this->MAX_INSERT != 0 && count($result) == $count))) {
487
+ wp_cache_flush();
488
  $this->insert_attachment_by($value);
489
  $this->insert_thumbnail_id($ids);
490
  $this->insert_attachment_meta_url($ids);
502
 
503
  function delete_attachment() {
504
  $ids = null;
505
+ $i = 1;
506
+ $count = 1;
507
  // delete fake attachments and _thumbnail_ids
508
+ $result = $this->get_fake_attachments();
509
+ foreach ($result as $res) {
510
+ $ids = ($i == 1) ? $res->id : ($ids . "," . $res->id);
511
+ if ($ids && (($i % $this->MAX_INSERT == 0) || ($i % $this->MAX_INSERT != 0 && count($result) == $count))) {
512
+ wp_cache_flush();
513
+ $this->delete_thumbnail_ids($ids);
514
+ $this->delete_attachments($ids);
515
+ $ids = null;
516
+ $i = 1;
517
+ } else
518
+ $i++;
519
+ $count++;
520
  }
521
 
522
  $ids = null;
523
+ $i = 1;
524
+ $count = 1;
525
  // delete attachment data and more _thumbnail_ids
526
+ $result = $this->get_posts_with_url();
527
+ foreach ($result as $res) {
528
+ $ids = ($i == 1) ? $res->post_id : ($ids . "," . $res->post_id);
529
+ if ($ids && (($i % $this->MAX_INSERT == 0) || ($i % $this->MAX_INSERT != 0 && count($result) == $count))) {
530
+ wp_cache_flush();
531
+ $this->delete_invalid_thumbnail_ids($ids);
532
+ $this->delete_fake_thumbnail_id($ids);
533
+ $this->delete_attachment_meta_url($ids);
534
+ $ids = null;
535
+ $i = 1;
536
+ } else
537
+ $i++;
538
+ $count++;
539
  }
540
 
541
  // delete data without attachment
admin/html/js/menu.js CHANGED
@@ -98,28 +98,29 @@ function fifu_fake_js() {
98
  console.log(jqXHR);
99
  console.log(textStatus);
100
  console.log(errorThrown);
101
- }
 
102
  });
103
  }
104
 
105
  function fifu_clean_js() {
106
- jQuery('.wrap').block({message: 'Please wait some seconds...', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
107
-
108
  if (jQuery("#fifu_toggle_data_clean").attr('class') != 'toggleon')
109
  return;
110
 
 
 
111
  jQuery.ajax({
112
  method: "POST",
113
  url: homeUrl() + '/wp-json/featured-image-from-url/v2/data_clean_api/',
114
  async: true,
115
  success: function (data) {
116
- jQuery('.wrap').unblock();
117
  window.location.href = '#tabs-j';
 
118
  location.reload();
119
  },
120
  error: function (jqXHR, textStatus, errorThrown) {
121
- jQuery('.wrap').unblock();
122
  window.location.href = '#tabs-j';
 
123
  location.reload();
124
  console.log(jqXHR);
125
  console.log(textStatus);
98
  console.log(jqXHR);
99
  console.log(textStatus);
100
  console.log(errorThrown);
101
+ },
102
+ timeout: 0
103
  });
104
  }
105
 
106
  function fifu_clean_js() {
 
 
107
  if (jQuery("#fifu_toggle_data_clean").attr('class') != 'toggleon')
108
  return;
109
 
110
+ jQuery('.wrap').block({message: 'Please wait some seconds...', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
111
+
112
  jQuery.ajax({
113
  method: "POST",
114
  url: homeUrl() + '/wp-json/featured-image-from-url/v2/data_clean_api/',
115
  async: true,
116
  success: function (data) {
 
117
  window.location.href = '#tabs-j';
118
+ jQuery("#fifu_toggle_data_clean").attr('toggleoff');
119
  location.reload();
120
  },
121
  error: function (jqXHR, textStatus, errorThrown) {
 
122
  window.location.href = '#tabs-j';
123
+ jQuery("#fifu_toggle_data_clean").attr('toggleoff');
124
  location.reload();
125
  console.log(jqXHR);
126
  console.log(textStatus);
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://featuredimagefromurl.com/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
- * Version: 2.4.2
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://featuredimagefromurl.com/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
+ * Version: 2.4.3
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/html/js/image.js CHANGED
@@ -37,9 +37,13 @@ function resizeImg($) {
37
  //original size
38
  var width = $(this)['0'].naturalWidth;
39
  var height = $(this)['0'].naturalHeight;
40
- var ratio = width / height;
41
- jQuery(this).attr('data-large_image_width', jQuery(window).width() * ratio);
42
- jQuery(this).attr('data-large_image_height', jQuery(window).width());
 
 
 
 
43
  });
44
  };
45
  resizeImage(imgSelector);
37
  //original size
38
  var width = $(this)['0'].naturalWidth;
39
  var height = $(this)['0'].naturalHeight;
40
+ jQuery(this).attr('data-large_image_width', width);
41
+ jQuery(this).attr('data-large_image_height', height);
42
+
43
+ //100%
44
+ //var ratio = width / height;
45
+ //jQuery(this).attr('data-large_image_width', jQuery(window).width() * ratio);
46
+ //jQuery(this).attr('data-large_image_height', jQuery(window).width());
47
  });
48
  };
49
  resizeImage(imgSelector);
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: marceljm
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, priority, seo, variable, tumblr, variation, product variation, shortcode
5
  Requires at least: 4.0
6
- Tested up to: 5.1.1
7
- Stable tag: 5.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -157,6 +157,9 @@ Features:
157
 
158
  == Changelog ==
159
 
 
 
 
160
  = 2.4.2 =
161
  * Bug fixes: examples of import files; broken favicon; metadata lockscreen; URLs from WordPress sites.
162
 
@@ -553,6 +556,9 @@ was removed. To finish, a Premium version is now been presented.
553
 
554
  == Upgrade Notice ==
555
 
 
 
 
556
  = 2.4.2 =
557
  * Bug fixes: examples of import files; broken favicon; metadata lockscreen; URLs from WordPress sites.
558
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, priority, seo, variable, tumblr, variation, product variation, shortcode
5
  Requires at least: 4.0
6
+ Tested up to: 5.2
7
+ Stable tag: 5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
157
 
158
  == Changelog ==
159
 
160
+ = 2.4.3 =
161
+ * Bug fixes: lightbox image size; metadata cache and lockscreen.
162
+
163
  = 2.4.2 =
164
  * Bug fixes: examples of import files; broken favicon; metadata lockscreen; URLs from WordPress sites.
165
 
556
 
557
  == Upgrade Notice ==
558
 
559
+ = 2.4.3 =
560
+ * Bug fixes: lightbox image size; metadata cache and lockscreen.
561
+
562
  = 2.4.2 =
563
  * Bug fixes: examples of import files; broken favicon; metadata lockscreen; URLs from WordPress sites.
564