From 34f8aa6fe6dea897df4db3c15c08c7122e864aba Mon Sep 17 00:00:00 2001 From: Oleksandr Mykhailenko Date: Sat, 13 Aug 2022 20:36:46 +0300 Subject: [PATCH 1/2] Remove var_dump from the code --- .../SettingsPages/ContactForm7Settings.php | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/includes/SettingsPages/ContactForm7Settings.php b/src/includes/SettingsPages/ContactForm7Settings.php index 0834c04d..1061b6c9 100644 --- a/src/includes/SettingsPages/ContactForm7Settings.php +++ b/src/includes/SettingsPages/ContactForm7Settings.php @@ -12,13 +12,13 @@ */ class ContactForm7Settings { - const MAILJET_CHECKBOX = 'mailjet-opt-in'; + public const MAILJET_CHECKBOX = 'mailjet-opt-in'; /** * @param $contactForm * @return false */ - public function sendConfirmationEmail($contactForm) + public function sendConfirmationEmail($contactForm): bool { $locale = Mailjeti18n::getLocale(); $formdata = \false; @@ -31,24 +31,24 @@ public function sendConfirmationEmail($contactForm) } } if (!$formdata) { - return \false; + return false; } $invalidFields = $submission->get_invalid_fields(); if (!empty($invalidFields)) { - return \false; + return false; } $mailjetCheckbox = $formdata[self::MAILJET_CHECKBOX]; if ($mailjetCheckbox[0] != '') { - $cf7Email = \trim(\stripslashes(get_option('cf7_email')), '[]'); + $cf7Email = trim(stripslashes(get_option('cf7_email')), '[]'); if (!isset($formdata[$cf7Email])) { return false; } $email = $formdata[$cf7Email]; - $cf7name = \stripslashes(get_option('cf7_fromname', '')); + $cf7name = stripslashes(get_option('cf7_fromname', '')); $matches = array(); $data = array(); - \preg_match_all('/\\[(.*?)\\]/', $cf7name, $matches); + preg_match_all('/\\[(.*?)\\]/', $cf7name, $matches); if (!empty($matches[1])) { foreach ($matches[1] as $match) { if (isset($formdata[$match])) { @@ -56,15 +56,15 @@ public function sendConfirmationEmail($contactForm) } } } - $newphrase = \str_replace($matches[0], $data, $cf7name); + $newphrase = str_replace($matches[0], $data, $cf7name); $mailjetCF7List = get_option('mailjet_cf7_list'); - $params = \http_build_query(array('cf7list' => $mailjetCF7List, 'email' => $email, 'prop' => $newphrase)); - $wpUrl = \sprintf('%s', get_home_url(), get_home_url()); - $subscriptionTemplate = apply_filters('mailjet_confirmation_email_filename', \dirname(\dirname(\dirname(__FILE__))) . '/templates/confirm-subscription-email.php'); - $message = \file_get_contents($subscriptionTemplate); - $emailParams = array('__EMAIL_TITLE__' => Mailjeti18n::getTranslationsFromFile($locale, 'Please confirm your subscription'), '__EMAIL_HEADER__' => \sprintf(__(Mailjeti18n::getTranslationsFromFile($locale, 'To receive newsletters from %s please confirm your subscription by clicking the following button:'), 'mailjet-for-wordpress'), $wpUrl), '__WP_URL__' => $wpUrl, '__CONFIRM_URL__' => get_home_url() . '?' . $params . '&token=' . \sha1($params . MailjetSettings::getCryptoHash()), '__CLICK_HERE__' => Mailjeti18n::getTranslationsFromFile($locale, 'Yes, subscribe me to this list'), '__FROM_NAME__' => get_option('blogname'), '__IGNORE__' => Mailjeti18n::getTranslationsFromFile($locale, 'If you received this email by mistake or don\'t wish to subscribe anymore, simply ignore this message.')); + $params = http_build_query(array('cf7list' => $mailjetCF7List, 'email' => $email, 'prop' => $newphrase)); + $wpUrl = sprintf('%s', get_home_url(), get_home_url()); + $subscriptionTemplate = apply_filters('mailjet_confirmation_email_filename', dirname(__FILE__, 3) . '/templates/confirm-subscription-email.php'); + $message = file_get_contents($subscriptionTemplate); + $emailParams = array('__EMAIL_TITLE__' => Mailjeti18n::getTranslationsFromFile($locale, 'Please confirm your subscription'), '__EMAIL_HEADER__' => sprintf(__(Mailjeti18n::getTranslationsFromFile($locale, 'To receive newsletters from %s please confirm your subscription by clicking the following button:'), 'mailjet-for-wordpress'), $wpUrl), '__WP_URL__' => $wpUrl, '__CONFIRM_URL__' => get_home_url() . '?' . $params . '&token=' . sha1($params . MailjetSettings::getCryptoHash()), '__CLICK_HERE__' => Mailjeti18n::getTranslationsFromFile($locale, 'Yes, subscribe me to this list'), '__FROM_NAME__' => get_option('blogname'), '__IGNORE__' => Mailjeti18n::getTranslationsFromFile($locale, 'If you received this email by mistake or don\'t wish to subscribe anymore, simply ignore this message.')); foreach ($emailParams as $key => $value) { - $message = \str_replace($key, $value, $message); + $message = str_replace($key, $value, $message); } $contact = array(); $contact['Email'] = $email; @@ -72,12 +72,11 @@ public function sendConfirmationEmail($contactForm) $contact['Properties']['name'] = $formdata[$cf7name]; MailjetApi::createMailjetContactProperty('name'); } - var_dump($contact, $mailjetCF7List); MailjetApi::syncMailjetContact($mailjetCF7List, $contact); $email_subject = Mailjeti18n::getTranslationsFromFile($locale, 'Subscription Confirmation'); add_filter('wp_mail_content_type', array(SubscriptionOptionsSettings::getInstance(), 'set_html_content_type')); wp_mail($email, $email_subject, $message, array('From: ' . get_option('blogname') . ' <' . get_option('admin_email') . '>')); } - return \false; + return false; } } From 038b31e37eef13b314cc04bd5674933c370ce665 Mon Sep 17 00:00:00 2001 From: Oleksandr Mykhailenko Date: Sat, 13 Aug 2022 20:39:03 +0300 Subject: [PATCH 2/2] Remove var_dump from the code --- README.md | 7 +++++-- readme.txt | 6 ++++++ src/includes/Mailjet.php | 2 +- wp-mailjet.php | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 45f16371..ebc19dbf 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ - Tags: email, marketing, signup, newsletter, widget, smtp, woocommerce, contact form 7 - Requires at least: 4.4 - Tested up to: 6.0.1 -- Stable tag: 5.2.24 +- Stable tag: 5.2.25 - Requires PHP: 5.6 - License: GPLv2 or later - License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -205,7 +205,10 @@ find vendor/ -type d -name ".git" -exec rm -rf {} \; 7. Configure abandoned cart notifications for WooCommerce ## Changelog -##### 5.2.24 +##### 5.2.25 +* Removed var_dump from the code because off error + +* ##### 5.2.24 * Fix bug with widget for WP 6+ version ##### 5.2.23 diff --git a/readme.txt b/readme.txt index 00d2015b..bb4e0906 100644 --- a/readme.txt +++ b/readme.txt @@ -196,6 +196,9 @@ find vendor/ -type d -name ".git" -exec rm -rf {} \; 7. Configure abandoned cart notifications for WooCommerce == Upgrade notice == += 5.2.25 = +* Removed var_dump from the code because off error + = 5.2.24 = * Fix bug with widget for WP 6+ version @@ -235,6 +238,9 @@ find vendor/ -type d -name ".git" -exec rm -rf {} \; * Removed Bootstrap dependency == Changelog == += 5.2.25 = +* Removed var_dump from the code because off error + = 5.2.24 = * Fix bug with widget for WP 6+ version diff --git a/src/includes/Mailjet.php b/src/includes/Mailjet.php index 066f5579..16818c62 100644 --- a/src/includes/Mailjet.php +++ b/src/includes/Mailjet.php @@ -62,7 +62,7 @@ public function __construct() if (\defined('MAILJET_VERSION')) { $this->version = MAILJET_VERSION; } else { - $this->version = '5.2.24'; + $this->version = '5.2.25'; } $this->plugin_name = 'mailjet'; $this->load_dependencies(); diff --git a/wp-mailjet.php b/wp-mailjet.php index e4b05230..b98ab53f 100755 --- a/wp-mailjet.php +++ b/wp-mailjet.php @@ -14,7 +14,7 @@ * Plugin Name: Mailjet for WordPress * Plugin URI: https://www.mailjet.com/partners/wordpress/ * Description: The Best WordPress Plugin For Email Newsletters. - * Version: 5.2.24 + * Version: 5.2.25 * Tested up to: 6.0.1 * Author: Mailjet SAS * Author URI: http://mailjet.com @@ -55,7 +55,7 @@ /** * Mailjet plugin version. */ -define('MAILJET_VERSION', '5.2.24'); +define('MAILJET_VERSION', '5.2.25'); /** * Mailjet Plugid dir.