Advanced Custom Fields: Font Awesome Field - Version 3.0.0-rc1

Version Description

  • Added new 'ACFFA_override_major_version' filter
  • Fixed logic to auto-select FontAwesome 4.x or 5.x depending on if 4.x was being used in a previous version of this plugin
  • Added admin notice to let people know about the FontAwesome Settings page
Download this release

Release Info

Developer mattkeys
Plugin Icon 128x128 Advanced Custom Fields: Font Awesome Field
Version 3.0.0-rc1
Comparing to
See all releases

Code changes from version 3.0.0-beta3 to 3.0.0-rc1

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: 3.0.0-beta3
8
  Author: mattkeys
9
  Author URI: http://mattkeys.me/
10
  License: GPLv2 or later
@@ -15,54 +15,94 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
16
  }
17
 
 
 
 
 
18
  if ( ! defined( 'ACFFA_PUBLIC_PATH' ) ) {
19
  define( 'ACFFA_PUBLIC_PATH', plugin_dir_url( __FILE__ ) );
20
  }
21
 
 
 
 
 
22
  if ( is_admin() ) {
23
  require 'admin/class-ACFFA-Admin.php';
24
  }
25
 
26
  if ( ! class_exists('acf_plugin_font_awesome') ) :
27
 
28
- $acffa_settings = get_option( 'acffa_settings' );
29
- $acffa_major_version = isset( $acffa_settings['acffa_major_version'] ) ? intval( $acffa_settings['acffa_major_version'] ) : 4;
30
-
31
- define( 'ACFFA_MAJOR_VERSION', $acffa_major_version );
32
-
33
- if ( version_compare( $acffa_major_version, 5, '<' ) ) {
34
- require 'assets/inc/class-ACFFA-Loader-4.php';
35
- } else {
36
- require 'assets/inc/class-ACFFA-Loader-5.php';
37
- }
38
-
39
  class acf_plugin_font_awesome {
40
 
41
- public function __construct()
42
  {
 
 
 
 
 
 
 
 
43
  $this->settings = array(
44
- 'version' => '3.0.0-beta3',
45
  'url' => plugin_dir_url( __FILE__ ),
46
  'path' => plugin_dir_path( __FILE__ )
47
  );
48
 
49
  load_plugin_textdomain( 'acf-font-awesome', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' );
50
 
51
- add_action('acf/include_field_types', array($this, 'include_field_types'), 10 ); // v5
52
  }
53
 
54
  public function include_field_types( $version = false )
55
  {
56
- if ( ! $version ) {
57
- $version = 5;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  }
59
 
60
- include_once('fields/acf-font-awesome-v' . $version . '.php');
61
-
 
 
 
 
 
 
62
  }
63
-
64
  }
65
 
66
- new acf_plugin_font_awesome();
67
 
68
  endif;
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: 3.0.0-rc1
8
  Author: mattkeys
9
  Author URI: http://mattkeys.me/
10
  License: GPLv2 or later
15
  exit;
16
  }
17
 
18
+ if ( ! defined( 'ACFFA_VERSION' ) ) {
19
+ define( 'ACFFA_VERSION', '3.0.0-rc1' );
20
+ }
21
+
22
  if ( ! defined( 'ACFFA_PUBLIC_PATH' ) ) {
23
  define( 'ACFFA_PUBLIC_PATH', plugin_dir_url( __FILE__ ) );
24
  }
25
 
26
+ if ( ! defined( 'ACFFA_BASENAME' ) ) {
27
+ define( 'ACFFA_BASENAME', plugin_basename( __FILE__ ) );
28
+ }
29
+
30
  if ( is_admin() ) {
31
  require 'admin/class-ACFFA-Admin.php';
32
  }
33
 
34
  if ( ! class_exists('acf_plugin_font_awesome') ) :
35
 
 
 
 
 
 
 
 
 
 
 
 
36
  class acf_plugin_font_awesome {
37
 
38
+ public function init()
39
  {
40
+ $acffa_major_version = $this->get_major_version();
41
+
42
+ if ( version_compare( $acffa_major_version, 5, '<' ) ) {
43
+ require 'assets/inc/class-ACFFA-Loader-4.php';
44
+ } else {
45
+ require 'assets/inc/class-ACFFA-Loader-5.php';
46
+ }
47
+
48
  $this->settings = array(
49
+ 'version' => ACFFA_VERSION,
50
  'url' => plugin_dir_url( __FILE__ ),
51
  'path' => plugin_dir_path( __FILE__ )
52
  );
53
 
54
  load_plugin_textdomain( 'acf-font-awesome', false, plugin_basename( dirname( __FILE__ ) ) . '/lang' );
55
 
56
+ add_action( 'acf/include_field_types', array( $this, 'include_field_types' ), 10 );
57
  }
58
 
59
  public function include_field_types( $version = false )
60
  {
61
+ include_once('fields/acf-font-awesome-v5.php');
62
+ }
63
+
64
+ public function get_major_version()
65
+ {
66
+ $current_version = get_option( 'ACFFA_current_version' );
67
+ $acffa_settings = get_option( 'acffa_settings', array() );
68
+ $default_version = ( $current_version && empty( $acffa_settings ) ) ? 4 : 5;
69
+
70
+ $acffa_major_version = isset( $acffa_settings['acffa_major_version'] ) ? intval( $acffa_settings['acffa_major_version'] ) : $default_version;
71
+ $override_major_version = (int) apply_filters( 'ACFFA_override_major_version', false );
72
+ if ( $override_major_version ) {
73
+ $override_major_version = floor( $override_major_version );
74
+
75
+ if ( 4 == $override_major_version || 5 == $override_major_version ) {
76
+ if ( $acffa_major_version !== $override_major_version ) {
77
+ $acffa_settings['acffa_major_version'] = $override_major_version;
78
+ update_option( 'acffa_settings', $acffa_settings, false );
79
+
80
+ do_action( 'ACFFA_refresh_latest_icons' );
81
+
82
+ $acffa_major_version = $override_major_version;
83
+ }
84
+
85
+ if ( ! defined( 'ACFFA_OVERRIDE_MAJOR_VERSION' ) ) {
86
+ define( 'ACFFA_OVERRIDE_MAJOR_VERSION', true );
87
+ }
88
+ }
89
+ }
90
+
91
+ if ( ! defined( 'ACFFA_MAJOR_VERSION' ) ) {
92
+ define( 'ACFFA_MAJOR_VERSION', $acffa_major_version );
93
  }
94
 
95
+ if ( ! isset( $acffa_settings['acffa_major_version'] ) ) {
96
+ $acffa_settings['acffa_major_version'] = $acffa_major_version;
97
+ $acffa_settings['acffa_plugin_version'] = ACFFA_VERSION;
98
+ $acffa_settings['show_upgrade_notice'] = true;
99
+ update_option( 'acffa_settings', $acffa_settings, false );
100
+ }
101
+
102
+ return $acffa_major_version;
103
  }
 
104
  }
105
 
106
+ add_action( 'after_setup_theme', array( new acf_plugin_font_awesome, 'init' ), 0 );
107
 
108
  endif;
admin/class-ACFFA-Admin.php CHANGED
@@ -17,8 +17,10 @@ class ACFFA_Admin
17
  {
18
  $this->version = 'v' . ACFFA_MAJOR_VERSION;
19
 
 
20
  add_action( 'admin_notices', array( $this, 'maybe_notify_cdn_error' ) );
21
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
 
22
  add_action( 'admin_menu', array( $this, 'add_settings_page' ), 100 );
23
  add_action( 'admin_init', array( $this, 'register_settings' ) );
24
  add_filter( 'pre_update_option_acffa_settings', array( $this, 'intercept_icon_set_save' ), 10, 2 );
@@ -26,6 +28,21 @@ class ACFFA_Admin
26
  add_action( 'wp_ajax_ACFFA_delete_icon_set', array( $this, 'ajax_remove_icon_set' ) );
27
  }
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  public function maybe_notify_cdn_error()
30
  {
31
  if ( ! get_option( 'ACFFA_cdn_error' ) ) {
@@ -36,7 +53,7 @@ class ACFFA_Admin
36
  $curl_info = curl_version();
37
  ?>
38
  <div class="notice notice-error is-dismissible">
39
- <p><?php echo __( 'The plugin "Advanced Custom Fields: Font Awesome" has detected an error while retrieving the latest FontAwesome icons. This may be due to temporary CDN downtime. However if problems persist, please contact your hosting provider to ensure cURL is installed and up to date. Detected cURL version: ', 'acf-font-awesome' ) . $curl_info['version']; ?></p>
40
  </div>
41
  <?php
42
  }
@@ -60,9 +77,19 @@ class ACFFA_Admin
60
  ));
61
  }
62
 
 
 
 
 
 
 
 
 
 
 
 
63
  public function add_settings_page()
64
  {
65
- // ACF v5.x
66
  add_submenu_page(
67
  'edit.php?post_type=acf-field-group',
68
  'FontAwesome Settings',
@@ -71,16 +98,6 @@ class ACFFA_Admin
71
  'fontawesome-settings',
72
  array( $this, 'fontawesome_settings' )
73
  );
74
-
75
- // ACF v4.x
76
- add_submenu_page(
77
- 'edit.php?post_type=acf',
78
- 'FontAwesome Settings',
79
- 'FontAwesome Settings',
80
- 'manage_options',
81
- 'fontawesome-settings',
82
- array( $this, 'fontawesome_settings' )
83
- );
84
  }
85
 
86
  public function fontawesome_settings()
@@ -148,6 +165,18 @@ class ACFFA_Admin
148
  )
149
  );
150
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  add_settings_section(
152
  'acffa_section_icon_set_builder',
153
  __( 'Icon Set Builder', 'acf-font-awesome' ),
@@ -231,8 +260,9 @@ class ACFFA_Admin
231
  public function acffa_major_version_cb( $args )
232
  {
233
  $options = get_option( 'acffa_settings' );
 
234
  ?>
235
- <select id="<?php echo esc_attr( $args['label_for'] ); ?>" name="acffa_settings[<?php echo esc_attr( $args['label_for'] ); ?>]">
236
  <option value="4" <?php echo isset( $options[ $args[ 'label_for'] ] ) ? ( selected( $options[ $args[ 'label_for'] ], 4, false ) ) : ( '' ); ?>>
237
  <?php _e( '4.x', 'acf-font-awesome' ); ?>
238
  </option>
@@ -241,6 +271,13 @@ class ACFFA_Admin
241
  </option>
242
  </select>
243
  <?php
 
 
 
 
 
 
 
244
  }
245
 
246
  public function acffa_pro_cdn_cb( $args )
@@ -259,6 +296,13 @@ class ACFFA_Admin
259
  <?php
260
  }
261
 
 
 
 
 
 
 
 
262
  public function acffa_section_icon_set_builder_cb( $args )
263
  {
264
  ?>
@@ -397,6 +441,9 @@ class ACFFA_Admin
397
 
398
  public function maybe_refresh_icons( $new_value, $old_value )
399
  {
 
 
 
400
  $refresh_icons = false;
401
 
402
  if ( $new_value['acffa_major_version'] !== $old_value['acffa_major_version'] ) {
@@ -503,4 +550,4 @@ class ACFFA_Admin
503
 
504
  }
505
 
506
- add_action( 'plugins_loaded', array( new ACFFA_Admin, 'init' ) );
17
  {
18
  $this->version = 'v' . ACFFA_MAJOR_VERSION;
19
 
20
+ add_action( 'admin_notices', array( $this, 'show_upgrade_notice' ) );
21
  add_action( 'admin_notices', array( $this, 'maybe_notify_cdn_error' ) );
22
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
23
+ add_filter( 'plugin_action_links', array( $this, 'add_settings_link' ), 10, 2 );
24
  add_action( 'admin_menu', array( $this, 'add_settings_page' ), 100 );
25
  add_action( 'admin_init', array( $this, 'register_settings' ) );
26
  add_filter( 'pre_update_option_acffa_settings', array( $this, 'intercept_icon_set_save' ), 10, 2 );
28
  add_action( 'wp_ajax_ACFFA_delete_icon_set', array( $this, 'ajax_remove_icon_set' ) );
29
  }
30
 
31
+ public function show_upgrade_notice()
32
+ {
33
+ $acffa_settings = get_option( 'acffa_settings' );
34
+ if ( ! isset( $acffa_settings['show_upgrade_notice'] ) ) {
35
+ return;
36
+ }
37
+ ?>
38
+ <div class="notice notice-info is-dismissible">
39
+ <p><?php echo sprintf( __( 'Visit the new ACF <a href="%s">FontAwesome Settings</a> page to change FontAwesome icon version, or to create custom icon sets.', 'acf-font-awesome' ), admin_url( '/edit.php?post_type=acf-field-group&page=fontawesome-settings' ) ); ?></p>
40
+ </div>
41
+ <?php
42
+ unset( $acffa_settings['show_upgrade_notice'] );
43
+ update_option( 'acffa_settings', $acffa_settings, false );
44
+ }
45
+
46
  public function maybe_notify_cdn_error()
47
  {
48
  if ( ! get_option( 'ACFFA_cdn_error' ) ) {
53
  $curl_info = curl_version();
54
  ?>
55
  <div class="notice notice-error is-dismissible">
56
+ <p><?php _e( 'The plugin "Advanced Custom Fields: Font Awesome" has detected an error while retrieving the latest FontAwesome icons. This may be due to temporary CDN downtime. However if problems persist, please contact your hosting provider to ensure cURL is installed and up to date. Detected cURL version: ', 'acf-font-awesome' ) . $curl_info['version']; ?></p>
57
  </div>
58
  <?php
59
  }
77
  ));
78
  }
79
 
80
+ public function add_settings_link( $links, $file )
81
+ {
82
+ if ( $file != ACFFA_BASENAME ) {
83
+ return $links;
84
+ }
85
+
86
+ array_unshift( $links, '<a href="' . esc_url( admin_url( '/edit.php?post_type=acf-field-group&page=fontawesome-settings' ) ) . '">' . esc_html__( 'Settings', 'acf-font-awesome' ) . '</a>' );
87
+
88
+ return $links;
89
+ }
90
+
91
  public function add_settings_page()
92
  {
 
93
  add_submenu_page(
94
  'edit.php?post_type=acf-field-group',
95
  'FontAwesome Settings',
98
  'fontawesome-settings',
99
  array( $this, 'fontawesome_settings' )
100
  );
 
 
 
 
 
 
 
 
 
 
101
  }
102
 
103
  public function fontawesome_settings()
165
  )
166
  );
167
 
168
+ add_settings_field(
169
+ 'acffa_plugin_version',
170
+ 'Plugin Version',
171
+ array( $this, 'acffa_plugin_version_cb' ),
172
+ 'acffa',
173
+ 'acffa_section_developers',
174
+ array(
175
+ 'label_for' => 'acffa_plugin_version',
176
+ 'class' => 'acffa_row hidden'
177
+ )
178
+ );
179
+
180
  add_settings_section(
181
  'acffa_section_icon_set_builder',
182
  __( 'Icon Set Builder', 'acf-font-awesome' ),
260
  public function acffa_major_version_cb( $args )
261
  {
262
  $options = get_option( 'acffa_settings' );
263
+ $attributes = defined( 'ACFFA_OVERRIDE_MAJOR_VERSION' ) ? 'disabled' : false;
264
  ?>
265
+ <select <?php echo $attributes; ?> id="<?php echo esc_attr( $args['label_for'] ); ?>" name="acffa_settings[<?php echo esc_attr( $args['label_for'] ); ?>]">
266
  <option value="4" <?php echo isset( $options[ $args[ 'label_for'] ] ) ? ( selected( $options[ $args[ 'label_for'] ], 4, false ) ) : ( '' ); ?>>
267
  <?php _e( '4.x', 'acf-font-awesome' ); ?>
268
  </option>
271
  </option>
272
  </select>
273
  <?php
274
+ if ( defined( 'ACFFA_OVERRIDE_MAJOR_VERSION' ) ) :
275
+ ?>
276
+ <p>
277
+ <em><?php _e( 'The major version is manually set with the "ACFFA_override_major_version" filter, and cannot be modified from this screen. Please remove or update the filter to make changes.', 'acf-font-awesome' ); ?></em>
278
+ </p>
279
+ <?php
280
+ endif;
281
  }
282
 
283
  public function acffa_pro_cdn_cb( $args )
296
  <?php
297
  }
298
 
299
+ public function acffa_plugin_version_cb( $args )
300
+ {
301
+ ?>
302
+ <input type="hidden" value="<?php echo ACFFA_VERSION; ?>" id="<?php echo esc_attr( $args['label_for'] ); ?>" name="acffa_settings[<?php echo esc_attr( $args['label_for'] ); ?>]" />
303
+ <?php
304
+ }
305
+
306
  public function acffa_section_icon_set_builder_cb( $args )
307
  {
308
  ?>
441
 
442
  public function maybe_refresh_icons( $new_value, $old_value )
443
  {
444
+ unset( $new_value['acffa_new_icon_set_label'] );
445
+ unset( $new_value['acffa_new_icon_set'] );
446
+
447
  $refresh_icons = false;
448
 
449
  if ( $new_value['acffa_major_version'] !== $old_value['acffa_major_version'] ) {
550
 
551
  }
552
 
553
+ add_action( 'after_setup_theme', array( new ACFFA_Admin, 'init' ), 10 );
assets/inc/class-ACFFA-Loader-4.php CHANGED
@@ -19,7 +19,6 @@ class ACFFA_Loader_4
19
  public $api_endpoint = 'https://data.jsdelivr.com/v1/package/resolve/gh/FortAwesome/Font-Awesome@4';
20
  public $cdn_baseurl = 'https://cdn.jsdelivr.net/fontawesome/';
21
  public $cdn_filepath = '/css/font-awesome.min.css';
22
- public $override_version = false;
23
  public $current_version = false;
24
  private $version;
25
 
@@ -29,17 +28,14 @@ class ACFFA_Loader_4
29
  $this->api_endpoint = apply_filters( 'ACFFA_api_endpoint', $this->api_endpoint );
30
  $this->cdn_baseurl = apply_filters( 'ACFFA_cdn_baseurl', $this->cdn_baseurl );
31
  $this->cdn_filepath = apply_filters( 'ACFFA_cdn_filepath', $this->cdn_filepath );
32
- $this->override_version = apply_filters( 'ACFFA_override_version', false );
33
 
34
  $this->current_version = get_option( 'ACFFA_current_version' );
35
 
36
- if ( $this->override_version ) {
37
- $this->current_version = $this->override_version;
38
- } else if ( ! $this->current_version || version_compare( $this->current_version, '5.0.0', '>=' ) ) {
39
  $this->current_version = $this->check_latest_version();
40
  }
41
 
42
- if ( ! $this->override_version && ! wp_next_scheduled ( 'ACFFA_refresh_latest_icons' ) ) {
43
  wp_schedule_event( time(), 'daily', 'ACFFA_refresh_latest_icons' );
44
  }
45
 
@@ -120,10 +116,6 @@ class ACFFA_Loader_4
120
 
121
  public function refresh_latest_icons()
122
  {
123
- if ( $this->override_version ) {
124
- return;
125
- }
126
-
127
  $latest_version = $this->check_latest_version( false );
128
 
129
  if ( ! $this->current_version || ! $latest_version ) {
19
  public $api_endpoint = 'https://data.jsdelivr.com/v1/package/resolve/gh/FortAwesome/Font-Awesome@4';
20
  public $cdn_baseurl = 'https://cdn.jsdelivr.net/fontawesome/';
21
  public $cdn_filepath = '/css/font-awesome.min.css';
 
22
  public $current_version = false;
23
  private $version;
24
 
28
  $this->api_endpoint = apply_filters( 'ACFFA_api_endpoint', $this->api_endpoint );
29
  $this->cdn_baseurl = apply_filters( 'ACFFA_cdn_baseurl', $this->cdn_baseurl );
30
  $this->cdn_filepath = apply_filters( 'ACFFA_cdn_filepath', $this->cdn_filepath );
 
31
 
32
  $this->current_version = get_option( 'ACFFA_current_version' );
33
 
34
+ if ( ! $this->current_version || version_compare( $this->current_version, '5.0.0', '>=' ) ) {
 
 
35
  $this->current_version = $this->check_latest_version();
36
  }
37
 
38
+ if ( ! wp_next_scheduled ( 'ACFFA_refresh_latest_icons' ) ) {
39
  wp_schedule_event( time(), 'daily', 'ACFFA_refresh_latest_icons' );
40
  }
41
 
116
 
117
  public function refresh_latest_icons()
118
  {
 
 
 
 
119
  $latest_version = $this->check_latest_version( false );
120
 
121
  if ( ! $this->current_version || ! $latest_version ) {
assets/inc/class-ACFFA-Loader-5.php CHANGED
@@ -25,7 +25,6 @@ class ACFFA_Loader_5
25
  private $free_manifest_url = 'http://cdn.jsdelivr.net/gh/mattkeys/FontAwesome-Free-Manifest/5.x/manifest.yml';
26
  private $pro_manifest_url = 'http://cdn.jsdelivr.net/gh/mattkeys/FontAwesome-Pro-Manifest/5.x/manifest.yml';
27
  private $cdn_filepath = '/css/all.css';
28
- private $override_version = false;
29
  private $current_version = false;
30
  private $pro_icons_enabled = false;
31
  private $active_icon_set = false;
@@ -51,18 +50,15 @@ class ACFFA_Loader_5
51
  $this->cdn_baseurl = apply_filters( 'ACFFA_cdn_baseurl', $this->cdn_baseurl );
52
  $this->manifest_url = apply_filters( 'ACFFA_manifest_url', $this->manifest_url );
53
  $this->cdn_filepath = apply_filters( 'ACFFA_cdn_filepath', $this->cdn_filepath );
54
- $this->override_version = apply_filters( 'ACFFA_override_version', false );
55
 
56
  $this->current_version = get_option( 'ACFFA_current_version' );
57
  $this->active_icon_set = get_option( 'ACFFA_active_icon_set' );
58
 
59
- if ( $this->override_version ) {
60
- $this->current_version = $this->override_version;
61
- } else if ( ! $this->current_version || version_compare( $this->current_version, '5.0.0', '<' ) || ! $this->active_icon_set || ( $this->pro_icons_enabled && 'pro' !== $this->active_icon_set ) || ( ! $this->pro_icons_enabled && 'free' !== $this->active_icon_set ) ) {
62
  $this->current_version = $this->check_latest_version();
63
  }
64
 
65
- if ( ! $this->override_version && ! wp_next_scheduled ( 'ACFFA_refresh_latest_icons' ) ) {
66
  wp_schedule_event( time(), 'daily', 'ACFFA_refresh_latest_icons' );
67
  }
68
 
@@ -157,10 +153,6 @@ class ACFFA_Loader_5
157
 
158
  public function refresh_latest_icons()
159
  {
160
- if ( $this->override_version ) {
161
- return;
162
- }
163
-
164
  $latest_version = $this->check_latest_version( false );
165
 
166
  if ( ! $this->current_version || ! $latest_version ) {
25
  private $free_manifest_url = 'http://cdn.jsdelivr.net/gh/mattkeys/FontAwesome-Free-Manifest/5.x/manifest.yml';
26
  private $pro_manifest_url = 'http://cdn.jsdelivr.net/gh/mattkeys/FontAwesome-Pro-Manifest/5.x/manifest.yml';
27
  private $cdn_filepath = '/css/all.css';
 
28
  private $current_version = false;
29
  private $pro_icons_enabled = false;
30
  private $active_icon_set = false;
50
  $this->cdn_baseurl = apply_filters( 'ACFFA_cdn_baseurl', $this->cdn_baseurl );
51
  $this->manifest_url = apply_filters( 'ACFFA_manifest_url', $this->manifest_url );
52
  $this->cdn_filepath = apply_filters( 'ACFFA_cdn_filepath', $this->cdn_filepath );
 
53
 
54
  $this->current_version = get_option( 'ACFFA_current_version' );
55
  $this->active_icon_set = get_option( 'ACFFA_active_icon_set' );
56
 
57
+ if ( ! $this->current_version || version_compare( $this->current_version, '5.0.0', '<' ) || ! $this->active_icon_set || ( $this->pro_icons_enabled && 'pro' !== $this->active_icon_set ) || ( ! $this->pro_icons_enabled && 'free' !== $this->active_icon_set ) ) {
 
 
58
  $this->current_version = $this->check_latest_version();
59
  }
60
 
61
+ if ( ! wp_next_scheduled ( 'ACFFA_refresh_latest_icons' ) ) {
62
  wp_schedule_event( time(), 'daily', 'ACFFA_refresh_latest_icons' );
63
  }
64
 
153
 
154
  public function refresh_latest_icons()
155
  {
 
 
 
 
156
  $latest_version = $this->check_latest_version( false );
157
 
158
  if ( ! $this->current_version || ! $latest_version ) {
readme.txt CHANGED
@@ -42,6 +42,7 @@ This ACF field type is compatible with:
42
  * **ACFFA_admin_enqueue_fa**: Return false to stop enqueueing FontAwesome in the admin area. Useful if you already have FontAwesome enqueued by some other means.
43
  * **ACFFA_get_icons**: Filter the array of icons and icon details loaded from the database
44
  * **ACFFA_get_fa_url**: Filter the URL used for enqueuing FontAwesome in the frontend and admin areas of the site.
 
45
 
46
  == Screenshots ==
47
 
@@ -50,6 +51,11 @@ This ACF field type is compatible with:
50
 
51
  == Changelog ==
52
 
 
 
 
 
 
53
  = 3.0.0-beta3 =
54
  * 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
55
  * Added field options to FontAwesome v5 fields to limit which of the icon sets ( Brands, Regular, Lite, Solid ) you want to allow in the field
@@ -173,6 +179,11 @@ This ACF field type is compatible with:
173
 
174
  == Upgrade Notice ==
175
 
 
 
 
 
 
176
  = 3.0.0-beta3 =
177
  * 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
178
  * Added field options to FontAwesome v5 fields to limit which of the icon sets ( Brands, Regular, Lite, Solid ) you want to allow in the field
42
  * **ACFFA_admin_enqueue_fa**: Return false to stop enqueueing FontAwesome in the admin area. Useful if you already have FontAwesome enqueued by some other means.
43
  * **ACFFA_get_icons**: Filter the array of icons and icon details loaded from the database
44
  * **ACFFA_get_fa_url**: Filter the URL used for enqueuing FontAwesome in the frontend and admin areas of the site.
45
+ * **ACFFA_override_major_version**: Filter to manually set the 'major' version of FontAwesome to load (accepts either 4, or 5).
46
 
47
  == Screenshots ==
48
 
51
 
52
  == Changelog ==
53
 
54
+ = 3.0.0-rc1 =
55
+ * Added new 'ACFFA_override_major_version' filter
56
+ * Fixed logic to auto-select FontAwesome 4.x or 5.x depending on if 4.x was being used in a previous version of this plugin
57
+ * Added admin notice to let people know about the FontAwesome Settings page
58
+
59
  = 3.0.0-beta3 =
60
  * 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
61
  * Added field options to FontAwesome v5 fields to limit which of the icon sets ( Brands, Regular, Lite, Solid ) you want to allow in the field
179
 
180
  == Upgrade Notice ==
181
 
182
+ = 3.0.0-rc1 =
183
+ * Added new 'ACFFA_override_major_version' filter
184
+ * Fixed logic to auto-select FontAwesome 4.x or 5.x depending on if 4.x was being used in a previous version of this plugin
185
+ * Added admin notice to let people know about the FontAwesome Settings page
186
+
187
  = 3.0.0-beta3 =
188
  * 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
189
  * Added field options to FontAwesome v5 fields to limit which of the icon sets ( Brands, Regular, Lite, Solid ) you want to allow in the field
uninstall.php CHANGED
@@ -4,8 +4,21 @@ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
4
  die;
5
  }
6
 
 
 
7
  delete_option( 'ACFFA_icon_data' );
8
  delete_option( 'ACFFA_current_version' );
 
 
 
 
 
 
 
 
 
 
 
9
 
10
  $timestamp = wp_next_scheduled( 'ACFFA_refresh_latest_icons' );
11
 
4
  die;
5
  }
6
 
7
+ delete_option( 'acffa_settings' );
8
+ delete_option( 'ACFFA_cdn_error' );
9
  delete_option( 'ACFFA_icon_data' );
10
  delete_option( 'ACFFA_current_version' );
11
+ delete_option( 'ACFFA_active_icon_set' );
12
+
13
+ $ACFFA_custom_icon_sets_list = get_option( 'ACFFA_custom_icon_sets_list' );
14
+ if ( $ACFFA_custom_icon_sets_list ) {
15
+ foreach ( $ACFFA_custom_icon_sets_list as $version => $custom_icon_sets ) {
16
+ foreach ( $custom_icon_sets as $option_name => $list_label ) {
17
+ delete_option( $option_name );
18
+ }
19
+ }
20
+ delete_option( 'ACFFA_custom_icon_sets_list' );
21
+ }
22
 
23
  $timestamp = wp_next_scheduled( 'ACFFA_refresh_latest_icons' );
24