From 5160d75665c5d4beaa13784a1b1838ca891d1c6c Mon Sep 17 00:00:00 2001 From: Danny van Kooten Date: Tue, 17 Sep 2024 09:33:25 +0200 Subject: [PATCH] clean-up HTML templates --- includes/forms/class-admin.php | 4 +- includes/forms/views/add-form.php | 29 +-------- includes/forms/views/edit-form.php | 28 ++++----- includes/forms/views/preview.php | 14 ++--- .../views/integration-settings.php | 62 ++++++++----------- includes/integrations/views/integrations.php | 35 ++--------- includes/views/parts/admin-sidebar.php | 10 +-- includes/views/parts/lists-overview.php | 25 ++++---- 8 files changed, 69 insertions(+), 138 deletions(-) diff --git a/includes/forms/class-admin.php b/includes/forms/class-admin.php index 1222ba3b..5db4ef2e 100755 --- a/includes/forms/class-admin.php +++ b/includes/forms/class-admin.php @@ -400,7 +400,7 @@ public function show_forms_page() */ public function show_edit_page() { - $form_id = ( ! empty($_GET['form_id']) ) ? (int) $_GET['form_id'] : 0; + $form_id = ! empty($_GET['form_id']) ? (int) $_GET['form_id'] : 0; $mailchimp = new MC4WP_MailChimp(); $lists = $mailchimp->get_lists(); @@ -414,7 +414,7 @@ public function show_edit_page() } $opts = $form->settings; - $active_tab = ( isset($_GET['tab']) ) ? $_GET['tab'] : 'fields'; + $active_tab = isset($_GET['tab']) ? trim($_GET['tab']) : 'fields'; $form_preview_url = add_query_arg( array( diff --git a/includes/forms/views/add-form.php b/includes/forms/views/add-form.php index b408e993..236fe2b4 100755 --- a/includes/forms/views/add-form.php +++ b/includes/forms/views/add-form.php @@ -1,25 +1,15 @@
-
- -
-

-

-
- -
- -

-
-

- - - -
- +
- - - -
- - +
- -
- diff --git a/includes/forms/views/edit-form.php b/includes/forms/views/edit-form.php index 494cd4f3..5bdd7dcc 100755 --- a/includes/forms/views/edit-form.php +++ b/includes/forms/views/edit-form.php @@ -23,17 +23,14 @@ Mailchimp for WordPress › - + | name); ?>

-
-

-

-

+ +

- + element ?>
@@ -75,7 +73,8 @@ $name) { $class = ( $active_tab === $tab ) ? 'nav-tab-active' : ''; - echo sprintf('%s', $tab, $class, $tab, esc_attr($this->tab_url($tab)), $name); + $href = esc_attr($this->tab_url($tab)); + echo "{$name}"; } ?> @@ -83,12 +82,9 @@
$name) : + foreach ($tabs as $tab => $name) { $class = ( $active_tab === $tab ) ? 'mc4wp-tab-active' : ''; - - // start of .tab - echo sprintf('
', $class, $tab); + echo "
"; /** * Runs when outputting a tab section on the "edit form" screen @@ -105,15 +101,13 @@ // end of .tab echo '
'; - endforeach; // foreach tabs + } // foreach tabs ?> -
+
- - + - diff --git a/includes/forms/views/preview.php b/includes/forms/views/preview.php index 685d7a6d..c41a45cf 100755 --- a/includes/forms/views/preview.php +++ b/includes/forms/views/preview.php @@ -9,9 +9,9 @@ Mailchimp for WordPress Form Preview - - - + + + body::before, body::after, body > *:not(#form-preview) { display:none !important; } - #form-preview { display: block !important; width: 100%; @@ -46,10 +44,10 @@ } - +
- + diff --git a/includes/integrations/views/integration-settings.php b/includes/integrations/views/integration-settings.php index afabb60b..f774f659 100755 --- a/includes/integrations/views/integration-settings.php +++ b/includes/integrations/views/integration-settings.php @@ -3,19 +3,14 @@ /** @var array $opts */ ?>
-

Mailchimp for WordPressname); ?>

-
- -
-

name)); ?>

@@ -32,7 +27,6 @@ description); ?>

-
@@ -57,18 +51,19 @@ ?> - has_ui_element('enabled')) { ?> - - - - + + + + + + @@ -126,8 +121,10 @@ echo ' - - - + + + + @@ -316,15 +313,10 @@ ?> - - -
- - diff --git a/includes/integrations/views/integrations.php b/includes/integrations/views/integrations.php index 1dbde54f..6fecb8b1 100755 --- a/includes/integrations/views/integrations.php +++ b/includes/integrations/views/integrations.php @@ -4,27 +4,20 @@ /** @var MC4WP_Integration_Fixture $integration */ function _mc4wp_integrations_table_row($integration) { + $style_attr = ! $integration->is_installed() ? 'style="opacity: 0.6;"' : ''; ?> - + > -
-   - -

name); ?>

-
+   + +

name); ?>

+
'; echo '
    '; foreach ($lists as $list) { + $checked = checked(in_array($list->id, $opts['lists'], true), true, false); + $value = esc_attr($list->id); echo '
  • '; } @@ -243,20 +240,20 @@ has_ui_element('update_existing')) { ?> -
-   - -

-
+   + +

+
- is_installed()) { - echo sprintf('%s', esc_attr(add_query_arg(array( 'integration' => $integration->slug ))), esc_html__('Configure this integration', 'mailchimp-for-wp'), $integration->name); + $href = esc_attr(add_query_arg(array( 'integration' => $integration->slug ))); + $title = esc_attr__('Configure this integration', 'mailchimp-for-wp'); + echo "{$integration->name}"; } else { - echo $integration->name; + echo esc_html($integration->name); } ?> - - - @@ -64,7 +56,6 @@ function _mc4wp_integrations_table($integrations) - -
-

Mailchimp for WordPress › @@ -104,10 +93,7 @@ function _mc4wp_integrations_table($integrations)

- -
-

Mailchimp for WordPress:

@@ -119,24 +105,15 @@ function _mc4wp_integrations_table($integrations)

- -

-

- -
-
-
-
-
diff --git a/includes/views/parts/admin-sidebar.php b/includes/views/parts/admin-sidebar.php index a51d9681..89c12730 100755 --- a/includes/views/parts/admin-sidebar.php +++ b/includes/views/parts/admin-sidebar.php @@ -32,22 +32,16 @@ function _mc4wp_admin_sidebar_other_plugins() // Koko Analytics echo '
  • '; - echo sprintf('Koko Analytics
    ', 'https://wordpress.org/plugins/koko-analytics/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar'); + echo 'Koko Analytics
    '; echo esc_html__('Privacy-friendly analytics plugin that does not use any external services.', 'mailchimp-for-wp'); echo '
  • '; // Boxzilla echo '
  • '; - echo sprintf('Boxzilla Pop-ups
    ', 'https://wordpress.org/plugins/boxzilla/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar'); + echo 'Boxzilla Pop-ups
    '; echo esc_html__('Pop-ups or boxes that slide-in with a newsletter sign-up form. A sure-fire way to grow your email lists.', 'mailchimp-for-wp'); echo '
  • '; - // HTML Forms - echo '
  • '; - echo sprintf('HTML Forms
    ', 'https://wordpress.org/plugins/html-forms/#utm_source=wp-plugin&utm_medium=mailchimp-for-wp&utm_campaign=sidebar'); - echo esc_html__('Super flexible forms using native HTML. Just like Mailchimp for WordPress forms but for other purposes, like a contact form.', 'mailchimp-for-wp'); - echo '
  • '; - echo ''; echo ''; } diff --git a/includes/views/parts/lists-overview.php b/includes/views/parts/lists-overview.php index 25095d53..8ea847b3 100755 --- a/includes/views/parts/lists-overview.php +++ b/includes/views/parts/lists-overview.php @@ -1,13 +1,11 @@

    -
    -
    + -

    - +

    @@ -19,8 +17,7 @@

    .

    ' . esc_html__('A total of %d lists were found in your Mailchimp account.', 'mailchimp-for-wp') . '

    ', count($lists)); - + echo '

    ', sprintf(esc_html__('A total of %d lists were found in your Mailchimp account.', 'mailchimp-for-wp'), count($lists)), '

    '; echo ''; $headings = array( @@ -32,27 +29,31 @@ echo ''; echo ''; foreach ($headings as $heading) { - echo sprintf('', $heading); + echo ''; } echo ''; echo ''; + echo ''; foreach ($lists as $list) { + $attr_data_list_id = esc_attr($list->id); + $list_name = esc_html($list->name); echo ''; - echo sprintf('', esc_attr($list->id), esc_html($list->name)); - echo sprintf('', esc_html($list->id)); - echo sprintf('', esc_html($list->stats->member_count)); + echo ''; + echo ''; + echo ''; echo ''; - echo sprintf('', $list->id); + echo ''; echo ''; echo ''; ?> '; echo '
    %s', $heading, '
    %s%s%s', $list_name,'', esc_html($list->id), '', esc_html($list->stats->member_count), '
    '; } // end if empty ?>