Skip to content

Commit

Permalink
Grouped backport and update from Subscribe2 HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
mattyrob committed Jul 9, 2024
1 parent 04a4a87 commit 81271f5
Show file tree
Hide file tree
Showing 27 changed files with 837 additions and 823 deletions.
172 changes: 88 additions & 84 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,84 +1,88 @@
module.exports = {
"env": {
"browser": true,
"jquery": true
},

"extends": "eslint:recommended",

"rules": {
"block-scoped-var": "error",
"comma-dangle": "error",
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error", "last"
],
"curly": "error",
"eol-last": [
"error",
"always"
],
"eqeqeq": "error",
"indent": [
"error",
"tab",
{
"SwitchCase": 1
}
],
"key-spacing": "error",
"linebreak-style": [
"error",
"unix"
],
"no-console": "error",
"no-else-return": "error",
"no-eval": "error",
"no-extra-parens": "error",
"no-implied-eval": "error",
"one-var-declaration-per-line": [
"error",
"initializations"
],
"semi": [
"error",
"always"
],
"semi-spacing": "error",
"space-in-parens": [
"error",
"always",
{
"exceptions": [
"empty",
]
}
],
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": true,
"overrides": {
"++": false,
"-": false
}
}
],
"vars-on-top": "error",
"yoda": [
"error",
"always"
]
},

"parserOptions": {
"ecmaVersion": 6
}
};
module.exports = [
{
"languageOptions": {
"ecmaVersion": 6
},
"rules": {
"block-scoped-var": "error",
"comma-dangle": "error",
"comma-spacing": [
"error",
{
"before": false,
"after": true
}
],
"comma-style": [
"error", "last"
],
"curly": "error",
"eol-last": [
"error",
"always"
],
"eqeqeq": "error",
"func-style": [
"error",
"declaration",
{
"allowArrowFunctions": false
}
],
"indent": [
"error",
"tab",
{
"SwitchCase": 1
}
],
"key-spacing": "error",
"linebreak-style": [
"error",
"unix"
],
"no-confusing-arrow": "error",
"no-console": "error",
"no-else-return": "error",
"no-eval": "error",
"no-extra-parens": "error",
"no-implied-eval": "error",
"no-mixed-spaces-and-tabs": "error",
"no-trailing-spaces": "error",
"one-var-declaration-per-line": [
"error",
"initializations"
],
"semi": [
"error",
"always"
],
"semi-spacing": "error",
"space-in-parens": [
"error",
"always",
{
"exceptions": [
"empty",
]
}
],
"space-unary-ops": [
"error",
{
"words": true,
"nonwords": true,
"overrides": {
"++": false,
"-": false
}
}
],
"vars-on-top": "error",
"yoda": [
"error",
"always"
]
}
}
];
26 changes: 8 additions & 18 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ module.exports = function( grunt ) {
grunt.initConfig(
{
eslint: {
options: {
overrideConfigFile: '.eslintrc.js'
},
grunt: {
src: [
'Gruntfile.js'
]
},
core: {
options: {
cwd: SOURCE_DIR,
fix: grunt.option( 'fix' )
},
src: [
Expand Down Expand Up @@ -100,7 +102,7 @@ module.exports = function( grunt ) {
],
options: {
bin: '/usr/local/bin/phpcs',
standard: '~/Desktop/subscribe2/ruleset.xml',
standard: '~/Plugins/ruleset.xml',
warningSeverity: 0
}
},
Expand All @@ -114,7 +116,7 @@ module.exports = function( grunt ) {
],
options: {
bin: '/usr/local/bin/phpcs',
standard: '~/Desktop/subscribe2/ruleset.xml',
standard: '~/Plugins/ruleset.xml',
warningSeverity: 1
}
}
Expand Down Expand Up @@ -157,17 +159,6 @@ module.exports = function( grunt ) {
}
}
},
csscomb: {
src: {
options: {
cwd: SOURCE_DIR
},
files: {
'./include/s2-user-admin.css': [ './include/s2-user-admin.css' ],
'./tinymce/css/content.css': [ './tinymce/css/content.css' ]
}
}
},
replace: {
version: {
options: {
Expand Down Expand Up @@ -342,7 +333,6 @@ module.exports = function( grunt ) {
[
'clean:minified',
'addtextdomain:s2cp',
'csscomb',
'terser',
'cssmin',
'imagemin',
Expand All @@ -362,13 +352,13 @@ module.exports = function( grunt ) {
'Preparing new release...',
function ( release ) {
var releases = [ 'major', 'minor', 'patch' ];
if ( arguments.length === 0 ) {
grunt.log.writeln( "Please specify release type, for example `grunt release:minor`" );
if ( 0 === arguments.length ) {
grunt.log.writeln( 'Please specify release type, for example `grunt release:minor`' );
} else {
if ( releases.includes( release ) ) {
grunt.task.run( 'release-' + release );
} else {
grunt.log.writeln( "Please specify a valid release type" );
grunt.log.writeln( 'Please specify a valid release type' );
}
}
}
Expand Down
10 changes: 4 additions & 6 deletions admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,11 @@
wp_schedule_event( $timestamp, $email_freq, 's2_digest_cron' );
}
}
} else {
if ( isset( s2cp()->subscribe2_options[ $key ] ) ) {
if ( 'sender' === $key && s2cp()->subscribe2_options[ $key ] !== $_POST[ $key ] ) {
s2cp()->subscribe2_options['dismiss_sender_warning'] = '0';
}
s2cp()->subscribe2_options[ $key ] = $_POST[ $key ];
} elseif ( isset( s2cp()->subscribe2_options[ $key ] ) ) {
if ( 'sender' === $key && s2cp()->subscribe2_options[ $key ] !== $_POST[ $key ] ) {
s2cp()->subscribe2_options['dismiss_sender_warning'] = '0';
}
s2cp()->subscribe2_options[ $key ] = $_POST[ $key ];
}
}

Expand Down
50 changes: 24 additions & 26 deletions admin/subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,26 @@
if ( false === s2cp()->validate_email( $clean_email ) ) {
( '' === $email_error ) ? $email_error = "$email" : $email_error .= ", $email";
continue;
} else {
if ( isset( $_POST['subscribe'] ) ) {
if ( false !== s2cp()->is_public( $clean_email ) ) {
( '' === $pub_sub_error ) ? $pub_sub_error = "$clean_email" : $pub_sub_error .= ", $clean_email";
continue;
}
if ( s2cp()->is_registered( $clean_email ) ) {
( '' === $reg_sub_error ) ? $reg_sub_error = "$clean_email" : $reg_sub_error .= ", $clean_email";
continue;
}
s2cp()->add( $clean_email, true );
$message = __( 'Address(es) subscribed!', 'subscribe2-for-cp' );
} elseif ( isset( $_POST['unsubscribe'] ) ) {
if ( false === s2cp()->is_public( $clean_email ) || s2cp()->is_registered( $clean_email ) ) {
( '' === $unsub_error ) ? $unsub_error = "$clean_email" : $unsub_error .= ", $clean_email";
continue;
}
s2cp()->delete( $clean_email );
$message = __( 'Address(es) unsubscribed!', 'subscribe2-for-cp' );
}

if ( isset( $_POST['subscribe'] ) ) {
if ( false !== s2cp()->is_public( $clean_email ) ) {
( '' === $pub_sub_error ) ? $pub_sub_error = "$clean_email" : $pub_sub_error .= ", $clean_email";
continue;
}
if ( s2cp()->is_registered( $clean_email ) ) {
( '' === $reg_sub_error ) ? $reg_sub_error = "$clean_email" : $reg_sub_error .= ", $clean_email";
continue;
}
s2cp()->add( $clean_email, true );
$message = __( 'Address(es) subscribed!', 'subscribe2-for-cp' );
} elseif ( isset( $_POST['unsubscribe'] ) ) {
if ( false === s2cp()->is_public( $clean_email ) || s2cp()->is_registered( $clean_email ) ) {
( '' === $unsub_error ) ? $unsub_error = "$clean_email" : $unsub_error .= ", $clean_email";
continue;
}
s2cp()->delete( $clean_email );
$message = __( 'Address(es) unsubscribed!', 'subscribe2-for-cp' );
}
}
if ( '' !== $reg_sub_error ) {
Expand Down Expand Up @@ -168,14 +168,12 @@
$what = 'all_users';
$subscribers = $all_users;
}
} elseif ( 'public' === $current_tab ) {
$what = 'public';
$subscribers = array_merge( (array) $confirmed, (array) $unconfirmed );
} else {
if ( 'public' === $current_tab ) {
$what = 'public';
$subscribers = array_merge( (array) $confirmed, (array) $unconfirmed );
} else {
$what = 'all_users';
$subscribers = $all_users;
}
$what = 'all_users';
$subscribers = $all_users;
}

if ( ! empty( $_POST['s'] ) ) {
Expand Down
Loading

0 comments on commit 81271f5

Please sign in to comment.