Skip to content

Commit

Permalink
Deploying version 1.6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmjones committed Jun 5, 2023
1 parent e5f7a4b commit b0a29f3
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 62 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Requires at least:** 5.3 \
**Tested up to:** 6.2 \
**Requires PHP:** 7.2 \
**Stable tag:** 1.6.4
**Stable tag:** 1.6.5

Fix your email delivery problems by sending your WordPress emails through Amazon SES's powerful email sending infrastructure.

Expand Down Expand Up @@ -191,6 +191,11 @@ Please double check the credentials match up with the credentials you received w

## Changelog

### 1.6.5 - 2023-06-05

* Bug fix: Apostrophes in email addresses no longer prevent sending
* Bug fix: More than 25 Verified Senders can now be managed

### 1.6.4 - 2023-05-18

* Bug fix: WP Offload SES now works with PHP 8.2
Expand Down
41 changes: 20 additions & 21 deletions classes/Activity-List-Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ public function column_default( $item, $column_name ) {
* @param array $email The array of info about the email.
*/
public function column_cb( $email ) {
$id = esc_attr( $email['id'] );
$id = esc_attr( $email['id'] );
?>
<input id="cb-select-<?php echo $id; ?>" type="checkbox" name="email[]" value="<?php echo $id; ?>" />
<input id="cb-select-<?php echo $id; ?>" type="checkbox" name="email[]" value="<?php echo $id; ?>"/>
<?php
}

Expand Down Expand Up @@ -313,9 +313,7 @@ public function get_data( $current_page, $per_page ) {
ORDER BY $orderby $order
LIMIT $offset, $count";

$results = $this->database->get_results( $query, ARRAY_A );

return $results;
return stripslashes_deep( $this->database->get_results( $query, ARRAY_A ) );
}

/**
Expand Down Expand Up @@ -409,9 +407,10 @@ public function render_views() {
* The dynamic portion of the hook name, `$this->screen->id`, refers
* to the ID of the current screen, usually a string.
*
* @param string[] $views An array of available list table views.
*
* @since 3.5.0
*
* @param string[] $views An array of available list table views.
*/
$views = apply_filters( "views_{$this->screen->id}", $views );
if ( empty( $views ) ) {
Expand All @@ -427,7 +426,7 @@ public function render_views() {
$current = 'all';
}

$current = ( $current === $class ) ? 'current' : '';
$current = ( $current === $class ) ? 'current' : '';
$views[ $class ] = "\t<li class='$class'><a href='#activity' class='$current' data-status='$class'>$view</a>";
}
echo implode( " |</li>\n", $views ) . "</li>\n";
Expand Down Expand Up @@ -508,17 +507,17 @@ public function process_bulk_actions() {
public function display() {
?>
<form id="wposes-activity-form" method="post">
<?php
wp_nonce_field( 'wposes-activity-nonce', 'wposes_activity_nonce' );
<?php
wp_nonce_field( 'wposes-activity-nonce', 'wposes_activity_nonce' );

$order = ! empty( $this->_pagination_args['order'] ) ? $this->_pagination_args['order'] : 'desc';
$orderby = ! empty( $this->_pagination_args['orderby'] ) ? $this->_pagination_args['orderby'] : 'date';
$order = ! empty( $this->_pagination_args['order'] ) ? $this->_pagination_args['order'] : 'desc';
$orderby = ! empty( $this->_pagination_args['orderby'] ) ? $this->_pagination_args['orderby'] : 'date';

echo '<input type="hidden" id="order" name="order" value="' . esc_attr( $order ) . '" />';
echo '<input type="hidden" id="orderby" name="orderby" value="' . esc_attr( $orderby ) . '" />';
echo '<input type="hidden" id="order" name="order" value="' . esc_attr( $order ) . '" />';
echo '<input type="hidden" id="orderby" name="orderby" value="' . esc_attr( $orderby ) . '" />';

parent::display();
?>
parent::display();
?>
</form>
<?php
}
Expand Down Expand Up @@ -548,9 +547,9 @@ public function extra_tablenav( $which = 'top' ) {
?>
<div id="wposes-activity-actions" class="alignleft actions">
<?php $this->email_months_dropdown(); ?>
<input id="wposes-subject-search" type="text" name="subject" placeholder="<?php _e( 'All Subjects', 'wp-offload-ses' ); ?>" />
<input id="wposes-recipient-search" type="text" name="recipient" placeholder="<?php _e( 'All Recipients', 'wp-offload-ses' ); ?>" />
<input type="submit" id="wposes-filter-btn" name="filter_action" class="button action" value="<?php _e( 'Filter', 'wp-offload-ses' ); ?>" />
<input id="wposes-subject-search" type="text" name="subject" placeholder="<?php _e( 'All Subjects', 'wp-offload-ses' ); ?>"/>
<input id="wposes-recipient-search" type="text" name="recipient" placeholder="<?php _e( 'All Recipients', 'wp-offload-ses' ); ?>"/>
<input type="submit" id="wposes-filter-btn" name="filter_action" class="button action" value="<?php _e( 'Filter', 'wp-offload-ses' ); ?>"/>
</div>
<?php
}
Expand All @@ -566,7 +565,7 @@ public function email_months_dropdown() {
FROM {$this->emails_table}
ORDER BY email_created DESC"
);
$m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
$m = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
?>
<select name="m" id="wposes-filter-by-date">
<option <?php selected( $m, 0 ); ?> value="0"><?php _e( 'All dates', 'wp-offload-ses' ); ?></option>
Expand All @@ -587,8 +586,8 @@ public function email_months_dropdown() {
);
}
?>
</select>
<?php
</select>
<?php
}

/**
Expand Down
14 changes: 11 additions & 3 deletions classes/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private function maybe_log_unverified_sender( string $email ) {
*/
private function to( $to ) {
$to = $this->maybe_convert_to_array( $to );
$to = stripslashes_deep( $to );

foreach ( $to as $recipient ) {
try {
Expand Down Expand Up @@ -217,7 +218,7 @@ private function from() {
* @param string $subject The subject of the email.
*/
private function subject( $subject ) {
$this->mail->Subject = $subject;
$this->mail->Subject = stripslashes( $subject );
}

/**
Expand Down Expand Up @@ -323,6 +324,7 @@ private function header_content_type( $content ) {
private function header_cc( $content, $type = 'cc' ) {
// They could be in CSV format.
$ccs = explode( ',', $content );
$ccs = stripslashes_deep( $ccs );

if ( empty( $ccs ) ) {
return;
Expand Down Expand Up @@ -353,6 +355,7 @@ private function header_cc( $content, $type = 'cc' ) {
*/
private function header_reply_to( $content ) {
$reply_to = $this->maybe_convert_to_array( $content );
$reply_to = stripslashes_deep( $reply_to );

foreach ( $reply_to as $recipient ) {
try {
Expand Down Expand Up @@ -480,6 +483,11 @@ public function prepare() {
$this->mail->Body = $wp_offload_ses->get_email_events()->filter_email_content( $this->email_id, $this->mail->Body );
}

// May need to strip slashes in the body.
if ( 'text/html' !== $this->mail->ContentType ) {
$this->mail->Body = stripslashes( $this->mail->Body );
}

// Fires after PHPMailer is initialized.
do_action_ref_array( 'phpmailer_init', array( &$this->mail ) );

Expand Down Expand Up @@ -576,9 +584,9 @@ public function view( $email_data = array() ) {

$body = $this->sanitize_email_body( $this->mail->Body );

// Maybe add HTML line breaks.
// Maybe strip slashes and add HTML line breaks.
if ( 'text/html' !== $this->mail->ContentType ) {
$body = nl2br( $body );
$body = nl2br( stripslashes( $body ) );
}

if ( isset( $email_data['status_i18n'] ) ) {
Expand Down
19 changes: 17 additions & 2 deletions classes/SES-API.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,18 @@ public function get_send_quota() {
/**
* Get the identities associated with the account.
*
* @param array $args Args to pass to the request.
* @param array $args Args to pass to the request.
* @param array $prev_identities Previously returned identities if paging.
*
* @return array|Error
*/
public function get_identities( array $args = array() ) {
public function get_identities( array $args = array(), array $prev_identities = array() ) {
if ( empty( $args['PageSize'] ) ) {
$args['PageSize'] = 1000;
}

$prev_identities = empty( $prev_identities ) ? array() : $prev_identities;

try {
$response = $this->get_client()->listEmailIdentities( $args );
$identities = $response['EmailIdentities'];
Expand Down Expand Up @@ -183,6 +190,14 @@ public function get_identities( array $args = array() ) {
}
}

$identities = array_merge( $prev_identities, $identities );

if ( ! empty( $response['NextToken'] ) ) {
$args['NextToken'] = $response['NextToken'];

return $this->get_identities( $args, $identities );
}

return $identities;
}

Expand Down
4 changes: 2 additions & 2 deletions classes/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ public function get_setting( string $key, $default = '' ) {
$this->get_settings();
$setting = $this->settings[ $key ] ?? $default;

return apply_filters( 'wposes_get_setting', $setting, $key );
return stripslashes_deep( apply_filters( 'wposes_get_setting', $setting, $key ) );
}

/**
Expand All @@ -396,7 +396,7 @@ public function get_network_setting( string $key, $default = '' ) {
$this->get_network_settings();
$network_setting = $this->network_settings[ $key ] ?? $default;

return apply_filters( 'wposes_get_network_setting', $network_setting, $key );
return stripslashes_deep( apply_filters( 'wposes_get_network_setting', $network_setting, $key ) );
}

/**
Expand Down
Loading

0 comments on commit b0a29f3

Please sign in to comment.