Changeset 1893633
- Timestamp:
- 06/15/2018 04:45:17 PM (8 years ago)
- Location:
- wp-emfluence/trunk
- Files:
-
- 4 edited
-
admin.php (modified) (6 diffs)
-
emfluence.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
widget.php (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-emfluence/trunk/admin.php
r1421095 r1893633 32 32 ,'account' 33 33 ); 34 add_settings_field( 35 'blacklist_domains', 36 'Blacklist Domains', 37 '_emfluence_emailer_options_blacklist_domains_element', 38 'emfluence_emailer', 39 'account' 40 ); 34 41 } 35 42 add_action('admin_init', 'emfluence_emailer_admin_init'); … … 41 48 return; 42 49 } 43 50 44 51 wp_enqueue_style( 45 52 'emfluence-widget', … … 47 54 array(), 48 55 filemtime(__DIR__ . '/css/widget-settings.css') 49 );56 ); 50 57 51 58 wp_enqueue_script( … … 64 71 */ 65 72 function _emfluence_emailer_options_page() { 66 ?>67 <div class="emfluence wrap">68 <h2><?php __( 'emfluence Marketing Platform' ); ?></h2>73 ?> 74 <div class="emfluence wrap"> 75 <h2><?php __( 'emfluence Marketing Platform' ); ?></h2> 69 76 70 <form action="options.php" method="post">71 <?php settings_fields('emfluence_emailer'); ?>72 <?php do_settings_sections('emfluence_emailer'); ?>77 <form action="options.php" method="post"> 78 <?php settings_fields('emfluence_emailer'); ?> 79 <?php do_settings_sections('emfluence_emailer'); ?> 73 80 74 <input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" />75 </form>81 <input name="Submit" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" /> 82 </form> 76 83 77 </div>78 <?php84 </div> 85 <?php 79 86 } 80 87 … … 88 95 } 89 96 97 function _emfluence_emailer_options_blacklist_domains_element(){ 98 $options = get_option('emfluence_global'); 99 if(!array_key_exists('blacklist_domains', $options)) $options['blacklist_domains'] = ''; 100 echo " 101 <textarea id='blacklist_domains' name='emfluence_global[blacklist_domains]' rows='10'>{$options['blacklist_domains']}</textarea> 102 <p>Form submissions with email address recipients in these domains will be rejected.</p> 103 <p>This is useful if you only want B2B leads.</p> 104 <p>Enter one domain per line, without commas. For example:<br /> 105 hotmail.com<br /> 106 gmail.com<br /> 107 aol.com 108 </p> 109 "; 110 } 111 90 112 /** 91 113 * Validates posted settings page options … … 94 116 */ 95 117 function _emfluence_emailer_options_validate($data){ 118 if(empty($data['api_key'])) return $data; 119 96 120 // Create a new instance of the api 97 121 $api = emfluence_get_api($data['api_key'], TRUE); -
wp-emfluence/trunk/emfluence.php
r1636887 r1893633 5 5 Description: Easily add forms to your website for contacts to add or update their details in your emfluence Marketing Platform account. 6 6 Author: emfluence Digital Marketing 7 Version: 2. 27 Version: 2.3 8 8 Author URI: https://www.emfluence.com 9 9 */ -
wp-emfluence/trunk/readme.txt
r1673829 r1893633 1 1 === Plugin Name === 2 2 Tags: email, email marketing, emailmarketing, emfluence, api, marketing automation, widget, email widget, email signup, mailing list, newsletter, form, automation 3 Requires at least: 3.0.14 Tested up to: 4. 85 Stable tag: 2. 23 Requires at least: 4.0 4 Tested up to: 4.9.6 5 Stable tag: 2.3 6 6 License: GPLv2 or later 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 52 52 == Changelog == 53 53 54 = 2.3 = 55 * Add blacklist domain setting on plugin admin page. 56 * Fix warning if there is any non-string POST data on form submit. 57 * Scroll to location of form on page after form submit. 58 59 = 2.2.1 = 60 * Fail more gracefully in the admin area if API token is not available. 61 54 62 = 2.2 = 55 63 * Add honeypot to cut down on spam submissions. -
wp-emfluence/trunk/widget.php
r1636887 r1893633 63 63 */ 64 64 protected function validate_email($email) { 65 65 66 // Ensure the basic pattern is correct 66 67 if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { 67 68 return false; 68 } else { 69 // Test the domain's MX records to avoid more fake domains in the correct pattern. 70 list($user, $domain) = explode('@', $email); 71 try { 72 if( !checkdnsrr($domain, 'MX') ){ 73 return false; 74 } 75 } catch( Exception $e ){ 69 } 70 71 // Test the domain's MX records to avoid more fake domains in the correct pattern. 72 list($user, $domain) = explode('@', $email); 73 try { 74 if( !checkdnsrr($domain, 'MX') ){ 76 75 return false; 77 76 } 78 } 77 } catch( Exception $e ){ 78 return false; 79 } 80 81 // Check domain blacklist 82 $options = get_option('emfluence_global'); 83 if(!empty($options['blacklist_domains'])) { 84 $blacklisted_domains = array_map( 85 function ($domain) { return strtolower(trim($domain)); }, 86 array_filter(explode(PHP_EOL, $options['blacklist_domains'])) 87 ); 88 if(in_array(strtolower($domain), $blacklisted_domains, true)) return false; 89 } 90 79 91 return true; 80 92 } … … 124 136 case 'email': 125 137 if(!$this->validate_email( $values[$key] )) { 126 $messages[] = array( 'type' => 'error', 'value' => sprintf(__('%s: Invalid email address .'), $field_name) );138 $messages[] = array( 'type' => 'error', 'value' => sprintf(__('%s: Invalid email address or blacklisted email domain.'), $field_name) ); 127 139 } 128 break;140 break; 129 141 case 'number': 130 142 if(!is_numeric($values[$key])) { … … 153 165 if( $title ) $title = $args['before_title'] . '<span>' . $title . '</span>' . $args['after_title']; 154 166 155 $output = $args['before_widget'] . '<form class="mail-form" method="post"><div class="holder"><div class="frame">';167 $output = $args['before_widget'] . '<form id="' . esc_attr($args['widget_id']) . '" class="mail-form" method="post" action="#' . esc_attr($args['widget_id']) . '"><div class="holder"><div class="frame">'; 156 168 $output .= $title; 157 169 $output .= $content; … … 189 201 // Set the field values in case there's an error 190 202 foreach( $_POST as $key => $value ){ 203 if(!is_string($value)) continue; 191 204 $values[$key] = htmlentities( trim( $value ) ); 192 205 } … … 220 233 } 221 234 $data['customFields'][$field] = array( 222 'value' => trim( $_POST[$parameter] ),235 'value' => trim( $_POST[$parameter] ), 223 236 ); 224 237 } … … 343 356 array(), 344 357 filemtime(__DIR__ . '/css/widget-frontend.css') 345 );358 ); 346 359 return; 347 360 } … … 376 389 'New email signup form submission for "' . $instance['title'] . '"', 377 390 $message 378 );391 ); 379 392 } 380 393 … … 428 441 </div> 429 442 <div class="selected">' . "\n"; 430 if( !empty($instance['groups']) ) {431 foreach ($instance['groups'] as $groupID) {432 $group = $groups[$groupID];433 $id = 'groups-' . $this->number . '-' . $groupID;434 $output .= '443 if( !empty($instance['groups']) ) { 444 foreach ($instance['groups'] as $groupID) { 445 $group = $groups[$groupID]; 446 $id = 'groups-' . $this->number . '-' . $groupID; 447 $output .= ' 435 448 <div> 436 449 <label for="' . $id . '"> … … 438 451 </label> 439 452 </div>'; 440 }441 }453 } 454 } 442 455 $output .= ' 443 456 </div> … … 867 880 public function form( $instance ) { 868 881 $options = get_option('emfluence_global'); 882 if(empty($options['api_key'])) { 883 print '<div class="wp-emfluence">Please visit the emfluence plugin settings page and add an API token.</div>'; 884 return; 885 } 869 886 $api = emfluence_get_api($options['api_key']); 870 887 $ping = $api->ping(); … … 936 953 $is_custom_display = ( 937 954 strrpos($field_key, '_display') === (strlen($field_key) - strlen('_display')) 938 );955 ); 939 956 if(!$is_custom_display) continue; 940 957 … … 961 978 'order' => is_numeric($new_instance[$key_prefix . '_order'])? $new_instance[$key_prefix . '_order'] : 6, 962 979 'type' => empty($instance[$key_prefix . '_type']) ? 'text' : $this->restrict_to_types($instance[$key_prefix . '_type']) 963 );980 ); 964 981 } 965 982
Note: See TracChangeset
for help on using the changeset viewer.