Featured Image From URL - Version 2.5.9

Version Description

  • New features: Add Class and Save Image Dimensions > Follow Redirects.
Download this release

Release Info

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

Code changes from version 2.5.8 to 2.5.9

admin/db.php CHANGED
@@ -15,6 +15,7 @@ class FifuDb {
15
  global $wpdb;
16
  $this->wpdb = $wpdb;
17
  $this->posts = $wpdb->prefix . 'posts';
 
18
  $this->postmeta = $wpdb->prefix . 'postmeta';
19
  $this->termmeta = $wpdb->prefix . 'termmeta';
20
  $this->term_taxonomy = $wpdb->prefix . 'term_taxonomy';
@@ -227,6 +228,30 @@ class FifuDb {
227
  );
228
  }
229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
  // get attachments without post
231
  function get_attachments_without_post($post_id) {
232
  $result = $this->wpdb->get_results("
@@ -882,6 +907,22 @@ function fifu_db_missing_dimensions() {
882
  return $aux ? $aux->amount : -1;
883
  }
884
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
885
  /* clean metadata */
886
 
887
  function fifu_db_enable_clean() {
15
  global $wpdb;
16
  $this->wpdb = $wpdb;
17
  $this->posts = $wpdb->prefix . 'posts';
18
+ $this->options = $wpdb->prefix . 'options';
19
  $this->postmeta = $wpdb->prefix . 'postmeta';
20
  $this->termmeta = $wpdb->prefix . 'termmeta';
21
  $this->term_taxonomy = $wpdb->prefix . 'term_taxonomy';
228
  );
229
  }
230
 
231
+ // count posts urls with metadata
232
+ function get_count_urls_with_metadata() {
233
+ return $this->wpdb->get_results("
234
+ SELECT COUNT(1) AS amount
235
+ FROM " . $this->postmeta . " pm
236
+ INNER JOIN " . $this->postmeta . " pm2 ON pm.post_id = pm2.post_id AND pm.meta_id <> pm2.meta_id AND pm2.meta_key = '_thumbnail_id'
237
+ INNER JOIN " . $this->posts . " p ON p.id = pm2.meta_value AND p.post_author = " . $this->author . "
238
+ WHERE pm.meta_key = 'fifu_image_url'
239
+ AND (
240
+ NOT EXISTS (SELECT 1 FROM " . $this->options . " WHERE option_name = 'fifu_fake_attach_id')
241
+ OR pm2.meta_value <> (SELECT option_value FROM " . $this->options . " WHERE option_name = 'fifu_fake_attach_id')
242
+ )"
243
+ );
244
+ }
245
+
246
+ // count posts urls
247
+ function get_count_urls() {
248
+ return $this->wpdb->get_results("
249
+ SELECT COUNT(DISTINCT pm.post_id) AS amount
250
+ FROM " . $this->postmeta . " pm
251
+ WHERE pm.meta_key = 'fifu_image_url'"
252
+ );
253
+ }
254
+
255
  // get attachments without post
256
  function get_attachments_without_post($post_id) {
257
  $result = $this->wpdb->get_results("
907
  return $aux ? $aux->amount : -1;
908
  }
909
 
910
+ /* count: metadata */
911
+
912
+ function fifu_db_count_urls_with_metadata() {
913
+ $db = new FifuDb();
914
+ $aux = $db->get_count_urls_with_metadata()[0];
915
+ return $aux ? $aux->amount : 0;
916
+ }
917
+
918
+ /* count: urls */
919
+
920
+ function fifu_db_count_urls() {
921
+ $db = new FifuDb();
922
+ $aux = $db->get_count_urls()[0];
923
+ return $aux ? $aux->amount : 0;
924
+ }
925
+
926
  /* clean metadata */
927
 
928
  function fifu_db_enable_clean() {
admin/html/menu.html CHANGED
@@ -38,14 +38,17 @@
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 August 2019</i>
44
  </div>
45
  </td>
46
  <td style="width:20%">
47
  <center>
48
- <div style="display: inline-block;"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"><input name="cmd" type="hidden" value="_s-xclick"><input name="hosted_button_id" type="hidden" value="8BLDLZ3HDBGQG"><br><input alt="PayPal – The safer, easier way to pay online!" name="submit" src="https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG_global.gif" type="image"><br><img src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" alt="" width="1" height="1" border="0"></form></div>
 
 
 
49
  </center>
50
  </td>
51
  <td style="width:20%">
@@ -752,8 +755,6 @@
752
  value="" style="display:block">
753
  </div>
754
 
755
- <a name="css"></a>
756
-
757
  <div class="box">
758
  <h2>CSS Style</h2>
759
  <div class="greybox">
@@ -777,6 +778,33 @@
777
  </form>
778
  </div>
779
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
780
  <div class="box">
781
  <h2>Maximum Sizes</h2>
782
  <div class="greybox">
@@ -1065,7 +1093,34 @@
1065
  <th>
1066
  clean the image dimensions of all external featured images now
1067
  </th>
1068
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1069
  </table>
1070
 
1071
  </div>
@@ -2731,10 +2786,13 @@ Pages:<?php echo wp_count_posts('page')->publish ?>;
2731
  Posts:<?php echo wp_count_posts('post')->publish ?>;
2732
  Products:<?php echo class_exists('WooCommerce') ? wp_count_posts('product')->publish : null ?>;
2733
  Images without Dimensions:<?php echo fifu_db_missing_dimensions() ?>;
 
 
2734
  php-curl:<?php echo fifu_has_curl() ? 'yes' : 'no' ?>;
2735
  Plugins:<?php echo fifu_get_plugins_list() ?>;
2736
  Active Plugins:<?php echo fifu_get_active_plugins_list() ?>;
2737
  fifu_auto_alt:<?php echo $enable_auto_alt ?>;
 
2738
  fifu_clean_dimensions_all:<?php echo $enable_clean_dimensions_all ?>;
2739
  fifu_column_height:<?php echo $column_height ?>;
2740
  fifu_content:<?php echo $enable_content ?>;
@@ -2774,6 +2832,7 @@ fifu_pop_first:<?php echo $enable_pop_first ?>;
2774
  fifu_priority:<?php echo $enable_priority ?>;
2775
  fifu_save_dimensions:<?php echo $enable_save_dimensions ?>;
2776
  fifu_save_dimensions_all:<?php echo $enable_save_dimensions_all ?>;
 
2777
  fifu_social:<?php echo $enable_social ?>;
2778
  fifu_wc_lbox:<?php echo $enable_wc_lbox ?>;
2779
  fifu_wc_zoom:<?php echo $enable_wc_zoom ?>;
38
  <tr>
39
  <td style="width:60%"
40
  <div>
41
+ Pay <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 August 2019</i>
44
  </div>
45
  </td>
46
  <td style="width:20%">
47
  <center>
48
+ <div style="display: inline-block;"><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
49
+ <input type="hidden" name="cmd" value="_s-xclick">
50
+ <input type="hidden" name="hosted_button_id" value="46Y3TGDMXCJZW">
51
+ <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"></form></div>
52
  </center>
53
  </td>
54
  <td style="width:20%">
755
  value="" style="display:block">
756
  </div>
757
 
 
 
758
  <div class="box">
759
  <h2>CSS Style</h2>
760
  <div class="greybox">
778
  </form>
779
  </div>
780
 
781
+ <div class="box">
782
+ <h2>Add Class</h2>
783
+ <div class="greybox">
784
+ Enable this toggle to add the class "fifu-class" to the external featured image tags.<br>
785
+ </div>
786
+ <br>
787
+ <form
788
+ id="fifu_form_class"
789
+ action="javascript:void(0)"
790
+ method="post">
791
+ <input
792
+ type="image"
793
+ href="javascript:void(0)"
794
+ id="fifu_toggle_class"
795
+ onclick="invert('class')"
796
+ name="fifu_toggle_class"
797
+ class="<?php echo $enable_class; ?>"
798
+ value="" style="display:block">
799
+
800
+ <input
801
+ type="hidden"
802
+ id="fifu_input_class"
803
+ name="fifu_input_class"
804
+ value="" >
805
+ </form>
806
+ </div>
807
+
808
  <div class="box">
809
  <h2>Maximum Sizes</h2>
810
  <div class="greybox">
1093
  <th>
1094
  clean the image dimensions of all external featured images now
1095
  </th>
1096
+ </tr>
1097
+ <tr>
1098
+ <th>
1099
+ <form
1100
+ id="fifu_form_save_dimensions_redirect"
1101
+ action="javascript:void(0)"
1102
+ method="post">
1103
+ <input
1104
+ type="image"
1105
+ href="javascript:void(0)"
1106
+ id="fifu_toggle_save_dimensions_redirect"
1107
+ onclick="invert('save_dimensions_redirect')"
1108
+ name="fifu_toggle_save_dimensions_redirect"
1109
+ class="<?php echo $enable_save_dimensions_redirect; ?>"
1110
+ value=""
1111
+ style="display:block">
1112
+
1113
+ <input
1114
+ type="hidden"
1115
+ id="fifu_input_save_dimensions_redirect"
1116
+ name="fifu_input_save_dimensions_redirect"
1117
+ value="" >
1118
+ </form>
1119
+ </th>
1120
+ <th>
1121
+ follow redirects (it will make the process much slower)
1122
+ </th>
1123
+ </tr>
1124
  </table>
1125
 
1126
  </div>
2786
  Posts:<?php echo wp_count_posts('post')->publish ?>;
2787
  Products:<?php echo class_exists('WooCommerce') ? wp_count_posts('product')->publish : null ?>;
2788
  Images without Dimensions:<?php echo fifu_db_missing_dimensions() ?>;
2789
+ URLs with Metadata:<?php echo fifu_db_count_urls_with_metadata() ?>;
2790
+ URLs:<?php echo fifu_db_count_urls() ?>;
2791
  php-curl:<?php echo fifu_has_curl() ? 'yes' : 'no' ?>;
2792
  Plugins:<?php echo fifu_get_plugins_list() ?>;
2793
  Active Plugins:<?php echo fifu_get_active_plugins_list() ?>;
2794
  fifu_auto_alt:<?php echo $enable_auto_alt ?>;
2795
+ fifu_class:<?php echo $enable_class ?>;
2796
  fifu_clean_dimensions_all:<?php echo $enable_clean_dimensions_all ?>;
2797
  fifu_column_height:<?php echo $column_height ?>;
2798
  fifu_content:<?php echo $enable_content ?>;
2832
  fifu_priority:<?php echo $enable_priority ?>;
2833
  fifu_save_dimensions:<?php echo $enable_save_dimensions ?>;
2834
  fifu_save_dimensions_all:<?php echo $enable_save_dimensions_all ?>;
2835
+ fifu_save_dimensions_redirect:<?php echo $enable_save_dimensions_redirect ?>;
2836
  fifu_social:<?php echo $enable_social ?>;
2837
  fifu_wc_lbox:<?php echo $enable_wc_lbox ?>;
2838
  fifu_wc_zoom:<?php echo $enable_wc_zoom ?>;
admin/html/meta-box.html CHANGED
@@ -61,9 +61,9 @@
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: "Save Image Dimensions" is much faster now</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: FAQ added to "WP All Import"</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: integration with WooCommerce TM Extra Product Options</b></a> plugin</p-->
69
  </div>
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: "Add Class" feature</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: "Save Image Dimensions > Follow Redirects" option</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>
admin/menu.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_original', 'fifu_lazy', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_fake', 'fifu_fake2', 'fifu_css', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_column_height', 'fifu_priority', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_data_generation', 'fifu_data_clean', 'fifu_image_height_shop', 'fifu_image_width_shop', 'fifu_image_height_prod', 'fifu_image_width_prod', 'fifu_image_height_cart', 'fifu_image_width_cart', 'fifu_image_height_ctgr', 'fifu_image_width_ctgr', 'fifu_image_height_arch', 'fifu_image_width_arch', 'fifu_image_height_home', 'fifu_image_width_home', 'fifu_image_height_page', 'fifu_image_width_page', 'fifu_image_height_post', 'fifu_image_width_post', 'fifu_save_dimensions', 'fifu_save_dimensions_all', 'fifu_clean_dimensions_all')));
4
 
5
  add_action('admin_menu', 'fifu_insert_menu');
6
 
@@ -40,6 +40,7 @@ function fifu_get_menu_html() {
40
  $enable_wc_zoom = get_option('fifu_wc_zoom');
41
  $enable_hide_page = get_option('fifu_hide_page');
42
  $enable_hide_post = get_option('fifu_hide_post');
 
43
  $enable_get_first = get_option('fifu_get_first');
44
  $enable_pop_first = get_option('fifu_pop_first');
45
  $enable_ovw_first = get_option('fifu_ovw_first');
@@ -66,6 +67,7 @@ function fifu_get_menu_html() {
66
  $max_image_height_post = get_option('fifu_image_height_post');
67
  $max_image_width_post = get_option('fifu_image_width_post');
68
  $enable_save_dimensions = get_option('fifu_save_dimensions');
 
69
  $enable_save_dimensions_all = 'toggleoff';
70
  $enable_clean_dimensions_all = 'toggleoff';
71
 
@@ -138,6 +140,7 @@ function fifu_update_menu_options() {
138
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
139
  fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
140
  fifu_update_option('fifu_input_hide_post', 'fifu_hide_post');
 
141
  fifu_update_option('fifu_input_get_first', 'fifu_get_first');
142
  fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
143
  fifu_update_option('fifu_input_ovw_first', 'fifu_ovw_first');
@@ -164,6 +167,7 @@ function fifu_update_menu_options() {
164
  fifu_update_option('fifu_input_image_height_post', 'fifu_image_height_post');
165
  fifu_update_option('fifu_input_image_width_post', 'fifu_image_width_post');
166
  fifu_update_option('fifu_input_save_dimensions', 'fifu_save_dimensions');
 
167
  fifu_update_option('fifu_input_save_dimensions_all', 'fifu_save_dimensions_all');
168
  fifu_update_option('fifu_input_clean_dimensions_all', 'fifu_clean_dimensions_all');
169
  }
1
  <?php
2
 
3
+ define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_original', 'fifu_lazy', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_fake', 'fifu_fake2', 'fifu_css', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_class', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_column_height', 'fifu_priority', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_data_generation', 'fifu_data_clean', 'fifu_image_height_shop', 'fifu_image_width_shop', 'fifu_image_height_prod', 'fifu_image_width_prod', 'fifu_image_height_cart', 'fifu_image_width_cart', 'fifu_image_height_ctgr', 'fifu_image_width_ctgr', 'fifu_image_height_arch', 'fifu_image_width_arch', 'fifu_image_height_home', 'fifu_image_width_home', 'fifu_image_height_page', 'fifu_image_width_page', 'fifu_image_height_post', 'fifu_image_width_post', 'fifu_save_dimensions', 'fifu_save_dimensions_redirect', 'fifu_save_dimensions_all', 'fifu_clean_dimensions_all')));
4
 
5
  add_action('admin_menu', 'fifu_insert_menu');
6
 
40
  $enable_wc_zoom = get_option('fifu_wc_zoom');
41
  $enable_hide_page = get_option('fifu_hide_page');
42
  $enable_hide_post = get_option('fifu_hide_post');
43
+ $enable_class = get_option('fifu_class');
44
  $enable_get_first = get_option('fifu_get_first');
45
  $enable_pop_first = get_option('fifu_pop_first');
46
  $enable_ovw_first = get_option('fifu_ovw_first');
67
  $max_image_height_post = get_option('fifu_image_height_post');
68
  $max_image_width_post = get_option('fifu_image_width_post');
69
  $enable_save_dimensions = get_option('fifu_save_dimensions');
70
+ $enable_save_dimensions_redirect = get_option('fifu_save_dimensions_redirect ');
71
  $enable_save_dimensions_all = 'toggleoff';
72
  $enable_clean_dimensions_all = 'toggleoff';
73
 
140
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
141
  fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
142
  fifu_update_option('fifu_input_hide_post', 'fifu_hide_post');
143
+ fifu_update_option('fifu_input_class', 'fifu_class');
144
  fifu_update_option('fifu_input_get_first', 'fifu_get_first');
145
  fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
146
  fifu_update_option('fifu_input_ovw_first', 'fifu_ovw_first');
167
  fifu_update_option('fifu_input_image_height_post', 'fifu_image_height_post');
168
  fifu_update_option('fifu_input_image_width_post', 'fifu_image_width_post');
169
  fifu_update_option('fifu_input_save_dimensions', 'fifu_save_dimensions');
170
+ fifu_update_option('fifu_input_save_dimensions_redirect', 'fifu_save_dimensions_redirect');
171
  fifu_update_option('fifu_input_save_dimensions_all', 'fifu_save_dimensions_all');
172
  fifu_update_option('fifu_input_clean_dimensions_all', 'fifu_clean_dimensions_all');
173
  }
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.5.8
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.9
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/thumbnail.php CHANGED
@@ -45,8 +45,7 @@ function fifu_choose($post) {
45
  if ($image_url || (get_option('fifu_default_url') && fifu_is_on('fifu_enable_default_url'))) {
46
  if (!$featured_image)
47
  update_post_meta($post_id, '_thumbnail_id', -1);
48
- }
49
- else {
50
  if ($featured_image == -1)
51
  delete_post_meta($post_id, '_thumbnail_id');
52
  }
@@ -72,8 +71,16 @@ function fifu_replace($html, $post_id, $post_thumbnail_id, $size) {
72
  $alt = get_post_meta($post_id, 'fifu_image_alt', true);
73
  $css = get_option('fifu_css');
74
 
75
- if ($url)
 
 
 
 
 
 
 
76
  return $css ? str_replace('/>', ' style="' . $css . '"/>', $html) : $html;
 
77
 
78
  return !$url ? $html : fifu_get_html($url, $alt, $width, $height);
79
  }
45
  if ($image_url || (get_option('fifu_default_url') && fifu_is_on('fifu_enable_default_url'))) {
46
  if (!$featured_image)
47
  update_post_meta($post_id, '_thumbnail_id', -1);
48
+ } else {
 
49
  if ($featured_image == -1)
50
  delete_post_meta($post_id, '_thumbnail_id');
51
  }
71
  $alt = get_post_meta($post_id, 'fifu_image_alt', true);
72
  $css = get_option('fifu_css');
73
 
74
+ if ($url) {
75
+ if (fifu_is_on('fifu_class')) {
76
+ if (strpos($html, 'class='))
77
+ $html = preg_replace('/class=[\'\"][^[\'\"]*[\'\"]/', 'class="fifu-class"', $html);
78
+ else
79
+ $html = str_replace('<img', '<img class="fifu-class"', $html);
80
+ }
81
+
82
  return $css ? str_replace('/>', ' style="' . $css . '"/>', $html) : $html;
83
+ }
84
 
85
  return !$url ? $html : fifu_get_html($url, $alt, $width, $height);
86
  }
includes/util.php CHANGED
@@ -60,10 +60,12 @@ function fifu_maximum($dimension) {
60
 
61
  function fifu_curl($url) {
62
  $curl = curl_init($url);
63
- $headers = array("Range: bytes=0-32768");
64
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
 
 
 
65
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
66
- curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
67
  $data = curl_exec($curl);
68
  curl_close($curl);
69
  return $data;
60
 
61
  function fifu_curl($url) {
62
  $curl = curl_init($url);
63
+ if (fifu_is_off('fifu_save_dimensions_redirect')) {
64
+ $headers = array("Range: bytes=0-32768");
65
+ curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
66
+ curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
67
+ }
68
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
 
69
  $data = curl_exec($curl);
70
  curl_close($curl);
71
  return $data;
readme.txt CHANGED
@@ -159,6 +159,9 @@ Features:
159
 
160
  == Changelog ==
161
 
 
 
 
162
  = 2.5.8 =
163
  * Improvement: Save Image Dimensions is faster now.
164
 
@@ -603,6 +606,9 @@ was removed. To finish, a Premium version is now been presented.
603
 
604
  == Upgrade Notice ==
605
 
 
 
 
606
  = 2.5.8 =
607
  * Improvement: Save Image Dimensions is faster now.
608
 
159
 
160
  == Changelog ==
161
 
162
+ = 2.5.9 =
163
+ * New features: Add Class and Save Image Dimensions > Follow Redirects.
164
+
165
  = 2.5.8 =
166
  * Improvement: Save Image Dimensions is faster now.
167
 
606
 
607
  == Upgrade Notice ==
608
 
609
+ = 2.5.9 =
610
+ * New features: Add Class and Save Image Dimensions > Follow Redirects.
611
+
612
  = 2.5.8 =
613
  * Improvement: Save Image Dimensions is faster now.
614