public static function settings() { global $wpdb; $pages = get_pages(); $page = fue_get_page_id('followup_unsubscribe'); $emails = get_option('fue_daily_emails'); $bcc = get_option('fue_bcc', ''); $all_emails = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}followup_emails ORDER BY name ASC"); include FUE_TEMPLATES_DIR . '/settings.php'; }
/** * Delete the created unsubscribe page */ public static function delete_unsubscribe_page() { $page_id = fue_get_page_id('followup_unsubscribe'); if ($page_id) { wp_delete_post($page_id, true); } delete_option('fue_followup_unsubscribe_page_id'); }
public function process_unsubscribe_request() { global $wpdb; if (isset($_GET['fue_action']) && $_GET['fue_action'] == 'order_unsubscribe') { if (!wp_verify_nonce($_GET['_wpnonce'], 'fue_unsubscribe')) { die('Request error. Please try again.'); } $order_id = $_GET['order_id']; $email = $_GET['email']; $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}followup_email_orders WHERE user_email = %s AND order_id = %d AND is_sent = 0", $email, $order_id)); wp_redirect(add_query_arg('fue_order_unsubscribed', 1, get_permalink(fue_get_page_id('followup_my_subscriptions')))); exit; } }
/** * Delete the created pages */ public function delete_pages() { $page_id = fue_get_page_id('followup_unsubscribe'); if ($page_id) { wp_delete_post($page_id, true); delete_option('fue_followup_unsubscribe_page_id'); } $page_id = fue_get_page_id('followup_my_subscriptions'); if ($page_id) { wp_delete_post($page_id, true); delete_option('fue_followup_my_subscriptions_page_id'); } }
public static function send_test_email() { global $wpdb; $_POST = array_map('stripslashes_deep', $_POST); $id = $_POST['id']; $email = $_POST['email']; $message = $_POST['message']; $codes = array(); $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM {$wpdb->prefix}followup_emails WHERE id = %d", $id)); $type = $data->email_type; if (!empty($data->tracking_code)) { parse_str($data->tracking_code, $codes); foreach ($codes as $key => $val) { $codes[$key] = urlencode($val); } } // process variable replacements $store_url = empty($codes) ? site_url() : add_query_arg($codes, site_url()); $store_name = get_bloginfo('name'); $page_id = fue_get_page_id('followup_unsubscribe'); $unsubscribe = empty($codes) ? add_query_arg('wcfu', $email, get_permalink($page_id)) : add_query_arg($codes, add_query_arg('wcfu', $email, get_permalink($page_id))); if ($type == 'signup') { $vars = apply_filters('fue_email_signup_test_variables', array('{store_url}', '{store_name}', '{customer_first_name}', '{customer_name}', '{customer_email}', '{unsubscribe_url}')); $reps = apply_filters('fue_email_signup_test_replacements', array($store_url, $store_name, 'John', 'John Doe', '*****@*****.**', $unsubscribe)); } elseif ($type == 'manual') { $vars = apply_filters('fue_email_manual_test_variables', array('{store_url}', '{store_name}', '{customer_first_name}', '{customer_name}', '{customer_email}', '{unsubscribe_url}')); $reps = apply_filters('fue_email_manual_test_replacements', array($store_url, $store_name, 'John', 'John Doe', '*****@*****.**', $unsubscribe)); } else { $vars = apply_filters('fue_email_' . $data->email_type . '_test_variables', array('{store_url}', '{store_name}', '{unsubscribe_url}'), $_POST); $reps = apply_filters('fue_email_' . $data->email_type . '_test_replacements', array($store_url, $store_name, $unsubscribe), $_POST); } $subject = strip_tags(str_replace($vars, $reps, $data->subject)); $message = str_replace($vars, $reps, $message); $message = do_shortcode($message); // hook to variable replacement $subject = apply_filters('fue_send_test_email_subject', $subject); $message = apply_filters('fue_send_test_email_message', $message); // look for custom fields $message = preg_replace_callback('|\\{cf ([0-9]+) ([^}]*)\\}|', 'fue_add_custom_fields', $message); // look for post id $message = preg_replace_callback('|\\{post_id=([^}]+)\\}|', 'fue_add_post', $message); // look for links //$replacer = new FUE_Link_Replacement( $email_order->id, $email->id, $user_id, $email_to ); $message = preg_replace('|\\{link url=([^}]+)\\}|', '$1', $message); // look for store_url with path $message = preg_replace_callback('|\\{store_url=([^}]+)\\}|', 'FUE::add_test_store_url', $message); do_action('fue_before_test_email_send', $subject, $message); self::mail($email, $subject, $message); do_action('fue_after_test_email_sent', $subject, $message); die("OK"); }