Changeset 1538202
- Timestamp:
- 11/22/2016 10:02:27 AM (9 years ago)
- Location:
- sendmachine
- Files:
-
- 12 edited
- 1 copied
-
tags/1.0.13 (copied) (copied from sendmachine/trunk)
-
tags/1.0.13/includes/sendmachine_defaults.php (modified) (1 diff)
-
tags/1.0.13/includes/sendmachine_subscribe_manager.php (modified) (4 diffs)
-
tags/1.0.13/readme.txt (modified) (2 diffs)
-
tags/1.0.13/sendmachine_wp.php (modified) (1 diff)
-
tags/1.0.13/sendmachine_wp_admin.php (modified) (1 diff)
-
tags/1.0.13/views/wp_sm_list_settings.php (modified) (1 diff)
-
trunk/includes/sendmachine_defaults.php (modified) (1 diff)
-
trunk/includes/sendmachine_subscribe_manager.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/sendmachine_wp.php (modified) (1 diff)
-
trunk/sendmachine_wp_admin.php (modified) (1 diff)
-
trunk/views/wp_sm_list_settings.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
sendmachine/tags/1.0.13/includes/sendmachine_defaults.php
r1538133 r1538202 23 23 "message_invalid_email" => __('Please provide a valid email address.', SM_LANGUAGE_DOMAIN), 24 24 "label_submit_button" => __('Subscribe', SM_LANGUAGE_DOMAIN), 25 "message_required_field" => __('Please provide all the required field data.', SM_LANGUAGE_DOMAIN), 25 26 "checkbox_register" => 1, 26 27 "checkbox_comment" => 0, -
sendmachine/tags/1.0.13/includes/sendmachine_subscribe_manager.php
r1538133 r1538202 165 165 $is_ajax = isset($data['is_sm_ajax_request']) ? $data['is_sm_ajax_request'] : NULL; 166 166 $sm_api = Sm_wp::instance()->sm; 167 $defaults = Sm_defaults::defaults(); 167 168 168 169 if ($action == "subscribe_form") { … … 174 175 175 176 $fields = $this->app['list']['fields']; 177 if(!$fields) { 178 $msg = array("message" => $this->app['list']['message_not_subscribed'], "status" => "error"); 179 echo json_encode($msg); 180 exit(); 181 } 176 182 177 183 $fn = array(); 184 $has_error = false; 178 185 foreach($fields as $f) $fn[] = $f['name']; 179 186 180 187 foreach($data as $k => $v) { 181 if(!in_array($k,$fn)) unset($data[$k]); 182 } 183 184 if ($sm_api->get_recipient($this->app['list']['id'], $email)) 188 189 if(!in_array($k,$fn)) { 190 unset($data[$k]); 191 continue; 192 } 193 194 foreach($fields as $field) { 195 if($field['name'] === $k) { 196 if($field['required'] && !$v) { 197 $has_error = true; 198 } 199 break; 200 } 201 } 202 } 203 204 if ($has_error) { 205 206 $_msg = isset($this->app['list']['message_required_field']) ? $this->app['list']['message_required_field'] : $defaults['list']['message_required_field']; 207 208 $msg = array("message" => $_msg, "status" => "error"); 209 echo json_encode($msg); 210 exit(); 211 } 212 213 if ($sm_api->get_recipient($this->app['list']['id'], $email)) { 214 185 215 $msg = array("message" => $this->app['list']['message_subscriber_exists'], "status" => "error"); 186 elseif ($resp = $sm_api->subscribe($this->app['list']['id'], $email, $data)) {216 } elseif ($resp = $sm_api->subscribe($this->app['list']['id'], $email, $data)) { 187 217 188 218 if (is_user_logged_in()) add_user_meta( get_current_user_id(), SM_USER_META_NAME, 1); … … 192 222 $msg = array("message" => $this->app['list']['message_success_subscribe'], "status" => "success"); 193 223 } 194 else 224 else { 225 195 226 $msg = array("message" => $this->app['list']['message_not_subscribed'], "status" => "error"); 227 } 196 228 197 229 if ($is_ajax) { echo json_encode($msg); exit(); } … … 221 253 if (is_user_logged_in() && $resp) add_user_meta( get_current_user_id(), SM_USER_META_NAME, 1); 222 254 } 223 elseif ($action == "sync_users") {255 elseif ($action == "sync_users") { 224 256 225 257 if (empty($this->app['list']['id'])) { -
sendmachine/tags/1.0.13/readme.txt
r1538133 r1538202 4 4 Requires at least: 3.2.1 5 5 Tested up to: 4.6 6 Stable tag: 1.0.1 26 Stable tag: 1.0.13 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 96 96 == Changelog == 97 97 98 = 1.0.13 = 99 * Subscribe required fields limitation 100 98 101 = 1.0.12 = 99 102 * Extra checks for invalid email address -
sendmachine/tags/1.0.13/sendmachine_wp.php
r1538133 r1538202 5 5 Plugin URI: https://www.sendmachine.com 6 6 Description: The official Sendmachine plugin featuring subscribe forms, users sync, news feed, email sending and transactional campaigns. 7 Version: 1.0.1 27 Version: 1.0.13 8 8 Author: Sendmachine team 9 9 Author URI: http://developers.sendmachine.com/ -
sendmachine/tags/1.0.13/sendmachine_wp_admin.php
r1538133 r1538202 91 91 if(!isset($this->app['list']['label_submit_button'])) { 92 92 $this->app['list']['label_submit_button'] = $defaults['list']['label_submit_button']; 93 } 94 95 if(!isset($this->app['list']['message_required_field'])) { 96 $this->app['list']['message_required_field'] = $defaults['list']['message_required_field']; 93 97 } 94 98 -
sendmachine/tags/1.0.13/views/wp_sm_list_settings.php
r1538133 r1538202 128 128 <tr> 129 129 <td class='sm_row_title'> 130 <span><?php _e("Required fields error", SM_LANGUAGE_DOMAIN); ?></span> 131 </td> 132 <td class='sm_row_content' colspan="2"> 133 <input type="text" name="update[list][message_required_field]" class="widefat" value="<?php echo $this->app['list']['message_required_field']; ?>" /> 134 </td> 135 </tr> 136 <tr> 137 <td class='sm_row_title'> 130 138 <span><?php _e("Submit button label", SM_LANGUAGE_DOMAIN); ?></span> 131 139 </td> -
sendmachine/trunk/includes/sendmachine_defaults.php
r1538133 r1538202 23 23 "message_invalid_email" => __('Please provide a valid email address.', SM_LANGUAGE_DOMAIN), 24 24 "label_submit_button" => __('Subscribe', SM_LANGUAGE_DOMAIN), 25 "message_required_field" => __('Please provide all the required field data.', SM_LANGUAGE_DOMAIN), 25 26 "checkbox_register" => 1, 26 27 "checkbox_comment" => 0, -
sendmachine/trunk/includes/sendmachine_subscribe_manager.php
r1538133 r1538202 165 165 $is_ajax = isset($data['is_sm_ajax_request']) ? $data['is_sm_ajax_request'] : NULL; 166 166 $sm_api = Sm_wp::instance()->sm; 167 $defaults = Sm_defaults::defaults(); 167 168 168 169 if ($action == "subscribe_form") { … … 174 175 175 176 $fields = $this->app['list']['fields']; 177 if(!$fields) { 178 $msg = array("message" => $this->app['list']['message_not_subscribed'], "status" => "error"); 179 echo json_encode($msg); 180 exit(); 181 } 176 182 177 183 $fn = array(); 184 $has_error = false; 178 185 foreach($fields as $f) $fn[] = $f['name']; 179 186 180 187 foreach($data as $k => $v) { 181 if(!in_array($k,$fn)) unset($data[$k]); 182 } 183 184 if ($sm_api->get_recipient($this->app['list']['id'], $email)) 188 189 if(!in_array($k,$fn)) { 190 unset($data[$k]); 191 continue; 192 } 193 194 foreach($fields as $field) { 195 if($field['name'] === $k) { 196 if($field['required'] && !$v) { 197 $has_error = true; 198 } 199 break; 200 } 201 } 202 } 203 204 if ($has_error) { 205 206 $_msg = isset($this->app['list']['message_required_field']) ? $this->app['list']['message_required_field'] : $defaults['list']['message_required_field']; 207 208 $msg = array("message" => $_msg, "status" => "error"); 209 echo json_encode($msg); 210 exit(); 211 } 212 213 if ($sm_api->get_recipient($this->app['list']['id'], $email)) { 214 185 215 $msg = array("message" => $this->app['list']['message_subscriber_exists'], "status" => "error"); 186 elseif ($resp = $sm_api->subscribe($this->app['list']['id'], $email, $data)) {216 } elseif ($resp = $sm_api->subscribe($this->app['list']['id'], $email, $data)) { 187 217 188 218 if (is_user_logged_in()) add_user_meta( get_current_user_id(), SM_USER_META_NAME, 1); … … 192 222 $msg = array("message" => $this->app['list']['message_success_subscribe'], "status" => "success"); 193 223 } 194 else 224 else { 225 195 226 $msg = array("message" => $this->app['list']['message_not_subscribed'], "status" => "error"); 227 } 196 228 197 229 if ($is_ajax) { echo json_encode($msg); exit(); } … … 221 253 if (is_user_logged_in() && $resp) add_user_meta( get_current_user_id(), SM_USER_META_NAME, 1); 222 254 } 223 elseif ($action == "sync_users") {255 elseif ($action == "sync_users") { 224 256 225 257 if (empty($this->app['list']['id'])) { -
sendmachine/trunk/readme.txt
r1538133 r1538202 4 4 Requires at least: 3.2.1 5 5 Tested up to: 4.6 6 Stable tag: 1.0.1 26 Stable tag: 1.0.13 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 96 96 == Changelog == 97 97 98 = 1.0.13 = 99 * Subscribe required fields limitation 100 98 101 = 1.0.12 = 99 102 * Extra checks for invalid email address -
sendmachine/trunk/sendmachine_wp.php
r1538133 r1538202 5 5 Plugin URI: https://www.sendmachine.com 6 6 Description: The official Sendmachine plugin featuring subscribe forms, users sync, news feed, email sending and transactional campaigns. 7 Version: 1.0.1 27 Version: 1.0.13 8 8 Author: Sendmachine team 9 9 Author URI: http://developers.sendmachine.com/ -
sendmachine/trunk/sendmachine_wp_admin.php
r1538133 r1538202 91 91 if(!isset($this->app['list']['label_submit_button'])) { 92 92 $this->app['list']['label_submit_button'] = $defaults['list']['label_submit_button']; 93 } 94 95 if(!isset($this->app['list']['message_required_field'])) { 96 $this->app['list']['message_required_field'] = $defaults['list']['message_required_field']; 93 97 } 94 98 -
sendmachine/trunk/views/wp_sm_list_settings.php
r1538133 r1538202 128 128 <tr> 129 129 <td class='sm_row_title'> 130 <span><?php _e("Required fields error", SM_LANGUAGE_DOMAIN); ?></span> 131 </td> 132 <td class='sm_row_content' colspan="2"> 133 <input type="text" name="update[list][message_required_field]" class="widefat" value="<?php echo $this->app['list']['message_required_field']; ?>" /> 134 </td> 135 </tr> 136 <tr> 137 <td class='sm_row_title'> 130 138 <span><?php _e("Submit button label", SM_LANGUAGE_DOMAIN); ?></span> 131 139 </td>
Note: See TracChangeset
for help on using the changeset viewer.