Better Font Awesome - Version 2.0.3

Version Description

  • Bugfix: fix broken icon text selection
  • Improve admin settings success/error message logic
Download this release

Release Info

Developer McGuive7
Plugin Icon 128x128 Better Font Awesome
Version 2.0.3
Comparing to
See all releases

Code changes from version 2.0.2 to 2.0.3

README.md CHANGED
@@ -6,7 +6,7 @@
6
  **Donate link:** https://mickeykay.me
7
  **Requires at least:** 3.0
8
  **Tested up to:** 6.0.2
9
- **Stable tag:** 2.0.2
10
  **License:** GPLv2+
11
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -113,6 +113,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,
113
 
114
  ## Changelog ##
115
 
 
 
 
 
116
  ### 2.0.2 ###
117
  * Bugfix: fix CSRF vulnerability
118
 
@@ -158,6 +162,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,
158
 
159
  ## Upgrade Notice ##
160
 
 
 
 
 
161
  ### 2.0.2 ###
162
  * Bugfix: fix CSRF vulnerability
163
 
6
  **Donate link:** https://mickeykay.me
7
  **Requires at least:** 3.0
8
  **Tested up to:** 6.0.2
9
+ **Stable tag:** 2.0.3
10
  **License:** GPLv2+
11
  **License URI:** http://www.gnu.org/licenses/gpl-2.0.html
12
 
113
 
114
  ## Changelog ##
115
 
116
+ ### 2.0.3 ###
117
+ * Bugfix: fix broken icon text selection
118
+ * Improve admin settings success/error message logic
119
+
120
  ### 2.0.2 ###
121
  * Bugfix: fix CSRF vulnerability
122
 
162
 
163
  ## Upgrade Notice ##
164
 
165
+ ### 2.0.3 ###
166
+ * Bugfix: fix broken icon text selection
167
+ * Improve admin settings success/error message logic
168
+
169
  ### 2.0.2 ###
170
  * Bugfix: fix CSRF vulnerability
171
 
better-font-awesome.php CHANGED
@@ -12,7 +12,7 @@
12
  * Plugin Name: Better Font Awesome
13
  * Plugin URI: http://wordpress.org/plugins/better-font-awesome
14
  * Description: The ultimate Font Awesome icon plugin for WordPress.
15
- * Version: 2.0.2
16
  * Author: Mickey Kay
17
  * Author URI: mickeyskay@gmail.com
18
  * License: GPLv2+
@@ -59,7 +59,7 @@ class Better_Font_Awesome_Plugin {
59
  *
60
  * @var string
61
  */
62
- const VERSION = '2.0.2';
63
 
64
  /**
65
  * The Better Font Awesome Library object.
@@ -489,9 +489,7 @@ class Better_Font_Awesome_Plugin {
489
  public function save_options() {
490
  if ( false == check_ajax_referer( self::SLUG . '-options', 'bfa_nonce', false ) ) {
491
  wp_die(
492
- '<div class="error"><p>'
493
- . __( 'Settings were not saved due to a missing nonce. Refresh the page and try again.', 'better-font-awesome' )
494
- . '</p></div>',
495
  403
496
  );
497
  }
@@ -506,7 +504,7 @@ class Better_Font_Awesome_Plugin {
506
  update_option( $this->option_name, $options );
507
 
508
  // Return a message.
509
- echo '<div class="updated"><p>' . esc_html__( 'Settings saved.', 'better-font-awesome' ) . '</p></div>';
510
 
511
  wp_die();
512
  }
12
  * Plugin Name: Better Font Awesome
13
  * Plugin URI: http://wordpress.org/plugins/better-font-awesome
14
  * Description: The ultimate Font Awesome icon plugin for WordPress.
15
+ * Version: 2.0.3
16
  * Author: Mickey Kay
17
  * Author URI: mickeyskay@gmail.com
18
  * License: GPLv2+
59
  *
60
  * @var string
61
  */
62
+ const VERSION = '2.0.3';
63
 
64
  /**
65
  * The Better Font Awesome Library object.
489
  public function save_options() {
490
  if ( false == check_ajax_referer( self::SLUG . '-options', 'bfa_nonce', false ) ) {
491
  wp_die(
492
+ __( 'Settings were not saved due to a missing nonce. Refresh the page and try again.', 'better-font-awesome' ),
 
 
493
  403
494
  );
495
  }
504
  update_option( $this->option_name, $options );
505
 
506
  // Return a message.
507
+ esc_html_e( 'Settings saved.', 'better-font-awesome' );
508
 
509
  wp_die();
510
  }
js/admin.js CHANGED
@@ -34,17 +34,29 @@
34
  $.post(
35
  bfa_ajax_object.ajax_url, // Array passed via wp_localize_script()
36
  data,
37
- function( response ) {
38
- $( '.bfa-loading-gif' ).fadeOut( function() {
39
- $( '.bfa-ajax-response-holder' ).html( response ).slideDown().delay(2000).fadeTo(600, 0).delay(300).slideUp().fadeTo(0, 100);
40
- });
 
 
 
 
 
 
41
  }
42
- ).fail( function( response ) {
43
  $( '.bfa-loading-gif' ).fadeOut( function() {
44
- $( '.bfa-ajax-response-holder' ).html( response.responseText ).slideDown().delay(2000).fadeTo(600, 0).delay(300).slideUp().fadeTo(0, 100);
 
 
 
 
 
 
 
45
  });
46
  });
47
-
48
  });
49
  });
50
  })( jQuery );
34
  $.post(
35
  bfa_ajax_object.ajax_url, // Array passed via wp_localize_script()
36
  data,
37
+ function() {}, // Empty success handler since success/errors handled below.
38
+ ).always( function( response, status, thing ) {
39
+ var message, messageClass;
40
+
41
+ if ('success' == status) {
42
+ message = response;
43
+ messageClass = 'updated';
44
+ } else {
45
+ message = response.responseText;
46
+ messageClass = 'error';
47
  }
48
+
49
  $( '.bfa-loading-gif' ).fadeOut( function() {
50
+ $( '.bfa-ajax-response-holder' )
51
+ .html( `<div class="${messageClass}"><p>${message}</p></div>` )
52
+ .slideDown()
53
+ .delay(2000)
54
+ .fadeTo(600, 0)
55
+ .delay(300)
56
+ .slideUp()
57
+ .fadeTo(0, 100);
58
  });
59
  });
 
60
  });
61
  });
62
  })( jQuery );
languages/better-font-awesome.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the GPLv2+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Better Font Awesome 2.0.2\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/better-font-awesome\n"
8
- "POT-Creation-Date: 2022-09-13 01:28:55+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -84,17 +84,17 @@ msgid ""
84
  "occur."
85
  msgstr ""
86
 
87
- #: better-font-awesome.php:493
88
  msgid ""
89
  "Settings were not saved due to a missing nonce. Refresh the page and try "
90
  "again."
91
  msgstr ""
92
 
93
- #: better-font-awesome.php:509
94
  msgid "Settings saved."
95
  msgstr ""
96
 
97
- #: better-font-awesome.php:533
98
  #. translators: placeholder is the numeric current version number.
99
  msgid ""
100
  "%s (The plugin automatically uses the latest version of Font Awesome, and "
2
  # This file is distributed under the GPLv2+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Better Font Awesome 2.0.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/better-font-awesome\n"
8
+ "POT-Creation-Date: 2022-09-14 06:25:05+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
84
  "occur."
85
  msgstr ""
86
 
87
+ #: better-font-awesome.php:492
88
  msgid ""
89
  "Settings were not saved due to a missing nonce. Refresh the page and try "
90
  "again."
91
  msgstr ""
92
 
93
+ #: better-font-awesome.php:507
94
  msgid "Settings saved."
95
  msgstr ""
96
 
97
+ #: better-font-awesome.php:531
98
  #. translators: placeholder is the numeric current version number.
99
  msgid ""
100
  "%s (The plugin automatically uses the latest version of Font Awesome, and "
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: better, font, awesome, icon, icons, bootstrap, fontstrap, cdn, shortcode
4
  Donate link: https://mickeykay.me
5
  Requires at least: 3.0
6
  Tested up to: 6.0.2
7
- Stable tag: 2.0.2
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -111,6 +111,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,
111
 
112
  == Changelog ==
113
 
 
 
 
 
114
  = 2.0.2 =
115
  * Bugfix: fix CSRF vulnerability
116
 
@@ -156,6 +160,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,
156
 
157
  == Upgrade Notice ==
158
 
 
 
 
 
159
  = 2.0.2 =
160
  * Bugfix: fix CSRF vulnerability
161
 
4
  Donate link: https://mickeykay.me
5
  Requires at least: 3.0
6
  Tested up to: 6.0.2
7
+ Stable tag: 2.0.3
8
  License: GPLv2+
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
111
 
112
  == Changelog ==
113
 
114
+ = 2.0.3 =
115
+ * Bugfix: fix broken icon text selection
116
+ * Improve admin settings success/error message logic
117
+
118
  = 2.0.2 =
119
  * Bugfix: fix CSRF vulnerability
120
 
160
 
161
  == Upgrade Notice ==
162
 
163
+ = 2.0.3 =
164
+ * Bugfix: fix broken icon text selection
165
+ * Improve admin settings success/error message logic
166
+
167
  = 2.0.2 =
168
  * Bugfix: fix CSRF vulnerability
169
 
vendor/mickey-kay/better-font-awesome-library/better-font-awesome-library.php CHANGED
@@ -45,7 +45,7 @@ class Better_Font_Awesome_Library {
45
  *
46
  * @var string
47
  */
48
- const VERSION = '2.0.1';
49
 
50
  /**
51
  * Font awesome GraphQL url.
@@ -921,13 +921,13 @@ class Better_Font_Awesome_Library {
921
 
922
  ob_start();
923
  ?>
924
- <span class="bfa-iconpicker fontawesome-iconpicker" data-selected="fa-flag">
925
- <a href="#" class="button button-secondary iconpicker-component">
926
  <span class="fa icon fa-flag icon-flag"></span>&nbsp;
927
  <?php esc_html_e( 'Insert Icon', 'better-font-awesome' ); ?>
928
  <i class="change-icon-placeholder"></i>
929
- </a>
930
- </span>
931
  <?php
932
  echo ob_get_clean();
933
 
45
  *
46
  * @var string
47
  */
48
+ const VERSION = '2.0.2';
49
 
50
  /**
51
  * Font awesome GraphQL url.
921
 
922
  ob_start();
923
  ?>
924
+ <div class="bfa-iconpicker" data-selected="fa-flag">
925
+ <button type="button" class="button iconpicker-component">
926
  <span class="fa icon fa-flag icon-flag"></span>&nbsp;
927
  <?php esc_html_e( 'Insert Icon', 'better-font-awesome' ); ?>
928
  <i class="change-icon-placeholder"></i>
929
+ </button>
930
+ </div>
931
  <?php
932
  echo ob_get_clean();
933
 
vendor/mickey-kay/better-font-awesome-library/css/admin-styles.css CHANGED
@@ -12,24 +12,17 @@
12
  * TinyMCE Button & Popup
13
  */
14
 
 
 
 
 
15
  .bfa-iconpicker .iconpicker-popover {
16
- position: absolute;
17
- top: 100%;
18
- left: 0;
19
  z-index: 1000;
20
- display: none;
21
- float: left;
22
- min-width: 160px;
23
- padding: 5px 0;
24
- list-style: none;
25
- font-size: 14px;
26
  background-color: #fff;
27
  border: 1px solid #ccc;
28
- border: 1px solid rgba(0,0,0,.15);
29
  border-radius: 4px;
30
  -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
31
  box-shadow: 0 6px 12px rgba(0,0,0,.175);
32
- background-clip: padding-box;
33
  }
34
 
35
  .bfa-iconpicker .iconpicker-popover .arrow {
@@ -50,10 +43,6 @@
50
  width: 100%;
51
  }
52
 
53
- .bfa-iconpicker .iconpicker-popover.popover {
54
- width: 253px;
55
- }
56
-
57
  .bfa-iconpicker .iconpicker-component i {
58
  display: none;
59
  }
12
  * TinyMCE Button & Popup
13
  */
14
 
15
+ .bfa-iconpicker {
16
+ display: inline-block;
17
+ }
18
+
19
  .bfa-iconpicker .iconpicker-popover {
 
 
 
20
  z-index: 1000;
 
 
 
 
 
 
21
  background-color: #fff;
22
  border: 1px solid #ccc;
 
23
  border-radius: 4px;
24
  -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
25
  box-shadow: 0 6px 12px rgba(0,0,0,.175);
 
26
  }
27
 
28
  .bfa-iconpicker .iconpicker-popover .arrow {
43
  width: 100%;
44
  }
45
 
 
 
 
 
46
  .bfa-iconpicker .iconpicker-component i {
47
  display: none;
48
  }
vendor/mickey-kay/better-font-awesome-library/css/admin-styles.min.css ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ .bfa-iconpicker{display:inline-block}.bfa-iconpicker .iconpicker-popover{z-index:1000;background-color:#fff;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,.175);box-shadow:0 6px 12px rgba(0,0,0,.175)}
2
+ .bfa-iconpicker .iconpicker-popover .arrow{display:none!important}.bfa-iconpicker .iconpicker-item{width:14px!important;height:14px!important;padding:14px!important;font-size:14px!important;line-height:1!important;box-shadow:0 0 0 1px #ddd!important}
3
+ .bfa-iconpicker input[type="search"]{width:100%}.bfa-iconpicker .iconpicker-component i{display:none}
vendor/mickey-kay/better-font-awesome-library/js/admin.js CHANGED
@@ -23,17 +23,24 @@
23
 
24
  $( function() {
25
 
26
- $( 'body' ).on( 'mousedown', '.bfa-iconpicker', function(e) { // Use mousedown even to allow for triggering click later without infinite looping.
 
 
 
 
 
 
 
 
27
 
28
- e.preventDefault();
29
 
30
- $( this ).not( ' .initialized' )
 
31
  .addClass( 'initialized' )
32
  .iconpicker({
33
  placement: 'bottomLeft',
34
  hideOnSelect: true,
35
- animation: false,
36
- selectedCustomClass: 'selected',
37
  icons: icons,
38
  fullClassFormatter: function( icon_title ) {
39
  var classes = [];
@@ -42,26 +49,29 @@
42
  return icon.base_class;
43
  },
44
  })
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  .find( '.iconpicker-item' ).each( function() {
46
  var $item = $( this );
47
  var title = $item.attr( 'title' ).replace( '.', '' );
48
 
49
  $item.attr( 'title', title );
50
  });
51
-
52
- $( this ).trigger( 'click' );
53
-
54
- })
55
- .on( 'click', '.bfa-iconpicker', function(e) {
56
- e.preventDefault(); // Prevent scrolling to top.
57
- $( this ).find( '.iconpicker-search' ).focus();
58
- });
59
-
60
- // Set up icon insertion functionality.
61
- $( '.bfa-iconpicker' ).on( 'iconpickerSelected', function( e ) {
62
- var icon_title = e.iconpickerItem.title.replace( '.', '' );
63
- var icon = get_icon_by_title( icon_title );
64
- wp.media.editor.insert( icon_shortcode( icon ) );
65
  });
66
  });
67
 
23
 
24
  $( function() {
25
 
26
+ // We initialize on click instead of document.ready to ensure
27
+ // that BFA triggers still work when dynamically loaded later
28
+ // (e.g. repeatable fields/editors).
29
+ //
30
+ // We use the 'mousedown' handler so that we can effectively
31
+ // initialize the trigger, then manually trigger a 'click'
32
+ // event to trigger the iconpicker's click handler, all
33
+ // without causing an infinite loop.
34
+ $( 'body' ).on( 'mousedown', '.bfa-iconpicker', function(e) {
35
 
36
+ var $iconPicker = $( this );
37
 
38
+ // Initialize if not already initialized.
39
+ $iconPicker.not( '.initialized' )
40
  .addClass( 'initialized' )
41
  .iconpicker({
42
  placement: 'bottomLeft',
43
  hideOnSelect: true,
 
 
44
  icons: icons,
45
  fullClassFormatter: function( icon_title ) {
46
  var classes = [];
49
  return icon.base_class;
50
  },
51
  })
52
+
53
+ // Place cursor focus on the search input.
54
+ .on( 'iconpickerShown', function( e ) {
55
+ $iconPicker.find( '.iconpicker-search' ).trigger( 'focus');
56
+ })
57
+
58
+ // Handle inserting selected icon into editor.
59
+ .on( 'iconpickerSelected', function( e ) {
60
+ var icon_title = e.iconpickerItem.title.replace( '.', '' );
61
+ var icon = get_icon_by_title( icon_title );
62
+ wp.media.editor.insert( icon_shortcode( icon ) );
63
+ })
64
+
65
+ // Fake a click to ensure trigger the iconpicker's native click handler.
66
+ .trigger( 'click' )
67
+
68
+ // Clean up human-readable icon names.
69
  .find( '.iconpicker-item' ).each( function() {
70
  var $item = $( this );
71
  var title = $item.attr( 'title' ).replace( '.', '' );
72
 
73
  $item.attr( 'title', title );
74
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  });
76
  });
77
 
vendor/mickey-kay/better-font-awesome-library/js/admin.min.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ (function(d){var c=Object.values(bfa_vars.fa_icons);function b(e){return c.find(function(f){return f.title==e;});}function a(e){var f=e.style?' style="'+e.style+'"':"";
2
+ return'[icon name="'+e.slug+'"'+f+' class="" unprefixed_class=""]';}d(function(){d("body").on("mousedown",".bfa-iconpicker",function(g){g.preventDefault();
3
+ var f=d(this);f.iconpicker({placement:"bottomLeft",hideOnSelect:true,animation:false,selectedCustomClass:"selected",icons:c,fullClassFormatter:function(h){var e=[];
4
+ var i=b(h);return i.base_class;},});f.find(".iconpicker-item").each(function(){var e=d(this);var h=e.attr("title").replace(".","");e.attr("title",h);});
5
+ f.find(".iconpicker-search").trigger("focus");});d(".bfa-iconpicker").on("iconpickerSelected",function(h){var f=h.iconpickerItem.title.replace(".","");
6
+ var g=b(f);wp.media.editor.insert(a(g));});});})(jQuery);
vendor/mickey-kay/better-font-awesome-library/package-lock.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "name": "better-font-awesome-library",
3
- "version": "2.0.0",
4
  "lockfileVersion": 1,
5
  "requires": true,
6
  "dependencies": {
1
  {
2
  "name": "better-font-awesome-library",
3
+ "version": "2.0.2",
4
  "lockfileVersion": 1,
5
  "requires": true,
6
  "dependencies": {