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

Version Description

  • Adding support for new FontAwesome 5.x free icon set
  • Adding new FontAwesome Settings admin menu under the ACF primary menu area for global configuration options.
  • Page load performance improvements (don't load icons in field constructor)
Download this release

Release Info

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

Code changes from version 2.1.2 to 3.0.0-beta1

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: 2.1.2
8
  Author: mattkeys
9
  Author URI: http://mattkeys.me/
10
  License: GPLv2 or later
@@ -15,16 +15,29 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
16
  }
17
 
 
 
 
 
18
  if ( ! class_exists('acf_plugin_font_awesome') ) :
19
 
20
- require 'assets/inc/class-ACFFAL.php';
 
 
 
 
 
 
 
 
 
21
 
22
  class acf_plugin_font_awesome {
23
 
24
  public function __construct()
25
  {
26
  $this->settings = array(
27
- 'version' => '2.1.2',
28
  'url' => plugin_dir_url( __FILE__ ),
29
  'path' => plugin_dir_path( __FILE__ )
30
  );
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-beta1
8
  Author: mattkeys
9
  Author URI: http://mattkeys.me/
10
  License: GPLv2 or later
15
  exit;
16
  }
17
 
18
+ if ( is_admin() ) {
19
+ require 'admin/class-ACFFA-Admin.php';
20
+ }
21
+
22
  if ( ! class_exists('acf_plugin_font_awesome') ) :
23
 
24
+ $acffa_settings = get_option( 'acffa_settings' );
25
+ $acffa_major_version = isset( $acffa_settings['acffa_major_version'] ) ? intval( $acffa_settings['acffa_major_version'] ) : 4;
26
+
27
+ define( 'ACFFA_MAJOR_VERSION', $acffa_major_version );
28
+
29
+ if ( version_compare( $acffa_major_version, 5, '<' ) ) {
30
+ require 'assets/inc/class-ACFFA-Loader-4.php';
31
+ } else {
32
+ require 'assets/inc/class-ACFFA-Loader-5.php';
33
+ }
34
 
35
  class acf_plugin_font_awesome {
36
 
37
  public function __construct()
38
  {
39
  $this->settings = array(
40
+ 'version' => '3.0.0-beta1',
41
  'url' => plugin_dir_url( __FILE__ ),
42
  'path' => plugin_dir_path( __FILE__ )
43
  );
admin/class-ACFFA-Admin.php ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * =======================================
4
+ * Advanced Custom Fields Font Awesome Admin
5
+ * =======================================
6
+ *
7
+ *
8
+ * @author Matt Keys <https://profiles.wordpress.org/mattkeys>
9
+ */
10
+
11
+ class ACFFA_Admin
12
+ {
13
+
14
+ public function init()
15
+ {
16
+ add_action( 'admin_menu', array( $this, 'add_settings_page' ), 100 );
17
+ add_action( 'admin_init', array( $this, 'register_settings' ) );
18
+ }
19
+
20
+ public function add_settings_page()
21
+ {
22
+ // ACF v5.x
23
+ add_submenu_page(
24
+ 'edit.php?post_type=acf-field-group',
25
+ 'FontAwesome Settings',
26
+ 'FontAwesome Settings',
27
+ 'manage_options',
28
+ 'fontawesome-settings',
29
+ array( $this, 'fontawesome_settings' )
30
+ );
31
+
32
+ // ACF v4.x
33
+ add_submenu_page(
34
+ 'edit.php?post_type=acf',
35
+ 'FontAwesome Settings',
36
+ 'FontAwesome Settings',
37
+ 'manage_options',
38
+ 'fontawesome-settings',
39
+ array( $this, 'fontawesome_settings' )
40
+ );
41
+ }
42
+
43
+ public function fontawesome_settings()
44
+ {
45
+ if ( isset( $_GET['settings-updated'] ) ) {
46
+ add_settings_error( 'acffa_messages', 'acffa_message', __( 'Settings Saved', 'acf-font-awesome' ), 'updated' );
47
+ }
48
+
49
+ settings_errors( 'acffa_messages' );
50
+ ?>
51
+ <div class="wrap">
52
+ <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
53
+ <form action="options.php" method="post">
54
+ <?php
55
+ settings_fields( 'acffa' );
56
+
57
+ do_settings_sections( 'acffa' );
58
+
59
+ submit_button( 'Save Settings' );
60
+ ?>
61
+ </form>
62
+ </div>
63
+ <?php
64
+ }
65
+
66
+ public function register_settings()
67
+ {
68
+ register_setting( 'acffa', 'acffa_settings' );
69
+
70
+ add_settings_section(
71
+ 'acffa_section_developers',
72
+ __( 'Major Version', 'acf-font-awesome' ),
73
+ array( $this, 'acffa_section_developers_cb' ),
74
+ 'acffa'
75
+ );
76
+
77
+ add_settings_field(
78
+ 'acffa_major_version',
79
+ __( 'Version', 'acf-font-awesome' ),
80
+ array( $this, 'acffa_major_version_cb' ),
81
+ 'acffa',
82
+ 'acffa_section_developers',
83
+ array(
84
+ 'label_for' => 'acffa_major_version',
85
+ 'class' => 'acffa_row'
86
+ )
87
+ );
88
+ }
89
+
90
+ public function acffa_section_developers_cb( $args )
91
+ {
92
+ ?>
93
+ <p id="<?php echo esc_attr( $args['id'] ); ?>">
94
+ <?php esc_html_e( 'FontAwesome underwent big changes with the release of version 5. It is best to choose a version and stick with it.', 'acf-font-awesome' ); ?><br />
95
+ <em><?php _e( 'Any icon selections saved prior to switching versions will need to be re-selected and re-saved after switching.', 'acf-font-awesome' ); ?></em>
96
+ </p>
97
+ <?php
98
+ }
99
+
100
+ public function acffa_major_version_cb( $args )
101
+ {
102
+ $options = get_option( 'acffa_settings' );
103
+ ?>
104
+ <select id="<?php echo esc_attr( $args['label_for'] ); ?>" name="acffa_settings[<?php echo esc_attr( $args['label_for'] ); ?>]">
105
+ <option value="4" <?php echo isset( $options[ $args[ 'label_for'] ] ) ? ( selected( $options[ $args[ 'label_for'] ], 4, false ) ) : ( '' ); ?>>
106
+ <?php esc_html_e( '4.x', 'acf-font-awesome' ); ?>
107
+ </option>
108
+ <option value="5" <?php echo isset( $options[ $args[ 'label_for'] ] ) ? ( selected( $options[ $args[ 'label_for'] ], 5, false ) ) : ( '' ); ?>>
109
+ <?php esc_html_e( '5.x', 'acf-font-awesome' ); ?>
110
+ </option>
111
+ </select>
112
+ <?php
113
+ }
114
+
115
+ }
116
+
117
+ add_action( 'plugins_loaded', array( new ACFFA_Admin, 'init' ) );
assets/css/input.css CHANGED
@@ -13,9 +13,38 @@
13
  margin: 0 0 10px 0;
14
  }
15
 
16
- .field_option_font-awesome .chosen-container,
17
- .field_type-font-awesome .chosen-container,
18
- .fa-select2,
19
- .fa-select2-drop {
20
  font-family: FontAwesome,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
21
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  margin: 0 0 10px 0;
14
  }
15
 
16
+ .field_option_font-awesome .chosen-container.fa4,
17
+ .field_type-font-awesome .chosen-container.fa4,
18
+ .fa-select2.fa4,
19
+ .fa-select2-drop.fa4 {
20
  font-family: FontAwesome,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
21
+ }
22
+
23
+ .field_option_font-awesome .chosen-container.fa5,
24
+ .field_type-font-awesome .chosen-container.fa5,
25
+ .fa-select2.fa5,
26
+ .fa-select2-drop.fa5 {
27
+ font-family: "Font Awesome 5 Brands","Font Awesome 5 Free",-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
28
+ }
29
+
30
+ .fa-select2.fa5 i.fas,
31
+ .fa-select2-drop.fa5 i.fas {
32
+ font-weight: 900;
33
+ }
34
+
35
+ .field_option_font-awesome .chosen-container.fa5 .chosen-results li,
36
+ .field_type-font-awesome .chosen-container.fa5 .chosen-results li {
37
+ font-weight: normal;
38
+ }
39
+
40
+ .field_option_font-awesome .chosen-container.fa5 .chosen-results li.fas:before,
41
+ .field_type-font-awesome .chosen-container.fa5 .chosen-results li.fas:before {
42
+ font-weight: 900;
43
+ }
44
+
45
+ .field_option_font-awesome .chosen-container.fa5 .chosen-results li:before,
46
+ .field_type-font-awesome .chosen-container.fa5 .chosen-results li:before {
47
+ display: inline-block;
48
+ width: 20px;
49
+ text-align: center;
50
+ }
assets/inc/chosen/bower.json CHANGED
File without changes
assets/inc/chosen/chosen-sprite.png CHANGED
File without changes
assets/inc/chosen/chosen-sprite@2x.png CHANGED
File without changes
assets/inc/chosen/chosen.css CHANGED
File without changes
assets/inc/chosen/chosen.jquery.js CHANGED
File without changes
assets/inc/chosen/chosen.jquery.min.js CHANGED
File without changes
assets/inc/chosen/chosen.min.css CHANGED
File without changes
assets/inc/chosen/chosen.proto.js CHANGED
File without changes
assets/inc/chosen/chosen.proto.min.js CHANGED
File without changes
assets/inc/chosen/docsupport/chosen.png CHANGED
File without changes
assets/inc/chosen/docsupport/init.js CHANGED
File without changes
assets/inc/chosen/docsupport/init.proto.js CHANGED
File without changes
assets/inc/chosen/docsupport/oss-credit.png CHANGED
File without changes
assets/inc/chosen/docsupport/prism.css CHANGED
File without changes
assets/inc/chosen/docsupport/prism.js CHANGED
File without changes
assets/inc/chosen/docsupport/style.css CHANGED
File without changes
assets/inc/chosen/index.html CHANGED
File without changes
assets/inc/chosen/index.proto.html CHANGED
File without changes
assets/inc/chosen/options.html CHANGED
File without changes
assets/inc/{class-ACFFAL.php → class-ACFFA-Loader-4.php} RENAMED
@@ -1,7 +1,8 @@
1
  <?php
2
  /**
3
  * =======================================
4
- * Advanced Custom Fields Font Awesome Loader
 
5
  * =======================================
6
  *
7
  *
@@ -12,10 +13,9 @@ if ( ! defined( 'ABSPATH' ) ) {
12
  exit;
13
  }
14
 
15
- class ACFFAL
16
  {
17
 
18
- // public $api_endpoint = 'https://data.jsdelivr.com/v1/package/gh/FortAwesome/Font-Awesome';
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';
@@ -152,7 +152,7 @@ class ACFFAL
152
  return $latest_version;
153
  }
154
 
155
- public function get_icons()
156
  {
157
  $fa_icons = get_option( 'ACFFA_icon_data' );
158
 
@@ -180,7 +180,7 @@ class ACFFAL
180
  if ( isset( $fa_icons[ $this->current_version ] ) ) {
181
  return $fa_icons[ $this->current_version ];
182
  } else {
183
- return false;
184
  }
185
  }
186
 
@@ -224,8 +224,6 @@ class ACFFAL
224
  $icons['list'][ $class ] = $unicode . ' ' . $class_nicename;
225
 
226
  $icons['details'][ $class ] = array(
227
- 'element' => $element,
228
- 'class' => $class,
229
  'hex' => $hex,
230
  'unicode' => $unicode
231
  );
@@ -233,11 +231,9 @@ class ACFFAL
233
 
234
  ksort( $icons['list'] );
235
 
236
- $icons['list'] = array( null => '' ) + $icons['list'];
237
-
238
  return $icons;
239
  }
240
  }
241
 
242
- add_action( 'acf/include_field_types', array( new ACFFAL, 'init' ), 5 ); // v5
243
- add_action( 'acf/register_fields', array( new ACFFAL, 'init' ), 5 ); // v4
1
  <?php
2
  /**
3
  * =======================================
4
+ * Advanced Custom Fields Font Awesome Loader 4
5
+ * Used with FontAwesome 4.x icon set
6
  * =======================================
7
  *
8
  *
13
  exit;
14
  }
15
 
16
+ class ACFFA_Loader_4
17
  {
18
 
 
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';
152
  return $latest_version;
153
  }
154
 
155
+ public function get_icons( $icons = array() )
156
  {
157
  $fa_icons = get_option( 'ACFFA_icon_data' );
158
 
180
  if ( isset( $fa_icons[ $this->current_version ] ) ) {
181
  return $fa_icons[ $this->current_version ];
182
  } else {
183
+ return array();
184
  }
185
  }
186
 
224
  $icons['list'][ $class ] = $unicode . ' ' . $class_nicename;
225
 
226
  $icons['details'][ $class ] = array(
 
 
227
  'hex' => $hex,
228
  'unicode' => $unicode
229
  );
231
 
232
  ksort( $icons['list'] );
233
 
 
 
234
  return $icons;
235
  }
236
  }
237
 
238
+ add_action( 'acf/include_field_types', array( new ACFFA_Loader_4, 'init' ), 5 ); // v5
239
+ add_action( 'acf/register_fields', array( new ACFFA_Loader_4, 'init' ), 5 ); // v4
assets/inc/class-ACFFA-Loader-5.php ADDED
@@ -0,0 +1,284 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * =======================================
4
+ * Advanced Custom Fields Font Awesome Loader 5
5
+ * Used with FontAwesome 5.x icon set
6
+ * =======================================
7
+ *
8
+ *
9
+ * @author Matt Keys <https://profiles.wordpress.org/mattkeys>
10
+ */
11
+
12
+ if ( ! defined( 'ABSPATH' ) ) {
13
+ exit;
14
+ }
15
+
16
+ class ACFFA_Loader_5
17
+ {
18
+ public $api_endpoint = 'https://data.jsdelivr.com/v1/package/resolve/gh/FortAwesome/Font-Awesome@5';
19
+ public $cdn_baseurl = 'https://cdn.jsdelivr.net/gh/FortAwesome/Font-Awesome@';
20
+ public $free_icon_manifest = '/advanced-options/metadata/icons.yml';
21
+ public $cdn_filepath = '/web-fonts-with-css/css/fontawesome-all.min.css';
22
+ public $override_version = false;
23
+ public $current_version = false;
24
+
25
+ public function init()
26
+ {
27
+ $this->api_endpoint = apply_filters( 'ACFFA_api_endpoint', $this->api_endpoint );
28
+ $this->cdn_baseurl = apply_filters( 'ACFFA_cdn_baseurl', $this->cdn_baseurl );
29
+ $this->cdn_filepath = apply_filters( 'ACFFA_cdn_filepath', $this->cdn_filepath );
30
+ $this->override_version = apply_filters( 'ACFFA_override_version', false );
31
+
32
+ $this->current_version = get_option( 'ACFFA_current_version' );
33
+
34
+ if ( $this->override_version ) {
35
+ $this->current_version = $this->override_version;
36
+ } else if ( ! $this->current_version || version_compare( $this->current_version, '5.0.0', '<' ) ) {
37
+ $this->current_version = $this->check_latest_version();
38
+ }
39
+
40
+ if ( ! $this->override_version && ! wp_next_scheduled ( 'ACFFA_refresh_latest_icons' ) ) {
41
+ wp_schedule_event( time(), 'daily', 'ACFFA_refresh_latest_icons' );
42
+ }
43
+
44
+ add_action( 'ACFFA_refresh_latest_icons', array( $this, 'refresh_latest_icons' ) );
45
+ add_action( 'wp_ajax_acf/fields/font-awesome/query', array( $this, 'select2_ajax_request' ) );
46
+ add_filter( 'ACFFA_get_icons', array( $this, 'get_icons' ), 5, 1 );
47
+ add_filter( 'ACFFA_get_fa_url', array( $this, 'get_fa_url' ), 5, 1 );
48
+ add_filter( 'ACFFA_icon_prefix', array( $this, 'get_prefix' ), 5, 2 );
49
+ add_filter( 'ACFFA_icon_prefix_label', array( $this, 'get_prefix_label' ), 5, 2 );
50
+ }
51
+
52
+ public function select2_ajax_request()
53
+ {
54
+ if ( ! acf_verify_ajax() ) {
55
+ die();
56
+ }
57
+
58
+ $response = $this->get_ajax_query( $_POST );
59
+
60
+ acf_send_ajax_results( $response );
61
+ }
62
+
63
+ private function get_ajax_query( $options = array() )
64
+ {
65
+ $options = acf_parse_args($options, array(
66
+ 'post_id' => 0,
67
+ 's' => '',
68
+ 'field_key' => '',
69
+ 'paged' => 1
70
+ ));
71
+
72
+ $results = array();
73
+ $s = null;
74
+
75
+ if ( $options['s'] !== '' ) {
76
+ $s = strval( $options['s'] );
77
+ $s = wp_unslash( $s );
78
+ }
79
+
80
+ $fa_icons = apply_filters( 'ACFFA_get_icons', array() );
81
+
82
+ if ( $fa_icons ) {
83
+ foreach ( $fa_icons['list'] as $prefix => $icons ) {
84
+ $prefix_icons = array();
85
+ foreach( $icons as $k => $v ) {
86
+
87
+ $v = strval( $v );
88
+
89
+ if ( is_string( $s ) && false === stripos( $v, $s ) ) {
90
+ continue;
91
+ }
92
+
93
+ $prefix_icons[] = array(
94
+ 'id' => $k,
95
+ 'text' => $v
96
+ );
97
+ }
98
+ $results[] = array(
99
+ 'id' => 'fab',
100
+ 'text' => apply_filters( 'ACFFA_icon_prefix_label', 'Regular', $prefix ),
101
+ 'children' => $prefix_icons
102
+ );
103
+ }
104
+ }
105
+
106
+ $response = array(
107
+ 'results' => $results
108
+ );
109
+
110
+ return $response;
111
+ }
112
+
113
+ public function refresh_latest_icons()
114
+ {
115
+ if ( $this->override_version ) {
116
+ return;
117
+ }
118
+
119
+ $latest_version = $this->check_latest_version( false );
120
+
121
+ if ( ! $this->current_version || ! $latest_version ) {
122
+ return;
123
+ }
124
+
125
+ if ( version_compare( $this->current_version, $latest_version, '<' ) ) {
126
+ update_option( 'ACFFA_current_version', $latest_version, false );
127
+ $this->current_version = $latest_version;
128
+
129
+ $this->get_icons();
130
+ }
131
+ }
132
+
133
+ private function check_latest_version( $update_option = true )
134
+ {
135
+ $latest_version = 'latest';
136
+
137
+ $remote_get = wp_remote_get( $this->api_endpoint );
138
+
139
+ if ( ! is_wp_error( $remote_get ) ) {
140
+ $response_json = wp_remote_retrieve_body( $remote_get );
141
+
142
+ if ( $response_json ) {
143
+ $response = json_decode( $response_json );
144
+
145
+ if ( isset( $response->versions ) && ! empty( $response->versions ) ) {
146
+ $latest_version = max( $response->versions );
147
+ $latest_version = ltrim( $latest_version, 'v' );
148
+
149
+ if ( $update_option ) {
150
+ update_option( 'ACFFA_current_version', $latest_version, false );
151
+ }
152
+ } else if ( isset( $response->version ) && ! empty( $response->version ) ) {
153
+ $latest_version = $response->version;
154
+
155
+ if ( $update_option ) {
156
+ update_option( 'ACFFA_current_version', $latest_version, false );
157
+ }
158
+ }
159
+ }
160
+ }
161
+
162
+ return $latest_version;
163
+ }
164
+
165
+ public function get_icons( $icons = array() )
166
+ {
167
+ $fa_icons = get_option( 'ACFFA_icon_data' );
168
+
169
+ if ( empty( $fa_icons ) || ! isset( $fa_icons[ $this->current_version ] ) ) {
170
+ $request_url = $this->cdn_baseurl . $this->current_version . $this->free_icon_manifest;
171
+ $remote_get = wp_remote_get( $request_url );
172
+
173
+ if ( ! is_wp_error( $remote_get ) ) {
174
+ $response = wp_remote_retrieve_body( $remote_get );
175
+
176
+ if ( ! empty( $response ) ) {
177
+ require_once( 'spyc/spyc.php' );
178
+ $parsed_icons = spyc_load( $response );
179
+
180
+ if ( is_array( $parsed_icons ) && ! empty( $parsed_icons ) ) {
181
+ $icons = $this->find_icons( $parsed_icons );
182
+
183
+ if ( ! empty( $icons['details'] ) ) {
184
+ $fa_icons = array(
185
+ $this->current_version => $icons
186
+ );
187
+
188
+ update_option( 'ACFFA_icon_data', $fa_icons, true );
189
+ }
190
+ }
191
+ }
192
+ }
193
+ }
194
+
195
+ if ( isset( $fa_icons[ $this->current_version ] ) ) {
196
+ return $fa_icons[ $this->current_version ];
197
+ } else {
198
+ return array();
199
+ }
200
+ }
201
+
202
+ public function get_fa_url()
203
+ {
204
+ return $this->cdn_baseurl . $this->current_version . $this->cdn_filepath;
205
+ }
206
+
207
+ private function find_icons( $manifest )
208
+ {
209
+ $icons = array(
210
+ 'list' => array(),
211
+ 'details' => array()
212
+ );
213
+
214
+ foreach ( $manifest as $icon => $details ) {
215
+ foreach( $details['styles'] as $style ) {
216
+ $prefix = apply_filters( 'ACFFA_icon_prefix', '', $style );
217
+
218
+ if ( ! isset( $icons['list'][ $prefix ] ) ) {
219
+ $icons['list'][ $prefix ] = array();
220
+ }
221
+
222
+ $icons['list'][ $prefix ][ $prefix . ' fa-' . $icon ] = '<i class="' . $prefix . '">&#x' . $details['unicode'] . ';</i> ' . $icon;
223
+
224
+ $icons['details'][ $prefix ][ $prefix . ' fa-' . $icon ] = array(
225
+ 'hex' => '\\' . $details['unicode'],
226
+ 'unicode' => '&#x' . $details['unicode'] . ';'
227
+ );
228
+ }
229
+ }
230
+
231
+ return $icons;
232
+ }
233
+
234
+ public function get_prefix( $prefix = 'far', $style )
235
+ {
236
+ switch ( $style ) {
237
+ case 'solid':
238
+ $prefix = 'fas';
239
+ break;
240
+
241
+ case 'brands':
242
+ $prefix = 'fab';
243
+ break;
244
+
245
+ case 'light':
246
+ $prefix = 'fal';
247
+ break;
248
+
249
+ case 'regular':
250
+ default:
251
+ $prefix = 'far';
252
+ break;
253
+ }
254
+
255
+ return $prefix;
256
+ }
257
+
258
+ public function get_prefix_label( $label = 'Regular', $prefix )
259
+ {
260
+ switch ( $prefix ) {
261
+ case 'fas':
262
+ $label = __( 'Solid', 'acf-font-awesome' );
263
+ break;
264
+
265
+ case 'fab':
266
+ $label = __( 'Brands', 'acf-font-awesome' );
267
+ break;
268
+
269
+ case 'fal':
270
+ $label = __( 'Light', 'acf-font-awesome' );
271
+ break;
272
+
273
+ case 'far':
274
+ default:
275
+ $label = __( 'Regular', 'acf-font-awesome' );
276
+ break;
277
+ }
278
+
279
+ return $label;
280
+ }
281
+ }
282
+
283
+ add_action( 'acf/include_field_types', array( new ACFFA_Loader_5, 'init' ), 5 ); // v5
284
+ add_action( 'acf/register_fields', array( new ACFFA_Loader_5, 'init' ), 5 ); // v4
assets/inc/spyc/COPYING ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The MIT License
2
+
3
+ Copyright (c) 2011 Vladimir Andersen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
assets/inc/spyc/spyc.php ADDED
@@ -0,0 +1,1161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Spyc -- A Simple PHP YAML Class
4
+ * @version 0.6.2
5
+ * @author Vlad Andersen <vlad.andersen@gmail.com>
6
+ * @author Chris Wanstrath <chris@ozmm.org>
7
+ * @link https://github.com/mustangostang/spyc/
8
+ * @copyright Copyright 2005-2006 Chris Wanstrath, 2006-2011 Vlad Andersen
9
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
10
+ * @package Spyc
11
+ */
12
+
13
+ if (!function_exists('spyc_load')) {
14
+ /**
15
+ * Parses YAML to array.
16
+ * @param string $string YAML string.
17
+ * @return array
18
+ */
19
+ function spyc_load ($string) {
20
+ return Spyc::YAMLLoadString($string);
21
+ }
22
+ }
23
+
24
+ if (!function_exists('spyc_load_file')) {
25
+ /**
26
+ * Parses YAML to array.
27
+ * @param string $file Path to YAML file.
28
+ * @return array
29
+ */
30
+ function spyc_load_file ($file) {
31
+ return Spyc::YAMLLoad($file);
32
+ }
33
+ }
34
+
35
+ if (!function_exists('spyc_dump')) {
36
+ /**
37
+ * Dumps array to YAML.
38
+ * @param array $data Array.
39
+ * @return string
40
+ */
41
+ function spyc_dump ($data) {
42
+ return Spyc::YAMLDump($data, false, false, true);
43
+ }
44
+ }
45
+
46
+ if (!class_exists('Spyc')) {
47
+
48
+ /**
49
+ * The Simple PHP YAML Class.
50
+ *
51
+ * This class can be used to read a YAML file and convert its contents
52
+ * into a PHP array. It currently supports a very limited subsection of
53
+ * the YAML spec.
54
+ *
55
+ * Usage:
56
+ * <code>
57
+ * $Spyc = new Spyc;
58
+ * $array = $Spyc->load($file);
59
+ * </code>
60
+ * or:
61
+ * <code>
62
+ * $array = Spyc::YAMLLoad($file);
63
+ * </code>
64
+ * or:
65
+ * <code>
66
+ * $array = spyc_load_file($file);
67
+ * </code>
68
+ * @package Spyc
69
+ */
70
+ class Spyc {
71
+
72
+ // SETTINGS
73
+
74
+ const REMPTY = "\0\0\0\0\0";
75
+
76
+ /**
77
+ * Setting this to true will force YAMLDump to enclose any string value in
78
+ * quotes. False by default.
79
+ *
80
+ * @var bool
81
+ */
82
+ public $setting_dump_force_quotes = false;
83
+
84
+ /**
85
+ * Setting this to true will forse YAMLLoad to use syck_load function when
86
+ * possible. False by default.
87
+ * @var bool
88
+ */
89
+ public $setting_use_syck_is_possible = false;
90
+
91
+
92
+
93
+ /**#@+
94
+ * @access private
95
+ * @var mixed
96
+ */
97
+ private $_dumpIndent;
98
+ private $_dumpWordWrap;
99
+ private $_containsGroupAnchor = false;
100
+ private $_containsGroupAlias = false;
101
+ private $path;
102
+ private $result;
103
+ private $LiteralPlaceHolder = '___YAML_Literal_Block___';
104
+ private $SavedGroups = array();
105
+ private $indent;
106
+ /**
107
+ * Path modifier that should be applied after adding current element.
108
+ * @var array
109
+ */
110
+ private $delayedPath = array();
111
+
112
+ /**#@+
113
+ * @access public
114
+ * @var mixed
115
+ */
116
+ public $_nodeId;
117
+
118
+ /**
119
+ * Load a valid YAML string to Spyc.
120
+ * @param string $input
121
+ * @return array
122
+ */
123
+ public function load ($input) {
124
+ return $this->_loadString($input);
125
+ }
126
+
127
+ /**
128
+ * Load a valid YAML file to Spyc.
129
+ * @param string $file
130
+ * @return array
131
+ */
132
+ public function loadFile ($file) {
133
+ return $this->_load($file);
134
+ }
135
+
136
+ /**
137
+ * Load YAML into a PHP array statically
138
+ *
139
+ * The load method, when supplied with a YAML stream (string or file),
140
+ * will do its best to convert YAML in a file into a PHP array. Pretty
141
+ * simple.
142
+ * Usage:
143
+ * <code>
144
+ * $array = Spyc::YAMLLoad('lucky.yaml');
145
+ * print_r($array);
146
+ * </code>
147
+ * @access public
148
+ * @return array
149
+ * @param string $input Path of YAML file or string containing YAML
150
+ */
151
+ public static function YAMLLoad($input) {
152
+ $Spyc = new Spyc;
153
+ return $Spyc->_load($input);
154
+ }
155
+
156
+ /**
157
+ * Load a string of YAML into a PHP array statically
158
+ *
159
+ * The load method, when supplied with a YAML string, will do its best
160
+ * to convert YAML in a string into a PHP array. Pretty simple.
161
+ *
162
+ * Note: use this function if you don't want files from the file system
163
+ * loaded and processed as YAML. This is of interest to people concerned
164
+ * about security whose input is from a string.
165
+ *
166
+ * Usage:
167
+ * <code>
168
+ * $array = Spyc::YAMLLoadString("---\n0: hello world\n");
169
+ * print_r($array);
170
+ * </code>
171
+ * @access public
172
+ * @return array
173
+ * @param string $input String containing YAML
174
+ */
175
+ public static function YAMLLoadString($input) {
176
+ $Spyc = new Spyc;
177
+ return $Spyc->_loadString($input);
178
+ }
179
+
180
+ /**
181
+ * Dump YAML from PHP array statically
182
+ *
183
+ * The dump method, when supplied with an array, will do its best
184
+ * to convert the array into friendly YAML. Pretty simple. Feel free to
185
+ * save the returned string as nothing.yaml and pass it around.
186
+ *
187
+ * Oh, and you can decide how big the indent is and what the wordwrap
188
+ * for folding is. Pretty cool -- just pass in 'false' for either if
189
+ * you want to use the default.
190
+ *
191
+ * Indent's default is 2 spaces, wordwrap's default is 40 characters. And
192
+ * you can turn off wordwrap by passing in 0.
193
+ *
194
+ * @access public
195
+ * @return string
196
+ * @param array|\stdClass $array PHP array
197
+ * @param int $indent Pass in false to use the default, which is 2
198
+ * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
199
+ * @param bool $no_opening_dashes Do not start YAML file with "---\n"
200
+ */
201
+ public static function YAMLDump($array, $indent = false, $wordwrap = false, $no_opening_dashes = false) {
202
+ $spyc = new Spyc;
203
+ return $spyc->dump($array, $indent, $wordwrap, $no_opening_dashes);
204
+ }
205
+
206
+
207
+ /**
208
+ * Dump PHP array to YAML
209
+ *
210
+ * The dump method, when supplied with an array, will do its best
211
+ * to convert the array into friendly YAML. Pretty simple. Feel free to
212
+ * save the returned string as tasteful.yaml and pass it around.
213
+ *
214
+ * Oh, and you can decide how big the indent is and what the wordwrap
215
+ * for folding is. Pretty cool -- just pass in 'false' for either if
216
+ * you want to use the default.
217
+ *
218
+ * Indent's default is 2 spaces, wordwrap's default is 40 characters. And
219
+ * you can turn off wordwrap by passing in 0.
220
+ *
221
+ * @access public
222
+ * @return string
223
+ * @param array $array PHP array
224
+ * @param int $indent Pass in false to use the default, which is 2
225
+ * @param int $wordwrap Pass in 0 for no wordwrap, false for default (40)
226
+ */
227
+ public function dump($array,$indent = false,$wordwrap = false, $no_opening_dashes = false) {
228
+ // Dumps to some very clean YAML. We'll have to add some more features
229
+ // and options soon. And better support for folding.
230
+
231
+ // New features and options.
232
+ if ($indent === false or !is_numeric($indent)) {
233
+ $this->_dumpIndent = 2;
234
+ } else {
235
+ $this->_dumpIndent = $indent;
236
+ }
237
+
238
+ if ($wordwrap === false or !is_numeric($wordwrap)) {
239
+ $this->_dumpWordWrap = 40;
240
+ } else {
241
+ $this->_dumpWordWrap = $wordwrap;
242
+ }
243
+
244
+ // New YAML document
245
+ $string = "";
246
+ if (!$no_opening_dashes) $string = "---\n";
247
+
248
+ // Start at the base of the array and move through it.
249
+ if ($array) {
250
+ $array = (array)$array;
251
+ $previous_key = -1;
252
+ foreach ($array as $key => $value) {
253
+ if (!isset($first_key)) $first_key = $key;
254
+ $string .= $this->_yamlize($key,$value,0,$previous_key, $first_key, $array);
255
+ $previous_key = $key;
256
+ }
257
+ }
258
+ return $string;
259
+ }
260
+
261
+ /**
262
+ * Attempts to convert a key / value array item to YAML
263
+ * @access private
264
+ * @return string
265
+ * @param $key The name of the key
266
+ * @param $value The value of the item
267
+ * @param $indent The indent of the current node
268
+ */
269
+ private function _yamlize($key,$value,$indent, $previous_key = -1, $first_key = 0, $source_array = null) {
270
+ if(is_object($value)) $value = (array)$value;
271
+ if (is_array($value)) {
272
+ if (empty ($value))
273
+ return $this->_dumpNode($key, array(), $indent, $previous_key, $first_key, $source_array);
274
+ // It has children. What to do?
275
+ // Make it the right kind of item
276
+ $string = $this->_dumpNode($key, self::REMPTY, $indent, $previous_key, $first_key, $source_array);
277
+ // Add the indent
278
+ $indent += $this->_dumpIndent;
279
+ // Yamlize the array
280
+ $string .= $this->_yamlizeArray($value,$indent);
281
+ } elseif (!is_array($value)) {
282
+ // It doesn't have children. Yip.
283
+ $string = $this->_dumpNode($key, $value, $indent, $previous_key, $first_key, $source_array);
284
+ }
285
+ return $string;
286
+ }
287
+
288
+ /**
289
+ * Attempts to convert an array to YAML
290
+ * @access private
291
+ * @return string
292
+ * @param $array The array you want to convert
293
+ * @param $indent The indent of the current level
294
+ */
295
+ private function _yamlizeArray($array,$indent) {
296
+ if (is_array($array)) {
297
+ $string = '';
298
+ $previous_key = -1;
299
+ foreach ($array as $key => $value) {
300
+ if (!isset($first_key)) $first_key = $key;
301
+ $string .= $this->_yamlize($key, $value, $indent, $previous_key, $first_key, $array);
302
+ $previous_key = $key;
303
+ }
304
+ return $string;
305
+ } else {
306
+ return false;
307
+ }
308
+ }
309
+
310
+ /**
311
+ * Returns YAML from a key and a value
312
+ * @access private
313
+ * @return string
314
+ * @param $key The name of the key
315
+ * @param $value The value of the item
316
+ * @param $indent The indent of the current node
317
+ */
318
+ private function _dumpNode($key, $value, $indent, $previous_key = -1, $first_key = 0, $source_array = null) {
319
+ // do some folding here, for blocks
320
+ if (is_string ($value) && ((strpos($value,"\n") !== false || strpos($value,": ") !== false || strpos($value,"- ") !== false ||
321
+ strpos($value,"*") !== false || strpos($value,"#") !== false || strpos($value,"<") !== false || strpos($value,">") !== false || strpos ($value, '%') !== false || strpos ($value, ' ') !== false ||
322
+ strpos($value,"[") !== false || strpos($value,"]") !== false || strpos($value,"{") !== false || strpos($value,"}") !== false) || strpos($value,"&") !== false || strpos($value, "'") !== false || strpos($value, "!") === 0 ||
323
+ substr ($value, -1, 1) == ':')
324
+ ) {
325
+ $value = $this->_doLiteralBlock($value,$indent);
326
+ } else {
327
+ $value = $this->_doFolding($value,$indent);
328
+ }
329
+
330
+ if ($value === array()) $value = '[ ]';
331
+ if ($value === "") $value = '""';
332
+ if (self::isTranslationWord($value)) {
333
+ $value = $this->_doLiteralBlock($value, $indent);
334
+ }
335
+ if (trim ($value) != $value)
336
+ $value = $this->_doLiteralBlock($value,$indent);
337
+
338
+ if (is_bool($value)) {
339
+ $value = $value ? "true" : "false";
340
+ }
341
+
342
+ if ($value === null) $value = 'null';
343
+ if ($value === "'" . self::REMPTY . "'") $value = null;
344
+
345
+ $spaces = str_repeat(' ',$indent);
346
+
347
+ //if (is_int($key) && $key - 1 == $previous_key && $first_key===0) {
348
+ if (is_array ($source_array) && array_keys($source_array) === range(0, count($source_array) - 1)) {
349
+ // It's a sequence
350
+ $string = $spaces.'- '.$value."\n";
351
+ } else {
352
+ // if ($first_key===0) throw new Exception('Keys are all screwy. The first one was zero, now it\'s "'. $key .'"');
353
+ // It's mapped
354
+ if (strpos($key, ":") !== false || strpos($key, "#") !== false) { $key = '"' . $key . '"'; }
355
+ $string = rtrim ($spaces.$key.': '.$value)."\n";
356
+ }
357
+ return $string;
358
+ }
359
+
360
+ /**
361
+ * Creates a literal block for dumping
362
+ * @access private
363
+ * @return string
364
+ * @param $value
365
+ * @param $indent int The value of the indent
366
+ */
367
+ private function _doLiteralBlock($value,$indent) {
368
+ if ($value === "\n") return '\n';
369
+ if (strpos($value, "\n") === false && strpos($value, "'") === false) {
370
+ return sprintf ("'%s'", $value);
371
+ }
372
+ if (strpos($value, "\n") === false && strpos($value, '"') === false) {
373
+ return sprintf ('"%s"', $value);
374
+ }
375
+ $exploded = explode("\n",$value);
376
+ $newValue = '|';
377
+ if (isset($exploded[0]) && ($exploded[0] == "|" || $exploded[0] == "|-" || $exploded[0] == ">")) {
378
+ $newValue = $exploded[0];
379
+ unset($exploded[0]);
380
+ }
381
+ $indent += $this->_dumpIndent;
382
+ $spaces = str_repeat(' ',$indent);
383
+ foreach ($exploded as $line) {
384
+ $line = trim($line);
385
+ if (strpos($line, '"') === 0 && strrpos($line, '"') == (strlen($line)-1) || strpos($line, "'") === 0 && strrpos($line, "'") == (strlen($line)-1)) {
386
+ $line = substr($line, 1, -1);
387
+ }
388
+ $newValue .= "\n" . $spaces . ($line);
389
+ }
390
+ return $newValue;
391
+ }
392
+
393
+ /**
394
+ * Folds a string of text, if necessary
395
+ * @access private
396
+ * @return string
397
+ * @param $value The string you wish to fold
398
+ */
399
+ private function _doFolding($value,$indent) {
400
+ // Don't do anything if wordwrap is set to 0
401
+
402
+ if ($this->_dumpWordWrap !== 0 && is_string ($value) && strlen($value) > $this->_dumpWordWrap) {
403
+ $indent += $this->_dumpIndent;
404
+ $indent = str_repeat(' ',$indent);
405
+ $wrapped = wordwrap($value,$this->_dumpWordWrap,"\n$indent");
406
+ $value = ">\n".$indent.$wrapped;
407
+ } else {
408
+ if ($this->setting_dump_force_quotes && is_string ($value) && $value !== self::REMPTY)
409
+ $value = '"' . $value . '"';
410
+ if (is_numeric($value) && is_string($value))
411
+ $value = '"' . $value . '"';
412
+ }
413
+
414
+
415
+ return $value;
416
+ }
417
+
418
+ private function isTrueWord($value) {
419
+ $words = self::getTranslations(array('true', 'on', 'yes', 'y'));
420
+ return in_array($value, $words, true);
421
+ }
422
+
423
+ private function isFalseWord($value) {
424
+ $words = self::getTranslations(array('false', 'off', 'no', 'n'));
425
+ return in_array($value, $words, true);
426
+ }
427
+
428
+ private function isNullWord($value) {
429
+ $words = self::getTranslations(array('null', '~'));
430
+ return in_array($value, $words, true);
431
+ }
432
+
433
+ private function isTranslationWord($value) {
434
+ return (
435
+ self::isTrueWord($value) ||
436
+ self::isFalseWord($value) ||
437
+ self::isNullWord($value)
438
+ );
439
+ }
440
+
441
+ /**
442
+ * Coerce a string into a native type
443
+ * Reference: http://yaml.org/type/bool.html
444
+ * TODO: Use only words from the YAML spec.
445
+ * @access private
446
+ * @param $value The value to coerce
447
+ */
448
+ private function coerceValue(&$value) {
449
+ if (self::isTrueWord($value)) {
450
+ $value = true;
451
+ } else if (self::isFalseWord($value)) {
452
+ $value = false;
453
+ } else if (self::isNullWord($value)) {
454
+ $value = null;
455
+ }
456
+ }
457
+
458
+ /**
459
+ * Given a set of words, perform the appropriate translations on them to
460
+ * match the YAML 1.1 specification for type coercing.
461
+ * @param $words The words to translate
462
+ * @access private
463
+ */
464
+ private static function getTranslations(array $words) {
465
+ $result = array();
466
+ foreach ($words as $i) {
467
+ $result = array_merge($result, array(ucfirst($i), strtoupper($i), strtolower($i)));
468
+ }
469
+ return $result;
470
+ }
471
+
472
+ // LOADING FUNCTIONS
473
+
474
+ private function _load($input) {
475
+ $Source = $this->loadFromSource($input);
476
+ return $this->loadWithSource($Source);
477
+ }
478
+
479
+ private function _loadString($input) {
480
+ $Source = $this->loadFromString($input);
481
+ return $this->loadWithSource($Source);
482
+ }
483
+
484
+ private function loadWithSource($Source) {
485
+ if (empty ($Source)) return array();
486
+ if ($this->setting_use_syck_is_possible && function_exists ('syck_load')) {
487
+ $array = syck_load (implode ("\n", $Source));
488
+ return is_array($array) ? $array : array();
489
+ }
490
+
491
+ $this->path = array();
492
+ $this->result = array();
493
+
494
+ $cnt = count($Source);
495
+ for ($i = 0; $i < $cnt; $i++) {
496
+ $line = $Source[$i];
497
+
498
+ $this->indent = strlen($line) - strlen(ltrim($line));
499
+ $tempPath = $this->getParentPathByIndent($this->indent);
500
+ $line = self::stripIndent($line, $this->indent);
501
+ if (self::isComment($line)) continue;
502
+ if (self::isEmpty($line)) continue;
503
+ $this->path = $tempPath;
504
+
505
+ $literalBlockStyle = self::startsLiteralBlock($line);
506
+ if ($literalBlockStyle) {
507
+ $line = rtrim ($line, $literalBlockStyle . " \n");
508
+ $literalBlock = '';
509
+ $line .= ' '.$this->LiteralPlaceHolder;
510
+ $literal_block_indent = strlen($Source[$i+1]) - strlen(ltrim($Source[$i+1]));
511
+ while (++$i < $cnt && $this->literalBlockContinues($Source[$i], $this->indent)) {
512
+ $literalBlock = $this->addLiteralLine($literalBlock, $Source[$i], $literalBlockStyle, $literal_block_indent);
513
+ }
514
+ $i--;
515
+ }
516
+
517
+ // Strip out comments
518
+ if (strpos ($line, '#')) {
519
+ $line = preg_replace('/\s*#([^"\']+)$/','',$line);
520
+ }
521
+
522
+ while (++$i < $cnt && self::greedilyNeedNextLine($line)) {
523
+ $line = rtrim ($line, " \n\t\r") . ' ' . ltrim ($Source[$i], " \t");
524
+ }
525
+ $i--;
526
+
527
+ $lineArray = $this->_parseLine($line);
528
+
529
+ if ($literalBlockStyle)
530
+ $lineArray = $this->revertLiteralPlaceHolder ($lineArray, $literalBlock);
531
+
532
+ $this->addArray($lineArray, $this->indent);
533
+
534
+ foreach ($this->delayedPath as $indent => $delayedPath)
535
+ $this->path[$indent] = $delayedPath;
536
+
537
+ $this->delayedPath = array();
538
+
539
+ }
540
+ return $this->result;
541
+ }
542
+
543
+ private function loadFromSource ($input) {
544
+ if (!empty($input) && strpos($input, "\n") === false && file_exists($input))
545
+ $input = file_get_contents($input);
546
+
547
+ return $this->loadFromString($input);
548
+ }
549
+
550
+ private function loadFromString ($input) {
551
+ $lines = explode("\n",$input);
552
+ foreach ($lines as $k => $_) {
553
+ $lines[$k] = rtrim ($_, "\r");
554
+ }
555
+ return $lines;
556
+ }
557
+
558
+ /**
559
+ * Parses YAML code and returns an array for a node
560
+ * @access private
561
+ * @return array
562
+ * @param string $line A line from the YAML file
563
+ */
564
+ private function _parseLine($line) {
565
+ if (!$line) return array();
566
+ $line = trim($line);
567
+ if (!$line) return array();
568
+
569
+ $array = array();
570
+
571
+ $group = $this->nodeContainsGroup($line);
572
+ if ($group) {
573
+ $this->addGroup($line, $group);
574
+ $line = $this->stripGroup ($line, $group);
575
+ }
576
+
577
+ if ($this->startsMappedSequence($line))
578
+ return $this->returnMappedSequence($line);
579
+
580
+ if ($this->startsMappedValue($line))
581
+ return $this->returnMappedValue($line);
582
+
583
+ if ($this->isArrayElement($line))
584
+ return $this->returnArrayElement($line);
585
+
586
+ if ($this->isPlainArray($line))
587
+ return $this->returnPlainArray($line);
588
+
589
+
590
+ return $this->returnKeyValuePair($line);
591
+
592
+ }
593
+
594
+ /**
595
+ * Finds the type of the passed value, returns the value as the new type.
596
+ * @access private
597
+ * @param string $value
598
+ * @return mixed
599
+ */
600
+ private function _toType($value) {
601
+ if ($value === '') return "";
602
+ $first_character = $value[0];
603
+ $last_character = substr($value, -1, 1);
604
+
605
+ $is_quoted = false;
606
+ do {
607
+ if (!$value) break;
608
+ if ($first_character != '"' && $first_character != "'") break;
609
+ if ($last_character != '"' && $last_character != "'") break;
610
+ $is_quoted = true;
611
+ } while (0);
612
+
613
+ if ($is_quoted) {
614
+ $value = str_replace('\n', "\n", $value);
615
+ if ($first_character == "'")
616
+ return strtr(substr ($value, 1, -1), array ('\'\'' => '\'', '\\\''=> '\''));
617
+ return strtr(substr ($value, 1, -1), array ('\\"' => '"', '\\\''=> '\''));
618
+ }
619
+
620
+ if (strpos($value, ' #') !== false && !$is_quoted)
621
+ $value = preg_replace('/\s+#(.+)$/','',$value);
622
+
623
+ if ($first_character == '[' && $last_character == ']') {
624
+ // Take out strings sequences and mappings
625
+ $innerValue = trim(substr ($value, 1, -1));
626
+ if ($innerValue === '') return array();
627
+ $explode = $this->_inlineEscape($innerValue);
628
+ // Propagate value array
629
+ $value = array();
630
+ foreach ($explode as $v) {
631
+ $value[] = $this->_toType($v);
632
+ }
633
+ return $value;
634
+ }
635
+
636
+ if (strpos($value,': ')!==false && $first_character != '{') {
637
+ $array = explode(': ',$value);
638
+ $key = trim($array[0]);
639
+ array_shift($array);
640
+ $value = trim(implode(': ',$array));
641
+ $value = $this->_toType($value);
642
+ return array($key => $value);
643
+ }
644
+
645
+ if ($first_character == '{' && $last_character == '}') {
646
+ $innerValue = trim(substr ($value, 1, -1));
647
+ if ($innerValue === '') return array();
648
+ // Inline Mapping
649
+ // Take out strings sequences and mappings
650
+ $explode = $this->_inlineEscape($innerValue);
651
+ // Propagate value array
652
+ $array = array();
653
+ foreach ($explode as $v) {
654
+ $SubArr = $this->_toType($v);
655
+ if (empty($SubArr)) continue;
656
+ if (is_array ($SubArr)) {
657
+ $array[key($SubArr)] = $SubArr[key($SubArr)]; continue;
658
+ }
659
+ $array[] = $SubArr;
660
+ }
661
+ return $array;
662
+ }
663
+
664
+ if ($value == 'null' || $value == 'NULL' || $value == 'Null' || $value == '' || $value == '~') {
665
+ return null;
666
+ }
667
+
668
+ if ( is_numeric($value) && preg_match ('/^(-|)[1-9]+[0-9]*$/', $value) ){
669
+ $intvalue = (int)$value;
670
+ if ($intvalue != PHP_INT_MAX && $intvalue != ~PHP_INT_MAX)
671
+ $value = $intvalue;
672
+ return $value;
673
+ }
674
+
675
+ if ( is_string($value) && preg_match('/^0[xX][0-9a-fA-F]+$/', $value)) {
676
+ // Hexadecimal value.
677
+ return hexdec($value);
678
+ }
679
+
680
+ $this->coerceValue($value);
681
+
682
+ if (is_numeric($value)) {
683
+ if ($value === '0') return 0;
684
+ if (rtrim ($value, 0) === $value)
685
+ $value = (float)$value;
686
+ return $value;
687
+ }
688
+
689
+ return $value;
690
+ }
691
+
692
+ /**
693
+ * Used in inlines to check for more inlines or quoted strings
694
+ * @access private
695
+ * @return array
696
+ */
697
+ private function _inlineEscape($inline) {
698
+ // There's gotta be a cleaner way to do this...
699
+ // While pure sequences seem to be nesting just fine,
700
+ // pure mappings and mappings with sequences inside can't go very
701
+ // deep. This needs to be fixed.
702
+
703
+ $seqs = array();
704
+ $maps = array();
705
+ $saved_strings = array();
706
+ $saved_empties = array();
707
+
708
+ // Check for empty strings
709
+ $regex = '/("")|(\'\')/';
710
+ if (preg_match_all($regex,$inline,$strings)) {
711
+ $saved_empties = $strings[0];
712
+ $inline = preg_replace($regex,'YAMLEmpty',$inline);
713
+ }
714
+ unset($regex);
715
+
716
+ // Check for strings
717
+ $regex = '/(?:(")|(?:\'))((?(1)[^"]+|[^\']+))(?(1)"|\')/';
718
+ if (preg_match_all($regex,$inline,$strings)) {
719
+ $saved_strings = $strings[0];
720
+ $inline = preg_replace($regex,'YAMLString',$inline);
721
+ }
722
+ unset($regex);
723
+
724
+ // echo $inline;
725
+
726
+ $i = 0;
727
+ do {
728
+
729
+ // Check for sequences
730
+ while (preg_match('/\[([^{}\[\]]+)\]/U',$inline,$matchseqs)) {
731
+ $seqs[] = $matchseqs[0];
732
+ $inline = preg_replace('/\[([^{}\[\]]+)\]/U', ('YAMLSeq' . (count($seqs) - 1) . 's'), $inline, 1);
733
+ }
734
+
735
+ // Check for mappings
736
+ while (preg_match('/{([^\[\]{}]+)}/U',$inline,$matchmaps)) {
737
+ $maps[] = $matchmaps[0];
738
+ $inline = preg_replace('/{([^\[\]{}]+)}/U', ('YAMLMap' . (count($maps) - 1) . 's'), $inline, 1);
739
+ }
740
+
741
+ if ($i++ >= 10) break;
742
+
743
+ } while (strpos ($inline, '[') !== false || strpos ($inline, '{') !== false);
744
+
745
+ $explode = explode(',',$inline);
746
+ $explode = array_map('trim', $explode);
747
+ $stringi = 0; $i = 0;
748
+
749
+ while (1) {
750
+
751
+ // Re-add the sequences
752
+ if (!empty($seqs)) {
753
+ foreach ($explode as $key => $value) {
754
+ if (strpos($value,'YAMLSeq') !== false) {
755
+ foreach ($seqs as $seqk => $seq) {
756
+ $explode[$key] = str_replace(('YAMLSeq'.$seqk.'s'),$seq,$value);
757
+ $value = $explode[$key];
758
+ }
759
+ }
760
+ }
761
+ }
762
+
763
+ // Re-add the mappings
764
+ if (!empty($maps)) {
765
+ foreach ($explode as $key => $value) {
766
+ if (strpos($value,'YAMLMap') !== false) {
767
+ foreach ($maps as $mapk => $map) {
768
+ $explode[$key] = str_replace(('YAMLMap'.$mapk.'s'), $map, $value);
769
+ $value = $explode[$key];
770
+ }
771
+ }
772
+ }
773
+ }
774
+
775
+
776
+ // Re-add the strings
777
+ if (!empty($saved_strings)) {
778
+ foreach ($explode as $key => $value) {
779
+ while (strpos($value,'YAMLString') !== false) {
780
+ $explode[$key] = preg_replace('/YAMLString/',$saved_strings[$stringi],$value, 1);
781
+ unset($saved_strings[$stringi]);
782
+ ++$stringi;
783
+ $value = $explode[$key];
784
+ }
785
+ }
786
+ }
787
+
788
+
789
+ // Re-add the empties
790
+ if (!empty($saved_empties)) {
791
+ foreach ($explode as $key => $value) {
792
+ while (strpos($value,'YAMLEmpty') !== false) {
793
+ $explode[$key] = preg_replace('/YAMLEmpty/', '', $value, 1);
794
+ $value = $explode[$key];
795
+ }
796
+ }
797
+ }
798
+
799
+ $finished = true;
800
+ foreach ($explode as $key => $value) {
801
+ if (strpos($value,'YAMLSeq') !== false) {
802
+ $finished = false; break;
803
+ }
804
+ if (strpos($value,'YAMLMap') !== false) {
805
+ $finished = false; break;
806
+ }
807
+ if (strpos($value,'YAMLString') !== false) {
808
+ $finished = false; break;
809
+ }
810
+ if (strpos($value,'YAMLEmpty') !== false) {
811
+ $finished = false; break;
812
+ }
813
+ }
814
+ if ($finished) break;
815
+
816
+ $i++;
817
+ if ($i > 10)
818
+ break; // Prevent infinite loops.
819
+ }
820
+
821
+
822
+ return $explode;
823
+ }
824
+
825
+ private function literalBlockContinues ($line, $lineIndent) {
826
+ if (!trim($line)) return true;
827
+ if (strlen($line) - strlen(ltrim($line)) > $lineIndent) return true;
828
+ return false;
829
+ }
830
+
831
+ private function referenceContentsByAlias ($alias) {
832
+ do {
833
+ if (!isset($this->SavedGroups[$alias])) { echo "Bad group name: $alias."; break; }
834
+ $groupPath = $this->SavedGroups[$alias];
835
+ $value = $this->result;
836
+ foreach ($groupPath as $k) {
837
+ $value = $value[$k];
838
+ }
839
+ } while (false);
840
+ return $value;
841
+ }
842
+
843
+ private function addArrayInline ($array, $indent) {
844
+ $CommonGroupPath = $this->path;
845
+ if (empty ($array)) return false;
846
+
847
+ foreach ($array as $k => $_) {
848
+ $this->addArray(array($k => $_), $indent);
849
+ $this->path = $CommonGroupPath;
850
+ }
851
+ return true;
852
+ }
853
+
854
+ private function addArray ($incoming_data, $incoming_indent) {
855
+
856
+ // print_r ($incoming_data);
857
+
858
+ if (count ($incoming_data) > 1)
859
+ return $this->addArrayInline ($incoming_data, $incoming_indent);
860
+
861
+ $key = key ($incoming_data);
862
+ $value = isset($incoming_data[$key]) ? $incoming_data[$key] : null;
863
+ if ($key === '__!YAMLZero') $key = '0';
864
+
865
+ if ($incoming_indent == 0 && !$this->_containsGroupAlias && !$this->_containsGroupAnchor) { // Shortcut for root-level values.
866
+ if ($key || $key === '' || $key === '0') {
867
+ $this->result[$key] = $value;
868
+ } else {
869
+ $this->result[] = $value; end ($this->result); $key = key ($this->result);
870
+ }
871
+ $this->path[$incoming_indent] = $key;
872
+ return;
873
+ }
874
+
875
+
876
+
877
+ $history = array();
878
+ // Unfolding inner array tree.
879
+ $history[] = $_arr = $this->result;
880
+ foreach ($this->path as $k) {
881
+ $history[] = $_arr = $_arr[$k];
882
+ }
883
+
884
+ if ($this->_containsGroupAlias) {
885
+ $value = $this->referenceContentsByAlias($this->_containsGroupAlias);
886
+ $this->_containsGroupAlias = false;
887
+ }
888
+
889
+
890
+ // Adding string or numeric key to the innermost level or $this->arr.
891
+ if (is_string($key) && $key == '<<') {
892
+ if (!is_array ($_arr)) { $_arr = array (); }
893
+
894
+ $_arr = array_merge ($_arr, $value);
895
+ } else if ($key || $key === '' || $key === '0') {
896
+ if (!is_array ($_arr))
897
+ $_arr = array ($key=>$value);
898
+ else
899
+ $_arr[$key] = $value;
900
+ } else {
901
+ if (!is_array ($_arr)) { $_arr = array ($value); $key = 0; }
902
+ else { $_arr[] = $value; end ($_arr); $key = key ($_arr); }
903
+ }
904
+
905
+ $reverse_path = array_reverse($this->path);
906
+ $reverse_history = array_reverse ($history);
907
+ $reverse_history[0] = $_arr;
908
+ $cnt = count($reverse_history) - 1;
909
+ for ($i = 0; $i < $cnt; $i++) {
910
+ $reverse_history[$i+1][$reverse_path[$i]] = $reverse_history[$i];
911
+ }
912
+ $this->result = $reverse_history[$cnt];
913
+
914
+ $this->path[$incoming_indent] = $key;
915
+
916
+ if ($this->_containsGroupAnchor) {
917
+ $this->SavedGroups[$this->_containsGroupAnchor] = $this->path;
918
+ if (is_array ($value)) {
919
+ $k = key ($value);
920
+ if (!is_int ($k)) {
921
+ $this->SavedGroups[$this->_containsGroupAnchor][$incoming_indent + 2] = $k;
922
+ }
923
+ }
924
+ $this->_containsGroupAnchor = false;
925
+ }
926
+
927
+ }
928
+
929
+ private static function startsLiteralBlock ($line) {
930
+ $lastChar = substr (trim($line), -1);
931
+ if ($lastChar != '>' && $lastChar != '|') return false;
932
+ if ($lastChar == '|') return $lastChar;
933
+ // HTML tags should not be counted as literal blocks.
934
+ if (preg_match ('#<.*?>$#', $line)) return false;
935
+ return $lastChar;
936
+ }
937
+
938
+ private static function greedilyNeedNextLine($line) {
939
+ $line = trim ($line);
940
+ if (!strlen($line)) return false;
941
+ if (substr ($line, -1, 1) == ']') return false;
942
+ if ($line[0] == '[') return true;
943
+ if (preg_match ('#^[^:]+?:\s*\[#', $line)) return true;
944
+ return false;
945
+ }
946
+
947
+ private function addLiteralLine ($literalBlock, $line, $literalBlockStyle, $indent = -1) {
948
+ $line = self::stripIndent($line, $indent);
949
+ if ($literalBlockStyle !== '|') {
950
+ $line = self::stripIndent($line);
951
+ }
952
+ $line = rtrim ($line, "\r\n\t ") . "\n";
953
+ if ($literalBlockStyle == '|') {
954
+ return $literalBlock . $line;
955
+ }
956
+ if (strlen($line) == 0)
957
+ return rtrim($literalBlock, ' ') . "\n";
958
+ if ($line == "\n" && $literalBlockStyle == '>') {
959
+ return rtrim ($literalBlock, " \t") . "\n";
960
+ }
961
+ if ($line != "\n")
962
+ $line = trim ($line, "\r\n ") . " ";
963
+ return $literalBlock . $line;
964
+ }
965
+
966
+ function revertLiteralPlaceHolder ($lineArray, $literalBlock) {
967
+ foreach ($lineArray as $k => $_) {
968
+ if (is_array($_))
969
+ $lineArray[$k] = $this->revertLiteralPlaceHolder ($_, $literalBlock);
970
+ else if (substr($_, -1 * strlen ($this->LiteralPlaceHolder)) == $this->LiteralPlaceHolder)
971
+ $lineArray[$k] = rtrim ($literalBlock, " \r\n");
972
+ }
973
+ return $lineArray;
974
+ }
975
+
976
+ private static function stripIndent ($line, $indent = -1) {
977
+ if ($indent == -1) $indent = strlen($line) - strlen(ltrim($line));
978
+ return substr ($line, $indent);
979
+ }
980
+
981
+ private function getParentPathByIndent ($indent) {
982
+ if ($indent == 0) return array();
983
+ $linePath = $this->path;
984
+ do {
985
+ end($linePath); $lastIndentInParentPath = key($linePath);
986
+ if ($indent <= $lastIndentInParentPath) array_pop ($linePath);
987
+ } while ($indent <= $lastIndentInParentPath);
988
+ return $linePath;
989
+ }
990
+
991
+
992
+ private function clearBiggerPathValues ($indent) {
993
+
994
+
995
+ if ($indent == 0) $this->path = array();
996
+ if (empty ($this->path)) return true;
997
+
998
+ foreach ($this->path as $k => $_) {
999
+ if ($k > $indent) unset ($this->path[$k]);
1000
+ }
1001
+
1002
+ return true;
1003
+ }
1004
+
1005
+
1006
+ private static function isComment ($line) {
1007
+ if (!$line) return false;
1008
+ if ($line[0] == '#') return true;
1009
+ if (trim($line, " \r\n\t") == '---') return true;
1010
+ return false;
1011
+ }
1012
+
1013
+ private static function isEmpty ($line) {
1014
+ return (trim ($line) === '');
1015
+ }
1016
+
1017
+
1018
+ private function isArrayElement ($line) {
1019
+ if (!$line || !is_scalar($line)) return false;
1020
+ if (substr($line, 0, 2) != '- ') return false;
1021
+ if (strlen ($line) > 3)
1022
+ if (substr($line,0,3) == '---') return false;
1023
+
1024
+ return true;
1025
+ }
1026
+
1027
+ private function isHashElement ($line) {
1028
+ return strpos($line, ':');
1029
+ }
1030
+
1031
+ private function isLiteral ($line) {
1032
+ if ($this->isArrayElement($line)) return false;
1033
+ if ($this->isHashElement($line)) return false;
1034
+ return true;
1035
+ }
1036
+
1037
+
1038
+ private static function unquote ($value) {
1039
+ if (!$value) return $value;
1040
+ if (!is_string($value)) return $value;
1041
+ if ($value[0] == '\'') return trim ($value, '\'');
1042
+ if ($value[0] == '"') return trim ($value, '"');
1043
+ return $value;
1044
+ }
1045
+
1046
+ private function startsMappedSequence ($line) {
1047
+ return (substr($line, 0, 2) == '- ' && substr ($line, -1, 1) == ':');
1048
+ }
1049
+
1050
+ private function returnMappedSequence ($line) {
1051
+ $array = array();
1052
+ $key = self::unquote(trim(substr($line,1,-1)));
1053
+ $array[$key] = array();
1054
+ $this->delayedPath = array(strpos ($line, $key) + $this->indent => $key);
1055
+ return array($array);
1056
+ }
1057
+
1058
+ private function checkKeysInValue($value) {
1059
+ if (strchr('[{"\'', $value[0]) === false) {
1060
+ if (strchr($value, ': ') !== false) {
1061
+ throw new Exception('Too many keys: '.$value);
1062
+ }
1063
+ }
1064
+ }
1065
+
1066
+ private function returnMappedValue ($line) {
1067
+ $this->checkKeysInValue($line);
1068
+ $array = array();
1069
+ $key = self::unquote (trim(substr($line,0,-1)));
1070
+ $array[$key] = '';
1071
+ return $array;
1072
+ }
1073
+
1074
+ private function startsMappedValue ($line) {
1075
+ return (substr ($line, -1, 1) == ':');
1076
+ }
1077
+
1078
+ private function isPlainArray ($line) {
1079
+ return ($line[0] == '[' && substr ($line, -1, 1) == ']');
1080
+ }
1081
+
1082
+ private function returnPlainArray ($line) {
1083
+ return $this->_toType($line);
1084
+ }
1085
+
1086
+ private function returnKeyValuePair ($line) {
1087
+ $array = array();
1088
+ $key = '';
1089
+ if (strpos ($line, ': ')) {
1090
+ // It's a key/value pair most likely
1091
+ // If the key is in double quotes pull it out
1092
+ if (($line[0] == '"' || $line[0] == "'") && preg_match('/^(["\'](.*)["\'](\s)*:)/',$line,$matches)) {
1093
+ $value = trim(str_replace($matches[1],'',$line));
1094
+ $key = $matches[2];
1095
+ } else {
1096
+ // Do some guesswork as to the key and the value
1097
+ $explode = explode(': ', $line);
1098
+ $key = trim(array_shift($explode));
1099
+ $value = trim(implode(': ', $explode));
1100
+ $this->checkKeysInValue($value);
1101
+ }
1102
+ // Set the type of the value. Int, string, etc
1103
+ $value = $this->_toType($value);
1104
+ if ($key === '0') $key = '__!YAMLZero';
1105
+ $array[$key] = $value;
1106
+ } else {
1107
+ $array = array ($line);
1108
+ }
1109
+ return $array;
1110
+
1111
+ }
1112
+
1113
+
1114
+ private function returnArrayElement ($line) {
1115
+ if (strlen($line) <= 1) return array(array()); // Weird %)
1116
+ $array = array();
1117
+ $value = trim(substr($line,1));
1118
+ $value = $this->_toType($value);
1119
+ if ($this->isArrayElement($value)) {
1120
+ $value = $this->returnArrayElement($value);
1121
+ }
1122
+ $array[] = $value;
1123
+ return $array;
1124
+ }
1125
+
1126
+
1127
+ private function nodeContainsGroup ($line) {
1128
+ $symbolsForReference = 'A-z0-9_\-';
1129
+ if (strpos($line, '&') === false && strpos($line, '*') === false) return false; // Please die fast ;-)
1130
+ if ($line[0] == '&' && preg_match('/^(&['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];
1131
+ if ($line[0] == '*' && preg_match('/^(\*['.$symbolsForReference.']+)/', $line, $matches)) return $matches[1];
1132
+ if (preg_match('/(&['.$symbolsForReference.']+)$/', $line, $matches)) return $matches[1];
1133
+ if (preg_match('/(\*['.$symbolsForReference.']+$)/', $line, $matches)) return $matches[1];
1134
+ if (preg_match ('#^\s*<<\s*:\s*(\*[^\s]+).*$#', $line, $matches)) return $matches[1];
1135
+ return false;
1136
+
1137
+ }
1138
+
1139
+ private function addGroup ($line, $group) {
1140
+ if ($group[0] == '&') $this->_containsGroupAnchor = substr ($group, 1);
1141
+ if ($group[0] == '*') $this->_containsGroupAlias = substr ($group, 1);
1142
+ //print_r ($this->path);
1143
+ }
1144
+
1145
+ private function stripGroup ($line, $group) {
1146
+ $line = trim(str_replace($group, '', $line));
1147
+ return $line;
1148
+ }
1149
+ }
1150
+ }
1151
+
1152
+ // Enable use of Spyc from command line
1153
+ // The syntax is the following: php Spyc.php spyc.yaml
1154
+
1155
+ do {
1156
+ if (PHP_SAPI != 'cli') break;
1157
+ if (empty ($_SERVER['argc']) || $_SERVER['argc'] < 2) break;
1158
+ if (empty ($_SERVER['PHP_SELF']) || FALSE === strpos ($_SERVER['PHP_SELF'], 'Spyc.php') ) break;
1159
+ $file = $argv[1];
1160
+ echo json_encode (spyc_load_file ($file));
1161
+ } while (0);
assets/js/input-v4.js CHANGED
@@ -1,15 +1,16 @@
1
  (function($){
2
-
3
  function update_preview( $select_element, parent ) {
4
- var value = $select_element.val();
 
5
 
6
  if ( ! parent ) {
7
  var parent = $select_element.closest('.field');
8
  }
9
 
10
- $( '.icon_preview', parent ).html( '<i class="fa ' + value + '" aria-hidden="true"></i>' );
11
 
12
- $( '.field_option_font-awesome .fa_live_preview', parent ).html( '<i class="fa ' + value + '" aria-hidden="true"></i>' );
13
  }
14
 
15
  function initialize_chosen( $select, allow_deselect ) {
@@ -17,7 +18,8 @@
17
  width : '100%',
18
  no_results_text : ACFFA.no_results,
19
  rtl : ACFFA.is_rtl,
20
- allow_single_deselect : allow_deselect
 
21
  });
22
  }
23
 
1
  (function($){
2
+
3
  function update_preview( $select_element, parent ) {
4
+ var value = $select_element.val(),
5
+ class_prefix = ( ACFFA.major_version >= 5 ) ? '' : 'fa ';
6
 
7
  if ( ! parent ) {
8
  var parent = $select_element.closest('.field');
9
  }
10
 
11
+ $( '.icon_preview', parent ).html( '<i class="' + class_prefix + value + '" aria-hidden="true"></i>' );
12
 
13
+ $( '.field_option_font-awesome .fa_live_preview', parent ).html( '<i class="' + class_prefix + value + '" aria-hidden="true"></i>' );
14
  }
15
 
16
  function initialize_chosen( $select, allow_deselect ) {
18
  width : '100%',
19
  no_results_text : ACFFA.no_results,
20
  rtl : ACFFA.is_rtl,
21
+ allow_single_deselect : allow_deselect,
22
+ inherit_select_classes : true
23
  });
24
  }
25
 
assets/js/input-v5.js CHANGED
@@ -1,8 +1,9 @@
1
  (function($){
2
 
3
  function update_preview( value, parent ) {
4
- $( '.acf-field-setting-fa_live_preview .acf-input', parent ).html( '<i class="fa ' + value + '" aria-hidden="true"></i>' );
5
- $( '.icon_preview', parent ).html( '<i class="fa ' + value + '" aria-hidden="true"></i>' );
 
6
  }
7
 
8
  function select2_init_args( element, parent ) {
@@ -33,8 +34,8 @@
33
  acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
34
 
35
  if ( $select.hasClass('select2-fontawesome') ) {
36
- args.dropdownCssClass = 'fa-select2-drop';
37
- args.containerCssClass = 'fa-select2';
38
  }
39
 
40
  return args;
1
  (function($){
2
 
3
  function update_preview( value, parent ) {
4
+ var class_prefix = ( ACFFA.major_version >= 5 ) ? '' : 'fa ';
5
+ $( '.acf-field-setting-fa_live_preview .acf-input', parent ).html( '<i class="' + class_prefix + value + '" aria-hidden="true"></i>' );
6
+ $( '.icon_preview', parent ).html( '<i class="' + class_prefix + value + '" aria-hidden="true"></i>' );
7
  }
8
 
9
  function select2_init_args( element, parent ) {
34
  acf.add_filter( 'select2_args', function( args, $select, settings, $field ) {
35
 
36
  if ( $select.hasClass('select2-fontawesome') ) {
37
+ args.dropdownCssClass = 'fa-select2-drop fa' + ACFFA.major_version;
38
+ args.containerCssClass = 'fa-select2 fa' + ACFFA.major_version;
39
  }
40
 
41
  return args;
fields/acf-font-awesome-v4.php CHANGED
@@ -31,7 +31,7 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
31
  'save_format' => 'element',
32
  'default_value' => '',
33
  'fa_live_preview' => '',
34
- 'choices' => $this->get_icons('list')
35
  );
36
 
37
  parent::__construct();
@@ -193,15 +193,34 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
193
  <div class="icon_preview"></div>
194
  <?php endif; ?>
195
 
196
- <select id="<?php echo $field['id']; ?>" class="chosen-fontawesome fontawesome-edit" name="<?php echo esc_attr($field['name']) ?>" data-ui="1" data-ajax="1" data-multiple="0" data-placeholder="- Select -" data-allow_null="<?php echo $field['allow_null']; ?>">
197
  <?php
198
  $icons = $this->get_icons('list');
 
199
  if ( $icons ) :
200
- foreach ( $icons as $value => $label ) :
201
- ?>
202
- <option value="<?php echo $value; ?>" <?php selected( $select_value, $value ); ?>><?php echo $label; ?></option>
203
- <?php
204
- endforeach;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  endif;
206
  ?>
207
  </select>
@@ -234,7 +253,8 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
234
  'chosen' => apply_filters( 'ACFFA_load_chosen', true ),
235
  'nonce' => wp_create_nonce( 'ACFFA_nonce' ),
236
  'is_rtl' => is_rtl(),
237
- 'no_results' => __( 'Cannot find icon', 'acf-font-awesome' ) . ' : '
 
238
  ));
239
 
240
  wp_register_style( 'acf-input-font-awesome', "{$url}assets/css/input.css", $dependencies, $version );
@@ -271,16 +291,46 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
271
  return $value;
272
  }
273
 
274
- switch ( $field['save_format'] ) {
275
- case 'element':
276
- case 'class':
277
- case 'unicode':
278
- $value = $this->icons['details'][ $value ][ $field['save_format'] ];
279
- break;
 
 
 
 
280
 
281
- case 'object':
282
- $value = ( object ) $this->icons['details'][ $value ];
283
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
 
286
  return $value;
31
  'save_format' => 'element',
32
  'default_value' => '',
33
  'fa_live_preview' => '',
34
+ 'choices' => array()
35
  );
36
 
37
  parent::__construct();
193
  <div class="icon_preview"></div>
194
  <?php endif; ?>
195
 
196
+ <select id="<?php echo $field['id']; ?>" class="chosen-fontawesome fontawesome-edit fa<?php echo ACFFA_MAJOR_VERSION; ?>" name="<?php echo esc_attr($field['name']) ?>" data-ui="1" data-ajax="1" data-multiple="0" data-placeholder="- Select -" data-allow_null="<?php echo $field['allow_null']; ?>">
197
  <?php
198
  $icons = $this->get_icons('list');
199
+
200
  if ( $icons ) :
201
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '<' ) ) :
202
+ foreach ( $icons as $value => $label ) :
203
+ ?>
204
+ <option value="<?php echo $value; ?>" <?php selected( $select_value, $value ); ?>><?php echo $label; ?></option>
205
+ <?php
206
+ endforeach;
207
+ else :
208
+ foreach ( $icons as $prefix => $children ) :
209
+ $prefix_label = apply_filters( 'ACFFA_icon_prefix_label', 'Regular', $prefix );
210
+ ?>
211
+ <optgroup label="<?php echo $prefix_label; ?>"><?php echo $prefix_label; ?>
212
+ <?php
213
+ foreach ( $children as $value => $label ) :
214
+ $label = explode( '; ', strip_tags( $label ) );
215
+ ?>
216
+ <option class="<?php echo $value; ?>" value="<?php echo $value; ?>" style=""<?php selected( $select_value, $value ); ?>><?php echo $label[1]; ?></option>
217
+ <?php
218
+ endforeach;
219
+ ?>
220
+ </optgroup>
221
+ <?php
222
+ endforeach;
223
+ endif;
224
  endif;
225
  ?>
226
  </select>
253
  'chosen' => apply_filters( 'ACFFA_load_chosen', true ),
254
  'nonce' => wp_create_nonce( 'ACFFA_nonce' ),
255
  'is_rtl' => is_rtl(),
256
+ 'no_results' => __( 'Cannot find icon', 'acf-font-awesome' ) . ' : ',
257
+ 'major_version' => ACFFA_MAJOR_VERSION
258
  ));
259
 
260
  wp_register_style( 'acf-input-font-awesome', "{$url}assets/css/input.css", $dependencies, $version );
291
  return $value;
292
  }
293
 
294
+ if ( ! $this->icons ) {
295
+ $this->get_icons();
296
+ }
297
+
298
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '<' ) ) {
299
+ $icon = isset( $this->icons['details'][ $value ] ) ? $this->icons['details'][ $value ] : false;
300
+ } else {
301
+ $prefix = substr( $value, 0, 3 );
302
+ $icon = isset( $this->icons['details'][ $prefix ][ $value ] ) ? $this->icons['details'][ $prefix ][ $value ] : false;
303
+ }
304
 
305
+ if ( $icon ) {
306
+ switch ( $field['save_format'] ) {
307
+ case 'element':
308
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '<' ) ) {
309
+ $value = '<i class="fa ' . $value . '" aria-hidden="true"></i>';
310
+ } else {
311
+ $value = '<i class="' . $value . '" aria-hidden="true"></i>';
312
+ }
313
+ break;
314
+
315
+ case 'unicode':
316
+ $value = $icon['unicode'];
317
+ break;
318
+
319
+ case 'object':
320
+ $object_data = array(
321
+ 'element' => '<i class="' . $value . '" aria-hidden="true"></i>',
322
+ 'class' => $value,
323
+ 'hex' => $icon['hex'],
324
+ 'unicode' => $icon['unicode']
325
+ );
326
+
327
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '>=' ) ) {
328
+ $object_data['prefix'] = $prefix;
329
+ }
330
+
331
+ $value = ( object ) $object_data;
332
+ break;
333
+ }
334
  }
335
 
336
  return $value;
fields/acf-font-awesome-v5.php CHANGED
@@ -25,7 +25,7 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
25
  'save_format' => 'element',
26
  'default_value' => '',
27
  'fa_live_preview' => '',
28
- 'choices' => $this->get_icons('list')
29
  );
30
 
31
  parent::__construct();
@@ -131,6 +131,8 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
131
  } else {
132
  $select_value = ( 'null' != $field['value'] ) ? $field['value'] : $field['default_value'];
133
  }
 
 
134
  ?>
135
  <input type="hidden" id="<?php echo $field['id']; ?>-input" name="<?php echo $field['name']; ?>" value="<?php echo $select_value; ?>">
136
 
@@ -138,15 +140,37 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
138
  <div class="icon_preview"></div>
139
  <?php endif; ?>
140
 
141
- <select id="<?php echo $field['id']; ?>" class="select2-fontawesome fontawesome-edit" name="<?php echo esc_attr($field['name']) ?>" data-ui="1" data-ajax="1" data-multiple="0" data-placeholder="- Select -" data-allow_null="<?php echo $field['allow_null']; ?>">
142
  <?php
143
  $icons = $this->get_icons('list');
144
- if ( $icons ) :
145
- foreach ( $icons as $value => $label ) :
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  ?>
147
- <option value="<?php echo $value; ?>" <?php selected( $select_value, $value ); ?>><?php echo $label; ?></option>
148
  <?php
149
- endforeach;
150
  endif;
151
  ?>
152
  </select>
@@ -159,6 +183,9 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
159
  $version = $this->settings['version'];
160
 
161
  wp_register_script( 'acf-input-font-awesome', "{$url}assets/js/input-v5.js", array('acf-input'), $version );
 
 
 
162
  wp_enqueue_script('acf-input-font-awesome');
163
 
164
  wp_register_style( 'acf-input-font-awesome', "{$url}assets/css/input.css", array('acf-input'), $version );
@@ -195,16 +222,44 @@ if ( ! class_exists( 'acf_field_font_awesome' ) ) :
195
  return $value;
196
  }
197
 
198
- if ( isset( $this->icons['details'][ $value ] ) ) {
 
 
 
 
 
 
 
 
 
 
 
199
  switch ( $field['save_format'] ) {
200
  case 'element':
201
- case 'class':
 
 
 
 
 
 
202
  case 'unicode':
203
- $value = $this->icons['details'][ $value ][ $field['save_format'] ];
204
  break;
205
 
206
  case 'object':
207
- $value = ( object ) $this->icons['details'][ $value ];
 
 
 
 
 
 
 
 
 
 
 
208
  break;
209
  }
210
  }
25
  'save_format' => 'element',
26
  'default_value' => '',
27
  'fa_live_preview' => '',
28
+ 'choices' => array()
29
  );
30
 
31
  parent::__construct();
131
  } else {
132
  $select_value = ( 'null' != $field['value'] ) ? $field['value'] : $field['default_value'];
133
  }
134
+
135
+ $select2_class = version_compare( ACFFA_MAJOR_VERSION, 5, '>=' ) ? 'fa5' : 'fa4';
136
  ?>
137
  <input type="hidden" id="<?php echo $field['id']; ?>-input" name="<?php echo $field['name']; ?>" value="<?php echo $select_value; ?>">
138
 
140
  <div class="icon_preview"></div>
141
  <?php endif; ?>
142
 
143
+ <select id="<?php echo $field['id']; ?>" class="<?php echo $select2_class; ?> select2-fontawesome fontawesome-edit" name="<?php echo esc_attr($field['name']) ?>" data-ui="1" data-ajax="1" data-multiple="0" data-placeholder="- Select -" data-allow_null="<?php echo $field['allow_null']; ?>">
144
  <?php
145
  $icons = $this->get_icons('list');
146
+
147
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '<' ) ) :
148
+ if ( $select_value && isset( $icons[ $select_value ] ) ) :
149
+ ?>
150
+ <option value="<?php echo $select_value; ?>" selected="selected"><?php echo $icons[ $select_value ]; ?></option>
151
+ <?php
152
+ elseif ( ( ! $select_value || ! isset( $icons[ $select_value ] ) ) && ! $field['allow_null'] ) :
153
+ $default_value = reset( $icons );
154
+ $default_key = key( $icons );
155
+ ?>
156
+ <option value="<?php echo $default_key; ?>" selected="selected"><?php echo $default_value; ?></option>
157
+ <?php
158
+ endif;
159
+ else :
160
+ $prefix = substr( $select_value, 0, 3 );
161
+ if ( $select_value && isset( $icons[ $prefix ][ $select_value ] ) ) :
162
+ ?>
163
+ <option value="<?php echo $select_value; ?>" selected="selected"><?php echo htmlentities( $icons[ $prefix ][ $select_value ] ); ?></option>
164
+ <?php
165
+ elseif ( ( ! $select_value || ! isset( $icons[ $prefix ][ $select_value ] ) ) && ! $field['allow_null'] ) :
166
+ $default_style_value = reset( $icons );
167
+ $default_style_key = key( $icons );
168
+ $default_value = reset( $default_style_value );
169
+ $default_key = key( $default_style_value );
170
  ?>
171
+ <option value="<?php echo $default_key; ?>" selected="selected"><?php echo $default_value; ?></option>
172
  <?php
173
+ endif;
174
  endif;
175
  ?>
176
  </select>
183
  $version = $this->settings['version'];
184
 
185
  wp_register_script( 'acf-input-font-awesome', "{$url}assets/js/input-v5.js", array('acf-input'), $version );
186
+ wp_localize_script( 'acf-input-font-awesome', 'ACFFA', array(
187
+ 'major_version' => ACFFA_MAJOR_VERSION
188
+ ));
189
  wp_enqueue_script('acf-input-font-awesome');
190
 
191
  wp_register_style( 'acf-input-font-awesome', "{$url}assets/css/input.css", array('acf-input'), $version );
222
  return $value;
223
  }
224
 
225
+ if ( ! $this->icons ) {
226
+ $this->get_icons();
227
+ }
228
+
229
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '<' ) ) {
230
+ $icon = isset( $this->icons['details'][ $value ] ) ? $this->icons['details'][ $value ] : false;
231
+ } else {
232
+ $prefix = substr( $value, 0, 3 );
233
+ $icon = isset( $this->icons['details'][ $prefix ][ $value ] ) ? $this->icons['details'][ $prefix ][ $value ] : false;
234
+ }
235
+
236
+ if ( $icon ) {
237
  switch ( $field['save_format'] ) {
238
  case 'element':
239
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '<' ) ) {
240
+ $value = '<i class="fa ' . $value . '" aria-hidden="true"></i>';
241
+ } else {
242
+ $value = '<i class="' . $value . '" aria-hidden="true"></i>';
243
+ }
244
+ break;
245
+
246
  case 'unicode':
247
+ $value = $icon['unicode'];
248
  break;
249
 
250
  case 'object':
251
+ $object_data = array(
252
+ 'element' => '<i class="' . $value . '" aria-hidden="true"></i>',
253
+ 'class' => $value,
254
+ 'hex' => $icon['hex'],
255
+ 'unicode' => $icon['unicode']
256
+ );
257
+
258
+ if ( version_compare( ACFFA_MAJOR_VERSION, 5, '>=' ) ) {
259
+ $object_data['prefix'] = $prefix;
260
+ }
261
+
262
+ $value = ( object ) $object_data;
263
  break;
264
  }
265
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mattkeys
3
  Tags: Advanced Custom Fields, ACF, Font Awesome, FontAwesome
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
- Stable tag: trunk
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -51,6 +51,11 @@ This ACF field type is compatible with:
51
 
52
  == Changelog ==
53
 
 
 
 
 
 
54
  = 2.1.2 =
55
  * Fixed bug where ACFFA_get_icons filter was not used in wp-admin area when retrieving icons.
56
 
@@ -160,6 +165,11 @@ This ACF field type is compatible with:
160
 
161
  == Upgrade Notice ==
162
 
 
 
 
 
 
163
  = 2.1.2 =
164
  * Fixed bug where ACFFA_get_icons filter was not used in wp-admin area when retrieving icons.
165
 
3
  Tags: Advanced Custom Fields, ACF, Font Awesome, FontAwesome
4
  Requires at least: 3.5
5
  Tested up to: 4.9
6
+ Stable tag: 2.1.2
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
51
 
52
  == Changelog ==
53
 
54
+ = 3.0.0-beta1 =
55
+ * Adding support for new FontAwesome 5.x free icon set
56
+ * Adding new FontAwesome Settings admin menu under the ACF primary menu area for global configuration options.
57
+ * Page load performance improvements (don't load icons in field constructor)
58
+
59
  = 2.1.2 =
60
  * Fixed bug where ACFFA_get_icons filter was not used in wp-admin area when retrieving icons.
61
 
165
 
166
  == Upgrade Notice ==
167
 
168
+ = 3.0.0-beta1 =
169
+ * Adding support for new FontAwesome 5.x free icon set
170
+ * Adding new FontAwesome Settings admin menu under the ACF primary menu area for global configuration options.
171
+ * Page load performance improvements (don't load icons in field constructor)
172
+
173
  = 2.1.2 =
174
  * Fixed bug where ACFFA_get_icons filter was not used in wp-admin area when retrieving icons.
175