Featured Image From URL - Version 2.7.8

Version Description

  • Bug fix: menu settings style issues in sites hosted in WordPress.com; Improvement: better compatibility and security for rest routes, used in some menu settings; Bug fix: conflict with internal images that have the path files.wordpress.com.
Download this release

Release Info

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

Code changes from version 2.7.7 to 2.7.8

admin/api.php CHANGED
@@ -58,39 +58,54 @@ function fifu_test_execution_time() {
58
  add_action('rest_api_init', function () {
59
  register_rest_route('featured-image-from-url/v2', '/enable_fake_api/', array(
60
  'methods' => 'POST',
61
- 'callback' => 'fifu_enable_fake_api'
 
62
  ));
63
  register_rest_route('featured-image-from-url/v2', '/disable_fake_api/', array(
64
  'methods' => 'POST',
65
- 'callback' => 'fifu_disable_fake_api'
 
66
  ));
67
  register_rest_route('featured-image-from-url/v2', '/none_fake_api/', array(
68
  'methods' => 'POST',
69
- 'callback' => 'fifu_none_fake_api'
 
70
  ));
71
  register_rest_route('featured-image-from-url/v2', '/data_clean_api/', array(
72
  'methods' => 'POST',
73
- 'callback' => 'fifu_data_clean_api'
 
74
  ));
75
  register_rest_route('featured-image-from-url/v2', '/save_dimensions_all_api/', array(
76
  'methods' => 'POST',
77
- 'callback' => 'fifu_save_dimensions_all_api'
 
78
  ));
79
  register_rest_route('featured-image-from-url/v2', '/clean_dimensions_all_api/', array(
80
  'methods' => 'POST',
81
- 'callback' => 'fifu_clean_dimensions_all_api'
 
82
  ));
83
  register_rest_route('featured-image-from-url/v2', '/disable_default_api/', array(
84
  'methods' => 'POST',
85
- 'callback' => 'fifu_disable_default_api'
 
86
  ));
87
  register_rest_route('featured-image-from-url/v2', '/none_default_api/', array(
88
  'methods' => 'POST',
89
- 'callback' => 'fifu_none_default_api'
 
90
  ));
91
  register_rest_route('featured-image-from-url/v2', '/rest_url_api/', array(
92
- 'methods' => 'POST',
93
  'callback' => 'fifu_rest_url'
94
  ));
95
  });
96
 
 
 
 
 
 
 
 
58
  add_action('rest_api_init', function () {
59
  register_rest_route('featured-image-from-url/v2', '/enable_fake_api/', array(
60
  'methods' => 'POST',
61
+ 'callback' => 'fifu_enable_fake_api',
62
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
63
  ));
64
  register_rest_route('featured-image-from-url/v2', '/disable_fake_api/', array(
65
  'methods' => 'POST',
66
+ 'callback' => 'fifu_disable_fake_api',
67
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
68
  ));
69
  register_rest_route('featured-image-from-url/v2', '/none_fake_api/', array(
70
  'methods' => 'POST',
71
+ 'callback' => 'fifu_none_fake_api',
72
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
73
  ));
74
  register_rest_route('featured-image-from-url/v2', '/data_clean_api/', array(
75
  'methods' => 'POST',
76
+ 'callback' => 'fifu_data_clean_api',
77
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
78
  ));
79
  register_rest_route('featured-image-from-url/v2', '/save_dimensions_all_api/', array(
80
  'methods' => 'POST',
81
+ 'callback' => 'fifu_save_dimensions_all_api',
82
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
83
  ));
84
  register_rest_route('featured-image-from-url/v2', '/clean_dimensions_all_api/', array(
85
  'methods' => 'POST',
86
+ 'callback' => 'fifu_clean_dimensions_all_api',
87
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
88
  ));
89
  register_rest_route('featured-image-from-url/v2', '/disable_default_api/', array(
90
  'methods' => 'POST',
91
+ 'callback' => 'fifu_disable_default_api',
92
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
93
  ));
94
  register_rest_route('featured-image-from-url/v2', '/none_default_api/', array(
95
  'methods' => 'POST',
96
+ 'callback' => 'fifu_none_default_api',
97
+ 'permission_callback' => 'fifu_get_private_data_permissions_check',
98
  ));
99
  register_rest_route('featured-image-from-url/v2', '/rest_url_api/', array(
100
+ 'methods' => ['GET', 'POST'],
101
  'callback' => 'fifu_rest_url'
102
  ));
103
  });
104
 
105
+ function fifu_get_private_data_permissions_check() {
106
+ if (!current_user_can('edit_posts')) {
107
+ return new WP_Error('rest_forbidden', esc_html__('You can not access private data.', 'featured-image-from-url'), array('status' => 401));
108
+ }
109
+ return true;
110
+ }
111
+
admin/html/css/menu.css CHANGED
@@ -111,7 +111,7 @@ th {
111
  content: '';
112
  position: absolute;
113
  right: 0;
114
- top: 50%;
115
  width: 0;
116
  height: 0;
117
  border: 12px solid transparent;
@@ -133,7 +133,7 @@ th {
133
  content: '';
134
  position: absolute;
135
  top: 0;
136
- left: 88%;
137
  width: 0;
138
  height: 0;
139
  border: 12px solid transparent;
@@ -142,3 +142,11 @@ th {
142
  margin-left: -12px;
143
  margin-top: -12px;
144
  }
 
 
 
 
 
 
 
 
111
  content: '';
112
  position: absolute;
113
  right: 0;
114
+ top: 27%;
115
  width: 0;
116
  height: 0;
117
  border: 12px solid transparent;
133
  content: '';
134
  position: absolute;
135
  top: 0;
136
+ left: 89%;
137
  width: 0;
138
  height: 0;
139
  border: 12px solid transparent;
142
  margin-left: -12px;
143
  margin-top: -12px;
144
  }
145
+
146
+ .ui-tabs .ui-tabs-nav li.ui-tabs-active a {
147
+ background-color: #4385bf;
148
+ }
149
+
150
+ .ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {
151
+ color: white;
152
+ }
admin/html/js/menu.js CHANGED
@@ -3,12 +3,7 @@ jQuery(document).ready(function () {
3
  jQuery('.wrap').css('opacity', 1);
4
  });
5
 
6
- function homeUrl() {
7
- var href = window.location.href;
8
- var index = href.indexOf('/wp-admin');
9
- var homeUrl = href.substring(0, index);
10
- return homeUrl;
11
- }
12
 
13
  function invert(id) {
14
  if (jQuery("#fifu_toggle_" + id).attr("class") == "toggleon") {
@@ -74,8 +69,11 @@ function fifu_default_js() {
74
  }
75
  jQuery.ajax({
76
  method: "POST",
77
- url: fifu_get_rest_url() + 'featured-image-from-url/v2/' + option + '/',
78
  async: true,
 
 
 
79
  success: function (data) {
80
  },
81
  error: function (jqXHR, textStatus, errorThrown) {
@@ -108,8 +106,11 @@ function fifu_fake_js() {
108
  }
109
  jQuery.ajax({
110
  method: "POST",
111
- url: fifu_get_rest_url() + 'featured-image-from-url/v2/' + option + '/',
112
  async: true,
 
 
 
113
  success: function (data) {
114
  },
115
  error: function (jqXHR, textStatus, errorThrown) {
@@ -134,8 +135,11 @@ function fifu_clean_js() {
134
 
135
  jQuery.ajax({
136
  method: "POST",
137
- url: fifu_get_rest_url() + 'featured-image-from-url/v2/data_clean_api/',
138
  async: true,
 
 
 
139
  success: function (data) {
140
  },
141
  error: function (jqXHR, textStatus, errorThrown) {
@@ -165,8 +169,11 @@ function fifu_save_dimensions_all_js() {
165
 
166
  jQuery.ajax({
167
  method: "POST",
168
- url: fifu_get_rest_url() + 'featured-image-from-url/v2/save_dimensions_all_api/',
169
  async: true,
 
 
 
170
  success: function (data) {
171
  },
172
  error: function (jqXHR, textStatus, errorThrown) {
@@ -193,8 +200,11 @@ function fifu_clean_dimensions_all_js() {
193
 
194
  jQuery.ajax({
195
  method: "POST",
196
- url: fifu_get_rest_url() + 'featured-image-from-url/v2/clean_dimensions_all_api/',
197
  async: true,
 
 
 
198
  success: function (data) {
199
  },
200
  error: function (jqXHR, textStatus, errorThrown) {
@@ -217,7 +227,7 @@ function fifu_get_rest_url() {
217
  error = false;
218
  jQuery.ajax({
219
  method: "POST",
220
- url: homeUrl() + '?rest_route=/featured-image-from-url/v2/rest_url_api/',
221
  async: false,
222
  success: function (data) {
223
  out = data;
@@ -229,7 +239,7 @@ function fifu_get_rest_url() {
229
  if (error) {
230
  jQuery.ajax({
231
  method: "POST",
232
- url: homeUrl() + '/wp-json/featured-image-from-url/v2/rest_url_api/',
233
  async: false,
234
  success: function (data) {
235
  out = data;
3
  jQuery('.wrap').css('opacity', 1);
4
  });
5
 
6
+ var restUrl = fifu_get_rest_url();
 
 
 
 
 
7
 
8
  function invert(id) {
9
  if (jQuery("#fifu_toggle_" + id).attr("class") == "toggleon") {
69
  }
70
  jQuery.ajax({
71
  method: "POST",
72
+ url: restUrl + 'featured-image-from-url/v2/' + option + '/',
73
  async: true,
74
+ beforeSend: function (xhr) {
75
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
76
+ },
77
  success: function (data) {
78
  },
79
  error: function (jqXHR, textStatus, errorThrown) {
106
  }
107
  jQuery.ajax({
108
  method: "POST",
109
+ url: restUrl + 'featured-image-from-url/v2/' + option + '/',
110
  async: true,
111
+ beforeSend: function (xhr) {
112
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
113
+ },
114
  success: function (data) {
115
  },
116
  error: function (jqXHR, textStatus, errorThrown) {
135
 
136
  jQuery.ajax({
137
  method: "POST",
138
+ url: restUrl + 'featured-image-from-url/v2/data_clean_api/',
139
  async: true,
140
+ beforeSend: function (xhr) {
141
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
142
+ },
143
  success: function (data) {
144
  },
145
  error: function (jqXHR, textStatus, errorThrown) {
169
 
170
  jQuery.ajax({
171
  method: "POST",
172
+ url: restUrl + 'featured-image-from-url/v2/save_dimensions_all_api/',
173
  async: true,
174
+ beforeSend: function (xhr) {
175
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
176
+ },
177
  success: function (data) {
178
  },
179
  error: function (jqXHR, textStatus, errorThrown) {
200
 
201
  jQuery.ajax({
202
  method: "POST",
203
+ url: restUrl + 'featured-image-from-url/v2/clean_dimensions_all_api/',
204
  async: true,
205
+ beforeSend: function (xhr) {
206
+ xhr.setRequestHeader('X-WP-Nonce', fifuScriptVars.nonce);
207
+ },
208
  success: function (data) {
209
  },
210
  error: function (jqXHR, textStatus, errorThrown) {
227
  error = false;
228
  jQuery.ajax({
229
  method: "POST",
230
+ url: fifuScriptVars.homeUrl + '/wp-json/featured-image-from-url/v2/rest_url_api/',
231
  async: false,
232
  success: function (data) {
233
  out = data;
239
  if (error) {
240
  jQuery.ajax({
241
  method: "POST",
242
+ url: fifuScriptVars.homeUrl + '?rest_route=/featured-image-from-url/v2/rest_url_api/',
243
  async: false,
244
  success: function (data) {
245
  out = data;
admin/html/menu.html CHANGED
@@ -1,7 +1,7 @@
1
  <div class="wrap" style="opacity:0">
2
 
3
  <div class="header-box" style="background-color:#23282d">
4
- <h1 style="color:white"><img src="<?php echo plugins_url()?>/featured-image-from-url/admin/images/favicon.png" alt=""> featured image from url 2</h1>
5
  </div>
6
 
7
  <div id="tabs-top">
@@ -1205,7 +1205,7 @@
1205
  </div>
1206
  <div id="tabs-j">
1207
  <div class="box">
1208
- <h2>Fake Internal Featured Image (<b style="color:red">keep me enabled</b>)</h2>
1209
  <div class="greybox">
1210
  Most themes/plugins are not able to show the external featured image if there is no internal featured image associated to your post/page/product. Enabling the toggle below, a symbolic <b>empty</b> file will be added to your Media Library to overcome this limitation.
1211
  </div>
@@ -1763,7 +1763,8 @@
1763
  <div class="box">
1764
  <h2>Lazy Load</h2>
1765
  <div class="greybox">
1766
- Enabling this feature the images/videos won't be loaded until user scrolls to them. So it will make your home/shop load faster.
 
1767
  </div>
1768
  <br>
1769
  <form
@@ -2115,42 +2116,42 @@
2115
  <div id="tabs-3">
2116
 
2117
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product.txt"
2118
- width="800px" height="250px" ></iframe>
2119
 
2120
  </div>
2121
 
2122
  <div id="tabs-4">
2123
 
2124
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product-variation.txt"
2125
- width="800px" height="450px" ></iframe>
2126
 
2127
  </div>
2128
 
2129
  <div id="tabs-5">
2130
 
2131
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/post.txt"
2132
- width="800px" height="150px" ></iframe>
2133
 
2134
  </div>
2135
 
2136
  <div id="tabs-6">
2137
 
2138
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product-category.txt"
2139
- width="800px" height="225px" ></iframe>
2140
 
2141
  </div>
2142
 
2143
  <div id="tabs-7">
2144
 
2145
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product-variable.txt"
2146
- width="800px" height="550px" ></iframe>
2147
 
2148
  </div>
2149
 
2150
  <div id="tabs-8">
2151
 
2152
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/batch.txt"
2153
- width="800px" height="425px" ></iframe>
2154
 
2155
  </div>
2156
 
@@ -2613,9 +2614,25 @@
2613
  If you need any help, you can refer to <a href="https://wordpress.org/plugins/featured-image-from-url/screenshots/" target="_blank">screenshots</a> or send an email to <b>marcel@featuredimagefromurl.com</b> (send me this <a href="admin.php?page=fifu-support-data"><button id="opener" onclick="jQuery('.wrap').block({message: 'Please wait some seconds...', css: {backgroundColor: 'none', border: 'none', color: 'white'}});">data</button></a>, please).
2614
  </div>
2615
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2616
  <div class="box">
2617
  <h2>Getting Started (external Featured Images)</h2>
2618
- <div class="greybox" style="min-height:480px">
2619
  <div style="width:100%">
2620
  <hgroup style="float:left;opacity:0.75;" class="speech-bubble">
2621
  <div style="font-style:italic;font-size:14px;color:white;padding-left:25px;padding-top:10px;">Hi, I'm an EXTERNAL image!</div>
@@ -2631,7 +2648,7 @@
2631
  <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">3) <b>paste</b> it here: <input type="text" style="width:80%;background-color:#f3f3f3;font-style:italic;" placeholder="or just drag and drop me here"></div>
2632
  <br>
2633
  </hgroup>
2634
- <img style="float:right;padding-left:1%;width:22%;position:relative;top:25px;filter:grayscale(25%);" src="https://ps.w.org/featured-image-from-url/assets/icon-256x256.png" title="Right click me!">
2635
  </div>
2636
  <hgroup style="float:right;opacity:0.75" class="speech-bubble2">
2637
  <div style="font-style:italic;font-size:14px;color:white;padding-left:25px;padding-top:10px;">Since now you have my address (also known as URL), how about making me famous?</div>
@@ -2640,7 +2657,7 @@
2640
  <br>
2641
  <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">1) <b>add a new post</b>;</div>
2642
  <br>
2643
- <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">2) find the "<b>Featured Image from URL</b>" box;</div>
2644
  <br>
2645
  <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">3) <b>paste</b> my address into "<b>Image URL</b>" field.</div>
2646
  <br>
@@ -2657,6 +2674,23 @@
2657
  From September 2019, always you guys report an issue between FIFU and another plugin or theme, the solution will be posted here.
2658
  </div>
2659
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2660
  <div class="box">
2661
  <table>
2662
  <tr>
@@ -2703,19 +2737,6 @@
2703
  1) enable "FIFU settings > Admin Area > jQuery".<br>
2704
  </div>
2705
  </div>
2706
- <div class="box">
2707
- <table>
2708
- <tr>
2709
- <td style="border-bottom:none">2019-11-21</td>
2710
- <td style="border-bottom:none"><h3>Jetpack</h3></td>
2711
- <td style="border-bottom:none">plugin</td>
2712
- </tr>
2713
- </table>
2714
- <div class="greybox" style="position: relative; top: -10px">
2715
- Showing external images on "Related Posts":<br>
2716
- 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>
2717
- </div>
2718
- </div>
2719
  <div class="box">
2720
  <table>
2721
  <tr>
1
  <div class="wrap" style="opacity:0">
2
 
3
  <div class="header-box" style="background-color:#23282d">
4
+ <h1 style="color:white"><span class="dashicons dashicons-camera" style="font-size:30px;padding-right:10px"></span> featured image from url 2</h1>
5
  </div>
6
 
7
  <div id="tabs-top">
1205
  </div>
1206
  <div id="tabs-j">
1207
  <div class="box">
1208
+ <h2>Fake Internal Featured Image (<b style="color:#4385bf">keep me enabled</b>)</h2>
1209
  <div class="greybox">
1210
  Most themes/plugins are not able to show the external featured image if there is no internal featured image associated to your post/page/product. Enabling the toggle below, a symbolic <b>empty</b> file will be added to your Media Library to overcome this limitation.
1211
  </div>
1763
  <div class="box">
1764
  <h2>Lazy Load</h2>
1765
  <div class="greybox">
1766
+ Enabling this feature the images/videos won't be loaded until user scrolls to them. So it will make your home/shop load faster.<br><br>
1767
+ <b>Important</b>: some themes and plugins (Jetpack for instance) have their own lazy load implementations, causing conflicts. Your images may not load if you have more than one lazy load running at the same time.
1768
  </div>
1769
  <br>
1770
  <form
2116
  <div id="tabs-3">
2117
 
2118
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product.txt"
2119
+ width="100%" height="250px" ></iframe>
2120
 
2121
  </div>
2122
 
2123
  <div id="tabs-4">
2124
 
2125
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product-variation.txt"
2126
+ width="100%" height="450px" ></iframe>
2127
 
2128
  </div>
2129
 
2130
  <div id="tabs-5">
2131
 
2132
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/post.txt"
2133
+ width="100%" height="150px" ></iframe>
2134
 
2135
  </div>
2136
 
2137
  <div id="tabs-6">
2138
 
2139
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product-category.txt"
2140
+ width="100%" height="225px" ></iframe>
2141
 
2142
  </div>
2143
 
2144
  <div id="tabs-7">
2145
 
2146
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/product-variable.txt"
2147
+ width="100%" height="565px" ></iframe>
2148
 
2149
  </div>
2150
 
2151
  <div id="tabs-8">
2152
 
2153
  <iframe src="<?php echo plugins_url()?>/featured-image-from-url/admin/html/txt/batch.txt"
2154
+ width="100%" height="535px" ></iframe>
2155
 
2156
  </div>
2157
 
2614
  If you need any help, you can refer to <a href="https://wordpress.org/plugins/featured-image-from-url/screenshots/" target="_blank">screenshots</a> or send an email to <b>marcel@featuredimagefromurl.com</b> (send me this <a href="admin.php?page=fifu-support-data"><button id="opener" onclick="jQuery('.wrap').block({message: 'Please wait some seconds...', css: {backgroundColor: 'none', border: 'none', color: 'white'}});">data</button></a>, please).
2615
  </div>
2616
  </div>
2617
+ <!--div class="box">
2618
+ <div style="float:right;position:relative">
2619
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
2620
+ <input type="hidden" name="cmd" value="_s-xclick" />
2621
+ <input type="hidden" name="hosted_button_id" value="D84YEX4JR7J86" />
2622
+ <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
2623
+ <img alt="" border="0" src="" width="1" height="1" />
2624
+ </form>
2625
+ </div>
2626
+ <h2>Donate $ 1 / year to take this project to the next level</h2>
2627
+ <div class="greybox">
2628
+ <a href="https://www.linkedin.com/in/marceljm/" target="_blank"><img src="https://avatars0.githubusercontent.com/u/10578419?s=460&v=4" style="border-radius:100%;width:8.5%;float:left"></a></h2>
2629
+ <div style="position:relative;left:10px">Hi, I'm Marcel, Software Engineer and Featured Image from URL author, a project 100% developed in my free time. During the last 4 years I did my best to develop all requested features, integrations, improvements and bug fixes. And <b>thanks to FIFU you keep saving money on storage, processing and copyright</b>. However, with so many users (100,000+ active installs in 2020), it's becoming increasingly difficult to help everyone. Important performance and automation features aren't done yet while frequent updates are required to keep this plugin working with the most current WordPress components. So please become a sponsor and help me to take FIFU to the next level!</div>
2630
+ </div>
2631
+ <div style='display:none'><br>2020 goal: $ 0,00; reached value until January 1st: $ 0.00; donations: 0; average value: $ 0.00; average value per plugin user: $ 0.00.</div>
2632
+ </div-->
2633
  <div class="box">
2634
  <h2>Getting Started (external Featured Images)</h2>
2635
+ <div class="greybox" style="min-height:475px">
2636
  <div style="width:100%">
2637
  <hgroup style="float:left;opacity:0.75;" class="speech-bubble">
2638
  <div style="font-style:italic;font-size:14px;color:white;padding-left:25px;padding-top:10px;">Hi, I'm an EXTERNAL image!</div>
2648
  <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">3) <b>paste</b> it here: <input type="text" style="width:80%;background-color:#f3f3f3;font-style:italic;" placeholder="or just drag and drop me here"></div>
2649
  <br>
2650
  </hgroup>
2651
+ <img style="float:right;padding-left:1%;width:22%;position:relative;top:19px;filter:grayscale(25%);" src="https://ps.w.org/featured-image-from-url/assets/icon-256x256.png" title="Right click me!">
2652
  </div>
2653
  <hgroup style="float:right;opacity:0.75" class="speech-bubble2">
2654
  <div style="font-style:italic;font-size:14px;color:white;padding-left:25px;padding-top:10px;">Since now you have my address (also known as URL), how about making me famous?</div>
2657
  <br>
2658
  <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">1) <b>add a new post</b>;</div>
2659
  <br>
2660
+ <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">2) find the <span class="dashicons dashicons-camera" style="font-size:18px;padding-right:3px"></span><b>Featured Image from URL</b> box;</div>
2661
  <br>
2662
  <div style="font-style:italic;font-size:14px;color:white;padding-left:40px">3) <b>paste</b> my address into "<b>Image URL</b>" field.</div>
2663
  <br>
2674
  From September 2019, always you guys report an issue between FIFU and another plugin or theme, the solution will be posted here.
2675
  </div>
2676
  </div>
2677
+ <div class="box">
2678
+ <table>
2679
+ <tr>
2680
+ <td style="border-bottom:none">2019-11-22</td>
2681
+ <td style="border-bottom:none"><h3>Jetpack</h3></td>
2682
+ <td style="border-bottom:none">plugin</td>
2683
+ </tr>
2684
+ </table>
2685
+ <div class="greybox" style="position: relative; top: -10px">
2686
+ Featured Images missing after enabling Lazy Load:<br>
2687
+ 1) disable "FIFU settings > Performance > Lazy Load" or "Jetpack settings > Performance > Enable Lazy Loading for images". You can't have both.<br>
2688
+ </div>
2689
+ <div class="greybox" style="position: relative; top: -10px">
2690
+ Showing external images on "Related Posts":<br>
2691
+ 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>
2692
+ </div>
2693
+ </div>
2694
  <div class="box">
2695
  <table>
2696
  <tr>
2737
  1) enable "FIFU settings > Admin Area > jQuery".<br>
2738
  </div>
2739
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
2740
  <div class="box">
2741
  <table>
2742
  <tr>
admin/html/meta-box.html CHANGED
@@ -55,15 +55,11 @@
55
  onClick="previewImage();"
56
  style="<?php echo $align, $margin, $show_button ?>" >Preview</a>
57
 
58
- <div id="fifu_news" style="position: relative; top:10px; <?php echo $show_button ?>">
59
- <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid #ee4394; border-top: 2px solid #ee4394; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
60
  background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">Please report any problem to <b>marcel@featuredimagefromurl.com</b></p>
61
- <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);
62
- 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="admin.php?page=featured-image-from-url#tabs-a"><b>premium</b></a> version</p>
63
- <p style="font-size: 12px; padding: 10px; border-bottom: 2px solid #34ba1c; border-top: 2px solid #34ba1c; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
64
- background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">New: FIFU <a href='admin.php?page=featured-image-from-url#tabs-p'>add-on</a> for <b>WP All Import</b>.</p>
65
- <!--p style="font-size: 12px; padding: 10px; border-bottom: 2px solid #538dd3; border-top: 2px solid #538dd3; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
66
- background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">New: tips about the integration between FIFU and other plugins will be posted <a href='admin.php?page=featured-image-from-url#tabs-t'>here</a></p-->
67
- <!--p style="font-size: 12px; padding: 10px; border-bottom: 2px solid #7e600e ; border-top: 2px solid #7e600e ; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
68
- background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">New: "Premium > Donate" replaced by regular PayPal payment button</p-->
69
  </div>
55
  onClick="previewImage();"
56
  style="<?php echo $align, $margin, $show_button ?>" >Preview</a>
57
 
58
+ <div id="fifu_news" style="position: relative; top:10px; <?php echo $show_news ?>">
59
+ <p style="font-size: 12px; padding: 10px; border-bottom: 1px solid #ee4394; border-top: 1px solid #ee4394; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
60
  background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;">Please report any problem to <b>marcel@featuredimagefromurl.com</b></p>
61
+ <!--p style="font-size: 12px; padding: 10px; border-bottom: 1px solid #34ba1c; border-top: 1px solid #34ba1c; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
62
+ background-color: whitesmoke; border-radius: 15px 5px 15px 5px; position: relative; top: 5px;"><a href='admin.php?page=featured-image-from-url#tabs-d'>Buy me a coffee</a>. Donations in 2020: 0; Active installs: 70,000+</p-->
63
+ <p style="font-size: 12px; padding: 10px; border-bottom: 1px solid orange; border-top: 1px solid orange; color: black; background: repeating-linear-gradient(-55deg,white,white 2px,whitesmoke 2px,white 5px);
64
+ 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="admin.php?page=featured-image-from-url#tabs-a">premium</a> version</p>
 
 
 
 
65
  </div>
admin/html/support-data.html CHANGED
@@ -1,7 +1,7 @@
1
  <div class="wrap">
2
 
3
  <div class="header-box" style="background-color:#23282d">
4
- <h1 style="color:white"><img src="<?php echo plugins_url()?>/featured-image-from-url/admin/images/favicon.png" alt=""> featured image from url 2</h1>
5
  </div>
6
 
7
  <div id="tabs-top">
1
  <div class="wrap">
2
 
3
  <div class="header-box" style="background-color:#23282d">
4
+ <h1 style="color:white"><span class="dashicons dashicons-camera" style="font-size:30px;padding-right:10px"></span> featured image from url 2</h1>
5
  </div>
6
 
7
  <div id="tabs-top">
admin/images/favicon.png DELETED
Binary file
admin/menu.php CHANGED
@@ -13,7 +13,7 @@ function fifu_insert_menu() {
13
  wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
14
  }
15
 
16
- add_menu_page('Featured Image from URL', 'Featured Image from URL', 'manage_options', 'featured-image-from-url', 'fifu_get_menu_html', plugins_url() . '/featured-image-from-url/admin/images/favicon.png', 57);
17
  add_submenu_page('featured-image-from-url', 'FIFU Settings', 'Settings', 'manage_options', 'featured-image-from-url');
18
  add_submenu_page('featured-image-from-url', 'FIFU Support Data', 'Support Data', 'manage_options', 'fifu-support-data', 'fifu_support_data');
19
 
@@ -81,6 +81,13 @@ function fifu_get_menu_html() {
81
  wp_enqueue_style('fifu-menu-css', plugins_url('/html/css/menu.css', __FILE__));
82
  wp_enqueue_script('fifu-menu-js', plugins_url('/html/js/menu.js', __FILE__));
83
 
 
 
 
 
 
 
 
84
  $enable_social = get_option('fifu_social');
85
  $enable_original = get_option('fifu_original');
86
  $enable_lazy = get_option('fifu_lazy');
13
  wp_enqueue_script('jquery-block-ui', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.blockUI/2.70/jquery.blockUI.min.js');
14
  }
15
 
16
+ add_menu_page('Featured Image from URL', 'Featured Image from URL', 'manage_options', 'featured-image-from-url', 'fifu_get_menu_html', 'dashicons-camera', 57);
17
  add_submenu_page('featured-image-from-url', 'FIFU Settings', 'Settings', 'manage_options', 'featured-image-from-url');
18
  add_submenu_page('featured-image-from-url', 'FIFU Support Data', 'Support Data', 'manage_options', 'fifu-support-data', 'fifu_support_data');
19
 
81
  wp_enqueue_style('fifu-menu-css', plugins_url('/html/css/menu.css', __FILE__));
82
  wp_enqueue_script('fifu-menu-js', plugins_url('/html/js/menu.js', __FILE__));
83
 
84
+ // register custom variables for the AJAX script
85
+ wp_localize_script('fifu-menu-js', 'fifuScriptVars', [
86
+ 'restUrl' => esc_url_raw(rest_url()),
87
+ 'homeUrl' => esc_url_raw(home_url()),
88
+ 'nonce' => wp_create_nonce('wp_rest'),
89
+ ]);
90
+
91
  $enable_social = get_option('fifu_social');
92
  $enable_original = get_option('fifu_original');
93
  $enable_lazy = get_option('fifu_lazy');
admin/meta-box.php CHANGED
@@ -7,9 +7,9 @@ function fifu_insert_meta_box() {
7
 
8
  foreach ($post_types as $post_type) {
9
  if ($post_type == 'product') {
10
- add_meta_box('urlMetaBox', 'Product Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
11
  } else if ($post_type)
12
- add_meta_box('imageUrlMetaBox', 'Featured Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
13
  }
14
  }
15
 
7
 
8
  foreach ($post_types as $post_type) {
9
  if ($post_type == 'product') {
10
+ add_meta_box('urlMetaBox', '<span class="dashicons dashicons-camera" style="font-size:20px;padding-right:10px"></span> Product Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
11
  } else if ($post_type)
12
+ add_meta_box('imageUrlMetaBox', '<span class="dashicons dashicons-camera" style="font-size:18px;padding-right:10px"></span> Featured Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
13
  }
14
  }
15
 
admin/wai-addon.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  include 'rapid-addon.php';
4
 
5
- $fifu_wai_addon = new RapidAddon('<div style="color:#777"><img src="' . plugins_url() . '/featured-image-from-url/admin/images/favicon.png" style="filter: invert(50%);height:18px;padding-right:4px;position:relative;top:2px"> Featured Image from URL</div>', 'fifu_wai_addon');
6
  $fifu_wai_addon->add_field('fifu_image_url', '<div title="fifu_image_url">Featured Image URL</div>', 'text', null, null, false, null);
7
  $fifu_wai_addon->add_field('fifu_image_alt', '<div title="fifu_image_alt">Featured Image Alt/Title</div>', 'text', null, null, false, null);
8
  $fifu_wai_addon->set_import_function('fifu_wai_addon_save');
@@ -38,3 +38,4 @@ function fifu_wai_addon_save($post_id, $data, $import_options, $article) {
38
  /* metadata */
39
  add_action('pmxi_saved_post', 'fifu_update_fake_attach_id');
40
  }
 
2
 
3
  include 'rapid-addon.php';
4
 
5
+ $fifu_wai_addon = new RapidAddon('<div style="color:#777"><span class="dashicons dashicons-camera" style="font-size:30px;padding-right:10px"></span> Featured Image from URL</div>', 'fifu_wai_addon');
6
  $fifu_wai_addon->add_field('fifu_image_url', '<div title="fifu_image_url">Featured Image URL</div>', 'text', null, null, false, null);
7
  $fifu_wai_addon->add_field('fifu_image_alt', '<div title="fifu_image_alt">Featured Image Alt/Title</div>', 'text', null, null, false, null);
8
  $fifu_wai_addon->set_import_function('fifu_wai_addon_save');
38
  /* metadata */
39
  add_action('pmxi_saved_post', 'fifu_update_fake_attach_id');
40
  }
41
+
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.7.7
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.7.8
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/attachment.php CHANGED
@@ -6,7 +6,7 @@ function fifu_replace_attached_file($att_url, $att_id) {
6
  if ($att_url) {
7
  $url = explode(";", $att_url);
8
  if (sizeof($url) > 1)
9
- return strpos($url[1], fifu_get_internal_image_path()) !== false ? get_post($att_id)->guid : $url[1];
10
  }
11
  return $att_url;
12
  }
@@ -17,7 +17,7 @@ function fifu_replace_attachment_url($att_url, $att_id) {
17
  if ($att_url) {
18
  $url = explode(";", $att_url);
19
  if (sizeof($url) > 1)
20
- return strpos($url[1], fifu_get_internal_image_path()) !== false ? get_post($att_id)->guid : $url[1];
21
  else {
22
  if (get_post($att_id)) {
23
  $url = get_post($att_id)->guid;
@@ -63,7 +63,7 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
63
  $image_size = fifu_get_image_size($size);
64
  if (fifu_is_on('fifu_original')) {
65
  return array(
66
- strpos($image[0], fifu_get_internal_image_path()) !== false ? get_post($att_id)->guid : $image[0],
67
  null,
68
  null,
69
  null,
@@ -72,7 +72,7 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
72
  $dimension = $post ? get_post_meta($post, 'fifu_image_dimension') : null;
73
  $arrFIFU = fifu_get_width_height($dimension);
74
  return array(
75
- strpos($image[0], fifu_get_internal_image_path()) !== false ? get_post($att_id)->guid : $image[0],
76
  !$dimension && isset($image_size['width']) && $image_size['width'] < $arrFIFU['width'] ? $image_size['width'] : $arrFIFU['width'],
77
  !$dimension && isset($image_size['height']) && $image_size['height'] < $arrFIFU['height'] ? $image_size['height'] : $arrFIFU['height'],
78
  isset($image_size['crop']) ? $image_size['crop'] : '',
@@ -87,6 +87,18 @@ function fifu_get_internal_image_path() {
87
  return explode("//", get_home_url())[1] . "/wp-content/uploads/";
88
  }
89
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  add_filter('wp_get_attachment_metadata', 'fifu_filter_wp_get_attachment_metadata', 10, 2);
91
 
92
  function fifu_filter_wp_get_attachment_metadata($data, $post_id) {
6
  if ($att_url) {
7
  $url = explode(";", $att_url);
8
  if (sizeof($url) > 1)
9
+ return fifu_has_internal_image_path($url[1]) ? get_post($att_id)->guid : $url[1];
10
  }
11
  return $att_url;
12
  }
17
  if ($att_url) {
18
  $url = explode(";", $att_url);
19
  if (sizeof($url) > 1)
20
+ return fifu_has_internal_image_path($url[1]) ? get_post($att_id)->guid : $url[1];
21
  else {
22
  if (get_post($att_id)) {
23
  $url = get_post($att_id)->guid;
63
  $image_size = fifu_get_image_size($size);
64
  if (fifu_is_on('fifu_original')) {
65
  return array(
66
+ fifu_has_internal_image_path($image[0]) ? get_post($att_id)->guid : $image[0],
67
  null,
68
  null,
69
  null,
72
  $dimension = $post ? get_post_meta($post, 'fifu_image_dimension') : null;
73
  $arrFIFU = fifu_get_width_height($dimension);
74
  return array(
75
+ fifu_has_internal_image_path($image[0]) ? get_post($att_id)->guid : $image[0],
76
  !$dimension && isset($image_size['width']) && $image_size['width'] < $arrFIFU['width'] ? $image_size['width'] : $arrFIFU['width'],
77
  !$dimension && isset($image_size['height']) && $image_size['height'] < $arrFIFU['height'] ? $image_size['height'] : $arrFIFU['height'],
78
  isset($image_size['crop']) ? $image_size['crop'] : '',
87
  return explode("//", get_home_url())[1] . "/wp-content/uploads/";
88
  }
89
 
90
+ function fifu_get_internal_image_path2() {
91
+ return get_bloginfo() . ".files.wordpress.com";
92
+ }
93
+
94
+ function fifu_get_internal_image_path3() {
95
+ return explode('.', explode("//", get_home_url())[1])[0] . ".files.wordpress.com";
96
+ }
97
+
98
+ function fifu_has_internal_image_path($url) {
99
+ return strpos($url, fifu_get_internal_image_path()) !== false || strpos($url, fifu_get_internal_image_path2()) !== false || strpos($url, fifu_get_internal_image_path3()) !== false;
100
+ }
101
+
102
  add_filter('wp_get_attachment_metadata', 'fifu_filter_wp_get_attachment_metadata', 10, 2);
103
 
104
  function fifu_filter_wp_get_attachment_metadata($data, $post_id) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, seo, variable, tumblr, variation, product variation, shortcode, facebook, instagram, imgur, 9gag, wcfm, add-on
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
- Stable tag: 2.7.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -159,6 +159,9 @@ Features:
159
 
160
  == Changelog ==
161
 
 
 
 
162
  = 2.7.7 =
163
  * Bug fix: Clean Metadata, Fake Internal Featured Image, Default External Featured Image and Save Image Dimensions were not being called from menu settings in some sites due wrong rest routes.
164
 
@@ -660,6 +663,9 @@ was removed. To finish, a Premium version is now been presented.
660
 
661
  == Upgrade Notice ==
662
 
 
 
 
663
  = 2.7.7 =
664
  * Bug fix: Clean Metadata, Fake Internal Featured Image, Default External Featured Image and Save Image Dimensions were not being called from menu settings in some sites due wrong rest routes.
665
 
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, seo, variable, tumblr, variation, product variation, shortcode, facebook, instagram, imgur, 9gag, wcfm, add-on
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
+ Stable tag: 2.7.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
159
 
160
  == Changelog ==
161
 
162
+ = 2.7.8 =
163
+ * Bug fix: menu settings style issues in sites hosted in WordPress.com; Improvement: better compatibility and security for rest routes, used in some menu settings; Bug fix: conflict with internal images that have the path files.wordpress.com.
164
+
165
  = 2.7.7 =
166
  * Bug fix: Clean Metadata, Fake Internal Featured Image, Default External Featured Image and Save Image Dimensions were not being called from menu settings in some sites due wrong rest routes.
167
 
663
 
664
  == Upgrade Notice ==
665
 
666
+ = 2.7.8 =
667
+ * Bug fix: menu settings style issues in sites hosted in WordPress.com; Improvement: better compatibility and security for rest routes, used in some menu settings; Bug fix: conflict with internal images that have the path files.wordpress.com.
668
+
669
  = 2.7.7 =
670
  * Bug fix: Clean Metadata, Fake Internal Featured Image, Default External Featured Image and Save Image Dimensions were not being called from menu settings in some sites due wrong rest routes.
671