Contact Form 7 Dynamic Text Extension - Version 1.1.0.1

Version Description

  • Removed undefined variable warning
Download this release

Release Info

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

Code changes from version 1.1 to 1.1.0.1

contact-form-7-dynamic-text-extension.php CHANGED
@@ -4,7 +4,7 @@
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.1
8
  Author: Chris Mavricos, SevenSpark
9
  Author URI: http://sevenspark.com
10
  License: GPL2
@@ -281,7 +281,7 @@ function wpcf7_dynamichidden_shortcode_handler( $tag ) {
281
  //if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
282
  // $validation_error = $wpcf7_contact_form->validation_error( $name );
283
 
284
- $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
285
 
286
  return $html;
287
  }
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.1.0.1
8
  Author: Chris Mavricos, SevenSpark
9
  Author URI: http://sevenspark.com
10
  License: GPL2
281
  //if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
282
  // $validation_error = $wpcf7_contact_form->validation_error( $name );
283
 
284
+ $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . '</span>';
285
 
286
  return $html;
287
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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: 2.9
6
  Tested up to: 3.8
7
- Stable tag: 1.1
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,9 @@ None. Yet.
189
 
190
  == Changelog ==
191
 
 
 
 
192
  = 1.1 =
193
  * Updated for compatibility with Contact Form 7 v3.6
194
  * Added Referrer shortcode
4
  Tags: Contact Form 7, Contact, Contact Form, dynamic, text, input, GET, POST, title, slug
5
  Requires at least: 2.9
6
  Tested up to: 3.8
7
+ Stable tag: 1.1.0.1
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
+ = 1.1.0.1 =
193
+ * Removed undefined variable warning
194
+
195
  = 1.1 =
196
  * Updated for compatibility with Contact Form 7 v3.6
197
  * Added Referrer shortcode
trunk/contact-form-7-dynamic-text-extension.php DELETED
@@ -1,506 +0,0 @@
1
- <?php
2
-
3
- /*
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.1
8
- Author: Chris Mavricos, SevenSpark
9
- Author URI: http://sevenspark.com
10
- License: GPL2
11
- */
12
-
13
- /* Copyright 2010-2014 Chris Mavricos, SevenSpark (email : chris@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
17
- published by the Free Software Foundation.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program; if not, write to the Free Software
26
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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
- global $wpcf7_contact_form;
59
-
60
- if ( ! is_array( $tag ) )
61
- return '';
62
-
63
- $type = $tag['type'];
64
- $name = $tag['name'];
65
- $options = (array) $tag['options'];
66
- $values = (array) $tag['values'];
67
-
68
- if ( empty( $name ) )
69
- return '';
70
-
71
- $atts = '';
72
- $id_att = '';
73
- $class_att = '';
74
- $size_att = '';
75
- $maxlength_att = '';
76
- $tabindex_att = '';
77
-
78
- $class_att .= ' wpcf7-text';
79
-
80
- if ( 'dynamictext*' == $type )
81
- $class_att .= ' wpcf7-validates-as-required';
82
-
83
- foreach ( $options as $option ) {
84
- if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
85
- $id_att = $matches[1];
86
-
87
- } elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
88
- $class_att .= ' ' . $matches[1];
89
-
90
- } elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
91
- $size_att = (int) $matches[1];
92
- $maxlength_att = (int) $matches[2];
93
-
94
- } elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
95
- $tabindex_att = (int) $matches[1];
96
-
97
- }
98
- }
99
-
100
- if ( $id_att )
101
- $atts .= ' id="' . trim( $id_att ) . '"';
102
-
103
- if ( $class_att )
104
- $atts .= ' class="' . trim( $class_att ) . '"';
105
-
106
- if ( $size_att )
107
- $atts .= ' size="' . $size_att . '"';
108
- else
109
- $atts .= ' size="40"'; // default size
110
-
111
- if ( $maxlength_att )
112
- $atts .= ' maxlength="' . $maxlength_att . '"';
113
-
114
- if ( '' !== $tabindex_att )
115
- $atts .= sprintf( ' tabindex="%d"', $tabindex_att );
116
-
117
- // Value
118
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) && $wpcf7_contact_form->is_posted() ) {
119
- if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['ok'] )
120
- $value = '';
121
- else
122
- $value = stripslashes_deep( $_POST[$name] );
123
- } else {
124
- $value = isset( $values[0] ) ? $values[0] : '';
125
- }
126
-
127
- $scval = do_shortcode('['.$value.']');
128
- if($scval != '['.$value.']') $value = $scval;
129
-
130
- //echo '<pre>'; print_r($options);echo '</pre>';
131
- $readonly = '';
132
- if(in_array('uneditable', $options)){
133
- $readonly = 'readonly="readonly"';
134
- }
135
-
136
- $html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' '. $readonly.' />';
137
-
138
- $validation_error = '';
139
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
140
- $validation_error = $wpcf7_contact_form->validation_error( $name );
141
-
142
- $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
143
-
144
- return $html;
145
- }
146
-
147
-
148
- /* Validation filter */
149
-
150
- function wpcf7_dynamictext_validation_filter( $result, $tag ) {
151
- global $wpcf7_contact_form;
152
-
153
- $type = $tag['type'];
154
- $name = $tag['name'];
155
-
156
- $_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
157
-
158
- if ( 'dynamictext*' == $type ) {
159
- if ( '' == $_POST[$name] ) {
160
- $result['valid'] = false;
161
- $result['reason'][$name] = $wpcf7_contact_form->message( 'invalid_required' );
162
- }
163
- }
164
-
165
- return $result;
166
- }
167
-
168
-
169
- /* Tag generator */
170
-
171
- function wpcf7_add_tag_generator_dynamictext() {
172
- if(function_exists('wpcf7_add_tag_generator')){
173
- wpcf7_add_tag_generator( 'dynamictext', __( 'Dynamic Text field', 'wpcf7' ),
174
- 'wpcf7-tg-pane-dynamictext', 'wpcf7_tg_pane_dynamictext_' );
175
- }
176
- }
177
-
178
- function wpcf7_tg_pane_dynamictext_( &$contact_form ) {
179
- wpcf7_tg_pane_dynamictext( 'dynamictext' );
180
- }
181
-
182
- function wpcf7_tg_pane_dynamictext( $type = 'dynamictext' ) {
183
- ?>
184
- <div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
185
- <form action="">
186
- <table>
187
- <tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
188
- <tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
189
- </table>
190
-
191
- <table>
192
- <tr>
193
- <td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
194
- <input type="text" name="id" class="idvalue oneline option" /></td>
195
-
196
- <td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
197
- <input type="text" name="class" class="classvalue oneline option" /></td>
198
- </tr>
199
-
200
- <tr>
201
- <td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
202
- <input type="text" name="size" class="numeric oneline option" /></td>
203
-
204
- <td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
205
- <input type="text" name="maxlength" class="numeric oneline option" /></td>
206
- </tr>
207
-
208
- <tr>
209
- <td>
210
- <input type="checkbox" name="uneditable" class="option" />&nbsp;<?php echo esc_html( __( "Make this field Uneditable", 'wpcf7' ) ); ?><br />
211
- </td>
212
-
213
- <td><?php echo esc_html( __( 'Dynamic value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" />
214
- <?php echo esc_html( __( 'You can enter any short code. Just leave out the square brackets ([]) and only use single quotes (\' not ")', 'wpcf7' )); ?>
215
- </td>
216
- </tr>
217
- </table>
218
-
219
- <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>
220
-
221
- <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>
222
- </form>
223
- </div>
224
- <?php
225
- }
226
-
227
-
228
- /*************************************************************
229
- * DynamicHidden Shortcode
230
- *************************************************************/
231
- function wpcf7_dynamichidden_shortcode_handler( $tag ) {
232
- global $wpcf7_contact_form;
233
-
234
- if ( ! is_array( $tag ) )
235
- return '';
236
-
237
- $type = $tag['type'];
238
- $name = $tag['name'];
239
- $options = (array) $tag['options'];
240
- $values = (array) $tag['values'];
241
-
242
- if ( empty( $name ) )
243
- return '';
244
-
245
- $atts = '';
246
- $id_att = '';
247
- $class_att = '';
248
- $size_att = '';
249
- $maxlength_att = '';
250
- $tabindex_att = '';
251
-
252
- $class_att .= ' wpcf7-text';
253
-
254
- foreach ( $options as $option ) {
255
- if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
256
- $id_att = $matches[1];
257
- }
258
- }
259
-
260
- if ( $id_att )
261
- $atts .= ' id="' . trim( $id_att ) . '"';
262
-
263
- // Value
264
- if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) && $wpcf7_contact_form->is_posted() ) {
265
- if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['ok'] )
266
- $value = '';
267
- else
268
- $value = stripslashes_deep( $_POST[$name] );
269
- } else {
270
- $value = isset( $values[0] ) ? $values[0] : '';
271
- }
272
-
273
- $scval = do_shortcode('['.$value.']');
274
- if($scval != '['.$value.']') $value = $scval;
275
- //echo '<pre>'; print_r($options);echo '</pre>';
276
-
277
- $html = '<input type="hidden" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
278
-
279
- //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
280
- //$validation_error = '';
281
- //if ( is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
282
- // $validation_error = $wpcf7_contact_form->validation_error( $name );
283
-
284
- $html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
285
-
286
- return $html;
287
- }
288
-
289
-
290
- /* Tag generator */
291
-
292
- function wpcf7_add_tag_generator_dynamichidden() {
293
- if(function_exists('wpcf7_add_tag_generator')){
294
- wpcf7_add_tag_generator( 'dynamichidden', __( 'Dynamic Hidden field', 'wpcf7' ),
295
- 'wpcf7-tg-pane-dynamichidden', 'wpcf7_tg_pane_dynamichidden_' );
296
- }
297
- }
298
-
299
- function wpcf7_tg_pane_dynamichidden_( &$contact_form ) {
300
- wpcf7_tg_pane_dynamichidden( 'dynamichidden' );
301
- }
302
-
303
- function wpcf7_tg_pane_dynamichidden( $type = 'dynamichidden' ) {
304
- ?>
305
- <div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
306
- <form action="">
307
- <table>
308
- <tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
309
- </table>
310
-
311
- <table>
312
- <tr>
313
- <td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
314
- <input type="text" name="id" class="idvalue oneline option" /></td>
315
- </tr>
316
-
317
- <tr>
318
-
319
- <td><?php echo esc_html( __( 'Dynamic value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" />
320
- <?php echo esc_html( __( 'You can enter any short code. Just leave out the square brackets ([]) and only use single quotes (\' not ")', 'wpcf7' )); ?>
321
- </td>
322
- </tr>
323
- </table>
324
-
325
- <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>
326
-
327
- <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>
328
- </form>
329
- </div>
330
- <?php
331
- }
332
-
333
-
334
-
335
-
336
- /*****************************************************
337
- * CF7 DTX Included Shortcodes
338
- *
339
- * Used like this:
340
- *
341
- * CF7_GET val='value'
342
- *
343
- * No [] and single quotes ' rather than double "
344
- *
345
- *****************************************************/
346
-
347
- /* Insert a $_GET variable */
348
- function cf7_get($atts){
349
- extract(shortcode_atts(array(
350
- 'key' => 0,
351
- ), $atts));
352
- $value = '';
353
- if( isset( $_GET[$key] ) ){
354
- $value = urldecode($_GET[$key]);
355
- }
356
- return $value;
357
- }
358
- add_shortcode('CF7_GET', 'cf7_get');
359
-
360
- /* See http://codex.wordpress.org/Function_Reference/get_bloginfo */
361
- function cf7_bloginfo($atts){
362
- extract(shortcode_atts(array(
363
- 'show' => 'name'
364
- ), $atts));
365
-
366
- return get_bloginfo($show);
367
- }
368
- add_shortcode('CF7_bloginfo', 'cf7_bloginfo');
369
-
370
- /* Insert a $_POST variable (submitted form value)*/
371
- function cf7_post($atts){
372
- extract(shortcode_atts(array(
373
- 'key' => -1,
374
- ), $atts));
375
- if($key == -1) return '';
376
- $val = '';
377
- if( isset( $_POST[$key] ) ){
378
- $val = $_POST[$key];
379
- }
380
- return $val;
381
- }
382
- add_shortcode('CF7_POST', 'cf7_post');
383
-
384
- /* Insert a $post (Blog Post) Variable */
385
- function cf7_get_post_var($atts){
386
- extract(shortcode_atts(array(
387
- 'key' => 'post_title',
388
- ), $atts));
389
-
390
- switch($key){
391
- case 'slug':
392
- $key = 'post_name';
393
- break;
394
- case 'title':
395
- $key = 'post_title';
396
- break;
397
- }
398
-
399
- global $post;
400
- //echo '<pre>'; print_r($post); echo '</pre>';
401
- $val = $post->$key;
402
- return $val;
403
- }
404
- add_shortcode('CF7_get_post_var', 'cf7_get_post_var');
405
-
406
- /* Insert the current URL */
407
- function cf7_url(){
408
- $pageURL = 'http';
409
- if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
410
- $pageURL .= "://";
411
- if ($_SERVER["SERVER_PORT"] != "80") {
412
- $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
413
- } else {
414
- $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
415
- }
416
- return $pageURL;
417
- }
418
- add_shortcode('CF7_URL', 'cf7_url');
419
-
420
- /* Insert a Custom Post Field
421
- * New in 1.0.4
422
- */
423
- function cf7_get_custom_field($atts){
424
- extract(shortcode_atts(array(
425
- 'key' => '',
426
- 'post_id' => -1,
427
- 'obfuscate' => 'off'
428
- ), $atts));
429
-
430
- if($post_id < 0){
431
- global $post;
432
- if(isset($post)) $post_id = $post->ID;
433
- }
434
-
435
- if($post_id < 0 || empty($key)) return '';
436
-
437
- $val = get_post_meta($post_id, $key, true);
438
-
439
- if($obfuscate == 'on'){
440
- $val = cf7dtx_obfuscate($val);
441
- }
442
-
443
- return $val;
444
-
445
- }
446
- add_shortcode('CF7_get_custom_field', 'cf7_get_custom_field');
447
-
448
- /* Insert information about the current user
449
- * New in 1.0.4
450
- * See http://codex.wordpress.org/Function_Reference/get_currentuserinfo
451
- */
452
- function cf7_get_current_user($atts){
453
- extract(shortcode_atts(array(
454
- 'key' => 'user_login',
455
- ), $atts));
456
-
457
- global $current_user;
458
- get_currentuserinfo();
459
-
460
- $val = $current_user->$key;
461
- return $val;
462
- }
463
- add_shortcode('CF7_get_current_user', 'cf7_get_current_user');
464
-
465
-
466
-
467
- function cf7_get_referrer( $atts ){
468
- return isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '';
469
- }
470
- add_shortcode( 'CF7_referrer' , 'cf7_get_referrer' );
471
-
472
-
473
- function cf7dtx_obfuscate($val){
474
- $link = '';
475
- foreach(str_split($val) as $letter)
476
- $link .= '&#'.ord($letter).';';
477
- return $link;
478
- }
479
-
480
- function cf7dtx_cf7com_links() {
481
- $links = '<div class="cf7com-links">'
482
- . '<a href="' . esc_url_raw( __( 'http://contactform7.com/', 'wpcf7' ) ) . '" target="_blank">'
483
- . esc_html( __( 'Contactform7.com', 'wpcf7' ) ) . '</a>&ensp;'
484
- . '<a href="' . esc_url_raw( __( 'http://contactform7.com/docs/', 'wpcf7' ) ) . '" target="_blank">'
485
- . esc_html( __( 'Docs', 'wpcf7' ) ) . '</a> - '
486
- . '<a href="' . esc_url_raw( __( 'http://contactform7.com/faq/', 'wpcf7' ) ) . '" target="_blank">'
487
- . esc_html( __( 'FAQ', 'wpcf7' ) ) . '</a> - '
488
- . '<a href="' . esc_url_raw( __( 'http://contactform7.com/support/', 'wpcf7' ) ) . '" target="_blank">'
489
- . esc_html( __( 'Support', 'wpcf7' ) ) . '</a>'
490
- . ' - <a href="'. esc_url_raw( __( 'http://sevenspark.com/wordpress-plugins/contact-form-7-dynamic-text-extension', 'wpcf7') )
491
- . '" target="_blank">'.__( 'Dynamic Text Extension' , 'wpcf7').'</a> by <a href="' . esc_url_raw( __( 'http://sevenspark.com', 'wpcf7') ).'" target="_blank">'
492
- . esc_html( __( 'SevenSpark', 'wpcf7' ) ). '</a> <a href="'.esc_url_raw( __('http://bit.ly/bVogDN')).'" target="_blank">'
493
- . esc_html( __( '[Donate]')).'</a>'
494
- . '</div>';
495
- return $links;
496
- }
497
- add_filter('wpcf7_cf7com_links', 'cf7dtx_cf7com_links');
498
-
499
- /*function obf($atts){
500
- extract(shortcode_atts(array(
501
- 'val' => ''
502
- ), $atts));
503
- return $val.' : '. cf7dtx_obfuscate($val);
504
- }
505
- add_shortcode('obf', 'obf');*/
506
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/readme.txt DELETED
@@ -1,223 +0,0 @@
1
- === Contact Form 7 Dynamic Text Extension ===
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: 2.9
6
- Tested up to: 3.8
7
- Stable tag: 1.1
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.
11
-
12
- == Description ==
13
-
14
- Contact Form 7 is an excellent WordPress plugin, and the CF7 DTX Plugin makes it even more awesome by adding dynamic content capabilities.
15
- While default values in Contact Form 7 are static. CF7 DTX lets you create pre-populated fields based on other values. Some examples might include:
16
-
17
- * Auto-filling a URL
18
- * Auto-filling a Post ID, title, or slug
19
- * Pre-populating a Product Number
20
- * Referencing other content on the site
21
- * Populating with post info
22
- * Populating with user info
23
- * Populating with custom fields
24
- * Any value you can write a shortcode for
25
-
26
- There are many more case-specific examples. I searched for a solution, and there are some decent hacks out there. Many of them are
27
- explored in this forum topic:
28
- [Contact Form 7 Input Fields Values as PHP Get-Viarables](http://wordpress.org/support/topic/contact-form-7-input-fields-values-as-php-get-viarables).
29
- However, they all involved hacking the current Contact Form 7 code, which means next time the plugin is updated their edits will be
30
- overwritten. That's bad.
31
-
32
- This Dynamic Text Extension plugin provides a more elegant solution that leaves the Contact Form 7 Plugin intact.
33
-
34
- = WHAT DOES IT DO? =
35
-
36
- This plugin provides a new tag type for the Contact Form 7 Plugin. It allows the dynamic generation of content for a text input box via any shortcode.
37
- For example, it comes with several built-in shortcodes that will allow the Contact Form to be populated from any $_GET PHP variable or any info from the
38
- get_bloginfo() function, among others. See below for included shortcodes.
39
-
40
- = HOW TO USE IT =
41
-
42
- After installing and activating the plugin, the Contact Form 7 tag generator will have 2 new tag types: Dynamic Text Field and Dynamic Hidden Field. Most of the options will be
43
- familiar to Contact Form 7 users. There are two important fields:
44
-
45
- **Dynamic Value**
46
-
47
- This field takes a shortcode, with two important provisions:
48
-
49
- 1. The shortcode should NOT include the normal square brackets ([ and ]). So, instead of [CF7_GET key='value'] you would use CF7_GET key='value' .
50
- 2. Any parameters in the shortcode must use single quotes. That is: CF7_GET key='value' and not CF7_GET key="value"
51
-
52
-
53
- **Uneditable Option**
54
-
55
- As these types of fields should often remain uneditable by the user, there is a checkbox to turn this option on (Not applicable for hidden fields).
56
-
57
-
58
- = INCLUDED SHORTCODES =
59
-
60
- The plugin includes 2 basic shortcodes for use with the Dynamic Text extension. You can write your own as well - any shortcode will work
61
-
62
- **PHP GET Variables**
63
-
64
- Want to use a variable from the PHP GET array? Just use the CF7_GET shortcode. For example, if you want to get the foo parameter from the url
65
- http://mysite.com?foo=bar
66
-
67
- Enter the following into the "Dynamic Value" input
68
-
69
- CF7_GET key='foo'
70
-
71
- Your Content Form 7 Tag will look something like this:
72
-
73
- [dynamictext dynamicname "CF7_GET key='foo'"]
74
-
75
- Your form's dynamicname text input will then be pre-populated with the value of foo, in this case, bar
76
-
77
-
78
- **PHP POST Variables**
79
-
80
- New in version 1.0.3!
81
-
82
- Grab variables from the $_POST array. The shortcode is much like the GET shortcode:
83
-
84
- CF7_POST key='foo'
85
-
86
- Your Content Form 7 Tag will look something like this:
87
-
88
- [dynamictext dynamicname "CF7_POST key='foo'"]
89
-
90
-
91
- **Blog Info**
92
-
93
- Want to grab some information from your blog like the URL or the sitename? Use the CF7_bloginfo shortcode. For example, to get the site's URL:
94
-
95
- Enter the following into the "Dynamic Value" input
96
-
97
- CF7_bloginfo show='url'
98
-
99
- Your Content Form 7 Tag will look something like this:
100
-
101
- [dynamictext dynamicname "CF7_bloginfo show='url'"]
102
-
103
- Your form's dynamicname text input will then be pre-populated with your site's URL
104
-
105
-
106
- **Post Info**
107
-
108
- New in version 1.0.3!
109
-
110
- Retrieve information about the current post/page (that the contact form is displayed on). The shortcode works as follows:
111
-
112
- CF7_get_post_var key='title' <-- retrieves the Post's Title
113
- CF7_get_post_var key='slug' <-- retrieves the Post's Slug
114
-
115
- You can also retrieve any parameter from the $post object. Just set that as the key value, for example 'post_date'
116
-
117
- The Contact Form 7 Tag would look like:
118
-
119
- [dynamictext dynamicname "CF7_get_post_var key='title'"]
120
-
121
- **Current URL**
122
-
123
- New in version 1.0.3!
124
-
125
- Retrieve the current URL. The shortcode takes no parameters:
126
-
127
- CF7_URL
128
-
129
- So your Contact Form 7 Tag would look like:
130
-
131
- [dynamictext dynamicname "CF7_URL"]
132
-
133
- **Custom Fields**
134
-
135
- New in version 1.0.4!
136
-
137
- Retrieve custom fields from the current post/page. Just set the custom field as the key in the shortcode.
138
-
139
- The dynamic value input becomes:
140
-
141
- CF7_get_custom_field key='my_custom_field'
142
-
143
- And the tag looks like this:
144
-
145
- [dynamictext dynamicname "CF7_get_custom_field key='my_custom_field'"]
146
-
147
- For the purposes of including an email address, you can obfuscate the custom field value by setting obfuscate='on' in the shortcode.
148
-
149
- **Current User Info**
150
-
151
- Get data about the current user - assuming they are logged in. Defaults to user name, but you can set the key to any valid value in
152
- http://codex.wordpress.org/Function_Reference/get_currentuserinfo
153
-
154
- CF7_get_current_user
155
-
156
- [dynamictext dynamicname "CF7_get_current_user"]
157
-
158
- **Referrer URL**
159
-
160
- Get the referral URL, if it exists. Note that this is not necessarily reliable as not all browsers send this data.
161
-
162
- [dynamictext dynamicname "CF7_referrer"]
163
-
164
-
165
- Like the Dynamic Text Extension? Please consider supporting its development by [Donating](http://bit.ly/bVogDN).
166
-
167
- Or check out my upcoming premium plugin, [UberMenu - WordPress Mega Menu Plugin](http://wpmegamenu.com)
168
-
169
-
170
- == Installation ==
171
-
172
- This section describes how to install the plugin and get it working.
173
-
174
- 1. Download and install the Contact Form 7 Plugin located at http://wordpress.org/extend/plugins/contact-form-7/
175
- 1. Upload the plugin folder to the '/wp-content/plugins/' directory
176
- 1. Activate the plugin through the 'Plugins' menu in WordPress
177
- 1. You will now have a "Dynamic Text" tag option in the Contact Form 7 tag generator
178
-
179
-
180
- == Frequently Asked Questions ==
181
-
182
- None. Yet.
183
-
184
-
185
- == Screenshots ==
186
-
187
- 1. The new Dynamic Text Field options.
188
-
189
-
190
- == Changelog ==
191
-
192
- = 1.1 =
193
- * Updated for compatibility with Contact Form 7 v3.6
194
- * Added Referrer shortcode
195
-
196
- = 1.0.4.2 =
197
- * Fixed a bug that created repeating square brackets around dynamic text values in cases where the form doesn't validate and JavaScript is deactivated.
198
-
199
- = 1.0.4.1 =
200
- * Removed trailing whitespace to fix "Headers already sent" errors
201
-
202
- = 1.0.4 =
203
- * Added Current User Info shortcode
204
- * Added Post Custom Field shortcode (with obfuscation support)
205
- * Added Hidden Field capability
206
-
207
- = 1.0.3 =
208
- * Added $_POST shortcode
209
- * Added current post/page variable shortcode
210
- * Added current URL shortcode
211
-
212
- = 1.0.2 =
213
- * Fixed administrative control panel dependency issue
214
-
215
- = 1.0.1 =
216
- * Fixed dependency issue.
217
-
218
-
219
- == Upgrade Notice ==
220
- 1.0.4.2 fixes a bug that occurs when JavaScript is disabled and a form item doesn't validate on the first try
221
- 1.0.4.1 fixes a "Headers already sent" error that can occur for some users.
222
-
223
- 1.0.4 upgrade includes hidden field capability and two new shortcodes - current user info and custom post fields.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/screenshot-1.jpg DELETED
Binary file