Version Description
- Fixed bug where FontAwesome settings page would not properly load CSS/JS assets on internationalized WordPress installations.
- Added support for theme authors to bundle this plugin with a theme ( see install instructions )
- Increased 'fallback' FontAwesome 6 version number to match the 6.0.0 release
Download this release
Release Info
Developer | mattkeys |
Plugin | Advanced Custom Fields: Font Awesome Field |
Version | 4.0.1 |
Comparing to | |
See all releases |
Code changes from version 4.0.0 to 4.0.1
- acf-font-awesome.php +93 -4
- admin/class-ACFFA-Admin.php +24 -19
- assets/inc/class-ACFFA-Loader-6.php +2 -2
- fields/acf-font-awesome-v5.php +2 -3
- fields/acf-font-awesome-v6.php +5 -6
- readme.txt +42 -25
acf-font-awesome.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Advanced Custom Fields: Font Awesome
|
5 |
Plugin URI: https://wordpress.org/plugins/advanced-custom-fields-font-awesome/
|
6 |
Description: Adds a new 'Font Awesome Icon' field to the popular Advanced Custom Fields plugin.
|
7 |
-
Version: 4.0.
|
8 |
Author: Matt Keys
|
9 |
Author URI: http://mattkeys.me/
|
10 |
License: GPLv2 or later
|
@@ -16,11 +16,22 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
16 |
}
|
17 |
|
18 |
if ( ! defined( 'ACFFA_VERSION' ) ) {
|
19 |
-
define( 'ACFFA_VERSION', '4.0.
|
20 |
}
|
21 |
|
22 |
if ( ! defined( 'ACFFA_PUBLIC_PATH' ) ) {
|
23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
}
|
25 |
|
26 |
if ( ! defined( 'ACFFA_BASENAME' ) ) {
|
@@ -66,6 +77,17 @@ if ( ! class_exists('acf_plugin_font_awesome') ) :
|
|
66 |
} else {
|
67 |
include_once('fields/acf-font-awesome-v6.php');
|
68 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
}
|
71 |
|
@@ -129,7 +151,7 @@ if ( ! class_exists('acf_plugin_font_awesome') ) :
|
|
129 |
define( 'ACFFA_FORCE_REFRESH', true );
|
130 |
do_action( 'ACFFA_refresh_latest_icons' );
|
131 |
}
|
132 |
-
if ( version_compare( $acffa_internal_version, '4.0.
|
133 |
$acffa_settings['acffa_v5_compatibility_mode'] = 1;
|
134 |
}
|
135 |
break;
|
@@ -138,6 +160,73 @@ if ( ! class_exists('acf_plugin_font_awesome') ) :
|
|
138 |
if ( $acffa_internal_version !== ACFFA_VERSION ) {
|
139 |
$acffa_settings['acffa_plugin_version'] = ACFFA_VERSION;
|
140 |
update_option( 'acffa_settings', $acffa_settings, false );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
}
|
142 |
}
|
143 |
}
|
4 |
Plugin Name: Advanced Custom Fields: Font Awesome
|
5 |
Plugin URI: https://wordpress.org/plugins/advanced-custom-fields-font-awesome/
|
6 |
Description: Adds a new 'Font Awesome Icon' field to the popular Advanced Custom Fields plugin.
|
7 |
+
Version: 4.0.1
|
8 |
Author: Matt Keys
|
9 |
Author URI: http://mattkeys.me/
|
10 |
License: GPLv2 or later
|
16 |
}
|
17 |
|
18 |
if ( ! defined( 'ACFFA_VERSION' ) ) {
|
19 |
+
define( 'ACFFA_VERSION', '4.0.1' );
|
20 |
}
|
21 |
|
22 |
if ( ! defined( 'ACFFA_PUBLIC_PATH' ) ) {
|
23 |
+
$stylesheet_dir = trim( get_stylesheet_directory(), '/' );
|
24 |
+
if ( stristr( __FILE__, $stylesheet_dir ) ) {
|
25 |
+
define( 'ACFFA_THEME_INSTALLATION', true );
|
26 |
+
$basename_dir = trim( plugin_basename( __DIR__ ), '/' );
|
27 |
+
$theme_path = str_replace( $stylesheet_dir, '', $basename_dir );
|
28 |
+
$public_path = get_stylesheet_directory_uri() . trailingslashit( $theme_path );
|
29 |
+
} else {
|
30 |
+
define( 'ACFFA_THEME_INSTALLATION', false );
|
31 |
+
$public_path = plugin_dir_url( __FILE__ );
|
32 |
+
}
|
33 |
+
|
34 |
+
define( 'ACFFA_PUBLIC_PATH', $public_path );
|
35 |
}
|
36 |
|
37 |
if ( ! defined( 'ACFFA_BASENAME' ) ) {
|
77 |
} else {
|
78 |
include_once('fields/acf-font-awesome-v6.php');
|
79 |
}
|
80 |
+
|
81 |
+
if ( ! defined( 'DISABLE_NAG_NOTICES' ) || ! DISABLE_NAG_NOTICES ) {
|
82 |
+
add_action( 'admin_notices', [ $this, 'theme_install_update_needed' ] );
|
83 |
+
}
|
84 |
+
add_action( 'ACFFA_theme_install_update_check', [ $this, 'theme_install_update_check' ] );
|
85 |
+
|
86 |
+
if ( ACFFA_THEME_INSTALLATION ) {
|
87 |
+
if ( ! wp_next_scheduled ( 'ACFFA_theme_install_update_check' ) ) {
|
88 |
+
wp_schedule_event( time(), 'daily', 'ACFFA_theme_install_update_check' );
|
89 |
+
}
|
90 |
+
}
|
91 |
|
92 |
}
|
93 |
|
151 |
define( 'ACFFA_FORCE_REFRESH', true );
|
152 |
do_action( 'ACFFA_refresh_latest_icons' );
|
153 |
}
|
154 |
+
if ( version_compare( $acffa_internal_version, '4.0.1', '<' ) ) {
|
155 |
$acffa_settings['acffa_v5_compatibility_mode'] = 1;
|
156 |
}
|
157 |
break;
|
160 |
if ( $acffa_internal_version !== ACFFA_VERSION ) {
|
161 |
$acffa_settings['acffa_plugin_version'] = ACFFA_VERSION;
|
162 |
update_option( 'acffa_settings', $acffa_settings, false );
|
163 |
+
delete_option( 'ACFFA_theme_install_update_needed' );
|
164 |
+
}
|
165 |
+
}
|
166 |
+
|
167 |
+
public function theme_install_update_check()
|
168 |
+
{
|
169 |
+
$acf_font_awesome_plugindata = wp_remote_get( 'https://api.wordpress.org/plugins/info/1.0/advanced-custom-fields-font-awesome.json' );
|
170 |
+
|
171 |
+
if ( is_wp_error( $acf_font_awesome_plugindata ) ) {
|
172 |
+
return;
|
173 |
+
}
|
174 |
+
|
175 |
+
$response = wp_remote_retrieve_body( $acf_font_awesome_plugindata );
|
176 |
+
$plugindata = json_decode( $response );
|
177 |
+
|
178 |
+
if ( ! isset( $plugindata->version ) || empty( $plugindata->version ) ) {
|
179 |
+
return;
|
180 |
+
}
|
181 |
+
|
182 |
+
if ( version_compare( ACFFA_VERSION, $plugindata->version, '<' ) ) {
|
183 |
+
update_option( 'ACFFA_theme_install_update_needed', $plugindata->version );
|
184 |
+
} else {
|
185 |
+
delete_option( 'ACFFA_theme_install_update_needed' );
|
186 |
+
}
|
187 |
+
}
|
188 |
+
|
189 |
+
public function theme_install_update_needed()
|
190 |
+
{
|
191 |
+
if ( ! ACFFA_THEME_INSTALLATION ) {
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
|
195 |
+
global $pagenow;
|
196 |
+
|
197 |
+
$show_notice = false;
|
198 |
+
if ( 'update-core.php' == $pagenow || 'plugins.php' == $pagenow ) {
|
199 |
+
$show_notice = true;
|
200 |
+
}
|
201 |
+
|
202 |
+
if ( ( isset( $_GET['post_type'] ) && 'acf-field-group' == $_GET['post_type'] ) && ( isset( $_GET['page'] ) && 'fontawesome-settings' == $_GET['page'] ) ) {
|
203 |
+
$show_notice = true;
|
204 |
+
}
|
205 |
+
|
206 |
+
if ( ! $show_notice ) {
|
207 |
+
return;
|
208 |
+
}
|
209 |
+
|
210 |
+
if ( ! $latest_version = get_option( 'ACFFA_theme_install_update_needed' ) ) {
|
211 |
+
return;
|
212 |
+
}
|
213 |
+
|
214 |
+
$active_theme = wp_get_theme();
|
215 |
+
$theme_name = $active_theme->get('Name') ? '<strong>(' . $active_theme->get('Name') . ')</strong>' : false;
|
216 |
+
$theme_author = $active_theme->get('AuthorURI') ? '<a href="' . $active_theme->get('AuthorURI') . '" target="_blank">' . __( 'theme author', 'acf-font-awesome' ) . '</a>' : __( 'theme author', 'acf-font-awesome' );
|
217 |
+
|
218 |
+
$out_of_date_message = '<p>' . sprintf( __( 'There is a new version of <a href="%s" target="_blank">Advanced Custom Fields: Font Awesome</a> available. Installed Version: <strong>%s</strong>, Latest Version: <strong>%s</strong>', 'acf-font-awesome' ), 'https://wordpress.org/plugins/advanced-custom-fields-font-awesome/', ACFFA_VERSION, $latest_version ) . '<br>';
|
219 |
+
$out_of_date_message .= "<br>\n";
|
220 |
+
$out_of_date_message .= sprintf( __( 'It looks like this plugin is bundled with your theme: %s and is not able to receive updates. It is recommended that you contact your %s for updates. Alternatively you can install this plugin through the <a href="%s" target="_blank">WordPress Plugin Repository</a> to get the latest version.', 'acf-font-awesome' ), $theme_name, $theme_author, admin_url( 'plugin-install.php?tab=plugin-information&plugin=advanced-custom-fields-font-awesome' ) ) . '</p>';
|
221 |
+
|
222 |
+
$out_of_date_message = apply_filters( 'ACFFA_theme_install_update_message', $out_of_date_message, ACFFA_VERSION, $latest_version );
|
223 |
+
|
224 |
+
if ( $out_of_date_message ) {
|
225 |
+
?>
|
226 |
+
<div class="update-message notice notice-warning notice-alt is-dismissible">
|
227 |
+
<?php echo $out_of_date_message; ?>
|
228 |
+
</div>
|
229 |
+
<?php
|
230 |
}
|
231 |
}
|
232 |
}
|
admin/class-ACFFA-Admin.php
CHANGED
@@ -10,8 +10,6 @@
|
|
10 |
|
11 |
class ACFFA_Admin
|
12 |
{
|
13 |
-
|
14 |
-
|
15 |
private $version;
|
16 |
|
17 |
public function init()
|
@@ -71,7 +69,8 @@ class ACFFA_Admin
|
|
71 |
|
72 |
public function enqueue_acf_select2( $hook )
|
73 |
{
|
74 |
-
|
|
|
75 |
return;
|
76 |
}
|
77 |
|
@@ -136,7 +135,8 @@ class ACFFA_Admin
|
|
136 |
|
137 |
public function enqueue_scripts_v6( $hook )
|
138 |
{
|
139 |
-
|
|
|
140 |
return;
|
141 |
}
|
142 |
|
@@ -149,8 +149,8 @@ class ACFFA_Admin
|
|
149 |
wp_enqueue_style( 'acffa_font-awesome', $fa_url );
|
150 |
}
|
151 |
|
152 |
-
wp_enqueue_style( 'acffa-settings', ACFFA_PUBLIC_PATH . 'assets/css/settings.css' );
|
153 |
-
wp_enqueue_script( 'acffa-settings', ACFFA_PUBLIC_PATH . 'assets/js/settings-v6.js', [ 'select2', 'wp-util' ],
|
154 |
wp_localize_script( 'acffa-settings', 'ACFFA', [
|
155 |
'search_string' => __( 'Add New Icon', 'acf-font-awesome' ),
|
156 |
'confirm_delete' => __( 'Are you sure you want to delete this icon set?', 'acf-font-awesome' ),
|
@@ -168,11 +168,12 @@ class ACFFA_Admin
|
|
168 |
|
169 |
public function enqueue_scripts_v5( $hook )
|
170 |
{
|
171 |
-
|
|
|
172 |
return;
|
173 |
}
|
174 |
|
175 |
-
wp_enqueue_style( 'acffa-settings', ACFFA_PUBLIC_PATH . 'assets/css/settings.css' );
|
176 |
|
177 |
wp_register_style( 'font-awesome', apply_filters( 'ACFFA_get_fa_url', '' ) );
|
178 |
wp_enqueue_style( 'multi-select-css', ACFFA_PUBLIC_PATH . 'assets/inc/multi-select/multi-select.css', [ 'font-awesome' ] );
|
@@ -300,26 +301,26 @@ class ACFFA_Admin
|
|
300 |
);
|
301 |
|
302 |
add_settings_field(
|
303 |
-
'
|
304 |
-
__( '
|
305 |
-
[ $this, '
|
306 |
'acffa',
|
307 |
'acffa_section_developers',
|
308 |
[
|
309 |
-
'label_for' => '
|
310 |
-
'class' => 'acffa_row
|
311 |
]
|
312 |
);
|
313 |
|
314 |
add_settings_field(
|
315 |
-
'
|
316 |
-
__( '
|
317 |
-
[ $this, '
|
318 |
'acffa',
|
319 |
'acffa_section_developers',
|
320 |
[
|
321 |
-
'label_for' => '
|
322 |
-
'class' => 'acffa_row
|
323 |
]
|
324 |
);
|
325 |
|
@@ -449,7 +450,7 @@ class ACFFA_Admin
|
|
449 |
$attributes = defined( 'ACFFA_OVERRIDE_MAJOR_VERSION' ) ? 'disabled' : false;
|
450 |
?>
|
451 |
<p>
|
452 |
-
<?php _e( 'IMPORTANT: This plugin has undergone major changes between FontAwesome versions. Switching to a new version may require you to reselect some/all icons that you have previously selected using this plugin. Switching to v6 has introduced a new "
|
453 |
</p>
|
454 |
<br>
|
455 |
<select <?php echo $attributes; ?> id="<?php echo esc_attr( $args['label_for'] ); ?>" name="acffa_settings[<?php echo esc_attr( $args['label_for'] ); ?>]">
|
@@ -939,6 +940,10 @@ class ACFFA_Admin
|
|
939 |
$show_blurbs = false;
|
940 |
}
|
941 |
|
|
|
|
|
|
|
|
|
942 |
return $show_blurbs;
|
943 |
}
|
944 |
|
10 |
|
11 |
class ACFFA_Admin
|
12 |
{
|
|
|
|
|
13 |
private $version;
|
14 |
|
15 |
public function init()
|
69 |
|
70 |
public function enqueue_acf_select2( $hook )
|
71 |
{
|
72 |
+
$acf_menu_slug = sanitize_title( __( 'Custom Fields', 'acf' ) );
|
73 |
+
if ( $acf_menu_slug . '_page_fontawesome-settings' != $hook ) {
|
74 |
return;
|
75 |
}
|
76 |
|
135 |
|
136 |
public function enqueue_scripts_v6( $hook )
|
137 |
{
|
138 |
+
$acf_menu_slug = sanitize_title( __( 'Custom Fields', 'acf' ) );
|
139 |
+
if ( $acf_menu_slug . '_page_fontawesome-settings' != $hook ) {
|
140 |
return;
|
141 |
}
|
142 |
|
149 |
wp_enqueue_style( 'acffa_font-awesome', $fa_url );
|
150 |
}
|
151 |
|
152 |
+
wp_enqueue_style( 'acffa-settings', ACFFA_PUBLIC_PATH . 'assets/css/settings.css', [], ACFFA_VERSION );
|
153 |
+
wp_enqueue_script( 'acffa-settings', ACFFA_PUBLIC_PATH . 'assets/js/settings-v6.js', [ 'select2', 'wp-util' ], ACFFA_VERSION, true );
|
154 |
wp_localize_script( 'acffa-settings', 'ACFFA', [
|
155 |
'search_string' => __( 'Add New Icon', 'acf-font-awesome' ),
|
156 |
'confirm_delete' => __( 'Are you sure you want to delete this icon set?', 'acf-font-awesome' ),
|
168 |
|
169 |
public function enqueue_scripts_v5( $hook )
|
170 |
{
|
171 |
+
$acf_menu_slug = sanitize_title( __( 'Custom Fields', 'acf' ) );
|
172 |
+
if ( $acf_menu_slug . '_page_fontawesome-settings' != $hook ) {
|
173 |
return;
|
174 |
}
|
175 |
|
176 |
+
wp_enqueue_style( 'acffa-settings', ACFFA_PUBLIC_PATH . 'assets/css/settings.css', [], ACFFA_VERSION );
|
177 |
|
178 |
wp_register_style( 'font-awesome', apply_filters( 'ACFFA_get_fa_url', '' ) );
|
179 |
wp_enqueue_style( 'multi-select-css', ACFFA_PUBLIC_PATH . 'assets/inc/multi-select/multi-select.css', [ 'font-awesome' ] );
|
301 |
);
|
302 |
|
303 |
add_settings_field(
|
304 |
+
'acffa_pro_cdn',
|
305 |
+
__( 'Enable Pro Icons?', 'acf-font-awesome' ),
|
306 |
+
[ $this, 'acffa_pro_cdn_cb' ],
|
307 |
'acffa',
|
308 |
'acffa_section_developers',
|
309 |
[
|
310 |
+
'label_for' => 'acffa_pro_cdn',
|
311 |
+
'class' => 'acffa_row pro_icons'
|
312 |
]
|
313 |
);
|
314 |
|
315 |
add_settings_field(
|
316 |
+
'acffa_v5_compatibility_mode',
|
317 |
+
__( 'Compatibility Mode', 'acf-font-awesome' ),
|
318 |
+
[ $this, 'acffa_v5_compatibility_mode_cb' ],
|
319 |
'acffa',
|
320 |
'acffa_section_developers',
|
321 |
[
|
322 |
+
'label_for' => 'acffa_v5_compatibility_mode',
|
323 |
+
'class' => 'acffa_row v5_compatibility_mode'
|
324 |
]
|
325 |
);
|
326 |
|
450 |
$attributes = defined( 'ACFFA_OVERRIDE_MAJOR_VERSION' ) ? 'disabled' : false;
|
451 |
?>
|
452 |
<p>
|
453 |
+
<?php _e( 'IMPORTANT: This plugin has undergone major changes between FontAwesome versions. Switching to a new version may require you to reselect some/all icons that you have previously selected using this plugin. Switching to v6 has introduced a new "Compatibility Mode" that aims to make this migration easier.', 'acf-font-awesome' ); ?>
|
454 |
</p>
|
455 |
<br>
|
456 |
<select <?php echo $attributes; ?> id="<?php echo esc_attr( $args['label_for'] ); ?>" name="acffa_settings[<?php echo esc_attr( $args['label_for'] ); ?>]">
|
940 |
$show_blurbs = false;
|
941 |
}
|
942 |
|
943 |
+
if ( version_compare( ACFFA_MAJOR_VERSION, 5, '=' ) && isset( $acffa_settings['acffa_pro_cdn'] ) && $acffa_settings['acffa_pro_cdn'] ) {
|
944 |
+
$show_blurbs = false;
|
945 |
+
}
|
946 |
+
|
947 |
return $show_blurbs;
|
948 |
}
|
949 |
|
assets/inc/class-ACFFA-Loader-6.php
CHANGED
@@ -361,7 +361,7 @@ class ACFFA_Loader_6
|
|
361 |
return 'https://kit.fontawesome.com/' . $this->kit_token . '.js';
|
362 |
} else {
|
363 |
$cdn_baseurl = 'https://use.fontawesome.com/releases/v';
|
364 |
-
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0
|
365 |
$cdn_filepath = '/css/all.css';
|
366 |
|
367 |
return $cdn_baseurl . $latest_version . $cdn_filepath;
|
@@ -463,7 +463,7 @@ class ACFFA_Loader_6
|
|
463 |
private function maybe_recheck_latest_version()
|
464 |
{
|
465 |
if ( ( time() - $this->latest_version_timestamp ) > HOUR_IN_SECONDS ) {
|
466 |
-
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0
|
467 |
}
|
468 |
}
|
469 |
}
|
361 |
return 'https://kit.fontawesome.com/' . $this->kit_token . '.js';
|
362 |
} else {
|
363 |
$cdn_baseurl = 'https://use.fontawesome.com/releases/v';
|
364 |
+
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0' );
|
365 |
$cdn_filepath = '/css/all.css';
|
366 |
|
367 |
return $cdn_baseurl . $latest_version . $cdn_filepath;
|
463 |
private function maybe_recheck_latest_version()
|
464 |
{
|
465 |
if ( ( time() - $this->latest_version_timestamp ) > HOUR_IN_SECONDS ) {
|
466 |
+
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0', true );
|
467 |
}
|
468 |
}
|
469 |
}
|
fields/acf-font-awesome-v5.php
CHANGED
@@ -252,16 +252,15 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
|
|
252 |
|
253 |
public function input_admin_enqueue_scripts()
|
254 |
{
|
255 |
-
$url = $this->settings['url'];
|
256 |
$version = $this->settings['version'];
|
257 |
|
258 |
-
wp_register_script( 'acf-input-font-awesome', "
|
259 |
wp_localize_script( 'acf-input-font-awesome', 'ACFFA', array(
|
260 |
'major_version' => ACFFA_MAJOR_VERSION
|
261 |
));
|
262 |
wp_enqueue_script('acf-input-font-awesome');
|
263 |
|
264 |
-
wp_register_style( 'acf-input-font-awesome', "
|
265 |
wp_enqueue_style('acf-input-font-awesome');
|
266 |
|
267 |
if ( apply_filters( 'ACFFA_admin_enqueue_fa', true ) ) {
|
252 |
|
253 |
public function input_admin_enqueue_scripts()
|
254 |
{
|
|
|
255 |
$version = $this->settings['version'];
|
256 |
|
257 |
+
wp_register_script( 'acf-input-font-awesome', ACFFA_PUBLIC_PATH . "assets/js/input-v5.js", array('acf-input'), $version );
|
258 |
wp_localize_script( 'acf-input-font-awesome', 'ACFFA', array(
|
259 |
'major_version' => ACFFA_MAJOR_VERSION
|
260 |
));
|
261 |
wp_enqueue_script('acf-input-font-awesome');
|
262 |
|
263 |
+
wp_register_style( 'acf-input-font-awesome', ACFFA_PUBLIC_PATH . "assets/css/input.css", array('acf-input'), $version );
|
264 |
wp_enqueue_style('acf-input-font-awesome');
|
265 |
|
266 |
if ( apply_filters( 'ACFFA_admin_enqueue_fa', true ) ) {
|
fields/acf-font-awesome-v6.php
CHANGED
@@ -260,22 +260,21 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
|
|
260 |
|
261 |
public function input_admin_enqueue_scripts()
|
262 |
{
|
263 |
-
$url = $this->settings['url'];
|
264 |
$version = $this->settings['version'];
|
265 |
$options = get_option( 'acffa_settings' );
|
266 |
-
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0
|
267 |
|
268 |
if ( isset( $options['acffa_v5_compatibility_mode'] ) && $options['acffa_v5_compatibility_mode'] ) {
|
269 |
wp_enqueue_script( 'acffa_fontawesome-js-api', "https://use.fontawesome.com/releases/v$latest_version/js/all.js", [], $latest_version );
|
270 |
}
|
271 |
-
wp_enqueue_script( 'acf-input-font-awesome', "
|
272 |
wp_localize_script( 'acf-input-font-awesome', 'ACFFA', [
|
273 |
'major_version' => ACFFA_MAJOR_VERSION,
|
274 |
'v5_compat_mode' => isset( $options['acffa_v5_compatibility_mode'] ) && $options['acffa_v5_compatibility_mode'] ? true : false
|
275 |
] );
|
276 |
|
277 |
-
wp_enqueue_style( 'acf-input-microtip', "
|
278 |
-
wp_enqueue_style( 'acf-input-font-awesome', "
|
279 |
|
280 |
if ( apply_filters( 'ACFFA_admin_enqueue_fa', true ) ) {
|
281 |
$fa_url = apply_filters( 'ACFFA_get_fa_url', '' );
|
@@ -302,7 +301,7 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
|
|
302 |
if ( stristr( $fa_url, 'https://kit.fontawesome.com/' ) ) {
|
303 |
wp_enqueue_script( 'acffa_font-awesome-kit', $fa_url );
|
304 |
} else {
|
305 |
-
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0
|
306 |
wp_enqueue_style( 'acffa_font-awesome', $fa_url, [], $latest_version );
|
307 |
}
|
308 |
}
|
260 |
|
261 |
public function input_admin_enqueue_scripts()
|
262 |
{
|
|
|
263 |
$version = $this->settings['version'];
|
264 |
$options = get_option( 'acffa_settings' );
|
265 |
+
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0' );
|
266 |
|
267 |
if ( isset( $options['acffa_v5_compatibility_mode'] ) && $options['acffa_v5_compatibility_mode'] ) {
|
268 |
wp_enqueue_script( 'acffa_fontawesome-js-api', "https://use.fontawesome.com/releases/v$latest_version/js/all.js", [], $latest_version );
|
269 |
}
|
270 |
+
wp_enqueue_script( 'acf-input-font-awesome', ACFFA_PUBLIC_PATH . "assets/js/input-v6.js", [ 'acf-input' ], $version );
|
271 |
wp_localize_script( 'acf-input-font-awesome', 'ACFFA', [
|
272 |
'major_version' => ACFFA_MAJOR_VERSION,
|
273 |
'v5_compat_mode' => isset( $options['acffa_v5_compatibility_mode'] ) && $options['acffa_v5_compatibility_mode'] ? true : false
|
274 |
] );
|
275 |
|
276 |
+
wp_enqueue_style( 'acf-input-microtip', ACFFA_PUBLIC_PATH . "assets/inc/microtip/microtip.min.css", [], '1.0.0' );
|
277 |
+
wp_enqueue_style( 'acf-input-font-awesome', ACFFA_PUBLIC_PATH . "assets/css/input.css", [ 'acf-input' ], $version );
|
278 |
|
279 |
if ( apply_filters( 'ACFFA_admin_enqueue_fa', true ) ) {
|
280 |
$fa_url = apply_filters( 'ACFFA_get_fa_url', '' );
|
301 |
if ( stristr( $fa_url, 'https://kit.fontawesome.com/' ) ) {
|
302 |
wp_enqueue_script( 'acffa_font-awesome-kit', $fa_url );
|
303 |
} else {
|
304 |
+
$latest_version = apply_filters( 'ACFFA_get_latest_version', '6.0.0' );
|
305 |
wp_enqueue_style( 'acffa_font-awesome', $fa_url, [], $latest_version );
|
306 |
}
|
307 |
}
|
readme.txt
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
=== Advanced Custom Fields: Font Awesome Field ===
|
2 |
Contributors: mattkeys
|
3 |
Tags: Advanced Custom Fields, ACF, Font Awesome, FontAwesome
|
@@ -29,10 +30,41 @@ This ACF field type is compatible with:
|
|
29 |
|
30 |
== Installation ==
|
31 |
|
|
|
|
|
32 |
1. Copy the `advanced-custom-fields-font-awesome` folder into your `wp-content/plugins` folder
|
33 |
2. Activate the Font Awesome plugin via the plugins admin page
|
34 |
3. Create a new field via ACF and select the Font Awesome type
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
== Optional Configuration ==
|
37 |
|
38 |
=== Filters ===
|
@@ -50,6 +82,11 @@ This ACF field type is compatible with:
|
|
50 |
|
51 |
== Changelog ==
|
52 |
|
|
|
|
|
|
|
|
|
|
|
53 |
= 4.0.0 =
|
54 |
* Added support for FontAwesome 6 icons
|
55 |
* Added support for FontAwesome Kits including Custom Uploaded Icons
|
@@ -191,34 +228,14 @@ This ACF field type is compatible with:
|
|
191 |
|
192 |
== Upgrade Notice ==
|
193 |
|
|
|
|
|
|
|
|
|
|
|
194 |
= 4.0.0 =
|
195 |
* Added support for FontAwesome 6 icons
|
196 |
* Added support for FontAwesome Kits including Custom Uploaded Icons
|
197 |
* Now utilizes the FontAwesome GraphQL API for quicker searching, fuzzy matching
|
198 |
* Added new compatibility mode to make updating from v4 and v5 icons easier
|
199 |
|
200 |
-
= 3.1.2 =
|
201 |
-
* Fixed compatibility issue with ACF 5.10+
|
202 |
-
* Fixed deprecated warnings in PHP 8, thanks to Levi Cole for the pull request
|
203 |
-
|
204 |
-
= 3.1.1 =
|
205 |
-
* Fixed bug where Duotone icons were not available to existing users of this plugin due to cached versions of the icons from before this plugin could properly parse the duotone icons.
|
206 |
-
|
207 |
-
= 3.1.0 =
|
208 |
-
* Added support for new FontAwesome Duotone icons (FontAwesome Pro subscription required)
|
209 |
-
* Added support for ACF 'acf/settings/capability' filter on the settings page
|
210 |
-
|
211 |
-
= 3.0.2 =
|
212 |
-
* Fixed bug causing PHP warning of undefined constant
|
213 |
-
|
214 |
-
= 3.0.1 =
|
215 |
-
* Fixed bug where the FontAwesome field would not successfully register on sites which force ACF to initialize itself early (usually by calling get_field function in the theme functions.php file)
|
216 |
-
|
217 |
-
= 3.0.0 =
|
218 |
-
* NOTE: When upgrading from a previous version of this plugin, the FontAwesome 'major version' will remain at v4 to stay compatible with existing integrations. *HOWEVER* if you are upgrading from a very old version of this plugin, it may not be possible to detect the former installation, and you will need to manually configure this plugin to use FontAwesome v4 in the new settings admin area.
|
219 |
-
* Added support for new FontAwesome 5.x free and pro icon sets
|
220 |
-
* Added new 'custom icon set' builder which allows FontAwesome ACF fields to be created with a limited set of icons individually selected from the full list of FontAwesome icons. Example: Create a custom icon set limited to just the social media brand icons
|
221 |
-
* Added new field options to to limit which of the icon sets ( Brands, Regular, Lite, Solid ) you want to allow in the field (applies to FontAwesome v5 only)
|
222 |
-
* Adding new FontAwesome Settings admin menu under the ACF primary menu area for global configuration options.
|
223 |
-
* Page load performance improvements (don't load icons in field constructor)
|
224 |
-
* Removing support for ACF v4 now that v5 is out with a free version
|
1 |
+
|
2 |
=== Advanced Custom Fields: Font Awesome Field ===
|
3 |
Contributors: mattkeys
|
4 |
Tags: Advanced Custom Fields, ACF, Font Awesome, FontAwesome
|
30 |
|
31 |
== Installation ==
|
32 |
|
33 |
+
Typical Installation:
|
34 |
+
|
35 |
1. Copy the `advanced-custom-fields-font-awesome` folder into your `wp-content/plugins` folder
|
36 |
2. Activate the Font Awesome plugin via the plugins admin page
|
37 |
3. Create a new field via ACF and select the Font Awesome type
|
38 |
|
39 |
+
Theme Installation:
|
40 |
+
|
41 |
+
If you are a theme author who wants to bundle this plugin with your theme, starting in version 4.0.1 this plugin has been designed to work from within a theme directory.
|
42 |
+
|
43 |
+
It is still more ideal to use something like [TGM Plugin Activation](http://tgmpluginactivation.com/) to include required/recommended plugins with your theme. However if you choose to bundle this plugin please follow these instructions:
|
44 |
+
|
45 |
+
1. Copy the 'advanced-custom-fields-font-awesome' folder into your theme folder. Preferably into a path like 'includes/advanced-custom-fields-font-awesome'
|
46 |
+
2. Include the plugin from your theme functions.php. Example: `include_once( get_stylesheet_directory() . '/includes/advanced-custom-fields-font-awesome/acf-font-awesome.php' );
|
47 |
+
`
|
48 |
+
|
49 |
+
***Plugins included this way are not able to receive regular plugin updates. It is up to theme developer to instead release these plugin updates to their users.***
|
50 |
+
|
51 |
+
However this plugin does attempt to let the user know if they are on an out of date version of the plugin. Out of date theme installations show an admin notification message at the top of the WordPress admin plugins page. The message is as follows:
|
52 |
+
|
53 |
+
> There is a new version of Advanced Custom Fields: Font Awesome available. Installed Version: {current_version}, Latest Version: {latest_version}
|
54 |
+
>
|
55 |
+
> It looks like this plugin is bundled with your theme: ({theme_name}) and is not able to receive updates. It is recommended that you contact your theme author for updates. Alternatively you can install this plugin through the WordPress Plugin Repository to get the latest version.
|
56 |
+
|
57 |
+
If the user installs this plugin from the plugin repository, that version of the plugin will override the one installed in their theme directory.
|
58 |
+
|
59 |
+
This notification message is filterable so you can customize it to better represent how you handle plugin updates for your theme users. See example below:
|
60 |
+
|
61 |
+
function my_acffa_update_message( $out_of_date_message, $current_version, $latest_version ) {
|
62 |
+
// Customize the message here
|
63 |
+
return $out_of_date_message;
|
64 |
+
}
|
65 |
+
add_filter( 'ACFFA_theme_install_update_message', 'my_acffa_update_message', 10, 3 );
|
66 |
+
|
67 |
+
|
68 |
== Optional Configuration ==
|
69 |
|
70 |
=== Filters ===
|
82 |
|
83 |
== Changelog ==
|
84 |
|
85 |
+
= 4.0.1 =
|
86 |
+
* Fixed bug where FontAwesome settings page would not properly load CSS/JS assets on internationalized WordPress installations.
|
87 |
+
* Added support for theme authors to bundle this plugin with a theme ( see install instructions )
|
88 |
+
* Increased 'fallback' FontAwesome 6 version number to match the 6.0.0 release
|
89 |
+
|
90 |
= 4.0.0 =
|
91 |
* Added support for FontAwesome 6 icons
|
92 |
* Added support for FontAwesome Kits including Custom Uploaded Icons
|
228 |
|
229 |
== Upgrade Notice ==
|
230 |
|
231 |
+
= 4.0.1 =
|
232 |
+
* Fixed bug where FontAwesome settings page would not properly load CSS/JS assets on internationalized WordPress installations.
|
233 |
+
* Added support for theme authors to bundle this plugin with a theme ( see install instructions )
|
234 |
+
* Increased 'fallback' FontAwesome 6 version number to match the 6.0.0 release
|
235 |
+
|
236 |
= 4.0.0 =
|
237 |
* Added support for FontAwesome 6 icons
|
238 |
* Added support for FontAwesome Kits including Custom Uploaded Icons
|
239 |
* Now utilizes the FontAwesome GraphQL API for quicker searching, fuzzy matching
|
240 |
* Added new compatibility mode to make updating from v4 and v5 icons easier
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|