Skip to content

Commit

Permalink
force short array notation, ditch wpcs
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Jan 11, 2025
1 parent cff3be2 commit 804aa8d
Show file tree
Hide file tree
Showing 97 changed files with 5,385 additions and 5,536 deletions.
8 changes: 2 additions & 6 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,11 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab

[*.yml]
indent_style = space
indent_size = 2

[*.js]
indent_style = space
indent_size = 2
[*.php]
indent_size = 4

[*.md]
trim_trailing_whitespace = false
Expand Down
6 changes: 1 addition & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
"require-dev": {
"phpunit/phpunit": "^9.0",
"brain/monkey": "^2.2",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.1",
"wp-coding-standards/wpcs": "dev-develop"
"squizlabs/php_codesniffer": "^3.11"
},
"scripts": {
"make-pot": "wp i18n make-pot . languages/mailchimp-for-wp.pot --exclude=assets/js",
Expand All @@ -33,9 +32,6 @@
"check-syntax": "find . -name '*.php' -not -path './vendor/*' -not -path './node_modules/*' -not -path './assets/*' -print0 | xargs -0 -n1 php -l"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"minimum-stability": "dev"
}
40 changes: 20 additions & 20 deletions config/default-form-messages.php
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
<?php

return array(
'subscribed' => array(
return [
'subscribed' => [
'type' => 'success',
'text' => esc_html__('Thank you, your sign-up request was successful! Please check your email inbox to confirm.', 'mailchimp-for-wp'),
),
'updated' => array(
],
'updated' => [
'type' => 'success',
'text' => esc_html__('Thank you, your records have been updated!', 'mailchimp-for-wp'),
),
'unsubscribed' => array(
],
'unsubscribed' => [
'type' => 'success',
'text' => esc_html__('You were successfully unsubscribed.', 'mailchimp-for-wp'),
),
'not_subscribed' => array(
],
'not_subscribed' => [
'type' => 'notice',
'text' => esc_html__('Given email address is not subscribed.', 'mailchimp-for-wp'),
),
'error' => array(
],
'error' => [
'type' => 'error',
'text' => esc_html__('Oops. Something went wrong. Please try again later.', 'mailchimp-for-wp'),
),
'invalid_email' => array(
],
'invalid_email' => [
'type' => 'error',
'text' => esc_html__('Please provide a valid email address.', 'mailchimp-for-wp'),
),
'already_subscribed' => array(
],
'already_subscribed' => [
'type' => 'notice',
'text' => esc_html__('Given email address is already subscribed, thank you!', 'mailchimp-for-wp'),
),
'required_field_missing' => array(
],
'required_field_missing' => [
'type' => 'error',
'text' => esc_html__('Please fill in the required fields.', 'mailchimp-for-wp'),
),
'no_lists_selected' => array(
],
'no_lists_selected' => [
'type' => 'error',
'text' => esc_html__('Please select at least one list.', 'mailchimp-for-wp'),
),
);
],
];
6 changes: 3 additions & 3 deletions config/default-form-settings.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

return array(
return [
'css' => 0,
'double_optin' => 1,
'hide_after_success' => 0,
'lists' => array(),
'lists' => [],
'redirect' => '',
'replace_interests' => 1,
'required_fields' => '',
'update_existing' => 0,
'subscriber_tags' => '',
);
];
4 changes: 2 additions & 2 deletions config/default-settings.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

return array(
return [
'api_key' => '',
'allow_usage_tracking' => 0,
'debug_log_level' => 'warning',
);
];
10 changes: 5 additions & 5 deletions includes/admin/class-admin-ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function __construct(MC4WP_Admin_Tools $tools)
*/
public function add_hooks()
{
add_action('wp_ajax_mc4wp_renew_mailchimp_lists', array( $this, 'refresh_mailchimp_lists' ));
add_action('wp_ajax_mc4wp_get_list_details', array( $this, 'get_list_details' ));
add_action('wp_ajax_mc4wp_renew_mailchimp_lists', [ $this, 'refresh_mailchimp_lists' ]);
add_action('wp_ajax_mc4wp_get_list_details', [ $this, 'get_list_details' ]);
}

/**
Expand Down Expand Up @@ -55,15 +55,15 @@ public function get_list_details()
}

$list_ids = (array) explode(',', $_GET['ids']);
$data = array();
$data = [];
$mailchimp = new MC4WP_MailChimp();
foreach ($list_ids as $list_id) {
$data[] = (object) array(
$data[] = (object) [
'id' => $list_id,
'merge_fields' => $mailchimp->get_list_merge_fields($list_id),
'interest_categories' => $mailchimp->get_list_interest_categories($list_id),
'marketing_permissions' => $mailchimp->get_list_marketing_permissions($list_id),
);
];
}

if (isset($_GET['format']) && $_GET['format'] === 'html') {
Expand Down
12 changes: 6 additions & 6 deletions includes/admin/class-admin-messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ class MC4WP_Admin_Messages
*/
public function add_hooks()
{
add_action('admin_notices', array( $this, 'show' ));
register_shutdown_function(array( $this, 'save' ));
add_action('admin_notices', [ $this, 'show' ]);
register_shutdown_function([ $this, 'save' ]);
}

private function load()
{
if (is_null($this->bag)) {
$this->bag = get_option('mc4wp_flash_messages', array());
$this->bag = get_option('mc4wp_flash_messages', []);
}
}

// empty flash bag
private function reset()
{
$this->bag = array();
$this->bag = [];
$this->dirty = true;
}

Expand All @@ -50,10 +50,10 @@ private function reset()
public function flash($message, $type = 'success')
{
$this->load();
$this->bag[] = array(
$this->bag[] = [
'text' => $message,
'type' => $type,
);
];
$this->dirty = true;
}

Expand Down
6 changes: 3 additions & 3 deletions includes/admin/class-admin-texts.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public function add_hooks()
{
global $pagenow;

add_filter('admin_footer_text', array( $this, 'footer_text' ));
add_filter('admin_footer_text', [ $this, 'footer_text' ]);

// Hooks for Plugins overview page
if ($pagenow === 'plugins.php') {
add_filter('plugin_action_links_' . $this->plugin_file, array( $this, 'add_plugin_settings_link' ), 10, 2);
add_filter('plugin_row_meta', array( $this, 'add_plugin_meta_links' ), 10, 2);
add_filter('plugin_action_links_' . $this->plugin_file, [ $this, 'add_plugin_settings_link' ], 10, 2);
add_filter('plugin_row_meta', [ $this, 'add_plugin_meta_links' ], 10, 2);
}
}

Expand Down
Loading

0 comments on commit 804aa8d

Please sign in to comment.