Featured Image From URL - Version 3.9.1

Version Description

  • New option: Auto set featured media from post content > skip URLs with.
Download this release

Release Info

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

Code changes from version 3.9.0 to 3.9.1

admin/cli-commands.php CHANGED
@@ -20,6 +20,10 @@ class fifu_cli extends WP_CLI_Command {
20
  update_option('fifu_spinner_nth', $args[0], 'no');
21
  return;
22
  }
 
 
 
 
23
  if (!empty($assoc_args['hide'])) {
24
  switch ($args[0]) {
25
  case 'on':
20
  update_option('fifu_spinner_nth', $args[0], 'no');
21
  return;
22
  }
23
+ if (!empty($assoc_args['skip'])) {
24
+ update_option('fifu_skip', $args[0], 'no');
25
+ return;
26
+ }
27
  if (!empty($assoc_args['hide'])) {
28
  switch ($args[0]) {
29
  case 'on':
admin/html/menu.html CHANGED
@@ -279,6 +279,21 @@
279
  on, off
280
  </th>
281
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  <tr class="color">
283
  <th>
284
  <?php $fifu['tab']['auto']() ?>
@@ -2366,6 +2381,25 @@
2366
  <?php $fifu['html']['check']() ?>
2367
  </th>
2368
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2369
  </table>
2370
  </div>
2371
 
279
  on, off
280
  </th>
281
  </tr>
282
+ <tr class="color">
283
+ <th>
284
+ <?php $fifu['tab']['auto']() ?>
285
+ </th>
286
+ <th>
287
+ <?php $fifu['title']['html']() ?>
288
+ </th>
289
+ <th>
290
+ <?php $fifu['html']['skip']['desc']() ?>
291
+ </th>
292
+ <th>
293
+ wp fifu content --skip &lt;string&gt;
294
+ </th>
295
+ <th>abcd,xyz,...</th>
296
+ </tr>
297
  <tr class="color">
298
  <th>
299
  <?php $fifu['tab']['auto']() ?>
2381
  <?php $fifu['html']['check']() ?>
2382
  </th>
2383
  </tr>
2384
+ <tr>
2385
+ <th>
2386
+ <?php $fifu['html']['skip']['desc']() ?>
2387
+ </th>
2388
+ <th>
2389
+ <form
2390
+ id="fifu_form_skip"
2391
+ action="javascript:void(0)"
2392
+ method="post">
2393
+ <input id="fifu_input_skip"
2394
+ type="text"
2395
+ name="fifu_input_skip"
2396
+ style="width:358px"
2397
+ value="<?php echo $skip; ?>"
2398
+ placeholder="<?php $fifu['html']['skip']['placeholder']() ?>">
2399
+ <input type="submit" value="<?php $fifu['button']['ok']() ?>" style="width:72px">
2400
+ </form>
2401
+ </th>
2402
+ </tr>
2403
  </table>
2404
  </div>
2405
 
admin/html/support-data.html CHANGED
@@ -53,6 +53,7 @@ fifu_query_strings:<?php echo $enable_query_strings ?>;
53
  fifu_reset:<?php echo $enable_reset ?>;
54
  fifu_run_delete_all:<?php echo $enable_run_delete_all ?>;
55
  fifu_run_delete_all_time:<?php echo $enable_run_delete_all_time ?>;
 
56
  fifu_social:<?php echo $enable_social ?>;
57
  fifu_social_image_only:<?php echo $enable_social_image_only ?>;
58
  fifu_spinner_db:<?php echo $max_db ?>;
53
  fifu_reset:<?php echo $enable_reset ?>;
54
  fifu_run_delete_all:<?php echo $enable_run_delete_all ?>;
55
  fifu_run_delete_all_time:<?php echo $enable_run_delete_all_time ?>;
56
+ fifu_skip:<?php echo $skip ?>;
57
  fifu_social:<?php echo $enable_social ?>;
58
  fifu_social_image_only:<?php echo $enable_social_image_only ?>;
59
  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_lazy', 'fifu_photon', 'fifu_cdn_social', 'fifu_cdn_crop', 'fifu_cdn_content', 'fifu_reset', 'fifu_content', 'fifu_content_page', 'fifu_content_cpt', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_default_url', 'fifu_default_cpt', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_decode', 'fifu_check', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
4
 
5
  define('FIFU_SLUG', 'featured-image-from-url');
6
 
@@ -89,6 +89,7 @@ function fifu_support_data() {
89
 
90
  $enable_social = get_option('fifu_social');
91
  $enable_social_image_only = get_option('fifu_social_image_only');
 
92
  $enable_lazy = get_option('fifu_lazy');
93
  $enable_photon = get_option('fifu_photon');
94
  $enable_cdn_social = get_option('fifu_cdn_social');
@@ -148,6 +149,7 @@ function fifu_get_menu_html() {
148
 
149
  $enable_social = get_option('fifu_social');
150
  $enable_social_image_only = get_option('fifu_social_image_only');
 
151
  $enable_lazy = get_option('fifu_lazy');
152
  $enable_photon = get_option('fifu_photon');
153
  $enable_cdn_social = get_option('fifu_cdn_social');
@@ -224,7 +226,7 @@ function fifu_get_setting($type) {
224
  register_setting('settings-group', $type);
225
 
226
  $arr1 = array('fifu_spinner_nth');
227
- $arrEmpty = array('fifu_default_url');
228
  $arrDefaultType = array('fifu_default_cpt');
229
  $arr64 = array('fifu_column_height');
230
  $arr1000 = array('fifu_spinner_db');
@@ -257,6 +259,7 @@ function fifu_get_setting($type) {
257
  function fifu_update_menu_options() {
258
  fifu_update_option('fifu_input_social', 'fifu_social');
259
  fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
 
260
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
261
  fifu_update_option('fifu_input_photon', 'fifu_photon');
262
  fifu_update_option('fifu_input_cdn_social', 'fifu_cdn_social');
1
  <?php
2
 
3
+ define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_social_image_only', 'fifu_skip', 'fifu_lazy', 'fifu_photon', 'fifu_cdn_social', 'fifu_cdn_crop', 'fifu_cdn_content', 'fifu_reset', 'fifu_content', 'fifu_content_page', 'fifu_content_cpt', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_default_url', 'fifu_default_cpt', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_confirm_delete_all', 'fifu_run_delete_all', 'fifu_column_height', 'fifu_decode', 'fifu_check', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean')));
4
 
5
  define('FIFU_SLUG', 'featured-image-from-url');
6
 
89
 
90
  $enable_social = get_option('fifu_social');
91
  $enable_social_image_only = get_option('fifu_social_image_only');
92
+ $skip = get_option('fifu_skip');
93
  $enable_lazy = get_option('fifu_lazy');
94
  $enable_photon = get_option('fifu_photon');
95
  $enable_cdn_social = get_option('fifu_cdn_social');
149
 
150
  $enable_social = get_option('fifu_social');
151
  $enable_social_image_only = get_option('fifu_social_image_only');
152
+ $skip = get_option('fifu_skip');
153
  $enable_lazy = get_option('fifu_lazy');
154
  $enable_photon = get_option('fifu_photon');
155
  $enable_cdn_social = get_option('fifu_cdn_social');
226
  register_setting('settings-group', $type);
227
 
228
  $arr1 = array('fifu_spinner_nth');
229
+ $arrEmpty = array('fifu_default_url', 'fifu_skip');
230
  $arrDefaultType = array('fifu_default_cpt');
231
  $arr64 = array('fifu_column_height');
232
  $arr1000 = array('fifu_spinner_db');
259
  function fifu_update_menu_options() {
260
  fifu_update_option('fifu_input_social', 'fifu_social');
261
  fifu_update_option('fifu_input_social_image_only', 'fifu_social_image_only');
262
+ fifu_update_option('fifu_input_skip', 'fifu_skip');
263
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
264
  fifu_update_option('fifu_input_photon', 'fifu_photon');
265
  fifu_update_option('fifu_input_cdn_social', 'fifu_cdn_social');
admin/strings.php CHANGED
@@ -938,6 +938,12 @@ function fifu_get_strings_settings() {
938
  $fifu['html']['check'] = function() {
939
  _e("check \"don't get URL from post content\" option, in the post editor, by default", FIFU_SLUG);
940
  };
 
 
 
 
 
 
941
 
942
  // all
943
  $fifu['all']['desc'] = function() {
@@ -2055,3 +2061,4 @@ function fifu_get_strings_cloud() {
2055
 
2056
  return $fifu;
2057
  }
 
938
  $fifu['html']['check'] = function() {
939
  _e("check \"don't get URL from post content\" option, in the post editor, by default", FIFU_SLUG);
940
  };
941
+ $fifu['html']['skip']['desc'] = function() {
942
+ _e("skip URLs with", FIFU_SLUG);
943
+ };
944
+ $fifu['html']['skip']['placeholder'] = function() {
945
+ _e("example.com,anotherexample,onemore", FIFU_SLUG);
946
+ };
947
 
948
  // all
949
  $fifu['all']['desc'] = function() {
2061
 
2062
  return $fifu;
2063
  }
2064
+
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/video as featured image/video of a post or WooCommerce product.
7
- * Version: 3.9.0
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/video as featured image/video of a post or WooCommerce product.
7
+ * Version: 3.9.1
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
includes/external-post.php CHANGED
@@ -47,12 +47,42 @@ function fifu_first_img_in_content($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 = fifu_is_on('fifu_decode') ? html_entity_decode($content) : $content;
58
  $matches = array();
@@ -97,8 +127,23 @@ function fifu_first_url_in_content($post_id) {
97
  $i = 0;
98
  foreach ($matches[0] as $tag) {
99
  $i++;
100
- if (($tag && strpos($tag, 'data:image/jpeg') !== false) || ($i != $nth))
101
  continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  break;
103
  }
104
  }
47
  $nth = get_option('fifu_spinner_nth') - 1;
48
 
49
  preg_match_all('/<img[^>]*>/', $content, $matches);
50
+ if ($matches && $matches[0]) {
51
+ $skip_list = get_option('fifu_skip');
52
+ if (!$skip_list)
53
+ return $matches[0][$nth];
54
+
55
+ return fifu_skip_urls($skip_list, $matches[0], $nth);
56
+ }
57
 
58
  return null;
59
  }
60
 
61
+ function fifu_skip_urls($skip_list, $img_list, $nth) {
62
+ $i = 0;
63
+ foreach ($img_list as $img) {
64
+ if ($i < $nth) {
65
+ $i++;
66
+ continue;
67
+ }
68
+
69
+ $skip = false;
70
+ foreach (explode(',', $skip_list) as $word) {
71
+ if (strpos($img, $word) !== false) {
72
+ $skip = true;
73
+ break;
74
+ }
75
+ }
76
+
77
+ if ($skip) {
78
+ $i++;
79
+ continue;
80
+ }
81
+ return $img_list[$i];
82
+ }
83
+ return null;
84
+ }
85
+
86
  function fifu_show_all_images($content) {
87
  $content = fifu_is_on('fifu_decode') ? html_entity_decode($content) : $content;
88
  $matches = array();
127
  $i = 0;
128
  foreach ($matches[0] as $tag) {
129
  $i++;
130
+ if (($tag && strpos($tag, 'data:image/jpeg') !== false) || ($i < $nth))
131
  continue;
132
+
133
+ // skip
134
+ $skip_list = get_option('fifu_skip');
135
+ if ($skip_list) {
136
+ $skip = false;
137
+ foreach (explode(',', $skip_list) as $word) {
138
+ if (strpos($tag, $word) !== false) {
139
+ $skip = true;
140
+ break;
141
+ }
142
+ }
143
+ if ($skip)
144
+ continue;
145
+ }
146
+
147
  break;
148
  }
149
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 5.9.2
7
- Stable tag: 3.9.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -227,20 +227,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
227
 
228
  == Changelog ==
229
 
 
 
 
230
  = 3.9.0 =
231
  * Enhancement: Autoplay, Loop and Mute (integration with local featured videos); fix: Undefined variable warning.
232
 
233
  = 3.8.9 =
234
  * New option: Auto set screenshot as featured image > High resolution.
235
 
236
- = 3.8.8 =
237
- * New option: Auto set featured media from post content (option to dont get URL from post content can be checked/unchecked by default); enhancement: Quick Edit column integrated with CDN + Optimized Thumbnails; fix: conflict with Yoast Duplicate Post plugin (update of the duplicated post was changing the image of the original one); fix: PHP Notice (Undefined offset).
238
-
239
  = others =
240
  * [more](https://fifu.app/changelog)
241
 
242
 
243
  == Upgrade Notice ==
244
 
245
- = 3.9.0 =
246
- * Enhancement: Autoplay, Loop and Mute (integration with local featured videos); fix: Undefined variable warning.
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
  Tested up to: 5.9.2
7
+ Stable tag: 3.9.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
227
 
228
  == Changelog ==
229
 
230
+ = 3.9.1 =
231
+ * New option: Auto set featured media from post content > skip URLs with.
232
+
233
  = 3.9.0 =
234
  * Enhancement: Autoplay, Loop and Mute (integration with local featured videos); fix: Undefined variable warning.
235
 
236
  = 3.8.9 =
237
  * New option: Auto set screenshot as featured image > High resolution.
238
 
 
 
 
239
  = others =
240
  * [more](https://fifu.app/changelog)
241
 
242
 
243
  == Upgrade Notice ==
244
 
245
+ = 3.9.1 =
246
+ * New option: Auto set featured media from post content > skip URLs with.