Featured Image From URL - Version 2.5.0

Version Description

  • New premium feature: auto set first video; Bug fix: conflict with Enhanced Media Library plugin.
Download this release

Release Info

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

Code changes from version 2.4.9 to 2.5.0

admin/html/js/menu.js CHANGED
@@ -1,4 +1,5 @@
1
  jQuery(document).ready(function () {
 
2
  jQuery('.wrap').css('opacity', 1);
3
  });
4
 
1
  jQuery(document).ready(function () {
2
+ window.scrollTo(0, 0);
3
  jQuery('.wrap').css('opacity', 1);
4
  });
5
 
admin/html/menu.html CHANGED
@@ -8,7 +8,7 @@
8
  <ul>
9
  <li><a href="#tabs-d">Help</a></li>
10
  <li><a href="#tabs-k">Admin Area</a></li>
11
- <li><a href="#tabs-b">Auto Set First Image</a></li>
12
  <li><a href="#tabs-g">Featured Image</a></li>
13
  <li><a href="#tabs-j">Metadata</a></li>
14
  <li><a href="#tabs-i">Performance</a></li>
@@ -38,9 +38,9 @@
38
  <tr>
39
  <td style="width:60%"
40
  <div>
41
- Donate <b>US$ 39,90</b> and receive the download link by email within 12 hours.<br>
42
  Moreover, <b>you will have lifetime automatic updates</b>.<br><br>
43
- <i>* price valid for May 2019</i>
44
  </div>
45
  </td>
46
  <td style="width:20%">
@@ -230,7 +230,7 @@
230
 
231
  <h2>Configuration</h2>
232
  <div class="greybox">
233
- Perfect for external posts, this option allows to use the first image from a post/page/product content as featured image. It will happen when you click on Publish/Update button.
234
  </div>
235
 
236
  <br>
@@ -259,7 +259,7 @@
259
  </form>
260
  </th>
261
  <th>
262
- use the first image as featured image
263
  </th>
264
  </tr>
265
  <tr>
@@ -285,7 +285,7 @@
285
  </form>
286
  </th>
287
  <th>
288
- hide the first image from content
289
  </th>
290
  </tr>
291
  <tr>
@@ -311,20 +311,19 @@
311
  </form>
312
  </th>
313
  <th>
314
- overwrite the existing external featured image
315
  </th>
316
  </tr>
317
- </table>
318
-
319
  </div>
320
  <div class="box">
321
  <h2>Apply to all</h2>
322
  <div class="greybox" id="grad2">
323
  <b>Premium feature</b><br><br>
324
- Enable that to update all your posts/pages/products applying the configuration above.
325
- Very useful if you have hundreds of them and want to set the first image as featured image for all.
326
- It can take some minutes and can't be undone, so make a backup.
327
- To repeat the process enable the toggle again.
328
  <br><br>
329
  To schedule this process (hourly, daily etc), you can use the Hook <b>fifu_event</b> with your favorite cron event plugin. I like <a href="https://wordpress.org/plugins/wp-crontrol/">WP Control</a>.
330
  </div>
@@ -340,7 +339,7 @@
340
  style="display:block">
341
  </th>
342
  <th>
343
- ignore posts that already have an external featured image
344
  </th>
345
  </tr>
346
  <tr>
@@ -1267,7 +1266,7 @@
1267
  <div class="greybox" id="grad2">
1268
  <b>Premium feature</b><br><br>
1269
 
1270
- Enable video meta box. If you are not using videos as featured images, you can disable this feature and make your site a little faster.
1271
 
1272
  </div>
1273
 
8
  <ul>
9
  <li><a href="#tabs-d">Help</a></li>
10
  <li><a href="#tabs-k">Admin Area</a></li>
11
+ <li><a href="#tabs-b">Auto Set First Image/Video</a></li>
12
  <li><a href="#tabs-g">Featured Image</a></li>
13
  <li><a href="#tabs-j">Metadata</a></li>
14
  <li><a href="#tabs-i">Performance</a></li>
38
  <tr>
39
  <td style="width:60%"
40
  <div>
41
+ Donate <strike>US$ 50,00</strike> <b>US$ 39,90</b> and receive your license key and the download link by email within 12 hours.
42
  Moreover, <b>you will have lifetime automatic updates</b>.<br><br>
43
+ <i>* price valid for June 2019</i>
44
  </div>
45
  </td>
46
  <td style="width:20%">
230
 
231
  <h2>Configuration</h2>
232
  <div class="greybox">
233
+ Perfect for external posts, this option allows to use the first image/video from a post/page/product content as featured image. It will happen when you click on Publish/Update button. For videos, however, you will need the premium version.
234
  </div>
235
 
236
  <br>
259
  </form>
260
  </th>
261
  <th>
262
+ use the first image/video as featured image
263
  </th>
264
  </tr>
265
  <tr>
285
  </form>
286
  </th>
287
  <th>
288
+ hide the first image/video from content
289
  </th>
290
  </tr>
291
  <tr>
311
  </form>
312
  </th>
313
  <th>
314
+ overwrite the existing external featured image/video
315
  </th>
316
  </tr>
317
+ </table>
 
318
  </div>
319
  <div class="box">
320
  <h2>Apply to all</h2>
321
  <div class="greybox" id="grad2">
322
  <b>Premium feature</b><br><br>
323
+ Enable that to update all your posts/pages/products applying the configuration above.
324
+ Very useful if you have hundreds of them and want to set the first image as featured image for all.
325
+ It can take some minutes and can't be undone, so make a backup.
326
+ To repeat the process enable the toggle again.
327
  <br><br>
328
  To schedule this process (hourly, daily etc), you can use the Hook <b>fifu_event</b> with your favorite cron event plugin. I like <a href="https://wordpress.org/plugins/wp-crontrol/">WP Control</a>.
329
  </div>
339
  style="display:block">
340
  </th>
341
  <th>
342
+ ignore posts that already have an external featured image/video
343
  </th>
344
  </tr>
345
  <tr>
1266
  <div class="greybox" id="grad2">
1267
  <b>Premium feature</b><br><br>
1268
 
1269
+ FIFU supports videos from YouTube, Vimeo, Cloudinary or Tumblr. You can enable the video meta box here.
1270
 
1271
  </div>
1272
 
admin/html/meta-box.html CHANGED
@@ -53,8 +53,8 @@
53
  <br/>
54
  <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid red; border-top: 2px solid red; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
55
  background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">Please report any problem to <b>marcel@featuredimagefromurl.com</b></p>
56
- <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid purple; border-top: 2px solid purple; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
57
  background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">Product Gallery, Video and Slider fields are only available in <a href="wp-admin/admin.php?page=featured-image-from-url#tabs-a"><b>premium</b></a> version.</p>
58
- <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid orange; border-top: 2px solid orange; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
59
- background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">New feature: replace broken image.</p>
60
  </div>
53
  <br/>
54
  <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid red; border-top: 2px solid red; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
55
  background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">Please report any problem to <b>marcel@featuredimagefromurl.com</b></p>
56
+ <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid #00b0ff; border-top: 2px solid #00b0ff; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
57
  background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">Product Gallery, Video and Slider fields are only available in <a href="wp-admin/admin.php?page=featured-image-from-url#tabs-a"><b>premium</b></a> version.</p>
58
+ <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid blue; border-top: 2px solid blue; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
59
+ background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">New feature: auto set first video.</p>
60
  </div>
admin/meta-box.php CHANGED
@@ -56,9 +56,9 @@ function fifu_remove_first_image($data, $postarr) {
56
  return $data;
57
 
58
  if (fifu_is_off('fifu_pop_first'))
59
- return str_replace($img, fifu_show_image($img), $data);
60
 
61
- return str_replace($img, fifu_hide_image($img), $data);
62
  }
63
 
64
  add_action('save_post', 'fifu_save_properties');
56
  return $data;
57
 
58
  if (fifu_is_off('fifu_pop_first'))
59
+ return str_replace($img, fifu_show_media($img), $data);
60
 
61
+ return str_replace($img, fifu_hide_media($img), $data);
62
  }
63
 
64
  add_action('save_post', 'fifu_save_properties');
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://featuredimagefromurl.com/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
- * Version: 2.4.9
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://featuredimagefromurl.com/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
+ * Version: 2.5.0
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/attachment.php CHANGED
@@ -50,8 +50,10 @@ function fifu_replace_attachment_url($att_url, $att_id) {
50
  add_filter('posts_where', 'fifu_query_attachments');
51
 
52
  function fifu_query_attachments($where) {
53
- if (isset($_POST['action']) && ($_POST['action'] == 'query-attachments'))
54
- $where .= ' AND post_author <> 77777 ';
 
 
55
  return $where;
56
  }
57
 
50
  add_filter('posts_where', 'fifu_query_attachments');
51
 
52
  function fifu_query_attachments($where) {
53
+ if (isset($_POST['action']) && ($_POST['action'] == 'query-attachments')) {
54
+ global $wpdb;
55
+ $where .= ' AND ' . $wpdb->prefix . 'posts.post_author <> 77777 ';
56
+ }
57
  return $where;
58
  }
59
 
includes/external-post.php CHANGED
@@ -18,9 +18,9 @@ function fifu_remove_first_image_ext($data, $postarr) {
18
  return $data;
19
 
20
  if (fifu_is_off('fifu_pop_first'))
21
- return str_replace($img, fifu_show_image($img), $data);
22
 
23
- return str_replace($img, fifu_hide_image($img), $data);
24
  }
25
 
26
  add_action('save_post', 'fifu_save_properties_ext');
@@ -47,19 +47,19 @@ function fifu_show_all_images($content) {
47
  $matches = array();
48
  preg_match_all('/<img[^>]*display:[ ]*none[^>]*>/', $content, $matches);
49
  foreach ($matches[0] as $img) {
50
- $content = str_replace($img, fifu_show_image($img), $content);
51
  }
52
  return $content;
53
  }
54
 
55
- function fifu_hide_image($img) {
56
- if (strpos($img, 'style=\"') !== false)
57
- return preg_replace('/style=..[^"]*["]/', 'style=\"display:none\"', $img);
58
- return str_replace('/>', ' style=\"display:none\"/>', $img);
59
  }
60
 
61
- function fifu_show_image($img) {
62
- return preg_replace('/style=..display:[ ]*none../', '', $img);
63
  }
64
 
65
  function fifu_first_url_in_content($post_id) {
@@ -71,16 +71,18 @@ function fifu_first_url_in_content($post_id) {
71
  if (!$matches[0])
72
  return;
73
 
 
 
74
  //double quotes
75
  $aux1 = explode('src="', $matches[0][0]);
76
- if ($aux1) {
77
  $aux2 = explode('"', $aux1[1]);
78
  }
79
 
80
  //single quotes
81
- if (!$aux2[0]) {
82
  $aux1 = explode("src='", $matches[0][0]);
83
- if ($aux1)
84
  $aux2 = explode("'", $aux1[1]);
85
  }
86
 
18
  return $data;
19
 
20
  if (fifu_is_off('fifu_pop_first'))
21
+ return str_replace($img, fifu_show_media($img), $data);
22
 
23
+ return str_replace($img, fifu_hide_media($img), $data);
24
  }
25
 
26
  add_action('save_post', 'fifu_save_properties_ext');
47
  $matches = array();
48
  preg_match_all('/<img[^>]*display:[ ]*none[^>]*>/', $content, $matches);
49
  foreach ($matches[0] as $img) {
50
+ $content = str_replace($img, fifu_show_media($img), $content);
51
  }
52
  return $content;
53
  }
54
 
55
+ function fifu_hide_media($img) {
56
+ if (strpos($img, 'style="') !== false)
57
+ return preg_replace('/style=.[^"]*["]/', 'style="display:none"', $img);
58
+ return preg_replace('/[\/]*>/', ' style="display:none">', $img);
59
  }
60
 
61
+ function fifu_show_media($img) {
62
+ return preg_replace('/style=[\\\]*.display:[ ]*none[\\\]*./', '', $img);
63
  }
64
 
65
  function fifu_first_url_in_content($post_id) {
71
  if (!$matches[0])
72
  return;
73
 
74
+ $aux2 = null;
75
+
76
  //double quotes
77
  $aux1 = explode('src="', $matches[0][0]);
78
+ if ($aux1 && count($aux1) > 1) {
79
  $aux2 = explode('"', $aux1[1]);
80
  }
81
 
82
  //single quotes
83
+ if (!$aux2 || !$aux2[0]) {
84
  $aux1 = explode("src='", $matches[0][0]);
85
+ if ($aux1 && count($aux1) > 1)
86
  $aux2 = explode("'", $aux1[1]);
87
  }
88
 
readme.txt CHANGED
@@ -16,7 +16,7 @@ Features:
16
 
17
  * Featured Image from URL plugin allows you to use an external image as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product;
18
 
19
- * perfect for external posts, the plugin is able to use the first image as Featured Image;
20
 
21
  * when you access the table of posts/pages/products/categories in admin menu, the Featured Images are shown in a new column;
22
 
@@ -28,7 +28,7 @@ Features:
28
 
29
  * all included content still has social tags to facilitate sharing on social networks;
30
 
31
- * compatible with WP All Import plugin;
32
 
33
  * some nonstandard image URLs, such as Instagram and Google Drive's, will work as well;
34
 
@@ -46,7 +46,7 @@ Features:
46
 
47
  * you can use a slider of images as "featured image" (**premium feature**);
48
 
49
- * you can use a video thumbnail or a video as "featured image" (**premium feature**);
50
 
51
  * you can use any content provided by a shortcode as "featured image" (**premium BETA feature**);
52
 
@@ -60,6 +60,8 @@ Features:
60
 
61
  * auto play/pause videos on mouse over/out (**premium feature**);
62
 
 
 
63
  **<a href="https://featuredimagefromurl.com/">Official Site</a>**
64
  **<a href="https://blog.featuredimagefromurl.com/">Live Preview (Blog)</a>**
65
  **<a href="https://shop.featuredimagefromurl.com/">Live Preview (Shop)</a>**
@@ -157,6 +159,9 @@ Features:
157
 
158
  == Changelog ==
159
 
 
 
 
160
  = 2.4.9 =
161
  * Bug fix: metadata generation (route not found).
162
 
@@ -574,6 +579,9 @@ was removed. To finish, a Premium version is now been presented.
574
 
575
  == Upgrade Notice ==
576
 
 
 
 
577
  = 2.4.9 =
578
  * Bug fix: metadata generation (route not found).
579
 
16
 
17
  * Featured Image from URL plugin allows you to use an external image as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product;
18
 
19
+ * perfect for external posts, the plugin is able to use the first image/video as Featured Image;
20
 
21
  * when you access the table of posts/pages/products/categories in admin menu, the Featured Images are shown in a new column;
22
 
28
 
29
  * all included content still has social tags to facilitate sharing on social networks;
30
 
31
+ * compatible with WP All Import plugin and WooCommerce import;
32
 
33
  * some nonstandard image URLs, such as Instagram and Google Drive's, will work as well;
34
 
46
 
47
  * you can use a slider of images as "featured image" (**premium feature**);
48
 
49
+ * you can use an external video thumbnail or an external video (from YouTube, Vimeo, Cloudinary or Tumblr) as "featured image" (**premium feature**);
50
 
51
  * you can use any content provided by a shortcode as "featured image" (**premium BETA feature**);
52
 
60
 
61
  * auto play/pause videos on mouse over/out (**premium feature**);
62
 
63
+ * replace broken URLs by a default one (**premium feature**);
64
+
65
  **<a href="https://featuredimagefromurl.com/">Official Site</a>**
66
  **<a href="https://blog.featuredimagefromurl.com/">Live Preview (Blog)</a>**
67
  **<a href="https://shop.featuredimagefromurl.com/">Live Preview (Shop)</a>**
159
 
160
  == Changelog ==
161
 
162
+ = 2.5.0 =
163
+ * New premium feature: auto set first video; Bug fix: conflict with Enhanced Media Library plugin.
164
+
165
  = 2.4.9 =
166
  * Bug fix: metadata generation (route not found).
167
 
579
 
580
  == Upgrade Notice ==
581
 
582
+ = 2.5.0 =
583
+ * New premium feature: auto set first video; Bug fix: conflict with Enhanced Media Library plugin.
584
+
585
  = 2.4.9 =
586
  * Bug fix: metadata generation (route not found).
587