Changeset 2016363
- Timestamp:
- 01/21/2019 03:56:57 PM (7 years ago)
- Location:
- contact-form-7-honeypot/trunk
- Files:
-
- 2 edited
-
honeypot.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
contact-form-7-honeypot/trunk/honeypot.php
r1822267 r2016363 6 6 Author: Nocean 7 7 Author URI: http://www.nocean.ca 8 Version: 1.1 38 Version: 1.14 9 9 Text Domain: contact-form-7-honeypot 10 10 Domain Path: /languages/ … … 85 85 // Test if new 4.6+ functions exists 86 86 if (function_exists('wpcf7_add_form_tag')) { 87 wpcf7_add_form_tag( 'honeypot', 'wpcf7_honeypot_formtag_handler', true ); 87 wpcf7_add_form_tag( 88 'honeypot', 89 'wpcf7_honeypot_formtag_handler', 90 array( 91 'name-attr' => true, 92 'do-not-store' => true, 93 'not-for-mail' => true 94 ) 95 ); 88 96 } else { 89 97 wpcf7_add_shortcode( 'honeypot', 'wpcf7_honeypot_formtag_handler', true ); … … 109 117 110 118 $class = wpcf7_form_controls_class( 'text' ); 111 $unique_id = uniqid('hp');112 119 $atts = array(); 113 120 $atts['class'] = $tag->get_class_option( $class ); 114 121 $atts['id'] = $tag->get_option( 'id', 'id', true ); 122 123 $atts['wrapper_id'] = $tag->get_option('wrapper-id'); 124 $wrapper_id = (!empty($atts['wrapper_id'])) ? reset($atts['wrapper_id']) : uniqid('wpcf7-'); 125 115 126 $atts['message'] = apply_filters('wpcf7_honeypot_accessibility_message', __('Please leave this field empty.','contact-form-7-honeypot')); 116 127 $atts['name'] = $tag->name; … … 125 136 $autocomplete_value = ($atts['validautocomplete']) ? 'off' : 'nope'; 126 137 127 // Check if we should move the CSS off the element and into the footer [todo: find a way to move to head]128 if (!empty($atts['move_inline_css']) ) {129 $hp_css = '#'.$ unique_id.' {'.$atts['css'].'}';130 wp_register_style( 'wpcf7-'.$ unique_id.'-inline', false);131 wp_enqueue_style( 'wpcf7-'.$ unique_id.'-inline' );132 wp_add_inline_style( 'wpcf7-'.$ unique_id.'-inline', $hp_css );138 // Check if we should move the CSS off the element and into the footer 139 if (!empty($atts['move_inline_css']) && $atts['move_inline_css'][0] === 'true') { 140 $hp_css = '#'.$wrapper_id.' {'.$atts['css'].'}'; 141 wp_register_style( 'wpcf7-'.$wrapper_id.'-inline', false); 142 wp_enqueue_style( 'wpcf7-'.$wrapper_id.'-inline' ); 143 wp_add_inline_style( 'wpcf7-'.$wrapper_id.'-inline', $hp_css ); 133 144 $el_css = ''; 134 145 } else { … … 136 147 } 137 148 138 $html = '<span id="'.$ unique_id.'" class="wpcf7-form-control-wrap ' . $atts['name'] . '-wrap" '.$el_css.'>';149 $html = '<span id="'.$wrapper_id.'" class="wpcf7-form-control-wrap ' . $atts['name'] . '-wrap" '.$el_css.'>'; 139 150 if (!$atts['nomessage']) { 140 151 $html .= '<label ' . $inputid_for . ' class="hp-message">'.$atts['message'].'</label>'; … … 232 243 <tr> 233 244 <th scope="row"> 245 <label for="<?php echo esc_attr( $args['content'] . '-wrapper-id' ); ?>"><?php echo esc_html( __( 'Wrapper ID (optional)', 'contact-form-7-honeypot' ) ); ?></label> 246 </th> 247 <td> 248 <input type="text" name="wrapper-id" class="wrapper-id-value oneline option" id="<?php echo esc_attr( $args['content'] . '-wrapper-id' ); ?>" /><br> 249 <em><?php echo esc_html( __( 'By default the markup that wraps this form item has a random ID. You can customize it here. If you\'re unsure, leave blank.', 'contact-form-7-honeypot' ) ); ?></em> 250 </td> 251 </tr> 252 253 <tr> 254 <th scope="row"> 234 255 <label for="<?php echo esc_attr( $args['content'] . '-validautocomplete' ); ?>"><?php echo esc_html( __( 'Use W3C Valid Autocomplete (optional)', 'contact-form-7-honeypot' ) ); ?></label> 235 256 </th> … … 256 277 <td> 257 278 <input type="checkbox" name="nomessage:true" id="<?php echo esc_attr( $args['content'] . '-nomessage' ); ?>" class="messagekillvalue option" /><br /> 258 <em><?php echo __('If checked, the accessibility label will not be generated. <strong>This is not recommended</strong>. If you\'re unsure, leave this unchecked.','contact-form-7-honeypot'); ?></em>279 <em><?php echo __('If checked, the accessibility label will not be generated. This is not recommended, but may improve spam blocking. If you\'re unsure, leave this unchecked.','contact-form-7-honeypot'); ?></em> 259 280 </td> 260 281 </tr> -
contact-form-7-honeypot/trunk/readme.txt
r1999070 r2016363 3 3 Requires at least: 3.5 4 4 Tested up to: 5.0 5 Stable tag: 1.1 35 Stable tag: 1.14 6 6 Contributors: DaoByDesign 7 7 Donate link: http://www.nocean.ca/buy-us-a-coffee/ … … 69 69 70 70 == Changelog == 71 = 1.14 = 72 Added do-not-store for when forms are stored in the DB (i.e. Flamingo). Improved wrapper ID masking and customization. 73 71 74 = 1.13 = 72 75 Additional functionality to improve spam-stopping power.
Note: See TracChangeset
for help on using the changeset viewer.