Merged in feature/314-dev-dev01 (pull request #24)
auto-patch 314-dev-dev01-2024-01-25T04_09_02 * auto-patch 314-dev-dev01-2024-01-25T04_09_02
This commit is contained in:
@@ -995,7 +995,6 @@ class SetupWizard {
|
||||
* AJAX callback for getting all partner's plugin information.
|
||||
*
|
||||
* @since 2.6.0
|
||||
* @since 3.9.0 Check if a SEO toolkit plugin is installed.
|
||||
*/
|
||||
public function get_partner_plugins_info() {
|
||||
|
||||
@@ -1004,7 +1003,6 @@ class SetupWizard {
|
||||
$plugins = $this->get_partner_plugins();
|
||||
|
||||
$contact_form_plugin_already_installed = false;
|
||||
$seo_toolkit_plugin_already_installed = false;
|
||||
|
||||
$contact_form_basenames = [
|
||||
'wpforms-lite/wpforms.php',
|
||||
@@ -1015,24 +1013,12 @@ class SetupWizard {
|
||||
'ninja-forms/ninja-forms.php',
|
||||
];
|
||||
|
||||
$seo_toolkit_basenames = [
|
||||
'all-in-one-seo-pack/all_in_one_seo_pack.php',
|
||||
'all-in-one-seo-pack-pro/all_in_one_seo_pack.php',
|
||||
'seo-by-rank-math/rank-math.php',
|
||||
'seo-by-rank-math-pro/rank-math-pro.php',
|
||||
'wordpress-seo/wp-seo.php',
|
||||
'wordpress-seo-premium/wp-seo-premium.php',
|
||||
'wp-seopress/seopress.php',
|
||||
'wp-seopress-pro/seopress-pro.php',
|
||||
];
|
||||
|
||||
$installed_plugins = get_plugins();
|
||||
|
||||
foreach ( $installed_plugins as $basename => $plugin_info ) {
|
||||
if ( in_array( $basename, $contact_form_basenames, true ) ) {
|
||||
$contact_form_plugin_already_installed = true;
|
||||
} elseif ( in_array( $basename, $seo_toolkit_basenames, true ) ) {
|
||||
$seo_toolkit_plugin_already_installed = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1044,7 +1030,6 @@ class SetupWizard {
|
||||
$data = [
|
||||
'plugins' => $plugins,
|
||||
'contact_form_plugin_already_installed' => $contact_form_plugin_already_installed,
|
||||
'seo_toolkit_plugin_already_installed' => $seo_toolkit_plugin_already_installed,
|
||||
];
|
||||
|
||||
wp_send_json_success( $data );
|
||||
|
||||
@@ -669,4 +669,21 @@ abstract class MailerAbstract implements MailerInterface {
|
||||
|
||||
return $this->connection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize email header values.
|
||||
*
|
||||
* @param string $name Name of the header.
|
||||
* @param string $value Value of the header.
|
||||
*
|
||||
* @since 3.11.1
|
||||
*/
|
||||
public function sanitize_header_value( $name, $value ) {
|
||||
|
||||
if ( strtolower( $name ) === 'list-unsubscribe' ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return WP::sanitize_value( $value );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ class Mailer extends MailerAbstract {
|
||||
|
||||
$this->set_body_param(
|
||||
array(
|
||||
'h:' . $name => WP::sanitize_value( $value ),
|
||||
'h:' . $name => $this->sanitize_header_value( $name, $value ),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -92,10 +92,7 @@ class Mailer extends MailerAbstract {
|
||||
}
|
||||
|
||||
$headers = isset( $this->body['Headers'] ) ? (array) $this->body['Headers'] : [];
|
||||
|
||||
if ( $name !== 'Message-ID' ) {
|
||||
$value = WP::sanitize_value( $value );
|
||||
}
|
||||
$value = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
// Prevent duplicates.
|
||||
$key = array_search( $name, array_column( $headers, 'Name' ), true );
|
||||
@@ -466,4 +463,21 @@ class Mailer extends MailerAbstract {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize email header values.
|
||||
*
|
||||
* @param string $name Name of the header.
|
||||
* @param string $value Value of the header.
|
||||
*
|
||||
* @since 3.11.1
|
||||
*/
|
||||
public function sanitize_header_value( $name, $value ) {
|
||||
|
||||
if ( strtolower( $name ) === 'message-id' ) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return parent::sanitize_header_value( $name, $value );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ class Mailer extends MailerAbstract {
|
||||
|
||||
$headers = isset( $this->body['custom_headers'] ) ? (array) $this->body['custom_headers'] : array();
|
||||
|
||||
$headers[ $name ] = WP::sanitize_value( $value );
|
||||
$headers[ $name ] = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
$this->set_body_param(
|
||||
array(
|
||||
|
||||
@@ -232,7 +232,7 @@ class Mailer extends MailerAbstract {
|
||||
|
||||
$headers = isset( $this->body['headers'] ) ? (array) $this->body['headers'] : array();
|
||||
|
||||
$headers[ $name ] = WP::sanitize_value( $value );
|
||||
$headers[ $name ] = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
$this->set_body_param(
|
||||
array(
|
||||
|
||||
@@ -110,7 +110,7 @@ class Mailer extends MailerAbstract {
|
||||
}
|
||||
|
||||
$headers = isset( $this->body['headers'] ) ? (array) $this->body['headers'] : [];
|
||||
$headers[ $name ] = WP::sanitize_value( $value );
|
||||
$headers[ $name ] = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
$this->set_body_param(
|
||||
[
|
||||
|
||||
@@ -81,7 +81,7 @@ class Mailer extends MailerAbstract {
|
||||
|
||||
$headers = isset( $this->body['Headers'] ) ? (array) $this->body['Headers'] : [];
|
||||
|
||||
$headers[ $name ] = WP::sanitize_value( $value );
|
||||
$headers[ $name ] = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
$this->set_body_param(
|
||||
[
|
||||
|
||||
@@ -131,10 +131,7 @@ class Mailer extends MailerAbstract {
|
||||
}
|
||||
|
||||
$headers = isset( $this->body['content']['headers'] ) ? (array) $this->body['content']['headers'] : [];
|
||||
|
||||
if ( ! in_array( $name, [ 'Message-ID', 'CC' ], true ) ) {
|
||||
$value = WP::sanitize_value( $value );
|
||||
}
|
||||
$value = $this->sanitize_header_value( $name, $value );
|
||||
|
||||
$headers[ $name ] = $value;
|
||||
|
||||
@@ -539,4 +536,30 @@ class Mailer extends MailerAbstract {
|
||||
|
||||
return $holder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sanitize email header values.
|
||||
*
|
||||
* @param string $name Name of the header.
|
||||
* @param string $value Value of the header.
|
||||
*
|
||||
* @since 3.11.1
|
||||
*/
|
||||
public function sanitize_header_value( $name, $value ) {
|
||||
|
||||
if (
|
||||
in_array(
|
||||
strtolower( $name ),
|
||||
[
|
||||
'message-id',
|
||||
'cc',
|
||||
],
|
||||
true
|
||||
)
|
||||
) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
return parent::sanitize_header_value( $name, $value );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user