diff --git a/admin/send-email.php b/admin/send-email.php index 240e0e2..fc1e7a1 100644 --- a/admin/send-email.php +++ b/admin/send-email.php @@ -97,9 +97,12 @@ } } else { global $phpmailer; - $message = '

' . __( 'Message failed!', 'subscribe2' ) . '

' . $error_message . $phpmailer->ErrorInfo; + + $mailer_error = ! empty( $phpmailer->ErrorInfo ) ? $phpmailer->ErrorInfo : ''; + $message = '

' . __( 'Message failed!', 'subscribe2' ) . '

' . $error_message . $mailer_error; } - echo '

' . wp_kses_post( $message ) . '

' . "\r\n"; + + echo '

' . wp_kses_post( $message ) . '

' . "\r\n"; } // show our form @@ -118,7 +121,7 @@ echo '

' . esc_html__( 'Subject', 'subscribe2' ) . ':

'; echo ''; -echo "

\r\n"; +echo "
\r\n"; echo '\r\n"; echo "

\r\n"; echo esc_html__( 'Recipients:', 'subscribe2' ) . ' '; @@ -128,16 +131,58 @@ echo '' . "\r\n"; echo '

 

'; ?> - + subscribe2_options[ $key ] = sanitize_text_field( trim( $_POST[ $key ] ) ); + $this->subscribe2_options[ $key ] = in_array( $key, array( 'notification_subject', 'confirm_subject', 'remind_subject' ) ) ? sanitize_text_field( trim( $_POST[ $key ] ) ) : sanitize_textarea_field( trim( $_POST[ $key ] ) ); } elseif ( in_array( $key, array( 'compulsory', 'exclude', 'format' ), true ) ) { sort( $_POST[ $key ] ); diff --git a/classes/class-s2-admin.php b/classes/class-s2-admin.php index 3f54c6e..2930279 100644 --- a/classes/class-s2-admin.php +++ b/classes/class-s2-admin.php @@ -540,7 +540,7 @@ public function s2_meta_handler( $post_id ) { } } - $subscribe_meta_field = ! empty( $_POST['s2_meta_field'] ) ? sanitize_text_field( $_POST['s2_meta_field'] ) : 'no'; + $subscribe_meta_field = ! empty( $_POST['s2_meta_field'] ) ? sanitize_text_field( $_POST['s2_meta_field'] ) : 'yes'; if ( ! empty( $subscribe_meta_field ) && 'no' === $subscribe_meta_field ) { update_post_meta( $post_id, '_s2mail', $subscribe_meta_field ); } else { diff --git a/classes/class-s2-core.php b/classes/class-s2-core.php index 94cf20b..5ac3e56 100644 --- a/classes/class-s2-core.php +++ b/classes/class-s2-core.php @@ -157,9 +157,7 @@ public function substitute( $string = '', $digest_post_ids = array() ) { if ( strstr( $string, '{TINYLINK}' ) ) { $response = wp_safe_remote_get( 'http://tinyurl.com/api-create.php?url=' . rawurlencode( $this->get_tracking_link( $this->permalink ) ) ); - if ( ! is_wp_error( $response ) ) { - $tinylink = wp_remote_retrieve_body( $response ); - } + $tinylink = ! is_wp_error( $response ) ? wp_remote_retrieve_body( $response ) : ''; if ( false !== $tinylink ) { $tlink = '' . $tinylink . ''; @@ -2204,7 +2202,7 @@ public function s2init() { } // Load our translations. - add_action( 'init', array( &$this, 'load_translations' ) ); + add_action( 'init', array( $this, 'load_translations' ) ); // Define and register table name. $s2_table = $wpdb->prefix . 'subscribe2'; @@ -2270,25 +2268,25 @@ public function s2init() { // Add actions for comment subscribers. if ( 'no' !== $this->subscribe2_options['comment_subs'] ) { - add_filter( 'jetpack_get_available_modules', array( &$this, 's2_hide_jetpack_comments' ) ); - add_filter( 'comment_form_submit_field', array( &$this, 's2_comment_meta_form' ) ); - add_action( 'comment_post', array( &$this, 's2_comment_meta' ), 1, 2 ); - add_action( 'wp_set_comment_status', array( &$this, 'comment_status' ) ); + add_filter( 'jetpack_get_available_modules', array( $this, 's2_hide_jetpack_comments' ) ); + add_filter( 'comment_form_submit_field', array( $this, 's2_comment_meta_form' ) ); + add_action( 'comment_post', array( $this, 's2_comment_meta' ), 1, 2 ); + add_action( 'wp_set_comment_status', array( $this, 'comment_status' ) ); } // Add action to display widget if option is enabled. if ( '1' === $this->subscribe2_options['widget'] ) { - add_action( 'widgets_init', array( &$this, 'subscribe2_widget' ) ); + add_action( 'widgets_init', array( $this, 'subscribe2_widget' ) ); } // Add action to display counter widget if option is enabled. if ( '1' === $this->subscribe2_options['counterwidget'] ) { - add_action( 'widgets_init', array( &$this, 'counter_widget' ) ); + add_action( 'widgets_init', array( $this, 'counter_widget' ) ); } // Add action to 'clean' unconfirmed Public Subscribers. if ( is_int( $this->clean_interval ) && $this->clean_interval > 0 ) { - add_action( 'wp_scheduled_delete', array( &$this, 's2cleaner_task' ) ); + add_action( 'wp_scheduled_delete', array( $this, 's2cleaner_task' ) ); } // Add ajax class if enabled. diff --git a/classes/class-s2-frontend.php b/classes/class-s2-frontend.php index 846e19e..039c7fc 100644 --- a/classes/class-s2-frontend.php +++ b/classes/class-s2-frontend.php @@ -13,7 +13,6 @@ class S2_Frontend extends S2_Core { public function unsubscribe( $email ) { global $wpdb; - $email = base64_decode( $email ); if ( ! filter_var( $email, FILTER_VALIDATE_EMAIL ) ) { return; } diff --git a/traits/ShortcodeTrait.php b/traits/ShortcodeTrait.php index fe12158..3f6d417 100644 --- a/traits/ShortcodeTrait.php +++ b/traits/ShortcodeTrait.php @@ -59,7 +59,7 @@ public function load_strings() { $this->unsubscribe = __( 'unsubscribe', 'subscribe2' ); //ACTION replacement in unsubscribing in confirmation email if ( ! empty( $_GET['s2_unsub'] ) ) { - $this->unsubscribe( sanitize_email( $_GET['s2_unsub'] ) ); + $this->unsubscribe( sanitize_email( base64_decode( $_GET['s2_unsub'] ) ) ); } } diff --git a/uninstall.php b/uninstall.php index 572bbbd..b8b903a 100644 --- a/uninstall.php +++ b/uninstall.php @@ -8,8 +8,10 @@ return; } +$s2_mu = false; + // Is this WordPressMU or not? -if ( isset( $wpmu_version ) || strpos( $wp_version, 'wordpress-mu' ) ) { +if ( isset( $wpmu_version ) || ( isset( $wp_version ) && strpos( $wp_version, 'wordpress-mu' ) ) ) { $s2_mu = true; }