Version Description
- New: fields for Gravity Forms plugin; FIFU Cloud: available for all users; fix: Default Featured Image > Post types; fix: Hide Featured Media (conflict with related posts section); fix: Auto set featured media from post content (unduly working for Elementor plugin editions).
Download this release
Release Info
Developer | marceljm |
Plugin | Featured Image From URL |
Version | 4.0.4 |
Comparing to | |
See all releases |
Code changes from version 4.0.3 to 4.0.4
- admin/db.php +2 -2
- admin/html/cloud.html +1 -0
- admin/html/menu.html +1 -0
- admin/html/support-data.html +1 -0
- admin/html/troubleshooting.html +30 -14
- admin/strings.php +1 -1
- featured-image-from-url.php +8 -1
- gravity-forms/class-gffifufieldaddon.php +133 -0
- gravity-forms/fifufieldaddon.php +21 -0
- gravity-forms/includes/class-fifu-image-gf-field.php +143 -0
- includes/external-post.php +5 -3
- includes/thumbnail.php +4 -0
- includes/util.php +4 -0
- readme.txt +12 -6
admin/db.php
CHANGED
@@ -1193,7 +1193,7 @@ class FifuDb {
|
|
1193 |
if ($has_fifu_attachment) {
|
1194 |
wp_delete_attachment($att_id);
|
1195 |
delete_post_thumbnail($post_id);
|
1196 |
-
if (fifu_get_default_url())
|
1197 |
set_post_thumbnail($post_id, get_option('fifu_default_attach_id'));
|
1198 |
} else {
|
1199 |
// when an external image is removed and an internal is added at the same time
|
@@ -1203,7 +1203,7 @@ class FifuDb {
|
|
1203 |
$this->delete_attachments($attachments);
|
1204 |
}
|
1205 |
|
1206 |
-
if (fifu_get_default_url()) {
|
1207 |
$post_thumbnail_id = get_post_thumbnail_id($post_id);
|
1208 |
$hasInternal = $post_thumbnail_id && get_post_field('post_author', $post_thumbnail_id) != $this->author;
|
1209 |
if (!$hasInternal)
|
1193 |
if ($has_fifu_attachment) {
|
1194 |
wp_delete_attachment($att_id);
|
1195 |
delete_post_thumbnail($post_id);
|
1196 |
+
if (fifu_get_default_url() && fifu_is_valid_default_cpt($post_id))
|
1197 |
set_post_thumbnail($post_id, get_option('fifu_default_attach_id'));
|
1198 |
} else {
|
1199 |
// when an external image is removed and an internal is added at the same time
|
1203 |
$this->delete_attachments($attachments);
|
1204 |
}
|
1205 |
|
1206 |
+
if (fifu_get_default_url() && fifu_is_valid_default_cpt($post_id)) {
|
1207 |
$post_thumbnail_id = get_post_thumbnail_id($post_id);
|
1208 |
$hasInternal = $post_thumbnail_id && get_post_field('post_author', $post_thumbnail_id) != $this->author;
|
1209 |
if (!$hasInternal)
|
admin/html/cloud.html
CHANGED
@@ -799,5 +799,6 @@
|
|
799 |
function removeNotices() {
|
800 |
jQuery('div.header-box > div').remove();
|
801 |
jQuery('.notice').remove();
|
|
|
802 |
}
|
803 |
</script>
|
799 |
function removeNotices() {
|
800 |
jQuery('div.header-box > div').remove();
|
801 |
jQuery('.notice').remove();
|
802 |
+
jQuery('[id^=wp-admin-bar-_]').remove();
|
803 |
}
|
804 |
</script>
|
admin/html/menu.html
CHANGED
@@ -5971,5 +5971,6 @@
|
|
5971 |
function removeNotices() {
|
5972 |
jQuery('div.header-box > div').remove();
|
5973 |
jQuery('.notice').remove();
|
|
|
5974 |
}
|
5975 |
</script>
|
5971 |
function removeNotices() {
|
5972 |
jQuery('div.header-box > div').remove();
|
5973 |
jQuery('.notice').remove();
|
5974 |
+
jQuery('[id^=wp-admin-bar-_]').remove();
|
5975 |
}
|
5976 |
</script>
|
admin/html/support-data.html
CHANGED
@@ -85,5 +85,6 @@ REST routes:
|
|
85 |
function removeNotices() {
|
86 |
jQuery('div.header-box > div').remove();
|
87 |
jQuery('.notice').remove();
|
|
|
88 |
}
|
89 |
</script>
|
85 |
function removeNotices() {
|
86 |
jQuery('div.header-box > div').remove();
|
87 |
jQuery('.notice').remove();
|
88 |
+
jQuery('[id^=wp-admin-bar-_]').remove();
|
89 |
}
|
90 |
</script>
|
admin/html/troubleshooting.html
CHANGED
@@ -9,6 +9,35 @@
|
|
9 |
<div id="tabs-top" style="float:left">
|
10 |
<ul>
|
11 |
<div id="tabs-t" style="padding:1em 1.4em; position: relative; top: -25px;">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
<div class="box">
|
13 |
<table>
|
14 |
<tr>
|
@@ -311,20 +340,6 @@
|
|
311 |
4) publish.<br>
|
312 |
</div>
|
313 |
</div>
|
314 |
-
<div class="box">
|
315 |
-
<table>
|
316 |
-
<tr>
|
317 |
-
<td style="border-bottom:none">2021-04-03</td>
|
318 |
-
<td style="border-bottom:none"><h3> Woodmart</h3></td>
|
319 |
-
<td style="border-bottom:none">theme</td>
|
320 |
-
</tr>
|
321 |
-
</table>
|
322 |
-
<div class="greybox" style="position: relative; top: -10px">
|
323 |
-
Product gallery doesn't work correctly. Two possible solutions:<br>
|
324 |
-
a) run "FIFU Settings > Metadata > Save Image Dimensions";<br>
|
325 |
-
b) enable "FIFU Settings > WooCommerce > FIFU Product Gallery".
|
326 |
-
</div>
|
327 |
-
</div>
|
328 |
<div class="box">
|
329 |
<table>
|
330 |
<tr>
|
@@ -959,5 +974,6 @@
|
|
959 |
function removeNotices() {
|
960 |
jQuery('div.header-box > div').remove();
|
961 |
jQuery('.notice').remove();
|
|
|
962 |
}
|
963 |
</script>
|
9 |
<div id="tabs-top" style="float:left">
|
10 |
<ul>
|
11 |
<div id="tabs-t" style="padding:1em 1.4em; position: relative; top: -25px;">
|
12 |
+
<div class="box">
|
13 |
+
<table>
|
14 |
+
<tr>
|
15 |
+
<td style="border-bottom:none">2022-07-23</td>
|
16 |
+
<td style="border-bottom:none"><h3> Mipro</h3></td>
|
17 |
+
<td style="border-bottom:none">theme</td>
|
18 |
+
</tr>
|
19 |
+
</table>
|
20 |
+
<div class="greybox" style="position: relative; top: -10px">
|
21 |
+
Fast Buy feature doesn't work:<br>
|
22 |
+
1) access "Theme Options > WooCommerce > Lazy Loading > Enable Lazy Loading";<br>
|
23 |
+
2) click on "Off";<br>
|
24 |
+
3) click on "Save Changes" button.
|
25 |
+
</div>
|
26 |
+
</div>
|
27 |
+
<div class="box">
|
28 |
+
<table>
|
29 |
+
<tr>
|
30 |
+
<td style="border-bottom:none">2022-07-23</td>
|
31 |
+
<td style="border-bottom:none"><h3> Woodmart, Mipro</h3></td>
|
32 |
+
<td style="border-bottom:none">themes</td>
|
33 |
+
</tr>
|
34 |
+
</table>
|
35 |
+
<div class="greybox" style="position: relative; top: -10px">
|
36 |
+
Product gallery doesn't work correctly. Two possible solutions:<br>
|
37 |
+
a) run "FIFU Settings > Metadata > Save Image Dimensions";<br>
|
38 |
+
b) enable "FIFU Settings > WooCommerce > FIFU Product Gallery".
|
39 |
+
</div>
|
40 |
+
</div>
|
41 |
<div class="box">
|
42 |
<table>
|
43 |
<tr>
|
340 |
4) publish.<br>
|
341 |
</div>
|
342 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
<div class="box">
|
344 |
<table>
|
345 |
<tr>
|
974 |
function removeNotices() {
|
975 |
jQuery('div.header-box > div').remove();
|
976 |
jQuery('.notice').remove();
|
977 |
+
jQuery('[id^=wp-admin-bar-_]').remove();
|
978 |
}
|
979 |
</script>
|
admin/strings.php
CHANGED
@@ -978,7 +978,7 @@ function fifu_get_strings_settings() {
|
|
978 |
|
979 |
// dimensions
|
980 |
$fifu['dimensions']['desc'] = function() {
|
981 |
-
_e("Some themes and plugins may not work correctly without image dimensions.
|
982 |
};
|
983 |
$fifu['dimensions']['now'] = function() {
|
984 |
_e("save the dimensions of all featured images now", FIFU_SLUG);
|
978 |
|
979 |
// dimensions
|
980 |
$fifu['dimensions']['desc'] = function() {
|
981 |
+
_e("Some themes and plugins may not work correctly without image dimensions. Then you can run this feature to get the dimensions of ~150 images by minute. Problems with the product gallery can be better solved by FIFU Settings > WooCommerce > FIFU Product Gallery.", FIFU_SLUG);
|
982 |
};
|
983 |
$fifu['dimensions']['now'] = function() {
|
984 |
_e("save the dimensions of all featured images now", FIFU_SLUG);
|
featured-image-from-url.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: Featured Image from URL (FIFU)
|
5 |
* Plugin URI: https://fifu.app/
|
6 |
* Description: Use an external image/video as featured image/video of a post or WooCommerce product.
|
7 |
-
* Version: 4.0.
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
@@ -18,6 +18,7 @@ define('FIFU_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
|
18 |
define('FIFU_INCLUDES_DIR', FIFU_PLUGIN_DIR . 'includes');
|
19 |
define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . 'admin');
|
20 |
define('FIFU_ELEMENTOR_DIR', FIFU_PLUGIN_DIR . 'elementor');
|
|
|
21 |
define('FIFU_DELETE_ALL_URLS', false);
|
22 |
define('FIFU_CLOUD_DEBUG', false);
|
23 |
|
@@ -44,6 +45,12 @@ require_once (FIFU_ADMIN_DIR . '/widgets.php');
|
|
44 |
|
45 |
require_once (FIFU_ELEMENTOR_DIR . '/elementor-fifu-extension.php');
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
if (defined('WP_CLI') && WP_CLI)
|
48 |
require_once (FIFU_ADMIN_DIR . '/cli-commands.php');
|
49 |
|
4 |
* Plugin Name: Featured Image from URL (FIFU)
|
5 |
* Plugin URI: https://fifu.app/
|
6 |
* Description: Use an external image/video as featured image/video of a post or WooCommerce product.
|
7 |
+
* Version: 4.0.4
|
8 |
* Author: fifu.app
|
9 |
* Author URI: https://fifu.app/
|
10 |
* WC requires at least: 4.0
|
18 |
define('FIFU_INCLUDES_DIR', FIFU_PLUGIN_DIR . 'includes');
|
19 |
define('FIFU_ADMIN_DIR', FIFU_PLUGIN_DIR . 'admin');
|
20 |
define('FIFU_ELEMENTOR_DIR', FIFU_PLUGIN_DIR . 'elementor');
|
21 |
+
define('FIFU_GRAVITY_DIR', FIFU_PLUGIN_DIR . 'gravity-forms');
|
22 |
define('FIFU_DELETE_ALL_URLS', false);
|
23 |
define('FIFU_CLOUD_DEBUG', false);
|
24 |
|
45 |
|
46 |
require_once (FIFU_ELEMENTOR_DIR . '/elementor-fifu-extension.php');
|
47 |
|
48 |
+
if (fifu_is_gravity_forms_active()) {
|
49 |
+
require_once (WP_PLUGIN_DIR . '/gravityforms/gravityforms.php');
|
50 |
+
if (class_exists('GFForms'))
|
51 |
+
require_once (FIFU_GRAVITY_DIR . '/fifufieldaddon.php');
|
52 |
+
}
|
53 |
+
|
54 |
if (defined('WP_CLI') && WP_CLI)
|
55 |
require_once (FIFU_ADMIN_DIR . '/cli-commands.php');
|
56 |
|
gravity-forms/class-gffifufieldaddon.php
ADDED
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
GFForms::include_addon_framework();
|
3 |
+
|
4 |
+
class GFFifuFieldAddOn extends GFAddOn {
|
5 |
+
|
6 |
+
protected $_version = GF_FIFU_FIELD_ADDON_VERSION;
|
7 |
+
protected $_min_gravityforms_version = '1.9';
|
8 |
+
protected $_slug = 'fifufieldaddon';
|
9 |
+
protected $_path = 'fifufieldaddon/fifufieldaddon.php';
|
10 |
+
protected $_full_path = __FILE__;
|
11 |
+
protected $_title = 'Gravity Forms FIFU Field Add-On';
|
12 |
+
protected $_short_title = 'FIFU Field Add-On';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var object $_instance If available, contains an instance of this class.
|
16 |
+
*/
|
17 |
+
private static $_instance = null;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Returns an instance of this class, and stores it in the $_instance property.
|
21 |
+
*
|
22 |
+
* @return object $_instance An instance of this class.
|
23 |
+
*/
|
24 |
+
public static function get_instance() {
|
25 |
+
if (self::$_instance == null) {
|
26 |
+
self::$_instance = new self();
|
27 |
+
}
|
28 |
+
|
29 |
+
return self::$_instance;
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Include the field early so it is available when entry exports are being performed.
|
34 |
+
*/
|
35 |
+
public function pre_init() {
|
36 |
+
parent::pre_init();
|
37 |
+
|
38 |
+
if ($this->is_gravityforms_supported() && class_exists('GF_Field')) {
|
39 |
+
require_once( 'includes/class-fifu-image-gf-field.php' );
|
40 |
+
}
|
41 |
+
}
|
42 |
+
|
43 |
+
public function init_admin() {
|
44 |
+
parent::init_admin();
|
45 |
+
|
46 |
+
add_filter('gform_tooltips', array($this, 'tooltips'));
|
47 |
+
add_action('gform_field_appearance_settings', array($this, 'field_appearance_settings'), 10, 2);
|
48 |
+
}
|
49 |
+
|
50 |
+
// # SCRIPTS & STYLES -----------------------------------------------------------------------------------------------
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Include my_script.js when the form contains a 'simple' type field.
|
54 |
+
*
|
55 |
+
* @return array
|
56 |
+
*/
|
57 |
+
public function scripts() {
|
58 |
+
$scripts = array(
|
59 |
+
array(
|
60 |
+
'handle' => 'my_script_js',
|
61 |
+
'src' => $this->get_base_url() . '/js/my_script.js',
|
62 |
+
'version' => $this->_version,
|
63 |
+
'deps' => array('jquery'),
|
64 |
+
'enqueue' => array(
|
65 |
+
array('field_types' => array('simple')),
|
66 |
+
),
|
67 |
+
),
|
68 |
+
);
|
69 |
+
|
70 |
+
return array_merge(parent::scripts(), $scripts);
|
71 |
+
}
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Include my_styles.css when the form contains a 'simple' type field.
|
75 |
+
*
|
76 |
+
* @return array
|
77 |
+
*/
|
78 |
+
public function styles() {
|
79 |
+
$styles = array(
|
80 |
+
array(
|
81 |
+
'handle' => 'my_styles_css',
|
82 |
+
'src' => $this->get_base_url() . '/css/my_styles.css',
|
83 |
+
'version' => $this->_version,
|
84 |
+
'enqueue' => array(
|
85 |
+
array('field_types' => array('simple'))
|
86 |
+
)
|
87 |
+
)
|
88 |
+
);
|
89 |
+
|
90 |
+
return array_merge(parent::styles(), $styles);
|
91 |
+
}
|
92 |
+
|
93 |
+
// # FIELD SETTINGS -------------------------------------------------------------------------------------------------
|
94 |
+
|
95 |
+
/**
|
96 |
+
* Add the tooltips for the field.
|
97 |
+
*
|
98 |
+
* @param array $tooltips An associative array of tooltips where the key is the tooltip name and the value is the tooltip.
|
99 |
+
*
|
100 |
+
* @return array
|
101 |
+
*/
|
102 |
+
public function tooltips($tooltips) {
|
103 |
+
$simple_tooltips = array(
|
104 |
+
'input_class_setting' => sprintf('<h6>%s</h6>%s', esc_html__('Input CSS Classes', 'fifufieldaddon'), esc_html__('The CSS Class names to be added to the field input.', 'fifufieldaddon')),
|
105 |
+
);
|
106 |
+
|
107 |
+
return array_merge($tooltips, $simple_tooltips);
|
108 |
+
}
|
109 |
+
|
110 |
+
/**
|
111 |
+
* Add the custom setting for the FIFU field to the Appearance tab.
|
112 |
+
*
|
113 |
+
* @param int $position The position the settings should be located at.
|
114 |
+
* @param int $form_id The ID of the form currently being edited.
|
115 |
+
*/
|
116 |
+
public function field_appearance_settings($position, $form_id) {
|
117 |
+
// Add our custom setting just before the 'Custom CSS Class' setting.
|
118 |
+
if ($position == 250) {
|
119 |
+
?>
|
120 |
+
<li class="input_class_setting field_setting">
|
121 |
+
<label for="input_class_setting">
|
122 |
+
<?php esc_html_e('Input CSS Classes', 'fifufieldaddon'); ?>
|
123 |
+
<?php gform_tooltip('input_class_setting') ?>
|
124 |
+
</label>
|
125 |
+
<input id="input_class_setting" type="text" class="fieldwidth-1" onkeyup="SetInputClassSetting(jQuery(this).val());" onchange="SetInputClassSetting(jQuery(this).val());"/>
|
126 |
+
</li>
|
127 |
+
|
128 |
+
<?php
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
}
|
133 |
+
|
gravity-forms/fifufieldaddon.php
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
define('GF_FIFU_FIELD_ADDON_VERSION', '1.0');
|
4 |
+
|
5 |
+
add_action('gform_loaded', array('GF_Fifu_Field_AddOn_Bootstrap', 'load'), 5);
|
6 |
+
|
7 |
+
class GF_Fifu_Field_AddOn_Bootstrap {
|
8 |
+
|
9 |
+
public static function load() {
|
10 |
+
|
11 |
+
if (!method_exists('GFForms', 'include_addon_framework')) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
+
|
15 |
+
require_once( 'class-gffifufieldaddon.php' );
|
16 |
+
|
17 |
+
GFAddOn::register('GFFifuFieldAddOn');
|
18 |
+
}
|
19 |
+
|
20 |
+
}
|
21 |
+
|
gravity-forms/includes/class-fifu-image-gf-field.php
ADDED
@@ -0,0 +1,143 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
if (!class_exists('GFForms')) {
|
4 |
+
die();
|
5 |
+
}
|
6 |
+
|
7 |
+
class FIFU_GF_Image_Field extends GF_Field {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* @var string $type The field type.
|
11 |
+
*/
|
12 |
+
public $type = 'fifu_image';
|
13 |
+
|
14 |
+
/**
|
15 |
+
* Return the field title, for use in the form editor.
|
16 |
+
*
|
17 |
+
* @return string
|
18 |
+
*/
|
19 |
+
public function get_form_editor_field_title() {
|
20 |
+
return esc_attr__('Featured Image (FIFU)', 'fifufieldaddon');
|
21 |
+
}
|
22 |
+
|
23 |
+
/**
|
24 |
+
* Assign the field button to the Post Fields group.
|
25 |
+
*
|
26 |
+
* @return array
|
27 |
+
*/
|
28 |
+
public function get_form_editor_button() {
|
29 |
+
return array(
|
30 |
+
'group' => 'post_fields',
|
31 |
+
'text' => $this->get_form_editor_field_title(),
|
32 |
+
'icon' => 'dashicons-camera',
|
33 |
+
);
|
34 |
+
}
|
35 |
+
|
36 |
+
/**
|
37 |
+
* The settings which should be available on the field in the form editor.
|
38 |
+
*
|
39 |
+
* @return array
|
40 |
+
*/
|
41 |
+
function get_form_editor_field_settings() {
|
42 |
+
return array(
|
43 |
+
'label_setting',
|
44 |
+
'description_setting',
|
45 |
+
'rules_setting',
|
46 |
+
'placeholder_setting',
|
47 |
+
'input_class_setting',
|
48 |
+
'css_class_setting',
|
49 |
+
'size_setting',
|
50 |
+
'admin_label_setting',
|
51 |
+
'default_value_setting',
|
52 |
+
'visibility_setting',
|
53 |
+
'conditional_logic_field_setting',
|
54 |
+
);
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Enable this field for use with conditional logic.
|
59 |
+
*
|
60 |
+
* @return bool
|
61 |
+
*/
|
62 |
+
public function is_conditional_logic_supported() {
|
63 |
+
return true;
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* The scripts to be included in the form editor.
|
68 |
+
*
|
69 |
+
* @return string
|
70 |
+
*/
|
71 |
+
public function get_form_editor_inline_script_on_page_render() {
|
72 |
+
|
73 |
+
// set the default field label for the simple type field
|
74 |
+
$script = sprintf("function SetDefaultValues_simple(field) {field.label = '%s';}", $this->get_form_editor_field_title()) . PHP_EOL;
|
75 |
+
|
76 |
+
// initialize the fields custom settings
|
77 |
+
$script .= "jQuery(document).bind('gform_load_field_settings', function (event, field, form) {" .
|
78 |
+
"var inputClass = field.inputClass == undefined ? '' : field.inputClass;" .
|
79 |
+
"jQuery('#input_class_setting').val(inputClass);" .
|
80 |
+
"});" . PHP_EOL;
|
81 |
+
|
82 |
+
// saving the simple setting
|
83 |
+
$script .= "function SetInputClassSetting(value) {SetFieldProperty('inputClass', value);}" . PHP_EOL;
|
84 |
+
|
85 |
+
return $script;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Define the fields inner markup.
|
90 |
+
*
|
91 |
+
* @param array $form The Form Object currently being processed.
|
92 |
+
* @param string|array $value The field value. From default/dynamic population, $_POST, or a resumed incomplete submission.
|
93 |
+
* @param null|array $entry Null or the Entry Object currently being edited.
|
94 |
+
*
|
95 |
+
* @return string
|
96 |
+
*/
|
97 |
+
public function get_field_input($form, $value = '', $entry = null) {
|
98 |
+
$id = absint($this->id);
|
99 |
+
$form_id = absint($form['id']);
|
100 |
+
$is_entry_detail = $this->is_entry_detail();
|
101 |
+
$is_form_editor = $this->is_form_editor();
|
102 |
+
|
103 |
+
// Prepare the value of the input ID attribute.
|
104 |
+
$field_id = $is_entry_detail || $is_form_editor || $form_id == 0 ? "input_$id" : 'input_' . $form_id . "_$id";
|
105 |
+
|
106 |
+
$value = esc_attr($value);
|
107 |
+
|
108 |
+
// Get the value of the inputClass property for the current field.
|
109 |
+
$inputClass = $this->inputClass;
|
110 |
+
|
111 |
+
// Prepare the input classes.
|
112 |
+
$size = $this->size;
|
113 |
+
$class_suffix = $is_entry_detail ? '_admin' : '';
|
114 |
+
$class = $size . $class_suffix . ' ' . $inputClass;
|
115 |
+
|
116 |
+
// Prepare the other input attributes.
|
117 |
+
$tabindex = $this->get_tabindex();
|
118 |
+
$logic_event = !$is_form_editor && !$is_entry_detail ? $this->get_conditional_logic_event('keyup') : '';
|
119 |
+
$placeholder_attribute = 'placeholder="Image URL"';
|
120 |
+
$required_attribute = $this->isRequired ? 'aria-required="true"' : '';
|
121 |
+
$invalid_attribute = $this->failed_validation ? 'aria-invalid="true"' : 'aria-invalid="false"';
|
122 |
+
$disabled_text = $is_form_editor ? 'disabled="disabled"' : '';
|
123 |
+
|
124 |
+
// Prepare the input tag for this field.
|
125 |
+
$input = "<input name='input_{$id}' id='{$field_id}' type='text' value='{$value}' class='{$class}' {$tabindex} {$logic_event} {$placeholder_attribute} {$required_attribute} {$invalid_attribute} {$disabled_text}/>";
|
126 |
+
|
127 |
+
return sprintf("<div class='ginput_container ginput_container_%s'>%s</div>", $this->type, $input);
|
128 |
+
}
|
129 |
+
|
130 |
+
public function get_value_save_entry($value, $form, $input_name, $lead_id, $lead) {
|
131 |
+
if ($this->phoneFormat == 'standard' && preg_match('/^\D?(\d{3})\D?\D?(\d{3})\D?(\d{4})$/', $value, $matches)) {
|
132 |
+
$value = sprintf('(%s) %s-%s', $matches[1], $matches[2], $matches[3]);
|
133 |
+
}
|
134 |
+
|
135 |
+
$_POST['fifu_input_url'] = $value;
|
136 |
+
|
137 |
+
return $value;
|
138 |
+
}
|
139 |
+
|
140 |
+
}
|
141 |
+
|
142 |
+
GF_Fields::register(new FIFU_GF_Image_Field());
|
143 |
+
|
includes/external-post.php
CHANGED
@@ -32,14 +32,16 @@ function fifu_save_properties_ext($post_id) {
|
|
32 |
|
33 |
$url = esc_url_raw(rtrim(fifu_first_url_in_content($post_id)));
|
34 |
|
35 |
-
if ($url && fifu_is_on('fifu_get_first')) {
|
36 |
update_post_meta($post_id, 'fifu_image_url', fifu_convert($url));
|
37 |
fifu_db_update_fake_attach_id($post_id);
|
38 |
return;
|
39 |
}
|
40 |
|
41 |
-
if (!$url && get_option('fifu_default_url') && fifu_is_on('fifu_enable_default_url'))
|
42 |
-
|
|
|
|
|
43 |
}
|
44 |
|
45 |
function fifu_first_img_in_content($content) {
|
32 |
|
33 |
$url = esc_url_raw(rtrim(fifu_first_url_in_content($post_id)));
|
34 |
|
35 |
+
if ((!isset($_POST['action']) || $_POST['action'] != 'elementor_ajax') && $url && fifu_is_on('fifu_get_first')) {
|
36 |
update_post_meta($post_id, 'fifu_image_url', fifu_convert($url));
|
37 |
fifu_db_update_fake_attach_id($post_id);
|
38 |
return;
|
39 |
}
|
40 |
|
41 |
+
if (!$url && get_option('fifu_default_url') && fifu_is_on('fifu_enable_default_url')) {
|
42 |
+
if (fifu_is_valid_default_cpt($post_id))
|
43 |
+
fifu_db_update_fake_attach_id($post_id);
|
44 |
+
}
|
45 |
}
|
46 |
|
47 |
function fifu_first_img_in_content($content) {
|
includes/thumbnail.php
CHANGED
@@ -266,6 +266,10 @@ function fifu_should_hide() {
|
|
266 |
if (class_exists('WooCommerce') && is_product())
|
267 |
return false;
|
268 |
|
|
|
|
|
|
|
|
|
269 |
return !is_front_page() && ((is_singular('post') && fifu_is_on('fifu_hide_post')) || (is_singular('page') && fifu_is_on('fifu_hide_page')) || (is_singular(get_post_type(get_the_ID())) && fifu_is_cpt() && fifu_is_on('fifu_hide_cpt')));
|
270 |
}
|
271 |
|
266 |
if (class_exists('WooCommerce') && is_product())
|
267 |
return false;
|
268 |
|
269 |
+
global $post;
|
270 |
+
if ($post->ID != get_queried_object_id())
|
271 |
+
return false;
|
272 |
+
|
273 |
return !is_front_page() && ((is_singular('post') && fifu_is_on('fifu_hide_post')) || (is_singular('page') && fifu_is_on('fifu_hide_page')) || (is_singular(get_post_type(get_the_ID())) && fifu_is_cpt() && fifu_is_on('fifu_hide_cpt')));
|
274 |
}
|
275 |
|
includes/util.php
CHANGED
@@ -169,6 +169,10 @@ function fifu_is_rank_math_seo_active() {
|
|
169 |
return is_plugin_active('seo-by-rank-math/rank-math.php');
|
170 |
}
|
171 |
|
|
|
|
|
|
|
|
|
172 |
// active themes
|
173 |
|
174 |
function fifu_is_flatsome_active() {
|
169 |
return is_plugin_active('seo-by-rank-math/rank-math.php');
|
170 |
}
|
171 |
|
172 |
+
function fifu_is_gravity_forms_active() {
|
173 |
+
return is_plugin_active('gravityforms/gravityforms.php');
|
174 |
+
}
|
175 |
+
|
176 |
// active themes
|
177 |
|
178 |
function fifu_is_flatsome_active() {
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
|
|
4 |
Tags: featured, image, url, video, woocommerce
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 6.0.1
|
7 |
-
Stable tag: 4.0.
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -108,6 +108,12 @@ Supports videos from YouTube, Vimeo, Imgur, 9GAG, Cloudinary, Tumblr, Publitio,
|
|
108 |
* **[PRO]** Featured grid
|
109 |
* **[PRO]** Product gallery
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
#### OTHERS
|
112 |
|
113 |
* **[PRO]** Quick edit
|
@@ -251,20 +257,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
|
|
251 |
|
252 |
== Changelog ==
|
253 |
|
|
|
|
|
|
|
254 |
= 4.0.3 =
|
255 |
* New FIFU Shortcode: for featured slider.
|
256 |
|
257 |
= 4.0.2 =
|
258 |
* New option: FIFU Product Gallery > videos before images; fix: Default Featured Image > Post types; FIFU Cloud: more details about how it can improve or replace other plugin features.
|
259 |
|
260 |
-
= 4.0.1 =
|
261 |
-
* Enhancement: security (validation, sanitization and escaping of option values).
|
262 |
-
|
263 |
= others =
|
264 |
* [more](https://fifu.app/changelog)
|
265 |
|
266 |
|
267 |
== Upgrade Notice ==
|
268 |
|
269 |
-
= 4.0.
|
270 |
-
* New FIFU
|
4 |
Tags: featured, image, url, video, woocommerce
|
5 |
Requires at least: 5.3
|
6 |
Tested up to: 6.0.1
|
7 |
+
Stable tag: 4.0.4
|
8 |
License: GPLv3
|
9 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
108 |
* **[PRO]** Featured grid
|
109 |
* **[PRO]** Product gallery
|
110 |
|
111 |
+
#### GRAVITY FORMS FIELDS
|
112 |
+
|
113 |
+
* Featured image
|
114 |
+
* **[PRO]** Featured video
|
115 |
+
* **[PRO]** Featured slider
|
116 |
+
|
117 |
#### OTHERS
|
118 |
|
119 |
* **[PRO]** Quick edit
|
257 |
|
258 |
== Changelog ==
|
259 |
|
260 |
+
= 4.0.4 =
|
261 |
+
* New: fields for Gravity Forms plugin; FIFU Cloud: available for all users; fix: Default Featured Image > Post types; fix: Hide Featured Media (conflict with related posts section); fix: Auto set featured media from post content (unduly working for Elementor plugin editions).
|
262 |
+
|
263 |
= 4.0.3 =
|
264 |
* New FIFU Shortcode: for featured slider.
|
265 |
|
266 |
= 4.0.2 =
|
267 |
* New option: FIFU Product Gallery > videos before images; fix: Default Featured Image > Post types; FIFU Cloud: more details about how it can improve or replace other plugin features.
|
268 |
|
|
|
|
|
|
|
269 |
= others =
|
270 |
* [more](https://fifu.app/changelog)
|
271 |
|
272 |
|
273 |
== Upgrade Notice ==
|
274 |
|
275 |
+
= 4.0.4 =
|
276 |
+
* New: fields for Gravity Forms plugin; FIFU Cloud: available for all users; fix: Default Featured Image > Post types; fix: Hide Featured Media (conflict with related posts section); fix: Auto set featured media from post content (unduly working for Elementor plugin editions).
|