Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate message logic #44

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
**Donate link:** https://mickeykay.me
**Requires at least:** 3.0
**Tested up to:** 6.0.2
**Stable tag:** 2.0.2
**Stable tag:** 2.0.3
**License:** GPLv2+
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -113,6 +113,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,

## Changelog ##

### 2.0.3 ###
* Bugfix: fix broken icon text selection
* Improve admin settings success/error message logic

### 2.0.2 ###
* Bugfix: fix CSRF vulnerability

Expand Down Expand Up @@ -158,6 +162,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,

## Upgrade Notice ##

### 2.0.3 ###
* Bugfix: fix broken icon text selection
* Improve admin settings success/error message logic

### 2.0.2 ###
* Bugfix: fix CSRF vulnerability

Expand Down
10 changes: 4 additions & 6 deletions better-font-awesome.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Plugin Name: Better Font Awesome
* Plugin URI: http://wordpress.org/plugins/better-font-awesome
* Description: The ultimate Font Awesome icon plugin for WordPress.
* Version: 2.0.2
* Version: 2.0.3
* Author: Mickey Kay
* Author URI: [email protected]
* License: GPLv2+
Expand Down Expand Up @@ -59,7 +59,7 @@ class Better_Font_Awesome_Plugin {
*
* @var string
*/
const VERSION = '2.0.2';
const VERSION = '2.0.3';

/**
* The Better Font Awesome Library object.
Expand Down Expand Up @@ -489,9 +489,7 @@ public function admin_enqueue_scripts( $hook ) {
public function save_options() {
if ( false == check_ajax_referer( self::SLUG . '-options', 'bfa_nonce', false ) ) {
wp_die(
'<div class="error"><p>'
. __( 'Settings were not saved due to a missing nonce. Refresh the page and try again.', 'better-font-awesome' )
. '</p></div>',
__( 'Settings were not saved due to a missing nonce. Refresh the page and try again.', 'better-font-awesome' ),
403
);
}
Expand All @@ -506,7 +504,7 @@ public function save_options() {
update_option( $this->option_name, $options );

// Return a message.
echo '<div class="updated"><p>' . esc_html__( 'Settings saved.', 'better-font-awesome' ) . '</p></div>';
esc_html_e( 'Settings saved.', 'better-font-awesome' );

wp_die();
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Better Font Awesome",
"license": "GPL-2.0",
"require": {
"mickey-kay/better-font-awesome-library": "2.0.1"
"mickey-kay/better-font-awesome-library": "2.0.2"
},
"require-dev": {
"phpunit/phpunit": "^5|^7",
Expand Down
18 changes: 11 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,29 @@
$.post(
bfa_ajax_object.ajax_url, // Array passed via wp_localize_script()
data,
function( response ) {
$( '.bfa-loading-gif' ).fadeOut( function() {
$( '.bfa-ajax-response-holder' ).html( response ).slideDown().delay(2000).fadeTo(600, 0).delay(300).slideUp().fadeTo(0, 100);
});
function() {}, // Empty success handler since success/errors handled below.
).always( function( response, status, thing ) {
var message, messageClass;

if ('success' == status) {
message = response;
messageClass = 'updated';
} else {
message = response.responseText;
messageClass = 'error';
}
).fail( function( response ) {

$( '.bfa-loading-gif' ).fadeOut( function() {
$( '.bfa-ajax-response-holder' ).html( response.responseText ).slideDown().delay(2000).fadeTo(600, 0).delay(300).slideUp().fadeTo(0, 100);
$( '.bfa-ajax-response-holder' )
.html( `<div class="${messageClass}"><p>${message}</p></div>` )
.slideDown()
.delay(2000)
.fadeTo(600, 0)
.delay(300)
.slideUp()
.fadeTo(0, 100);
});
});

});
});
})( jQuery );
10 changes: 5 additions & 5 deletions languages/better-font-awesome.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the GPLv2+.
msgid ""
msgstr ""
"Project-Id-Version: Better Font Awesome 2.0.2\n"
"Project-Id-Version: Better Font Awesome 2.0.3\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/better-font-awesome\n"
"POT-Creation-Date: 2022-09-13 01:28:55+00:00\n"
"POT-Creation-Date: 2022-09-14 06:25:05+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down Expand Up @@ -84,17 +84,17 @@ msgid ""
"occur."
msgstr ""

#: better-font-awesome.php:493
#: better-font-awesome.php:492
msgid ""
"Settings were not saved due to a missing nonce. Refresh the page and try "
"again."
msgstr ""

#: better-font-awesome.php:509
#: better-font-awesome.php:507
msgid "Settings saved."
msgstr ""

#: better-font-awesome.php:533
#: better-font-awesome.php:531
#. translators: placeholder is the numeric current version number.
msgid ""
"%s (The plugin automatically uses the latest version of Font Awesome, and "
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "Better Font Awesome",
"description": "The best WordPress extension ever made!",
"version": "2.0.2",
"version": "2.0.3",
"homepage": "http://wordpress.org/plugins/better-font-awesome",
"scripts": {
"composer": "composer install",
Expand Down
10 changes: 9 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: better, font, awesome, icon, icons, bootstrap, fontstrap, cdn, shortcode
Donate link: https://mickeykay.me
Requires at least: 3.0
Tested up to: 6.0.2
Stable tag: 2.0.2
Stable tag: 2.0.3
License: GPLv2+
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -111,6 +111,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,

== Changelog ==

= 2.0.3 =
* Bugfix: fix broken icon text selection
* Improve admin settings success/error message logic

= 2.0.2 =
* Bugfix: fix CSRF vulnerability

Expand Down Expand Up @@ -156,6 +160,10 @@ Better Font Awesome does it's best to load after any existing Font Awesome CSS,

== Upgrade Notice ==

= 2.0.3 =
* Bugfix: fix broken icon text selection
* Improve admin settings success/error message logic

= 2.0.2 =
* Bugfix: fix CSRF vulnerability

Expand Down