Featured Image From URL - Version 2.0.7

Version Description

  • Improvement: stop button for fake internal featured image process.
Download this release

Release Info

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

Code changes from version 2.0.6 to 2.0.7

admin/html/js/menu.js CHANGED
@@ -55,3 +55,11 @@ jQuery(function () {
55
  jQuery("#dialog").dialog("open");
56
  });
57
  });
 
 
 
 
 
 
 
 
55
  jQuery("#dialog").dialog("open");
56
  });
57
  });
58
+
59
+ jQuery(document).ready(function () {
60
+ jQuery("#select_fake2").val("<?php echo $enable_fake2; ?>");
61
+ jQuery("#select_fake2").change(function () {
62
+ jQuery("#fifu_input_fake2").val(jQuery("#select_fake2").val());
63
+ jQuery("#fifu_form_fake2").submit();
64
+ });
65
+ });
admin/html/menu.html CHANGED
@@ -345,20 +345,19 @@
345
  action="javascript:void(0)"
346
  method="post">
347
  <td>
348
- <input
349
- type="image"
350
- href="javascript:void(0)"
351
- id="fifu_toggle_fake2"
352
- onclick="invert('fake2')"
353
- name="fifu_toggle_fake2"
354
- class="<?php echo $enable_fake2; ?>"
355
- value=""
356
- style="display:block" >
357
  <input
358
  type="hidden"
359
  id="fifu_input_fake2"
360
  name="fifu_input_fake2"
361
- value="" >
 
362
  </td>
363
  <td>
364
  create a different fake image for each URL
345
  action="javascript:void(0)"
346
  method="post">
347
  <td>
348
+
349
+ <select id="select_fake2" style="width:90%">
350
+ <option value="toggleon">ON</option>
351
+ <option value="toggleoff">OFF</option>
352
+ <option value=null>STOP</option>
353
+ </select>
354
+
 
 
355
  <input
356
  type="hidden"
357
  id="fifu_input_fake2"
358
  name="fifu_input_fake2"
359
+ value="<?php echo $enable_fake2; ?>" >
360
+
361
  </td>
362
  <td>
363
  create a different fake image for each URL
admin/menu.php CHANGED
@@ -168,19 +168,23 @@ function fifu_enable_fake2() {
168
 
169
  $table = $wpdb->prefix . 'postmeta';
170
  $query = "
171
- SELECT DISTINCT post_id
172
- FROM " . $table . " a
173
- WHERE a.meta_key IN ('fifu_image_url', 'fifu_video_url', 'fifu_slider_image_url_0', 'fifu_shortcode')
174
- AND a.meta_value IS NOT NULL
175
- AND a.meta_value <> ''
176
- AND NOT EXISTS (
177
- SELECT 1
178
- FROM " . $table . " c
179
- WHERE a.post_id = c.post_id
180
- AND c.meta_key = '_thumbnail_id'
181
  )";
182
  $result = $wpdb->get_results($query);
 
 
183
  foreach ($result as $i) {
 
 
184
  $alt = get_post_meta($i->post_id, 'fifu_image_alt', true);
185
  // create attachment
186
  $filename = ';' . fifu_main_image_url($i->post_id);
@@ -271,7 +275,11 @@ function fifu_disable_fake2() {
271
  // delete attachment created by fifu
272
  $query = "SELECT id FROM " . $table_posts . " WHERE post_type = 'attachment' AND post_content LIKE 'Please don%'";
273
  $result = $wpdb->get_results($query);
 
 
274
  foreach ($result as $i) {
 
 
275
  $where = array('meta_key' => '_thumbnail_id', 'meta_value' => $i->id);
276
  $wpdb->delete($table, $where);
277
 
168
 
169
  $table = $wpdb->prefix . 'postmeta';
170
  $query = "
171
+ SELECT DISTINCT post_id
172
+ FROM " . $table . " a
173
+ WHERE a.meta_key IN ('fifu_image_url', 'fifu_video_url', 'fifu_slider_image_url_0', 'fifu_shortcode')
174
+ AND a.meta_value IS NOT NULL
175
+ AND a.meta_value <> ''
176
+ AND NOT EXISTS (
177
+ SELECT 1
178
+ FROM " . $table . " c
179
+ WHERE a.post_id = c.post_id
180
+ AND c.meta_key = '_thumbnail_id'
181
  )";
182
  $result = $wpdb->get_results($query);
183
+
184
+ $query = "SELECT option_value FROM " . $wpdb->prefix . 'options' . " WHERE option_name = 'fifu_fake2'";
185
  foreach ($result as $i) {
186
+ if ($wpdb->get_results($query)[0]->option_value != 'toggleon')
187
+ return;
188
  $alt = get_post_meta($i->post_id, 'fifu_image_alt', true);
189
  // create attachment
190
  $filename = ';' . fifu_main_image_url($i->post_id);
275
  // delete attachment created by fifu
276
  $query = "SELECT id FROM " . $table_posts . " WHERE post_type = 'attachment' AND post_content LIKE 'Please don%'";
277
  $result = $wpdb->get_results($query);
278
+
279
+ $query = "SELECT option_value FROM " . $wpdb->prefix . 'options' . " WHERE option_name = 'fifu_fake2'";
280
  foreach ($result as $i) {
281
+ if ($wpdb->get_results($query)[0]->option_value != 'toggleoff')
282
+ return;
283
  $where = array('meta_key' => '_thumbnail_id', 'meta_value' => $i->id);
284
  $wpdb->delete($table, $where);
285
 
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.0.6
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.0.7
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
readme.txt CHANGED
@@ -161,6 +161,9 @@ Features:
161
 
162
  == Changelog ==
163
 
 
 
 
164
  = 2.0.6 =
165
  * Bug fix: fake internal featured image.
166
 
@@ -449,6 +452,9 @@ was removed. To finish, a Premium version is now been presented.
449
 
450
  == Upgrade Notice ==
451
 
 
 
 
452
  = 2.0.6 =
453
  * Bug fix: fake internal featured image.
454
 
161
 
162
  == Changelog ==
163
 
164
+ = 2.0.7 =
165
+ * Improvement: stop button for fake internal featured image process.
166
+
167
  = 2.0.6 =
168
  * Bug fix: fake internal featured image.
169
 
452
 
453
  == Upgrade Notice ==
454
 
455
+ = 2.0.7 =
456
+ * Improvement: stop button for fake internal featured image process.
457
+
458
  = 2.0.6 =
459
  * Bug fix: fake internal featured image.
460