Featured Image From URL - Version 3.4.8

Version Description

  • Notice: for users with Instagram images; improvement: 20 new WP-CLI commands added; fix: Unsplash random image.
Download this release

Release Info

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

Code changes from version 3.4.7 to 3.4.8

admin/api.php CHANGED
@@ -1,7 +1,6 @@
1
  <?php
2
 
3
  define('FIFU_QUERY_ADDRESS', 'https://query.featuredimagefromurl.com');
4
- define('FIFU_INSTAGRAM_ADDRESS', 'https://urls.featuredimagefromurl.com/instagram/');
5
 
6
  function fifu_get_ip() {
7
  foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
@@ -83,41 +82,6 @@ function fifu_api_query($dataset) {
83
  }
84
  }
85
 
86
- function fifu_api_get_instagram_thumb($url) {
87
- $site = fifu_get_home_url();
88
- $ip = fifu_get_ip();
89
- $time = time();
90
- $encoded_url = base64_encode($url);
91
- $url_sign = substr($encoded_url, -25);
92
- $signature = hash_hmac('sha256', $url_sign . $time, $site);
93
- $array = array(
94
- 'headers' => array('Content-Type' => 'application/json; charset=utf-8'),
95
- 'body' => json_encode(
96
- array(
97
- 'site' => $site,
98
- 'signature' => $signature,
99
- 'time' => $time,
100
- 'ip' => $ip,
101
- 'url' => $encoded_url,
102
- 'version' => fifu_version_number(),
103
- )
104
- ),
105
- 'method' => 'POST',
106
- 'data_format' => 'body',
107
- 'blocking' => true,
108
- 'timeout' => 10,
109
- );
110
- $response = fifu_remote_post(FIFU_INSTAGRAM_ADDRESS, $array);
111
- if (is_wp_error($response))
112
- return null;
113
-
114
- $json = json_decode($response['http_response']->get_response_object()->body);
115
- if ($json && isset($json->url) && $json->url)
116
- return $json->url;
117
-
118
- return null;
119
- }
120
-
121
  function fifu_enable_fake_api(WP_REST_Request $request) {
122
  update_option('fifu_fake_stop', false, 'no');
123
  fifu_enable_fake();
@@ -206,12 +170,6 @@ function fifu_api_list_all_without_dimensions(WP_REST_Request $request) {
206
  return fifu_db_get_all_without_dimensions();
207
  }
208
 
209
- function fifu_api_convert_instagram_url(WP_REST_Request $request) {
210
- $url = $request['url'];
211
- $new_url = fifu_api_get_instagram_thumb($url);
212
- return $new_url ? $new_url : $url;
213
- }
214
-
215
  function fifu_test_execution_time() {
216
  for ($i = 0; $i <= 120; $i++) {
217
  error_log($i);
@@ -261,11 +219,6 @@ add_action('rest_api_init', function () {
261
  'callback' => 'fifu_api_list_all_without_dimensions',
262
  'permission_callback' => 'fifu_get_private_data_permissions_check',
263
  ));
264
- register_rest_route('featured-image-from-url/v2', '/convert_instagram_url/', array(
265
- 'methods' => 'POST',
266
- 'callback' => 'fifu_api_convert_instagram_url',
267
- 'permission_callback' => 'fifu_get_private_data_permissions_check',
268
- ));
269
  register_rest_route('featured-image-from-url/v2', '/rest_url_api/', array(
270
  'methods' => ['GET', 'POST'],
271
  'callback' => 'fifu_rest_url',
1
  <?php
2
 
3
  define('FIFU_QUERY_ADDRESS', 'https://query.featuredimagefromurl.com');
 
4
 
5
  function fifu_get_ip() {
6
  foreach (array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR') as $key) {
82
  }
83
  }
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  function fifu_enable_fake_api(WP_REST_Request $request) {
86
  update_option('fifu_fake_stop', false, 'no');
87
  fifu_enable_fake();
170
  return fifu_db_get_all_without_dimensions();
171
  }
172
 
 
 
 
 
 
 
173
  function fifu_test_execution_time() {
174
  for ($i = 0; $i <= 120; $i++) {
175
  error_log($i);
219
  'callback' => 'fifu_api_list_all_without_dimensions',
220
  'permission_callback' => 'fifu_get_private_data_permissions_check',
221
  ));
 
 
 
 
 
222
  register_rest_route('featured-image-from-url/v2', '/rest_url_api/', array(
223
  'methods' => ['GET', 'POST'],
224
  'callback' => 'fifu_rest_url',
admin/cli-commands.php CHANGED
@@ -74,6 +74,119 @@ class fifu_cli extends WP_CLI_Command {
74
  }
75
  }
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  // metadata
78
 
79
  function metadata($args) {
74
  }
75
  }
76
 
77
+ // featured image
78
+
79
+ function image($args, $assoc_args) {
80
+ if (!empty($assoc_args['title-copy'])) {
81
+ switch ($args[0]) {
82
+ case 'on':
83
+ update_option('fifu_auto_alt', 'toggleon', 'no'); // toggle
84
+ break;
85
+ case 'off':
86
+ update_option('fifu_auto_alt', 'toggleoff', 'no'); // toggle
87
+ break;
88
+ }
89
+ return;
90
+ }
91
+ if (!empty($assoc_args['title-always'])) {
92
+ switch ($args[0]) {
93
+ case 'on':
94
+ update_option('fifu_dynamic_alt', 'toggleon', 'no'); // toggle
95
+ break;
96
+ case 'off':
97
+ update_option('fifu_dynamic_alt', 'toggleoff', 'no'); // toggle
98
+ break;
99
+ }
100
+ return;
101
+ }
102
+ if (!empty($assoc_args['hide-page'])) {
103
+ switch ($args[0]) {
104
+ case 'on':
105
+ update_option('fifu_hide_page', 'toggleon', 'no'); // toggle
106
+ break;
107
+ case 'off':
108
+ update_option('fifu_hide_page', 'toggleoff', 'no'); // toggle
109
+ break;
110
+ }
111
+ return;
112
+ }
113
+ if (!empty($assoc_args['hide-post'])) {
114
+ switch ($args[0]) {
115
+ case 'on':
116
+ update_option('fifu_hide_post', 'toggleon', 'no'); // toggle
117
+ break;
118
+ case 'off':
119
+ update_option('fifu_hide_post', 'toggleoff', 'no'); // toggle
120
+ break;
121
+ }
122
+ return;
123
+ }
124
+ if (!empty($assoc_args['hide-cpt'])) {
125
+ switch ($args[0]) {
126
+ case 'on':
127
+ update_option('fifu_hide_cpt', 'toggleon', 'no'); // toggle
128
+ break;
129
+ case 'off':
130
+ update_option('fifu_hide_cpt', 'toggleoff', 'no'); // toggle
131
+ break;
132
+ }
133
+ return;
134
+ }
135
+ if (!empty($assoc_args['default'])) {
136
+ switch ($args[0]) {
137
+ case 'on':
138
+ update_option('fifu_enable_default_url', 'toggleon', 'no'); // toggle
139
+ $default_url = get_option('fifu_default_url');
140
+ if (!$default_url)
141
+ fifu_db_delete_default_url();
142
+ elseif (fifu_is_on('fifu_fake')) {
143
+ if (!wp_get_attachment_url(get_option('fifu_default_attach_id'))) {
144
+ $att_id = fifu_db_create_attachment($default_url);
145
+ update_option('fifu_default_attach_id', $att_id);
146
+ fifu_db_set_default_url();
147
+ } else
148
+ fifu_db_update_default_url($default_url);
149
+ }
150
+ break;
151
+ case 'off':
152
+ update_option('fifu_enable_default_url', 'toggleoff', 'no'); // toggle
153
+ fifu_db_delete_default_url();
154
+ break;
155
+ }
156
+ return;
157
+ }
158
+ if (!empty($assoc_args['default-url'])) {
159
+ update_option('fifu_default_url', $args[0], 'no');
160
+ if (fifu_is_off('fifu_enable_default_url'))
161
+ fifu_db_delete_default_url();
162
+ elseif (!$args[0])
163
+ fifu_db_delete_default_url();
164
+ return;
165
+ }
166
+ if (!empty($assoc_args['content-page'])) {
167
+ switch ($args[0]) {
168
+ case 'on':
169
+ update_option('fifu_content_page', 'toggleon', 'no'); // toggle
170
+ break;
171
+ case 'off':
172
+ update_option('fifu_content_page', 'toggleoff', 'no'); // toggle
173
+ break;
174
+ }
175
+ return;
176
+ }
177
+ if (!empty($assoc_args['content-post'])) {
178
+ switch ($args[0]) {
179
+ case 'on':
180
+ update_option('fifu_content', 'toggleon', 'no'); // toggle
181
+ break;
182
+ case 'off':
183
+ update_option('fifu_content', 'toggleoff', 'no'); // toggle
184
+ break;
185
+ }
186
+ return;
187
+ }
188
+ }
189
+
190
  // metadata
191
 
192
  function metadata($args) {
admin/html/js/convert-url.js CHANGED
@@ -2,9 +2,6 @@ function fifu_convert($url) {
2
  if (fifu_from_google_drive($url))
3
  return fifu_google_drive_url($url);
4
 
5
- if (fifu_from_instagram($url))
6
- return fifu_instagram_url($url);
7
-
8
  return $url;
9
  }
10
 
@@ -21,41 +18,3 @@ function fifu_google_drive_id($url) {
21
  function fifu_google_drive_url($url) {
22
  return 'https://drive.google.com/uc?id=' + fifu_google_drive_id($url);
23
  }
24
-
25
- //Instagram
26
-
27
- function fifu_from_instagram($url) {
28
- return $url.match('[^a-z]instagram.com');
29
- }
30
-
31
- function fifu_instagram_id($url) {
32
- return $url.match(/[-\w]{11,}/);
33
- }
34
-
35
- function fifu_instagram_url($url) {
36
- url = jQuery('#fifu_input_url').val();
37
- jQuery.ajax({
38
- method: "POST",
39
- url: fifu_get_rest_url() + 'featured-image-from-url/v2/convert_instagram_url/',
40
- data: {
41
- "url": url,
42
- },
43
- async: false,
44
- beforeSend: function (xhr) {
45
- xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
46
- },
47
- success: function (data) {
48
- url = data;
49
- jQuery('#fifu_input_url').val(url);
50
- },
51
- error: function (jqXHR, textStatus, errorThrown) {
52
- console.log(jqXHR);
53
- console.log(textStatus);
54
- console.log(errorThrown);
55
- },
56
- complete: function () {
57
- },
58
- timeout: 0
59
- });
60
- return url;
61
- }
2
  if (fifu_from_google_drive($url))
3
  return fifu_google_drive_url($url);
4
 
 
 
 
5
  return $url;
6
  }
7
 
18
  function fifu_google_drive_url($url) {
19
  return 'https://drive.google.com/uc?id=' + fifu_google_drive_id($url);
20
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/html/js/meta-box.js CHANGED
@@ -51,7 +51,10 @@ function previewImage() {
51
  }, 2000);
52
  }
53
  }
54
- xhr.open("GET", 'https://source.unsplash.com/featured/?' + $url, true);
 
 
 
55
  xhr.send();
56
  if (!$url)
57
  jQuery("#fifu_keywords").val(' ');
51
  }, 2000);
52
  }
53
  }
54
+ if (!$url || $url == ' ')
55
+ xhr.open("GET", 'https://source.unsplash.com/random', true);
56
+ else
57
+ xhr.open("GET", 'https://source.unsplash.com/featured/?' + $url, true);
58
  xhr.send();
59
  if (!$url)
60
  jQuery("#fifu_keywords").val(' ');
admin/html/menu.html CHANGED
@@ -367,6 +367,157 @@
367
  on, off
368
  </th>
369
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
  <tr class="color">
371
  <th>
372
  <?php $fifu['tab']['shortcode']() ?>
@@ -717,7 +868,178 @@
717
  <th>
718
  on, off
719
  </th>
720
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
721
  <tr class="color">
722
  <th>
723
  <?php $fifu['tab']['metadata']() ?>
@@ -2743,6 +3065,11 @@
2743
  <?php $fifu['slider']['counter']() ?>
2744
  </th>
2745
  </tr>
 
 
 
 
 
2746
  <tr>
2747
  <th>
2748
  <input id="fifu_input_spinner_slider"
@@ -2777,6 +3104,11 @@
2777
  <?php $fifu['slider']['duration']() ?>
2778
  </th>
2779
  </tr>
 
 
 
 
 
2780
  </table>
2781
  </div>
2782
  <div id="tabsSlider-b">
@@ -3605,7 +3937,7 @@
3605
  <i class="fab fa-facebook" style="font-size:30px"></i>
3606
  </td>
3607
  <td style="width:33%;text-align:center;border-bottom: 1px solid #ddd !important">
3608
- <i class="fas fa-money-bill-alt" style="font-size:30px"></i>
3609
  </td>
3610
  <td style="width:33%;text-align:center;border-bottom: 1px solid #ddd !important">
3611
  <i class="fas fa-tachometer-alt" style="font-size:30px"></i>
367
  on, off
368
  </th>
369
  </tr>
370
+ <tr class="color">
371
+ <th>
372
+ <?php $fifu['tab']['image']() ?>
373
+ </th>
374
+ <th>
375
+ <?php $fifu['title']['title']() ?>
376
+ </th>
377
+ <th>
378
+ <?php $fifu['title']['copy']() ?>
379
+ </th>
380
+ <th>
381
+ wp fifu image --title-copy &lt;toggle&gt;
382
+ </th>
383
+ <th>
384
+ on, off
385
+ </th>
386
+ </tr>
387
+ <tr class="color">
388
+ <th>
389
+ <?php $fifu['tab']['image']() ?>
390
+ </th>
391
+ <th>
392
+ <?php $fifu['title']['title']() ?>
393
+ </th>
394
+ <th>
395
+ <?php $fifu['title']['always']() ?>
396
+ </th>
397
+ <th>
398
+ wp fifu image --title-always &lt;toggle&gt;
399
+ </th>
400
+ <th>
401
+ on, off
402
+ </th>
403
+ </tr>
404
+ <tr class="color">
405
+ <th>
406
+ <?php $fifu['tab']['image']() ?>
407
+ </th>
408
+ <th>
409
+ <?php $fifu['title']['hide']() ?>
410
+ </th>
411
+ <th>
412
+ <?php $fifu['where']['page']() ?>
413
+ </th>
414
+ <th>
415
+ wp fifu image --hide-page &lt;toggle&gt;
416
+ </th>
417
+ <th>
418
+ on, off
419
+ </th>
420
+ </tr>
421
+ <tr class="color">
422
+ <th>
423
+ <?php $fifu['tab']['image']() ?>
424
+ </th>
425
+ <th>
426
+ <?php $fifu['title']['hide']() ?>
427
+ </th>
428
+ <th>
429
+ <?php $fifu['where']['post']() ?>
430
+ </th>
431
+ <th>
432
+ wp fifu image --hide-post &lt;toggle&gt;
433
+ </th>
434
+ <th>
435
+ on, off
436
+ </th>
437
+ </tr>
438
+ <tr class="color">
439
+ <th>
440
+ <?php $fifu['tab']['image']() ?>
441
+ </th>
442
+ <th>
443
+ <?php $fifu['title']['hide']() ?>
444
+ </th>
445
+ <th>
446
+ <?php $fifu['where']['cpt']() ?> <?php $fifu['hide']['exception']() ?>
447
+ </th>
448
+ <th>
449
+ wp fifu image --hide-cpt &lt;toggle&gt;
450
+ </th>
451
+ <th>
452
+ on, off
453
+ </th>
454
+ </tr>
455
+ <tr class="color">
456
+ <th>
457
+ <?php $fifu['tab']['image']() ?>
458
+ </th>
459
+ <th>
460
+ <?php $fifu['title']['default']() ?>
461
+ </th>
462
+ <th></th>
463
+ <th>
464
+ wp fifu image --default &lt;toggle&gt;
465
+ </th>
466
+ <th>
467
+ on, off
468
+ </th>
469
+ </tr>
470
+ <tr class="color">
471
+ <th>
472
+ <?php $fifu['tab']['image']() ?>
473
+ </th>
474
+ <th>
475
+ <?php $fifu['title']['default']() ?>
476
+ </th>
477
+ <th>
478
+ URL
479
+ </th>
480
+ <th>
481
+ wp fifu image --default-url &lt;string&gt;
482
+ </th>
483
+ <th>
484
+ https://...
485
+ </th>
486
+ </tr>
487
+ <tr class="color">
488
+ <th>
489
+ <?php $fifu['tab']['image']() ?>
490
+ </th>
491
+ <th>
492
+ <?php $fifu['title']['content']() ?>
493
+ </th>
494
+ <th>
495
+ <?php $fifu['where']['page']() ?>
496
+ </th>
497
+ <th>
498
+ wp fifu image --content-page &lt;toggle&gt;
499
+ </th>
500
+ <th>
501
+ on, off
502
+ </th>
503
+ </tr>
504
+ <tr class="color">
505
+ <th>
506
+ <?php $fifu['tab']['image']() ?>
507
+ </th>
508
+ <th>
509
+ <?php $fifu['title']['content']() ?>
510
+ </th>
511
+ <th>
512
+ <?php $fifu['where']['post']() ?>
513
+ </th>
514
+ <th>
515
+ wp fifu image --content-post &lt;toggle&gt;
516
+ </th>
517
+ <th>
518
+ on, off
519
+ </th>
520
+ </tr>
521
  <tr class="color">
522
  <th>
523
  <?php $fifu['tab']['shortcode']() ?>
868
  <th>
869
  on, off
870
  </th>
871
+ </tr>
872
+ <tr class="color">
873
+ <th>
874
+ <?php $fifu['tab']['video']() ?>
875
+ </th>
876
+ <th>
877
+ <?php $fifu['title']['width']() ?>
878
+ </th>
879
+ <th></th>
880
+ <th>
881
+ wp fifu video --min-width &lt;integer&gt;
882
+ </th>
883
+ <th>
884
+ 75, 100, 150...
885
+ </th>
886
+ </tr>
887
+ <tr class="color">
888
+ <th>
889
+ <?php $fifu['tab']['video']() ?>
890
+ </th>
891
+ <th>
892
+ <?php $fifu['title']['black']() ?>
893
+ </th>
894
+ <th></th>
895
+ <th>
896
+ wp fifu video --black &lt;toggle&gt;
897
+ </th>
898
+ <th>
899
+ on, off
900
+ </th>
901
+ </tr>
902
+ <tr class="color">
903
+ <th>
904
+ <?php $fifu['tab']['video']() ?>
905
+ </th>
906
+ <th>
907
+ <?php $fifu['title']['mouseover']() ?>
908
+ </th>
909
+ <th>
910
+ <?php $fifu['player']['youtube']() ?>
911
+ </th>
912
+ <th>
913
+ wp fifu video --mouse-youtube &lt;toggle&gt;
914
+ </th>
915
+ <th>
916
+ on, off
917
+ </th>
918
+ </tr>
919
+ <tr class="color">
920
+ <th>
921
+ <?php $fifu['tab']['video']() ?>
922
+ </th>
923
+ <th>
924
+ <?php $fifu['title']['mouseover']() ?>
925
+ </th>
926
+ <th>
927
+ <?php $fifu['player']['vimeo']() ?>
928
+ </th>
929
+ <th>
930
+ wp fifu video --mouse-vimeo &lt;toggle&gt;
931
+ </th>
932
+ <th>
933
+ on, off
934
+ </th>
935
+ </tr>
936
+ <tr class="color">
937
+ <th>
938
+ <?php $fifu['tab']['video']() ?>
939
+ </th>
940
+ <th>
941
+ <?php $fifu['title']['autoplay']() ?>
942
+ </th>
943
+ <th></th>
944
+ <th>
945
+ wp fifu video --autoplay &lt;toggle&gt;
946
+ </th>
947
+ <th>
948
+ on, off
949
+ </th>
950
+ </tr>
951
+ <tr class="color">
952
+ <th>
953
+ <?php $fifu['tab']['video']() ?>
954
+ </th>
955
+ <th>
956
+ <?php $fifu['title']['loop']() ?>
957
+ </th>
958
+ <th></th>
959
+ <th>
960
+ wp fifu video --loop &lt;toggle&gt;
961
+ </th>
962
+ <th>
963
+ on, off
964
+ </th>
965
+ </tr>
966
+ <tr class="color">
967
+ <th>
968
+ <?php $fifu['tab']['video']() ?>
969
+ </th>
970
+ <th>
971
+ <?php $fifu['title']['mute']() ?>
972
+ </th>
973
+ <th></th>
974
+ <th>
975
+ wp fifu video --mute &lt;toggle&gt;
976
+ </th>
977
+ <th>
978
+ on, off
979
+ </th>
980
+ </tr>
981
+ <tr class="color">
982
+ <th>
983
+ <?php $fifu['tab']['video']() ?>
984
+ </th>
985
+ <th>
986
+ <?php $fifu['title']['background']() ?>
987
+ </th>
988
+ <th></th>
989
+ <th>
990
+ wp fifu video --background &lt;toggle&gt;
991
+ </th>
992
+ <th>
993
+ on, off
994
+ </th>
995
+ </tr>
996
+ <tr class="color">
997
+ <th>
998
+ <?php $fifu['tab']['video']() ?>
999
+ </th>
1000
+ <th>
1001
+ <?php $fifu['title']['related']() ?>
1002
+ </th>
1003
+ <th></th>
1004
+ <th>
1005
+ wp fifu video --related &lt;toggle&gt;
1006
+ </th>
1007
+ <th>
1008
+ on, off
1009
+ </th>
1010
+ </tr>
1011
+ <tr class="color">
1012
+ <th>
1013
+ <?php $fifu['tab']['video']() ?>
1014
+ </th>
1015
+ <th>
1016
+ <?php $fifu['title']['icon']() ?>
1017
+ </th>
1018
+ <th></th>
1019
+ <th>
1020
+ wp fifu video --icon &lt;toggle&gt;
1021
+ </th>
1022
+ <th>
1023
+ on, off
1024
+ </th>
1025
+ </tr>
1026
+ <tr class="color">
1027
+ <th>
1028
+ <?php $fifu['tab']['video']() ?>
1029
+ </th>
1030
+ <th>
1031
+ <?php $fifu['title']['icon']() ?>
1032
+ </th>
1033
+ <th>
1034
+ <?php $fifu['icon']['css']() ?>
1035
+ </th>
1036
+ <th>
1037
+ wp fifu video --icon-selector &lt;string&gt;
1038
+ </th>
1039
+ <th>
1040
+ #id, .class, ...
1041
+ </th>
1042
+ </tr>
1043
  <tr class="color">
1044
  <th>
1045
  <?php $fifu['tab']['metadata']() ?>
3065
  <?php $fifu['slider']['counter']() ?>
3066
  </th>
3067
  </tr>
3068
+ </table>
3069
+
3070
+ <br>
3071
+
3072
+ <table style="text-align:left">
3073
  <tr>
3074
  <th>
3075
  <input id="fifu_input_spinner_slider"
3104
  <?php $fifu['slider']['duration']() ?>
3105
  </th>
3106
  </tr>
3107
+ <tr>
3108
+ <th>
3109
+ <input type="submit" disabled value="<?php $fifu['button']['ok']() ?>" style="width:73px">
3110
+ </th>
3111
+ </tr>
3112
  </table>
3113
  </div>
3114
  <div id="tabsSlider-b">
3937
  <i class="fab fa-facebook" style="font-size:30px"></i>
3938
  </td>
3939
  <td style="width:33%;text-align:center;border-bottom: 1px solid #ddd !important">
3940
+ <i class="fab fa-instagram-square" style="font-size:30px"></i>
3941
  </td>
3942
  <td style="width:33%;text-align:center;border-bottom: 1px solid #ddd !important">
3943
  <i class="fas fa-tachometer-alt" style="font-size:30px"></i>
admin/menu.php CHANGED
@@ -8,7 +8,7 @@ add_action('admin_menu', 'fifu_insert_menu');
8
 
9
  function fifu_insert_menu() {
10
  if (strpos($_SERVER['REQUEST_URI'], 'featured-image-from-url') !== false) {
11
- wp_enqueue_script('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/js/all.min.js');
12
  wp_enqueue_style('jquery-ui-style1', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css');
13
  wp_enqueue_style('jquery-ui-style2', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.structure.min.css');
14
  wp_enqueue_style('jquery-ui-style3', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.theme.min.css');
8
 
9
  function fifu_insert_menu() {
10
  if (strpos($_SERVER['REQUEST_URI'], 'featured-image-from-url') !== false) {
11
+ wp_enqueue_script('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/js/all.min.js');
12
  wp_enqueue_style('jquery-ui-style1', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css');
13
  wp_enqueue_style('jquery-ui-style2', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.structure.min.css');
14
  wp_enqueue_style('jquery-ui-style3', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.theme.min.css');
admin/strings.php CHANGED
@@ -355,7 +355,7 @@ function fifu_get_strings_settings() {
355
  _e("\"Nulled\" Premium doesn't work", FIFU_SLUG);
356
  };
357
  $fifu['support']['money'] = function() {
358
- _e("Does FIFU Premium work on my site?", FIFU_SLUG);
359
  };
360
  $fifu['support']['speed'] = function() {
361
  _e("PageSpeed and GTmetrix issues", FIFU_SLUG);
@@ -376,7 +376,7 @@ function fifu_get_strings_settings() {
376
  _e("This plugin has NO nulled versions, but pirate versions. Don't install that. It's illegal and should ruin your site. Moreover, sales of the original premium version keep this project alive.", FIFU_SLUG);
377
  };
378
  $fifu['support']['money-desc'] = function() {
379
- _e("You have a 30-day money-back guarantee to test for yourself. If something goes wrong just contact the support and ask for a solution or refund.", FIFU_SLUG);
380
  };
381
  $fifu['support']['speed-desc'] = function() {
382
  _e("You can solve that installing Jetpack plugin. Access its \"Settings\", \"Performance\" and enable \"Speed up image load times\". You'll have a free CDN + optimized external thumbnails.", FIFU_SLUG);
@@ -557,7 +557,7 @@ function fifu_get_strings_settings() {
557
 
558
  // auto set
559
  $fifu['auto']['desc'] = function() {
560
- _e("Set featured images automatically. FIFU will check every minute if there are post types without featured images and will perform web searches based on post titles to get the image URLs. The image searches happen in a FIFU cloud service connected to a search engine and, due the costs involved, for now it's limited to 1,000 posts a day, one search at a time, and available only for license keys purchased/renewed from a year ago.", FIFU_SLUG);
561
  };
562
  $fifu['auto']['tab']['auto'] = function() {
563
  _e("Auto set", FIFU_SLUG);
@@ -580,7 +580,7 @@ function fifu_get_strings_settings() {
580
 
581
  // isbn
582
  $fifu['isbn']['desc'] = function() {
583
- _e("Set featured images automatically. FIFU will check every minute if there are post types without featured images and will perform web searches based on ISBN to get the image URLs. The image searches happen in a FIFU cloud service connected to a books API and, due the costs involved, for now it's limited to 1,000 posts a day, one search at a time, and available only for license keys purchased/renewed from a year ago.", FIFU_SLUG);
584
  };
585
 
586
  // giphy
355
  _e("\"Nulled\" Premium doesn't work", FIFU_SLUG);
356
  };
357
  $fifu['support']['money'] = function() {
358
+ _e("Instagram images disappeared", FIFU_SLUG);
359
  };
360
  $fifu['support']['speed'] = function() {
361
  _e("PageSpeed and GTmetrix issues", FIFU_SLUG);
376
  _e("This plugin has NO nulled versions, but pirate versions. Don't install that. It's illegal and should ruin your site. Moreover, sales of the original premium version keep this project alive.", FIFU_SLUG);
377
  };
378
  $fifu['support']['money-desc'] = function() {
379
+ _e("Because Instagram is invalidating its URLs once a month. FIFU can renew the URLs automatically via API, however due to the costs involved, it is only available in the Premium version.", FIFU_SLUG);
380
  };
381
  $fifu['support']['speed-desc'] = function() {
382
  _e("You can solve that installing Jetpack plugin. Access its \"Settings\", \"Performance\" and enable \"Speed up image load times\". You'll have a free CDN + optimized external thumbnails.", FIFU_SLUG);
557
 
558
  // auto set
559
  $fifu['auto']['desc'] = function() {
560
+ _e("Set featured images automatically. FIFU will check every minute if there are post types without featured images and will perform web searches based on post titles to get the image URLs. The image searches happen in a FIFU cloud service connected to a search engine and, due the costs involved, for now it's limited to 2,500 posts a day, one search at a time, and available only for license keys purchased/renewed from a year ago.", FIFU_SLUG);
561
  };
562
  $fifu['auto']['tab']['auto'] = function() {
563
  _e("Auto set", FIFU_SLUG);
580
 
581
  // isbn
582
  $fifu['isbn']['desc'] = function() {
583
+ _e("Set featured images automatically. FIFU will check every minute if there are post types without featured images and will perform web searches based on ISBN to get the image URLs. The image searches happen in a FIFU cloud service connected to a books API and, due the costs involved, for now it's limited to 2,500 posts a day, one search at a time, and available only for license keys purchased/renewed from a year ago.", FIFU_SLUG);
584
  };
585
 
586
  // giphy
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image as featured image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
7
- * Version: 3.4.7
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image as featured image of a post or WooCommerce product. Includes Image Search, Video, Social Tags, SEO, Lazy Load, Gallery, Automation etc.
7
+ * Version: 3.4.8
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
includes/attachment.php CHANGED
@@ -316,9 +316,6 @@ function fifu_add_url_parameters($url, $att_id) {
316
  if (!$post_id)
317
  return $url;
318
 
319
- // instagram URL fixer
320
- $url = fifu_check_instagram_thumb($url, $att_id, $post_id);
321
-
322
  $post_thumbnail_id = get_post_thumbnail_id($post_id);
323
  $post_thumbnail_id = $post_thumbnail_id ? $post_thumbnail_id : get_term_meta($post_id, 'thumbnail_id', true);
324
  $featured = $post_thumbnail_id == $att_id ? 1 : 0;
316
  if (!$post_id)
317
  return $url;
318
 
 
 
 
319
  $post_thumbnail_id = get_post_thumbnail_id($post_id);
320
  $post_thumbnail_id = $post_thumbnail_id ? $post_thumbnail_id : get_term_meta($post_id, 'thumbnail_id', true);
321
  $featured = $post_thumbnail_id == $att_id ? 1 : 0;
includes/convert-url.php CHANGED
@@ -4,9 +4,6 @@ function fifu_convert($url) {
4
  if (fifu_from_google_drive($url))
5
  return fifu_google_drive_url($url);
6
 
7
- if (fifu_from_instagram($url))
8
- return fifu_instagram_url($url);
9
-
10
  return $url;
11
  }
12
 
@@ -25,40 +22,3 @@ function fifu_google_drive_url($url) {
25
  return 'https://drive.google.com/uc?id=' . fifu_google_drive_id($url);
26
  }
27
 
28
- //Instagram
29
-
30
- function fifu_from_instagram($url) {
31
- return preg_match("/[^a-z]instagram.com/", $url);
32
- }
33
-
34
- function fifu_instagram_id($url) {
35
- preg_match("/[-\w]{11,}/", $url, $matches);
36
- return $matches[0];
37
- }
38
-
39
- function fifu_instagram_url($url) {
40
- return 'https://www.instagram.com/p/' . fifu_instagram_id($url) . '/media/?size=l';
41
- }
42
-
43
- function fifu_is_old_instagram_url($url) {
44
- return strpos($url, 'https://www.instagram.com/p/') !== false;
45
- }
46
-
47
- function fifu_is_new_instagram_url($url) {
48
- return strpos($url, 'https://scontent.cdninstagram.com/v/') !== false;
49
- }
50
-
51
- function fifu_is_renewed_instagram_url($url) {
52
- return strpos($url, 'fifu-create-date') !== false;
53
- }
54
-
55
- function fifu_instagram_expired_date($url) {
56
- $aux = explode('fifu-create-date=', $url)[1];
57
- return $aux ? explode('&', $aux)[0] : null;
58
- }
59
-
60
- function fifu_is_expired_instagram_url($url) {
61
- $date = fifu_instagram_expired_date($url);
62
- return $date ? strtotime(date("Y-m-d")) - strtotime($date) >= 3600 * 24 * 30 : false;
63
- }
64
-
4
  if (fifu_from_google_drive($url))
5
  return fifu_google_drive_url($url);
6
 
 
 
 
7
  return $url;
8
  }
9
 
22
  return 'https://drive.google.com/uc?id=' . fifu_google_drive_id($url);
23
  }
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/util.php CHANGED
@@ -71,32 +71,6 @@ function fifu_get_tags($post_id) {
71
  return $names ? rtrim($names) : null;
72
  }
73
 
74
- function fifu_check_instagram_thumb($url, $att_id, $post_id) {
75
- if (!fifu_is_old_instagram_url($url) && !fifu_is_new_instagram_url($url))
76
- return $url;
77
-
78
- if (fifu_is_new_instagram_url($url)) {
79
- if (fifu_is_renewed_instagram_url($url) && !fifu_is_expired_instagram_url($url))
80
- return $url;
81
- }
82
-
83
- if (!fifu_is_in_editor()) {
84
- $db_url = get_post_meta($post_id, 'fifu_image_url', true);
85
- if ($db_url == $url) {
86
- $new_url = fifu_api_get_instagram_thumb($url);
87
- if ($new_url) {
88
- update_post_meta($post_id, 'fifu_image_url', $new_url);
89
- update_post_meta($att_id, '_wp_attached_file', $new_url);
90
- global $wpdb;
91
- $wpdb->update($wpdb->posts, ['guid' => $new_url], ['ID' => $att_id]);
92
- return $new_url;
93
- }
94
- } else
95
- return $db_url;
96
- }
97
- return $url;
98
- }
99
-
100
  function fifu_get_home_url() {
101
  return explode('//', get_home_url())[1];
102
  }
71
  return $names ? rtrim($names) : null;
72
  }
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  function fifu_get_home_url() {
75
  return explode('//', get_home_url())[1];
76
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
4
  Tags: featured, image, url, woocommerce, thumbnail
5
  Requires at least: 5.3
6
  Tested up to: 5.6
7
- Stable tag: 3.4.7
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -197,20 +197,20 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr and Publiti
197
 
198
  == Changelog ==
199
 
 
 
 
200
  = 3.4.7 =
201
  * Fix: undefined variables.
202
 
203
  = 3.4.6 =
204
  * Improvement: 35 new WP-CLI commands added; new integration function: fifu_dev_set_image_list(); fix: conflict with AMP + Jetpack; fix: expired Instagram URLs.
205
 
206
- = 3.4.5 =
207
- * Improvement: integration with WP-CLI (20 commands added); bug fix: Hide Featured Media should not work for WooCommerce products.
208
-
209
  = others =
210
  * [more](https://fifu.app/changelog/)
211
 
212
 
213
  == Upgrade Notice ==
214
 
215
- = 3.4.7 =
216
- * Fix: undefined variables.
4
  Tags: featured, image, url, woocommerce, thumbnail
5
  Requires at least: 5.3
6
  Tested up to: 5.6
7
+ Stable tag: 3.4.8
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
197
 
198
  == Changelog ==
199
 
200
+ = 3.4.8 =
201
+ * Notice: for users with Instagram images; improvement: 20 new WP-CLI commands added; fix: Unsplash random image.
202
+
203
  = 3.4.7 =
204
  * Fix: undefined variables.
205
 
206
  = 3.4.6 =
207
  * Improvement: 35 new WP-CLI commands added; new integration function: fifu_dev_set_image_list(); fix: conflict with AMP + Jetpack; fix: expired Instagram URLs.
208
 
 
 
 
209
  = others =
210
  * [more](https://fifu.app/changelog/)
211
 
212
 
213
  == Upgrade Notice ==
214
 
215
+ = 3.4.8 =
216
+ * Notice: for users with Instagram images; improvement: 20 new WP-CLI commands added; fix: Unsplash random image.