Contact Form 7 Dynamic Text Extension - Version 2.0

Version Description

  • Complete rewrite for Compatibility with Contact Form 7 v4
Download this release

Release Info

Developer sevenspark
Plugin Icon wp plugin Contact Form 7 Dynamic Text Extension
Version 2.0
Comparing to
See all releases

Code changes from version 1.2 to 2.0

contact-form-7-dynamic-text-extension.php CHANGED
@@ -4,13 +4,13 @@
4
  Plugin Name: Contact Form 7 - Dynamic Text Extension
5
  Plugin URI: http://sevenspark.com/wordpress-plugins/contact-form-7-dynamic-text-extension
6
  Description: Provides a dynamic text field that accepts any shortcode to generate the content. Requires Contact Form 7
7
- Version: 1.2
8
  Author: Chris Mavricos, SevenSpark
9
  Author URI: http://sevenspark.com
10
  License: GPL2
11
  */
12
 
13
- /* Copyright 2010-2014 Chris Mavricos, SevenSpark http://sevenspark.com
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
@@ -27,308 +27,230 @@ License: GPL2
27
  */
28
 
29
 
30
- /**
31
- ** A base module for [dynamictext], [dynamictext*]
32
- **/
33
- function wpcf7_dynamictext_init(){
34
-
35
- if(function_exists('wpcf7_add_shortcode')){
36
-
37
- /* Shortcode handler */
38
- wpcf7_add_shortcode( 'dynamictext', 'wpcf7_dynamictext_shortcode_handler', true );
39
- wpcf7_add_shortcode( 'dynamictext*', 'wpcf7_dynamictext_shortcode_handler', true );
40
- wpcf7_add_shortcode( 'dynamichidden', 'wpcf7_dynamichidden_shortcode_handler', true );
41
-
42
- }
43
-
44
- add_filter( 'wpcf7_validate_dynamictext', 'wpcf7_dynamictext_validation_filter', 10, 2 );
45
- add_filter( 'wpcf7_validate_dynamictext*', 'wpcf7_dynamictext_validation_filter', 10, 2 );
46
-
47
- add_action( 'admin_init', 'wpcf7_add_tag_generator_dynamictext', 15 );
48
- add_action( 'admin_init', 'wpcf7_add_tag_generator_dynamichidden', 16 );
49
-
50
  }
51
- add_action( 'plugins_loaded', 'wpcf7_dynamictext_init' , 20 );
52
 
53
- /*************************************************************
54
- * DynamicText Shortcode
55
- *************************************************************/
56
-
57
- function wpcf7_dynamictext_shortcode_handler( $tag ) {
58
-
59
- $wpcf7_contact_form = WPCF7_ContactForm::get_current();
60
 
61
- if ( ! is_array( $tag ) )
62
- return '';
63
 
64
- $type = $tag['type'];
65
- $name = $tag['name'];
66
- $options = (array) $tag['options'];
67
- $values = (array) $tag['values'];
 
 
 
68
 
69
- if ( empty( $name ) )
70
  return '';
71
 
72
- $atts = '';
73
- $id_att = '';
74
- $class_att = '';
75
- $size_att = '';
76
- $maxlength_att = '';
77
- $tabindex_att = '';
78
-
79
- $class_att .= ' wpcf7-text';
80
 
81
- if ( 'dynamictext*' == $type )
82
- $class_att .= ' wpcf7-validates-as-required';
83
 
84
- foreach ( $options as $option ) {
85
- if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
86
- $id_att = $matches[1];
87
 
88
- } elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
89
- $class_att .= ' ' . $matches[1];
90
 
91
- } elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
92
- $size_att = (int) $matches[1];
93
- $maxlength_att = (int) $matches[2];
94
 
95
- } elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
96
- $tabindex_att = (int) $matches[1];
 
97
 
98
- }
 
99
  }
100
 
101
- if ( $id_att )
102
- $atts .= ' id="' . trim( $id_att ) . '"';
 
103
 
104
- if ( $class_att )
105
- $atts .= ' class="' . trim( $class_att ) . '"';
106
 
107
- if ( $size_att )
108
- $atts .= ' size="' . $size_att . '"';
109
- else
110
- $atts .= ' size="40"'; // default size
111
 
112
- if ( $maxlength_att )
113
- $atts .= ' maxlength="' . $maxlength_att . '"';
114
 
115
- if ( '' !== $tabindex_att )
116
- $atts .= sprintf( ' tabindex="%d"', $tabindex_att );
117
 
118
- // Value
119
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) && $wpcf7_contact_form->is_posted() ) {
120
- if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['ok'] )
121
- $value = '';
122
- else
123
- $value = stripslashes_deep( $_POST[$name] );
124
- } else {
125
- $value = isset( $values[0] ) ? $values[0] : '';
126
  }
127
-
 
 
 
 
128
  $scval = do_shortcode('['.$value.']');
129
- if($scval != '['.$value.']') $value = $scval;
 
 
 
 
130
 
131
- //echo '<pre>'; print_r($options);echo '</pre>';
132
- $readonly = '';
133
- if(in_array('uneditable', $options)){
134
- $readonly = 'readonly="readonly"';
 
 
 
 
 
 
 
135
  }
136
 
137
- $html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' '. $readonly.' />';
138
 
139
- $validation_error = '';
140
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
141
- $validation_error = $wpcf7_contact_form->validation_error( $name );
142
 
143
- $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
 
 
144
 
145
  return $html;
146
  }
147
 
 
 
 
148
 
149
- /* Validation filter */
150
 
151
- function wpcf7_dynamictext_validation_filter( $result, $tag ) {
152
-
153
- $wpcf7_contact_form = WPCF7_ContactForm::get_current();
154
 
155
- $type = $tag['type'];
156
- $name = $tag['name'];
157
-
158
- $_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
159
-
160
- if ( 'dynamictext*' == $type ) {
161
- if ( '' == $_POST[$name] ) {
162
- $result['valid'] = false;
163
- $result['reason'][$name] = $wpcf7_contact_form->message( 'invalid_required' );
164
  }
165
  }
166
 
167
- return $result;
168
- }
 
169
 
 
 
 
170
 
171
- /* Tag generator */
172
 
173
- function wpcf7_add_tag_generator_dynamictext() {
174
- if(function_exists('wpcf7_add_tag_generator')){
175
- wpcf7_add_tag_generator( 'dynamictext', __( 'Dynamic Text field', 'wpcf7' ),
176
- 'wpcf7-tg-pane-dynamictext', 'wpcf7_tg_pane_dynamictext_' );
 
 
 
177
  }
178
- }
179
 
180
- function wpcf7_tg_pane_dynamictext_( $contact_form ) {
181
- wpcf7_tg_pane_dynamictext( 'dynamictext' );
182
  }
183
 
184
- function wpcf7_tg_pane_dynamictext( $type = 'dynamictext' ) {
185
- ?>
186
- <div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
187
- <form action="">
188
- <table>
189
- <tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
190
- <tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
191
- </table>
192
-
193
- <table>
194
- <tr>
195
- <td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
196
- <input type="text" name="id" class="idvalue oneline option" /></td>
197
-
198
- <td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
199
- <input type="text" name="class" class="classvalue oneline option" /></td>
200
- </tr>
201
 
202
- <tr>
203
- <td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
204
- <input type="text" name="size" class="numeric oneline option" /></td>
205
 
206
- <td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
207
- <input type="text" name="maxlength" class="numeric oneline option" /></td>
208
- </tr>
209
 
210
- <tr>
211
- <td>
212
- <input type="checkbox" name="uneditable" class="option" />&nbsp;<?php echo esc_html( __( "Make this field Uneditable", 'wpcf7' ) ); ?><br />
213
- </td>
214
-
215
- <td><?php echo esc_html( __( 'Dynamic value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" />
216
- <?php echo esc_html( __( 'You can enter any short code. Just leave out the square brackets ([]) and only use single quotes (\' not ")', 'wpcf7' )); ?>
217
- </td>
218
- </tr>
219
- </table>
220
-
221
- <div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="<?php echo $type; ?>" class="tag" readonly="readonly" onfocus="this.select()" /></div>
222
-
223
- <div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
224
- </form>
225
- </div>
226
- <?php
227
  }
228
 
 
229
 
230
- /*************************************************************
231
- * DynamicHidden Shortcode
232
- *************************************************************/
233
- function wpcf7_dynamichidden_shortcode_handler( $tag ) {
234
-
235
- $wpcf7_contact_form = WPCF7_ContactForm::get_current();
236
-
237
- if ( ! is_array( $tag ) )
238
- return '';
239
 
240
- $type = $tag['type'];
241
- $name = $tag['name'];
242
- $options = (array) $tag['options'];
243
- $values = (array) $tag['values'];
244
 
245
- if ( empty( $name ) )
246
- return '';
247
 
248
- $atts = '';
249
- $id_att = '';
250
- $class_att = '';
251
- $size_att = '';
252
- $maxlength_att = '';
253
- $tabindex_att = '';
254
 
255
- $class_att .= ' wpcf7-text';
256
 
257
- foreach ( $options as $option ) {
258
- if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
259
- $id_att = $matches[1];
260
- }
261
- }
262
 
263
- if ( $id_att )
264
- $atts .= ' id="' . trim( $id_att ) . '"';
265
-
266
- // Value
267
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) && $wpcf7_contact_form->is_posted() ) {
268
- if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['ok'] )
269
- $value = '';
270
- else
271
- $value = stripslashes_deep( $_POST[$name] );
272
- } else {
273
- $value = isset( $values[0] ) ? $values[0] : '';
 
274
  }
275
 
276
- $scval = do_shortcode('['.$value.']');
277
- if($scval != '['.$value.']') $value = $scval;
278
- //echo '<pre>'; print_r($options);echo '</pre>';
279
-
280
- $html = '<input type="hidden" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
281
-
282
- //No need to validate, it's a hidden field - we could validate by checking the value hasn't changed, but that seems overkill I think
283
- //$validation_error = '';
284
- //if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
285
- // $validation_error = $wpcf7_contact_form->validation_error( $name );
286
-
287
- $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . '</span>';
288
 
289
- return $html;
290
- }
291
-
292
-
293
- /* Tag generator */
294
-
295
- function wpcf7_add_tag_generator_dynamichidden() {
296
- if(function_exists('wpcf7_add_tag_generator')){
297
- wpcf7_add_tag_generator( 'dynamichidden', __( 'Dynamic Hidden field', 'wpcf7' ),
298
- 'wpcf7-tg-pane-dynamichidden', 'wpcf7_tg_pane_dynamichidden_' );
299
- }
300
- }
301
 
302
- function wpcf7_tg_pane_dynamichidden_( $contact_form ) {
303
- wpcf7_tg_pane_dynamichidden( 'dynamichidden' );
304
- }
305
 
306
- function wpcf7_tg_pane_dynamichidden( $type = 'dynamichidden' ) {
307
  ?>
308
- <div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
309
- <form action="">
310
- <table>
311
- <tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
312
  </table>
 
 
313
 
314
- <table>
315
- <tr>
316
- <td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
317
- <input type="text" name="id" class="idvalue oneline option" /></td>
318
- </tr>
319
-
320
- <tr>
321
 
322
- <td><?php echo esc_html( __( 'Dynamic value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" />
323
- <?php echo esc_html( __( 'You can enter any short code. Just leave out the square brackets ([]) and only use single quotes (\' not ")', 'wpcf7' )); ?>
324
- </td>
325
- </tr>
326
- </table>
327
 
328
- <div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="<?php echo $type; ?>" class="tag" readonly="readonly" onfocus="this.select()" /></div>
329
 
330
- <div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
331
- </form>
332
  </div>
333
  <?php
334
  }
@@ -336,6 +258,8 @@ function wpcf7_tg_pane_dynamichidden( $type = 'dynamichidden' ) {
336
 
337
 
338
 
 
 
339
  /*****************************************************
340
  * CF7 DTX Included Shortcodes
341
  *
@@ -409,14 +333,16 @@ add_shortcode('CF7_get_post_var', 'cf7_get_post_var');
409
  /* Insert the current URL */
410
  function cf7_url(){
411
  $pageURL = 'http';
412
- if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 
413
  $pageURL .= "://";
414
- if ($_SERVER["SERVER_PORT"] != "80") {
 
415
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
416
  } else {
417
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
418
  }
419
- return $pageURL;
420
  }
421
  add_shortcode('CF7_URL', 'cf7_url');
422
 
4
  Plugin Name: Contact Form 7 - Dynamic Text Extension
5
  Plugin URI: http://sevenspark.com/wordpress-plugins/contact-form-7-dynamic-text-extension
6
  Description: Provides a dynamic text field that accepts any shortcode to generate the content. Requires Contact Form 7
7
+ Version: 2.0
8
  Author: Chris Mavricos, SevenSpark
9
  Author URI: http://sevenspark.com
10
  License: GPL2
11
  */
12
 
13
+ /* Copyright 2010-2015 Chris Mavricos, SevenSpark http://sevenspark.com
14
 
15
  This program is free software; you can redistribute it and/or modify
16
  it under the terms of the GNU General Public License, version 2, as
27
  */
28
 
29
 
30
+ add_action( 'plugins_loaded', 'wpcf7dtx_init' , 20 );
31
+ function wpcf7dtx_init(){
32
+ add_action( 'wpcf7_init', 'wpcf7dtx_add_shortcode_dynamictext' );
33
+ add_filter( 'wpcf7_validate_dynamictext*', 'wpcf7dtx_dynamictext_validation_filter', 10, 2 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
 
35
 
 
 
 
 
 
 
 
36
 
 
 
37
 
38
+ function wpcf7dtx_add_shortcode_dynamictext() {
39
+ wpcf7_add_shortcode(
40
+ array( 'dynamictext' , 'dynamictext*' , 'dynamichidden' ),
41
+ 'wpcf7dtx_dynamictext_shortcode_handler', true );
42
+ }
43
+ function wpcf7dtx_dynamictext_shortcode_handler( $tag ) {
44
+ $tag = new WPCF7_Shortcode( $tag );
45
 
46
+ if ( empty( $tag->name ) )
47
  return '';
48
 
49
+ $validation_error = wpcf7_get_validation_error( $tag->name );
 
 
 
 
 
 
 
50
 
51
+ $class = wpcf7_form_controls_class( $tag->type, 'wpcf7dtx-dynamictext' );
 
52
 
 
 
 
53
 
54
+ if ( $validation_error )
55
+ $class .= ' wpcf7-not-valid';
56
 
57
+ $atts = array();
 
 
58
 
59
+ $atts['size'] = $tag->get_size_option( '40' );
60
+ $atts['maxlength'] = $tag->get_maxlength_option();
61
+ $atts['minlength'] = $tag->get_minlength_option();
62
 
63
+ if ( $atts['maxlength'] && $atts['minlength'] && $atts['maxlength'] < $atts['minlength'] ) {
64
+ unset( $atts['maxlength'], $atts['minlength'] );
65
  }
66
 
67
+ $atts['class'] = $tag->get_class_option( $class );
68
+ $atts['id'] = $tag->get_id_option();
69
+ $atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
70
 
71
+ if ( $tag->has_option( 'readonly' ) )
72
+ $atts['readonly'] = 'readonly';
73
 
74
+ if ( $tag->is_required() )
75
+ $atts['aria-required'] = 'true';
 
 
76
 
77
+ $atts['aria-invalid'] = $validation_error ? 'true' : 'false';
 
78
 
79
+ $value = (string) reset( $tag->values );
 
80
 
81
+ if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
82
+ $atts['placeholder'] = $value;
83
+ $value = '';
 
 
 
 
 
84
  }
85
+
86
+ $value = $tag->get_default_option( $value );
87
+
88
+ $value = wpcf7_get_hangover( $tag->name, $value );
89
+
90
  $scval = do_shortcode('['.$value.']');
91
+ if( $scval != '['.$value.']' ){
92
+ $value = esc_attr( $scval );
93
+ }
94
+
95
+ $atts['value'] = $value;
96
 
97
+ //echo '<pre>'; print_r( $tag ); echo '</pre>';
98
+ switch( $tag->basetype ){
99
+ case 'dynamictext':
100
+ $atts['type'] = 'text';
101
+ break;
102
+ case 'dynamichidden':
103
+ $atts['type'] = 'hidden';
104
+ break;
105
+ default:
106
+ $atts['type'] = 'text';
107
+ break;
108
  }
109
 
110
+ $atts['name'] = $tag->name;
111
 
112
+ $atts = wpcf7_format_atts( $atts );
 
 
113
 
114
+ $html = sprintf(
115
+ '<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
116
+ sanitize_html_class( $tag->name ), $atts, $validation_error );
117
 
118
  return $html;
119
  }
120
 
121
+ //add_filter( 'wpcf7_validate_text', 'wpcf7_text_validation_filter', 10, 2 ); // in init
122
+ function wpcf7dtx_dynamictext_validation_filter( $result, $tag ) {
123
+ $tag = new WPCF7_Shortcode( $tag );
124
 
125
+ $name = $tag->name;
126
 
127
+ $value = isset( $_POST[$name] )
128
+ ? trim( wp_unslash( strtr( (string) $_POST[$name], "\n", " " ) ) )
129
+ : '';
130
 
131
+ if ( 'dynamictext' == $tag->basetype ) {
132
+ if ( $tag->is_required() && '' == $value ) {
133
+ $result->invalidate( $tag, wpcf7_get_message( 'invalid_required' ) );
 
 
 
 
 
 
134
  }
135
  }
136
 
137
+ if ( ! empty( $value ) ) {
138
+ $maxlength = $tag->get_maxlength_option();
139
+ $minlength = $tag->get_minlength_option();
140
 
141
+ if ( $maxlength && $minlength && $maxlength < $minlength ) {
142
+ $maxlength = $minlength = null;
143
+ }
144
 
145
+ $code_units = wpcf7_count_code_units( $value );
146
 
147
+ if ( false !== $code_units ) {
148
+ if ( $maxlength && $maxlength < $code_units ) {
149
+ $result->invalidate( $tag, wpcf7_get_message( 'invalid_too_long' ) );
150
+ } elseif ( $minlength && $code_units < $minlength ) {
151
+ $result->invalidate( $tag, wpcf7_get_message( 'invalid_too_short' ) );
152
+ }
153
+ }
154
  }
 
155
 
156
+ return $result;
 
157
  }
158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
159
 
 
 
 
160
 
 
 
 
161
 
162
+ if ( is_admin() ) {
163
+ add_action( 'admin_init', 'wpcf7dtx_add_tag_generator_dynamictext', 25 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
164
  }
165
 
166
+ function wpcf7dtx_add_tag_generator_dynamictext() {
167
 
168
+ $tag_generator = WPCF7_TagGenerator::get_instance();
169
+ $tag_generator->add( 'dynamictext', __( 'dynamic text', 'contact-form-7' ),
170
+ 'wpcf7dtx_tag_generator_dynamictext' );
 
 
 
 
 
 
171
 
172
+ $tag_generator->add( 'dynamichidden', __( 'dynamic hidden', 'contact-form-7' ),
173
+ 'wpcf7dtx_tag_generator_dynamictext' );
174
+ }
 
175
 
 
 
176
 
177
+ function wpcf7dtx_tag_generator_dynamictext( $contact_form , $args = '' ){
178
+ $args = wp_parse_args( $args, array() );
179
+ $type = $args['id'];
 
 
 
180
 
181
+ $description;
182
 
 
 
 
 
 
183
 
184
+ switch( $type ){
185
+ case 'dynamictext':
186
+ $description = __( "Generate a form-tag for a single-line plain text input field, with a dynamically generated default value.", 'contact-form-7' );
187
+ //$type = 'text';
188
+ break;
189
+ case 'dynamichidden':
190
+ $description = __( "Generate a form-tag for a hidden input field, with a dynamically generated default value.", 'contact-form-7' );
191
+ //$type = 'hidden';
192
+ break;
193
+ default:
194
+ //$type = 'text';
195
+ break;
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
+
 
 
 
 
 
 
 
 
 
 
 
200
 
 
 
 
201
 
 
202
  ?>
203
+ <div class="control-box">
204
+ <fieldset>
205
+ <legend><?php echo $description; ?></legend>
206
+
207
+ <table class="form-table">
208
+ <tbody>
209
+ <tr>
210
+ <th scope="row"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></th>
211
+ <td>
212
+ <fieldset>
213
+ <legend class="screen-reader-text"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend>
214
+ <label><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field', 'contact-form-7' ) ); ?></label>
215
+ </fieldset>
216
+ </td>
217
+ </tr>
218
+
219
+ <tr>
220
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-name' ); ?>"><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?></label></th>
221
+ <td><input type="text" name="name" class="tg-name oneline" id="<?php echo esc_attr( $args['content'] . '-name' ); ?>" /></td>
222
+ </tr>
223
+
224
+ <tr>
225
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-values' ); ?>"><?php echo esc_html( __( 'Dynamic value', 'contact-form-7' ) ); ?></label></th>
226
+ <td><input type="text" name="values" class="oneline" id="<?php echo esc_attr( $args['content'] . '-values' ); ?>" /><br />
227
+ <?php _e( 'You can enter any short code. Just leave out the square brackets (<code>[]</code>) and only use single quotes (<code>\'</code> not <code>"</code>). <br/>So <code>[shortcode attribute="value"]</code> becomes <code>shortcode attribute=\'value\'</code>', 'contact-form-7' ); ?></td>
228
+ </tr>
229
+
230
+ <tr>
231
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th>
232
+ <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
233
+ </tr>
234
+
235
+ <tr>
236
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th>
237
+ <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
238
+ </tr>
239
+
240
+ </tbody>
241
  </table>
242
+ </fieldset>
243
+ </div>
244
 
245
+ <div class="insert-box">
246
+ <input type="text" name="<?php echo $type; ?>" class="tag code" readonly="readonly" onfocus="this.select()" />
 
 
 
 
 
247
 
248
+ <div class="submitbox">
249
+ <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" />
250
+ </div>
 
 
251
 
252
+ <br class="clear" />
253
 
 
 
254
  </div>
255
  <?php
256
  }
258
 
259
 
260
 
261
+
262
+
263
  /*****************************************************
264
  * CF7 DTX Included Shortcodes
265
  *
333
  /* Insert the current URL */
334
  function cf7_url(){
335
  $pageURL = 'http';
336
+ if( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on"){ $pageURL .= "s"; }
337
+
338
  $pageURL .= "://";
339
+
340
+ if( isset( $_SERVER["SERVER_PORT"] ) && $_SERVER["SERVER_PORT"] != "80" ){
341
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
342
  } else {
343
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
344
  }
345
+ return $pageURL;
346
  }
347
  add_shortcode('CF7_URL', 'cf7_url');
348
 
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: sevenspark
3
  Donate link: http://bit.ly/bVogDN
4
  Tags: Contact Form 7, Contact, Contact Form, dynamic, text, input, GET, POST, title, slug
5
- Requires at least: 3.8
6
- Tested up to: 3.9
7
- Stable tag: 1.2
8
 
9
  This plugin provides 2 new tag types for the Contact Form 7 Plugin. It allows the dynamic generation of content for a text input box via any shortcode.
10
  It also offers dynamic hidden field functionality, which can be utilized to dynamically set the Email Recipient (To:) address.
@@ -189,6 +189,10 @@ None. Yet.
189
 
190
  == Changelog ==
191
 
 
 
 
 
192
  = 1.2 =
193
  * Compatibility update for Contact Form 7 v3.9
194
 
@@ -226,7 +230,5 @@ None. Yet.
226
 
227
 
228
  == Upgrade Notice ==
229
- 1.0.4.2 fixes a bug that occurs when JavaScript is disabled and a form item doesn't validate on the first try
230
- 1.0.4.1 fixes a "Headers already sent" error that can occur for some users.
231
 
232
- 1.0.4 upgrade includes hidden field capability and two new shortcodes - current user info and custom post fields.
2
  Contributors: sevenspark
3
  Donate link: http://bit.ly/bVogDN
4
  Tags: Contact Form 7, Contact, Contact Form, dynamic, text, input, GET, POST, title, slug
5
+ Requires at least: 4.0
6
+ Tested up to: 4.2.4
7
+ Stable tag: 2.0
8
 
9
  This plugin provides 2 new tag types for the Contact Form 7 Plugin. It allows the dynamic generation of content for a text input box via any shortcode.
10
  It also offers dynamic hidden field functionality, which can be utilized to dynamically set the Email Recipient (To:) address.
189
 
190
  == Changelog ==
191
 
192
+ = 2.0 =
193
+
194
+ * Complete rewrite for Compatibility with Contact Form 7 v4
195
+
196
  = 1.2 =
197
  * Compatibility update for Contact Form 7 v3.9
198
 
230
 
231
 
232
  == Upgrade Notice ==
 
 
233
 
234
+ 2.0 complete rewrite for compatibility with latest Contact Form 7
screenshot-1.jpg CHANGED
Binary file