Featured Image From URL - Version 1.3.6

Version Description

  • Bug fixes and hover effect presentation.

=

Download this release

Release Info

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

Code changes from version 1.3.5 to 1.3.6

admin/category.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
 
3
- add_action('product_cat_edit_form_fields','fifu_show_category_box');
4
- add_action('product_cat_add_form_fields','fifu_show_category_box');
5
 
6
- function fifu_show_category_box($term) {
7
  $margin = 'margin-top:10px;';
8
  $width = 'width:100%;';
9
  $height = 'height:266px;';
@@ -12,22 +12,19 @@ function fifu_show_category_box($term) {
12
  $url = get_term_meta($term->term_id, 'fifu_image_url', true);
13
  $alt = get_term_meta($term->term_id, 'fifu_image_alt', true);
14
 
15
- if ($url) {
16
  $show_url = $show_button = 'display:none;';
17
- $show_alt = $show_image = $show_link = '';
18
- } else {
19
  $show_alt = $show_image = $show_link = 'display:none;';
20
- $show_url = $show_button = '';
21
- }
22
 
23
  include 'html/category.html';
24
  include 'html/category-advertisement.html';
25
  }
26
 
27
- add_action( 'edited_product_cat', 'fifu_save_category_image_properties', 10, 2 );
28
- add_action( 'create_product_cat', 'fifu_save_category_image_properties', 10, 2 );
29
 
30
- function fifu_save_category_image_properties($term_id) {
31
  if (isset($_POST['fifu_input_url']))
32
  update_term_meta($term_id, 'fifu_image_url', esc_url($_POST['fifu_input_url']));
33
 
1
  <?php
2
 
3
+ add_action('product_cat_edit_form_fields', 'fifu_cat_show_box');
4
+ add_action('product_cat_add_form_fields', 'fifu_cat_show_box');
5
 
6
+ function fifu_cat_show_box($term) {
7
  $margin = 'margin-top:10px;';
8
  $width = 'width:100%;';
9
  $height = 'height:266px;';
12
  $url = get_term_meta($term->term_id, 'fifu_image_url', true);
13
  $alt = get_term_meta($term->term_id, 'fifu_image_alt', true);
14
 
15
+ if ($url)
16
  $show_url = $show_button = 'display:none;';
17
+ else
 
18
  $show_alt = $show_image = $show_link = 'display:none;';
 
 
19
 
20
  include 'html/category.html';
21
  include 'html/category-advertisement.html';
22
  }
23
 
24
+ add_action('edited_product_cat', 'fifu_cat_save_properties', 10, 2);
25
+ add_action('create_product_cat', 'fifu_cat_save_properties', 10, 2);
26
 
27
+ function fifu_cat_save_properties($term_id) {
28
  if (isset($_POST['fifu_input_url']))
29
  update_term_meta($term_id, 'fifu_image_url', esc_url($_POST['fifu_input_url']));
30
 
admin/column.php CHANGED
@@ -33,4 +33,3 @@ function fifu_column_content($column, $post_id) {
33
  echo sprintf('<img src="%s" width="100"/>', $url);
34
  }
35
  }
36
-
33
  echo sprintf('<img src="%s" width="100"/>', $url);
34
  }
35
  }
 
admin/html/category.html CHANGED
@@ -1,53 +1,12 @@
1
- <script><?php include 'js/category.js' ?></script>
2
-
3
  <style><?php include 'css/category.css' ?></style>
4
 
5
  <tr>
6
  <th>External Featured Image</th>
7
  <td>
8
  <div class="box">
9
-
10
- <!-- show alt field, image and remove link if URL was already provided -->
11
-
12
- <input id="fifu_input_alt"
13
- type="text"
14
- name="fifu_input_alt"
15
- placeholder="alt attribute (optional)"
16
- value="<?php echo $alt; ?>"
17
- style="<?php echo $width, $margin, $show_alt ?>" />
18
-
19
- <p/>
20
-
21
- <div id="fifu_image"
22
- style="<?php echo $height, $margin, $show_image ?>
23
- background:url('<?php echo $url; ?>') no-repeat center center;
24
- background-size:cover;" >
25
- </div>
26
-
27
- <p/>
28
-
29
- <a id="fifu_link"
30
- href="#"
31
- onClick="removeImage();"
32
- style="<?php echo $show_link ?>" >Remove external featured image</a>
33
-
34
- <!-- show URL field and preview button if URL was not provided yet -->
35
-
36
- <input id="fifu_input_url"
37
- type="text"
38
- name="fifu_input_url"
39
- placeholder="URL"
40
- value="<?php echo $url; ?>"
41
- style="<?php echo $width, $margin, $show_url ?>" />
42
-
43
- <a id="fifu_button"
44
- class="button"
45
- onClick="previewImage();"
46
- style="<?php echo $align, $margin, $show_button ?>" >Preview</a>
47
-
48
  </div>
49
  </td>
50
  </tr>
51
 
52
  <br/>
53
-
 
 
1
  <style><?php include 'css/category.css' ?></style>
2
 
3
  <tr>
4
  <th>External Featured Image</th>
5
  <td>
6
  <div class="box">
7
+ <?php include 'meta-box.html' ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </div>
9
  </td>
10
  </tr>
11
 
12
  <br/>
 
admin/html/css/hover.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
1
+ .blink_me {
2
+ animation: blinker 2s linear infinite;
3
+ }
4
+
5
+ @keyframes blinker {
6
+ 50% { opacity: 0.0; }
7
+ }
admin/html/hover.html ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <script><?php include 'js/meta-box.js' ?></script>
2
+ <style><?php include 'css/hover.css' ?></style>
3
+
4
+ <p/>
5
+
6
+ <a id="fifu_hover"
7
+ class="blink_me"
8
+ href="https://marceljm.com/wordpress/featured-image-from-url-premium/#hover"
9
+ style="<?php echo $show_hover ?>" >Apply a hover effect</a>
admin/html/js/meta-box.js CHANGED
@@ -2,6 +2,7 @@ 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("");
@@ -22,5 +23,6 @@ function previewImage() {
22
  jQuery("#fifu_input_alt").show();
23
  jQuery("#fifu_image").show();
24
  jQuery("#fifu_link").show();
 
25
  }
26
  }
2
  jQuery("#fifu_input_alt").hide();
3
  jQuery("#fifu_image").hide();
4
  jQuery("#fifu_link").hide();
5
+ jQuery("#fifu_hover").hide();
6
 
7
  jQuery("#fifu_input_alt").val("");
8
  jQuery("#fifu_input_url").val("");
23
  jQuery("#fifu_input_alt").show();
24
  jQuery("#fifu_image").show();
25
  jQuery("#fifu_link").show();
26
+ jQuery("#fifu_hover").show();
27
  }
28
  }
admin/html/js/wc-meta-box.js CHANGED
@@ -21,10 +21,10 @@ function wcPreviewImage(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
-
28
  if ($url) {
29
  jQuery(inputUrl).hide();
30
  jQuery(button).hide();
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
+
28
  if ($url) {
29
  jQuery(inputUrl).hide();
30
  jQuery(button).hide();
admin/html/menu.html CHANGED
@@ -30,6 +30,18 @@
30
 
31
  </div>
32
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  <div class="box">
34
 
35
  <h2>Give This Plugin a 5-Star Rating</h2>
30
 
31
  </div>
32
 
33
+ <div class="box">
34
+
35
+ <h2>Hover Effects</h2>
36
+
37
+ <div class="greybox">
38
+
39
+ <p>Make your front page cool! Choose a hover effect in the plugin settings to be applied to all external featured images of your posts on your main page. Featured Image From URL Premium has 18 hover effects available. <a href="https://marceljm.com/wordpress/featured-image-from-url-premium#hover" targe="_blank">Check it out</a>.<p/>
40
+
41
+ </div>
42
+
43
+ </div>
44
+
45
  <div class="box">
46
 
47
  <h2>Give This Plugin a 5-Star Rating</h2>
admin/html/meta-box.html CHANGED
@@ -1,6 +1,6 @@
1
  <script><?php include 'js/meta-box.js' ?></script>
2
 
3
- <!-- show alt field, image and remove link if URL was already provided -->
4
 
5
  <input id="fifu_input_alt"
6
  type="text"
1
  <script><?php include 'js/meta-box.js' ?></script>
2
 
3
+ <!-- show alt field, image and link if URL was already provided -->
4
 
5
  <input id="fifu_input_alt"
6
  type="text"
admin/html/wc-meta-box.html CHANGED
@@ -7,13 +7,13 @@
7
  name="fifu_input_alt_<?php echo $i; ?>"
8
  placeholder="alt attribute (required)"
9
  value="<?php echo $alt[$i]; ?>"
10
- style="<?php echo $altWidth, $show_alt[$i], $top ?>" />
11
 
12
  <a id="fifu_link_<?php echo $i; ?>"
13
  class="button"
14
  href="#"
15
  onClick="wcRemoveImage(<?php echo $i; ?>);"
16
- style="<?php echo $show_link[$i], $top ?>" >x</a>
17
 
18
  <div id="fifu_image_<?php echo $i; ?>"
19
  style="<?php echo $height, $margin, $show_image[$i] ?>
7
  name="fifu_input_alt_<?php echo $i; ?>"
8
  placeholder="alt attribute (required)"
9
  value="<?php echo $alt[$i]; ?>"
10
+ style="<?php echo $altWidth, $show_alt[$i] ?>" />
11
 
12
  <a id="fifu_link_<?php echo $i; ?>"
13
  class="button"
14
  href="#"
15
  onClick="wcRemoveImage(<?php echo $i; ?>);"
16
+ style="<?php echo $show_link[$i] ?>" >x</a>
17
 
18
  <div id="fifu_image_<?php echo $i; ?>"
19
  style="<?php echo $height, $margin, $show_image[$i] ?>
admin/images/favicon.png CHANGED
Binary file
admin/menu.php CHANGED
@@ -29,7 +29,8 @@ function fifu_get_menu_html() {
29
  $show_woocommerce_button = $show_content_button = "display:block";
30
  $output = shell_exec('uname -s');
31
  if ($output == "") {
32
- $compatible = "Unfortunatelly, the script and your server system are not compatible =/";
 
33
  $show_woocommerce_button = "display:none";
34
  } else {
35
  if (strpos($output, "Linux") !== false)
29
  $show_woocommerce_button = $show_content_button = "display:block";
30
  $output = shell_exec('uname -s');
31
  if ($output == "") {
32
+ $compatible = "Unfortunatelly, the script and your server system are not compatible. " .
33
+ "But we still can do the WooCommerce integration manually. In this case, send an email to <a href='mailto:contact@marceljm.com'>contact@marceljm.com</a>.";
34
  $show_woocommerce_button = "display:none";
35
  } else {
36
  if (strpos($output, "Linux") !== false)
admin/meta-box.php CHANGED
@@ -13,7 +13,7 @@ function fifu_insert_meta_box() {
13
  'fifu_show_elements',
14
  $post_type,
15
  'side',
16
- 'default'
17
  );
18
  if (get_option('fifu_woocommerce') == 'toggleon') {
19
  add_meta_box(
@@ -22,7 +22,7 @@ function fifu_insert_meta_box() {
22
  'fifu_wc_show_elements',
23
  $post_type,
24
  'side',
25
- 'default'
26
  );
27
  }
28
  }
@@ -34,7 +34,7 @@ function fifu_insert_meta_box() {
34
  'fifu_show_elements',
35
  $post_type,
36
  'side',
37
- 'default'
38
  );
39
  }
40
 
@@ -61,13 +61,16 @@ function fifu_show_elements($post) {
61
 
62
  if ($url) {
63
  $show_url = $show_button = 'display:none;';
64
- $show_alt = $show_image = $show_link = '';
65
  } else {
66
- $show_alt = $show_image = $show_link = 'display:none;';
67
  $show_url = $show_button = '';
68
  }
69
 
70
  include 'html/meta-box.html';
 
 
 
71
  }
72
 
73
  function fifu_show_advertisement($post) {
@@ -102,9 +105,9 @@ function fifu_wc_show_elements($post) {
102
  }
103
  }
104
 
105
- add_action('save_post', 'fifu_save_image_properties');
106
 
107
- function fifu_save_image_properties($post_id) {
108
  if (isset($_POST['fifu_input_url'])) {
109
  update_post_meta($post_id, 'fifu_image_url', esc_url($_POST['fifu_input_url']));
110
 
@@ -115,7 +118,7 @@ function fifu_save_image_properties($post_id) {
115
  if (isset($_POST['fifu_input_alt']))
116
  update_post_meta($post_id, 'fifu_image_alt', wp_strip_all_tags($_POST['fifu_input_alt']));
117
 
118
- if (get_post_type(get_the_ID() == 'product')) {
119
  $count = 10;
120
  for ($i = 0; $i < 10; $i++) {
121
  if (isset($_POST['fifu_input_url_' . $i]) && isset($_POST['fifu_input_alt_' . $i])) {
@@ -131,11 +134,11 @@ function fifu_save_image_properties($post_id) {
131
  }
132
  }
133
  }
134
- if ($count == 0 && !esc_url($_POST['fifu_input_url']) && get_post_thumbnail_id($post_id) == get_option('fifu_attachment_id'))
135
  delete_post_thumbnail($post_id);
136
  }
137
  else {
138
- if (!esc_url($_POST['fifu_input_url']) && get_post_thumbnail_id($post_id) == get_option('fifu_attachment_id'))
139
  delete_post_thumbnail($post_id);
140
  }
141
  }
13
  'fifu_show_elements',
14
  $post_type,
15
  'side',
16
+ 'low'
17
  );
18
  if (get_option('fifu_woocommerce') == 'toggleon') {
19
  add_meta_box(
22
  'fifu_wc_show_elements',
23
  $post_type,
24
  'side',
25
+ 'low'
26
  );
27
  }
28
  }
34
  'fifu_show_elements',
35
  $post_type,
36
  'side',
37
+ 'low'
38
  );
39
  }
40
 
61
 
62
  if ($url) {
63
  $show_url = $show_button = 'display:none;';
64
+ $show_alt = $show_image = $show_link = $show_hover = '';
65
  } else {
66
+ $show_alt = $show_image = $show_link = $show_hover = 'display:none;';
67
  $show_url = $show_button = '';
68
  }
69
 
70
  include 'html/meta-box.html';
71
+
72
+ if (get_post_type(get_the_ID()) == 'post')
73
+ include 'html/hover.html';
74
  }
75
 
76
  function fifu_show_advertisement($post) {
105
  }
106
  }
107
 
108
+ add_action('save_post', 'fifu_save_properties');
109
 
110
+ function fifu_save_properties($post_id) {
111
  if (isset($_POST['fifu_input_url'])) {
112
  update_post_meta($post_id, 'fifu_image_url', esc_url($_POST['fifu_input_url']));
113
 
118
  if (isset($_POST['fifu_input_alt']))
119
  update_post_meta($post_id, 'fifu_image_alt', wp_strip_all_tags($_POST['fifu_input_alt']));
120
 
121
+ if (get_post_type(get_the_ID()) == 'product') {
122
  $count = 10;
123
  for ($i = 0; $i < 10; $i++) {
124
  if (isset($_POST['fifu_input_url_' . $i]) && isset($_POST['fifu_input_alt_' . $i])) {
134
  }
135
  }
136
  }
137
+ if ($count == 0 && (isset($_POST['fifu_input_url']) && !esc_url($_POST['fifu_input_url'])) && get_post_thumbnail_id($post_id) == get_option('fifu_attachment_id'))
138
  delete_post_thumbnail($post_id);
139
  }
140
  else {
141
+ if ((isset($_POST['fifu_input_url']) && !esc_url($_POST['fifu_input_url'])) && get_post_thumbnail_id($post_id) == get_option('fifu_attachment_id'))
142
  delete_post_thumbnail($post_id);
143
  }
144
  }
featured-image-from-url.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  * Plugin Name: Featured Image From URL
5
  * Description: Allows to use an external image as Featured Image of your post, page or Custom Post Type, such as WooCommerce Product (supports Product Gallery also).
6
- * Version: 1.3.5
7
  * Author: Marcel Jacques Machado
8
  * Author URI: https://marceljm.com/wordpress/featured-image-from-url-premium/
9
  */
@@ -26,6 +26,7 @@ register_deactivation_hook( __FILE__, 'fifu_desactivate' );
26
 
27
  function fifu_desactivate() {
28
  update_option('fifu_woocommerce', 'toggleoff');
 
29
  shell_exec('sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh');
30
  fifu_disable_nonstandard_compatibility();
31
  }
3
  /*
4
  * Plugin Name: Featured Image From URL
5
  * Description: Allows to use an external image as Featured Image of your post, page or Custom Post Type, such as WooCommerce Product (supports Product Gallery also).
6
+ * Version: 1.3.6
7
  * Author: Marcel Jacques Machado
8
  * Author URI: https://marceljm.com/wordpress/featured-image-from-url-premium/
9
  */
26
 
27
  function fifu_desactivate() {
28
  update_option('fifu_woocommerce', 'toggleoff');
29
+ update_option('fifu_hope', 'toggleoff');
30
  shell_exec('sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh');
31
  fifu_disable_nonstandard_compatibility();
32
  }
includes/thumbnail.php CHANGED
@@ -3,8 +3,8 @@
3
  add_filter('wp_head', 'fifu_add_social_tags');
4
 
5
  function fifu_add_social_tags() {
6
- $url = get_post_meta(get_the_ID(), 'fifu_image_url', true);
7
  $post_id = get_the_ID();
 
8
  $title = get_the_title($post_id);
9
  $description = wp_strip_all_tags(get_post_field('post_content', $post_id));
10
 
@@ -34,17 +34,17 @@ function fifu_choose($post) {
34
  add_filter('post_thumbnail_html', 'fifu_replace', 10, 2);
35
 
36
  function fifu_replace($html, $post_id) {
37
- $image_url = get_post_meta($post_id, 'fifu_image_url', true);
38
- $image_alt = get_post_meta($post_id, 'fifu_image_alt', true);
39
 
40
- if ($image_url)
41
- $html = fifu_get_html($image_url, $image_alt);
42
 
43
  return $html;
44
  }
45
 
46
- function fifu_get_html($image_url, $image_alt) {
47
- return sprintf('<!-- Featured Image From URL plugin --> <img src="%s" alt="%s"></img>', $image_url, $image_alt);
48
  }
49
 
50
  add_filter('the_content', 'fifu_add_to_content');
3
  add_filter('wp_head', 'fifu_add_social_tags');
4
 
5
  function fifu_add_social_tags() {
 
6
  $post_id = get_the_ID();
7
+ $url = get_post_meta($post_id, 'fifu_image_url', true);
8
  $title = get_the_title($post_id);
9
  $description = wp_strip_all_tags(get_post_field('post_content', $post_id));
10
 
34
  add_filter('post_thumbnail_html', 'fifu_replace', 10, 2);
35
 
36
  function fifu_replace($html, $post_id) {
37
+ $url = get_post_meta($post_id, 'fifu_image_url', true);
38
+ $alt = get_post_meta($post_id, 'fifu_image_alt', true);
39
 
40
+ if ($url)
41
+ $html = fifu_get_html($url, $alt);
42
 
43
  return $html;
44
  }
45
 
46
+ function fifu_get_html($url, $alt) {
47
+ return sprintf('<!-- Featured Image From URL plugin --> <img src="%s" alt="%s"></img>', $url, $alt);
48
  }
49
 
50
  add_filter('the_content', 'fifu_add_to_content');
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: marceljm
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
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, featured video
5
  Requires at least: 4.0
6
- Tested up to: 4.5.1
7
- Stable tag: 4.5.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -211,6 +211,9 @@ was removed. To finish, a Premium version is now been presented.
211
  = 1.3.5 =
212
  * Bug fixes.
213
 
 
 
 
214
  == Upgrade Notice ==
215
 
216
  = 1.0 =
@@ -276,3 +279,6 @@ was removed. To finish, a Premium version is now been presented.
276
 
277
  = 1.3.5 =
278
  * Bug fixes.
 
 
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG
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, featured video
5
  Requires at least: 4.0
6
+ Tested up to: 4.5.2
7
+ Stable tag: 4.5.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
211
  = 1.3.5 =
212
  * Bug fixes.
213
 
214
+ = 1.3.6 =
215
+ * Bug fixes and hover effect presentation.
216
+
217
  == Upgrade Notice ==
218
 
219
  = 1.0 =
279
 
280
  = 1.3.5 =
281
  * Bug fixes.
282
+
283
+ = 1.3.6 =
284
+ * Bug fixes and hover effect presentation.
scripts/enableWoocommerce.sh CHANGED
@@ -26,7 +26,7 @@ gallery()
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="attachment-shop_thumbnail";\
30
  $image=fifu_get_html($image_link,$image_caption);\
31
  $attachment_id=1;\
32
  echo\ apply_filters("woocommerce_single_product_image_thumbnail_html",\
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",\