_args['plural'] ) ) { die( '

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

' ); } if ( ! empty( $_POST['addresses'] ) ) { $reg_sub_error = ''; $pub_sub_error = ''; $unsub_error = ''; $email_error = ''; $message = ''; foreach ( preg_split( '/[\s,]+/', $_POST['addresses'] ) as $email ) { $clean_email = $this->sanitize_email( $email ); if ( false === $this->validate_email( $clean_email ) ) { ( '' === $email_error ) ? $email_error = "$email" : $email_error .= ", $email"; continue; } else { if ( isset( $_POST['subscribe'] ) ) { if ( false !== $this->is_public( $clean_email ) ) { ( '' === $pub_sub_error ) ? $pub_sub_error = "$clean_email" : $pub_sub_error .= ", $clean_email"; continue; } if ( $this->is_registered( $clean_email ) ) { ( '' === $reg_sub_error ) ? $reg_sub_error = "$clean_email" : $reg_sub_error .= ", $clean_email"; continue; } $this->add( $clean_email, true ); $message = __( 'Address(es) subscribed!', 'subscribe2' ); } elseif ( isset( $_POST['unsubscribe'] ) ) { if ( false === $this->is_public( $clean_email ) || $this->is_registered( $clean_email ) ) { ( '' === $unsub_error ) ? $unsub_error = "$clean_email" : $unsub_error .= ", $clean_email"; continue; } $this->delete( $clean_email ); $message = __( 'Address(es) unsubscribed!', 'subscribe2' ); } } } if ( '' !== $reg_sub_error ) { echo '

' . esc_html__( 'Some emails were not processed, the following are already Registered Subscribers', 'subscribe2' ) . ':
' . esc_html( $reg_sub_error ) . '

'; } if ( '' !== $pub_sub_error ) { echo '

' . esc_html__( 'Some emails were not processed, the following are already Public Subscribers', 'subscribe2' ) . ':
' . esc_html( $pub_sub_error ) . '

'; } if ( '' !== $unsub_error ) { echo '

' . esc_html__( 'Some emails were not processed, the following were not in the database', 'subscribe2' ) . ':
' . esc_html( $unsub_error ) . '

'; } if ( '' !== $email_error ) { echo '

' . esc_html__( 'Some emails were not processed, the following were invalid email addresses', 'subscribe2' ) . ':
' . esc_html( $email_error ) . '

'; } if ( '' !== $message ) { echo '

' . esc_html( $message ) . '

'; } $_POST['what'] = 'confirmed'; } elseif ( isset( $_POST['remind'] ) ) { $this->remind( $_POST['reminderemails'] ); echo '

' . esc_html__( 'Reminder Email(s) Sent!', 'subscribe2' ) . '

'; } elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === $_POST['manage'] ) { if ( isset( $_REQUEST['subscriber'] ) ) { $this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['category'] ); } else { $this->subscribe_registered_users( $_POST['exportcsv'], $_POST['category'] ); } echo '

' . esc_html__( 'Registered Users Subscribed!', 'subscribe2' ) . '

'; } elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === $_POST['manage'] ) { if ( isset( $_REQUEST['subscriber'] ) ) { $this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['category'] ); } else { $this->unsubscribe_registered_users( $_POST['exportcsv'], $_POST['category'] ); } echo '

' . esc_html__( 'Registered Users Unsubscribed!', 'subscribe2' ) . '

'; } elseif ( isset( $_POST['sub_format'] ) ) { if ( isset( $_REQUEST['subscriber'] ) ) { $this->format_change( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['format'] ); } else { $this->format_change( $_POST['exportcsv'], $_POST['format'] ); } echo '

' . esc_html__( 'Format updated for Selected Registered Users!', 'subscribe2' ) . '

'; } elseif ( isset( $_POST['sub_digest'] ) ) { if ( isset( $_REQUEST['subscriber'] ) ) { $this->digest_change( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['sub_category'] ); } else { $this->digest_change( $_POST['exportcsv'], $_POST['sub_category'] ); } echo '

' . esc_html__( 'Digest Subscription updated for Selected Registered Users!', 'subscribe2' ) . '

'; } } if ( 'registered' === $current_tab ) { // Get Registered Subscribers $registered = $this->get_registered( 'return=emailid' ); $all_users = $this->get_all_registered( 'emailid' ); // safety check for our arrays if ( '' === $registered ) { $registered = array(); } if ( '' === $all_users ) { $all_users = array(); } } else { //Get Public Subscribers $confirmed = $this->get_public(); $unconfirmed = $this->get_public( 0 ); // safety check for our arrays if ( '' === $confirmed ) { $confirmed = array(); } if ( '' === $unconfirmed ) { $unconfirmed = array(); } } $reminderform = false; if ( isset( $_REQUEST['what'] ) ) { if ( 'public' === $_REQUEST['what'] ) { $what = 'public'; $subscribers = array_merge( (array) $confirmed, (array) $unconfirmed ); } elseif ( 'confirmed' === $_REQUEST['what'] ) { $what = 'confirmed'; $subscribers = $confirmed; } elseif ( 'unconfirmed' === $_REQUEST['what'] ) { $what = 'unconfirmed'; $subscribers = $unconfirmed; if ( ! empty( $subscribers ) ) { $reminderemails = implode( ',', $subscribers ); $reminderform = true; } } elseif ( is_numeric( $_REQUEST['what'] ) ) { $what = intval( $_REQUEST['what'] ); $subscribers = $this->get_registered( "cats=$what&return=emailid" ); } elseif ( 'registered' === $_REQUEST['what'] ) { $what = 'registered'; $subscribers = $registered; } elseif ( 'all_users' === $_REQUEST['what'] ) { $what = 'all_users'; $subscribers = $all_users; } } else { if ( 'public' === $current_tab ) { $what = 'public'; $subscribers = array_merge( (array) $confirmed, (array) $unconfirmed ); } else { $what = 'all_users'; $subscribers = $all_users; } } if ( ! empty( $_POST['s'] ) ) { if ( 'registered' === $current_tab ) { foreach ( $subscribers as $subscriber ) { if ( is_numeric( stripos( $subscriber['user_email'], $_POST['s'] ) ) ) { $result[] = $subscriber; } } } else { foreach ( $subscribers as $subscriber ) { if ( is_numeric( stripos( $subscriber, $_POST['s'] ) ) ) { $result[] = $subscriber; } } } $subscribers = $result; } $s2_list_table->prepare_items(); // show our form echo '
'; echo '

' . esc_html__( 'Subscribers', 'subscribe2' ) . '

' . "\r\n"; $s2tabs = array( 'public' => __( 'Public Subscribers', 'subscribe2' ), 'registered' => __( 'Registered Subscribers', 'subscribe2' ), ); echo ''; echo '
' . "\r\n"; echo '' . "\r\n"; switch ( $current_tab ) { case 'public': echo '' . "\r\n"; echo '
' . "\r\n"; echo '

' . esc_html__( 'Add/Remove Subscribers', 'subscribe2' ) . '

' . "\r\n"; echo '

' . esc_html__( 'Enter addresses, one per line or comma-separated', 'subscribe2' ) . '
' . "\r\n"; echo '

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

'; echo ' 

' . "\r\n"; echo '
' . "\r\n"; // subscriber lists echo '
' . "\r\n"; echo '

' . esc_html__( 'Current Subscribers', 'subscribe2' ) . '

' . "\r\n"; echo '
'; $cats = $this->all_cats(); $cat_ids = array(); foreach ( $cats as $category ) { $cat_ids[] = $category->term_id; } $exclude = array_merge( array( 'all', 'all_users', 'registered' ), $cat_ids ); break; case 'registered': echo '' . "\r\n"; echo '
' . "\r\n"; echo '

' . esc_html__( 'Add/Remove Subscribers', 'subscribe2' ) . '

' . "\r\n"; echo '

' . esc_html__( 'Add Registered User', 'subscribe2' ) . '

' . "\r\n"; echo "
\r\n"; // subscriber lists echo '
' . "\r\n"; echo '

' . esc_html__( 'Current Subscribers', 'subscribe2' ) . '

' . "\r\n"; echo '
'; $exclude = array( 'all', 'public', 'confirmed', 'unconfirmed' ); break; } // show the selected subscribers echo ''; echo '' . "\r\n"; if ( $reminderform ) { echo '' . "\r\n"; } else { echo ''; } if ( ! empty( $subscribers ) ) { if ( 'public' === $current_tab ) { $exportcsv = implode( ",\r\n", $subscribers ); } else { $exportcsv = ''; foreach ( $subscribers as $subscriber ) { ( '' === $exportcsv ) ? $exportcsv = $subscriber['user_email'] : $exportcsv .= ",\r\n" . $subscriber['user_email']; } } echo '' . "\r\n"; } else { echo ''; } echo '
'; $this->display_subscriber_dropdown( $what, __( 'Filter', 'subscribe2' ), $exclude ); echo '' . "\r\n"; echo '' . "\r\n"; echo '
'; // output our subscriber table $s2_list_table->search_box( __( 'Search', 'subscribe2' ), 'search_id' ); $s2_list_table->display(); echo '
' . "\r\n"; // show bulk management form if filtered in some Registered Users if ( 'registered' === $current_tab ) { echo '
' . "\r\n"; echo '

' . esc_html__( 'Bulk Management', 'subscribe2' ) . '

' . "\r\n"; if ( 'never' === $this->subscribe2_options['email_freq'] ) { $categories = array(); if ( isset( $_POST['category'] ) ) { $categories = $_POST['category']; } $manage = ''; if ( isset( $_POST['manage'] ) ) { $manage = $_POST['manage']; } $format = ''; if ( isset( $_POST['format'] ) ) { $format = $_POST['format']; } echo esc_html__( 'Preferences for Registered Users selected above can be changed using this section.', 'subscribe2' ) . '
' . "\r\n"; echo '' . esc_html__( 'Consider User Privacy as changes cannot be undone', 'subscribe2' ) . '
' . "\r\n"; echo '
' . esc_html__( 'Action to perform', 'subscribe2' ) . ':' . "\r\n"; echo '  ' . "\r\n"; echo '

' . "\r\n"; if ( '1' === $this->subscribe2_options['reg_override'] ) { $s2_forms->display_category_form( $categories, 1 ); } else { $s2_forms->display_category_form( $categories, 0 ); } echo '

'; echo '
' . esc_html__( 'Send email as', 'subscribe2' ) . ':' . "\r\n"; echo '  ' . "\r\n"; echo '  ' . "\r\n"; echo '  ' . "\r\n"; echo '' . "\r\n"; echo '

'; } else { $sub_cats = ''; if ( isset( $_POST['sub_category'] ) ) { $sub_cats = $_POST['sub_category']; } echo esc_html__( 'Preferences for Registered Users selected above can be changed using this section.', 'subscribe2' ) . "
\r\n"; echo '' . esc_html__( 'Consider User Privacy as changes cannot be undone.', 'subscribe2' ) . '
' . "\r\n"; echo '
' . esc_html__( 'Subscribe Selected Users to receive a periodic digest notification', 'subscribe2' ) . ':' . "\r\n"; echo '  ' . "\r\n"; echo ''; echo '

'; } echo '
' . "\r\n"; } echo '
' . "\r\n"; require ABSPATH . 'wp-admin/admin-footer.php'; // just to be sure die;