From 58ca9da7430450bbd5f027a0a6638a3a84e11949 Mon Sep 17 00:00:00 2001 From: gabiermi Date: Thu, 28 Mar 2024 19:18:19 +0500 Subject: [PATCH 1/4] some small changes --- omnisend/view/connection-form.html | 134 -------------------------- omnisend/view/connection-success.html | 19 ---- omnisend/view/snippet.html | 4 +- 3 files changed, 2 insertions(+), 155 deletions(-) delete mode 100644 omnisend/view/connection-form.html delete mode 100644 omnisend/view/connection-success.html diff --git a/omnisend/view/connection-form.html b/omnisend/view/connection-form.html deleted file mode 100644 index 768960f..0000000 --- a/omnisend/view/connection-form.html +++ /dev/null @@ -1,134 +0,0 @@ -
-
- -
-
- - - -
- - - - -
- - - - -
-
-

Connect Omnisend Plugin

-
-

Connect Omnisend plugin to Wordpress to:

-
-
    -
  • - Automatically import all your WordPress users to Omnisend -
  • -
  • - Collect subscribers through Forms -
  • -
  • - Segment and target your customers -
  • -
  • - Set up behavior-based automations -
  • -
-
-
-
-
-
- -

Steps to connect to Omnisend:

-
-
1
-
-
-
-

Create Omnisend account

-
- -
-
-
-
-
-
-
2
-
-
-
-

Copy the API key from the platform connection instructions

-
- -
-
-
-
-
-
-
3
-
-
-
-

Paste copied API key here:

-
-
-
-
-
- -
-
- -
-
-
-
-
-
-
-
-
-
-
- Need help? Check our - - Wordpress connection guide - -
-
- -
-
diff --git a/omnisend/view/connection-success.html b/omnisend/view/connection-success.html deleted file mode 100644 index 5e221e7..0000000 --- a/omnisend/view/connection-success.html +++ /dev/null @@ -1,19 +0,0 @@ - - - -
- -
-

You are connected to Omnisend!

-
-

- Head to Omnisend to continue with collecting subscribers through forms, segmenting and targeting your customers and designing email campaigns. -

- -
diff --git a/omnisend/view/snippet.html b/omnisend/view/snippet.html index 79455ca..d4c843b 100644 --- a/omnisend/view/snippet.html +++ b/omnisend/view/snippet.html @@ -1,10 +1,10 @@ From f3ce01172b77887608fcd76124164b79e557e5a5 Mon Sep 17 00:00:00 2001 From: gabiermi Date: Tue, 9 Apr 2024 12:56:51 +0500 Subject: [PATCH 3/4] refactor styles --- composer.lock | 22 +- omnisend/class-omnisend-core-bootstrap.php | 4 +- .../includes/Internal/class-connection.php | 4 +- omnisend/styles/styles.css | 246 +----------------- 4 files changed, 17 insertions(+), 259 deletions(-) diff --git a/composer.lock b/composer.lock index e081285..cff7966 100644 --- a/composer.lock +++ b/composer.lock @@ -809,16 +809,16 @@ }, { "name": "phpunit/phpunit", - "version": "10.5.16", + "version": "10.5.17", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd" + "reference": "c1f736a473d21957ead7e94fcc029f571895abf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd", - "reference": "18f8d4a5f52b61fdd9370aaae3167daa0eeb69cd", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c1f736a473d21957ead7e94fcc029f571895abf5", + "reference": "c1f736a473d21957ead7e94fcc029f571895abf5", "shasum": "" }, "require": { @@ -890,7 +890,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.16" + "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.17" }, "funding": [ { @@ -906,7 +906,7 @@ "type": "tidelift" } ], - "time": "2024-03-28T10:08:10+00:00" + "time": "2024-04-05T04:39:01+00:00" }, { "name": "sebastian/cli-parser", @@ -1826,16 +1826,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.9.0", + "version": "3.9.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b" + "reference": "267a4405fff1d9c847134db3a3c92f1ab7f77909" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b", - "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/267a4405fff1d9c847134db3a3c92f1ab7f77909", + "reference": "267a4405fff1d9c847134db3a3c92f1ab7f77909", "shasum": "" }, "require": { @@ -1902,7 +1902,7 @@ "type": "open_collective" } ], - "time": "2024-02-16T15:06:51+00:00" + "time": "2024-03-31T21:03:09+00:00" }, { "name": "theseer/tokenizer", diff --git a/omnisend/class-omnisend-core-bootstrap.php b/omnisend/class-omnisend-core-bootstrap.php index 6e5f8b1..d041284 100644 --- a/omnisend/class-omnisend-core-bootstrap.php +++ b/omnisend/class-omnisend-core-bootstrap.php @@ -81,8 +81,8 @@ function ( $user_login, $user ) { public static function omnisend_app_market() { - if(!current_user_can('manage_options')){ - wp_die(__( 'You do not have sufficient permissions to access this page.')); + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } ?> diff --git a/omnisend/includes/Internal/class-connection.php b/omnisend/includes/Internal/class-connection.php index 6011d40..ca8d6d9 100644 --- a/omnisend/includes/Internal/class-connection.php +++ b/omnisend/includes/Internal/class-connection.php @@ -14,8 +14,8 @@ class Connection { public static function display(): void { - if(!current_user_can('manage_options')){ - wp_die(__( 'You do not have sufficient permissions to access this page.')); + if ( ! current_user_can( 'manage_options' ) ) { + wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } Options::set_landing_page_visited(); diff --git a/omnisend/styles/styles.css b/omnisend/styles/styles.css index f9912f3..4b4a6fe 100644 --- a/omnisend/styles/styles.css +++ b/omnisend/styles/styles.css @@ -90,18 +90,6 @@ margin-bottom: 24px; } -.omnisend-paragraph-16 { - margin: 0; - font-weight: 400; - color: #1e2423; - font-family: Roboto; - font-size: 16px; - font-stretch: normal; - font-style: normal; - letter-spacing: normal; - line-height: 24px; -} - .omnisend-landing-h1 { margin: 0; color: #1e2423; @@ -139,30 +127,6 @@ line-height: 40px; } -.omnisend-h2 { - margin: 0; - color: #1e2423; - font-family: Roboto; - font-stretch: normal; - font-style: normal; - font-weight: 500; - letter-spacing: normal; - font-size: 32px; - line-height: 40px; -} - -.omnisend-h3 { - margin: 0; - font-size: 24px; - color: #1e2423; - font-family: Roboto; - font-stretch: normal; - font-style: normal; - font-weight: 500; - letter-spacing: normal; - line-height: 32px; -} - .omnisend-paragraph-14 { margin: 0; font-weight: 300; @@ -175,64 +139,6 @@ line-height: 24px; } -.omnisend-grid-column { - box-sizing: border-box; - flex-basis: 0; - flex-grow: 1; - max-width: 100%; - display: flex; - flex-direction: column; - padding: 0; -} - -.omnisend-flex-row { - display: flex; -} - -.omnisend-row-input-button { - box-sizing: border-box; - display: flex; - flex: 0 1 auto; - flex-flow: wrap; - flex-direction: row; - margin: 0 auto; - width: 100%; - gap: 16px; - align-items: flex-end; -} - -.omnisend-link-button { - background: none; - font: inherit; - align-items: center; - border-radius: 8px; - box-sizing: border-box; - cursor: pointer; - display: flex; - flex-wrap: nowrap; - font-family: Roboto; - font-size: 14px; - font-stretch: normal; - font-style: normal; - font-weight: 400; - gap: 8px; - height: 40px; - justify-content: center; - letter-spacing: normal; - line-height: 24px; - outline: none; - padding: 8px 16px; - position: relative; - text-decoration: none; - transition: - background-color 0.1s ease-in-out, - color 0.1s ease-in-out; - white-space: nowrap; - border: 1px solid #35938f; - color: #35938f; - width: fit-content; -} - .omnisend-text-body { font-family: Roboto; font-size: 22px; @@ -347,133 +253,11 @@ height: auto; } -.omnisend-link-button { - background: none; - font: inherit; - align-items: center; - border-radius: 8px; - box-sizing: border-box; - cursor: pointer; - display: flex; - flex-wrap: nowrap; - font-family: Roboto; - font-size: 14px; - font-stretch: normal; - font-style: normal; - font-weight: 400; - gap: 8px; - height: 40px; - justify-content: center; - letter-spacing: normal; - line-height: 24px; - outline: none; - padding: 8px 16px; - position: relative; - text-decoration: none; - transition: - background-color 0.1s ease-in-out, - color 0.1s ease-in-out; - white-space: nowrap; - border: 1px solid #35938f; - color: #35938f; - width: fit-content; -} - -.omnisend-step-number { - align-items: center; - background: #35938f; - border-radius: 50%; - color: #fff; - display: flex; - font-family: Roboto; - font-size: 16px; - height: 32px; - justify-content: center; - min-width: 32px; - width: 32px; -} - .omnisend-divider { border: 0; border-bottom: 1px solid #b6b6b6; } -.omnisend-form-input { - appearance: none; - background-color: white; - border: 1px solid #b6b6b6; - border-radius: 8px; - box-sizing: border-box; - color: #1e2423; - display: flex; - font-family: Roboto; - font-size: 14px; - font-stretch: normal; - font-style: normal; - font-weight: 400; - height: 40px; - letter-spacing: normal; - line-height: 24px; - outline: none; - padding: 8px 16px; - position: relative; - transition: border-color 0.1s linear; - width: 100%; -} - -.omnisend-form-field { - display: flex; - flex-grow: 8; - flex-direction: column; - max-width: 100%; -} - -.omnisend-form-field > input { - border-radius: 8px; - border: 1px solid #b6b6b6; - background: #fff; -} - -.omnisend-form-field-button { - box-sizing: border-box; - max-width: 100%; - flex: 0 1; - display: flex; - flex-direction: column; - padding: 0; -} - -.omnisend-form-button-primary { - background: none; - font: inherit; - align-items: center; - border-radius: 8px; - box-sizing: border-box; - cursor: pointer; - display: flex; - flex-wrap: nowrap; - font-family: Roboto; - font-size: 14px; - font-stretch: normal; - font-style: normal; - font-weight: 400; - gap: 8px; - height: 40px; - justify-content: center; - letter-spacing: normal; - line-height: 24px; - outline: none; - padding: 8px 16px; - position: relative; - transition: - background-color 0.1s ease-in-out, - color 0.1s ease-in-out; - white-space: nowrap; - background-color: #35938f; - border: 1px solid #35938f; - color: #fff; -} - .omnisend-landing-text-microcopy { font-family: Roboto; font-size: 13px; @@ -495,7 +279,7 @@ } .omnisend-bullet-list li:before { - content: ""; + content: ''; width: 5px; height: 5px; border-radius: 50%; @@ -522,32 +306,6 @@ align-items: center; } -.omnisend-help-wrapper { - box-sizing: border-box; - display: flex; - flex: 0 1 auto; - flex-flow: wrap; - flex-direction: row; - margin: 0 auto; - width: 100%; -} - -.omnisend-a { - outline: none; - text-decoration: none; - transition: color 0.1s; - align-items: center; - gap: 8px; - color: #35938f; - font-family: Roboto; - font-stretch: normal; - font-style: normal; - letter-spacing: normal; - line-height: 24px; - font-size: 14px; - font-weight: 400; -} - .omnisend-landing-page-text { max-width: 880px; } @@ -571,7 +329,7 @@ @media only screen and (max-width: 1300px) { .omnisend-landing-page-banner-sticker { - display: none; + display: none; } } From 8b7f5af61bda4ca5e7ad9c46642209b43715a993 Mon Sep 17 00:00:00 2001 From: gabiermi Date: Wed, 10 Apr 2024 09:47:16 +0500 Subject: [PATCH 4/4] add security restrictions for current user --- omnisend/class-omnisend-core-bootstrap.php | 2 +- omnisend/includes/Internal/class-connection.php | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/omnisend/class-omnisend-core-bootstrap.php b/omnisend/class-omnisend-core-bootstrap.php index d041284..72e937e 100644 --- a/omnisend/class-omnisend-core-bootstrap.php +++ b/omnisend/class-omnisend-core-bootstrap.php @@ -82,7 +82,7 @@ function ( $user_login, $user ) { public static function omnisend_app_market() { if ( ! current_user_can( 'manage_options' ) ) { - wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); + wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) ); } ?> diff --git a/omnisend/includes/Internal/class-connection.php b/omnisend/includes/Internal/class-connection.php index ca8d6d9..ca3c920 100644 --- a/omnisend/includes/Internal/class-connection.php +++ b/omnisend/includes/Internal/class-connection.php @@ -15,7 +15,7 @@ class Connection { public static function display(): void { if ( ! current_user_can( 'manage_options' ) ) { - wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); + wp_die( esc_html__( 'You do not have sufficient permissions to access this page.' ) ); } Options::set_landing_page_visited(); @@ -150,7 +150,15 @@ public static function omnisend_post_connection() { // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText $wordpress_platform = 'wordpress'; // WordPress is lowercase as it's required by integration. - // add current_user_can('manage_options') check + if ( ! current_user_can( 'manage_options' ) ) { + return rest_ensure_response( + array( + 'success' => false, + 'error' => 'You do not have sufficient permissions to perform this action.', + ) + ); + } + if ( ! isset( $_POST['action_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['action_nonce'] ) ), 'connect' ) ) { return rest_ensure_response( array(