' . esc_html__( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '

' ); } $subject = html_entity_decode( stripslashes( wp_kses( $this->substitute( $_POST['subject'] ), '' ) ), ENT_QUOTES ); $body = wpautop( $this->substitute( stripslashes( $_POST['content'] ) ), true ); if ( '' !== $current_user->display_name || '' !== $current_user->user_email ) { $this->myname = html_entity_decode( $current_user->display_name, ENT_QUOTES ); $this->myemail = $current_user->user_email; } if ( isset( $_POST['send'] ) ) { if ( 'confirmed' === $_POST['what'] ) { $recipients = $this->get_public(); } elseif ( 'unconfirmed' === $_POST['what'] ) { $recipients = $this->get_public( 0 ); } elseif ( 'public' === $_POST['what'] ) { $confirmed = $this->get_public(); $unconfirmed = $this->get_public( 0 ); $recipients = array_merge( (array) $confirmed, (array) $unconfirmed ); } elseif ( is_numeric( $_POST['what'] ) ) { $category = intval( $_POST['what'] ); $recipients = $this->get_registered( "cats=$category" ); } elseif ( 'all_users' === $_POST['what'] ) { $recipients = $this->get_all_registered(); } elseif ( 'all' === $_POST['what'] ) { $confirmed = $this->get_public(); $unconfirmed = $this->get_public( 0 ); $registered = $this->get_all_registered(); $recipients = array_merge( (array) $confirmed, (array) $unconfirmed, (array) $registered ); } else { $recipients = $this->get_registered(); } } elseif ( isset( $_POST['preview'] ) ) { global $user_email; $recipients[] = $user_email; } $uploads = array(); if ( ! empty( $_FILES ) ) { foreach ( $_FILES['file']['name'] as $key => $value ) { if ( 0 === $_FILES['file']['error'][ $key ] ) { $file = array( 'name' => $_FILES['file']['name'][ $key ], 'type' => $_FILES['file']['type'][ $key ], 'tmp_name' => $_FILES['file']['tmp_name'][ $key ], 'error' => $_FILES['file']['error'][ $key ], 'size' => $_FILES['file']['size'][ $key ], ); $uploads[] = wp_handle_upload( $file, array( 'test_form' => false, ) ); } } } $attachments = array(); if ( ! empty( $uploads ) ) { foreach ( $uploads as $upload ) { if ( ! isset( $upload['error'] ) ) { $attachments[] = $upload['file']; } else { $upload_error = $upload['error']; } } } if ( empty( $body ) ) { $error_message = __( 'Your email was empty', 'subscribe2' ); $success = false; } elseif ( isset( $upload_error ) ) { $error_message = $upload_error; $success = false; } else { $success = $this->mail( $recipients, $subject, $body, 'html', $attachments ); $error_message = __( 'Check your settings and check with your hosting provider', 'subscribe2' ); } if ( $success ) { if ( isset( $_POST['preview'] ) ) { $message = '

' . __( 'Preview message sent!', 'subscribe2' ) . '

'; } elseif ( isset( $_POST['send'] ) ) { $message = '

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

'; } } else { global $phpmailer; $message = '

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

' . $error_message . $phpmailer->ErrorInfo; } echo '

' . wp_kses_post( $message ) . '

' . "\r\n"; } // show our form echo '
'; echo '

' . esc_html__( 'Send an email to subscribers', 'subscribe2' ) . '

' . "\r\n"; echo '
' . "\r\n"; wp_nonce_field( 'subscribe2-write_subscribers' . S2VERSION ); if ( isset( $_POST['subject'] ) ) { $subject = stripslashes( esc_html( $_POST['subject'] ) ); } else { $subject = __( 'A message from', 'subscribe2' ) . ' ' . html_entity_decode( get_option( 'blogname' ), ENT_QUOTES ); } if ( ! isset( $_POST['content'] ) ) { $body = ''; } echo '

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

'; echo ''; echo "

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

\r\n"; echo esc_html__( 'Recipients:', 'subscribe2' ) . ' '; $this->display_subscriber_dropdown( apply_filters( 's2_subscriber_dropdown_default', 'registered' ), false ); echo ''; echo '

 

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

 

'; ?>