Featured Image From URL - Version 3.2.5

Version Description

  • Improvement: FIFU automatically saves the image dimensions now (for less style issues); deprecated: Original Sizes feature; bug fix: large URLs were being cropped; bug fix: menu settings was not being shown; bug fix: conflict with Accelerated Mobile Pages plugin; bug fix: conflict when category and product had the same ID; bug fix: conflict beteweem URL from Post Content and HTML character entities; bug fix: images not being shown in WooCommerce lightbox.
Download this release

Release Info

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

Code changes from version 3.2.4 to 3.2.5

admin/api.php CHANGED
@@ -2,55 +2,107 @@
2
 
3
  function fifu_enable_fake_api(WP_REST_Request $request) {
4
  fifu_enable_fake();
 
5
  }
6
 
7
  function fifu_disable_fake_api(WP_REST_Request $request) {
8
  fifu_disable_fake();
9
  delete_option('fifu_fake_attach_id');
 
10
  }
11
 
12
  function fifu_none_fake_api(WP_REST_Request $request) {
13
  update_option('fifu_fake_created', null, 'no');
 
14
  }
15
 
16
  function fifu_data_clean_api(WP_REST_Request $request) {
17
  fifu_db_enable_clean();
18
  update_option('fifu_data_clean', 'toggleoff', 'no');
 
19
  }
20
 
21
  function fifu_run_delete_all_api(WP_REST_Request $request) {
22
  fifu_db_delete_all();
23
  update_option('fifu_run_delete_all', 'toggleoff', 'no');
 
24
  }
25
 
26
- function fifu_save_dimensions_all_api(WP_REST_Request $request) {
27
- update_option('fifu_save_dimensions_all', 'toggleoff', 'no');
 
 
28
 
29
- if (fifu_is_off('fifu_save_dimensions'))
30
- return;
 
31
 
32
- fifu_db_save_dimensions_all();
 
33
  }
34
 
35
- function fifu_clean_dimensions_all_api(WP_REST_Request $request) {
36
- update_option('fifu_clean_dimensions_all', 'toggleoff', 'no');
37
 
38
- if (fifu_is_off('fifu_clean_dimensions'))
39
- return;
 
40
 
41
- fifu_db_clean_dimensions_all();
42
- }
 
43
 
44
- function fifu_disable_default_api(WP_REST_Request $request) {
45
- fifu_db_delete_default_url();
46
- }
47
 
48
- function fifu_none_default_api(WP_REST_Request $request) {
49
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  }
51
 
52
- function fifu_rest_url(WP_REST_Request $request) {
53
- return get_rest_url();
54
  }
55
 
56
  function fifu_test_execution_time() {
@@ -58,6 +110,7 @@ function fifu_test_execution_time() {
58
  error_log($i);
59
  sleep(1);
60
  }
 
61
  }
62
 
63
  add_action('rest_api_init', function () {
@@ -86,24 +139,24 @@ add_action('rest_api_init', function () {
86
  'callback' => 'fifu_run_delete_all_api',
87
  'permission_callback' => 'fifu_get_private_data_permissions_check',
88
  ));
89
- register_rest_route('featured-image-from-url/v2', '/save_dimensions_all_api/', array(
90
  'methods' => 'POST',
91
- 'callback' => 'fifu_save_dimensions_all_api',
92
  'permission_callback' => 'fifu_get_private_data_permissions_check',
93
  ));
94
- register_rest_route('featured-image-from-url/v2', '/clean_dimensions_all_api/', array(
95
  'methods' => 'POST',
96
- 'callback' => 'fifu_clean_dimensions_all_api',
97
  'permission_callback' => 'fifu_get_private_data_permissions_check',
98
  ));
99
- register_rest_route('featured-image-from-url/v2', '/disable_default_api/', array(
100
  'methods' => 'POST',
101
- 'callback' => 'fifu_disable_default_api',
102
  'permission_callback' => 'fifu_get_private_data_permissions_check',
103
  ));
104
- register_rest_route('featured-image-from-url/v2', '/none_default_api/', array(
105
  'methods' => 'POST',
106
- 'callback' => 'fifu_none_default_api',
107
  'permission_callback' => 'fifu_get_private_data_permissions_check',
108
  ));
109
  register_rest_route('featured-image-from-url/v2', '/rest_url_api/', array(
2
 
3
  function fifu_enable_fake_api(WP_REST_Request $request) {
4
  fifu_enable_fake();
5
+ return json_encode(array());
6
  }
7
 
8
  function fifu_disable_fake_api(WP_REST_Request $request) {
9
  fifu_disable_fake();
10
  delete_option('fifu_fake_attach_id');
11
+ return json_encode(array());
12
  }
13
 
14
  function fifu_none_fake_api(WP_REST_Request $request) {
15
  update_option('fifu_fake_created', null, 'no');
16
+ return json_encode(array());
17
  }
18
 
19
  function fifu_data_clean_api(WP_REST_Request $request) {
20
  fifu_db_enable_clean();
21
  update_option('fifu_data_clean', 'toggleoff', 'no');
22
+ return json_encode(array());
23
  }
24
 
25
  function fifu_run_delete_all_api(WP_REST_Request $request) {
26
  fifu_db_delete_all();
27
  update_option('fifu_run_delete_all', 'toggleoff', 'no');
28
+ return json_encode(array());
29
  }
30
 
31
+ function fifu_disable_default_api(WP_REST_Request $request) {
32
+ fifu_db_delete_default_url();
33
+ return json_encode(array());
34
+ }
35
 
36
+ function fifu_none_default_api(WP_REST_Request $request) {
37
+ return json_encode(array());
38
+ }
39
 
40
+ function fifu_rest_url(WP_REST_Request $request) {
41
+ return get_rest_url();
42
  }
43
 
44
+ function fifu_save_sizes_api(WP_REST_Request $request) {
45
+ $json = json_encode(array());
46
 
47
+ $att_id = $request['att_id'];
48
+ if (filter_var($att_id, FILTER_VALIDATE_INT) === false)
49
+ return $json;
50
 
51
+ $width = $request['width'];
52
+ if (filter_var($width, FILTER_VALIDATE_INT) === false)
53
+ return $json;
54
 
55
+ $height = $request['height'];
56
+ if (filter_var($height, FILTER_VALIDATE_INT) === false)
57
+ return $json;
58
 
59
+ $url = $request['url'];
60
+ if (filter_var($url, FILTER_SANITIZE_URL) === false)
61
+ return $json;
62
+
63
+ $att_id = filter_var($att_id, FILTER_SANITIZE_SPECIAL_CHARS);
64
+
65
+ if (!$att_id || !$width || !$height || !$url)
66
+ return $json;
67
+
68
+ $guid = get_the_guid($att_id);
69
+
70
+ if ($url != $guid)
71
+ return $json;
72
+
73
+ // mutex
74
+ $count = 0;
75
+ $timeout = 10;
76
+ $got_lock = true;
77
+ $fp = fopen(ABSPATH . 'fifu-lock', 'w') or die('Cannot create lock file');
78
+ while (!flock($fp, LOCK_EX | LOCK_NB, $wouldblock)) {
79
+ if ($wouldblock && $count++ < $timeout)
80
+ sleep(1);
81
+ else {
82
+ $got_lock = false;
83
+ break;
84
+ }
85
+ }
86
+ if (!$got_lock)
87
+ return $json;
88
+
89
+ if (get_post_field('post_author', $att_id) != FIFU_AUTHOR)
90
+ return;
91
+
92
+ // save
93
+ $metadata = get_post_meta($att_id, '_wp_attachment_metadata', true);
94
+ if (!$metadata || !$metadata['width'] || !$metadata['height']) {
95
+ $metadata = null;
96
+ $metadata['width'] = filter_var($width, FILTER_SANITIZE_SPECIAL_CHARS);
97
+ $metadata['height'] = filter_var($height, FILTER_SANITIZE_SPECIAL_CHARS);
98
+ wp_update_attachment_metadata($att_id, $metadata);
99
+ }
100
+
101
+ return $json;
102
  }
103
 
104
+ function fifu_api_list_all_without_dimensions(WP_REST_Request $request) {
105
+ return fifu_db_get_all_without_dimensions();
106
  }
107
 
108
  function fifu_test_execution_time() {
110
  error_log($i);
111
  sleep(1);
112
  }
113
+ return json_encode(array());
114
  }
115
 
116
  add_action('rest_api_init', function () {
139
  'callback' => 'fifu_run_delete_all_api',
140
  'permission_callback' => 'fifu_get_private_data_permissions_check',
141
  ));
142
+ register_rest_route('featured-image-from-url/v2', '/disable_default_api/', array(
143
  'methods' => 'POST',
144
+ 'callback' => 'fifu_disable_default_api',
145
  'permission_callback' => 'fifu_get_private_data_permissions_check',
146
  ));
147
+ register_rest_route('featured-image-from-url/v2', '/none_default_api/', array(
148
  'methods' => 'POST',
149
+ 'callback' => 'fifu_none_default_api',
150
  'permission_callback' => 'fifu_get_private_data_permissions_check',
151
  ));
152
+ register_rest_route('featured-image-from-url/v2', '/save_sizes_api/', array(
153
  'methods' => 'POST',
154
+ 'callback' => 'fifu_save_sizes_api',
155
  'permission_callback' => 'fifu_get_private_data_permissions_check',
156
  ));
157
+ register_rest_route('featured-image-from-url/v2', '/list_all_without_dimensions/', array(
158
  'methods' => 'POST',
159
+ 'callback' => 'fifu_api_list_all_without_dimensions',
160
  'permission_callback' => 'fifu_get_private_data_permissions_check',
161
  ));
162
  register_rest_route('featured-image-from-url/v2', '/rest_url_api/', array(
admin/category.php CHANGED
@@ -62,5 +62,11 @@ function fifu_ctgr_save_properties($term_id) {
62
  update_term_meta($term_id, 'fifu_image_url', fifu_convert($url));
63
  fifu_db_ctgr_update_fake_attach_id($term_id);
64
  }
 
 
 
 
 
 
65
  }
66
 
62
  update_term_meta($term_id, 'fifu_image_url', fifu_convert($url));
63
  fifu_db_ctgr_update_fake_attach_id($term_id);
64
  }
65
+
66
+ /* dimensions */
67
+ $width = fifu_get_width_meta($_POST);
68
+ $height = fifu_get_height_meta($_POST);
69
+ $att_id = get_term_meta($term_id, 'thumbnail_id', true);
70
+ fifu_save_dimensions($att_id, $width, $height);
71
  }
72
 
admin/db.php CHANGED
@@ -43,7 +43,9 @@ class FifuDb {
43
  /* attachment metadata */
44
 
45
  // insert 1 _wp_attached_file for each attachment
46
- function insert_attachment_meta_url($ids) {
 
 
47
  $this->wpdb->get_results("
48
  INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value) (
49
  SELECT p.id, '_wp_attached_file', p.guid
@@ -51,6 +53,7 @@ class FifuDb {
51
  WHERE p.post_parent IN (" . $ids . ")
52
  AND p.post_type = 'attachment'
53
  AND p.post_author = " . $this->author . "
 
54
  AND NOT EXISTS (
55
  SELECT 1
56
  FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_wp_attached_file') AS b
@@ -61,10 +64,12 @@ class FifuDb {
61
  }
62
 
63
  // delete 1 _wp_attached_file or _wp_attachment_image_alt for each attachment
64
- function delete_attachment_meta($ids) {
 
 
65
  $this->wpdb->get_results("
66
  DELETE FROM " . $this->postmeta . "
67
- WHERE meta_key IN ('_wp_attached_file', '_wp_attachment_image_alt')
68
  AND EXISTS (
69
  SELECT 1
70
  FROM " . $this->posts . " p
@@ -72,12 +77,15 @@ class FifuDb {
72
  AND p.post_parent IN (" . $ids . ")
73
  AND p.post_type = 'attachment'
74
  AND p.post_author = " . $this->author . "
 
75
  )"
76
  );
77
  }
78
 
79
  // insert 1 _wp_attachment_image_alt for each attachment
80
- function insert_attachment_meta_alt($ids) {
 
 
81
  $this->wpdb->get_results("
82
  INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value) (
83
  SELECT p.id, '_wp_attachment_image_alt', p.post_title
@@ -85,6 +93,7 @@ class FifuDb {
85
  WHERE p.post_parent IN (" . $ids . ")
86
  AND p.post_type = 'attachment'
87
  AND p.post_author = " . $this->author . "
 
88
  AND NOT EXISTS (
89
  SELECT 1
90
  FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_wp_attachment_image_alt') AS b
@@ -95,7 +104,9 @@ class FifuDb {
95
  }
96
 
97
  // insert 1 _thumbnail_id for each attachment (posts)
98
- function insert_thumbnail_id($ids) {
 
 
99
  $this->wpdb->get_results("
100
  INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value) (
101
  SELECT p.post_parent, '_thumbnail_id', p.id
@@ -103,6 +114,7 @@ class FifuDb {
103
  WHERE p.post_parent IN (" . $ids . ")
104
  AND p.post_type = 'attachment'
105
  AND p.post_author = " . $this->author . "
 
106
  AND NOT EXISTS (
107
  SELECT 1
108
  FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_thumbnail_id') AS b
@@ -186,20 +198,34 @@ class FifuDb {
186
  );
187
  }
188
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
189
  // get posts without dimensions
190
  function get_posts_without_dimensions() {
191
  return $this->wpdb->get_results("
192
- SELECT p.*
193
  FROM " . $this->posts . " p
194
- INNER JOIN " . $this->posts . " parent ON p.post_parent = parent.id AND parent.post_status NOT IN ('auto-draft', 'trash')
195
  WHERE p.post_type = 'attachment'
196
  AND p.post_author = " . $this->author . "
197
  AND p.post_status NOT IN ('auto-draft', 'trash')
198
  AND NOT EXISTS (
199
  SELECT 1
200
- FROM " . $this->postmeta . " pm
201
- WHERE p.id = pm.post_id
202
- AND pm.meta_key IN ('fifu_image_dimension')
203
  )
204
  ORDER BY p.id DESC"
205
  );
@@ -210,7 +236,6 @@ class FifuDb {
210
  return $this->wpdb->get_results("
211
  SELECT COUNT(1) AS amount
212
  FROM " . $this->posts . " p
213
- INNER JOIN " . $this->posts . " parent ON p.post_parent = parent.id AND parent.post_status NOT IN ('auto-draft', 'trash')
214
  WHERE p.post_type = 'attachment'
215
  AND p.post_author = " . $this->author . "
216
  AND p.post_status NOT IN ('auto-draft', 'trash')
@@ -218,7 +243,7 @@ class FifuDb {
218
  SELECT 1
219
  FROM " . $this->postmeta . " pm
220
  WHERE p.id = pm.post_id
221
- AND pm.meta_key IN ('fifu_image_dimension')
222
  )
223
  ORDER BY p.id DESC"
224
  );
@@ -268,6 +293,7 @@ class FifuDb {
268
  WHERE post_parent = " . $post_id . "
269
  AND post_type = 'attachment'
270
  AND post_author = " . $this->author . "
 
271
  AND NOT EXISTS (
272
  SELECT 1
273
  FROM " . $this->postmeta . "
@@ -286,7 +312,8 @@ class FifuDb {
286
  FROM " . $this->posts . "
287
  WHERE post_parent = " . $term_id . "
288
  AND post_type = 'attachment'
289
- AND post_author = " . $this->author . "
 
290
  AND NOT EXISTS (
291
  SELECT 1
292
  FROM " . $this->termmeta . "
@@ -415,7 +442,7 @@ class FifuDb {
415
  function delete_attachment_meta_url_and_alt($ids) {
416
  $this->wpdb->get_results("
417
  DELETE FROM " . $this->postmeta . "
418
- WHERE meta_key IN ('_wp_attached_file','_wp_attachment_image_alt')
419
  AND post_id IN (" . $ids . ")
420
  AND EXISTS (
421
  SELECT 1
@@ -449,7 +476,7 @@ class FifuDb {
449
  function delete_attachment_meta_without_attachment() {
450
  $this->wpdb->get_results("
451
  DELETE FROM " . $this->postmeta . "
452
- WHERE meta_key IN ('_wp_attached_file', '_wp_attachment_image_alt')
453
  AND NOT EXISTS (
454
  SELECT 1
455
  FROM " . $this->posts . " p
@@ -493,12 +520,7 @@ class FifuDb {
493
  );
494
  $this->wpdb->get_results("
495
  DELETE FROM " . $this->postmeta . "
496
- WHERE meta_key = '_wp_attached_file'
497
- AND meta_value IN ('Featured Image from URL', 'fifu.png')"
498
- );
499
- $this->wpdb->get_results("
500
- DELETE FROM " . $this->posts . "
501
- WHERE guid = 'http://fifu.png'"
502
  );
503
  }
504
 
@@ -510,20 +532,18 @@ class FifuDb {
510
  VALUES " . str_replace('\\', '', $value));
511
  }
512
 
513
- function get_formatted_value($url, $alt, $post_parent) {
514
- return "(" . $this->author . ", '" . $url . "', '" . str_replace("'", "", $alt) . "', 'image/jpeg', 'attachment', 'inherit', '" . $post_parent . "', now(), now(), now(), now(), '', '', '', '', '')";
 
 
515
  }
516
 
517
- /* insert dimension */
518
-
519
- function insert_dimension_by($value) {
520
- $this->wpdb->get_results("
521
- INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value)
522
- VALUES " . $value);
523
  }
524
 
525
- function get_formatted_dimension_value($post_id, $dimension) {
526
- return "(" . $post_id . ", 'fifu_image_dimension', '" . $dimension . "')";
527
  }
528
 
529
  /* insert fake internal featured image */
@@ -541,14 +561,14 @@ class FifuDb {
541
  $url = $result[0]->meta_value;
542
  }
543
  $url = htmlspecialchars_decode($url);
544
- $value = $this->get_formatted_value($url, get_term_meta($res->term_id, 'fifu_image_alt', true), $res->term_id);
545
- $this->insert_attachment_by($value);
546
  $att_id = $this->wpdb->insert_id;
547
  update_term_meta($res->term_id, 'thumbnail_id', $att_id);
548
  }
549
  if ($ids) {
550
- $this->insert_attachment_meta_url($ids);
551
- $this->insert_attachment_meta_alt($ids);
552
  }
553
  }
554
 
@@ -567,9 +587,9 @@ class FifuDb {
567
  if ($value && (($i % $this->MAX_INSERT == 0) || ($i % $this->MAX_INSERT != 0 && count($result) == $count))) {
568
  wp_cache_flush();
569
  $this->insert_attachment_by($value);
570
- $this->insert_thumbnail_id($ids);
571
- $this->insert_attachment_meta_url($ids);
572
- $this->insert_attachment_meta_alt($ids);
573
  $ids = null;
574
  $value = null;
575
  $i = 1;
@@ -633,47 +653,25 @@ class FifuDb {
633
  $ids = ($i++ == 0) ? $res->term_id : ($ids . "," . $res->term_id);
634
  if ($ids) {
635
  $this->delete_thumbnail_ids_category($ids);
636
- $this->delete_attachment_meta($ids);
637
  $this->delete_thumbnail_ids_category_without_attachment();
638
  }
639
  $this->delete_empty_urls_category();
640
  }
641
 
642
- /* dimensions: save all */
643
-
644
- function save_dimensions_all() {
645
- $value = null;
646
- // get all posts or all posts without dimensions
647
- $result = $this->get_posts_without_dimensions();
648
- foreach ($result as $res) {
649
- $post_id = $res->ID;
650
-
651
- // set featured image
652
- $url = $res->guid;
653
-
654
- if (!$url)
655
- continue;
656
-
657
- // get dimensions
658
- $dimension = fifu_get_dimension_backend($url);
659
-
660
- if (!$dimension)
661
- continue;
662
-
663
- $value = $this->get_formatted_dimension_value($post_id, $dimension);
664
- if ($value) {
665
- $this->insert_dimension_by($value);
666
- $value = null;
667
- }
668
- }
669
- }
670
-
671
  /* dimensions: clean all */
672
 
673
  function clean_dimensions_all() {
674
  $this->wpdb->get_results("
675
- DELETE FROM " . $this->postmeta . "
676
- WHERE meta_key = 'fifu_image_dimension'"
 
 
 
 
 
 
 
677
  );
678
  }
679
 
@@ -727,8 +725,6 @@ class FifuDb {
727
  $this->delete_attachments($attachments);
728
  }
729
  }
730
- if (fifu_is_on('fifu_save_dimensions'))
731
- fifu_update_or_delete_value($att_id, 'fifu_image_dimension', fifu_get_dimension_backend($url));
732
  }
733
  }
734
 
@@ -757,8 +753,8 @@ class FifuDb {
757
  }
758
  // insert
759
  else {
760
- $value = $this->get_formatted_value($url, $alt, $term_id);
761
- $this->insert_attachment_by($value);
762
  $att_id = $this->wpdb->insert_id;
763
  update_term_meta($term_id, 'thumbnail_id', $att_id);
764
  update_post_meta($att_id, '_wp_attached_file', $url);
@@ -886,11 +882,11 @@ function fifu_db_change_url_length() {
886
  $db->change_url_length();
887
  }
888
 
889
- /* dimensions: save all */
890
 
891
- function fifu_db_save_dimensions_all() {
892
  $db = new FifuDb();
893
- return $db->save_dimensions_all();
894
  }
895
 
896
  /* dimensions: clean all */
@@ -904,11 +900,8 @@ function fifu_db_clean_dimensions_all() {
904
 
905
  function fifu_db_missing_dimensions() {
906
  $db = new FifuDb();
907
- if (fifu_is_on('fifu_save_dimensions')) {
908
- $aux = $db->get_count_posts_without_dimensions()[0];
909
- return $aux ? $aux->amount : -1;
910
- }
911
- return null;
912
  }
913
 
914
  /* count: metadata */
@@ -1005,3 +998,10 @@ function fifu_db_delete_thumbnail_id_without_attachment() {
1005
  return $db->delete_thumbnail_id_without_attachment();
1006
  }
1007
 
 
 
 
 
 
 
 
43
  /* attachment metadata */
44
 
45
  // insert 1 _wp_attached_file for each attachment
46
+ function insert_attachment_meta_url($ids, $is_ctgr) {
47
+ $ctgr_sql = $is_ctgr ? "AND p.post_name LIKE 'fifu-category%'" : "";
48
+
49
  $this->wpdb->get_results("
50
  INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value) (
51
  SELECT p.id, '_wp_attached_file', p.guid
53
  WHERE p.post_parent IN (" . $ids . ")
54
  AND p.post_type = 'attachment'
55
  AND p.post_author = " . $this->author . "
56
+ " . $ctgr_sql . "
57
  AND NOT EXISTS (
58
  SELECT 1
59
  FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_wp_attached_file') AS b
64
  }
65
 
66
  // delete 1 _wp_attached_file or _wp_attachment_image_alt for each attachment
67
+ function delete_attachment_meta($ids, $is_ctgr) {
68
+ $ctgr_sql = $is_ctgr ? "AND p.post_name LIKE 'fifu-category%'" : "";
69
+
70
  $this->wpdb->get_results("
71
  DELETE FROM " . $this->postmeta . "
72
+ WHERE meta_key IN ('_wp_attached_file', '_wp_attachment_image_alt', '_wp_attachment_metadata')
73
  AND EXISTS (
74
  SELECT 1
75
  FROM " . $this->posts . " p
77
  AND p.post_parent IN (" . $ids . ")
78
  AND p.post_type = 'attachment'
79
  AND p.post_author = " . $this->author . "
80
+ " . $ctgr_sql . "
81
  )"
82
  );
83
  }
84
 
85
  // insert 1 _wp_attachment_image_alt for each attachment
86
+ function insert_attachment_meta_alt($ids, $is_ctgr) {
87
+ $ctgr_sql = $is_ctgr ? "AND p.post_name LIKE 'fifu-category%'" : "";
88
+
89
  $this->wpdb->get_results("
90
  INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value) (
91
  SELECT p.id, '_wp_attachment_image_alt', p.post_title
93
  WHERE p.post_parent IN (" . $ids . ")
94
  AND p.post_type = 'attachment'
95
  AND p.post_author = " . $this->author . "
96
+ " . $ctgr_sql . "
97
  AND NOT EXISTS (
98
  SELECT 1
99
  FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_wp_attachment_image_alt') AS b
104
  }
105
 
106
  // insert 1 _thumbnail_id for each attachment (posts)
107
+ function insert_thumbnail_id($ids, $is_ctgr) {
108
+ $ctgr_sql = $is_ctgr ? "AND p.post_name LIKE 'fifu-category%'" : "";
109
+
110
  $this->wpdb->get_results("
111
  INSERT INTO " . $this->postmeta . " (post_id, meta_key, meta_value) (
112
  SELECT p.post_parent, '_thumbnail_id', p.id
114
  WHERE p.post_parent IN (" . $ids . ")
115
  AND p.post_type = 'attachment'
116
  AND p.post_author = " . $this->author . "
117
+ " . $ctgr_sql . "
118
  AND NOT EXISTS (
119
  SELECT 1
120
  FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_thumbnail_id') AS b
198
  );
199
  }
200
 
201
+ // get att_id by post and url
202
+ function get_att_id($post_parent, $url, $is_ctgr) {
203
+ $ctgr_sql = $is_ctgr ? "AND p.post_name LIKE 'fifu-category%'" : "";
204
+
205
+ $result = $this->wpdb->get_results("
206
+ SELECT p.id
207
+ FROM " . $this->posts . " p
208
+ WHERE p.post_parent = " . $post_parent . "
209
+ AND p.guid = '" . $url . "'
210
+ AND post_author = " . $this->author . "
211
+ " . $ctgr_sql . "
212
+ LIMIT 1"
213
+ );
214
+ return $result ? $result[0]->id : null;
215
+ }
216
+
217
  // get posts without dimensions
218
  function get_posts_without_dimensions() {
219
  return $this->wpdb->get_results("
220
+ SELECT p.ID, p.guid
221
  FROM " . $this->posts . " p
 
222
  WHERE p.post_type = 'attachment'
223
  AND p.post_author = " . $this->author . "
224
  AND p.post_status NOT IN ('auto-draft', 'trash')
225
  AND NOT EXISTS (
226
  SELECT 1
227
+ FROM (SELECT post_id FROM " . $this->postmeta . " WHERE meta_key = '_wp_attachment_metadata') AS b
228
+ WHERE p.id = b.post_id
 
229
  )
230
  ORDER BY p.id DESC"
231
  );
236
  return $this->wpdb->get_results("
237
  SELECT COUNT(1) AS amount
238
  FROM " . $this->posts . " p
 
239
  WHERE p.post_type = 'attachment'
240
  AND p.post_author = " . $this->author . "
241
  AND p.post_status NOT IN ('auto-draft', 'trash')
243
  SELECT 1
244
  FROM " . $this->postmeta . " pm
245
  WHERE p.id = pm.post_id
246
+ AND pm.meta_key IN ('_wp_attachment_metadata')
247
  )
248
  ORDER BY p.id DESC"
249
  );
293
  WHERE post_parent = " . $post_id . "
294
  AND post_type = 'attachment'
295
  AND post_author = " . $this->author . "
296
+ AND post_name NOT LIKE 'fifu-category%'
297
  AND NOT EXISTS (
298
  SELECT 1
299
  FROM " . $this->postmeta . "
312
  FROM " . $this->posts . "
313
  WHERE post_parent = " . $term_id . "
314
  AND post_type = 'attachment'
315
+ AND post_author = " . $this->author . "
316
+ AND post_name LIKE 'fifu-category%'
317
  AND NOT EXISTS (
318
  SELECT 1
319
  FROM " . $this->termmeta . "
442
  function delete_attachment_meta_url_and_alt($ids) {
443
  $this->wpdb->get_results("
444
  DELETE FROM " . $this->postmeta . "
445
+ WHERE meta_key IN ('_wp_attached_file', '_wp_attachment_image_alt', '_wp_attachment_metadata')
446
  AND post_id IN (" . $ids . ")
447
  AND EXISTS (
448
  SELECT 1
476
  function delete_attachment_meta_without_attachment() {
477
  $this->wpdb->get_results("
478
  DELETE FROM " . $this->postmeta . "
479
+ WHERE meta_key IN ('_wp_attached_file', '_wp_attachment_image_alt', '_wp_attachment_metadata')
480
  AND NOT EXISTS (
481
  SELECT 1
482
  FROM " . $this->posts . " p
520
  );
521
  $this->wpdb->get_results("
522
  DELETE FROM " . $this->postmeta . "
523
+ WHERE meta_key = 'fifu_image_dimension'"
 
 
 
 
 
524
  );
525
  }
526
 
532
  VALUES " . str_replace('\\', '', $value));
533
  }
534
 
535
+ function insert_ctgr_attachment_by($value) {
536
+ $this->wpdb->get_results("
537
+ INSERT INTO " . $this->posts . " (post_author, guid, post_title, post_mime_type, post_type, post_status, post_parent, post_date, post_date_gmt, post_modified, post_modified_gmt, post_content, post_excerpt, to_ping, pinged, post_content_filtered, post_name)
538
+ VALUES " . str_replace('\\', '', $value));
539
  }
540
 
541
+ function get_formatted_value($url, $alt, $post_parent) {
542
+ return "(" . $this->author . ", '" . $url . "', '" . str_replace("'", "", $alt) . "', 'image/jpeg', 'attachment', 'inherit', '" . $post_parent . "', now(), now(), now(), now(), '', '', '', '', '')";
 
 
 
 
543
  }
544
 
545
+ function get_ctgr_formatted_value($url, $alt, $post_parent) {
546
+ return "(" . $this->author . ", '" . $url . "', '" . str_replace("'", "", $alt) . "', 'image/jpeg', 'attachment', 'inherit', '" . $post_parent . "', now(), now(), now(), now(), '', '', '', '', '', 'fifu-category-" . $post_parent . "')";
547
  }
548
 
549
  /* insert fake internal featured image */
561
  $url = $result[0]->meta_value;
562
  }
563
  $url = htmlspecialchars_decode($url);
564
+ $value = $this->get_ctgr_formatted_value($url, get_term_meta($res->term_id, 'fifu_image_alt', true), $res->term_id);
565
+ $this->insert_ctgr_attachment_by($value);
566
  $att_id = $this->wpdb->insert_id;
567
  update_term_meta($res->term_id, 'thumbnail_id', $att_id);
568
  }
569
  if ($ids) {
570
+ $this->insert_attachment_meta_url($ids, true);
571
+ $this->insert_attachment_meta_alt($ids, true);
572
  }
573
  }
574
 
587
  if ($value && (($i % $this->MAX_INSERT == 0) || ($i % $this->MAX_INSERT != 0 && count($result) == $count))) {
588
  wp_cache_flush();
589
  $this->insert_attachment_by($value);
590
+ $this->insert_thumbnail_id($ids, false);
591
+ $this->insert_attachment_meta_url($ids, false);
592
+ $this->insert_attachment_meta_alt($ids, false);
593
  $ids = null;
594
  $value = null;
595
  $i = 1;
653
  $ids = ($i++ == 0) ? $res->term_id : ($ids . "," . $res->term_id);
654
  if ($ids) {
655
  $this->delete_thumbnail_ids_category($ids);
656
+ $this->delete_attachment_meta($ids, true);
657
  $this->delete_thumbnail_ids_category_without_attachment();
658
  }
659
  $this->delete_empty_urls_category();
660
  }
661
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
662
  /* dimensions: clean all */
663
 
664
  function clean_dimensions_all() {
665
  $this->wpdb->get_results("
666
+ DELETE FROM " . $this->postmeta . " pm
667
+ WHERE pm.meta_key = '_wp_attachment_metadata'
668
+ AND EXISTS (
669
+ SELECT 1
670
+ FROM " . $this->posts . " p
671
+ WHERE p.id = pm.post_id
672
+ AND p.post_type = 'attachment'
673
+ AND p.post_author = " . $this->author . "
674
+ )"
675
  );
676
  }
677
 
725
  $this->delete_attachments($attachments);
726
  }
727
  }
 
 
728
  }
729
  }
730
 
753
  }
754
  // insert
755
  else {
756
+ $value = $this->get_ctgr_formatted_value($url, $alt, $term_id);
757
+ $this->insert_ctgr_attachment_by($value);
758
  $att_id = $this->wpdb->insert_id;
759
  update_term_meta($term_id, 'thumbnail_id', $att_id);
760
  update_post_meta($att_id, '_wp_attached_file', $url);
882
  $db->change_url_length();
883
  }
884
 
885
+ /* dimensions: get all */
886
 
887
+ function fifu_db_get_all_without_dimensions() {
888
  $db = new FifuDb();
889
+ return $db->get_posts_without_dimensions();
890
  }
891
 
892
  /* dimensions: clean all */
900
 
901
  function fifu_db_missing_dimensions() {
902
  $db = new FifuDb();
903
+ $aux = $db->get_count_posts_without_dimensions()[0];
904
+ return $aux ? $aux->amount : -1;
 
 
 
905
  }
906
 
907
  /* count: metadata */
998
  return $db->delete_thumbnail_id_without_attachment();
999
  }
1000
 
1001
+ /* att_id */
1002
+
1003
+ function fifu_db_get_att_id($post_parent, $url, $is_ctgr) {
1004
+ $db = new FifuDb();
1005
+ return $db->get_att_id($post_parent, $url, $is_ctgr);
1006
+ }
1007
+
admin/html/category.html CHANGED
@@ -6,7 +6,7 @@
6
  <?php esc_html_e('Featured image', 'featured-image-from-url'); ?>
7
  </td>
8
  <td>
9
- <div class="box">
10
  <?php include 'meta-box.html' ?>
11
  </div>
12
  </td>
6
  <?php esc_html_e('Featured image', 'featured-image-from-url'); ?>
7
  </td>
8
  <td>
9
+ <div class="box" style="max-width: 240px;">
10
  <?php include 'meta-box.html' ?>
11
  </div>
12
  </td>
admin/html/js/menu.js CHANGED
@@ -171,7 +171,6 @@ function fifu_run_delete_all_js() {
171
  return;
172
 
173
  fifu_run_clean_js();
174
- fifu_run_clean_dimensions_all_js();
175
 
176
  jQuery('#tabs-top').block({message: fifuScriptVars.wait, css: {backgroundColor: 'none', border: 'none', color: 'white'}});
177
 
@@ -199,70 +198,78 @@ function fifu_run_delete_all_js() {
199
  }
200
 
201
  function fifu_save_dimensions_all_js() {
202
- if (jQuery("#fifu_toggle_save_dimensions_all").attr('class') != 'toggleon')
203
- return;
204
-
205
  jQuery('#tabs-top').block({message: 'Please wait. It can take several minutes...', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
206
 
207
- interval = setInterval(function () {
208
- jQuery("#countdown").load(location.href + " #countdown");
209
- }, 3000);
210
-
211
  jQuery.ajax({
212
  method: "POST",
213
- url: restUrl + 'featured-image-from-url/v2/save_dimensions_all_api/',
214
  async: true,
215
  beforeSend: function (xhr) {
216
  xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
217
  },
218
  success: function (data) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  },
220
  error: function (jqXHR, textStatus, errorThrown) {
221
  console.log(jqXHR);
222
  console.log(textStatus);
223
  console.log(errorThrown);
224
  },
225
- complete: function () {
226
- setTimeout(function () {
227
- jQuery("#fifu_toggle_save_dimensions_all").attr('class', 'toggleoff');
228
- jQuery('#tabs-top').unblock();
229
- }, 1000);
230
- jQuery("#countdown").load(location.href + " #countdown");
231
- clearInterval(interval);
232
  }
233
  });
234
  }
235
 
236
- function fifu_clean_dimensions_all_js() {
237
- if (jQuery("#fifu_toggle_clean_dimensions_all").attr('class') != 'toggleon')
238
- return;
239
-
240
- fifu_run_clean_dimensions_all_js();
241
- }
242
 
243
- function fifu_run_clean_dimensions_all_js() {
244
- jQuery('#tabs-top').block({message: fifuScriptVars.wait, css: {backgroundColor: 'none', border: 'none', color: 'white'}});
245
 
246
  jQuery.ajax({
247
  method: "POST",
248
- url: restUrl + 'featured-image-from-url/v2/clean_dimensions_all_api/',
249
- async: true,
250
- beforeSend: function (xhr) {
251
- xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
252
- },
253
- success: function (data) {
254
  },
255
- error: function (jqXHR, textStatus, errorThrown) {
256
- console.log(jqXHR);
257
- console.log(textStatus);
258
- console.log(errorThrown);
 
259
  },
260
- complete: function () {
261
- setTimeout(function () {
262
- jQuery("#fifu_toggle_clean_dimensions_all").attr('class', 'toggleoff');
263
- jQuery('#tabs-top').unblock();
264
- }, 1000);
265
- jQuery("#countdown").load(location.href + " #countdown");
266
- }
267
  });
 
 
268
  }
171
  return;
172
 
173
  fifu_run_clean_js();
 
174
 
175
  jQuery('#tabs-top').block({message: fifuScriptVars.wait, css: {backgroundColor: 'none', border: 'none', color: 'white'}});
176
 
198
  }
199
 
200
  function fifu_save_dimensions_all_js() {
 
 
 
201
  jQuery('#tabs-top').block({message: 'Please wait. It can take several minutes...', css: {backgroundColor: 'none', border: 'none', color: 'white'}});
202
 
 
 
 
 
203
  jQuery.ajax({
204
  method: "POST",
205
+ url: restUrl + 'featured-image-from-url/v2/list_all_without_dimensions/',
206
  async: true,
207
  beforeSend: function (xhr) {
208
  xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
209
  },
210
  success: function (data) {
211
+ jQuery("#countdown").text(data.length);
212
+ var i = 0;
213
+ var count = data.length;
214
+ function dimensionsLoop() {
215
+ setTimeout(function () {
216
+ var image = new Image();
217
+ jQuery(image).attr('onload', 'fifu_get_sizes(this, ' + data[i]['ID'] + ')');
218
+ jQuery(image).attr('src', data[i]['guid']);
219
+ image = null;
220
+ jQuery("#countdown").text(--count);
221
+ i++;
222
+ if (i < data.length)
223
+ dimensionsLoop();
224
+ else {
225
+ jQuery('#tabs-top').unblock();
226
+ invert('save_dimensions_all');
227
+ jQuery("#countdown").text('done');
228
+ }
229
+ }, 500)
230
+ }
231
+ if (data.length > 0)
232
+ dimensionsLoop();
233
+ else {
234
+ jQuery('#tabs-top').unblock();
235
+ invert('save_dimensions_all');
236
+ jQuery("#countdown").text('done');
237
+ }
238
  },
239
  error: function (jqXHR, textStatus, errorThrown) {
240
  console.log(jqXHR);
241
  console.log(textStatus);
242
  console.log(errorThrown);
243
  },
244
+ complete: function (data) {
 
 
 
 
 
 
245
  }
246
  });
247
  }
248
 
249
+ function fifu_get_sizes($, att_id) {
250
+ width = jQuery($)[0].naturalWidth;
251
+ height = jQuery($)[0].naturalHeight;
 
 
 
252
 
253
+ if (width == 1 && height == 1)
254
+ return;
255
 
256
  jQuery.ajax({
257
  method: "POST",
258
+ url: restUrl + 'featured-image-from-url/v2/save_sizes_api/',
259
+ data: {
260
+ "width": width,
261
+ "height": height,
262
+ "att_id": att_id,
263
+ "url": jQuery($).attr('src'),
264
  },
265
+ async: false,
266
+ beforeSend: function (xhr) {
267
+ jQuery($).removeAttr('onload');
268
+ jQuery($).removeAttr('fifu-att-id');
269
+ xhr.setRequestHeader("X-WP-Nonce", fifuScriptVars.nonce);
270
  },
271
+ timeout: 10
 
 
 
 
 
 
272
  });
273
+
274
+ return;
275
  }
admin/html/js/meta-box.js CHANGED
@@ -57,6 +57,8 @@ function runPreview($url) {
57
  jQuery("#fifu_lightbox").attr('href', $url);
58
 
59
  if ($url) {
 
 
60
  jQuery("#fifu_button").hide();
61
  jQuery("#fifu_help").hide();
62
  jQuery("#fifu_premium").hide();
@@ -72,16 +74,6 @@ function runPreview($url) {
72
  }
73
  }
74
 
75
- function getMeta(url) {
76
- jQuery("<img/>", {
77
- load: function () {
78
- jQuery("#fifu_input_image_width").val(this.width);
79
- jQuery("#fifu_input_image_height").val(this.height);
80
- },
81
- src: url
82
- });
83
- }
84
-
85
  jQuery(document).ready(function () {
86
  jQuery("#fifu_next").on('click', function (evt) {
87
  evt.stopImmediatePropagation();
@@ -95,6 +87,15 @@ jQuery(document).ready(function () {
95
  jQuery.fancybox.open('<img src="' + jQuery("#fifu_input_url").val() + '" style="max-height:600px">');
96
  });
97
 
 
 
 
 
 
 
 
 
 
98
  jQuery('.fifu-hover').on('mouseover', function (evt) {
99
  jQuery(this).css('color', '#23282e');
100
  });
@@ -102,6 +103,23 @@ jQuery(document).ready(function () {
102
  jQuery(this).css('color', 'white');
103
  });
104
 
 
105
  jQuery("div#imageUrlMetaBox").find('h2').replaceWith('<h3 style="top:7px;position:relative;"><span class="dashicons dashicons-camera" style="font-size:15px"></span> Featured image</h3>');
106
  jQuery("div#urlMetaBox").find('h2').replaceWith('<h4 style="top:5px;position:relative;"><span class="dashicons dashicons-camera" style="font-size:15px"></span> Product image</h4>');
107
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  jQuery("#fifu_lightbox").attr('href', $url);
58
 
59
  if ($url) {
60
+ fifu_get_sizes();
61
+
62
  jQuery("#fifu_button").hide();
63
  jQuery("#fifu_help").hide();
64
  jQuery("#fifu_premium").hide();
74
  }
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
77
  jQuery(document).ready(function () {
78
  jQuery("#fifu_next").on('click', function (evt) {
79
  evt.stopImmediatePropagation();
87
  jQuery.fancybox.open('<img src="' + jQuery("#fifu_input_url").val() + '" style="max-height:600px">');
88
  });
89
 
90
+ // start
91
+ fifu_get_sizes();
92
+
93
+ // blur
94
+ jQuery("#fifu_input_url").on('input', function (evt) {
95
+ evt.stopImmediatePropagation();
96
+ fifu_get_sizes();
97
+ });
98
+
99
  jQuery('.fifu-hover').on('mouseover', function (evt) {
100
  jQuery(this).css('color', '#23282e');
101
  });
103
  jQuery(this).css('color', 'white');
104
  });
105
 
106
+ // title
107
  jQuery("div#imageUrlMetaBox").find('h2').replaceWith('<h3 style="top:7px;position:relative;"><span class="dashicons dashicons-camera" style="font-size:15px"></span> Featured image</h3>');
108
  jQuery("div#urlMetaBox").find('h2').replaceWith('<h4 style="top:5px;position:relative;"><span class="dashicons dashicons-camera" style="font-size:15px"></span> Product image</h4>');
109
  });
110
+
111
+ function fifu_get_sizes() {
112
+ image_url = jQuery("#fifu_input_url").val();
113
+ fifu_get_image(image_url);
114
+ }
115
+
116
+ function fifu_get_image(url) {
117
+ var image = new Image();
118
+ jQuery(image).attr('onload', 'fifu_store_sizes(this);');
119
+ jQuery(image).attr('src', url);
120
+ }
121
+
122
+ function fifu_store_sizes($) {
123
+ jQuery("#fifu_input_image_width").val($.naturalWidth);
124
+ jQuery("#fifu_input_image_height").val($.naturalHeight);
125
+ }
admin/html/menu.html CHANGED
@@ -22,55 +22,12 @@
22
  <li><a href="#tabs-o"><i class="fas fa-shopping-cart"></i> <?php esc_html_e('WooCommerce', 'featured-image-from-url'); ?></a></li>
23
  <li><a href="#tabs-p"><i class="fas fa-redo"></i> <?php esc_html_e('WP All Import', 'featured-image-from-url'); ?></a></li>
24
  <li><a href="#tabs-t"><i class="fas fa-info-circle"></i> <?php esc_html_e('Troubleshooting', 'featured-image-from-url'); ?></a></li>
25
- <li><a href="#tabs-a"><i class="fas fa-star"></i> Premium <b style="border-radius:2px;padding:3px;background-color:#32373c;color:white">$ 39.90</b></a></li>
26
  <br>
27
  <br>
28
- <div id="tabs-a">
29
- <a name="top"></a>
30
- <div class="box">
31
- <h2><?php esc_html_e('Feature of the month', 'featured-image-from-url'); ?></h2>
32
- <div class="greybox">
33
- <table>
34
- <tr>
35
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('July') ?></td>
36
- <td style="border-bottom:none"><?php esc_html_e('full integration between Featured Slider and Lazy Load', 'featured-image-from-url'); ?></td>
37
- </tr>
38
- <tr>
39
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('June') ?></td>
40
- <td style="border-bottom:none"><?php esc_html_e('Giphy Search', 'featured-image-from-url'); ?></td>
41
- </tr>
42
- <tr>
43
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('May') ?></td>
44
- <td style="border-bottom:none"><?php esc_html_e('Media RSS Tags', 'featured-image-from-url'); ?></td>
45
- </tr>
46
- <tr>
47
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('April') ?></td>
48
- <td style="border-bottom:none"><?php esc_html_e('embedded video can be replaced by its thumbnail + play button (drastically decreases the loading time)', 'featured-image-from-url'); ?></td>
49
- </tr>
50
- <tr>
51
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('March') ?></td>
52
- <td style="border-bottom:none"><?php esc_html_e('Google Chrome Extension for FIFU', 'featured-image-from-url'); ?></td>
53
- </tr>
54
- <tr>
55
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('February') ?></td>
56
- <td style="border-bottom:none"><?php esc_html_e('support to private videos from Vimeo', 'featured-image-from-url'); ?></td>
57
- </tr>
58
- <tr>
59
- <td style="border-bottom:none;text-align:right;"><?php esc_html_e('January') ?></td>
60
- <td style="border-bottom:none"><?php esc_html_e('integration with WooCoomerce Additional Variation Images plugin', 'featured-image-from-url'); ?></td>
61
- </tr>
62
- </table>
63
- </div>
64
- </div>
65
- <div class="box">
66
- <h2><a href="https://fifu.app/">Featured Image from URL Premium</a></h2>
67
- <iframe style="width:100%;height:600px" src="https://fifu.app/"></iframe>
68
- </div>
69
- </div>
70
 
71
  <div id="tabs-k">
72
  <div class="box">
73
- <h2><?php esc_html_e('Featured Image Column', 'featured-image-from-url'); ?></h2>
74
  <div class="greybox">
75
  <?php esc_html_e('The plugin adds a new column to your post list. Below you can choose the height (px) of the image in the column. To disable that, just uncheck "FIFU" in the Screen Options.', 'featured-image-from-url'); ?>
76
  </div>
@@ -85,7 +42,7 @@
85
  </div>
86
 
87
  <div class="box">
88
- <div class="fifu-pro">premium</div>
89
  <h2><?php esc_html_e('Gallery Fields', 'featured-image-from-url'); ?></h2>
90
  <div class="greybox" id="grad2">
91
  <?php esc_html_e('Choose the number of fields you have in the post editor.', 'featured-image-from-url'); ?><br><br>
@@ -93,7 +50,7 @@
93
  <tr>
94
  <th>
95
  <label for="fifu_input_spinner_image"
96
- placehold><?php esc_html_e('Image Gallery:', 'featured-image-from-url'); ?></label>
97
  </th>
98
  <th>
99
  <input id="fifu_input_spinner_image"
@@ -103,7 +60,7 @@
103
  </tr>
104
  <tr>
105
  <th>
106
- <label for="fifu_input_spinner_video"><?php esc_html_e('Video Gallery:', 'featured-image-from-url'); ?></label>
107
  </th>
108
  <th>
109
  <input id="fifu_input_spinner_video"
@@ -113,7 +70,7 @@
113
  </tr>
114
  <tr>
115
  <th>
116
- <label for="fifu_input_spinner_slider"><?php esc_html_e('Slider:', 'featured-image-from-url'); ?></label>
117
  </th>
118
  <th>
119
  <input id="fifu_input_spinner_slider"
@@ -126,69 +83,14 @@
126
  <br>
127
  <input type="submit" value="<?php esc_html_e('Submit', 'featured-image-from-url'); ?>" disabled>
128
  </div>
129
- <div class="box">
130
- <h2><?php esc_html_e('Database', 'featured-image-from-url'); ?></h2>
131
- <div class="greybox">
132
- <?php esc_html_e('Limit of rows to UPDATE, INSERT or DELETE by query. Higher this number, faster the features URL from Post Content > All Posts, Image Metadata and Clean Metadata. However, if you have too limited resources, don\'t increase this value too much, otherwise your database can bring down.', 'featured-image-from-url'); ?><br><br>
133
- <form
134
- id="fifu_form_db"
135
- action="javascript:void(0)"
136
- method="post">
137
 
138
- <table style="text-align:left">
139
- <tr>
140
- <th>
141
- <label for="fifu_input_spinner_db"
142
- placehold><?php esc_html_e('Rows Limit', 'featured-image-from-url'); ?></label>
143
- </th>
144
- <th>
145
- <input id="fifu_input_spinner_db"
146
- name="fifu_input_spinner_db"
147
- value="<?php echo $max_db; ?>"
148
- size="4">
149
- </th>
150
- <th>
151
- <input type="submit" value="<?php esc_html_e('Submit', 'featured-image-from-url'); ?>">
152
- </th>
153
- </tr>
154
- </table>
155
- </form>
156
- </div>
157
- </div>
158
- <div class="box">
159
- <div class="fifu-pro">premium</div>
160
- <h2><?php esc_html_e('Schedule Metadata Generation', 'featured-image-from-url'); ?></h2>
161
- <div class="greybox" id="grad2">
162
- <?php esc_html_e('If you are setting the image URLs in a nonstandard way, the images probably won\'t be shown at front-end because some extra metadata is required. Here you can schedule an event to run each N minutes and check if there is some image URL without metadata and create that. The FIFU keys are listed on WP All Import > Custom Fields.', 'featured-image-from-url'); ?><br><br>
163
- <table style="text-align:left">
164
- <tr>
165
- <th>
166
- <label for="fifu_input_spinner_cron_metadata"
167
- placehold><?php esc_html_e('Interval (minutes)', 'featured-image-from-url'); ?></label>
168
- </th>
169
- <th>
170
- <input id="fifu_input_spinner_cron_metadata"
171
- name="fifu_input_spinner_cron_metadata"
172
- size="4">
173
- </th>
174
- <th>
175
- <input type="submit" value="<?php esc_html_e('Submit', 'featured-image-from-url'); ?>" disabled>
176
- </th>
177
- </tr>
178
- </table>
179
- </div>
180
- <br>
181
- <input
182
- type="submit"
183
- href="javascript:void(0)"
184
- class="toggleoff"
185
- value=""
186
- style="display:block;border:none">
187
- </div>
188
  <div class="box">
189
  <h2><?php esc_html_e('Media Library', 'featured-image-from-url'); ?></h2>
190
  <div class="greybox">
191
  <?php esc_html_e('Show the external images in your media library.', 'featured-image-from-url'); ?>
 
 
 
192
  </div>
193
  <br>
194
  <form
@@ -257,7 +159,7 @@
257
  <h2><?php esc_html_e('Configuration', 'featured-image-from-url'); ?></h2>
258
  <div class="greybox">
259
  <?php esc_html_e('It reads the HTML of your post and use the 1st image (or video) URL found as Featured Image. It happens when you click on Publish (or Update) button.', 'featured-image-from-url'); ?><br/><br/>
260
- <b><?php esc_html_e('Important:', 'featured-image-from-url'); ?></b> <?php esc_html_e('the images need to be in an "img" HTML tag and videos in an "iframe" tag. Contents provided by [shortcode] can\'t be read.', 'featured-image-from-url'); ?>
261
  </div>
262
 
263
  <br>
@@ -390,14 +292,20 @@
390
  </table>
391
  </div>
392
  <div class="box">
393
- <div class="fifu-pro">premium</div>
394
  <h2><?php esc_html_e('All Posts', 'featured-image-from-url'); ?></h2>
395
  <div class="greybox" id="grad2">
396
- <?php esc_html_e('Update all your posts applying the configuration above. ', 'featured-image-from-url'); ?>
397
- <?php esc_html_e('It can take some minutes and can\'t be undone, so make a backup.', 'featured-image-from-url'); ?>
398
  <?php esc_html_e('To repeat the process enable the toggle again.', 'featured-image-from-url'); ?>
399
- <br><br>
400
- <?php esc_html_e('To schedule this process (hourly, daily etc), you can use the hook fifu_event with your favorite cron event plugin. Suggestion:', 'featured-image-from-url'); ?> <a href="https://wordpress.org/plugins/wp-crontrol/">WP Crontrol</a>.
 
 
 
 
 
 
 
401
  </div>
402
  <br>
403
  <table style="text-align:left">
@@ -432,7 +340,7 @@
432
  </div>
433
  <div id="tabs-g">
434
  <div class="box">
435
- <div class="fifu-pro">premium</div>
436
  <h2><?php esc_html_e('Same Height', 'featured-image-from-url'); ?></h2>
437
  <div class="greybox" id="grad2">
438
  <?php esc_html_e('If you have different sizes of images on your home (or shop), enable the toggle below to show them in the same height. Depending on your theme, it may be necessary to use a Selector to inform where is the group of images that you want to resize. ', 'featured-image-from-url'); ?>
@@ -568,7 +476,7 @@
568
  </div>
569
 
570
  <div class="box">
571
- <div class="fifu-pro">premium</div>
572
  <h2><?php esc_html_e('Giphy Search', 'featured-image-from-url'); ?></h2>
573
  <div class="greybox" id="grad2">
574
  <?php esc_html_e('Enable keyword gif search at featured image box.', 'featured-image-from-url'); ?>
@@ -589,7 +497,7 @@
589
  </div>
590
 
591
  <div class="box">
592
- <div class="fifu-pro">premium</div>
593
  <h2><?php esc_html_e('Unsplash Image Size', 'featured-image-from-url'); ?></h2>
594
  <div class="greybox" id="grad2">
595
  <?php esc_html_e('Choose the size of the Unsplash images (loaded randomly or via keywords search). Examples of valid sizes: 500x500, 300x400, 1920x1080... Or leave this field empty to get the original size.', 'featured-image-from-url'); ?>
@@ -605,7 +513,7 @@
605
  </div>
606
 
607
  <div class="box">
608
- <div class="fifu-pro">premium</div>
609
  <h2><?php esc_html_e('Replace Not Found Image', 'featured-image-from-url'); ?></h2>
610
  <div class="greybox" id="grad2">
611
  <?php esc_html_e('Define the URL of an image to be shown in case of image not found error.', 'featured-image-from-url'); ?>
@@ -620,42 +528,6 @@
620
  </div>
621
  </div>
622
 
623
- <div class="box">
624
- <h2><?php esc_html_e('Original Size', 'featured-image-from-url'); ?></h2>
625
- <div class="greybox">
626
- <?php esc_html_e('Useful if you have small images, here you can define if the image should be shown in the original size or resized to the dimensions of the available area.', 'featured-image-from-url'); ?>
627
- </div>
628
- <br>
629
- <table style="text-align:left">
630
- <tr>
631
- <th>
632
- <form
633
- id="fifu_form_original"
634
- action="javascript:void(0)"
635
- method="post">
636
- <input
637
- type="submit"
638
- href="javascript:void(0)"
639
- id="fifu_toggle_original"
640
- onclick="invert('original')"
641
- name="fifu_toggle_original"
642
- class="<?php echo $enable_original; ?>"
643
- value=""
644
- style="display:block;border:none">
645
- <input
646
- type="hidden"
647
- id="fifu_input_original"
648
- name="fifu_input_original"
649
- value="" >
650
- </form>
651
- </th>
652
- <th>
653
- <?php esc_html_e('original size', 'featured-image-from-url'); ?>
654
- </th>
655
- </tr>
656
- </table>
657
- </div>
658
-
659
  <div class="box">
660
  <h2><?php esc_html_e('Default Featured Image', 'featured-image-from-url'); ?></h2>
661
  <div class="greybox">
@@ -860,7 +732,7 @@
860
  </div>
861
 
862
  <div class="box">
863
- <div class="fifu-pro">premium</div>
864
  <h2><?php esc_html_e('Hover Effects', 'featured-image-from-url'); ?></h2>
865
  <div class="greybox" id="grad2">
866
  <?php esc_html_e('Choose a hover effect to be applied to the Featured Images on home.', 'featured-image-from-url'); ?>
@@ -899,7 +771,7 @@
899
  </div>
900
 
901
  <div class="box">
902
- <div class="fifu-pro">premium</div>
903
  <h2><?php esc_html_e('Image Validation', 'featured-image-from-url'); ?></h2>
904
  <div class="greybox" id="grad2">
905
  <?php esc_html_e('It checks images addresses and, when an image is not found, its URL is not saved. However, each validation can take some seconds. It is not integrated with URL from Post Content or REST API features.', 'featured-image-from-url'); ?>
@@ -962,132 +834,6 @@
962
  </form>
963
  </div>
964
 
965
- <div class="box">
966
-
967
- <h2><?php esc_html_e('Save Image Dimensions', 'featured-image-from-url'); ?></h2>
968
-
969
- <div class="greybox">
970
- <?php esc_html_e('Some themes and WooCommerce lightbox (PhotoSwipe) may need the image width and height to avoid style issues.', 'featured-image-from-url'); ?>
971
- </div>
972
-
973
- <br>
974
-
975
- <table style="text-align:left">
976
- <tr>
977
- <th>
978
- <form
979
- id="fifu_form_save_dimensions"
980
- action="javascript:void(0)"
981
- method="post">
982
- <input
983
- type="submit"
984
- href="javascript:void(0)"
985
- id="fifu_toggle_save_dimensions"
986
- onclick="invert('save_dimensions')"
987
- name="fifu_toggle_save_dimensions"
988
- class="<?php echo $enable_save_dimensions; ?>"
989
- value=""
990
- style="display:block;border:none">
991
-
992
- <input
993
- type="hidden"
994
- id="fifu_input_save_dimensions"
995
- name="fifu_input_save_dimensions"
996
- value="" >
997
- </form>
998
- </th>
999
- <th>
1000
- <?php esc_html_e('save and use image dimensions', 'featured-image-from-url'); ?>
1001
- </th>
1002
- </tr>
1003
- <tr>
1004
- <th>
1005
- <form
1006
- id="fifu_form_save_dimensions_all"
1007
- action="javascript:void(0)"
1008
- method="post">
1009
- <input
1010
- type="submit"
1011
- href="javascript:void(0)"
1012
- id="fifu_toggle_save_dimensions_all"
1013
- onclick="invert('save_dimensions_all'); fifu_save_dimensions_all_js();"
1014
- name="fifu_toggle_save_dimensions_all"
1015
- class="<?php echo $enable_save_dimensions_all; ?>"
1016
- value=""
1017
- style="display:block;border:none">
1018
-
1019
- <input
1020
- type="hidden"
1021
- id="fifu_input_save_dimensions_all"
1022
- name="fifu_input_save_dimensions_all"
1023
- value="" >
1024
- </form>
1025
- </th>
1026
- <th>
1027
- <?php esc_html_e('save the dimensions of all Featured Images now (it requires php-curl)', 'featured-image-from-url'); ?>
1028
- </th>
1029
- <th>
1030
- <div id="countdown"><?php echo fifu_db_missing_dimensions() ?></div>
1031
- </th>
1032
- </tr>
1033
- <tr>
1034
- <th>
1035
- <form
1036
- id="fifu_form_clean_dimensions_all"
1037
- action="javascript:void(0)"
1038
- method="post">
1039
- <input
1040
- type="submit"
1041
- href="javascript:void(0)"
1042
- id="fifu_toggle_clean_dimensions_all"
1043
- onclick="invert('clean_dimensions_all'); fifu_clean_dimensions_all_js();"
1044
- name="fifu_toggle_clean_dimensions_all"
1045
- class="<?php echo $enable_clean_dimensions_all; ?>"
1046
- value=""
1047
- style="display:block;border:none">
1048
-
1049
- <input
1050
- type="hidden"
1051
- id="fifu_input_clean_dimensions_all"
1052
- name="fifu_input_clean_dimensions_all"
1053
- value="" >
1054
- </form>
1055
- </th>
1056
- <th>
1057
- <?php esc_html_e('clean the dimensions of all Featured Images now', 'featured-image-from-url'); ?>
1058
- </th>
1059
- </tr>
1060
- <tr>
1061
- <th>
1062
- <form
1063
- id="fifu_form_save_dimensions_redirect"
1064
- action="javascript:void(0)"
1065
- method="post">
1066
- <input
1067
- type="submit"
1068
- href="javascript:void(0)"
1069
- id="fifu_toggle_save_dimensions_redirect"
1070
- onclick="invert('save_dimensions_redirect')"
1071
- name="fifu_toggle_save_dimensions_redirect"
1072
- class="<?php echo $enable_save_dimensions_redirect; ?>"
1073
- value=""
1074
- style="display:block;border:none">
1075
-
1076
- <input
1077
- type="hidden"
1078
- id="fifu_input_save_dimensions_redirect"
1079
- name="fifu_input_save_dimensions_redirect"
1080
- value="" >
1081
- </form>
1082
- </th>
1083
- <th>
1084
- <?php esc_html_e('follow redirects (it will make the process slower)', 'featured-image-from-url'); ?>
1085
- </th>
1086
- </tr>
1087
- </table>
1088
-
1089
- </div>
1090
-
1091
  </div>
1092
  <div id="tabs-j">
1093
  <div class="box">
@@ -1162,6 +908,106 @@
1162
  </table>
1163
  </div>
1164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1165
  <div class="box">
1166
 
1167
  <h2><?php esc_html_e('Delete All URLs', 'featured-image-from-url'); ?> <span class="dashicons dashicons-welcome-comments" style="font-size: 25px;" title="<?php esc_html_e('Requirement: access Plugins -> Plugin Editor -> Select plugin to edit -> Featured Image from URL -> Select. Then change the value of FIFU_DELETE_ALL_URLS from false to true.', 'featured-image-from-url'); ?>"></span></h2>
@@ -1235,7 +1081,7 @@
1235
  <div id="tabs-l">
1236
  <div class="box">
1237
 
1238
- <div class="fifu-pro">premium</div>
1239
  <h2><?php esc_html_e('Featured Shortcode', 'featured-image-from-url'); ?></h2>
1240
 
1241
  <div class="greybox" id="grad2">
@@ -1370,7 +1216,7 @@
1370
  <div id="tabs-c">
1371
  <div class="box">
1372
 
1373
- <div class="fifu-pro">premium</div>
1374
  <h2><?php esc_html_e('Featured Video', 'featured-image-from-url'); ?></h2>
1375
 
1376
  <div class="greybox" id="grad2">
@@ -1406,7 +1252,7 @@
1406
  </div>
1407
 
1408
  <div class="box">
1409
- <div class="fifu-pro">premium</div>
1410
  <h2><?php esc_html_e('Video Thumbnail', 'featured-image-from-url'); ?></h2>
1411
  <div class="greybox" id="grad2">
1412
  <?php esc_html_e('Show the video thumbnail instead of the video. Thumbnails are images, so they are loaded much faster than embedded videos.', 'featured-image-from-url'); ?>
@@ -1469,7 +1315,7 @@
1469
  </div>
1470
 
1471
  <div class="box">
1472
- <div class="fifu-pro">premium</div>
1473
  <h2><?php esc_html_e('Play Button', 'featured-image-from-url'); ?></h2>
1474
  <div class="greybox" id="grad2">
1475
  <?php esc_html_e('Add play button to video thumbnail. Clicking on that, the video starts inline or in a lightbox.', 'featured-image-from-url'); ?>
@@ -1535,7 +1381,7 @@
1535
  </div>
1536
 
1537
  <div class="box">
1538
- <div class="fifu-pro">premium</div>
1539
  <h2><?php esc_html_e('Minimum Width', 'featured-image-from-url'); ?></h2>
1540
  <div class="greybox" id="grad2">
1541
  <?php esc_html_e('Define a minimum width that a theme area should have to show a video. FIFU automatically shows a thumbnail when the minimum width is not reached.', 'featured-image-from-url'); ?>
@@ -1546,7 +1392,7 @@
1546
  </div>
1547
 
1548
  <div class="box">
1549
- <div class="fifu-pro">premium</div>
1550
  <h2><?php esc_html_e('Black Background', 'featured-image-from-url'); ?></h2>
1551
  <div class="greybox" id="grad2">
1552
  <?php esc_html_e('Unlike Youtube, Vimeo videos can\'t fit a theme area without generating a vertical padding. Here you can change the background color from transparent to black.', 'featured-image-from-url'); ?>
@@ -1570,7 +1416,7 @@
1570
  </div>
1571
 
1572
  <div class="box">
1573
- <div class="fifu-pro">premium</div>
1574
  <h2><?php esc_html_e('Mouseover Autoplay', 'featured-image-from-url'); ?></h2>
1575
  <div class="greybox" id="grad2">
1576
  <?php esc_html_e('Play a video on "mouseover" and pause on "mouseout".', 'featured-image-from-url'); ?>
@@ -1607,7 +1453,7 @@
1607
  </div>
1608
 
1609
  <div class="box">
1610
- <div class="fifu-pro">premium</div>
1611
  <h2><?php esc_html_e('Autoplay', 'featured-image-from-url'); ?></h2>
1612
  <div class="greybox" id="grad2">
1613
  <?php esc_html_e('Autoplay videos (available for YouTube and Vimeo).', 'featured-image-from-url'); ?>
@@ -1628,7 +1474,7 @@
1628
  </div>
1629
 
1630
  <div class="box">
1631
- <div class="fifu-pro">premium</div>
1632
  <h2><?php esc_html_e('Loop', 'featured-image-from-url'); ?></h2>
1633
  <div class="greybox" id="grad2">
1634
  <?php esc_html_e('Loop videos (available for YouTube and Vimeo).', 'featured-image-from-url'); ?>
@@ -1649,7 +1495,7 @@
1649
  </div>
1650
 
1651
  <div class="box">
1652
- <div class="fifu-pro">premium</div>
1653
  <h2><?php esc_html_e('Mute', 'featured-image-from-url'); ?></h2>
1654
  <div class="greybox" id="grad2">
1655
  <?php esc_html_e('Start the videos without audio (available for YouTube and Vimeo).', 'featured-image-from-url'); ?>
@@ -1671,7 +1517,7 @@
1671
 
1672
 
1673
  <div class="box">
1674
- <div class="fifu-pro">premium</div>
1675
  <h2><?php esc_html_e('Background Video', 'featured-image-from-url'); ?></h2>
1676
  <div class="greybox" id="grad2">
1677
  <?php esc_html_e('Start the videos in background, which means autoplay, no controls and no sound.', 'featured-image-from-url'); ?>
@@ -1695,7 +1541,7 @@
1695
  </div>
1696
 
1697
  <div class="box">
1698
- <div class="fifu-pro">premium</div>
1699
  <h2><?php esc_html_e('Related Videos', 'featured-image-from-url'); ?></h2>
1700
  <div class="greybox" id="grad2">
1701
  <?php esc_html_e('Show related videos when the video ends.', 'featured-image-from-url'); ?>
@@ -1719,7 +1565,7 @@
1719
  </div>
1720
 
1721
  <div class="box">
1722
- <div class="fifu-pro">premium</div>
1723
  <h2><?php esc_html_e('Gallery Icon', 'featured-image-from-url'); ?></h2>
1724
  <div class="greybox" id="grad2">
1725
  <?php esc_html_e('Add icons to the video thumbnails in the WooCommerce gallery.', 'featured-image-from-url'); ?>
@@ -1754,7 +1600,7 @@
1754
  </div>
1755
  <div id="tabs-m">
1756
  <div class="box">
1757
- <div class="fifu-pro">premium</div>
1758
  <h2><?php esc_html_e('Featured Slider', 'featured-image-from-url'); ?></h2>
1759
  <div class="greybox" id="grad2">
1760
  <?php esc_html_e('Define the slider settings here.', 'featured-image-from-url'); ?>
@@ -1926,7 +1772,7 @@
1926
  </table>
1927
  </div>
1928
  <div class="box">
1929
- <div class="fifu-pro">premium</div>
1930
  <h2><?php esc_html_e('Media RSS Tags', 'featured-image-from-url'); ?></h2>
1931
  <div class="greybox" id="grad2">
1932
  <?php esc_html_e('Add Media RSS tags in the RSS feed. This way, services that make use of RSS, such as Google News, can show the Featured Images.', 'featured-image-from-url'); ?>
@@ -1989,11 +1835,11 @@
1989
  </div>
1990
 
1991
  <div class="box">
1992
- <div class="fifu-pro">premium</div>
1993
- <h2><?php esc_html_e('Flickr Thumbnails', 'fifu-premium'); ?></h2>
1994
  <div class="greybox" id="grad2">
1995
- <?php esc_html_e('Flickr images have thumbnails and FIFU is able to load the exactly thumbnail your site needs. The supported sizes are 75, 100, 150, 240, 320, 500, 640, 800 and 1024 px width. Larger sizes can\'t be used due a different URL pattern.', 'fifu-premium'); ?><br><br>
1996
- <b><?php esc_html_e('Requirement:', 'fifu-premium'); ?></b> <?php esc_html_e('the Lazy Load feature should be enabled.', 'fifu-premium'); ?>
1997
  </div>
1998
  <br>
1999
  <input
@@ -2007,7 +1853,7 @@
2007
  <div id="tabs-q">
2008
  <div class="box">
2009
 
2010
- <div class="fifu-pro">premium</div>
2011
  <h2><?php esc_html_e('WP / WooCommerce REST API', 'featured-image-from-url'); ?></h2>
2012
 
2013
  <div class="greybox" id="grad2">
@@ -2318,7 +2164,7 @@
2318
 
2319
  <a name="category"></a>
2320
  <div class="box">
2321
- <div class="fifu-pro">premium</div>
2322
  <h2><?php esc_html_e('Auto Set Category Images', 'featured-image-from-url'); ?></h2>
2323
  <div class="greybox" id="grad2">
2324
  <?php esc_html_e('Set one image to each category. The chosen image is the Featured Image from the most recent product from that category.', 'featured-image-from-url'); ?>
@@ -2375,7 +2221,7 @@
2375
  <a name="variable"></a>
2376
 
2377
  <div class="box">
2378
- <div class="fifu-pro">premium</div>
2379
  <h2><?php esc_html_e('Variable Product', 'featured-image-from-url'); ?></h2>
2380
  <div class="greybox" id="grad2">
2381
  <?php esc_html_e('Add FIFU fields (Featured Image and Image Gallery) to product variations.', 'featured-image-from-url'); ?>
@@ -2654,7 +2500,7 @@
2654
  <div class="box">
2655
  <h2><?php esc_html_e('Fast support', 'featured-image-from-url'); ?></h2>
2656
  <div class="greybox">
2657
- <?php esc_html_e('If you need help, you can refer to', 'featured-image-from-url'); ?> <a href="admin.php?page=featured-image-from-url#tabs-t" target="_blank"><?php esc_html_e('troubleshooting', 'featured-image-from-url'); ?></a> <?php esc_html_e('or send an email to', 'featured-image-from-url'); ?><b> marcel@featuredimagefromurl.com</b> (<?php esc_html_e('with this', 'featured-image-from-url'); ?> <a href="admin.php?page=fifu-support-data"><button id="opener" onclick="jQuery('#tabs-top').block({message: '<?php esc_html_e('Please wait some seconds...', 'featured-image-from-url'); ?>', css: {backgroundColor: 'none', border: 'none', color: 'white'}});"><?php esc_html_e('status', 'featured-image-from-url'); ?></button></a>).
2658
  <br>
2659
  <br>
2660
  <table style="background-color: #fff; border-radius: 13px;">
@@ -2691,7 +2537,7 @@
2691
  <?php esc_html_e('Just send me an email. If you are available to discuss the details and the plugin is free and has more than 25,000 active installs, I should provide an integration very soon.', 'featured-image-from-url'); ?>
2692
  </td>
2693
  <td>
2694
- <?php esc_html_e('You can set Featured Images using custom fields. The main one is fifu_image_url and you can set that using REST API. For nonstandard automation, enable Schedule Metadata Generation, at Admin tab (no additional code required).', 'featured-image-from-url'); ?>
2695
  </td>
2696
  </tr>
2697
  </table>
@@ -2801,29 +2647,25 @@
2801
  </table>
2802
  </div>
2803
  </div>
2804
- <div class="box">
2805
- <h2>How to become a FIFU translator</h2>
2806
- <div class="greybox">
2807
- <table>
2808
- <tr>
2809
- <td style="width:16%;vertical-align:unset;">
2810
- <span class="dashicons dashicons-translation" style="font-size:110px"></span>
2811
- </td>
2812
- <td style="width:84%">
2813
- 1) please check if your NATIVE language is still available <a href="https://fifu.app/translate/" target="_blank">here</a> and get the language code (e.g. de_DE);<br>
2814
- 2) send an email to support@featuredimagefromurl.com with the subject <i>I'd like to translate FIFU to [language code]</i>;<br>
2815
- 3) please wait for an answer. Once you are accepted as an official translator, you will be responsible for:<br>
2816
- |_ translating the POT file in /plugins/featured-image-from-url/languages/ (~450 strings, including README);<br>
2817
- |_ uploading translations to <a href="https://translate.wordpress.org/projects/wp-plugins/featured-image-from-url/" target="_blank">WordPress.org</a>;<br>
2818
- |_ updating the translations periodically (once or twice a month is fine).<br>
2819
- And to thank you for your valuable efforts <b>you will receive the Premium version and updates</b>.<span class="dashicons dashicons-smiley" style="font-size:16px"></span>
2820
- </td>
2821
- </tr>
2822
- </table>
2823
- </div>
2824
- </div>
2825
  </div>
2826
  <div id="tabs-t">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2827
  <div class="box">
2828
  <table>
2829
  <tr>
@@ -3134,15 +2976,10 @@
3134
  <td style="border-bottom:none"><h3>WooCommerce</h3></td>
3135
  <td style="border-bottom:none">plugin</td>
3136
  </tr>
3137
- </table>
3138
- <div class="greybox" style="position: relative; top: -10px">
3139
- External image is not being shown on lightbox:<br>
3140
- 1) enable "FIFU Settings > Featured Image > Save Image Dimensions > save and use image dimensions";<br>
3141
- 2) enable "save the image dimensions of all external featured images now" (it will be automatically disabled when finished).<br>
3142
- </div>
3143
  <div class="greybox" style="position: relative; top: -10px">
3144
  Adding external "Product Image" and "Product Gallery" via SQL:<br>
3145
- 1) enable "FIFU Settings > Admin > Schedule Metadata Generation";<br>
3146
  2) run the SQL. Example: "insert into wp_postmeta (post_id, meta_key, meta_value) values (12345, 'fifu_list_url', 'URL1|URL2|URL3|URL4')"<br>
3147
  * the first URL is for the featured image and the others for the gallery<br>
3148
  </div>
@@ -3193,7 +3030,7 @@
3193
  </table>
3194
  <div class="greybox" style="position: relative; top: -10px">
3195
  Duplicating post and external featured image:<br>
3196
- 1) enable "FIFU Settings > Admin > Schedule Metadata Generation";<br>
3197
  2) access "Multisite Post Duplicator Settings";<br>
3198
  3) disable "Copy featured image when duplicating";<br>
3199
  4) disable "Copy post content images to destination media library";<br>
@@ -3217,20 +3054,6 @@
3217
  x) There is no local solution. Jetpack Related Posts documentation informs: "we do all the analysis, processing, and serving from our cloud". It means Jetpack would need to adapt its web service to work with the images provided by FIFU. So you may contact Jetpack support or install an alternative plugin for Related Posts, like <a href="https://wordpress.org/plugins/related-posts-thumbnails/">this</a>.<br>
3218
  </div>
3219
  </div>
3220
- <div class="box">
3221
- <table>
3222
- <tr>
3223
- <td style="border-bottom:none">2019-12-21</td>
3224
- <td style="border-bottom:none"><h3> thePLRstore | Bimber | Techwise</h3></td>
3225
- <td style="border-bottom:none">themes</td>
3226
- </tr>
3227
- </table>
3228
- <div class="greybox" style="position: relative; top: -10px">
3229
- Avoiding external featured images overlay:<br>
3230
- 1) enable "FIFU settings > Featured Image > Save Image Dimensions > save and use image dimensions";<br>
3231
- 2) enable "save the image dimensions of all external featured images now" (it will be automatically disabled when finished).<br>
3232
- </div>
3233
- </div>
3234
  <div class="box">
3235
  <table>
3236
  <tr>
@@ -3262,21 +3085,7 @@
3262
  Solving "Uncaught ReferenceError: jQuery is not defined"<br>
3263
  1) enable "FIFU settings > Admin > jQuery".<br>
3264
  </div>
3265
- </div>
3266
- <div class="box">
3267
- <table>
3268
- <tr>
3269
- <td style="border-bottom:none">2019-10-29</td>
3270
- <td style="border-bottom:none"><h3>The7 + The7 Elements + The7 WPBakery Page Builder</h3></td>
3271
- <td style="border-bottom:none">theme + plugins</td>
3272
- </tr>
3273
- </table>
3274
- <div class="greybox" style="position: relative; top: -10px">
3275
- Showing external featured images on "Blog Carousel":<br>
3276
- 1) enable "FIFU settings > Featured Image > Save Image Dimensions > save and use image dimensions";<br>
3277
- 2) enable "save the image dimensions of all external featured images now" (it will be automatically disabled when finished).<br>
3278
- </div>
3279
- </div>
3280
  <div class="box">
3281
  <table>
3282
  <tr>
@@ -3288,7 +3097,7 @@
3288
  <div class="greybox" style="position: relative; top: -10px">
3289
  Replacing http URLs by https:<br>
3290
  1) run this SQL command: UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://', 'https://') WHERE meta_key = 'fifu_image_url' AND meta_value LIKE '%site.com%';<br>
3291
- 2) enable "FIFU settings > Metadata > Clean Metadata" toggle (it will be automatically disabled after a few minutes);<br>
3292
  3) enable "Image Metadata".<br>
3293
  * replace site.com by the domain of the URLs you want to update
3294
  </div>
@@ -3314,12 +3123,12 @@
3314
  <td style="border-bottom:none"><h3>WPML Multilingual CMS + Translation Management</h3></td>
3315
  <td style="border-bottom:none">plugins</td>
3316
  </tr>
3317
- </table>
3318
  <div class="greybox" style="position: relative; top: -10px">
3319
  Copying the external featured image to the translation:<br>
3320
  1) access "WPML > Settings > Custom Fields Translation";<br>
3321
  2) search for "fifu_image_url", choose "Copy" and save;<br>
3322
- 3) if you use FIFU Premium, enable "Admin > Schedule Metadata Generation". That's all;<br>
3323
  4) but if you use the free version, after the translation post is created, access the post editor and click on "Update" button.<br>
3324
  </div>
3325
  </div>
@@ -3336,7 +3145,7 @@
3336
  0) make a backup (you might want to revert the changes later);<br>
3337
  1) deactivate Nelio;<br>
3338
  2) run this SQL command: INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT * FROM (SELECT post_id, 'fifu_image_url' AS meta_key, SUBSTRING_INDEX(SUBSTRING_INDEX(meta_value, '"', 2), '"', -1) AS meta_value FROM wp_postmeta WHERE meta_key = '_nelioefi_first_image') pm WHERE meta_value <> '';<br>
3339
- 3) enable "FIFU settings > Metadata > Clean Metadata" toggle (it will be automatically disabled after a few minutes);<br>
3340
  4) enable "Image Metadata".<br>
3341
  </div>
3342
  </div>
22
  <li><a href="#tabs-o"><i class="fas fa-shopping-cart"></i> <?php esc_html_e('WooCommerce', 'featured-image-from-url'); ?></a></li>
23
  <li><a href="#tabs-p"><i class="fas fa-redo"></i> <?php esc_html_e('WP All Import', 'featured-image-from-url'); ?></a></li>
24
  <li><a href="#tabs-t"><i class="fas fa-info-circle"></i> <?php esc_html_e('Troubleshooting', 'featured-image-from-url'); ?></a></li>
 
25
  <br>
26
  <br>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  <div id="tabs-k">
29
  <div class="box">
30
+ <h2><?php esc_html_e('FIFU Column', 'featured-image-from-url'); ?></h2>
31
  <div class="greybox">
32
  <?php esc_html_e('The plugin adds a new column to your post list. Below you can choose the height (px) of the image in the column. To disable that, just uncheck "FIFU" in the Screen Options.', 'featured-image-from-url'); ?>
33
  </div>
42
  </div>
43
 
44
  <div class="box">
45
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
46
  <h2><?php esc_html_e('Gallery Fields', 'featured-image-from-url'); ?></h2>
47
  <div class="greybox" id="grad2">
48
  <?php esc_html_e('Choose the number of fields you have in the post editor.', 'featured-image-from-url'); ?><br><br>
50
  <tr>
51
  <th>
52
  <label for="fifu_input_spinner_image"
53
+ placehold><?php esc_html_e('WooCommerce Image Gallery:', 'featured-image-from-url'); ?></label>
54
  </th>
55
  <th>
56
  <input id="fifu_input_spinner_image"
60
  </tr>
61
  <tr>
62
  <th>
63
+ <label for="fifu_input_spinner_video"><?php esc_html_e('WooCommerce Video Gallery:', 'featured-image-from-url'); ?></label>
64
  </th>
65
  <th>
66
  <input id="fifu_input_spinner_video"
70
  </tr>
71
  <tr>
72
  <th>
73
+ <label for="fifu_input_spinner_slider"><?php esc_html_e('Featured Slider:', 'featured-image-from-url'); ?></label>
74
  </th>
75
  <th>
76
  <input id="fifu_input_spinner_slider"
83
  <br>
84
  <input type="submit" value="<?php esc_html_e('Submit', 'featured-image-from-url'); ?>" disabled>
85
  </div>
 
 
 
 
 
 
 
 
86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  <div class="box">
88
  <h2><?php esc_html_e('Media Library', 'featured-image-from-url'); ?></h2>
89
  <div class="greybox">
90
  <?php esc_html_e('Show the external images in your media library.', 'featured-image-from-url'); ?>
91
+ <br>
92
+ <br>
93
+ <b><?php esc_html_e('Important:', 'featured-image-from-url'); ?></b> <?php esc_html_e('if some external image is not being shown in the media library, run Metadata > Save Image Dimensions.', 'featured-image-from-url'); ?>
94
  </div>
95
  <br>
96
  <form
159
  <h2><?php esc_html_e('Configuration', 'featured-image-from-url'); ?></h2>
160
  <div class="greybox">
161
  <?php esc_html_e('It reads the HTML of your post and use the 1st image (or video) URL found as Featured Image. It happens when you click on Publish (or Update) button.', 'featured-image-from-url'); ?><br/><br/>
162
+ <b><?php esc_html_e('Requirement:', 'featured-image-from-url'); ?></b> <?php esc_html_e('the images need to be in an "img" HTML tag and videos in an "iframe" tag. Contents provided by [shortcode] can\'t be read.', 'featured-image-from-url'); ?>
163
  </div>
164
 
165
  <br>
292
  </table>
293
  </div>
294
  <div class="box">
295
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
296
  <h2><?php esc_html_e('All Posts', 'featured-image-from-url'); ?></h2>
297
  <div class="greybox" id="grad2">
298
+ <?php esc_html_e('Update all your posts applying the configuration above. ', 'featured-image-from-url'); ?>
 
299
  <?php esc_html_e('To repeat the process enable the toggle again.', 'featured-image-from-url'); ?>
300
+ <br/>
301
+ <br/>
302
+ <b><?php esc_html_e('Important: ', 'featured-image-from-url'); ?></b><?php esc_html_e('this process can take several minutes and can\'t be undone, so make a backup.', 'featured-image-from-url'); ?>
303
+ <br/>
304
+ <br/>
305
+ <b><?php esc_html_e('Requirement: ', 'featured-image-from-url'); ?></b><?php esc_html_e('if you have thousands of posts, access wp-config.php and add "set_time_limit(1800);" before the "Happy publishing" line. This ensures the process won\'t be killed before 30 minutes (the default value is 30 seconds).', 'featured-image-from-url'); ?>
306
+ <br/>
307
+ <br/>
308
+ <b><?php esc_html_e('Tip: ', 'featured-image-from-url'); ?></b><?php esc_html_e('to schedule this process (hourly, daily etc), you can use the hook fifu_event with your favorite cron event plugin. Suggestion:', 'featured-image-from-url'); ?> <a href="https://wordpress.org/plugins/wp-crontrol/">WP Crontrol</a>.
309
  </div>
310
  <br>
311
  <table style="text-align:left">
340
  </div>
341
  <div id="tabs-g">
342
  <div class="box">
343
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
344
  <h2><?php esc_html_e('Same Height', 'featured-image-from-url'); ?></h2>
345
  <div class="greybox" id="grad2">
346
  <?php esc_html_e('If you have different sizes of images on your home (or shop), enable the toggle below to show them in the same height. Depending on your theme, it may be necessary to use a Selector to inform where is the group of images that you want to resize. ', 'featured-image-from-url'); ?>
476
  </div>
477
 
478
  <div class="box">
479
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
480
  <h2><?php esc_html_e('Giphy Search', 'featured-image-from-url'); ?></h2>
481
  <div class="greybox" id="grad2">
482
  <?php esc_html_e('Enable keyword gif search at featured image box.', 'featured-image-from-url'); ?>
497
  </div>
498
 
499
  <div class="box">
500
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
501
  <h2><?php esc_html_e('Unsplash Image Size', 'featured-image-from-url'); ?></h2>
502
  <div class="greybox" id="grad2">
503
  <?php esc_html_e('Choose the size of the Unsplash images (loaded randomly or via keywords search). Examples of valid sizes: 500x500, 300x400, 1920x1080... Or leave this field empty to get the original size.', 'featured-image-from-url'); ?>
513
  </div>
514
 
515
  <div class="box">
516
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
517
  <h2><?php esc_html_e('Replace Not Found Image', 'featured-image-from-url'); ?></h2>
518
  <div class="greybox" id="grad2">
519
  <?php esc_html_e('Define the URL of an image to be shown in case of image not found error.', 'featured-image-from-url'); ?>
528
  </div>
529
  </div>
530
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  <div class="box">
532
  <h2><?php esc_html_e('Default Featured Image', 'featured-image-from-url'); ?></h2>
533
  <div class="greybox">
732
  </div>
733
 
734
  <div class="box">
735
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
736
  <h2><?php esc_html_e('Hover Effects', 'featured-image-from-url'); ?></h2>
737
  <div class="greybox" id="grad2">
738
  <?php esc_html_e('Choose a hover effect to be applied to the Featured Images on home.', 'featured-image-from-url'); ?>
771
  </div>
772
 
773
  <div class="box">
774
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
775
  <h2><?php esc_html_e('Image Validation', 'featured-image-from-url'); ?></h2>
776
  <div class="greybox" id="grad2">
777
  <?php esc_html_e('It checks images addresses and, when an image is not found, its URL is not saved. However, each validation can take some seconds. It is not integrated with URL from Post Content or REST API features.', 'featured-image-from-url'); ?>
834
  </form>
835
  </div>
836
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
837
  </div>
838
  <div id="tabs-j">
839
  <div class="box">
908
  </table>
909
  </div>
910
 
911
+ <div class="box">
912
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
913
+ <h2><?php esc_html_e('Schedule Metadata Generation', 'featured-image-from-url'); ?></h2>
914
+ <div class="greybox" id="grad2">
915
+ <?php esc_html_e('If you are setting the image URLs in a nonstandard way, the images probably won\'t be shown at front-end because some extra metadata is required. Here you can schedule an event to run each N minutes and check if there is some image URL without metadata and create that. The FIFU keys are listed on WP All Import > Custom Fields.', 'featured-image-from-url'); ?><br><br>
916
+ <table style="text-align:left">
917
+ <tr>
918
+ <th>
919
+ <label for="fifu_input_spinner_cron_metadata"
920
+ placehold><?php esc_html_e('Interval (minutes)', 'featured-image-from-url'); ?></label>
921
+ </th>
922
+ <th>
923
+ <input id="fifu_input_spinner_cron_metadata"
924
+ name="fifu_input_spinner_cron_metadata"
925
+ size="4">
926
+ </th>
927
+ <th>
928
+ <input type="submit" value="<?php esc_html_e('Submit', 'featured-image-from-url'); ?>" disabled>
929
+ </th>
930
+ </tr>
931
+ </table>
932
+ </div>
933
+ <br>
934
+ <input
935
+ type="submit"
936
+ href="javascript:void(0)"
937
+ class="toggleoff"
938
+ value=""
939
+ style="display:block;border:none">
940
+ </div>
941
+
942
+ <div class="box">
943
+
944
+ <h2><?php esc_html_e('Save Image Dimensions', 'featured-image-from-url'); ?></h2>
945
+
946
+ <div class="greybox">
947
+ <?php esc_html_e('Some themes and plugins may not work correctly without image dimensions. This feature can get ~100 images dimensions by minute.', 'featured-image-from-url'); ?>
948
+ </div>
949
+
950
+ <br>
951
+
952
+ <table style="text-align:left">
953
+ <tr>
954
+ <th>
955
+ <form
956
+ id="fifu_form_save_dimensions_all"
957
+ action="javascript:void(0)"
958
+ method="post">
959
+ <input
960
+ type="submit"
961
+ href="javascript:void(0)"
962
+ id="fifu_toggle_save_dimensions_all"
963
+ onclick="invert('save_dimensions_all');
964
+ fifu_save_dimensions_all_js();"
965
+ name="fifu_toggle_save_dimensions_all"
966
+ class="toggleoff"
967
+ value=""
968
+ style="display:block;border:none">
969
+ </form>
970
+ </th>
971
+ <th>
972
+ <?php esc_html_e('save the dimensions of all featured images now:', 'featured-image-from-url'); ?>
973
+ </th>
974
+ <th>
975
+ <div id="countdown"><?php echo fifu_db_missing_dimensions() ?></div>
976
+ </th>
977
+ </tr>
978
+ </table>
979
+ </div>
980
+
981
+ <div class="box">
982
+ <h2><?php esc_html_e('Database', 'featured-image-from-url'); ?></h2>
983
+ <div class="greybox">
984
+ <?php esc_html_e('Limit of rows to UPDATE, INSERT or DELETE by query. Higher this number, faster the features URL from Post Content > All Posts, Image Metadata and Clean Metadata. However, if you have too limited resources, don\'t increase this value too much, otherwise your database can bring down.', 'featured-image-from-url'); ?><br><br>
985
+ <form
986
+ id="fifu_form_db"
987
+ action="javascript:void(0)"
988
+ method="post">
989
+
990
+ <table style="text-align:left">
991
+ <tr>
992
+ <th>
993
+ <label for="fifu_input_spinner_db"
994
+ placehold><?php esc_html_e('Rows Limit', 'featured-image-from-url'); ?></label>
995
+ </th>
996
+ <th>
997
+ <input id="fifu_input_spinner_db"
998
+ name="fifu_input_spinner_db"
999
+ value="<?php echo $max_db; ?>"
1000
+ size="4">
1001
+ </th>
1002
+ <th>
1003
+ <input type="submit" value="<?php esc_html_e('Submit', 'featured-image-from-url'); ?>">
1004
+ </th>
1005
+ </tr>
1006
+ </table>
1007
+ </form>
1008
+ </div>
1009
+ </div>
1010
+
1011
  <div class="box">
1012
 
1013
  <h2><?php esc_html_e('Delete All URLs', 'featured-image-from-url'); ?> <span class="dashicons dashicons-welcome-comments" style="font-size: 25px;" title="<?php esc_html_e('Requirement: access Plugins -> Plugin Editor -> Select plugin to edit -> Featured Image from URL -> Select. Then change the value of FIFU_DELETE_ALL_URLS from false to true.', 'featured-image-from-url'); ?>"></span></h2>
1081
  <div id="tabs-l">
1082
  <div class="box">
1083
 
1084
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1085
  <h2><?php esc_html_e('Featured Shortcode', 'featured-image-from-url'); ?></h2>
1086
 
1087
  <div class="greybox" id="grad2">
1216
  <div id="tabs-c">
1217
  <div class="box">
1218
 
1219
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1220
  <h2><?php esc_html_e('Featured Video', 'featured-image-from-url'); ?></h2>
1221
 
1222
  <div class="greybox" id="grad2">
1252
  </div>
1253
 
1254
  <div class="box">
1255
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1256
  <h2><?php esc_html_e('Video Thumbnail', 'featured-image-from-url'); ?></h2>
1257
  <div class="greybox" id="grad2">
1258
  <?php esc_html_e('Show the video thumbnail instead of the video. Thumbnails are images, so they are loaded much faster than embedded videos.', 'featured-image-from-url'); ?>
1315
  </div>
1316
 
1317
  <div class="box">
1318
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1319
  <h2><?php esc_html_e('Play Button', 'featured-image-from-url'); ?></h2>
1320
  <div class="greybox" id="grad2">
1321
  <?php esc_html_e('Add play button to video thumbnail. Clicking on that, the video starts inline or in a lightbox.', 'featured-image-from-url'); ?>
1381
  </div>
1382
 
1383
  <div class="box">
1384
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1385
  <h2><?php esc_html_e('Minimum Width', 'featured-image-from-url'); ?></h2>
1386
  <div class="greybox" id="grad2">
1387
  <?php esc_html_e('Define a minimum width that a theme area should have to show a video. FIFU automatically shows a thumbnail when the minimum width is not reached.', 'featured-image-from-url'); ?>
1392
  </div>
1393
 
1394
  <div class="box">
1395
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1396
  <h2><?php esc_html_e('Black Background', 'featured-image-from-url'); ?></h2>
1397
  <div class="greybox" id="grad2">
1398
  <?php esc_html_e('Unlike Youtube, Vimeo videos can\'t fit a theme area without generating a vertical padding. Here you can change the background color from transparent to black.', 'featured-image-from-url'); ?>
1416
  </div>
1417
 
1418
  <div class="box">
1419
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1420
  <h2><?php esc_html_e('Mouseover Autoplay', 'featured-image-from-url'); ?></h2>
1421
  <div class="greybox" id="grad2">
1422
  <?php esc_html_e('Play a video on "mouseover" and pause on "mouseout".', 'featured-image-from-url'); ?>
1453
  </div>
1454
 
1455
  <div class="box">
1456
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1457
  <h2><?php esc_html_e('Autoplay', 'featured-image-from-url'); ?></h2>
1458
  <div class="greybox" id="grad2">
1459
  <?php esc_html_e('Autoplay videos (available for YouTube and Vimeo).', 'featured-image-from-url'); ?>
1474
  </div>
1475
 
1476
  <div class="box">
1477
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1478
  <h2><?php esc_html_e('Loop', 'featured-image-from-url'); ?></h2>
1479
  <div class="greybox" id="grad2">
1480
  <?php esc_html_e('Loop videos (available for YouTube and Vimeo).', 'featured-image-from-url'); ?>
1495
  </div>
1496
 
1497
  <div class="box">
1498
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1499
  <h2><?php esc_html_e('Mute', 'featured-image-from-url'); ?></h2>
1500
  <div class="greybox" id="grad2">
1501
  <?php esc_html_e('Start the videos without audio (available for YouTube and Vimeo).', 'featured-image-from-url'); ?>
1517
 
1518
 
1519
  <div class="box">
1520
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1521
  <h2><?php esc_html_e('Background Video', 'featured-image-from-url'); ?></h2>
1522
  <div class="greybox" id="grad2">
1523
  <?php esc_html_e('Start the videos in background, which means autoplay, no controls and no sound.', 'featured-image-from-url'); ?>
1541
  </div>
1542
 
1543
  <div class="box">
1544
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1545
  <h2><?php esc_html_e('Related Videos', 'featured-image-from-url'); ?></h2>
1546
  <div class="greybox" id="grad2">
1547
  <?php esc_html_e('Show related videos when the video ends.', 'featured-image-from-url'); ?>
1565
  </div>
1566
 
1567
  <div class="box">
1568
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1569
  <h2><?php esc_html_e('Gallery Icon', 'featured-image-from-url'); ?></h2>
1570
  <div class="greybox" id="grad2">
1571
  <?php esc_html_e('Add icons to the video thumbnails in the WooCommerce gallery.', 'featured-image-from-url'); ?>
1600
  </div>
1601
  <div id="tabs-m">
1602
  <div class="box">
1603
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1604
  <h2><?php esc_html_e('Featured Slider', 'featured-image-from-url'); ?></h2>
1605
  <div class="greybox" id="grad2">
1606
  <?php esc_html_e('Define the slider settings here.', 'featured-image-from-url'); ?>
1772
  </table>
1773
  </div>
1774
  <div class="box">
1775
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1776
  <h2><?php esc_html_e('Media RSS Tags', 'featured-image-from-url'); ?></h2>
1777
  <div class="greybox" id="grad2">
1778
  <?php esc_html_e('Add Media RSS tags in the RSS feed. This way, services that make use of RSS, such as Google News, can show the Featured Images.', 'featured-image-from-url'); ?>
1835
  </div>
1836
 
1837
  <div class="box">
1838
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1839
+ <h2><?php esc_html_e('Flickr Thumbnails', 'featured-image-from-url'); ?></h2>
1840
  <div class="greybox" id="grad2">
1841
+ <?php esc_html_e('Flickr images have thumbnails and FIFU is able to load the exactly thumbnail your site needs. The supported sizes are 75, 100, 150, 240, 320, 500, 640, 800 and 1024 px width. Larger sizes can\'t be used due a different URL pattern.', 'featured-image-from-url'); ?><br><br>
1842
+ <b><?php esc_html_e('Requirement:', 'featured-image-from-url'); ?></b> <?php esc_html_e('the Lazy Load feature should be enabled.', 'featured-image-from-url'); ?>
1843
  </div>
1844
  <br>
1845
  <input
1853
  <div id="tabs-q">
1854
  <div class="box">
1855
 
1856
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
1857
  <h2><?php esc_html_e('WP / WooCommerce REST API', 'featured-image-from-url'); ?></h2>
1858
 
1859
  <div class="greybox" id="grad2">
2164
 
2165
  <a name="category"></a>
2166
  <div class="box">
2167
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
2168
  <h2><?php esc_html_e('Auto Set Category Images', 'featured-image-from-url'); ?></h2>
2169
  <div class="greybox" id="grad2">
2170
  <?php esc_html_e('Set one image to each category. The chosen image is the Featured Image from the most recent product from that category.', 'featured-image-from-url'); ?>
2221
  <a name="variable"></a>
2222
 
2223
  <div class="box">
2224
+ <div class="fifu-pro"><a href="https://fifu.app" target="_blank" style="color:grey">premium</a></div>
2225
  <h2><?php esc_html_e('Variable Product', 'featured-image-from-url'); ?></h2>
2226
  <div class="greybox" id="grad2">
2227
  <?php esc_html_e('Add FIFU fields (Featured Image and Image Gallery) to product variations.', 'featured-image-from-url'); ?>
2500
  <div class="box">
2501
  <h2><?php esc_html_e('Fast support', 'featured-image-from-url'); ?></h2>
2502
  <div class="greybox">
2503
+ <?php esc_html_e('If you need help, you can refer to', 'featured-image-from-url'); ?> <a href="admin.php?page=featured-image-from-url#tabs-t" target="_blank"><?php esc_html_e('troubleshooting', 'featured-image-from-url'); ?></a> <?php esc_html_e('or send an email to', 'featured-image-from-url'); ?><b> marcel@featuredimagefromurl.com</b> (<?php esc_html_e('with this', 'featured-image-from-url'); ?> <a href="admin.php?page=fifu-support-data"><button id="opener" onclick="jQuery('#tabs-top').block({message: '<?php esc_html_e('Please wait some seconds...', 'featured - image - from - url'); ?>', css: {backgroundColor: 'none', border: 'none', color: 'white'}});"><?php esc_html_e('status', 'featured-image-from-url'); ?></button></a>).
2504
  <br>
2505
  <br>
2506
  <table style="background-color: #fff; border-radius: 13px;">
2537
  <?php esc_html_e('Just send me an email. If you are available to discuss the details and the plugin is free and has more than 25,000 active installs, I should provide an integration very soon.', 'featured-image-from-url'); ?>
2538
  </td>
2539
  <td>
2540
+ <?php esc_html_e('You can set Featured Images using custom fields. The main one is fifu_image_url and you can set that using REST API. For nonstandard automation you can call fifu_dev_set_image() or enable Schedule Metadata Generation.', 'featured-image-from-url'); ?>
2541
  </td>
2542
  </tr>
2543
  </table>
2647
  </table>
2648
  </div>
2649
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2650
  </div>
2651
  <div id="tabs-t">
2652
+ <div class="box">
2653
+ <table>
2654
+ <tr>
2655
+ <td style="border-bottom:none">2020-08-13</td>
2656
+ <td style="border-bottom:none"><h3> WooCommerce REST API</h3></td>
2657
+ <td style="border-bottom:none">API</td>
2658
+ </tr>
2659
+ </table>
2660
+ <div class="greybox" style="position: relative; top: -10px">
2661
+ The import of dozens / hundreds of thousands of products isn't fast enough:<br>
2662
+ 1) deactivate FIFU;<br>
2663
+ 2) import the products using the API;<br>
2664
+ 3) activate FIFU;<br>
2665
+ 4) run Metadata > Clean Metadata;<br>
2666
+ 5) enable Metadata > Image Metadata.<br>
2667
+ </div>
2668
+ </div>
2669
  <div class="box">
2670
  <table>
2671
  <tr>
2976
  <td style="border-bottom:none"><h3>WooCommerce</h3></td>
2977
  <td style="border-bottom:none">plugin</td>
2978
  </tr>
2979
+ </table>
 
 
 
 
 
2980
  <div class="greybox" style="position: relative; top: -10px">
2981
  Adding external "Product Image" and "Product Gallery" via SQL:<br>
2982
+ 1) enable "FIFU Settings > Metadata > Schedule Metadata Generation";<br>
2983
  2) run the SQL. Example: "insert into wp_postmeta (post_id, meta_key, meta_value) values (12345, 'fifu_list_url', 'URL1|URL2|URL3|URL4')"<br>
2984
  * the first URL is for the featured image and the others for the gallery<br>
2985
  </div>
3030
  </table>
3031
  <div class="greybox" style="position: relative; top: -10px">
3032
  Duplicating post and external featured image:<br>
3033
+ 1) enable "FIFU Settings > Metadata > Schedule Metadata Generation";<br>
3034
  2) access "Multisite Post Duplicator Settings";<br>
3035
  3) disable "Copy featured image when duplicating";<br>
3036
  4) disable "Copy post content images to destination media library";<br>
3054
  x) There is no local solution. Jetpack Related Posts documentation informs: "we do all the analysis, processing, and serving from our cloud". It means Jetpack would need to adapt its web service to work with the images provided by FIFU. So you may contact Jetpack support or install an alternative plugin for Related Posts, like <a href="https://wordpress.org/plugins/related-posts-thumbnails/">this</a>.<br>
3055
  </div>
3056
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3057
  <div class="box">
3058
  <table>
3059
  <tr>
3085
  Solving "Uncaught ReferenceError: jQuery is not defined"<br>
3086
  1) enable "FIFU settings > Admin > jQuery".<br>
3087
  </div>
3088
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3089
  <div class="box">
3090
  <table>
3091
  <tr>
3097
  <div class="greybox" style="position: relative; top: -10px">
3098
  Replacing http URLs by https:<br>
3099
  1) run this SQL command: UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://', 'https://') WHERE meta_key = 'fifu_image_url' AND meta_value LIKE '%site.com%';<br>
3100
+ 2) run "FIFU settings > Metadata > Clean Metadata";<br>
3101
  3) enable "Image Metadata".<br>
3102
  * replace site.com by the domain of the URLs you want to update
3103
  </div>
3123
  <td style="border-bottom:none"><h3>WPML Multilingual CMS + Translation Management</h3></td>
3124
  <td style="border-bottom:none">plugins</td>
3125
  </tr>
3126
+ </table>
3127
  <div class="greybox" style="position: relative; top: -10px">
3128
  Copying the external featured image to the translation:<br>
3129
  1) access "WPML > Settings > Custom Fields Translation";<br>
3130
  2) search for "fifu_image_url", choose "Copy" and save;<br>
3131
+ 3) if you use FIFU Premium, enable "Metadata > Schedule Metadata Generation". That's all;<br>
3132
  4) but if you use the free version, after the translation post is created, access the post editor and click on "Update" button.<br>
3133
  </div>
3134
  </div>
3145
  0) make a backup (you might want to revert the changes later);<br>
3146
  1) deactivate Nelio;<br>
3147
  2) run this SQL command: INSERT INTO wp_postmeta (post_id, meta_key, meta_value) SELECT * FROM (SELECT post_id, 'fifu_image_url' AS meta_key, SUBSTRING_INDEX(SUBSTRING_INDEX(meta_value, '"', 2), '"', -1) AS meta_value FROM wp_postmeta WHERE meta_key = '_nelioefi_first_image') pm WHERE meta_value <> '';<br>
3148
+ 3) run "FIFU settings > Metadata > Clean Metadata";<br>
3149
  4) enable "Image Metadata".<br>
3150
  </div>
3151
  </div>
admin/html/support-data.html CHANGED
@@ -23,7 +23,6 @@ Plugins:<?php echo fifu_get_plugins_list() ?>;
23
  Active Plugins:<?php echo fifu_get_active_plugins_list() ?>;
24
  fifu_auto_alt:<?php echo $enable_auto_alt ?>;
25
  fifu_class:<?php echo $enable_class ?>;
26
- fifu_clean_dimensions_all:<?php echo $enable_clean_dimensions_all ?>;
27
  fifu_column_height:<?php echo $column_height ?>;
28
  fifu_confirm_delete_all:<?php echo $enable_confirm_delete_all ?>;
29
  fifu_confirm_delete_all_time:<?php echo $enable_confirm_delete_all_time ?>;
@@ -43,15 +42,11 @@ fifu_hide_post:<?php echo $enable_hide_post ?>;
43
  fifu_jquery:<?php echo $enable_jquery ?>;
44
  fifu_lazy:<?php echo $enable_lazy ?>;
45
  fifu_media_library:<?php echo $enable_media_library ?>;
46
- fifu_original:<?php echo $enable_original ?>;
47
  fifu_ovw_first:<?php echo $enable_ovw_first ?>;
48
  fifu_pop_first:<?php echo $enable_pop_first ?>;
49
  fifu_query_strings:<?php echo $enable_query_strings ?>;
50
  fifu_run_delete_all:<?php echo $enable_run_delete_all ?>;
51
  fifu_run_delete_all_time:<?php echo $enable_run_delete_all_time ?>;
52
- fifu_save_dimensions:<?php echo $enable_save_dimensions ?>;
53
- fifu_save_dimensions_all:<?php echo $enable_save_dimensions_all ?>;
54
- fifu_save_dimensions_redirect:<?php echo $enable_save_dimensions_redirect ?>;
55
  fifu_social:<?php echo $enable_social ?>;
56
  fifu_social_image_only:<?php echo $enable_social_image_only ?>;
57
  fifu_spinner_db:<?php echo $max_db ?>;
23
  Active Plugins:<?php echo fifu_get_active_plugins_list() ?>;
24
  fifu_auto_alt:<?php echo $enable_auto_alt ?>;
25
  fifu_class:<?php echo $enable_class ?>;
 
26
  fifu_column_height:<?php echo $column_height ?>;
27
  fifu_confirm_delete_all:<?php echo $enable_confirm_delete_all ?>;
28
  fifu_confirm_delete_all_time:<?php echo $enable_confirm_delete_all_time ?>;
42
  fifu_jquery:<?php echo $enable_jquery ?>;
43
  fifu_lazy:<?php echo $enable_lazy ?>;
44
  fifu_media_library:<?php echo $enable_media_library ?>;
 
45
  fifu_ovw_first:<?php echo $enable_ovw_first ?>;
46
  fifu_pop_first:<?php echo $enable_pop_first ?>;
47
  fifu_query_strings:<?php echo $enable_query_strings ?>;
48
  fifu_run_delete_all:<?php echo $enable_run_delete_all ?>;
49
  fifu_run_delete_all_time:<?php echo $enable_run_delete_all_time ?>;
 
 
 
50
  fifu_social:<?php echo $enable_social ?>;
51
  fifu_social_image_only:<?php echo $enable_social_image_only ?>;
52
  fifu_spinner_db:<?php echo $max_db ?>;
admin/menu.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_original', 'fifu_lazy', 'fifu_jquery', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_css', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_class', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean', 'fifu_save_dimensions', 'fifu_save_dimensions_redirect', 'fifu_save_dimensions_all', 'fifu_clean_dimensions_all')));
4
 
5
  add_action('admin_menu', 'fifu_insert_menu');
6
 
@@ -36,7 +36,6 @@ function fifu_support_data() {
36
 
37
  $enable_social = get_option('fifu_social');
38
  $enable_social_image_only = get_option('fifu_social_image_only');
39
- $enable_original = get_option('fifu_original');
40
  $enable_lazy = get_option('fifu_lazy');
41
  $enable_jquery = get_option('fifu_jquery');
42
  $enable_media_library = get_option('fifu_media_library');
@@ -67,10 +66,6 @@ function fifu_support_data() {
67
  $enable_auto_alt = get_option('fifu_auto_alt');
68
  $enable_dynamic_alt = get_option('fifu_dynamic_alt');
69
  $enable_data_clean = 'toggleoff';
70
- $enable_save_dimensions = get_option('fifu_save_dimensions');
71
- $enable_save_dimensions_redirect = get_option('fifu_save_dimensions_redirect ');
72
- $enable_save_dimensions_all = 'toggleoff';
73
- $enable_clean_dimensions_all = 'toggleoff';
74
 
75
  include 'html/support-data.html';
76
  }
@@ -92,7 +87,6 @@ function fifu_get_menu_html() {
92
 
93
  $enable_social = get_option('fifu_social');
94
  $enable_social_image_only = get_option('fifu_social_image_only');
95
- $enable_original = get_option('fifu_original');
96
  $enable_lazy = get_option('fifu_lazy');
97
  $enable_jquery = get_option('fifu_jquery');
98
  $enable_media_library = get_option('fifu_media_library');
@@ -123,10 +117,6 @@ function fifu_get_menu_html() {
123
  $enable_auto_alt = get_option('fifu_auto_alt');
124
  $enable_dynamic_alt = get_option('fifu_dynamic_alt');
125
  $enable_data_clean = 'toggleoff';
126
- $enable_save_dimensions = get_option('fifu_save_dimensions');
127
- $enable_save_dimensions_redirect = get_option('fifu_save_dimensions_redirect ');
128
- $enable_save_dimensions_all = 'toggleoff';
129
- $enable_clean_dimensions_all = 'toggleoff';
130
 
131
  include 'html/menu.html';
132
 
@@ -183,7 +173,6 @@ function fifu_get_setting($type) {
183
  function fifu_update_menu_options() {
184
  fifu_update_option('fifu_input_social', 'fifu_social');
185
  fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
186
- fifu_update_option('fifu_input_original', 'fifu_original');
187
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
188
  fifu_update_option('fifu_input_jquery', 'fifu_jquery');
189
  fifu_update_option('fifu_input_media_library', 'fifu_media_library');
@@ -212,10 +201,6 @@ function fifu_update_menu_options() {
212
  fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
213
  fifu_update_option('fifu_input_dynamic_alt', 'fifu_dynamic_alt');
214
  fifu_update_option('fifu_input_data_clean', 'fifu_data_clean');
215
- fifu_update_option('fifu_input_save_dimensions', 'fifu_save_dimensions');
216
- fifu_update_option('fifu_input_save_dimensions_redirect', 'fifu_save_dimensions_redirect');
217
- fifu_update_option('fifu_input_save_dimensions_all', 'fifu_save_dimensions_all');
218
- fifu_update_option('fifu_input_clean_dimensions_all', 'fifu_clean_dimensions_all');
219
 
220
  // delete all confirm log
221
  if (fifu_is_on('fifu_confirm_delete_all'))
@@ -248,6 +233,7 @@ function fifu_enable_fake() {
248
  return;
249
  update_option('fifu_fake_created', true, 'no');
250
 
 
251
  fifu_db_insert_attachment();
252
  fifu_db_insert_attachment_category();
253
  }
1
  <?php
2
 
3
+ define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_lazy', 'fifu_jquery', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_css', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_class', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
4
 
5
  add_action('admin_menu', 'fifu_insert_menu');
6
 
36
 
37
  $enable_social = get_option('fifu_social');
38
  $enable_social_image_only = get_option('fifu_social_image_only');
 
39
  $enable_lazy = get_option('fifu_lazy');
40
  $enable_jquery = get_option('fifu_jquery');
41
  $enable_media_library = get_option('fifu_media_library');
66
  $enable_auto_alt = get_option('fifu_auto_alt');
67
  $enable_dynamic_alt = get_option('fifu_dynamic_alt');
68
  $enable_data_clean = 'toggleoff';
 
 
 
 
69
 
70
  include 'html/support-data.html';
71
  }
87
 
88
  $enable_social = get_option('fifu_social');
89
  $enable_social_image_only = get_option('fifu_social_image_only');
 
90
  $enable_lazy = get_option('fifu_lazy');
91
  $enable_jquery = get_option('fifu_jquery');
92
  $enable_media_library = get_option('fifu_media_library');
117
  $enable_auto_alt = get_option('fifu_auto_alt');
118
  $enable_dynamic_alt = get_option('fifu_dynamic_alt');
119
  $enable_data_clean = 'toggleoff';
 
 
 
 
120
 
121
  include 'html/menu.html';
122
 
173
  function fifu_update_menu_options() {
174
  fifu_update_option('fifu_input_social', 'fifu_social');
175
  fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
 
176
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
177
  fifu_update_option('fifu_input_jquery', 'fifu_jquery');
178
  fifu_update_option('fifu_input_media_library', 'fifu_media_library');
201
  fifu_update_option('fifu_input_auto_alt', 'fifu_auto_alt');
202
  fifu_update_option('fifu_input_dynamic_alt', 'fifu_dynamic_alt');
203
  fifu_update_option('fifu_input_data_clean', 'fifu_data_clean');
 
 
 
 
204
 
205
  // delete all confirm log
206
  if (fifu_is_on('fifu_confirm_delete_all'))
233
  return;
234
  update_option('fifu_fake_created', true, 'no');
235
 
236
+ fifu_db_change_url_length();
237
  fifu_db_insert_attachment();
238
  fifu_db_insert_attachment_category();
239
  }
admin/meta-box.php CHANGED
@@ -8,9 +8,9 @@ function fifu_insert_meta_box() {
8
 
9
  foreach ($post_types as $post_type) {
10
  if ($post_type == 'product') {
11
- add_meta_box('urlMetaBox', esc_html__('Product image', 'featured-image-from-url'), 'fifu_show_elements', $post_type, 'side', 'low');
12
  } else if ($post_type) {
13
- add_meta_box('imageUrlMetaBox', esc_html__('Featured image', 'featured-image-from-url'), 'fifu_show_elements', $post_type, 'side', 'low');
14
  }
15
  }
16
  fifu_register_meta_box_script();
@@ -138,6 +138,21 @@ function fifu_save_properties($post_id) {
138
  }
139
 
140
  fifu_save($post_id, $ignore);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  }
142
 
143
  function fifu_save($post_id, $ignore) {
@@ -239,6 +254,22 @@ function fifu_variation_settings_fields($loop, $variation_data, $variation) {
239
  }
240
  }
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  /* plugin: wordpress importer */
243
 
244
  add_action('import_end', 'fifu_import_end', 10, 0);
8
 
9
  foreach ($post_types as $post_type) {
10
  if ($post_type == 'product') {
11
+ add_meta_box('urlMetaBox', esc_html__('Product image', 'featured-image-from-url'), 'fifu_show_elements', $post_type, 'side', 'high');
12
  } else if ($post_type) {
13
+ add_meta_box('imageUrlMetaBox', esc_html__('Featured image', 'featured-image-from-url'), 'fifu_show_elements', $post_type, 'side', 'high');
14
  }
15
  }
16
  fifu_register_meta_box_script();
138
  }
139
 
140
  fifu_save($post_id, $ignore);
141
+
142
+ /* dimensions featured */
143
+ $width = fifu_get_width_meta($_POST);
144
+ $height = fifu_get_height_meta($_POST);
145
+ $att_id = get_post_thumbnail_id($post_id);
146
+ fifu_save_dimensions($att_id, $width, $height);
147
+ }
148
+
149
+ function fifu_save_dimensions($att_id, $width, $height) {
150
+ if (!$att_id || !$width || !$height)
151
+ return;
152
+ $metadata = null;
153
+ $metadata['width'] = $width;
154
+ $metadata['height'] = $height;
155
+ wp_update_attachment_metadata($att_id, $metadata);
156
  }
157
 
158
  function fifu_save($post_id, $ignore) {
254
  }
255
  }
256
 
257
+ /* dimensions */
258
+
259
+ function fifu_get_width_meta($req) {
260
+ if (isset($req['fifu_input_url']) && isset($req['fifu_input_image_width']))
261
+ return wp_strip_all_tags($req['fifu_input_image_width']);
262
+
263
+ return null;
264
+ }
265
+
266
+ function fifu_get_height_meta($req) {
267
+ if (isset($req['fifu_input_url']) && isset($req['fifu_input_image_height']))
268
+ return wp_strip_all_tags($req['fifu_input_image_height']);
269
+
270
+ return null;
271
+ }
272
+
273
  /* plugin: wordpress importer */
274
 
275
  add_action('import_end', 'fifu_import_end', 10, 0);
featured-image-from-url.php CHANGED
@@ -4,11 +4,11 @@
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image as Featured Image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
7
- * Version: 3.2.4
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 3.0
11
- * WC tested up to: 4.3.1
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
@@ -58,14 +58,22 @@ function fifu_activate_actions() {
58
  }
59
  }
60
 
 
 
 
 
 
 
61
  add_action('upgrader_process_complete', 'fifu_upgrade', 10, 2);
62
 
63
  function fifu_upgrade($upgrader_object, $options) {
64
  $current_plugin_path_name = plugin_basename(__FILE__);
65
  if ($options['action'] == 'update' && $options['type'] == 'plugin') {
66
  foreach ($options['plugins'] as $each_plugin) {
67
- if ($each_plugin == $current_plugin_path_name)
68
  fifu_activate_actions();
 
 
69
  }
70
  }
71
  }
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image as Featured Image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
7
+ * Version: 3.2.5
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 3.0
11
+ * WC tested up to: 4.3.3
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
58
  }
59
  }
60
 
61
+ register_deactivation_hook(__FILE__, 'fifu_deactivation');
62
+
63
+ function fifu_deactivation() {
64
+ unlink(ABSPATH . 'fifu-lock');
65
+ }
66
+
67
  add_action('upgrader_process_complete', 'fifu_upgrade', 10, 2);
68
 
69
  function fifu_upgrade($upgrader_object, $options) {
70
  $current_plugin_path_name = plugin_basename(__FILE__);
71
  if ($options['action'] == 'update' && $options['type'] == 'plugin') {
72
  foreach ($options['plugins'] as $each_plugin) {
73
+ if ($each_plugin == $current_plugin_path_name) {
74
  fifu_activate_actions();
75
+ unlink(ABSPATH . 'fifu-lock');
76
+ }
77
  }
78
  }
79
  }
includes/attachment.php CHANGED
@@ -57,18 +57,20 @@ function fifu_replace_attachment_url($att_url, $att_id) {
57
  add_filter('posts_where', 'fifu_query_attachments');
58
 
59
  function fifu_query_attachments($where) {
 
60
  if (isset($_POST['action']) && ($_POST['action'] == 'query-attachments') && fifu_is_off('fifu_media_library')) {
61
- global $wpdb;
62
  $where .= ' AND ' . $wpdb->prefix . 'posts.post_author <> ' . FIFU_AUTHOR . ' ';
63
- }
 
64
  return $where;
65
  }
66
 
67
  add_filter('posts_where', function ($where, \WP_Query $q) {
68
- if (is_admin() && $q->is_main_query() && fifu_is_off('fifu_media_library')) {
69
- global $wpdb;
70
  $where .= ' AND ' . $wpdb->prefix . 'posts.post_author <> ' . FIFU_AUTHOR . ' ';
71
- }
 
72
  return $where;
73
  }, 10, 2);
74
 
@@ -101,39 +103,11 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
101
  if (fifu_should_hide() && fifu_main_image_url($post->ID) == $image[0])
102
  return null;
103
 
104
- $image_size = fifu_get_image_size($size);
105
- if (fifu_is_on('fifu_original')) {
106
- return array(
107
- $image[0],
108
- null,
109
- null,
110
- null,
111
- );
112
- }
113
-
114
- $dimension = $att_post ? get_post_meta($att_post->ID, 'fifu_image_dimension') : null;
115
- $arrFIFU = fifu_get_width_height($dimension);
116
-
117
- $width = $arrFIFU['width'];
118
- if (isset($image_size['width'])) {
119
- $is = $image_size['width'];
120
- if (!$width || (!$dimension && $is < $width))
121
- $width = $is;
122
- }
123
-
124
- $height = $arrFIFU['height'];
125
- if (isset($image_size['height'])) {
126
- $is = $image_size['height'];
127
- if (!$height || (!$dimension && $is < $height))
128
- $height = $is;
129
- }
130
 
131
- return array(
132
- $image[0],
133
- $width,
134
- $height,
135
- isset($image_size['crop']) ? $image_size['crop'] : '',
136
- );
137
  }
138
 
139
  add_action('template_redirect', 'fifu_action', 10);
@@ -170,13 +144,14 @@ function fifu_callback($buffer) {
170
  continue;
171
 
172
  $post_id = $data['post_id'];
 
173
  $featured = $data['featured'];
174
 
175
  if ($featured) {
176
  // add featured
177
  $newImgItem = str_replace('<img ', '<img fifu-featured="1" ', $imgItem);
178
 
179
- $buffer = str_replace($imgItem, fifu_replace($newImgItem, $post_id, null, null), $buffer);
180
  }
181
  }
182
 
@@ -200,6 +175,8 @@ function fifu_callback($buffer) {
200
 
201
  if (strpos($imgItem, 'fifu-replaced') !== false)
202
  continue;
 
 
203
  }
204
 
205
  if (fifu_is_on('fifu_lazy')) {
@@ -207,7 +184,7 @@ function fifu_callback($buffer) {
207
  $class = 'lazyload ';
208
 
209
  // add class
210
- $newImgItem = str_replace('class=' . $mainDelimiter, 'class=' . $mainDelimiter . $class, $imgItem);
211
 
212
  // add status
213
  $newImgItem = str_replace('<img ', '<img fifu-replaced="1" ', $newImgItem);
@@ -229,33 +206,10 @@ function fifu_callback($buffer) {
229
 
230
  add_filter('wp_get_attachment_metadata', 'fifu_filter_wp_get_attachment_metadata', 10, 2);
231
 
232
- function fifu_filter_wp_get_attachment_metadata($data, $post_id) {
233
- if (!$data || !is_array($data)) {
234
- $dimension = get_post_meta($post_id, 'fifu_image_dimension');
235
- return fifu_get_width_height($dimension);
236
- }
237
  return $data;
238
  }
239
 
240
- function fifu_get_width_height($dimension) {
241
- if ($dimension && fifu_is_on('fifu_save_dimensions')) {
242
- $dimension = $dimension[0];
243
- $width = explode(';', $dimension)[0];
244
- $height = explode(';', $dimension)[1];
245
- } else {
246
- $dimension = null;
247
- $width = fifu_maximum('width');
248
- $height = fifu_maximum('height');
249
-
250
- // a value is required, otherwise the zoom doesn't work
251
- if (!$width && is_singular('product'))
252
- $width = 1000;
253
- }
254
- return array('width' => $width, 'height' => $height);
255
- }
256
-
257
- // for themes that dont call post_thumbnail_html
258
-
259
  function fifu_add_url_parameters($url, $att_id) {
260
  $post_id = get_post($att_id)->post_parent;
261
 
57
  add_filter('posts_where', 'fifu_query_attachments');
58
 
59
  function fifu_query_attachments($where) {
60
+ global $wpdb;
61
  if (isset($_POST['action']) && ($_POST['action'] == 'query-attachments') && fifu_is_off('fifu_media_library')) {
 
62
  $where .= ' AND ' . $wpdb->prefix . 'posts.post_author <> ' . FIFU_AUTHOR . ' ';
63
+ } else
64
+ $where .= ' AND (' . $wpdb->prefix . 'posts.post_author <> ' . FIFU_AUTHOR . ' OR (' . $wpdb->prefix . 'posts.post_author = ' . FIFU_AUTHOR . ' AND EXISTS (SELECT 1 FROM ' . $wpdb->prefix . 'postmeta WHERE ' . $wpdb->prefix . 'postmeta.post_id = ' . $wpdb->prefix . 'posts.id AND ' . $wpdb->prefix . 'postmeta.meta_key = "_wp_attachment_metadata")))';
65
  return $where;
66
  }
67
 
68
  add_filter('posts_where', function ($where, \WP_Query $q) {
69
+ global $wpdb;
70
+ if (is_admin() && $q->is_main_query() && fifu_is_off('fifu_media_library'))
71
  $where .= ' AND ' . $wpdb->prefix . 'posts.post_author <> ' . FIFU_AUTHOR . ' ';
72
+ else
73
+ $where .= ' AND (' . $wpdb->prefix . 'posts.post_author <> ' . FIFU_AUTHOR . ' OR (' . $wpdb->prefix . 'posts.post_author = ' . FIFU_AUTHOR . ' AND EXISTS (SELECT 1 FROM ' . $wpdb->prefix . 'postmeta WHERE ' . $wpdb->prefix . 'postmeta.post_id = ' . $wpdb->prefix . 'posts.id AND ' . $wpdb->prefix . 'postmeta.meta_key = "_wp_attachment_metadata")))';
74
  return $where;
75
  }, 10, 2);
76
 
103
  if (fifu_should_hide() && fifu_main_image_url($post->ID) == $image[0])
104
  return null;
105
 
106
+ // fix zoom
107
+ if ($image[1] == 1 && $image[2] == 1)
108
+ $image[1] = 1920;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
 
110
+ return $image;
 
 
 
 
 
111
  }
112
 
113
  add_action('template_redirect', 'fifu_action', 10);
144
  continue;
145
 
146
  $post_id = $data['post_id'];
147
+ $att_id = $data['att_id'];
148
  $featured = $data['featured'];
149
 
150
  if ($featured) {
151
  // add featured
152
  $newImgItem = str_replace('<img ', '<img fifu-featured="1" ', $imgItem);
153
 
154
+ $buffer = str_replace($imgItem, fifu_replace($newImgItem, $post_id, null, null, null), $buffer);
155
  }
156
  }
157
 
175
 
176
  if (strpos($imgItem, 'fifu-replaced') !== false)
177
  continue;
178
+
179
+ $att_id = $data['att_id'];
180
  }
181
 
182
  if (fifu_is_on('fifu_lazy')) {
184
  $class = 'lazyload ';
185
 
186
  // add class
187
+ $newImgItem = str_replace('class=' . $mainDelimiter, 'class=' . $mainDelimiter . $class, $newImgItem);
188
 
189
  // add status
190
  $newImgItem = str_replace('<img ', '<img fifu-replaced="1" ', $newImgItem);
206
 
207
  add_filter('wp_get_attachment_metadata', 'fifu_filter_wp_get_attachment_metadata', 10, 2);
208
 
209
+ function fifu_filter_wp_get_attachment_metadata($data, $att_id) {
 
 
 
 
210
  return $data;
211
  }
212
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  function fifu_add_url_parameters($url, $att_id) {
214
  $post_id = get_post($att_id)->post_parent;
215
 
includes/external-post.php CHANGED
@@ -43,12 +43,18 @@ function fifu_save_properties_ext($post_id) {
43
  }
44
 
45
  function fifu_first_img_in_content($content) {
46
- $matches = array();
 
 
47
  preg_match_all('/<img[^>]*>/', $content, $matches);
48
- return $matches && $matches[0] ? $matches[0][get_option('fifu_spinner_nth') - 1] : null;
 
 
 
49
  }
50
 
51
  function fifu_show_all_images($content) {
 
52
  $matches = array();
53
  preg_match_all('/<img[^>]*display:[ ]*none[^>]*>/', $content, $matches);
54
  foreach ($matches[0] as $img) {
@@ -58,57 +64,55 @@ function fifu_show_all_images($content) {
58
  }
59
 
60
  function fifu_hide_media($img) {
61
- if (strpos($img, 'style="') !== false)
62
- return preg_replace('/style=.[^"]*["]/', 'style="display:none"', $img);
 
63
  return preg_replace('/[\/]*>/', ' style="display:none">', $img);
64
  }
65
 
66
  function fifu_show_media($img) {
 
67
  return preg_replace('/style=[\\\]*.display:[ ]*none[\\\]*./', '', $img);
68
  }
69
 
70
  function fifu_first_url_in_content($post_id) {
71
  $content = get_post_field('post_content', $post_id);
 
72
  if (!$content)
73
  return;
 
74
  $matches = array();
 
75
  preg_match_all('/<img[^>]*>/', $content, $matches);
 
76
  if (!$matches[0])
77
  return;
78
 
79
- $i = 0;
80
  $nth = get_option('fifu_spinner_nth');
 
 
81
  $tag = null;
82
- foreach ($matches[0] as $tag) {
83
- $i++;
84
- if (($tag && strpos($tag, 'data:image/jpeg') !== false) || ($i != $nth))
85
- continue;
86
- break;
 
 
 
87
  }
88
 
89
  if (!$tag)
90
- return;
91
-
92
- $aux2 = null;
93
 
94
- //double quotes
95
- $aux1 = explode('src="', $tag);
96
- if ($aux1 && count($aux1) > 1) {
97
- $aux2 = explode('"', $aux1[1]);
98
- }
99
-
100
- //single quotes
101
- if (!$aux2 || !$aux2[0]) {
102
- $aux1 = explode("src='", $tag);
103
- if ($aux1 && count($aux1) > 1)
104
- $aux2 = explode("'", $aux1[1]);
105
- }
106
 
107
  //query strings
108
  if (fifu_is_on('fifu_query_strings'))
109
- return $tag ? preg_replace('/\?.*/', '', $aux2[0]) : null;
110
 
111
- return $tag ? $aux2[0] : null;
112
  }
113
 
114
  function fifu_update_fake_attach_id($post_id) {
43
  }
44
 
45
  function fifu_first_img_in_content($content) {
46
+ $content = html_entity_decode($content);
47
+ $nth = get_option('fifu_spinner_nth') - 1;
48
+
49
  preg_match_all('/<img[^>]*>/', $content, $matches);
50
+ if ($matches && $matches[0])
51
+ return $matches[0][$nth];
52
+
53
+ return null;
54
  }
55
 
56
  function fifu_show_all_images($content) {
57
+ $content = html_entity_decode($content);
58
  $matches = array();
59
  preg_match_all('/<img[^>]*display:[ ]*none[^>]*>/', $content, $matches);
60
  foreach ($matches[0] as $img) {
64
  }
65
 
66
  function fifu_hide_media($img) {
67
+ $img = html_entity_decode($img);
68
+ if (strpos($img, 'style=') !== false)
69
+ return preg_replace('/style=[\'\"][^\'\"]*[\'\"]/', 'style="display:none"', $img);
70
  return preg_replace('/[\/]*>/', ' style="display:none">', $img);
71
  }
72
 
73
  function fifu_show_media($img) {
74
+ $img = html_entity_decode($img);
75
  return preg_replace('/style=[\\\]*.display:[ ]*none[\\\]*./', '', $img);
76
  }
77
 
78
  function fifu_first_url_in_content($post_id) {
79
  $content = get_post_field('post_content', $post_id);
80
+ $content = html_entity_decode($content);
81
  if (!$content)
82
  return;
83
+
84
  $matches = array();
85
+
86
  preg_match_all('/<img[^>]*>/', $content, $matches);
87
+
88
  if (!$matches[0])
89
  return;
90
 
 
91
  $nth = get_option('fifu_spinner_nth');
92
+
93
+ // $matches
94
  $tag = null;
95
+ if (sizeof($matches) != 0) {
96
+ $i = 0;
97
+ foreach ($matches[0] as $tag) {
98
+ $i++;
99
+ if (($tag && strpos($tag, 'data:image/jpeg') !== false) || ($i != $nth))
100
+ continue;
101
+ break;
102
+ }
103
  }
104
 
105
  if (!$tag)
106
+ return null;
 
 
107
 
108
+ // src
109
+ $src = fifu_get_attribute('src', $tag);
 
 
 
 
 
 
 
 
 
 
110
 
111
  //query strings
112
  if (fifu_is_on('fifu_query_strings'))
113
+ return preg_replace('/\?.*/', '', $src);
114
 
115
+ return $src;
116
  }
117
 
118
  function fifu_update_fake_attach_id($post_id) {
includes/genesis.php CHANGED
@@ -3,6 +3,6 @@
3
  add_filter('genesis_get_image', 'fifu_genesis_image', 10, 4);
4
 
5
  function fifu_genesis_image($args, $size, $var2, $src) {
6
- return $src ? fifu_replace($args, get_the_ID(), $var2, $size) : $args;
7
  }
8
 
3
  add_filter('genesis_get_image', 'fifu_genesis_image', 10, 4);
4
 
5
  function fifu_genesis_image($args, $size, $var2, $src) {
6
+ return $src ? fifu_replace($args, get_the_ID(), $var2, $size, null) : $args;
7
  }
8
 
includes/html/js/image.js CHANGED
@@ -7,12 +7,6 @@ jQuery(document).ready(function ($) {
7
  disableClick($);
8
  disableLink($);
9
 
10
- // for all images at single product page
11
- setTimeout(function () {
12
- resizeImg($);
13
- jQuery('a.woocommerce-product-gallery__trigger').css('visibility', 'visible');
14
- }, 2500);
15
-
16
  // zoomImg
17
  setTimeout(function () {
18
  jQuery('img.zoomImg').css('z-index', '');
@@ -33,23 +27,6 @@ if (fifuImageVars.fifu_is_product) {
33
  });
34
  }
35
 
36
- function resizeImg($) {
37
- var imgSelector = ".post img, .page img, .widget-content img, .product img, .wp-admin img, .tax-product_cat img, .fifu img";
38
- var resizeImage = function (sSel) {
39
- jQuery(sSel).each(function () {
40
- //original size
41
- var width = $(this)['0'].naturalWidth;
42
- var height = $(this)['0'].naturalHeight;
43
-
44
- //100%
45
- var ratio = width / height;
46
- jQuery(this).attr('data-large_image_width', jQuery(window).width() * ratio);
47
- jQuery(this).attr('data-large_image_height', jQuery(window).width());
48
- });
49
- };
50
- resizeImage(imgSelector);
51
- }
52
-
53
  function disableClick($) {
54
  if (!fifuImageVars.fifu_woo_lbox_enabled) {
55
  firstParentClass = '';
7
  disableClick($);
8
  disableLink($);
9
 
 
 
 
 
 
 
10
  // zoomImg
11
  setTimeout(function () {
12
  jQuery('img.zoomImg').css('z-index', '');
27
  });
28
  }
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  function disableClick($) {
31
  if (!fifuImageVars.fifu_woo_lbox_enabled) {
32
  firstParentClass = '';
includes/thumbnail.php CHANGED
@@ -44,6 +44,8 @@ function fifu_add_js() {
44
  'fifu_woo_lbox_enabled' => fifu_woo_lbox(),
45
  'fifu_woo_zoom' => fifu_woo_zoom(),
46
  'fifu_is_product' => class_exists('WooCommerce') && is_product(),
 
 
47
  ]);
48
  }
49
 
@@ -77,25 +79,23 @@ function fifu_add_social_tags() {
77
 
78
  function fifu_add_jquery() {
79
  if (fifu_is_on('fifu_jquery') && !fifu_is_elementor_editor())
80
- wp_enqueue_script('fifu-jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js');
81
  }
82
 
83
  function fifu_apply_css() {
84
  if (fifu_is_off('fifu_wc_lbox'))
85
  echo '<style>[class$="woocommerce-product-gallery__trigger"] {display:none !important;}</style>';
86
- else
87
- echo '<style>[class$="woocommerce-product-gallery__trigger"] {visibility:hidden;}</style>';
88
  }
89
 
90
  add_filter('woocommerce_product_get_image', 'fifu_woo_replace', 10, 5);
91
 
92
  function fifu_woo_replace($html, $product, $woosize) {
93
- return fifu_replace($html, $product->get_id(), null, null);
94
  }
95
 
96
- add_filter('post_thumbnail_html', 'fifu_replace', 10, 4);
97
 
98
- function fifu_replace($html, $post_id, $post_thumbnail_id, $size) {
99
  if (!$html)
100
  return $html;
101
 
@@ -211,36 +211,6 @@ function fifu_is_in_editor() {
211
  return !is_admin() || get_current_screen() == null ? false : get_current_screen()->parent_base == 'edit';
212
  }
213
 
214
- function fifu_get_image_sizes() {
215
- global $_wp_additional_image_sizes;
216
- $sizes = array();
217
- foreach (get_intermediate_image_sizes() as $_size) {
218
- if (in_array($_size, array('thumbnail', 'medium', 'medium_large', 'large'))) {
219
- $sizes[$_size]['width'] = get_option("{$_size}_size_w");
220
- $sizes[$_size]['height'] = get_option("{$_size}_size_h");
221
- $sizes[$_size]['crop'] = (bool) get_option("{$_size}_crop");
222
- } elseif (isset($_wp_additional_image_sizes[$_size])) {
223
- $sizes[$_size] = array(
224
- 'width' => $_wp_additional_image_sizes[$_size]['width'],
225
- 'height' => $_wp_additional_image_sizes[$_size]['height'],
226
- 'crop' => $_wp_additional_image_sizes[$_size]['crop'],
227
- );
228
- }
229
- }
230
- return $sizes;
231
- }
232
-
233
- function fifu_get_image_size($size) {
234
- $sizes = fifu_get_image_sizes();
235
- if (is_array($size)) {
236
- $arr_size = array();
237
- $arr_size['width'] = count($size) > 0 ? $size[0] : null;
238
- $arr_size['height'] = count($size) > 1 ? $size[1] : null;
239
- return $arr_size;
240
- }
241
- return isset($sizes[$size]) ? $sizes[$size] : false;
242
- }
243
-
244
  function fifu_get_default_url() {
245
  return wp_get_attachment_url(get_option('fifu_default_attach_id'));
246
  }
44
  'fifu_woo_lbox_enabled' => fifu_woo_lbox(),
45
  'fifu_woo_zoom' => fifu_woo_zoom(),
46
  'fifu_is_product' => class_exists('WooCommerce') && is_product(),
47
+ 'fifu_rest_url' => esc_url_raw(rest_url()),
48
+ 'fifu_nonce' => wp_create_nonce('wp_rest'),
49
  ]);
50
  }
51
 
79
 
80
  function fifu_add_jquery() {
81
  if (fifu_is_on('fifu_jquery') && !fifu_is_elementor_editor())
82
+ wp_enqueue_script('fifu-jquery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js');
83
  }
84
 
85
  function fifu_apply_css() {
86
  if (fifu_is_off('fifu_wc_lbox'))
87
  echo '<style>[class$="woocommerce-product-gallery__trigger"] {display:none !important;}</style>';
 
 
88
  }
89
 
90
  add_filter('woocommerce_product_get_image', 'fifu_woo_replace', 10, 5);
91
 
92
  function fifu_woo_replace($html, $product, $woosize) {
93
+ return fifu_replace($html, $product->get_id(), null, null, null);
94
  }
95
 
96
+ add_filter('post_thumbnail_html', 'fifu_replace', 10, 5);
97
 
98
+ function fifu_replace($html, $post_id, $post_thumbnail_id, $size, $attr) {
99
  if (!$html)
100
  return $html;
101
 
211
  return !is_admin() || get_current_screen() == null ? false : get_current_screen()->parent_base == 'edit';
212
  }
213
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  function fifu_get_default_url() {
215
  return wp_get_attachment_url(get_option('fifu_default_attach_id'));
216
  }
includes/util.php CHANGED
@@ -10,6 +10,13 @@ function fifu_get_attribute($attribute, $html) {
10
  $aux = $aux[1];
11
 
12
  $quote = $aux[0];
 
 
 
 
 
 
 
13
  $aux = explode($quote, $aux);
14
  if ($aux)
15
  return $aux[1];
@@ -34,29 +41,6 @@ function fifu_get_post_types() {
34
  return $arr;
35
  }
36
 
37
- function fifu_maximum($dimension) {
38
- $dimension = 'fifu_image_' . $dimension . '_';
39
- $size = null;
40
-
41
- if (is_home()) {
42
- $size = get_option($dimension . 'home');
43
- } else if (class_exists('WooCommerce') && is_shop()) {
44
- $size = get_option($dimension . 'shop');
45
- } else if (class_exists('WooCommerce') && is_product_category()) {
46
- $size = get_option($dimension . 'ctgr');
47
- } else if (is_singular('post') || is_author() || is_search()) {
48
- $size = get_option($dimension . 'post');
49
- } else if (is_singular('page')) {
50
- $size = class_exists('WooCommerce') && is_cart() ? get_option($dimension . 'cart') : get_option($dimension . 'page');
51
- } else if (is_singular('product')) {
52
- $size = get_option($dimension . 'prod');
53
- } else if (is_archive()) {
54
- $size = get_option($dimension . 'arch');
55
- }
56
-
57
- return $size ? $size : null;
58
- }
59
-
60
  function fifu_get_delimiter($property, $html) {
61
  $delimiter = explode($property . '=', $html);
62
  return $delimiter ? substr($delimiter[1], 0, 1) : null;
@@ -76,29 +60,6 @@ function fifu_starts_with($text, $substr) {
76
  return substr($text, 0, strlen($substr)) === $substr;
77
  }
78
 
79
- /* dimensions */
80
-
81
- function fifu_curl($url) {
82
- $curl = curl_init($url);
83
- if (fifu_is_off('fifu_save_dimensions_redirect')) {
84
- $headers = array("Range: bytes=0-32768");
85
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
86
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
87
- }
88
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
89
- $data = curl_exec($curl);
90
- curl_close($curl);
91
- return $data;
92
- }
93
-
94
- function fifu_get_dimension_backend($url) {
95
- $raw = fifu_curl($url);
96
- $img = imagecreatefromstring($raw);
97
- $width = imagesx($img);
98
- $height = imagesy($img);
99
- return ($width && $height) ? $width . ";" . $height : null;
100
- }
101
-
102
  function fifu_dashboard() {
103
  return !is_home() &&
104
  !is_singular('post') &&
@@ -135,3 +96,9 @@ function fifu_is_avada_active() {
135
  return 'avada' == strtolower(get_option('template'));
136
  }
137
 
 
 
 
 
 
 
10
  $aux = $aux[1];
11
 
12
  $quote = $aux[0];
13
+
14
+ if ($quote == '&') {
15
+ preg_match('/^&[^;]+;/', $aux, $matches);
16
+ if ($matches)
17
+ $quote = $matches[0];
18
+ }
19
+
20
  $aux = explode($quote, $aux);
21
  if ($aux)
22
  return $aux[1];
41
  return $arr;
42
  }
43
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
  function fifu_get_delimiter($property, $html) {
45
  $delimiter = explode($property . '=', $html);
46
  return $delimiter ? substr($delimiter[1], 0, 1) : null;
60
  return substr($text, 0, strlen($substr)) === $substr;
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  function fifu_dashboard() {
64
  return !is_home() &&
65
  !is_singular('post') &&
96
  return 'avada' == strtolower(get_option('template'));
97
  }
98
 
99
+ // plugin: accelerated-mobile-pages
100
+
101
+ function fifu_amp_url($url, $width, $height) {
102
+ return array(0 => $url, 1 => $width, 2 => $height);
103
+ }
104
+
includes/woo.php CHANGED
@@ -12,8 +12,31 @@ function fifu_woo_theme() {
12
  return file_exists(get_template_directory() . '/woocommerce');
13
  }
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  function fifu_woocommerce_gallery_image_html_attachment_image_params($params, $attachment_id, $image_size, $main_image) {
 
 
 
 
 
 
 
 
16
  return $params;
17
  }
18
 
19
  add_filter('woocommerce_gallery_image_html_attachment_image_params', 'fifu_woocommerce_gallery_image_html_attachment_image_params', 10, 4);
 
12
  return file_exists(get_template_directory() . '/woocommerce');
13
  }
14
 
15
+ define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS', "
16
+ function fix_images_without_dimensions() {
17
+ jQuery('img[data-large_image_height=0]').each(function () {
18
+ if (jQuery(this)[0].naturalWidth <= 1)
19
+ return;
20
+
21
+ jQuery(this)
22
+ .attr('data-large_image_width', jQuery(this)[0].naturalWidth)
23
+ .attr('data-large_image_height', jQuery(this)[0].naturalHeight);
24
+ });
25
+ }
26
+ fix_images_without_dimensions();"
27
+ );
28
+
29
  function fifu_woocommerce_gallery_image_html_attachment_image_params($params, $attachment_id, $image_size, $main_image) {
30
+ // fix zoom
31
+ if ($params['data-large_image_width'] == 0)
32
+ $params['data-large_image_width'] = 1920;
33
+
34
+ // fix lightbox
35
+ if (is_product())
36
+ $params['onload'] = FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS;
37
+
38
  return $params;
39
  }
40
 
41
  add_filter('woocommerce_gallery_image_html_attachment_image_params', 'fifu_woocommerce_gallery_image_html_attachment_image_params', 10, 4);
42
+
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
4
  Tags: featured image, featured, image, url, thumbnail
5
  Requires at least: 5.0
6
  Tested up to: 5.5
7
- Stable tag: 3.2.4
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -26,7 +26,6 @@ Use an external image as featured image of your post, page or custom post type.
26
  * Hide featured media
27
  * Featured image in content
28
  * CSS style
29
- * Original size
30
  * Add class
31
  * Save image dimensions
32
  * Featured image column
@@ -193,20 +192,20 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr and Publiti
193
 
194
  == Changelog ==
195
 
 
 
 
196
  = 3.2.4 =
197
  * Critical bug fix: conflict with URLs from Jetpack, Cloudinary and maybe others.
198
 
199
  = 3.2.3 =
200
  * Improvement: core changes for a better integration with themes, plugins and WordPress 5.5; bug fix: conflict between Hide Featured Media and Related Posts Thumbnails plugin.
201
 
202
- = 3.2.2 =
203
- * Adjustment: layout changes for WordPress 5.5; improvement: Flickr Thumbnails (less controls and more precision); bug fix: conflict between Lazy Load and Avada theme.
204
-
205
  = others =
206
  * [more](https://fifu.app/changelog/)
207
 
208
 
209
  == Upgrade Notice ==
210
 
211
- = 3.2.4 =
212
- * Critical bug fix: conflict with URLs from Jetpack, Cloudinary and maybe others.
4
  Tags: featured image, featured, image, url, thumbnail
5
  Requires at least: 5.0
6
  Tested up to: 5.5
7
+ Stable tag: 3.2.5
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
26
  * Hide featured media
27
  * Featured image in content
28
  * CSS style
 
29
  * Add class
30
  * Save image dimensions
31
  * Featured image column
192
 
193
  == Changelog ==
194
 
195
+ = 3.2.5 =
196
+ * Improvement: FIFU automatically saves the image dimensions now (for less style issues); deprecated: Original Sizes feature; bug fix: large URLs were being cropped; bug fix: menu settings was not being shown; bug fix: conflict with Accelerated Mobile Pages plugin; bug fix: conflict when category and product had the same ID; bug fix: conflict beteweem URL from Post Content and HTML character entities; bug fix: images not being shown in WooCommerce lightbox.
197
+
198
  = 3.2.4 =
199
  * Critical bug fix: conflict with URLs from Jetpack, Cloudinary and maybe others.
200
 
201
  = 3.2.3 =
202
  * Improvement: core changes for a better integration with themes, plugins and WordPress 5.5; bug fix: conflict between Hide Featured Media and Related Posts Thumbnails plugin.
203
 
 
 
 
204
  = others =
205
  * [more](https://fifu.app/changelog/)
206
 
207
 
208
  == Upgrade Notice ==
209
 
210
+ = 3.2.5 =
211
+ * Improvement: FIFU automatically saves the image dimensions now (for less style issues); deprecated: Original Sizes feature; bug fix: large URLs were being cropped; bug fix: menu settings was not being shown; bug fix: conflict with Accelerated Mobile Pages plugin; bug fix: conflict when category and product had the same ID; bug fix: conflict beteweem URL from Post Content and HTML character entities; bug fix: images not being shown in WooCommerce lightbox.