Featured Image From URL - Version 1.4.6

Version Description

  • Bug fixes.

=

Download this release

Release Info

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

Code changes from version 1.4.5 to 1.4.6

admin/category.php CHANGED
@@ -4,30 +4,33 @@ 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;';
10
- $align = 'text-align:left;';
11
-
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
 
31
- if (isset($_POST['fifu_input_alt']))
32
- update_term_meta($term_id, 'fifu_image_alt', wp_strip_all_tags($_POST['fifu_input_alt']));
33
  }
 
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;';
10
+ $align = 'text-align:left;';
11
+
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 = $show_sirv = 'display:none;';
17
+ else {
18
+ $show_alt = $show_image = $show_link = 'display:none;';
19
+ $show_sirv = ($is_sirv_active ? '' : 'display:none;');
20
+ }
21
+
22
+ include 'html/category.html';
23
+ include 'html/category-advertisement.html';
24
  }
25
 
26
  add_action('edited_product_cat', 'fifu_cat_save_properties', 10, 2);
27
  add_action('create_product_cat', 'fifu_cat_save_properties', 10, 2);
28
 
29
  function fifu_cat_save_properties($term_id) {
30
+ if (isset($_POST['fifu_input_url']))
31
+ update_term_meta($term_id, 'fifu_image_url', esc_url($_POST['fifu_input_url']));
32
 
33
+ if (isset($_POST['fifu_input_alt']))
34
+ update_term_meta($term_id, 'fifu_image_alt', wp_strip_all_tags($_POST['fifu_input_alt']));
35
  }
36
+
admin/column.php CHANGED
@@ -3,33 +3,33 @@
3
  add_action('admin_init', 'fifu_column');
4
 
5
  function fifu_column() {
6
- add_filter('manage_posts_columns', 'fifu_column_head');
7
- add_filter('manage_pages_columns', 'fifu_column_head');
8
- add_filter('manage_edit-product_cat_columns', 'fifu_column_head');
9
- add_action('manage_posts_custom_column', 'fifu_column_content', 10, 2);
10
- add_action('manage_pages_custom_column', 'fifu_column_content', 10, 2);
11
- add_action('manage_product_cat_custom_column', 'fifu_cat_column_content', 10, 3);
12
  }
13
 
14
  function fifu_column_head($default) {
15
- $default['featured_image'] = 'Featured Image';
16
- return $default;
17
  }
18
 
19
  function fifu_cat_column_content($internal_image, $column, $term_id) {
20
- if ($column == 'featured_image') {
21
- $url = get_term_meta($term_id, 'fifu_image_url', true);
22
- if ($url != '')
23
- echo sprintf('<img src="%s" width="100"/>', $url);
24
- } else
25
- echo $internal_image;
26
  }
27
 
28
  function fifu_column_content($column, $post_id) {
29
- if ($column == 'featured_image') {
30
- $url = get_post_meta($post_id, 'fifu_image_url', true);
31
- if ($url == '')
32
- $url = wp_get_attachment_url(get_post_thumbnail_id());
33
- echo sprintf('<img src="%s" width="100"/>', $url);
34
- }
35
  }
3
  add_action('admin_init', 'fifu_column');
4
 
5
  function fifu_column() {
6
+ add_filter('manage_posts_columns', 'fifu_column_head');
7
+ add_filter('manage_pages_columns', 'fifu_column_head');
8
+ add_filter('manage_edit-product_cat_columns', 'fifu_column_head');
9
+ add_action('manage_posts_custom_column', 'fifu_column_content', 10, 2);
10
+ add_action('manage_pages_custom_column', 'fifu_column_content', 10, 2);
11
+ add_action('manage_product_cat_custom_column', 'fifu_cat_column_content', 10, 3);
12
  }
13
 
14
  function fifu_column_head($default) {
15
+ $default['featured_image'] = 'Featured Image';
16
+ return $default;
17
  }
18
 
19
  function fifu_cat_column_content($internal_image, $column, $term_id) {
20
+ if ($column == 'featured_image') {
21
+ $url = get_term_meta($term_id, 'fifu_image_url', true);
22
+ if ($url != '')
23
+ echo sprintf('<img src="%s" width="100"/>', $url);
24
+ } else
25
+ echo $internal_image;
26
  }
27
 
28
  function fifu_column_content($column, $post_id) {
29
+ if ($column == 'featured_image') {
30
+ $url = get_post_meta($post_id, 'fifu_image_url', true);
31
+ if ($url == '')
32
+ $url = wp_get_attachment_url(get_post_thumbnail_id());
33
+ echo sprintf('<img src="%s" width="100"/>', $url);
34
+ }
35
  }
admin/menu.php CHANGED
@@ -3,137 +3,132 @@
3
  add_action('admin_menu', 'fifu_insert_menu');
4
 
5
  function fifu_insert_menu() {
6
- add_menu_page(
7
- 'Featured Image From URL',
8
- 'Featured Image From URL',
9
- 'administrator',
10
- 'featured-image-from-url',
11
- 'fifu_get_menu_html',
12
- plugins_url() . '/featured-image-from-url/admin/images/favicon.png'
13
- );
14
-
15
- add_action('admin_init', 'fifu_get_menu_settings');
16
  }
17
 
18
  function fifu_get_menu_html() {
19
- $image_button = plugins_url() . '/featured-image-from-url/admin/images/onoff.jpg';
20
-
21
- $enable_woocommerce = get_option('fifu_woocommerce');
22
- $enable_content = get_option('fifu_content');
23
- $enable_hope = get_option('fifu_hope');
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 = $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:marceljmachado@gmail.com'>marceljmachado@gmail.com</a>.";
34
- $show_woocommerce_button = "display:none";
35
- } else {
36
- if (strpos($output, "Linux") !== false)
37
- $compatible = "You server is using $output system. Great! The script may work =)";
38
- else
39
- $compatible = "You server is using $output system. The script may work. <p/>" .
40
- "Please, send an email to <a href='mailto:marceljmachado@gmail.com'>marceljmachado@gmail.com</a> " .
41
- "informing your server system and let me know if it worked for you.";
42
- }
43
-
44
- include 'html/menu.html';
45
-
46
- fifu_update_menu_options();
47
-
48
- fifu_script_woocommerce();
49
-
50
- if (get_option('fifu_hope') == 'toggleon')
51
- fifu_enable_nonstandard_compatibility();
52
- else
53
- fifu_disable_nonstandard_compatibility();
54
  }
55
 
56
  function fifu_get_menu_settings() {
57
- fifu_get_setting('fifu_woocommerce');
58
- fifu_get_setting('fifu_content');
59
- fifu_get_setting('fifu_hope');
60
 
61
- for ($x = 0; $x <= 4; $x++)
62
- fifu_get_setting('fifu_cpt' . $x);
63
  }
64
 
65
  function fifu_get_setting($type) {
66
- register_setting('settings-group', $type);
67
-
68
- if (!get_option($type)) {
69
- if (strpos($type, "cpt") !== false)
70
- update_option($type, '');
71
- else
72
- update_option($type, 'toggleoff');
73
- }
74
  }
75
 
76
  function fifu_update_menu_options() {
77
- fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
78
- fifu_update_option('fifu_input_content', 'fifu_content');
79
- fifu_update_option('fifu_input_hope', 'fifu_hope');
80
 
81
- for ($x = 0; $x <= 4; $x++)
82
- fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
83
  }
84
 
85
  function fifu_update_option($input, $type) {
86
- if (isset($_POST[$input])) {
87
- if ($_POST[$input] == 'on')
88
- update_option($type, 'toggleon');
89
- else if ($_POST[$input] == 'off')
90
- update_option($type, 'toggleoff');
91
- else
92
- update_option($type, wp_strip_all_tags($_POST[$input]));
93
- }
94
  }
95
 
96
  function fifu_script_woocommerce() {
97
- if (get_option('fifu_woocommerce') == 'toggleon') {
98
- $command1 = "echo " . get_template_directory() . " > ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
99
- $command2 = "sh ../wp-content/plugins/featured-image-from-url/scripts/enableWoocommerce.sh";
100
- } else {
101
- $command1 = "sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh";
102
- $command2 = "rm ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
103
- }
104
- shell_exec($command1);
105
- shell_exec($command2);
106
  }
107
 
108
  function fifu_enable_nonstandard_compatibility() {
109
- if (get_option('fifu_attachment_id'))
110
- return;
111
-
112
- global $wpdb;
113
- $old_attach_id = get_option('fifu_attachment_id');
114
-
115
- // create attachment
116
- $filename = 'Featured Image From URL';
117
- $parent_post_id = null;
118
- $filetype = wp_check_filetype('fifu.png', null);
119
- $attachment = array(
120
- 'guid' => basename($filename),
121
- 'post_mime_type' => $filetype['type'],
122
- 'post_title' => '',
123
- 'post_excerpt' => '',
124
- 'post_content' => 'Please don\'t remove that. It\'s just a symbolic file that keeps the field filled. ' .
125
- 'Some themes depend on having an attached file to work. But you are free to use any image you want instead of this file.',
126
- 'post_status' => 'inherit'
127
- );
128
- $attach_id = wp_insert_attachment($attachment, $filename, $parent_post_id);
129
- require_once( ABSPATH . 'wp-admin/includes/image.php' );
130
- $attach_data = wp_generate_attachment_metadata($attach_id, $filename);
131
- wp_update_attachment_metadata($attach_id, $attach_data);
132
- update_option('fifu_attachment_id', $attach_id);
133
-
134
- // insert _thumbnail_id
135
- $table = $wpdb->prefix . 'postmeta';
136
- $query = "
137
  SELECT DISTINCT post_id
138
  FROM " . $table . " a
139
  WHERE a.post_id in (
@@ -149,38 +144,39 @@ function fifu_enable_nonstandard_compatibility() {
149
  WHERE a.post_id = c.post_id
150
  AND c.meta_key = '_thumbnail_id'
151
  )";
152
- $result = $wpdb->get_results($query);
153
- foreach ($result as $i) {
154
- $data = array('post_id' => $i->post_id, 'meta_key' => '_thumbnail_id', 'meta_value' => $attach_id);
155
- $wpdb->insert($table, $data);
156
- }
157
-
158
- // update _thumbnail_id
159
- $data = array('meta_value' => $attach_id);
160
- $where = array('meta_key' => '_thumbnail_id', 'meta_value' => $old_attach_id);
161
- $wpdb->update($table, $data, $where, null, null);
162
-
163
- // update _thumbnail_id
164
- $query = "
165
  SELECT post_id
166
  FROM " . $table . " a
167
  WHERE a.meta_key = 'fifu_image_url'
168
  AND a.meta_value IS NOT NULL
169
  AND a.meta_value <> ''";
170
- $result= $wpdb->get_results($query);
171
- foreach ($result as $i) {
172
- $data = array('meta_value' => $attach_id);
173
- $where = array('post_id' => $i->post_id, 'meta_key' => '_thumbnail_id', 'meta_value' => -1);
174
- $wpdb->update($table, $data, $where, null, null);
175
- }
176
  }
177
 
178
  function fifu_disable_nonstandard_compatibility() {
179
- global $wpdb;
180
- $table = $wpdb->prefix . 'postmeta';
181
- $where = array('meta_key' => '_thumbnail_id', 'meta_value' => get_option('fifu_attachment_id'));
182
- $wpdb->delete($table, $where);
183
 
184
- wp_delete_attachment(get_option('fifu_attachment_id'));
185
- delete_option('fifu_attachment_id');
186
  }
 
3
  add_action('admin_menu', 'fifu_insert_menu');
4
 
5
  function fifu_insert_menu() {
6
+ add_menu_page(
7
+ 'Featured Image From URL', 'Featured Image From URL', 'administrator', 'featured-image-from-url', 'fifu_get_menu_html', plugins_url() . '/featured-image-from-url/admin/images/favicon.png'
8
+ );
9
+
10
+ add_action('admin_init', 'fifu_get_menu_settings');
 
 
 
 
 
11
  }
12
 
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_content = get_option('fifu_content');
18
+ $enable_hope = get_option('fifu_hope');
19
+
20
+ $array_cpt = array();
21
+ for ($x = 0; $x <= 4; $x++)
22
+ $array_cpt[$x] = get_option('fifu_cpt' . $x);
23
+
24
+ $show_woocommerce_button = $show_content_button = "display:block";
25
+ $output = shell_exec('uname -s');
26
+ if ($output == "") {
27
+ $compatible = "Unfortunatelly, the script and your server system are not compatible. " .
28
+ "But we still can do the WooCommerce integration manually. In this case, send an email to <a href='mailto:marceljmachado@gmail.com'>marceljmachado@gmail.com</a>.";
29
+ $show_woocommerce_button = "display:none";
30
+ } else {
31
+ if (strpos($output, "Linux") !== false)
32
+ $compatible = "You server is using $output system. Great! The script may work =)";
33
+ else
34
+ $compatible = "You server is using $output system. The script may work. <p/>" .
35
+ "Please, send an email to <a href='mailto:marceljmachado@gmail.com'>marceljmachado@gmail.com</a> " .
36
+ "informing your server system and let me know if it worked for you.";
37
+ }
38
+
39
+ include 'html/menu.html';
40
+
41
+ fifu_update_menu_options();
42
+
43
+ fifu_script_woocommerce();
44
+
45
+ if (get_option('fifu_hope') == 'toggleon')
46
+ fifu_enable_nonstandard_compatibility();
47
+ else
48
+ fifu_disable_nonstandard_compatibility();
49
  }
50
 
51
  function fifu_get_menu_settings() {
52
+ fifu_get_setting('fifu_woocommerce');
53
+ fifu_get_setting('fifu_content');
54
+ fifu_get_setting('fifu_hope');
55
 
56
+ for ($x = 0; $x <= 4; $x++)
57
+ fifu_get_setting('fifu_cpt' . $x);
58
  }
59
 
60
  function fifu_get_setting($type) {
61
+ register_setting('settings-group', $type);
62
+
63
+ if (!get_option($type)) {
64
+ if (strpos($type, "cpt") !== false)
65
+ update_option($type, '');
66
+ else
67
+ update_option($type, 'toggleoff');
68
+ }
69
  }
70
 
71
  function fifu_update_menu_options() {
72
+ fifu_update_option('fifu_input_woocommerce', 'fifu_woocommerce');
73
+ fifu_update_option('fifu_input_content', 'fifu_content');
74
+ fifu_update_option('fifu_input_hope', 'fifu_hope');
75
 
76
+ for ($x = 0; $x <= 4; $x++)
77
+ fifu_update_option('fifu_input_cpt' . $x, 'fifu_cpt' . $x);
78
  }
79
 
80
  function fifu_update_option($input, $type) {
81
+ if (isset($_POST[$input])) {
82
+ if ($_POST[$input] == 'on')
83
+ update_option($type, 'toggleon');
84
+ else if ($_POST[$input] == 'off')
85
+ update_option($type, 'toggleoff');
86
+ else
87
+ update_option($type, wp_strip_all_tags($_POST[$input]));
88
+ }
89
  }
90
 
91
  function fifu_script_woocommerce() {
92
+ if (get_option('fifu_woocommerce') == 'toggleon') {
93
+ $command1 = "echo " . get_template_directory() . " > ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
94
+ $command2 = "sh ../wp-content/plugins/featured-image-from-url/scripts/enableWoocommerce.sh";
95
+ } else {
96
+ $command1 = "sh ../wp-content/plugins/featured-image-from-url/scripts/disableWoocommerce.sh";
97
+ $command2 = "rm ../wp-content/plugins/featured-image-from-url/scripts/tmp.txt";
98
+ }
99
+ shell_exec($command1);
100
+ shell_exec($command2);
101
  }
102
 
103
  function fifu_enable_nonstandard_compatibility() {
104
+ if (get_option('fifu_attachment_id'))
105
+ return;
106
+
107
+ global $wpdb;
108
+ $old_attach_id = get_option('fifu_attachment_id');
109
+
110
+ // create attachment
111
+ $filename = 'Featured Image From URL';
112
+ $parent_post_id = null;
113
+ $filetype = wp_check_filetype('fifu.png', null);
114
+ $attachment = array(
115
+ 'guid' => basename($filename),
116
+ 'post_mime_type' => $filetype['type'],
117
+ 'post_title' => '',
118
+ 'post_excerpt' => '',
119
+ 'post_content' => 'Please don\'t remove that. It\'s just a symbolic file that keeps the field filled. ' .
120
+ 'Some themes depend on having an attached file to work. But you are free to use any image you want instead of this file.',
121
+ 'post_status' => 'inherit'
122
+ );
123
+ $attach_id = wp_insert_attachment($attachment, $filename, $parent_post_id);
124
+ require_once( ABSPATH . 'wp-admin/includes/image.php' );
125
+ $attach_data = wp_generate_attachment_metadata($attach_id, $filename);
126
+ wp_update_attachment_metadata($attach_id, $attach_data);
127
+ update_option('fifu_attachment_id', $attach_id);
128
+
129
+ // insert _thumbnail_id
130
+ $table = $wpdb->prefix . 'postmeta';
131
+ $query = "
132
  SELECT DISTINCT post_id
133
  FROM " . $table . " a
134
  WHERE a.post_id in (
144
  WHERE a.post_id = c.post_id
145
  AND c.meta_key = '_thumbnail_id'
146
  )";
147
+ $result = $wpdb->get_results($query);
148
+ foreach ($result as $i) {
149
+ $data = array('post_id' => $i->post_id, 'meta_key' => '_thumbnail_id', 'meta_value' => $attach_id);
150
+ $wpdb->insert($table, $data);
151
+ }
152
+
153
+ // update _thumbnail_id
154
+ $data = array('meta_value' => $attach_id);
155
+ $where = array('meta_key' => '_thumbnail_id', 'meta_value' => $old_attach_id);
156
+ $wpdb->update($table, $data, $where, null, null);
157
+
158
+ // update _thumbnail_id
159
+ $query = "
160
  SELECT post_id
161
  FROM " . $table . " a
162
  WHERE a.meta_key = 'fifu_image_url'
163
  AND a.meta_value IS NOT NULL
164
  AND a.meta_value <> ''";
165
+ $result = $wpdb->get_results($query);
166
+ foreach ($result as $i) {
167
+ $data = array('meta_value' => $attach_id);
168
+ $where = array('post_id' => $i->post_id, 'meta_key' => '_thumbnail_id', 'meta_value' => -1);
169
+ $wpdb->update($table, $data, $where, null, null);
170
+ }
171
  }
172
 
173
  function fifu_disable_nonstandard_compatibility() {
174
+ global $wpdb;
175
+ $table = $wpdb->prefix . 'postmeta';
176
+ $where = array('meta_key' => '_thumbnail_id', 'meta_value' => get_option('fifu_attachment_id'));
177
+ $wpdb->delete($table, $where);
178
 
179
+ wp_delete_attachment(get_option('fifu_attachment_id'));
180
+ delete_option('fifu_attachment_id');
181
  }
182
+
admin/meta-box.php CHANGED
@@ -126,13 +126,14 @@ function fifu_save_properties($post_id) {
126
  delete_post_meta($post_id, 'fifu_image_alt_' . $i);
127
  $count--;
128
  }
129
- }
 
130
  }
131
  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'))
132
  delete_post_thumbnail($post_id);
133
  }
134
  else {
135
- if ((isset($_POST['fifu_input_url']) && !esc_url($_POST['fifu_input_url'])) && get_post_thumbnail_id($post_id) == get_option('fifu_attachment_id'))
136
  delete_post_thumbnail($post_id);
137
  }
138
  }
126
  delete_post_meta($post_id, 'fifu_image_alt_' . $i);
127
  $count--;
128
  }
129
+ } else
130
+ $count--;
131
  }
132
  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'))
133
  delete_post_thumbnail($post_id);
134
  }
135
  else {
136
+ if ((isset($_POST['fifu_input_url']) && !esc_url($_POST['fifu_input_url'])) && get_post_thumbnail_id($post_id) == get_option('fifu_attachment_id') && get_option('fifu_attachment_id') != null)
137
  delete_post_thumbnail($post_id);
138
  }
139
  }
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.4.5
7
  * Author: Marcel Jacques Machado
8
  * Author URI: http://marceljm.com/wordpress/featured-image-from-url-premium/
9
  */
@@ -22,9 +22,9 @@ if (is_admin()) {
22
  require_once( FIFU_ADMIN_DIR . '/category.php' );
23
  }
24
 
25
- register_deactivation_hook(__FILE__, 'fifu_desactivate');
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');
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.4.6
7
  * Author: Marcel Jacques Machado
8
  * Author URI: http://marceljm.com/wordpress/featured-image-from-url-premium/
9
  */
22
  require_once( FIFU_ADMIN_DIR . '/category.php' );
23
  }
24
 
25
+ register_deactivation_hook(__FILE__, 'fifu_deactivate');
26
 
27
+ function fifu_deactivate() {
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');
includes/thumbnail-category.php CHANGED
@@ -3,38 +3,39 @@
3
  add_filter('woocommerce_before_main_content', 'fifu_cat_show_image', 30);
4
 
5
  function fifu_cat_show_image() {
6
- $url = fifu_cat_get_url();
7
- $alt = fifu_cat_get_alt();
8
 
9
- if ($url)
10
- echo fifu_get_html($url, $alt);
11
  }
12
 
13
  add_filter('wp_head', 'fifu_cat_add_social_tags');
14
 
15
  function fifu_cat_add_social_tags() {
16
- $url = fifu_cat_get_url();
17
- $title = single_cat_title('', false);
18
 
19
- $term_id = fifu_cat_get_term_id();
20
- if ($term_id)
21
- $description = wp_strip_all_tags(category_description($term_id));
22
 
23
- if ($url)
24
- include 'html/social.html';
25
  }
26
 
27
  function fifu_cat_get_url() {
28
- $term_id = fifu_cat_get_term_id();
29
- return get_term_meta($term_id, 'fifu_image_url', true);
30
  }
31
 
32
  function fifu_cat_get_alt() {
33
- $term_id = fifu_cat_get_term_id();
34
- return get_term_meta($term_id, 'fifu_image_alt', true);
35
  }
36
 
37
  function fifu_cat_get_term_id() {
38
- global $wp_query;
39
- return $wp_query->get_queried_object_id();
40
  }
 
3
  add_filter('woocommerce_before_main_content', 'fifu_cat_show_image', 30);
4
 
5
  function fifu_cat_show_image() {
6
+ $url = fifu_cat_get_url();
7
+ $alt = fifu_cat_get_alt();
8
 
9
+ if ($url)
10
+ echo fifu_get_html($url, $alt);
11
  }
12
 
13
  add_filter('wp_head', 'fifu_cat_add_social_tags');
14
 
15
  function fifu_cat_add_social_tags() {
16
+ $url = fifu_cat_get_url();
17
+ $title = single_cat_title('', false);
18
 
19
+ $term_id = fifu_cat_get_term_id();
20
+ if ($term_id)
21
+ $description = wp_strip_all_tags(category_description($term_id));
22
 
23
+ if ($url)
24
+ include 'html/social.html';
25
  }
26
 
27
  function fifu_cat_get_url() {
28
+ $term_id = fifu_cat_get_term_id();
29
+ return get_term_meta($term_id, 'fifu_image_url', true);
30
  }
31
 
32
  function fifu_cat_get_alt() {
33
+ $term_id = fifu_cat_get_term_id();
34
+ return get_term_meta($term_id, 'fifu_image_alt', true);
35
  }
36
 
37
  function fifu_cat_get_term_id() {
38
+ global $wp_query;
39
+ return $wp_query->get_queried_object_id();
40
  }
41
+
includes/thumbnail.php CHANGED
@@ -81,3 +81,4 @@ function fifu_replace_attachment_url($att_url, $att_id) {
81
  }
82
  return $att_url;
83
  }
 
81
  }
82
  return $att_url;
83
  }
84
+
readme.txt CHANGED
@@ -264,6 +264,9 @@ was removed. To finish, a Premium version is now been presented.
264
  = 1.4.5 =
265
  * Add External Featured Image Slider.
266
 
 
 
 
267
  == Upgrade Notice ==
268
 
269
  = 1.0 =
@@ -356,3 +359,6 @@ was removed. To finish, a Premium version is now been presented.
356
 
357
  = 1.4.5 =
358
  * Add External Featured Image Slider.
 
 
 
264
  = 1.4.5 =
265
  * Add External Featured Image Slider.
266
 
267
+ = 1.4.6 =
268
+ * Bug fixes.
269
+
270
  == Upgrade Notice ==
271
 
272
  = 1.0 =
359
 
360
  = 1.4.5 =
361
  * Add External Featured Image Slider.
362
+
363
+ = 1.4.6 =
364
+ * Bug fixes.