Featured Image From URL - Version 1.1.4

Version Description

  • Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define until 5 Custom Post Types for now.

=

Download this release

Release Info

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

Code changes from version 1.1.3 to 1.1.4

admin/html/js/menu.js CHANGED
@@ -53,5 +53,19 @@ jQuery(function () {
53
  }
54
  });
55
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  });
57
 
53
  }
54
  });
55
  });
56
+
57
+ jQuery("#fifu_form_cpt").submit(function () {
58
+
59
+ var frm = jQuery("#fifu_form_cpt");
60
+
61
+ jQuery.ajax({
62
+ type: frm.attr('method'),
63
+ url: url,
64
+ data: frm.serialize(),
65
+ success: function (data) {
66
+ //alert('saved');
67
+ }
68
+ });
69
+ });
70
  });
71
 
admin/html/menu.html CHANGED
@@ -6,7 +6,7 @@
6
 
7
  <div class="box">
8
 
9
- <h2>Featured Image From URL</h2>
10
 
11
  <div class="greybox">
12
 
@@ -16,6 +16,42 @@
16
 
17
  </div>
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  <div class="box">
20
 
21
  <h2>WooCommerce Full Integration</h2>
@@ -56,6 +92,34 @@
56
 
57
  </div>
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  <div class="box">
60
 
61
  <h2>Featured Image in Content</h2>
@@ -92,42 +156,6 @@
92
 
93
  </div>
94
 
95
- <div class="box">
96
-
97
- <h2>Make a Donation</h2>
98
-
99
- <div class="greybox">
100
-
101
- <p>Featured Image From URL is completely free and without advertising. To help me to continue updating and improving it, please consider making a donation by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG" target="_blank">PayPal</a>. Thank you!</p>
102
-
103
- </div>
104
-
105
- </div>
106
-
107
- <div class="box">
108
-
109
- <h2>Suggestions For Improvement</h2>
110
-
111
- <div class="greybox">
112
-
113
- <p>Constructive suggestions for improvement are always welcome. Just send an email to <a href="mailto:contact@marceljm.com">contact@marceljm.com</a>. Your request can be available in next version.</p>
114
-
115
- </div>
116
-
117
- </div>
118
-
119
- <div class="box">
120
-
121
- <h2>Give This Plugin a 5-Star Rating</h2>
122
-
123
- <div class="greybox">
124
-
125
- <p>Do you really love Featured Image From URL? So give your <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">rating</a> right now. It's very important for me and WordPress community too.</p>
126
-
127
- </div>
128
-
129
- </div>
130
-
131
  <div class="box">
132
 
133
  <h2>Backlink to Featured Image From URL</h2>
@@ -170,7 +198,7 @@
170
 
171
  <div class="greybox">
172
 
173
- <p>Hi! I'm Marcel Jacques Machado. Graduated in Computer Science, I work as a Software Engineer for almost a decade. I already worked with C, Python, Delphi, Shell Script and other programming languages and technologies. Nowadays, I develop web services for MasterCard in Brazil using Java. About PHP, this plugin, Featured Image From URL, is my first pratical experience. I also have a <a href="http://marceljm.com/" target="_blank">blog</a> in WordPress and I expect to post some useful content very soon.
174
 
175
  </div>
176
 
6
 
7
  <div class="box">
8
 
9
+ <h2>Help</h2>
10
 
11
  <div class="greybox">
12
 
16
 
17
  </div>
18
 
19
+ <div class="box">
20
+
21
+ <h2>Make a Donation</h2>
22
+
23
+ <div class="greybox">
24
+
25
+ <p>Featured Image From URL is completely free and without advertising. To help me to continue updating and improving it, please consider making a donation by <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=8BLDLZ3HDBGQG" target="_blank">PayPal</a>. Thank you!</p>
26
+
27
+ </div>
28
+
29
+ </div>
30
+
31
+ <div class="box">
32
+
33
+ <h2>Give This Plugin a 5-Star Rating</h2>
34
+
35
+ <div class="greybox">
36
+
37
+ <p>Do you really love Featured Image From URL? So give your <a href="https://wordpress.org/support/view/plugin-reviews/featured-image-from-url?filter=5" target="_blank">rating</a> right now. It's very important for me and WordPress community too.</p>
38
+
39
+ </div>
40
+
41
+ </div>
42
+
43
+ <div class="box">
44
+
45
+ <h2>Suggestions For Improvement</h2>
46
+
47
+ <div class="greybox">
48
+
49
+ <p>Constructive suggestions for improvement are always welcome. Just send an email to <a href="mailto:contact@marceljm.com">contact@marceljm.com</a>. Your request can be available in next version.</p>
50
+
51
+ </div>
52
+
53
+ </div>
54
+
55
  <div class="box">
56
 
57
  <h2>WooCommerce Full Integration</h2>
92
 
93
  </div>
94
 
95
+ <div class="box">
96
+
97
+ <h2>Custom Post Types</h2>
98
+
99
+ <div class="greybox">
100
+
101
+ <p>Featured Image from URL is preconfigured to work with only one Custom Post Type (WooCommerce Product). But you also can use this plugin with other ones. For that, you just need to know the correct Custom Post Type names and fill the fields below. Please, let me know if you need more than 5 inputs here.</p>
102
+
103
+ </div>
104
+
105
+ <p/>
106
+
107
+ <form
108
+ id="fifu_form_cpt"
109
+ action="javascript:void(0)"
110
+ method="post">
111
+
112
+ <input id="fifu_input_cpt0" type="text" name="fifu_input_cpt0" style="width:130px" value="<?php echo $array_cpt[0]; ?>">
113
+ <input id="fifu_input_cpt1" type="text" name="fifu_input_cpt1" style="width:130px" value="<?php echo $array_cpt[1]; ?>">
114
+ <input id="fifu_input_cpt2" type="text" name="fifu_input_cpt2" style="width:130px" value="<?php echo $array_cpt[2]; ?>">
115
+ <input id="fifu_input_cpt3" type="text" name="fifu_input_cpt3" style="width:130px" value="<?php echo $array_cpt[3]; ?>">
116
+ <input id="fifu_input_cpt4" type="text" name="fifu_input_cpt4" style="width:130px" value="<?php echo $array_cpt[4]; ?>">
117
+
118
+ <input type="submit" value="Submit" >
119
+ </form>
120
+
121
+ </div>
122
+
123
  <div class="box">
124
 
125
  <h2>Featured Image in Content</h2>
156
 
157
  </div>
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
  <div class="box">
160
 
161
  <h2>Backlink to Featured Image From URL</h2>
198
 
199
  <div class="greybox">
200
 
201
+ <p>Hi! I'm Marcel Jacques Machado. Graduated in Computer Science, I work as a Software Engineer for almost a decade. I already worked with C, Python, Delphi, Shell Script and other programming languages and technologies. Nowadays, I develop web applications for Telefonica in Brazil using Java. About PHP, this plugin, Featured Image From URL, is my first pratical experience. I also have a <a href="http://marceljm.com/" target="_blank">blog</a> in WordPress and I expect to post some useful content very soon.
202
 
203
  </div>
204
 
admin/menu.php CHANGED
@@ -22,6 +22,10 @@ function fifu_get_menu_html() {
22
  $enable_woocommerce = get_option('fifu_woocommerce');
23
  $enable_content = get_option('fifu_content');
24
 
 
 
 
 
25
  $show_woocommerce_button = "display:block";
26
  $output = shell_exec('uname -s');
27
  if ($output == "") {
@@ -45,26 +49,40 @@ function fifu_get_menu_settings() {
45
  fifu_get_setting('fifu_backlink');
46
  fifu_get_setting('fifu_woocommerce');
47
  fifu_get_setting('fifu_content');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
49
 
50
  function fifu_update_menu_options() {
51
  fifu_update_option('fifu_input_backlink', 'fifu_backlink');
52
  fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
53
  fifu_update_option('fifu_input_content', 'fifu_content');
54
- }
55
-
56
- function fifu_get_setting($type) {
57
- register_setting('settings-group', $type);
58
 
59
- if (!get_option($type))
60
- update_option($type, 'toggleoff');
61
  }
62
 
63
  function fifu_update_option($input, $type) {
64
- if ($_POST[$input] == 'on')
65
- update_option($type, 'toggleon');
66
- else if ($_POST[$input] == 'off')
67
- update_option($type, 'toggleoff');
 
 
 
 
68
  }
69
 
70
  function fifu_script_woocommerce() {
22
  $enable_woocommerce = get_option('fifu_woocommerce');
23
  $enable_content = get_option('fifu_content');
24
 
25
+ $array_cpt = array();
26
+ for ($x = 0; $x <= 4; $x++)
27
+ $array_cpt[$x] = get_option('fifu_cpt' . $x);
28
+
29
  $show_woocommerce_button = "display:block";
30
  $output = shell_exec('uname -s');
31
  if ($output == "") {
49
  fifu_get_setting('fifu_backlink');
50
  fifu_get_setting('fifu_woocommerce');
51
  fifu_get_setting('fifu_content');
52
+
53
+ for ($x = 0; $x <= 4; $x++)
54
+ fifu_get_setting('fifu_cpt' . $x);
55
+ }
56
+
57
+ function fifu_get_setting($type) {
58
+ register_setting('settings-group', $type);
59
+
60
+ if (!get_option($type)) {
61
+ if (strpos($type, "cpt") !== false)
62
+ update_option($type, '');
63
+ else
64
+ update_option($type, 'toggleoff');
65
+ }
66
  }
67
 
68
  function fifu_update_menu_options() {
69
  fifu_update_option('fifu_input_backlink', 'fifu_backlink');
70
  fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
71
  fifu_update_option('fifu_input_content', 'fifu_content');
 
 
 
 
72
 
73
+ for ($x = 0; $x <= 4; $x++)
74
+ fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
75
  }
76
 
77
  function fifu_update_option($input, $type) {
78
+ if (isset($_POST[$input])) {
79
+ if ($_POST[$input] == 'on')
80
+ update_option($type, 'toggleon');
81
+ else if ($_POST[$input] == 'off')
82
+ update_option($type, 'toggleoff');
83
+ else
84
+ update_option($type, wp_strip_all_tags($_POST[$input]));
85
+ }
86
  }
87
 
88
  function fifu_script_woocommerce() {
admin/meta-box.php CHANGED
@@ -3,7 +3,7 @@
3
  add_action('add_meta_boxes', 'fifu_insert_meta_box');
4
 
5
  function fifu_insert_meta_box() {
6
- $post_types = array('post', 'page', 'product');
7
 
8
  foreach ($post_types as $post_type) {
9
  if ($post_type == 'product') {
@@ -27,13 +27,14 @@ function fifu_insert_meta_box() {
27
  }
28
  }
29
  else {
30
- add_meta_box(
31
- 'Url Meta Box',
32
- 'External Featured Image',
33
- 'fifu_show_elements',
34
- $post_type,
35
- 'side',
36
- 'default'
 
37
  );
38
  }
39
  }
3
  add_action('add_meta_boxes', 'fifu_insert_meta_box');
4
 
5
  function fifu_insert_meta_box() {
6
+ $post_types = array('post', 'page', 'product', get_option('fifu_cpt0'), get_option('fifu_cpt1'), get_option('fifu_cpt2'), get_option('fifu_cpt3'), get_option('fifu_cpt4'));
7
 
8
  foreach ($post_types as $post_type) {
9
  if ($post_type == 'product') {
27
  }
28
  }
29
  else {
30
+ if ($post_type)
31
+ add_meta_box(
32
+ 'Url Meta Box',
33
+ 'External Featured Image',
34
+ 'fifu_show_elements',
35
+ $post_type,
36
+ 'side',
37
+ 'default'
38
  );
39
  }
40
  }
featured-image-from-url.php CHANGED
@@ -2,8 +2,8 @@
2
 
3
  /*
4
  * Plugin Name: Featured Image From URL
5
- * Description: Allows to use an external image as Featured Image of your post, page or WooCommerce product. And external images in WooCommerce Product Gallery.
6
- * Version: 1.1.3
7
  * Author: Marcel Jacques Machado
8
  * Author URI: http://marceljm.com
9
  */
2
 
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.1.4
7
  * Author: Marcel Jacques Machado
8
  * Author URI: http://marceljm.com
9
  */
readme.txt CHANGED
@@ -1,18 +1,18 @@
1
  === Plugin Name ===
2
  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, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content
5
  Requires at least: 4.0
6
  Tested up to: 4.4.1
7
  Stable tag: 4.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
- Allows to use an external image as Featured Image of your post, page or WooCommerce product. And external images in WooCommerce Product Gallery.
12
 
13
  == Description ==
14
 
15
- Allows you to use an external image (from Flickr, Picasa, Amazon S3, anywhere etc) as Featured Image of your post, page or WooCommerce product.
16
 
17
  It's also possible to use external images in the WooCommerce Product Gallery (since your site is hosted on a Linux server).
18
 
@@ -29,7 +29,7 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
29
 
30
  == Frequently Asked Questions ==
31
 
32
- = Where are the "Featured Image from URL" box? =
33
 
34
  * It will be immediately below or above the traditional "Featured Image" box, in the page/post/product editor.
35
 
@@ -83,7 +83,11 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
83
 
84
  = How to show the Featured Image (internal or external) at the beginning of the content of a Post, Page or Product? =
85
 
86
- * There is a toggle (on/off) in Featured Image From URL settings. This functionality was added to attend some themes that didn't show the Featured Image before the content of Posts, Pages or Products.
 
 
 
 
87
 
88
  == Screenshots ==
89
 
@@ -154,6 +158,9 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
154
  = 1.1.3 =
155
  * If your theme don't show Featured Image (internal or external) in Posts, Pages or Products, now it's possible to include that at the beginning of the content automatically.
156
 
 
 
 
157
  == Upgrade Notice ==
158
 
159
  = 1.0 =
@@ -177,3 +184,5 @@ And if your theme don't show Featured Image (internal or external) in Posts, Pag
177
  = 1.1.3 =
178
  * If your theme don't show Featured Image (internal or external) in Posts, Pages or Products, now it's possible to include that at the beginning of the content automatically.
179
 
 
 
1
  === Plugin Name ===
2
  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, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type
5
  Requires at least: 4.0
6
  Tested up to: 4.4.1
7
  Stable tag: 4.4.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ 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).
12
 
13
  == Description ==
14
 
15
+ Allows you to use an external image (from Flickr, Picasa, Amazon S3, anywhere etc) as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product.
16
 
17
  It's also possible to use external images in the WooCommerce Product Gallery (since your site is hosted on a Linux server).
18
 
29
 
30
  == Frequently Asked Questions ==
31
 
32
+ = Where are the "Featured Image From URL" box? =
33
 
34
  * It will be immediately below or above the traditional "Featured Image" box, in the page/post/product editor.
35
 
83
 
84
  = How to show the Featured Image (internal or external) at the beginning of the content of a Post, Page or Product? =
85
 
86
+ * There is a toggle (on/off) in Featured Image From URL settings. This functionality was added to attend some themes that didn't show the Featured Image before the content of Posts, Pages or Products.
87
+
88
+ = How to use Featured Image From URL with my Custom Post Types? =
89
+
90
+ * There are some text fields in Featured Image From URL settings. For now you can define there until 5 Custom Post Types. Just type the correct names and click on Submit button.
91
 
92
  == Screenshots ==
93
 
158
  = 1.1.3 =
159
  * If your theme don't show Featured Image (internal or external) in Posts, Pages or Products, now it's possible to include that at the beginning of the content automatically.
160
 
161
+ = 1.1.4 =
162
+ * Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define until 5 Custom Post Types for now.
163
+
164
  == Upgrade Notice ==
165
 
166
  = 1.0 =
184
  = 1.1.3 =
185
  * If your theme don't show Featured Image (internal or external) in Posts, Pages or Products, now it's possible to include that at the beginning of the content automatically.
186
 
187
+ = 1.1.4 =
188
+ * Now it's possible to use external images as Featured Images of your Custom Post Types. On the menu settings, you can define for now until 5 Custom Post Types.