Changeset 3841745
- Timestamp:
- 12/03/2026 07:09:02 AM (less than one hour ago)
- Location:
- subscribe-to-download-lite
- Files:
-
- 32 edited
- 1 copied
-
tags/1.3.1 (copied) (copied from subscribe-to-download-lite/trunk )
-
tags/1.3.1/inc/classes/class-stdl-admin.php (modified) (3 diffs)
-
tags/1.3.1/inc/classes/class-stdl-ajax-admin.php (modified) (2 diffs)
-
tags/1.3.1/inc/classes/class-stdl-downloader.php (modified) (3 diffs)
-
tags/1.3.1/inc/classes/class-stdl-enqueue.php (modified) (1 diff)
-
tags/1.3.1/inc/classes/class-stdl-library.php (modified) (6 diffs)
-
tags/1.3.1/inc/cores/subscription-process.php (modified) (1 diff)
-
tags/1.3.1/inc/views/backend/form-sections/stdl-upgrade-to-pro.php (modified) (2 diffs)
-
tags/1.3.1/inc/views/backend/stdl-pro-vs-free.php (modified) (3 diffs)
-
tags/1.3.1/inc/views/backend/stdl-upgrade.php (modified) (2 diffs)
-
tags/1.3.1/inc/views/backend/subscribers/list-subscribers.php (modified) (2 diffs)
-
tags/1.3.1/inc/views/backend/upgrade.php (modified) (1 diff)
-
tags/1.3.1/inc/views/frontend/download-button.php (modified) (1 diff)
-
tags/1.3.1/inc/views/frontend/stdl-shortcode.php (modified) (1 diff)
-
tags/1.3.1/js/stdl-frontend.js (modified) (3 diffs)
-
tags/1.3.1/readme.txt (modified) (3 diffs)
-
tags/1.3.1/subscribe-to-download-lite.php (modified) (3 diffs)
-
trunk/inc/classes/class-stdl-admin.php (modified) (3 diffs)
-
trunk/inc/classes/class-stdl-ajax-admin.php (modified) (2 diffs)
-
trunk/inc/classes/class-stdl-downloader.php (modified) (3 diffs)
-
trunk/inc/classes/class-stdl-enqueue.php (modified) (1 diff)
-
trunk/inc/classes/class-stdl-library.php (modified) (6 diffs)
-
trunk/inc/cores/subscription-process.php (modified) (1 diff)
-
trunk/inc/views/backend/form-sections/stdl-upgrade-to-pro.php (modified) (2 diffs)
-
trunk/inc/views/backend/stdl-pro-vs-free.php (modified) (3 diffs)
-
trunk/inc/views/backend/stdl-upgrade.php (modified) (2 diffs)
-
trunk/inc/views/backend/subscribers/list-subscribers.php (modified) (2 diffs)
-
trunk/inc/views/backend/upgrade.php (modified) (1 diff)
-
trunk/inc/views/frontend/download-button.php (modified) (1 diff)
-
trunk/inc/views/frontend/stdl-shortcode.php (modified) (1 diff)
-
trunk/js/stdl-frontend.js (modified) (3 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/subscribe-to-download-lite.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
subscribe-to-download-lite/tags/1.3.1/inc/classes/class-stdl-admin.php
r3216457 r3841745 32 32 33 33 function export_to_csv() { 34 if ( !empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'stdl_export_csv_nonce')) {34 if (current_user_can('manage_options') && !empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'stdl_export_csv_nonce')) { 35 35 $filename = "subscribers-list.csv"; 36 36 header('Content-type: application/csv'); … … 71 71 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 72 72 73 $subscriber_query = "select * from $subscriber_table";73 $subscriber_query = $wpdb->prepare("SELECT * FROM $subscriber_table WHERE subscriber_form_alias = %s", 'stdl'); 74 74 75 75 $subscriber_rows = $wpdb->get_results($subscriber_query); … … 78 78 if (!empty($subscriber_rows)) { 79 79 foreach ($subscriber_rows as $subscriber_row) { 80 $download_status = (!empty($subscriber_row->subscriber_download_status)) ? esc_html__('Yes', 'subscribe-to-download-lite') : esc_html__('No', 'subscribe-to-download-lite');80 $download_status = esc_html($this->get_download_status_label($subscriber_row->subscriber_download_status)); 81 81 $csv_row = array($subscriber_row->subscriber_name, $subscriber_row->subscriber_email, $download_status); 82 82 $csv_rows[] = $csv_row; -
subscribe-to-download-lite/tags/1.3.1/inc/classes/class-stdl-ajax-admin.php
r2341208 r3841745 34 34 $form_data = $this->sanitize_array($form_data, $sanitize_rule); 35 35 $stdl_settings = $form_data['form_details']; 36 $terms = isset($stdl_settings['form']['terms_agreement']) ? $stdl_settings['form']['terms_agreement'] : array(); 37 if (!empty($terms['show']) && (empty($terms['agreement_text']) || trim(wp_strip_all_tags($terms['agreement_text'])) === '')) { 38 die(wp_json_encode(array('status' => 403, 'message' => esc_html__('Enter agreement text or disable the agreement field.', 'subscribe-to-download-lite')))); 39 } 40 $general = &$stdl_settings['general']; 41 $file_url = !empty($general['download_file']) ? esc_url_raw($general['download_file'], array('http', 'https')) : ''; 42 $file_id = !empty($general['download_file_id']) ? absint($general['download_file_id']) : 0; 43 $attachment_url = $file_id ? wp_get_attachment_url($file_id) : false; 44 if (!$file_url || !$attachment_url || set_url_scheme($file_url) !== set_url_scheme($attachment_url)) { 45 $general['download_file_id'] = ''; 46 } 47 $general['download_file'] = $file_url; 36 48 update_option('stdl_settings', $stdl_settings); 37 49 $response['status'] = 200; … … 48 60 $subscriber_id = intval($_POST['subscriber_id']); 49 61 global $wpdb; 50 $delete_check = $wpdb->delete(STDL_SUBSCRIBERS_TABLE, array('subscriber_id' => $subscriber_id ), array('%d'));62 $delete_check = $wpdb->delete(STDL_SUBSCRIBERS_TABLE, array('subscriber_id' => $subscriber_id, 'subscriber_form_alias' => 'stdl'), array('%d', '%s')); 51 63 if ($delete_check) { 52 64 $response['status'] = 200; -
subscribe-to-download-lite/tags/1.3.1/inc/classes/class-stdl-downloader.php
r2341208 r3841745 11 11 12 12 function initialize_downloader() { 13 if (!empty($_ REQUEST['stdl_encryption_key'])) {14 $encryption_key = sanitize_text_field($_REQUEST['stdl_encryption_key']);15 if (isset($_COOKIE['stdl_encryption_key']) && $encryption_key == $_COOKIE['stdl_encryption_key']) {16 $encryption_key = sanitize_text_field($_COOKIE['stdl_encryption_key']);13 if (!empty($_GET['stdl_encryption_key']) && is_string($_GET['stdl_encryption_key'])) { 14 nocache_headers(); 15 $encryption_key = sanitize_text_field(wp_unslash($_GET['stdl_encryption_key'])); 16 if (isset($_COOKIE['stdl_encryption_key']) && is_string($_COOKIE['stdl_encryption_key']) && hash_equals($encryption_key, $_COOKIE['stdl_encryption_key']) && $this->check_if_already_subscribed($encryption_key)) { 17 17 $download_path = $this->get_download_path($encryption_key); 18 18 … … 26 26 */ 27 27 $download_path = apply_filters('stdl_download_path', $download_path, $encryption_key); 28 if (file_exists($download_path)) { 28 if (!$download_path) { 29 $form_details = get_option('stdl_settings'); 30 $url = !empty($form_details['general']['download_file']) ? esc_url_raw($form_details['general']['download_file'], array('http', 'https')) : ''; 31 if ($url && wp_redirect($url)) { 32 $this->update_download_status($encryption_key, 2); 33 exit; 34 } 35 } elseif (is_file($download_path) && is_readable($download_path)) { 29 36 header('Content-Description: File Transfer'); 30 37 header('Content-Type: application/octet-stream'); 31 header('Content-Disposition: attachment; filename="' . basename($download_path) . '"'); 32 header('Expires: 0'); 33 header('Cache-Control: must-revalidate'); 34 header('Pragma: public'); 38 header('Content-Disposition: attachment; filename="' . sanitize_file_name(basename($download_path)) . '"'); 35 39 header('Content-Length: ' . filesize($download_path)); 36 readfile($download_path); 37 $this->update_download_status($encryption_key); 40 if (readfile($download_path) !== false) { 41 $this->update_download_status($encryption_key); 42 } 38 43 exit; 39 44 } … … 42 47 } 43 48 44 function update_download_status($encryption_key ) {49 function update_download_status($encryption_key, $status = 1) { 45 50 global $wpdb; 46 $wpdb->update(STDL_SUBSCRIBERS_TABLE, array('subscriber_download_status' => 1), array('subscriber_encryption_key' => $encryption_key), array('%d'), array('%s')); 51 if ($status === 2) { 52 $table = STDL_SUBSCRIBERS_TABLE; 53 $wpdb->query($wpdb->prepare("UPDATE $table SET subscriber_download_status = 2 WHERE subscriber_encryption_key = %s AND subscriber_form_alias = %s AND subscriber_download_status = 0", $encryption_key, 'stdl')); 54 return; 55 } 56 $wpdb->update(STDL_SUBSCRIBERS_TABLE, array('subscriber_download_status' => $status), array('subscriber_encryption_key' => $encryption_key, 'subscriber_form_alias' => 'stdl'), array('%d'), array('%s', '%s')); 47 57 } 48 58 -
subscribe-to-download-lite/tags/1.3.1/inc/classes/class-stdl-enqueue.php
r2341208 r3841745 12 12 13 13 function register_frontend_assets() { 14 $stdl_frontend_obj = array('ajax_url' => admin_url('admin-ajax.php'), 'ajax_nonce' => wp_create_nonce('stdl_frontend_ajax_nonce')); 14 $stdl_frontend_obj = array( 15 'ajax_url' => admin_url('admin-ajax.php'), 16 'ajax_nonce' => wp_create_nonce('stdl_frontend_ajax_nonce'), 17 'request_error' => __('Could not submit the form. Please try again.', 'subscribe-to-download-lite'), 18 ); 15 19 wp_enqueue_style('fontawesome', STDL_URL . 'fontawesome/css/all.min.css', array(), STDL_VERSION); 16 20 wp_enqueue_script('stdl-frontend-script', STDL_JS_DIR . '/stdl-frontend.js', array('jquery'), STDL_VERSION); -
subscribe-to-download-lite/tags/1.3.1/inc/classes/class-stdl-library.php
r3260547 r3841745 13 13 function permission_denied() { 14 14 die('No script kiddies please!!'); 15 } 16 17 function get_download_status_label($status) { 18 switch ((int) $status) { 19 case 1: 20 return __('Downloaded', 'subscribe-to-download-lite'); 21 case 2: 22 return __('Redirected', 'subscribe-to-download-lite'); 23 default: 24 return __('Untracked', 'subscribe-to-download-lite'); 25 } 15 26 } 16 27 … … 177 188 global $wpdb; 178 189 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 179 $subscriber_row = $wpdb->get_row($wpdb->prepare("select * from $subscriber_table where subscriber_email = %s ", $email));190 $subscriber_row = $wpdb->get_row($wpdb->prepare("select * from $subscriber_table where subscriber_email = %s and subscriber_form_alias = %s", $email, 'stdl')); 180 191 return $subscriber_row; 181 192 } … … 189 200 */ 190 201 function get_default_from_email() { 191 $site_url = site_url(); 192 $find_h = '#^http(s)?://#'; 193 $find_w = '/^www\./'; 194 $replace = ''; 195 $output = preg_replace($find_h, $replace, $site_url); 196 $output = preg_replace($find_w, $replace, $output); 197 return 'noreply@' . $output; 202 $host = wp_parse_url(home_url('/'), PHP_URL_HOST); 203 $address = 'noreply@' . preg_replace('/^www\./i', '', (string) $host); 204 return is_email($address) ? $address : get_option('admin_email'); 198 205 } 199 206 … … 206 213 */ 207 214 function generate_encryption_key() { 208 $current_date_time = date('Y-m-d H:i:s'); 209 $encryption_key = md5($current_date_time); 210 return $encryption_key; 215 return bin2hex(random_bytes(16)); 211 216 } 212 217 … … 222 227 function get_download_path($encryption_key) { 223 228 $form_details = get_option('stdl_settings'); 224 if (empty($form_details['general']['download_file_id'])) { 229 $general = $form_details['general']; 230 if (empty($general['download_file']) || empty($general['download_file_id'])) { 225 231 // If download file is not available in the settings 226 232 return false; 227 233 } 228 $attachment_path = get_attached_file(intval($form_details['general']['download_file_id'])); 229 return $attachment_path; 234 $file_id = absint($general['download_file_id']); 235 $attachment_url = wp_get_attachment_url($file_id); 236 if (!$attachment_url || set_url_scheme($attachment_url) !== set_url_scheme($general['download_file'])) { 237 return false; 238 } 239 return get_attached_file($file_id); 230 240 } 231 241 … … 249 259 global $wpdb; 250 260 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 251 $subscriber_count = $wpdb->get_var( "SELECT COUNT(*) FROM $subscriber_table WHERE subscriber_encryption_key like '$encryption_key'");261 $subscriber_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $subscriber_table WHERE subscriber_encryption_key = %s AND subscriber_form_alias = %s", $encryption_key, 'stdl')); 252 262 if ($subscriber_count == 0) { 253 263 return false; -
subscribe-to-download-lite/tags/1.3.1/inc/cores/subscription-process.php
r2341208 r3841745 3 3 defined('ABSPATH') or die('No script kiddies please!!'); 4 4 5 if ($this->ajax_nonce_verify()) { 6 /** 7 * Triggers just before processing the subscription form 8 * 9 * @since 1.0.0 10 */ 11 do_action('stdl_before_form_process'); 12 $form_data = $_POST['form_data']; 13 $form_data = stripslashes_deep($form_data); 14 parse_str($form_data, $form_data); 15 $form_data = $this->sanitize_array($form_data); 16 $form_alias = sanitize_text_field($_POST['form_alias']); 17 $form_details = get_option('stdl_settings'); 18 $subscriber_email = sanitize_email($form_data['stdl_email']); 19 $subscriber_name = (!empty($form_data['stdl_name'])) ? sanitize_text_field($form_data['stdl_name']) : ''; 20 if (empty($form_data['stdl_email']) || (!empty($form_details['form']['terms_agreement']['show']) && empty($form_data['stdl_terms_agreement'])) || (!empty($form_details['form']['name']['show']) && !empty($form_details['form']['name']['required']) && empty($form_data['stdl_name']))) { 21 $response['status'] = 403; 22 $response['message'] = esc_attr($form_details['general']['required_error_message']); 23 } else { 24 //It is okay to process the form now 25 $subscriber_row = $this->get_subscriber_row_by_email($form_data['stdl_email']); 26 $from_email = (!empty($form_details['email']['from_email'])) ? $form_details['email']['from_email'] : $this->get_default_from_email(); 27 $from_name = (!empty($form_details['email']['from_name'])) ? $form_details['email']['from_name'] : esc_html__('No Reply', 'subscribe-to-download-lite'); 28 $subject = (!empty($form_details['email']['subject'])) ? $form_details['email']['subject'] : esc_html__('Subscription Successful', 'subscribe-to-download-lite'); 29 $email_message = (!empty($form_details['email']['email_message'])) ? $form_details['email']['email_message'] : $this->get_default_email_message(); 5 if (!$this->ajax_nonce_verify()) { 6 $this->permission_denied(); 7 return; 8 } 30 9 31 $charset = get_option('blog_charset'); 32 $headers[] = 'Content-Type: text/html; charset=' . $charset; 33 $headers[] = "From: $from_name < $from_email >"; 10 do_action('stdl_before_form_process'); 34 11 35 if (empty($subscriber_row)) { 36 //if subscriber isn't already subscribed 37 $encryption_key = $this->generate_encryption_key(); 38 if (!empty($form_details['general']['encrypt_link'])) { 12 parse_str(isset($_POST['form_data']) && is_string($_POST['form_data']) ? wp_unslash($_POST['form_data']) : '', $form_data); 13 $form_data = $this->sanitize_array($form_data); 14 $form_details = get_option('stdl_settings'); 15 $general = $form_details['general']; 16 $terms = isset($form_details['form']['terms_agreement']) ? $form_details['form']['terms_agreement'] : array(); 17 $email = !empty($form_data['stdl_email']) && is_string($form_data['stdl_email']) ? $form_data['stdl_email'] : ''; 18 $name = !empty($form_data['stdl_name']) && is_string($form_data['stdl_name']) ? $form_data['stdl_name'] : ''; 19 $requires_terms = !empty($terms['show']) && !empty($terms['agreement_text']) && trim(wp_strip_all_tags($terms['agreement_text'])) !== ''; 20 $requires_name = !empty($form_details['form']['name']['show']) && !empty($form_details['form']['name']['required']); 39 21 40 $download_url = site_url() . '?stdl_encryption_key=' . $encryption_key; 41 } else { 42 $download_url = esc_url($form_details['general']['download_file']); 43 } 44 if (!empty($download_url)) { 45 $email_message = str_replace('#download_link', '<a href="' . $download_url . '">' . $download_url . '</a>', $email_message); 22 if (!is_email($email) || ($requires_terms && empty($form_data['stdl_terms_agreement'])) || ($requires_name && $name === '')) { 23 wp_send_json(array('status' => 403, 'message' => esc_html($general['required_error_message']))); 24 } 46 25 47 $email_check = wp_mail($form_data['stdl_email'], $subject, $email_message, $headers); 48 if ($email_check) { 49 setcookie("stdl_encryption_key", $encryption_key, time() + 3600 * 24 * 365, '/'); 50 global $wpdb; 51 $wpdb->insert(STDL_SUBSCRIBERS_TABLE, array('subscriber_name' => $subscriber_name, 52 'subscriber_email' => $subscriber_email, 53 'subscriber_form_alias' => $form_alias, 54 'subscriber_encryption_key' => $encryption_key), array('%s', '%s', '%s', '%s')); 55 $response['status'] = 200; 56 $response['message'] = esc_attr($form_details['general']['success_message']); 57 } else { 58 $response['status'] = 403; 59 $response['message'] = esc_attr($form_details['general']['error_message']); 60 } 61 } else { 62 $response['status'] = 200; 63 $response['type'] = esc_html__('Default subscription', 'subscribe-to-download-lite'); 64 $response['message'] = esc_attr($form_details['general']['success_message']); 65 } 66 } else { 67 //if subscriber is already subscribed 68 $encryption_key = $subscriber_row->subscriber_encryption_key; 69 if (!empty($form_details['general']['encrypt_link'])) { 26 $subscriber = $this->get_subscriber_row_by_email($email); 27 $key = $subscriber ? $subscriber->subscriber_encryption_key : $this->generate_encryption_key(); 28 $file_url = !empty($general['download_file']) ? esc_url_raw($general['download_file'], array('http', 'https')) : ''; 29 if (!$subscriber) { 30 global $wpdb; 31 $data = array( 32 'subscriber_name' => $name, 33 'subscriber_email' => $email, 34 'subscriber_form_alias' => 'stdl', 35 'subscriber_encryption_key' => $key, 36 ); 37 // Pro can have previously extended this shared table with additional fields. 38 $table = STDL_SUBSCRIBERS_TABLE; 39 $columns = $wpdb->get_col("SHOW COLUMNS FROM $table"); 40 foreach (array('subscriber_custom_fields', 'subscribed_user_ip') as $column) { 41 if (in_array($column, $columns, true)) { 42 $data[$column] = ''; 43 } 44 } 45 $saved = $wpdb->insert($table, $data, array_fill(0, count($data), '%s')); 46 if (!$saved) { 47 wp_send_json(array('status' => 403, 'message' => esc_html__('Could not save your subscription. Please try again.', 'subscribe-to-download-lite'))); 48 } 49 } 70 50 71 $download_url = site_url() . '?stdl_encryption_key=' . $encryption_key; 72 } else { 73 $download_url = esc_url($form_details['general']['download_file']); 74 } 75 if (!empty($download_url)) { 76 77 $email_message = str_replace('#download_link', '<a href="' . $download_url . '">' . $download_url . '</a>', $email_message); 78 /** 79 * Filters email message 80 * 81 * @param string $email_message 82 * @param array $form_data 83 * 84 * @since 1.0.0 85 */ 86 $email_message = apply_filters('stdl_email_message', $email_message, $form_data); 87 $email_check = wp_mail($form_data['stdl_email'], $subject, $email_message, $headers); 88 if ($email_check) { 89 setcookie("stdl_encryption_key", $encryption_key, time() + 3600 * 24 * 365, '/'); 90 global $wpdb; 91 $wpdb->update(STDL_SUBSCRIBERS_TABLE, array('subscriber_form_alias' => $form_alias), array('subscriber_email' => $form_data['stdl_email']), array('%s'), array('%s')); 92 $response['status'] = 200; 93 $response['message'] = esc_attr($form_details['general']['success_message']); 94 } else { 95 $response['status'] = 403; 96 $response['message'] = esc_attr($form_details['general']['error_message']); 97 } 98 } else { 99 $response['status'] = 200; 100 $response['type'] = esc_html__('Default subscription', 'subscribe-to-download-lite'); 101 $response['message'] = esc_attr($form_details['general']['success_message']); 102 } 103 } 104 /** 105 * Triggers at the end of processing the subscription form successfully 106 * 107 * @param array $form_data 108 * 109 * @since 1.0.0 110 */ 111 do_action('stdl_end_form_process', $form_data, $form_details); 51 if ($file_url) { 52 $download_url = !empty($general['encrypt_link']) ? add_query_arg('stdl_encryption_key', $key, home_url('/')) : $file_url; 53 $email_settings = $form_details['email']; 54 $from_email = !empty($email_settings['from_email']) ? $email_settings['from_email'] : $this->get_default_from_email(); 55 $from_name = !empty($email_settings['from_name']) ? $email_settings['from_name'] : esc_html__('No Reply', 'subscribe-to-download-lite'); 56 $subject = !empty($email_settings['subject']) ? $email_settings['subject'] : esc_html__('Subscription Successful', 'subscribe-to-download-lite'); 57 $message = !empty($email_settings['email_message']) ? $email_settings['email_message'] : $this->get_default_email_message(); 58 $link = '<a href="' . esc_url($download_url) . '">' . esc_html($download_url) . '</a>'; 59 $message = strpos($message, '#download_link') === false ? $message . '<br>' . $link : str_replace('#download_link', $link, $message); 60 if ($subscriber) { 61 $message = apply_filters('stdl_email_message', $message, $form_data); 62 } 63 $headers = array('Content-Type: text/html; charset=' . get_option('blog_charset'), "From: $from_name <$from_email>"); 64 if (!wp_mail($email, $subject, $message, $headers)) { 65 wp_send_json(array('status' => 403, 'message' => esc_html($general['error_message']))); 112 66 } 113 67 114 die(json_encode($response)); 68 setcookie('stdl_encryption_key', $key, time() + YEAR_IN_SECONDS, '/', '', is_ssl(), true); 69 $response = array('status' => 200, 'message' => esc_html($general['success_message'])); 115 70 } else { 116 $this->permission_denied(); 71 $response = array( 72 'status' => 200, 73 'type' => esc_html__('Default subscription', 'subscribe-to-download-lite'), 74 'message' => esc_html__('Subscription successful.', 'subscribe-to-download-lite'), 75 ); 117 76 } 77 78 /** Fires after a successful Lite signup and any required download email handoff. */ 79 do_action('stdl_end_form_process', $form_data, $form_details); 80 wp_send_json($response); -
subscribe-to-download-lite/tags/1.3.1/inc/views/backend/form-sections/stdl-upgrade-to-pro.php
r3216457 r3841745 10 10 <p>You can create <strong>unlimited subscription forms</strong>, choose a stunning layout from our 11 11 <strong>20 beautifully pre designed templates</strong>, connect the forms directly to popular third 12 party subscription services such as <strong>Mailchimp, Constant Contact, Mailer lite, ConvertKitand12 party subscription services such as <strong>Mailchimp, Constant Contact, MailerLite Classic and 13 13 Brevo/Sendinblue</strong>, <strong>export subscribers</strong> and what not. With this plugin you 14 14 are just few seconds away from collecting the subscribers from your WordPress site because creating and … … 45 45 <div class="stdl-feat-block"> 46 46 <div class="stdl-feat-img"> 47 <a href="https://demo.wpshuffle.com/subscribe-to- unlock/all-templates-demo/" class=""> <img47 <a href="https://demo.wpshuffle.com/subscribe-to-download/all-templates-demo/" class=""> <img 48 48 loading="lazy" src="https://wpshuffle.com/wp-content/uploads/2025/01/std-feat-3.png"></a> 49 49 </div> -
subscribe-to-download-lite/tags/1.3.1/inc/views/backend/stdl-pro-vs-free.php
r3216457 r3841745 168 168 <div class="stdl-compare-row stdl--flex stdl--flex-w"> 169 169 <div class="stdl-feat-col"> 170 <p>Mailer liteIntegration</p>170 <p>MailerLite Classic Integration</p> 171 171 </div> 172 172 <div class="stdl-feat-col"> … … 180 180 <div class="stdl-feat-col"> 181 181 <p>Brevo/Sendinblue Integration</p> 182 </div>183 <div class="stdl-feat-col">184 <p class="no"><i class="fa fa-times" aria-hidden="true"></i></p>185 </div>186 <div class="stdl-feat-col">187 <p class="yes"><i class="fa fa-check" aria-hidden="true"></i></p>188 </div>189 </div>190 <div class="stdl-compare-row stdl--flex stdl--flex-w">191 <div class="stdl-feat-col">192 <p>ConvertKit Integration</p>193 182 </div> 194 183 <div class="stdl-feat-col"> … … 253 242 <div class="stdl-feat-col"> 254 243 <div class="stdl-add-wrap stdl-btn-cntr"> 255 <a href=" https://1.envato.market/PNaY6" class="stdl-button-orange stdl-btn-margin stdl-hov" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-unlock-lite'); ?></a>244 <a href="<?php echo esc_url(STDL_UPGRADE_LINK); ?>" class="stdl-button-orange stdl-btn-margin stdl-hov" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-download-lite'); ?></a> 256 245 </div> 257 246 -
subscribe-to-download-lite/tags/1.3.1/inc/views/backend/stdl-upgrade.php
r3216457 r3841745 27 27 <p>You can create <strong>unlimited subscription forms</strong>, choose a stunning layout from our 28 28 <strong>20 beautifully pre designed templates</strong>, connect the forms directly to popular third 29 party subscription services such as <strong>Mailchimp, Constant Contact, Mailer lite, ConvertKitand29 party subscription services such as <strong>Mailchimp, Constant Contact, MailerLite Classic and 30 30 Brevo/Sendinblue</strong>, <strong>export subscribers</strong> and what not. With this plugin you 31 31 are just few seconds away from collecting the subscribers from your WordPress site because creating and … … 62 62 <div class="stdl-feat-block"> 63 63 <div class="stdl-feat-img"> 64 <a href="https://demo.wpshuffle.com/subscribe-to- unlock/all-templates-demo/" class=""> <img64 <a href="https://demo.wpshuffle.com/subscribe-to-download/all-templates-demo/" class=""> <img 65 65 loading="lazy" src="https://wpshuffle.com/wp-content/uploads/2025/01/std-feat-3.png"></a> 66 66 </div> -
subscribe-to-download-lite/tags/1.3.1/inc/views/backend/subscribers/list-subscribers.php
r3216457 r3841745 39 39 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 40 40 41 $subscriber_query = "select * from $subscriber_table";41 $subscriber_query = $wpdb->prepare("SELECT * FROM $subscriber_table WHERE subscriber_form_alias = %s", 'stdl'); 42 42 43 43 $subscriber_rows = $wpdb->get_results($subscriber_query); … … 48 48 <td><?php echo esc_attr($subscriber_row->subscriber_name); ?></td> 49 49 <td><?php echo esc_attr($subscriber_row->subscriber_email); ?></td> 50 <td><?php echo (!empty($subscriber_row->subscriber_download_status)) ? esc_html__('Yes', 'subscribe-to-download-lite') : esc_html__('No', 'subscribe-to-download-lite'); ?></td>50 <td><?php echo esc_html($this->get_download_status_label($subscriber_row->subscriber_download_status)); ?></td> 51 51 <td> 52 52 <a class="stdl-delete stdl-subscriber-delete" href="javascript:void(0)" data-subscriber-id="<?php echo intval($subscriber_row->subscriber_id); ?>" title="<?php esc_html_e('Delete Subscriber', 'subscribe-to-download-lite'); ?>"><?php esc_html_e('Delete', 'subscribe-to-download-lite'); ?></a> -
subscribe-to-download-lite/tags/1.3.1/inc/views/backend/upgrade.php
r2920291 r3841745 1 1 <div class="stdl-go-pro"> 2 <a href=" https://1.envato.market/Q3KGo" target="_blank"><img src="<?php echo STDL_URL . 'images/UpgradeBanner.png' ?>" /></a>3 <a href=" https://1.envato.market/Q3KGo" class="stdl-button-orange" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-download-lite'); ?></a>2 <a href="<?php echo esc_url(STDL_UPGRADE_LINK); ?>" target="_blank"><img src="<?php echo STDL_URL . 'images/UpgradeBanner.png' ?>" /></a> 3 <a href="<?php echo esc_url(STDL_UPGRADE_LINK); ?>" class="stdl-button-orange" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-download-lite'); ?></a> 4 4 </div> -
subscribe-to-download-lite/tags/1.3.1/inc/views/frontend/download-button.php
r2341208 r3841745 1 <a href="<?php echo site_url() . '/?stdl_encryption_key=' . sanitize_text_field( $_COOKIE['stdl_encryption_key'] ); ?>" class="stdl-download-button stdl-button-<?php echo esc_attr( $form_template ); ?>"><i class="fa fa-download" aria-hidden="true"></i> 1 <?php 2 $download_url = $form_details['general']['download_file']; 3 if (!empty($form_details['general']['encrypt_link'])) { 4 $download_url = add_query_arg('stdl_encryption_key', sanitize_text_field($_COOKIE['stdl_encryption_key']), home_url('/')); 5 } 6 ?> 7 <a href="<?php echo esc_url($download_url); ?>" class="stdl-download-button stdl-button-<?php echo esc_attr( $form_template ); ?>"><i class="fa fa-download" aria-hidden="true"></i> 2 8 <?php echo esc_attr( $form_details['general']['download_button_text'] ); ?></a> 3 9 -
subscribe-to-download-lite/tags/1.3.1/inc/views/frontend/stdl-shortcode.php
r2341208 r3841745 2 2 $form_details = get_option('stdl_settings'); 3 3 $form_template = (!empty($atts['template'])) ? $atts['template'] : $form_details['layout']['template']; 4 if ( isset($_COOKIE['stdl_encryption_key']) && $this->check_if_already_subscribed($_COOKIE['stdl_encryption_key']) && empty($form_details['general']['always_show'])) {4 if (!empty($form_details['general']['download_file']) && isset($_COOKIE['stdl_encryption_key']) && is_string($_COOKIE['stdl_encryption_key']) && $this->check_if_already_subscribed($_COOKIE['stdl_encryption_key']) && empty($form_details['general']['always_show'])) { 5 5 /** 6 6 * Triggers just before displaying the download button -
subscribe-to-download-lite/tags/1.3.1/js/stdl-frontend.js
r2341208 r3841745 13 13 $.ajax({ 14 14 type: 'post', 15 dataType: 'json', 15 16 url: stdl_frontend_obj.ajax_url, 16 17 data: { … … 21 22 }, 22 23 beforeSend: function (xhr) { 24 selector.find(':submit').prop('disabled', true); 23 25 selector.find('.stdl-form-message').slideUp(500); 24 26 selector.find('.stdl-form-loader-wraper').show(); 25 27 }, 26 28 success: function (res) { 27 selector.find('.stdl-form-loader-wraper').hide();28 res = $.parseJSON(res);29 29 if (res.status == 200) { 30 30 selector[0].reset(); … … 33 33 selector.find('.stdl-form-message').removeClass('stdl-success').addClass('stdl-error').html(res.message).slideDown(500); 34 34 } 35 }, 36 error: function () { 37 selector.find('.stdl-form-message').removeClass('stdl-success').addClass('stdl-error').text(stdl_frontend_obj.request_error).slideDown(500); 38 }, 39 complete: function () { 40 selector.find('.stdl-form-loader-wraper').hide(); 41 selector.find(':submit').prop('disabled', false); 35 42 } 36 43 }); -
subscribe-to-download-lite/tags/1.3.1/readme.txt
r3716347 r3841745 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.0.0 8 Stable tag: 1.3. 08 Stable tag: 1.3.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 57 57 * Show popup form with delay on individual page 58 58 * Custom Form Styler Available 59 * Mailchimp, Constant Contact, MailerLite and other marketing integrations59 * Mailchimp, Constant Contact, MailerLite Classic and other marketing integrations 60 60 * Track Download Status 61 61 * And many more ... 62 62 63 Check all premium features [here](https:// 1.envato.market/Q3KGo)63 Check all premium features [here](https://codecanyon.net/item/subscribe-to-download-an-advanced-subscription-plugin-for-wordpress/24020447) 64 64 65 65 = Upgrade to PRO = 66 66 67 * To upgrade to pro, please go [here](https:// 1.envato.market/Q3KGo)67 * To upgrade to pro, please go [here](https://codecanyon.net/item/subscribe-to-download-an-advanced-subscription-plugin-for-wordpress/24020447) 68 68 * To check demo, please go [here](http://demo.wpshuffle.com/subscribe-to-download) 69 69 … … 116 116 117 117 == Changelog == 118 = 1.3.1 = 119 * Fixed signup-only forms so subscribers are saved when no download file is configured. 120 * Improved signup and email error handling so visitors can retry without creating another subscriber record. 121 * Fixed download links for returning subscribers and for files changed to an external URL. 122 * Added a settings check for blank agreement text and scoped the subscriber list and CSV to the Lite form. 123 * Clarified which downloads were tracked or redirected, and corrected the Pro purchase and template demo links. 124 118 125 = 1.3.0 = 119 126 * Fixed security issues -
subscribe-to-download-lite/tags/1.3.1/subscribe-to-download-lite.php
r3260547 r3841745 6 6 Plugin URI: https://wpshuffle.com/subscribe-to-download-lite 7 7 Description: A plugin to collect email using an email subscribing form by providing the free downloadable items 8 Version: 1.3. 08 Version: 1.3.1 9 9 Author: WP Shuffle 10 10 Author URI: http://wpshuffle.com … … 33 33 34 34 global $wpdb; 35 defined('STDL_VERSION') or define('STDL_VERSION', '1.3. 0'); // Plugin's active version35 defined('STDL_VERSION') or define('STDL_VERSION', '1.3.1'); // Plugin's active version 36 36 defined('STDL_PATH') or define('STDL_PATH', plugin_dir_path(__FILE__)); // plugin's absolute path 37 37 defined('STDL_URL') or define('STDL_URL', plugin_dir_url(__FILE__)); // plugin's absolute URL … … 42 42 defined('STDL_SUBSCRIBERS_TABLE') or define('STDL_SUBSCRIBERS_TABLE', $wpdb->prefix . 'std_subscribers'); //plugin's subscriber table 43 43 defined('STDL_TOTAL_TEMPLATES') or define('STDL_TOTAL_TEMPLATES', 5); //Total number of templates available 44 defined('STDL_UPGRADE_LINK') or define('STDL_UPGRADE_LINK', 'https:// 1.envato.market/Q3KGo');44 defined('STDL_UPGRADE_LINK') or define('STDL_UPGRADE_LINK', 'https://codecanyon.net/item/subscribe-to-download-an-advanced-subscription-plugin-for-wordpress/24020447'); 45 45 } 46 46 -
subscribe-to-download-lite/trunk/inc/classes/class-stdl-admin.php
r3216457 r3841745 32 32 33 33 function export_to_csv() { 34 if ( !empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'stdl_export_csv_nonce')) {34 if (current_user_can('manage_options') && !empty($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'stdl_export_csv_nonce')) { 35 35 $filename = "subscribers-list.csv"; 36 36 header('Content-type: application/csv'); … … 71 71 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 72 72 73 $subscriber_query = "select * from $subscriber_table";73 $subscriber_query = $wpdb->prepare("SELECT * FROM $subscriber_table WHERE subscriber_form_alias = %s", 'stdl'); 74 74 75 75 $subscriber_rows = $wpdb->get_results($subscriber_query); … … 78 78 if (!empty($subscriber_rows)) { 79 79 foreach ($subscriber_rows as $subscriber_row) { 80 $download_status = (!empty($subscriber_row->subscriber_download_status)) ? esc_html__('Yes', 'subscribe-to-download-lite') : esc_html__('No', 'subscribe-to-download-lite');80 $download_status = esc_html($this->get_download_status_label($subscriber_row->subscriber_download_status)); 81 81 $csv_row = array($subscriber_row->subscriber_name, $subscriber_row->subscriber_email, $download_status); 82 82 $csv_rows[] = $csv_row; -
subscribe-to-download-lite/trunk/inc/classes/class-stdl-ajax-admin.php
r2341208 r3841745 34 34 $form_data = $this->sanitize_array($form_data, $sanitize_rule); 35 35 $stdl_settings = $form_data['form_details']; 36 $terms = isset($stdl_settings['form']['terms_agreement']) ? $stdl_settings['form']['terms_agreement'] : array(); 37 if (!empty($terms['show']) && (empty($terms['agreement_text']) || trim(wp_strip_all_tags($terms['agreement_text'])) === '')) { 38 die(wp_json_encode(array('status' => 403, 'message' => esc_html__('Enter agreement text or disable the agreement field.', 'subscribe-to-download-lite')))); 39 } 40 $general = &$stdl_settings['general']; 41 $file_url = !empty($general['download_file']) ? esc_url_raw($general['download_file'], array('http', 'https')) : ''; 42 $file_id = !empty($general['download_file_id']) ? absint($general['download_file_id']) : 0; 43 $attachment_url = $file_id ? wp_get_attachment_url($file_id) : false; 44 if (!$file_url || !$attachment_url || set_url_scheme($file_url) !== set_url_scheme($attachment_url)) { 45 $general['download_file_id'] = ''; 46 } 47 $general['download_file'] = $file_url; 36 48 update_option('stdl_settings', $stdl_settings); 37 49 $response['status'] = 200; … … 48 60 $subscriber_id = intval($_POST['subscriber_id']); 49 61 global $wpdb; 50 $delete_check = $wpdb->delete(STDL_SUBSCRIBERS_TABLE, array('subscriber_id' => $subscriber_id ), array('%d'));62 $delete_check = $wpdb->delete(STDL_SUBSCRIBERS_TABLE, array('subscriber_id' => $subscriber_id, 'subscriber_form_alias' => 'stdl'), array('%d', '%s')); 51 63 if ($delete_check) { 52 64 $response['status'] = 200; -
subscribe-to-download-lite/trunk/inc/classes/class-stdl-downloader.php
r2341208 r3841745 11 11 12 12 function initialize_downloader() { 13 if (!empty($_ REQUEST['stdl_encryption_key'])) {14 $encryption_key = sanitize_text_field($_REQUEST['stdl_encryption_key']);15 if (isset($_COOKIE['stdl_encryption_key']) && $encryption_key == $_COOKIE['stdl_encryption_key']) {16 $encryption_key = sanitize_text_field($_COOKIE['stdl_encryption_key']);13 if (!empty($_GET['stdl_encryption_key']) && is_string($_GET['stdl_encryption_key'])) { 14 nocache_headers(); 15 $encryption_key = sanitize_text_field(wp_unslash($_GET['stdl_encryption_key'])); 16 if (isset($_COOKIE['stdl_encryption_key']) && is_string($_COOKIE['stdl_encryption_key']) && hash_equals($encryption_key, $_COOKIE['stdl_encryption_key']) && $this->check_if_already_subscribed($encryption_key)) { 17 17 $download_path = $this->get_download_path($encryption_key); 18 18 … … 26 26 */ 27 27 $download_path = apply_filters('stdl_download_path', $download_path, $encryption_key); 28 if (file_exists($download_path)) { 28 if (!$download_path) { 29 $form_details = get_option('stdl_settings'); 30 $url = !empty($form_details['general']['download_file']) ? esc_url_raw($form_details['general']['download_file'], array('http', 'https')) : ''; 31 if ($url && wp_redirect($url)) { 32 $this->update_download_status($encryption_key, 2); 33 exit; 34 } 35 } elseif (is_file($download_path) && is_readable($download_path)) { 29 36 header('Content-Description: File Transfer'); 30 37 header('Content-Type: application/octet-stream'); 31 header('Content-Disposition: attachment; filename="' . basename($download_path) . '"'); 32 header('Expires: 0'); 33 header('Cache-Control: must-revalidate'); 34 header('Pragma: public'); 38 header('Content-Disposition: attachment; filename="' . sanitize_file_name(basename($download_path)) . '"'); 35 39 header('Content-Length: ' . filesize($download_path)); 36 readfile($download_path); 37 $this->update_download_status($encryption_key); 40 if (readfile($download_path) !== false) { 41 $this->update_download_status($encryption_key); 42 } 38 43 exit; 39 44 } … … 42 47 } 43 48 44 function update_download_status($encryption_key ) {49 function update_download_status($encryption_key, $status = 1) { 45 50 global $wpdb; 46 $wpdb->update(STDL_SUBSCRIBERS_TABLE, array('subscriber_download_status' => 1), array('subscriber_encryption_key' => $encryption_key), array('%d'), array('%s')); 51 if ($status === 2) { 52 $table = STDL_SUBSCRIBERS_TABLE; 53 $wpdb->query($wpdb->prepare("UPDATE $table SET subscriber_download_status = 2 WHERE subscriber_encryption_key = %s AND subscriber_form_alias = %s AND subscriber_download_status = 0", $encryption_key, 'stdl')); 54 return; 55 } 56 $wpdb->update(STDL_SUBSCRIBERS_TABLE, array('subscriber_download_status' => $status), array('subscriber_encryption_key' => $encryption_key, 'subscriber_form_alias' => 'stdl'), array('%d'), array('%s', '%s')); 47 57 } 48 58 -
subscribe-to-download-lite/trunk/inc/classes/class-stdl-enqueue.php
r2341208 r3841745 12 12 13 13 function register_frontend_assets() { 14 $stdl_frontend_obj = array('ajax_url' => admin_url('admin-ajax.php'), 'ajax_nonce' => wp_create_nonce('stdl_frontend_ajax_nonce')); 14 $stdl_frontend_obj = array( 15 'ajax_url' => admin_url('admin-ajax.php'), 16 'ajax_nonce' => wp_create_nonce('stdl_frontend_ajax_nonce'), 17 'request_error' => __('Could not submit the form. Please try again.', 'subscribe-to-download-lite'), 18 ); 15 19 wp_enqueue_style('fontawesome', STDL_URL . 'fontawesome/css/all.min.css', array(), STDL_VERSION); 16 20 wp_enqueue_script('stdl-frontend-script', STDL_JS_DIR . '/stdl-frontend.js', array('jquery'), STDL_VERSION); -
subscribe-to-download-lite/trunk/inc/classes/class-stdl-library.php
r3260547 r3841745 13 13 function permission_denied() { 14 14 die('No script kiddies please!!'); 15 } 16 17 function get_download_status_label($status) { 18 switch ((int) $status) { 19 case 1: 20 return __('Downloaded', 'subscribe-to-download-lite'); 21 case 2: 22 return __('Redirected', 'subscribe-to-download-lite'); 23 default: 24 return __('Untracked', 'subscribe-to-download-lite'); 25 } 15 26 } 16 27 … … 177 188 global $wpdb; 178 189 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 179 $subscriber_row = $wpdb->get_row($wpdb->prepare("select * from $subscriber_table where subscriber_email = %s ", $email));190 $subscriber_row = $wpdb->get_row($wpdb->prepare("select * from $subscriber_table where subscriber_email = %s and subscriber_form_alias = %s", $email, 'stdl')); 180 191 return $subscriber_row; 181 192 } … … 189 200 */ 190 201 function get_default_from_email() { 191 $site_url = site_url(); 192 $find_h = '#^http(s)?://#'; 193 $find_w = '/^www\./'; 194 $replace = ''; 195 $output = preg_replace($find_h, $replace, $site_url); 196 $output = preg_replace($find_w, $replace, $output); 197 return 'noreply@' . $output; 202 $host = wp_parse_url(home_url('/'), PHP_URL_HOST); 203 $address = 'noreply@' . preg_replace('/^www\./i', '', (string) $host); 204 return is_email($address) ? $address : get_option('admin_email'); 198 205 } 199 206 … … 206 213 */ 207 214 function generate_encryption_key() { 208 $current_date_time = date('Y-m-d H:i:s'); 209 $encryption_key = md5($current_date_time); 210 return $encryption_key; 215 return bin2hex(random_bytes(16)); 211 216 } 212 217 … … 222 227 function get_download_path($encryption_key) { 223 228 $form_details = get_option('stdl_settings'); 224 if (empty($form_details['general']['download_file_id'])) { 229 $general = $form_details['general']; 230 if (empty($general['download_file']) || empty($general['download_file_id'])) { 225 231 // If download file is not available in the settings 226 232 return false; 227 233 } 228 $attachment_path = get_attached_file(intval($form_details['general']['download_file_id'])); 229 return $attachment_path; 234 $file_id = absint($general['download_file_id']); 235 $attachment_url = wp_get_attachment_url($file_id); 236 if (!$attachment_url || set_url_scheme($attachment_url) !== set_url_scheme($general['download_file'])) { 237 return false; 238 } 239 return get_attached_file($file_id); 230 240 } 231 241 … … 249 259 global $wpdb; 250 260 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 251 $subscriber_count = $wpdb->get_var( "SELECT COUNT(*) FROM $subscriber_table WHERE subscriber_encryption_key like '$encryption_key'");261 $subscriber_count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $subscriber_table WHERE subscriber_encryption_key = %s AND subscriber_form_alias = %s", $encryption_key, 'stdl')); 252 262 if ($subscriber_count == 0) { 253 263 return false; -
subscribe-to-download-lite/trunk/inc/cores/subscription-process.php
r2341208 r3841745 3 3 defined('ABSPATH') or die('No script kiddies please!!'); 4 4 5 if ($this->ajax_nonce_verify()) { 6 /** 7 * Triggers just before processing the subscription form 8 * 9 * @since 1.0.0 10 */ 11 do_action('stdl_before_form_process'); 12 $form_data = $_POST['form_data']; 13 $form_data = stripslashes_deep($form_data); 14 parse_str($form_data, $form_data); 15 $form_data = $this->sanitize_array($form_data); 16 $form_alias = sanitize_text_field($_POST['form_alias']); 17 $form_details = get_option('stdl_settings'); 18 $subscriber_email = sanitize_email($form_data['stdl_email']); 19 $subscriber_name = (!empty($form_data['stdl_name'])) ? sanitize_text_field($form_data['stdl_name']) : ''; 20 if (empty($form_data['stdl_email']) || (!empty($form_details['form']['terms_agreement']['show']) && empty($form_data['stdl_terms_agreement'])) || (!empty($form_details['form']['name']['show']) && !empty($form_details['form']['name']['required']) && empty($form_data['stdl_name']))) { 21 $response['status'] = 403; 22 $response['message'] = esc_attr($form_details['general']['required_error_message']); 23 } else { 24 //It is okay to process the form now 25 $subscriber_row = $this->get_subscriber_row_by_email($form_data['stdl_email']); 26 $from_email = (!empty($form_details['email']['from_email'])) ? $form_details['email']['from_email'] : $this->get_default_from_email(); 27 $from_name = (!empty($form_details['email']['from_name'])) ? $form_details['email']['from_name'] : esc_html__('No Reply', 'subscribe-to-download-lite'); 28 $subject = (!empty($form_details['email']['subject'])) ? $form_details['email']['subject'] : esc_html__('Subscription Successful', 'subscribe-to-download-lite'); 29 $email_message = (!empty($form_details['email']['email_message'])) ? $form_details['email']['email_message'] : $this->get_default_email_message(); 5 if (!$this->ajax_nonce_verify()) { 6 $this->permission_denied(); 7 return; 8 } 30 9 31 $charset = get_option('blog_charset'); 32 $headers[] = 'Content-Type: text/html; charset=' . $charset; 33 $headers[] = "From: $from_name < $from_email >"; 10 do_action('stdl_before_form_process'); 34 11 35 if (empty($subscriber_row)) { 36 //if subscriber isn't already subscribed 37 $encryption_key = $this->generate_encryption_key(); 38 if (!empty($form_details['general']['encrypt_link'])) { 12 parse_str(isset($_POST['form_data']) && is_string($_POST['form_data']) ? wp_unslash($_POST['form_data']) : '', $form_data); 13 $form_data = $this->sanitize_array($form_data); 14 $form_details = get_option('stdl_settings'); 15 $general = $form_details['general']; 16 $terms = isset($form_details['form']['terms_agreement']) ? $form_details['form']['terms_agreement'] : array(); 17 $email = !empty($form_data['stdl_email']) && is_string($form_data['stdl_email']) ? $form_data['stdl_email'] : ''; 18 $name = !empty($form_data['stdl_name']) && is_string($form_data['stdl_name']) ? $form_data['stdl_name'] : ''; 19 $requires_terms = !empty($terms['show']) && !empty($terms['agreement_text']) && trim(wp_strip_all_tags($terms['agreement_text'])) !== ''; 20 $requires_name = !empty($form_details['form']['name']['show']) && !empty($form_details['form']['name']['required']); 39 21 40 $download_url = site_url() . '?stdl_encryption_key=' . $encryption_key; 41 } else { 42 $download_url = esc_url($form_details['general']['download_file']); 43 } 44 if (!empty($download_url)) { 45 $email_message = str_replace('#download_link', '<a href="' . $download_url . '">' . $download_url . '</a>', $email_message); 22 if (!is_email($email) || ($requires_terms && empty($form_data['stdl_terms_agreement'])) || ($requires_name && $name === '')) { 23 wp_send_json(array('status' => 403, 'message' => esc_html($general['required_error_message']))); 24 } 46 25 47 $email_check = wp_mail($form_data['stdl_email'], $subject, $email_message, $headers); 48 if ($email_check) { 49 setcookie("stdl_encryption_key", $encryption_key, time() + 3600 * 24 * 365, '/'); 50 global $wpdb; 51 $wpdb->insert(STDL_SUBSCRIBERS_TABLE, array('subscriber_name' => $subscriber_name, 52 'subscriber_email' => $subscriber_email, 53 'subscriber_form_alias' => $form_alias, 54 'subscriber_encryption_key' => $encryption_key), array('%s', '%s', '%s', '%s')); 55 $response['status'] = 200; 56 $response['message'] = esc_attr($form_details['general']['success_message']); 57 } else { 58 $response['status'] = 403; 59 $response['message'] = esc_attr($form_details['general']['error_message']); 60 } 61 } else { 62 $response['status'] = 200; 63 $response['type'] = esc_html__('Default subscription', 'subscribe-to-download-lite'); 64 $response['message'] = esc_attr($form_details['general']['success_message']); 65 } 66 } else { 67 //if subscriber is already subscribed 68 $encryption_key = $subscriber_row->subscriber_encryption_key; 69 if (!empty($form_details['general']['encrypt_link'])) { 26 $subscriber = $this->get_subscriber_row_by_email($email); 27 $key = $subscriber ? $subscriber->subscriber_encryption_key : $this->generate_encryption_key(); 28 $file_url = !empty($general['download_file']) ? esc_url_raw($general['download_file'], array('http', 'https')) : ''; 29 if (!$subscriber) { 30 global $wpdb; 31 $data = array( 32 'subscriber_name' => $name, 33 'subscriber_email' => $email, 34 'subscriber_form_alias' => 'stdl', 35 'subscriber_encryption_key' => $key, 36 ); 37 // Pro can have previously extended this shared table with additional fields. 38 $table = STDL_SUBSCRIBERS_TABLE; 39 $columns = $wpdb->get_col("SHOW COLUMNS FROM $table"); 40 foreach (array('subscriber_custom_fields', 'subscribed_user_ip') as $column) { 41 if (in_array($column, $columns, true)) { 42 $data[$column] = ''; 43 } 44 } 45 $saved = $wpdb->insert($table, $data, array_fill(0, count($data), '%s')); 46 if (!$saved) { 47 wp_send_json(array('status' => 403, 'message' => esc_html__('Could not save your subscription. Please try again.', 'subscribe-to-download-lite'))); 48 } 49 } 70 50 71 $download_url = site_url() . '?stdl_encryption_key=' . $encryption_key; 72 } else { 73 $download_url = esc_url($form_details['general']['download_file']); 74 } 75 if (!empty($download_url)) { 76 77 $email_message = str_replace('#download_link', '<a href="' . $download_url . '">' . $download_url . '</a>', $email_message); 78 /** 79 * Filters email message 80 * 81 * @param string $email_message 82 * @param array $form_data 83 * 84 * @since 1.0.0 85 */ 86 $email_message = apply_filters('stdl_email_message', $email_message, $form_data); 87 $email_check = wp_mail($form_data['stdl_email'], $subject, $email_message, $headers); 88 if ($email_check) { 89 setcookie("stdl_encryption_key", $encryption_key, time() + 3600 * 24 * 365, '/'); 90 global $wpdb; 91 $wpdb->update(STDL_SUBSCRIBERS_TABLE, array('subscriber_form_alias' => $form_alias), array('subscriber_email' => $form_data['stdl_email']), array('%s'), array('%s')); 92 $response['status'] = 200; 93 $response['message'] = esc_attr($form_details['general']['success_message']); 94 } else { 95 $response['status'] = 403; 96 $response['message'] = esc_attr($form_details['general']['error_message']); 97 } 98 } else { 99 $response['status'] = 200; 100 $response['type'] = esc_html__('Default subscription', 'subscribe-to-download-lite'); 101 $response['message'] = esc_attr($form_details['general']['success_message']); 102 } 103 } 104 /** 105 * Triggers at the end of processing the subscription form successfully 106 * 107 * @param array $form_data 108 * 109 * @since 1.0.0 110 */ 111 do_action('stdl_end_form_process', $form_data, $form_details); 51 if ($file_url) { 52 $download_url = !empty($general['encrypt_link']) ? add_query_arg('stdl_encryption_key', $key, home_url('/')) : $file_url; 53 $email_settings = $form_details['email']; 54 $from_email = !empty($email_settings['from_email']) ? $email_settings['from_email'] : $this->get_default_from_email(); 55 $from_name = !empty($email_settings['from_name']) ? $email_settings['from_name'] : esc_html__('No Reply', 'subscribe-to-download-lite'); 56 $subject = !empty($email_settings['subject']) ? $email_settings['subject'] : esc_html__('Subscription Successful', 'subscribe-to-download-lite'); 57 $message = !empty($email_settings['email_message']) ? $email_settings['email_message'] : $this->get_default_email_message(); 58 $link = '<a href="' . esc_url($download_url) . '">' . esc_html($download_url) . '</a>'; 59 $message = strpos($message, '#download_link') === false ? $message . '<br>' . $link : str_replace('#download_link', $link, $message); 60 if ($subscriber) { 61 $message = apply_filters('stdl_email_message', $message, $form_data); 62 } 63 $headers = array('Content-Type: text/html; charset=' . get_option('blog_charset'), "From: $from_name <$from_email>"); 64 if (!wp_mail($email, $subject, $message, $headers)) { 65 wp_send_json(array('status' => 403, 'message' => esc_html($general['error_message']))); 112 66 } 113 67 114 die(json_encode($response)); 68 setcookie('stdl_encryption_key', $key, time() + YEAR_IN_SECONDS, '/', '', is_ssl(), true); 69 $response = array('status' => 200, 'message' => esc_html($general['success_message'])); 115 70 } else { 116 $this->permission_denied(); 71 $response = array( 72 'status' => 200, 73 'type' => esc_html__('Default subscription', 'subscribe-to-download-lite'), 74 'message' => esc_html__('Subscription successful.', 'subscribe-to-download-lite'), 75 ); 117 76 } 77 78 /** Fires after a successful Lite signup and any required download email handoff. */ 79 do_action('stdl_end_form_process', $form_data, $form_details); 80 wp_send_json($response); -
subscribe-to-download-lite/trunk/inc/views/backend/form-sections/stdl-upgrade-to-pro.php
r3216457 r3841745 10 10 <p>You can create <strong>unlimited subscription forms</strong>, choose a stunning layout from our 11 11 <strong>20 beautifully pre designed templates</strong>, connect the forms directly to popular third 12 party subscription services such as <strong>Mailchimp, Constant Contact, Mailer lite, ConvertKitand12 party subscription services such as <strong>Mailchimp, Constant Contact, MailerLite Classic and 13 13 Brevo/Sendinblue</strong>, <strong>export subscribers</strong> and what not. With this plugin you 14 14 are just few seconds away from collecting the subscribers from your WordPress site because creating and … … 45 45 <div class="stdl-feat-block"> 46 46 <div class="stdl-feat-img"> 47 <a href="https://demo.wpshuffle.com/subscribe-to- unlock/all-templates-demo/" class=""> <img47 <a href="https://demo.wpshuffle.com/subscribe-to-download/all-templates-demo/" class=""> <img 48 48 loading="lazy" src="https://wpshuffle.com/wp-content/uploads/2025/01/std-feat-3.png"></a> 49 49 </div> -
subscribe-to-download-lite/trunk/inc/views/backend/stdl-pro-vs-free.php
r3216457 r3841745 168 168 <div class="stdl-compare-row stdl--flex stdl--flex-w"> 169 169 <div class="stdl-feat-col"> 170 <p>Mailer liteIntegration</p>170 <p>MailerLite Classic Integration</p> 171 171 </div> 172 172 <div class="stdl-feat-col"> … … 180 180 <div class="stdl-feat-col"> 181 181 <p>Brevo/Sendinblue Integration</p> 182 </div>183 <div class="stdl-feat-col">184 <p class="no"><i class="fa fa-times" aria-hidden="true"></i></p>185 </div>186 <div class="stdl-feat-col">187 <p class="yes"><i class="fa fa-check" aria-hidden="true"></i></p>188 </div>189 </div>190 <div class="stdl-compare-row stdl--flex stdl--flex-w">191 <div class="stdl-feat-col">192 <p>ConvertKit Integration</p>193 182 </div> 194 183 <div class="stdl-feat-col"> … … 253 242 <div class="stdl-feat-col"> 254 243 <div class="stdl-add-wrap stdl-btn-cntr"> 255 <a href=" https://1.envato.market/PNaY6" class="stdl-button-orange stdl-btn-margin stdl-hov" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-unlock-lite'); ?></a>244 <a href="<?php echo esc_url(STDL_UPGRADE_LINK); ?>" class="stdl-button-orange stdl-btn-margin stdl-hov" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-download-lite'); ?></a> 256 245 </div> 257 246 -
subscribe-to-download-lite/trunk/inc/views/backend/stdl-upgrade.php
r3216457 r3841745 27 27 <p>You can create <strong>unlimited subscription forms</strong>, choose a stunning layout from our 28 28 <strong>20 beautifully pre designed templates</strong>, connect the forms directly to popular third 29 party subscription services such as <strong>Mailchimp, Constant Contact, Mailer lite, ConvertKitand29 party subscription services such as <strong>Mailchimp, Constant Contact, MailerLite Classic and 30 30 Brevo/Sendinblue</strong>, <strong>export subscribers</strong> and what not. With this plugin you 31 31 are just few seconds away from collecting the subscribers from your WordPress site because creating and … … 62 62 <div class="stdl-feat-block"> 63 63 <div class="stdl-feat-img"> 64 <a href="https://demo.wpshuffle.com/subscribe-to- unlock/all-templates-demo/" class=""> <img64 <a href="https://demo.wpshuffle.com/subscribe-to-download/all-templates-demo/" class=""> <img 65 65 loading="lazy" src="https://wpshuffle.com/wp-content/uploads/2025/01/std-feat-3.png"></a> 66 66 </div> -
subscribe-to-download-lite/trunk/inc/views/backend/subscribers/list-subscribers.php
r3216457 r3841745 39 39 $subscriber_table = STDL_SUBSCRIBERS_TABLE; 40 40 41 $subscriber_query = "select * from $subscriber_table";41 $subscriber_query = $wpdb->prepare("SELECT * FROM $subscriber_table WHERE subscriber_form_alias = %s", 'stdl'); 42 42 43 43 $subscriber_rows = $wpdb->get_results($subscriber_query); … … 48 48 <td><?php echo esc_attr($subscriber_row->subscriber_name); ?></td> 49 49 <td><?php echo esc_attr($subscriber_row->subscriber_email); ?></td> 50 <td><?php echo (!empty($subscriber_row->subscriber_download_status)) ? esc_html__('Yes', 'subscribe-to-download-lite') : esc_html__('No', 'subscribe-to-download-lite'); ?></td>50 <td><?php echo esc_html($this->get_download_status_label($subscriber_row->subscriber_download_status)); ?></td> 51 51 <td> 52 52 <a class="stdl-delete stdl-subscriber-delete" href="javascript:void(0)" data-subscriber-id="<?php echo intval($subscriber_row->subscriber_id); ?>" title="<?php esc_html_e('Delete Subscriber', 'subscribe-to-download-lite'); ?>"><?php esc_html_e('Delete', 'subscribe-to-download-lite'); ?></a> -
subscribe-to-download-lite/trunk/inc/views/backend/upgrade.php
r2920291 r3841745 1 1 <div class="stdl-go-pro"> 2 <a href=" https://1.envato.market/Q3KGo" target="_blank"><img src="<?php echo STDL_URL . 'images/UpgradeBanner.png' ?>" /></a>3 <a href=" https://1.envato.market/Q3KGo" class="stdl-button-orange" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-download-lite'); ?></a>2 <a href="<?php echo esc_url(STDL_UPGRADE_LINK); ?>" target="_blank"><img src="<?php echo STDL_URL . 'images/UpgradeBanner.png' ?>" /></a> 3 <a href="<?php echo esc_url(STDL_UPGRADE_LINK); ?>" class="stdl-button-orange" target="_blank"><?php esc_html_e('Upgrade now', 'subscribe-to-download-lite'); ?></a> 4 4 </div> -
subscribe-to-download-lite/trunk/inc/views/frontend/download-button.php
r2341208 r3841745 1 <a href="<?php echo site_url() . '/?stdl_encryption_key=' . sanitize_text_field( $_COOKIE['stdl_encryption_key'] ); ?>" class="stdl-download-button stdl-button-<?php echo esc_attr( $form_template ); ?>"><i class="fa fa-download" aria-hidden="true"></i> 1 <?php 2 $download_url = $form_details['general']['download_file']; 3 if (!empty($form_details['general']['encrypt_link'])) { 4 $download_url = add_query_arg('stdl_encryption_key', sanitize_text_field($_COOKIE['stdl_encryption_key']), home_url('/')); 5 } 6 ?> 7 <a href="<?php echo esc_url($download_url); ?>" class="stdl-download-button stdl-button-<?php echo esc_attr( $form_template ); ?>"><i class="fa fa-download" aria-hidden="true"></i> 2 8 <?php echo esc_attr( $form_details['general']['download_button_text'] ); ?></a> 3 9 -
subscribe-to-download-lite/trunk/inc/views/frontend/stdl-shortcode.php
r2341208 r3841745 2 2 $form_details = get_option('stdl_settings'); 3 3 $form_template = (!empty($atts['template'])) ? $atts['template'] : $form_details['layout']['template']; 4 if ( isset($_COOKIE['stdl_encryption_key']) && $this->check_if_already_subscribed($_COOKIE['stdl_encryption_key']) && empty($form_details['general']['always_show'])) {4 if (!empty($form_details['general']['download_file']) && isset($_COOKIE['stdl_encryption_key']) && is_string($_COOKIE['stdl_encryption_key']) && $this->check_if_already_subscribed($_COOKIE['stdl_encryption_key']) && empty($form_details['general']['always_show'])) { 5 5 /** 6 6 * Triggers just before displaying the download button -
subscribe-to-download-lite/trunk/js/stdl-frontend.js
r2341208 r3841745 13 13 $.ajax({ 14 14 type: 'post', 15 dataType: 'json', 15 16 url: stdl_frontend_obj.ajax_url, 16 17 data: { … … 21 22 }, 22 23 beforeSend: function (xhr) { 24 selector.find(':submit').prop('disabled', true); 23 25 selector.find('.stdl-form-message').slideUp(500); 24 26 selector.find('.stdl-form-loader-wraper').show(); 25 27 }, 26 28 success: function (res) { 27 selector.find('.stdl-form-loader-wraper').hide();28 res = $.parseJSON(res);29 29 if (res.status == 200) { 30 30 selector[0].reset(); … … 33 33 selector.find('.stdl-form-message').removeClass('stdl-success').addClass('stdl-error').html(res.message).slideDown(500); 34 34 } 35 }, 36 error: function () { 37 selector.find('.stdl-form-message').removeClass('stdl-success').addClass('stdl-error').text(stdl_frontend_obj.request_error).slideDown(500); 38 }, 39 complete: function () { 40 selector.find('.stdl-form-loader-wraper').hide(); 41 selector.find(':submit').prop('disabled', false); 35 42 } 36 43 }); -
subscribe-to-download-lite/trunk/readme.txt
r3716347 r3841745 6 6 Tested up to: 7.1 7 7 Requires PHP: 7.0.0 8 Stable tag: 1.3. 08 Stable tag: 1.3.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 57 57 * Show popup form with delay on individual page 58 58 * Custom Form Styler Available 59 * Mailchimp, Constant Contact, MailerLite and other marketing integrations59 * Mailchimp, Constant Contact, MailerLite Classic and other marketing integrations 60 60 * Track Download Status 61 61 * And many more ... 62 62 63 Check all premium features [here](https:// 1.envato.market/Q3KGo)63 Check all premium features [here](https://codecanyon.net/item/subscribe-to-download-an-advanced-subscription-plugin-for-wordpress/24020447) 64 64 65 65 = Upgrade to PRO = 66 66 67 * To upgrade to pro, please go [here](https:// 1.envato.market/Q3KGo)67 * To upgrade to pro, please go [here](https://codecanyon.net/item/subscribe-to-download-an-advanced-subscription-plugin-for-wordpress/24020447) 68 68 * To check demo, please go [here](http://demo.wpshuffle.com/subscribe-to-download) 69 69 … … 116 116 117 117 == Changelog == 118 = 1.3.1 = 119 * Fixed signup-only forms so subscribers are saved when no download file is configured. 120 * Improved signup and email error handling so visitors can retry without creating another subscriber record. 121 * Fixed download links for returning subscribers and for files changed to an external URL. 122 * Added a settings check for blank agreement text and scoped the subscriber list and CSV to the Lite form. 123 * Clarified which downloads were tracked or redirected, and corrected the Pro purchase and template demo links. 124 118 125 = 1.3.0 = 119 126 * Fixed security issues -
subscribe-to-download-lite/trunk/subscribe-to-download-lite.php
r3260547 r3841745 6 6 Plugin URI: https://wpshuffle.com/subscribe-to-download-lite 7 7 Description: A plugin to collect email using an email subscribing form by providing the free downloadable items 8 Version: 1.3. 08 Version: 1.3.1 9 9 Author: WP Shuffle 10 10 Author URI: http://wpshuffle.com … … 33 33 34 34 global $wpdb; 35 defined('STDL_VERSION') or define('STDL_VERSION', '1.3. 0'); // Plugin's active version35 defined('STDL_VERSION') or define('STDL_VERSION', '1.3.1'); // Plugin's active version 36 36 defined('STDL_PATH') or define('STDL_PATH', plugin_dir_path(__FILE__)); // plugin's absolute path 37 37 defined('STDL_URL') or define('STDL_URL', plugin_dir_url(__FILE__)); // plugin's absolute URL … … 42 42 defined('STDL_SUBSCRIBERS_TABLE') or define('STDL_SUBSCRIBERS_TABLE', $wpdb->prefix . 'std_subscribers'); //plugin's subscriber table 43 43 defined('STDL_TOTAL_TEMPLATES') or define('STDL_TOTAL_TEMPLATES', 5); //Total number of templates available 44 defined('STDL_UPGRADE_LINK') or define('STDL_UPGRADE_LINK', 'https:// 1.envato.market/Q3KGo');44 defined('STDL_UPGRADE_LINK') or define('STDL_UPGRADE_LINK', 'https://codecanyon.net/item/subscribe-to-download-an-advanced-subscription-plugin-for-wordpress/24020447'); 45 45 } 46 46
Note:
See TracChangeset
for help on using the changeset viewer.