Skip to content

Commit

Permalink
code style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed Dec 18, 2024
1 parent 5f7e9f4 commit 87388d7
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 46 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

#### 4.9.15 - Dec 18, 2024

-


#### 4.9.19 - Nov 11, 2024

- Add integration with [Prosopo](https://prosopo.io/), a GDPR compliant anti-spam solution for protecting your sign-up forms against bot sign-ups. Thanks [Maxim Akimov](https://github.com/light-source)!
Expand Down
4 changes: 2 additions & 2 deletions config/default-form-content.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

$email_label = esc_html__('Email address', 'mailchimp-for-wp');
$email_label = esc_html__('Email address', 'mailchimp-for-wp');
$email_placeholder_attr = esc_attr__('Your email address', 'mailchimp-for-wp');
$signup_button_value = esc_attr__('Sign up', 'mailchimp-for-wp');
$signup_button_value = esc_attr__('Sign up', 'mailchimp-for-wp');

$content = "<p>\n\t<label for=\"email\">{$email_label}: \n";
$content .= "\t\t<input type=\"email\" id=\"email\" name=\"EMAIL\" placeholder=\"{$email_placeholder_attr}\" required>\n</label>\n</p>\n\n";
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public function show_generals_setting_page()
}
}

$obfuscated_api_key = mc4wp_obfuscate_string($api_key);
$obfuscated_api_key = mc4wp_obfuscate_string($api_key);
$is_procaptcha_configured = MC4WP_Procaptcha::get_instance()->is_enabled();

require MC4WP_PLUGIN_DIR . '/includes/views/general-settings.php';
Expand Down
2 changes: 1 addition & 1 deletion includes/forms/views/edit-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<?php
foreach ($tabs as $tab => $name) {
$class = ( $active_tab === $tab ) ? 'nav-tab-active' : '';
$href = esc_attr($this->tab_url($tab));
$href = esc_attr($this->tab_url($tab));
echo "<a class=\"nav-tab nav-tab-{$tab} {$class}\" data-tab=\"{$tab}\" href=\"{$href}\">{$name}</a>";
}
?>
Expand Down
2 changes: 1 addition & 1 deletion includes/integrations/views/integration-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
echo '<ul style="margin-bottom: 20px; max-height: 300px; overflow-y: auto;">';
foreach ($lists as $list) {
$checked = checked(in_array($list->id, $opts['lists'], true), true, false);
$value = esc_attr($list->id);
$value = esc_attr($list->id);
echo '<li><label>';
echo "<input type=\"checkbox\" name=\"mc4wp_integrations[{$integration->slug}][lists][]\" value=\"{$value}\" class=\"mc4wp-list-input\" {$checked}> ";
echo esc_html($list->name);
Expand Down
2 changes: 1 addition & 1 deletion includes/integrations/views/integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function _mc4wp_integrations_table_row($integration)
<td>
<?php
if ($integration->is_installed()) {
$href = esc_attr(add_query_arg(array( 'integration' => $integration->slug )));
$href = esc_attr(add_query_arg(array( 'integration' => $integration->slug )));
$title = esc_attr__('Configure this integration', 'mailchimp-for-wp');
echo "<strong><a href=\"{$href}\" title=\"{$title}\">{$integration->name}</a></strong>";
} else {
Expand Down
2 changes: 1 addition & 1 deletion includes/views/parts/lists-overview.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

foreach ($lists as $list) {
$attr_data_list_id = esc_attr($list->id);
$list_name = esc_html($list->name);
$list_name = esc_html($list->name);
echo '<tr>';
echo '<td><a href="#" class="mc4wp-mailchimp-list" data-list-id="', $attr_data_list_id, '">', $list_name, '</a><span class="row-actions alignright"></span></td>';
echo '<td><code>', esc_html($list->id), '</code></td>';
Expand Down
2 changes: 1 addition & 1 deletion integrations/gravity-forms/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

mc4wp_register_integration('gravity-forms', 'MC4WP_Gravity_Forms_Integration', true);

add_action('plugins_loaded', function() {
add_action('plugins_loaded', function () {
if (class_exists('GF_Fields')) {
GF_Fields::register(new MC4WP_Gravity_Forms_Field());
}
Expand Down
4 changes: 2 additions & 2 deletions integrations/ninja-forms/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

mc4wp_register_integration('ninja-forms', 'MC4WP_Ninja_Forms_Integration', true);

add_filter('ninja_forms_register_fields', function($fields) {
add_filter('ninja_forms_register_fields', function ($fields) {
$fields['mc4wp_optin'] = new MC4WP_Ninja_Forms_Field();
return $fields;
});

add_filter('ninja_forms_register_actions', function($actions) {
add_filter('ninja_forms_register_actions', function ($actions) {
$actions['mc4wp_subscribe'] = new MC4WP_Ninja_Forms_Action();
return $actions;
});
51 changes: 26 additions & 25 deletions integrations/ninja-forms/class-action.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
*/
class MC4WP_Ninja_Forms_Action extends NF_Abstracts_Action
{
protected $_name = 'mc4wp_subscribe';
protected $_nicename = 'Mailchimp';
protected $_tags = array( 'newsletter' );
protected $_timing = 'normal';
protected $_priority = '10';
protected $_settings = array();
protected $_name = 'mc4wp_subscribe';
protected $_nicename = 'Mailchimp';
protected $_tags = array( 'newsletter' );
protected $_timing = 'normal';
protected $_priority = '10';
protected $_settings = array();
protected $_setting_labels = array(
'list' => 'List',
'fields' => 'List Field Mapping',
Expand All @@ -24,7 +24,7 @@ public function __construct()
{
parent::__construct();

$this->_settings['double_optin'] = array(
$this->_settings['double_optin'] = array(
'name' => 'double_optin',
'type' => 'select',
'label' => 'Use double opt-in?',
Expand Down Expand Up @@ -61,15 +61,15 @@ public function __construct()
),
);

add_action( 'wp_ajax_nf_' . $this->_name . '_get_lists', array($this, '_get_lists'));
add_action('wp_ajax_nf_' . $this->_name . '_get_lists', array($this, '_get_lists'));
add_action('init', array($this, 'translate_props'));

$this->get_list_settings();
}

public function translate_props()
{
$this->_settings['double_optin']['label'] = __('Use double opt-in?', 'mailchimp-for-wp');
$this->_settings['double_optin']['label'] = __('Use double opt-in?', 'mailchimp-for-wp');
$this->_settings['update_existing']['label'] = __('Update existing subscribers?', 'mailchimp-for-wp');

$this->_settings[ $this->get_name() . 'newsletter_list_fields' ]['label'] = __('List Field Mapping', 'mailchimp-for-wp');
Expand Down Expand Up @@ -116,10 +116,10 @@ public function process($action_settings, $form_id, $data)

public function ajax_get_lists_handler()
{
check_ajax_referer( 'ninja_forms_builder_nonce', 'security' );
check_ajax_referer('ninja_forms_builder_nonce', 'security');
$lists = $this->get_lists();
array_unshift( $return, array( 'value' => 0, 'label' => '-', 'fields' => array(), 'groups' => array() ) );
echo wp_json_encode( array( 'lists' => $return ) );
array_unshift($return, array( 'value' => 0, 'label' => '-', 'fields' => array(), 'groups' => array() ));
echo wp_json_encode(array( 'lists' => $return ));
wp_die();
}

Expand Down Expand Up @@ -158,11 +158,13 @@ private function get_list_settings()
'list' => 'List',
'fields' => 'List Field Mapping',
);
$labels = array_merge( $label_defaults, $this->_setting_labels );
$prefix = $this->get_name();
$lists = $this->get_lists();
$labels = array_merge($label_defaults, $this->_setting_labels);
$prefix = $this->get_name();
$lists = $this->get_lists();

if( empty( $lists ) ) return;
if (empty($lists)) {
return;
}

$this->_settings[ $prefix . 'newsletter_list' ] = array(
'name' => 'newsletter_list',
Expand All @@ -175,24 +177,23 @@ private function get_list_settings()
);

$fields = array();
foreach( $lists as $list ) {
foreach ($lists as $list) {
$this->_settings[ $prefix . 'newsletter_list' ][ 'options' ][] = $list;

//Check to see if list has fields array set.
if ( isset( $list[ 'fields' ] ) ) {

foreach ( $list[ 'fields' ] as $field ) {
$name = $list[ 'value' ] . '_' . $field[ 'value' ];
if (isset($list[ 'fields' ])) {
foreach ($list[ 'fields' ] as $field) {
$name = $list[ 'value' ] . '_' . $field[ 'value' ];
$fields[] = array(
'name' => $name,
'type' => 'textbox',
'label' => $field[ 'label' ],
'width' => 'full',
'use_merge_tags' => array(
'exclude' => array(
'user', 'post', 'system', 'querystrings'
)
)
'user', 'post', 'system', 'querystrings',
),
),
);
}
}
Expand All @@ -203,7 +204,7 @@ private function get_list_settings()
'label' => 'List Field Mapping',
'type' => 'fieldset',
'group' => 'primary',
'settings' => array()
'settings' => array(),
);
}
}
16 changes: 8 additions & 8 deletions integrations/ninja-forms/class-field.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
*/
class MC4WP_Ninja_Forms_Field extends NF_Abstracts_Input
{
protected $_name = 'mc4wp_optin';
protected $_nicename = 'Mailchimp opt-in';
protected $_section = 'misc';
protected $_type = 'checkbox';
protected $_icon = 'check-square-o';
protected $_templates = 'checkbox';
protected $_test_value = 0;
protected $_settings = array( 'checkbox_default_value', 'checked_calc_value', 'unchecked_calc_value' );
protected $_name = 'mc4wp_optin';
protected $_nicename = 'Mailchimp opt-in';
protected $_section = 'misc';
protected $_type = 'checkbox';
protected $_icon = 'check-square-o';
protected $_templates = 'checkbox';
protected $_test_value = 0;
protected $_settings = array( 'checkbox_default_value', 'checked_calc_value', 'unchecked_calc_value' );
protected $_settings_exclude = array( 'default', 'placeholder', 'input_limit_set', 'checkbox_values' );

/**
Expand Down
4 changes: 2 additions & 2 deletions integrations/prosopo-procaptcha/class-procaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ protected function is_human_made_request()
return false;
}

$body = wp_remote_retrieve_body($response);
$body = json_decode($body, true);
$body = wp_remote_retrieve_body($response);
$body = json_decode($body, true);
$is_verified = is_array($body) && isset($body['verified']) && $body['verified'];

return true === $is_verified;
Expand Down
2 changes: 1 addition & 1 deletion integrations/wpforms/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

mc4wp_register_integration('wpforms', 'MC4WP_WPForms_Integration', true);

add_action('plugins_loaded', function() {
add_action('plugins_loaded', function () {
if (class_exists('WPForms_Field')) {
new MC4WP_WPForms_Field();
}
Expand Down

0 comments on commit 87388d7

Please sign in to comment.