Featured Image From URL - Version 1.8.7

Version Description

  • New free feature: CSS Style.
Download this release

Release Info

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

Code changes from version 1.8.6 to 1.8.7

admin/html/js/category.js DELETED
@@ -1,26 +0,0 @@
1
- function removeImage() {
2
- jQuery("#fifu_input_alt").hide();
3
- jQuery("#fifu_image").hide();
4
- jQuery("#fifu_link").hide();
5
-
6
- jQuery("#fifu_input_alt").val("");
7
- jQuery("#fifu_input_url").val("");
8
-
9
- jQuery("#fifu_input_url").show();
10
- jQuery("#fifu_button").show();
11
- }
12
-
13
- function previewImage() {
14
- var $url = jQuery("#fifu_input_url").val();
15
-
16
- if ($url) {
17
- jQuery("#fifu_input_url").hide();
18
- jQuery("#fifu_button").hide();
19
-
20
- jQuery("#fifu_image").css('background-image', "url('" + $url + "')");
21
-
22
- jQuery("#fifu_input_alt").show();
23
- jQuery("#fifu_image").show();
24
- jQuery("#fifu_link").show();
25
- }
26
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/html/js/wc-meta-box.js DELETED
@@ -1,39 +0,0 @@
1
- function wcRemoveImage(i) {
2
- var inputUrl = "#fifu_input_url_" + i;
3
- var button = "#fifu_button_" + i;
4
- var image = "#fifu_image_" + i;
5
- var inputAlt = "#fifu_input_alt_" + i;
6
- var link = "#fifu_link_" + i;
7
-
8
- jQuery(inputAlt).hide();
9
- jQuery(image).hide();
10
- jQuery(link).hide();
11
-
12
- jQuery(inputAlt).val("");
13
- jQuery(inputUrl).val("");
14
-
15
- jQuery(inputUrl).show();
16
- jQuery(button).show();
17
- }
18
-
19
- function wcPreviewImage(i) {
20
- var inputUrl = "#fifu_input_url_" + i;
21
- var button = "#fifu_button_" + i;
22
- var image = "#fifu_image_" + i;
23
- var inputAlt = "#fifu_input_alt_" + i;
24
- var link = "#fifu_link_" + i;
25
-
26
- var $url = jQuery(inputUrl).val();
27
- $url = fifu_convert($url);
28
-
29
- if ($url) {
30
- jQuery(inputUrl).hide();
31
- jQuery(button).hide();
32
-
33
- jQuery(image).css('background-image', "url('" + $url + "')");
34
-
35
- jQuery(inputAlt).show();
36
- jQuery(image).show();
37
- jQuery(link).show();
38
- }
39
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/html/menu.html CHANGED
@@ -136,6 +136,33 @@
136
  </form>
137
  </div>
138
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  <div class="box">
140
  <h2>Default External Featured Image</h2>
141
  <div class="greybox">
@@ -322,8 +349,6 @@
322
  <h2>Priority</h2>
323
  <div class="greybox" id="grad1">
324
  Enable the toggle below to prioritize the internal image rather than the external one, if both exist.
325
- <br><br>
326
- <i>If this new FREE feature is useful to you, please cherish my work. Give FIFU a <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">5-star</a> rating!</i>
327
  </div>
328
  <br>
329
  <table style="text-align:left">
@@ -596,18 +621,6 @@
596
  </div>
597
  </div>
598
 
599
- <div class="box">
600
- <h2>CSS Style</h2>
601
- <div class="greybox" id="grad2">
602
- <b>Premium feature</b><br><br>
603
- Here you can define a CSS style to be applied to all external featured images. Usage example:<br><br>
604
- width: 100%; border-radius: 8px; border: 1px solid #ddd; padding: 5px;
605
- </div>
606
- <br>
607
- <input id="fifu_input_css" type="text" name="fifu_input_css" style="width:675px">
608
- <input type="submit" value="Submit" disabled>
609
- </div>
610
-
611
  <div class="box">
612
  <h2>External Featured Videos</h2>
613
  <div class="greybox" id="grad2">
136
  </form>
137
  </div>
138
 
139
+ <a name="css"></a>
140
+
141
+ <div class="box">
142
+ <h2>CSS Style</h2>
143
+ <div class="greybox" id="grad1">
144
+ Here you can define a CSS style to be applied to all external featured images. Usage example:<br><br>
145
+ width: 100%; border-radius: 8px; border: 1px solid #ddd; padding: 5px;
146
+ <br><br>
147
+ <i>If this new FREE feature is useful to you, please cherish my work. Give FIFU a <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">5-star</a> rating!</i>
148
+ </div>
149
+ <br>
150
+ <form
151
+ id="fifu_form_css"
152
+ action="javascript:void(0)"
153
+ method="post">
154
+
155
+ <input id="fifu_input_css"
156
+ type="text"
157
+ name="fifu_input_css"
158
+ style="width:675px"
159
+ value="<?php echo $css_style; ?>">
160
+
161
+ <input type="submit"
162
+ value="Submit" >
163
+ </form>
164
+ </div>
165
+
166
  <div class="box">
167
  <h2>Default External Featured Image</h2>
168
  <div class="greybox">
349
  <h2>Priority</h2>
350
  <div class="greybox" id="grad1">
351
  Enable the toggle below to prioritize the internal image rather than the external one, if both exist.
 
 
352
  </div>
353
  <br>
354
  <table style="text-align:left">
621
  </div>
622
  </div>
623
 
 
 
 
 
 
 
 
 
 
 
 
 
624
  <div class="box">
625
  <h2>External Featured Videos</h2>
626
  <div class="greybox" id="grad2">
admin/html/meta-box.html CHANGED
@@ -50,8 +50,10 @@
50
  <div style="<?php echo $show_news?>">
51
  <br>
52
  <hr>
53
- <p style="font-size: 12px; padding: 5px; border-left: 6px solid #41f450; color: black;
54
- background-color: #eee; border-radius: 25px 5px;">New: <a href="admin.php?page=featured-image-from-url#priority">prioritize</a> the internal image rather than the external one, if both exist. (11% of <a href="https://goo.gl/forms/TxLdhwXTqsuO5BHg2">votes</a>)</p>
 
 
55
  <center>
56
  <table>
57
  <tbody>
50
  <div style="<?php echo $show_news?>">
51
  <br>
52
  <hr>
53
+ <p style="font-size: 12px; padding: 5px; border-left: 6px solid #c71230; color: black;
54
+ background-color: #eee; border-radius: 25px 5px;">New: the field above is available in <b>Quick Edit</b> now (premium feature)</p>
55
+ <p style="font-size: 12px; padding: 5px; border-left: 6px solid #3627c2; color: black;
56
+ background-color: #eee; border-radius: 25px 5px;">New: apply a <b><a href="admin.php?page=featured-image-from-url#css">CSS Style</a></b> to all your external featured images. It's a free feature now (16% of <a href="https://goo.gl/forms/TxLdhwXTqsuO5BHg2">votes</a>)</p>
57
  <center>
58
  <table>
59
  <tbody>
admin/html/wc-meta-box.html DELETED
@@ -1,37 +0,0 @@
1
- <script><?php include 'js/wc-meta-box.js' ?></script>
2
- <script><?php include 'js/convert-url.js' ?></script>
3
-
4
- <!-- show alt field, remove button and image if URL was already provided -->
5
-
6
- <input id="fifu_input_alt_<?php echo $i; ?>"
7
- type="text"
8
- name="fifu_input_alt_<?php echo $i; ?>"
9
- placeholder="alt attribute (required)"
10
- value="<?php echo $alt[$i]; ?>"
11
- style="<?php echo $altWidth, $show_alt[$i] ?>" />
12
-
13
- <a id="fifu_link_<?php echo $i; ?>"
14
- class="button"
15
- href="#"
16
- onClick="wcRemoveImage(<?php echo $i; ?>);"
17
- style="<?php echo $show_link[$i] ?>" >x</a>
18
-
19
- <div id="fifu_image_<?php echo $i; ?>"
20
- style="<?php echo $height, $margin, $show_image[$i] ?>
21
- background:url('<?php echo $url[$i]; ?>') no-repeat center center;
22
- background-size:cover;" >
23
- </div>
24
-
25
- <!-- show URL field and preview button if URL was not provided yet -->
26
-
27
- <input id="fifu_input_url_<?php echo $i; ?>"
28
- type="text"
29
- name="fifu_input_url_<?php echo $i; ?>"
30
- placeholder="URL"
31
- value="<?php echo $url[$i]; ?>"
32
- style="<?php echo $width, $margin, $show_url[$i] ?>" />
33
-
34
- <a id="fifu_button_<?php echo $i; ?>"
35
- class="button"
36
- onClick="wcPreviewImage(<?php echo $i; ?>);"
37
- style="<?php echo $align, $margin, $show_button[$i] ?>" >Preview</a>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
admin/menu.php CHANGED
@@ -17,6 +17,7 @@ function fifu_get_menu_html() {
17
  $enable_lazy = get_option('fifu_lazy');
18
  $enable_content = get_option('fifu_content');
19
  $enable_fake = get_option('fifu_fake');
 
20
  $default_url = get_option('fifu_default_url');
21
  $enable_wc_lbox = get_option('fifu_wc_lbox');
22
  $enable_wc_zoom = get_option('fifu_wc_zoom');
@@ -47,6 +48,7 @@ function fifu_get_menu_settings() {
47
  fifu_get_setting('fifu_lazy');
48
  fifu_get_setting('fifu_content');
49
  fifu_get_setting('fifu_fake');
 
50
  fifu_get_setting('fifu_default_url');
51
  fifu_get_setting('fifu_wc_lbox');
52
  fifu_get_setting('fifu_wc_zoom');
@@ -82,6 +84,7 @@ function fifu_update_menu_options() {
82
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
83
  fifu_update_option('fifu_input_content', 'fifu_content');
84
  fifu_update_option('fifu_input_fake', 'fifu_fake');
 
85
  fifu_update_option('fifu_input_default_url', 'fifu_default_url');
86
  fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
87
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
17
  $enable_lazy = get_option('fifu_lazy');
18
  $enable_content = get_option('fifu_content');
19
  $enable_fake = get_option('fifu_fake');
20
+ $css_style = get_option('fifu_css');
21
  $default_url = get_option('fifu_default_url');
22
  $enable_wc_lbox = get_option('fifu_wc_lbox');
23
  $enable_wc_zoom = get_option('fifu_wc_zoom');
48
  fifu_get_setting('fifu_lazy');
49
  fifu_get_setting('fifu_content');
50
  fifu_get_setting('fifu_fake');
51
+ fifu_get_setting('fifu_css');
52
  fifu_get_setting('fifu_default_url');
53
  fifu_get_setting('fifu_wc_lbox');
54
  fifu_get_setting('fifu_wc_zoom');
84
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
85
  fifu_update_option('fifu_input_content', 'fifu_content');
86
  fifu_update_option('fifu_input_fake', 'fifu_fake');
87
+ fifu_update_option('fifu_input_css', 'fifu_css');
88
  fifu_update_option('fifu_input_default_url', 'fifu_default_url');
89
  fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
90
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image From URL
5
  * Plugin URI: http://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: 1.8.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: http://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: 1.8.7
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/thumbnail.php CHANGED
@@ -70,7 +70,13 @@ function fifu_get_html($url, $alt) {
70
  if (is_plugin_active('sirv/sirv.php') && strpos($url, "sirv.com") !== false)
71
  return sprintf('<!-- Featured Image From URL plugin --> <img class="Sirv" data-src="%s">', $url);
72
 
73
- return sprintf('<!-- Featured Image From URL plugin --> <img %s alt="%s" title="%s" style="%s">', fifu_lazy_url($url), $alt, $alt, fifu_should_hide() ? 'display:none' : '');
 
 
 
 
 
 
74
  }
75
 
76
  add_filter('the_content', 'fifu_add_to_content');
70
  if (is_plugin_active('sirv/sirv.php') && strpos($url, "sirv.com") !== false)
71
  return sprintf('<!-- Featured Image From URL plugin --> <img class="Sirv" data-src="%s">', $url);
72
 
73
+ $css = get_option('fifu_css');
74
+
75
+ if (fifu_should_hide()) {
76
+ $css = 'display:none';
77
+ }
78
+
79
+ return sprintf('<!-- Featured Image From URL plugin --> <img %s alt="%s" title="%s" style="%s">', fifu_lazy_url($url), $alt, $alt, $css);
80
  }
81
 
82
  add_filter('the_content', 'fifu_add_to_content');
readme.txt CHANGED
@@ -159,6 +159,9 @@ Features:
159
 
160
  == Changelog ==
161
 
 
 
 
162
  = 1.8.6 =
163
  * Bug fix: image URL was being shown in log file.
164
 
@@ -375,6 +378,9 @@ was removed. To finish, a Premium version is now been presented.
375
 
376
  == Upgrade Notice ==
377
 
 
 
 
378
  = 1.8.6 =
379
  * Bug fix: image URL was being shown in log file.
380
 
159
 
160
  == Changelog ==
161
 
162
+ = 1.8.7 =
163
+ * New free feature: CSS Style.
164
+
165
  = 1.8.6 =
166
  * Bug fix: image URL was being shown in log file.
167
 
378
 
379
  == Upgrade Notice ==
380
 
381
+ = 1.8.7 =
382
+ * New free feature: CSS Style.
383
+
384
  = 1.8.6 =
385
  * Bug fix: image URL was being shown in log file.
386
 
scripts/disableWoocommerce.sh DELETED
@@ -1,38 +0,0 @@
1
- #!/bin/bash
2
-
3
- dir='../wp-content/plugins/woocommerce/templates/single-product/'
4
- themeDir=`cat ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt`
5
-
6
- restoreProductImage()
7
- {
8
- file=$1
9
- overwrite
10
- }
11
-
12
- restoreProductThumbnails()
13
- {
14
- file=$1
15
- overwrite
16
- }
17
-
18
- restoreCategory()
19
- {
20
- file=$themeDir'/woocommerce.php'
21
- overwrite
22
- }
23
-
24
- overwrite()
25
- {
26
- mv $file'.bkp' $file
27
- }
28
-
29
- restore()
30
- {
31
- restoreProductImage $dir'product-image.php'
32
- restoreProductImage `find $themeDir . -iname product-thumbnails.php`
33
- restoreProductThumbnails $dir'product-thumbnails.php'
34
- restoreProductThumbnails `find $themeDir . -iname product-thumbnails.php`
35
- restoreCategory
36
- }
37
-
38
- restore
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
scripts/enableWoocommerce.sh DELETED
@@ -1,69 +0,0 @@
1
- #!/bin/bash
2
-
3
- dir='../wp-content/plugins/woocommerce/templates/single-product/'
4
- themeDir=`cat ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt`
5
-
6
- featured_image()
7
- {
8
- file=$dir'product-image.php'
9
- old='$image_link.*wp_get_attachment_url.*get_post_thumbnail_id.*;'
10
- new='$image_link=get_post_meta($post->ID,"fifu_image_url",true);\
11
- if($image_link=="")\
12
- $image_link=wp_get_attachment_url(get_post_thumbnail_id());'
13
- replace
14
- }
15
-
16
- gallery()
17
- {
18
- file=$1
19
- old='if.*$attachment_ids.*{'
20
- new='if(true){'
21
- replace
22
-
23
- old='?><\/div>'
24
- new='\
25
- for($i=0;$i<10;$i++){\
26
- $image_link=get_post_meta($post->ID,"fifu_image_url_".$i,true);\
27
- if($image_link){\
28
- $image_caption=get_post_meta($post->ID,"fifu_image_alt_".$i,true);\
29
- $image_class="zoom";\
30
- $image=fifu_get_html($image_link,$image_caption);\
31
- $attachment_id=1;\
32
- echo\ apply_filters("woocommerce_single_product_image_thumbnail_html",\
33
- sprintf("<a\ href='%s'\ class='%s'\ title='%s'\ data-rel='prettyPhoto[product-gallery]'>%s<\/a>",\
34
- $image_link,$image_class,$image_caption,$image),$attachment_id,$post->ID,$image_class);\
35
- }\
36
- }\
37
- ?><\/div>'
38
- replace
39
- }
40
-
41
- category()
42
- {
43
- file=$themeDir'/woocommerce.php'
44
- old='woocommerce_content()'
45
- new='fifu_cat_show_image();woocommerce_content()'
46
- replace
47
- }
48
-
49
- replace()
50
- {
51
- integrated=`egrep "fifu_" $file`
52
- if [[ ! $integrated ]]
53
- then
54
- backup
55
- sed -i "s/$old/$new/" $file
56
- fi
57
- }
58
-
59
- backup()
60
- {
61
- cp $file $file'.bkp'
62
- }
63
-
64
- featured_image
65
-
66
- gallery $dir'product-thumbnails.php'
67
- gallery `find $themeDir . -iname product-thumbnails.php`
68
-
69
- category