Featured Image From URL - Version 1.7.4

Version Description

  • Bug fix: Instagram URLs. Scripts removed: no more support to WooCommerce 2.

=

Download this release

Release Info

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

Code changes from version 1.7.3 to 1.7.4

admin/html/js/convert-url.js CHANGED
@@ -25,7 +25,7 @@ function fifu_google_drive_url($url) {
25
  //Instagram
26
 
27
  function fifu_from_instagram($url) {
28
- return $url.includes('instagram.com');
29
  }
30
 
31
  function fifu_instagram_id($url) {
25
  //Instagram
26
 
27
  function fifu_from_instagram($url) {
28
+ return $url.match('[^a-z]instagram.com');
29
  }
30
 
31
  function fifu_instagram_id($url) {
admin/html/menu.html CHANGED
@@ -384,35 +384,6 @@
384
  </form>
385
  </div>
386
 
387
- <div style="<?php echo show_woocommerce_box() ?>">
388
- <div class="box">
389
- <h2>WooCommerce Full Integration</h2>
390
- <div class="greybox" id="grad1">
391
- The External Featured Image box is already available on Product Editor. However the full integration is required if you want to include the External Product Gallery and use other WooCommerce resources, such as Lightbox. This free version supports WooCommerce 2.4/2.5 and the Premium version supports WooCommerce 3.
392
- </div>
393
- <br>
394
- <form
395
- id="fifu_form_woocommerce"
396
- action="javascript:void(0)"
397
- method="post">
398
- <input
399
- type="image"
400
- href="javascript:void(0)"
401
- id="fifu_toggle_woocommerce"
402
- onclick="invert('woocommerce')"
403
- name="fifu_toggle_woocommerce"
404
- class="<?php echo $enable_woocommerce; ?>"
405
- value=""
406
- style="display:block">
407
- <input
408
- type="hidden"
409
- id="fifu_input_woocommerce"
410
- name="fifu_input_woocommerce"
411
- value="" >
412
- </form>
413
- </div>
414
- </div>
415
-
416
  <div class="box">
417
  <h2>WooCommerce</h2>
418
  <div class="greybox" id="grad1">
@@ -960,26 +931,11 @@
960
  Allows you to use use external images/videos on Product Categories Grid.
961
  </div>
962
  <br>
963
- <form
964
- id="fifu_form_woocommerce"
965
- action="javascript:void(0)"
966
- method="post">
967
- <input
968
- type="image"
969
- href="javascript:void(0)"
970
- id="fifu_toggle_woocommerce"
971
- onclick="invert('woocommerce')"
972
- name="fifu_toggle_woocommerce"
973
- class="<?php echo $enable_woocommerce; ?>"
974
- value=""
975
- style="display:block">
976
-
977
- <input
978
- type="hidden"
979
- id="fifu_input_woocommerce"
980
- name="fifu_input_woocommerce"
981
- value="" >
982
- </form>
983
  </div>
984
 
985
  <div class="box">
384
  </form>
385
  </div>
386
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  <div class="box">
388
  <h2>WooCommerce</h2>
389
  <div class="greybox" id="grad1">
931
  Allows you to use use external images/videos on Product Categories Grid.
932
  </div>
933
  <br>
934
+ <input
935
+ type="image"
936
+ href="javascript:void(0)"
937
+ class="toggleoff"
938
+ value="" style="display:block">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
939
  </div>
940
 
941
  <div class="box">
admin/html/meta-box.html CHANGED
@@ -47,7 +47,7 @@
47
  style="<?php echo $show_sirv?>">Choose Sirv image</a>
48
 
49
 
50
- <div style="<?php echo $show_news?>">
51
  <br>
52
  <hr>
53
  <p style="font-size: 12px; padding: 5px; border-left: 6px solid #6a04c9; color: black;
47
  style="<?php echo $show_sirv?>">Choose Sirv image</a>
48
 
49
 
50
+ <div style="<?php echo $show_news?>;display:none">
51
  <br>
52
  <hr>
53
  <p style="font-size: 12px; padding: 5px; border-left: 6px solid #6a04c9; color: black;
admin/menu.php CHANGED
@@ -13,7 +13,6 @@ function fifu_insert_menu() {
13
  function fifu_get_menu_html() {
14
  $image_button = plugins_url() . '/featured-image-from-url/admin/images/onoff.jpg';
15
 
16
- $enable_woocommerce = get_option('fifu_woocommerce');
17
  $enable_social = get_option('fifu_social');
18
  $enable_lazy = get_option('fifu_lazy');
19
  $enable_content = get_option('fifu_content');
@@ -35,8 +34,6 @@ function fifu_get_menu_html() {
35
 
36
  fifu_update_menu_options();
37
 
38
- fifu_script_woocommerce();
39
-
40
  if (get_option('fifu_fake') == 'toggleon')
41
  fifu_enable_fake();
42
  else
@@ -44,7 +41,6 @@ function fifu_get_menu_html() {
44
  }
45
 
46
  function fifu_get_menu_settings() {
47
- fifu_get_setting('fifu_woocommerce');
48
  fifu_get_setting('fifu_social');
49
  fifu_get_setting('fifu_lazy');
50
  fifu_get_setting('fifu_content');
@@ -78,7 +74,6 @@ function fifu_get_setting($type) {
78
  }
79
 
80
  function fifu_update_menu_options() {
81
- fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
82
  fifu_update_option('fifu_input_social', 'fifu_social');
83
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
84
  fifu_update_option('fifu_input_content', 'fifu_content');
@@ -107,22 +102,6 @@ function fifu_update_option($input, $type) {
107
  }
108
  }
109
 
110
- function fifu_script_woocommerce() {
111
- if (get_option('fifu_woocommerce') == 'toggleon') {
112
- $command1 = "echo " . get_template_directory() . " > ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
113
- $command2 = "sh ../wp-content/plugins/featured-image-from-url/scripts/enableWoocommerce.sh";
114
- } else {
115
- $command1 = "sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh";
116
- $command2 = "rm ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
117
- }
118
- shell_exec($command1);
119
- shell_exec($command2);
120
- }
121
-
122
- function show_woocommerce_box() {
123
- return function_exists('WC') && WC()->version < 2.6 ? 'display:inline' : 'display:none';
124
- }
125
-
126
  function fifu_enable_fake() {
127
  if (get_option('fifu_fake_attach_id'))
128
  return;
13
  function fifu_get_menu_html() {
14
  $image_button = plugins_url() . '/featured-image-from-url/admin/images/onoff.jpg';
15
 
 
16
  $enable_social = get_option('fifu_social');
17
  $enable_lazy = get_option('fifu_lazy');
18
  $enable_content = get_option('fifu_content');
34
 
35
  fifu_update_menu_options();
36
 
 
 
37
  if (get_option('fifu_fake') == 'toggleon')
38
  fifu_enable_fake();
39
  else
41
  }
42
 
43
  function fifu_get_menu_settings() {
 
44
  fifu_get_setting('fifu_social');
45
  fifu_get_setting('fifu_lazy');
46
  fifu_get_setting('fifu_content');
74
  }
75
 
76
  function fifu_update_menu_options() {
 
77
  fifu_update_option('fifu_input_social', 'fifu_social');
78
  fifu_update_option('fifu_input_lazy', 'fifu_lazy');
79
  fifu_update_option('fifu_input_content', 'fifu_content');
102
  }
103
  }
104
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  function fifu_enable_fake() {
106
  if (get_option('fifu_fake_attach_id'))
107
  return;
admin/meta-box.php CHANGED
@@ -17,8 +17,6 @@ function fifu_insert_meta_box() {
17
  foreach ($post_types as $post_type) {
18
  if ($post_type == 'product') {
19
  add_meta_box('urlMetaBox', 'Product Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
20
- if (get_option('fifu_woocommerce') == 'toggleon')
21
- add_meta_box('wooCommerceGalleryMetaBox', 'Product Gallery from URL', 'fifu_wc_show_elements', $post_type, 'side', 'low');
22
  } else if ($post_type)
23
  add_meta_box('imageUrlMetaBox', 'Featured Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
24
  }
@@ -47,29 +45,6 @@ function fifu_show_elements($post) {
47
  include 'html/meta-box.html';
48
  }
49
 
50
- function fifu_wc_show_elements($post) {
51
- $margin = 'margin-top:1px;';
52
- $width = 'width:70%;';
53
- $height = 'height:200px;';
54
- $align = 'text-align:left;';
55
- $altWidth = 'width:86%;';
56
-
57
- for ($i = 0; $i < 10; $i++) {
58
- $url[$i] = get_post_meta($post->ID, 'fifu_image_url_' . $i, true);
59
- $alt[$i] = get_post_meta($post->ID, 'fifu_image_alt_' . $i, true);
60
-
61
- if ($url[$i]) {
62
- $show_url[$i] = $show_button[$i] = 'display:none;';
63
- $show_alt[$i] = $show_image[$i] = $show_link[$i] = '';
64
- } else {
65
- $show_alt[$i] = $show_image[$i] = $show_link[$i] = 'display:none;';
66
- $show_url[$i] = $show_button[$i] = '';
67
- }
68
-
69
- include 'html/wc-meta-box.html';
70
- }
71
- }
72
-
73
  add_filter('wp_insert_post_data', 'fifu_remove_first_image', 10, 2);
74
 
75
  function fifu_remove_first_image($data, $postarr) {
@@ -107,18 +82,6 @@ function fifu_save_properties($post_id) {
107
  $alt = wp_strip_all_tags($_POST['fifu_input_alt']);
108
  fifu_update_or_delete($post_id, 'fifu_image_alt', $alt);
109
  }
110
-
111
- /* gallery */
112
- if (get_post_type(get_the_ID()) == 'product') {
113
- for ($i = 0; $i < 10; $i++) {
114
- if (isset($_POST['fifu_input_url_' . $i]) && isset($_POST['fifu_input_alt_' . $i])) {
115
- $url = esc_url($_POST['fifu_input_url_' . $i]);
116
- $alt = wp_strip_all_tags($_POST['fifu_input_alt_' . $i]);
117
- fifu_update_or_delete($post_id, 'fifu_image_url_' . $i, $url);
118
- fifu_update_or_delete($post_id, 'fifu_image_alt_' . $i, $alt);
119
- }
120
- }
121
- }
122
  }
123
 
124
  function fifu_update_or_delete($post_id, $field, $url) {
17
  foreach ($post_types as $post_type) {
18
  if ($post_type == 'product') {
19
  add_meta_box('urlMetaBox', 'Product Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
 
 
20
  } else if ($post_type)
21
  add_meta_box('imageUrlMetaBox', 'Featured Image from URL', 'fifu_show_elements', $post_type, 'side', 'low');
22
  }
45
  include 'html/meta-box.html';
46
  }
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  add_filter('wp_insert_post_data', 'fifu_remove_first_image', 10, 2);
49
 
50
  function fifu_remove_first_image($data, $postarr) {
82
  $alt = wp_strip_all_tags($_POST['fifu_input_alt']);
83
  fifu_update_or_delete($post_id, 'fifu_image_alt', $alt);
84
  }
 
 
 
 
 
 
 
 
 
 
 
 
85
  }
86
 
87
  function fifu_update_or_delete($post_id, $field, $url) {
featured-image-from-url.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  * Plugin Name: Featured Image From URL
5
  * 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.
6
- * Version: 1.7.3
7
  * Author: Marcel Jacques Machado
8
  * Author URI: http://featuredimagefromurl.com/
9
  */
@@ -24,10 +24,3 @@ if (is_admin()) {
24
  require_once( FIFU_ADMIN_DIR . '/column.php' );
25
  require_once( FIFU_ADMIN_DIR . '/category.php' );
26
  }
27
-
28
- register_deactivation_hook(__FILE__, 'fifu_deactivate');
29
-
30
- function fifu_deactivate() {
31
- update_option('fifu_woocommerce', 'toggleoff');
32
- shell_exec('sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh');
33
- }
3
  /*
4
  * Plugin Name: Featured Image From URL
5
  * 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.
6
+ * Version: 1.7.4
7
  * Author: Marcel Jacques Machado
8
  * Author URI: http://featuredimagefromurl.com/
9
  */
24
  require_once( FIFU_ADMIN_DIR . '/column.php' );
25
  require_once( FIFU_ADMIN_DIR . '/category.php' );
26
  }
 
 
 
 
 
 
 
includes/convert-url.php CHANGED
@@ -28,7 +28,7 @@ function fifu_google_drive_url($url) {
28
  //Instagram
29
 
30
  function fifu_from_instagram($url) {
31
- return strpos($url, 'instagram.com') !== false;
32
  }
33
 
34
  function fifu_instagram_id($url) {
28
  //Instagram
29
 
30
  function fifu_from_instagram($url) {
31
+ return preg_match("/[^a-z]instagram.com/", $url);
32
  }
33
 
34
  function fifu_instagram_id($url) {
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, 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
5
  Requires at least: 4.0
6
- Tested up to: 4.9.1
7
- Stable tag: 4.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -328,6 +328,9 @@ was removed. To finish, a Premium version is now been presented.
328
  = 1.7.3 =
329
  * Bug fix.
330
 
 
 
 
331
  == Upgrade Notice ==
332
 
333
  = 1.0 =
@@ -503,4 +506,7 @@ was removed. To finish, a Premium version is now been presented.
503
  * Disable product lightbox and zoom.
504
 
505
  = 1.7.3 =
506
- * Bug fix.
 
 
 
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, 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
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.4
7
+ Stable tag: 4.9.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
328
  = 1.7.3 =
329
  * Bug fix.
330
 
331
+ = 1.7.4 =
332
+ * Bug fix: Instagram URLs. Scripts removed: no more support to WooCommerce 2.
333
+
334
  == Upgrade Notice ==
335
 
336
  = 1.0 =
506
  * Disable product lightbox and zoom.
507
 
508
  = 1.7.3 =
509
+ * Bug fix.
510
+
511
+ = 1.7.4 =
512
+ * Bug fix: Instagram URLs. Scripts removed: no more support to WooCommerce 2.