Version Description
Download this release
Release Info
Developer | takayukister |
Plugin | Contact Form 7 |
Version | 3.4 |
Comparing to | |
See all releases |
Code changes from version 3.3.3 to 3.4
- admin/css/styles.css +9 -2
- admin/includes/meta-boxes.php +1 -1
- admin/js/taggenerator.js +15 -11
- includes/capabilities.php +2 -0
- includes/classes.php +45 -17
- includes/controller.php +1 -1
- includes/css/styles.css +1 -1
- includes/formatting.php +29 -0
- includes/functions.php +33 -45
- includes/js/jquery.form.js +104 -61
- includes/js/jquery.form.min.js +2 -2
- includes/js/scripts.js +16 -10
- includes/shortcodes.php +164 -7
- languages/wpcf7-ja.mo +0 -0
- languages/wpcf7.pot +292 -199
- modules/acceptance.php +30 -48
- modules/captcha.php +76 -87
- modules/checkbox.php +70 -77
- modules/date.php +201 -0
- modules/file.php +60 -63
- modules/number.php +211 -0
- modules/quiz.php +36 -55
- modules/select.php +47 -52
- modules/special-mail-tags.php +0 -28
- modules/submit.php +18 -30
- modules/text.php +134 -82
- modules/textarea.php +48 -73
- readme.txt +16 -49
- settings.php +8 -0
- wp-contact-form-7.php +3 -3
admin/css/styles.css
CHANGED
@@ -67,6 +67,7 @@ div.actions-link input {
|
|
67 |
border: none;
|
68 |
font-size: 11px;
|
69 |
cursor: pointer;
|
|
|
70 |
}
|
71 |
|
72 |
div.actions-link input.copy {
|
@@ -150,6 +151,11 @@ label.disabled {
|
|
150 |
color: #777;
|
151 |
}
|
152 |
|
|
|
|
|
|
|
|
|
|
|
153 |
div.tag-generator {
|
154 |
position: relative;
|
155 |
background: transparent;
|
@@ -219,12 +225,13 @@ div.tg-pane input.tg-name {
|
|
219 |
}
|
220 |
|
221 |
div.tg-pane input.oneline {
|
222 |
-
width:
|
223 |
font-size: smaller;
|
|
|
224 |
}
|
225 |
|
226 |
div.tg-pane textarea {
|
227 |
-
width:
|
228 |
height: 100px;
|
229 |
font-size: smaller;
|
230 |
}
|
67 |
border: none;
|
68 |
font-size: 11px;
|
69 |
cursor: pointer;
|
70 |
+
background: inherit;
|
71 |
}
|
72 |
|
73 |
div.actions-link input.copy {
|
151 |
color: #777;
|
152 |
}
|
153 |
|
154 |
+
#messagesdiv div.inside {
|
155 |
+
height: 28em;
|
156 |
+
overflow: auto;
|
157 |
+
}
|
158 |
+
|
159 |
div.tag-generator {
|
160 |
position: relative;
|
161 |
background: transparent;
|
225 |
}
|
226 |
|
227 |
div.tg-pane input.oneline {
|
228 |
+
width: 94%;
|
229 |
font-size: smaller;
|
230 |
+
-moz-box-sizing: border-box;
|
231 |
}
|
232 |
|
233 |
div.tg-pane textarea {
|
234 |
+
width: 94%;
|
235 |
height: 100px;
|
236 |
font-size: smaller;
|
237 |
}
|
admin/includes/meta-boxes.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
function wpcf7_form_meta_box( $post ) {
|
6 |
?>
|
7 |
-
<div class="half-left"><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="
|
8 |
|
9 |
<div class="half-right"><div id="taggenerator"></div></div>
|
10 |
|
4 |
|
5 |
function wpcf7_form_meta_box( $post ) {
|
6 |
?>
|
7 |
+
<div class="half-left"><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24"><?php echo esc_textarea( $post->form ); ?></textarea></div>
|
8 |
|
9 |
<div class="half-right"><div id="taggenerator"></div></div>
|
10 |
|
admin/js/taggenerator.js
CHANGED
@@ -129,7 +129,7 @@
|
|
129 |
|
130 |
pane.find(':input.numeric').each(function(i) {
|
131 |
var val = $(this).val();
|
132 |
-
val = val.replace(/[^0-9]/g, '');
|
133 |
$(this).val(val);
|
134 |
});
|
135 |
|
@@ -168,7 +168,7 @@
|
|
168 |
|
169 |
pane.find(':input.date').each(function(i) {
|
170 |
var val = $(this).val();
|
171 |
-
if (! val.match(/^\d{4}-\d{
|
172 |
$(this).val('');
|
173 |
});
|
174 |
|
@@ -192,18 +192,22 @@
|
|
192 |
|
193 |
var options = [];
|
194 |
|
195 |
-
var size = scope.find(':input[name="size"]').val();
|
196 |
-
var maxlength = scope.find(':input[name="maxlength"]').val();
|
197 |
-
|
198 |
-
|
199 |
|
200 |
-
|
201 |
-
|
202 |
-
if (cols || rows)
|
203 |
options.push(cols + 'x' + rows);
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
-
|
206 |
-
if (-1 < $.inArray($(this).attr('name'), ['size', 'maxlength', 'cols', 'rows']))
|
207 |
return;
|
208 |
|
209 |
var val = $(this).val();
|
129 |
|
130 |
pane.find(':input.numeric').each(function(i) {
|
131 |
var val = $(this).val();
|
132 |
+
val = val.replace(/[^0-9.-]/g, '');
|
133 |
$(this).val(val);
|
134 |
});
|
135 |
|
168 |
|
169 |
pane.find(':input.date').each(function(i) {
|
170 |
var val = $(this).val();
|
171 |
+
if (! val.match(/^\d{4}-\d{2}-\d{2}$/)) // 'yyyy-mm-dd' ISO 8601 format
|
172 |
$(this).val('');
|
173 |
});
|
174 |
|
192 |
|
193 |
var options = [];
|
194 |
|
195 |
+
var size = scope.find(':input[name="size"]').val() || '';
|
196 |
+
var maxlength = scope.find(':input[name="maxlength"]').val() || '';
|
197 |
+
var cols = scope.find(':input[name="cols"]').val() || '';
|
198 |
+
var rows = scope.find(':input[name="rows"]').val() || '';
|
199 |
|
200 |
+
if ((cols || rows) && maxlength)
|
201 |
+
options.push(cols + 'x' + rows + '/' + maxlength);
|
202 |
+
else if (cols || rows)
|
203 |
options.push(cols + 'x' + rows);
|
204 |
+
else if (size || maxlength)
|
205 |
+
options.push(size + '/' + maxlength);
|
206 |
+
|
207 |
+
scope.find('input.option').not(':checkbox,:radio').each(function(i) {
|
208 |
+
var excluded = ['size', 'maxlength', 'cols', 'rows'];
|
209 |
|
210 |
+
if (-1 < $.inArray($(this).attr('name'), excluded))
|
|
|
211 |
return;
|
212 |
|
213 |
var val = $(this).val();
|
includes/capabilities.php
CHANGED
@@ -9,6 +9,8 @@ function wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ) {
|
|
9 |
'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,
|
10 |
'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
11 |
|
|
|
|
|
12 |
$caps = array_diff( $caps, array_keys( $meta_caps ) );
|
13 |
|
14 |
if ( isset( $meta_caps[$cap] ) )
|
9 |
'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,
|
10 |
'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
11 |
|
12 |
+
$meta_caps = apply_filters( 'wpcf7_map_meta_cap', $meta_caps );
|
13 |
+
|
14 |
$caps = array_diff( $caps, array_keys( $meta_caps ) );
|
15 |
|
16 |
if ( isset( $meta_caps[$cap] ) )
|
includes/classes.php
CHANGED
@@ -58,6 +58,12 @@ class WPCF7_ContactForm {
|
|
58 |
public function __construct( $post = null ) {
|
59 |
$this->initial = true;
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
$post = get_post( $post );
|
62 |
|
63 |
if ( $post && self::post_type == get_post_type( $post ) ) {
|
@@ -149,8 +155,12 @@ class WPCF7_ContactForm {
|
|
149 |
|
150 |
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
151 |
|
|
|
|
|
|
|
152 |
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
|
153 |
-
. ' class="' . esc_attr( $class ) . '"'
|
|
|
154 |
|
155 |
$form .= $this->form_hidden_fields();
|
156 |
|
@@ -390,6 +400,8 @@ class WPCF7_ContactForm {
|
|
390 |
|
391 |
} else {
|
392 |
$result['message'] = $this->message( 'mail_sent_ng' );
|
|
|
|
|
393 |
}
|
394 |
|
395 |
if ( $ajax ) {
|
@@ -572,8 +584,22 @@ class WPCF7_ContactForm {
|
|
572 |
if ( $matches[1] == '[' && $matches[3] == ']' )
|
573 |
return substr( $matches[0], 1, -1 );
|
574 |
|
575 |
-
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
|
578 |
if ( is_array( $submitted ) )
|
579 |
$replaced = join( ', ', $submitted );
|
@@ -585,15 +611,18 @@ class WPCF7_ContactForm {
|
|
585 |
$replaced = wptexturize( $replaced );
|
586 |
}
|
587 |
|
588 |
-
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced,
|
|
|
589 |
|
590 |
return stripslashes( $replaced );
|
591 |
}
|
592 |
|
593 |
-
|
|
|
|
|
594 |
return $special;
|
595 |
|
596 |
-
return $
|
597 |
}
|
598 |
|
599 |
/* Message */
|
@@ -644,17 +673,16 @@ class WPCF7_ContactForm {
|
|
644 |
/* Upgrade */
|
645 |
|
646 |
function upgrade() {
|
647 |
-
if (
|
648 |
-
$this->mail['recipient']
|
649 |
-
|
650 |
-
|
651 |
-
if ( ! is_array( $this->messages ) )
|
652 |
-
$this->messages = array();
|
653 |
-
|
654 |
|
655 |
-
|
656 |
-
|
657 |
-
$this->messages[$key]
|
|
|
|
|
658 |
}
|
659 |
}
|
660 |
|
@@ -834,7 +862,7 @@ function wpcf7_scan_shortcode( $cond = null ) {
|
|
834 |
|
835 |
function wpcf7_form_controls_class( $type, $default = '' ) {
|
836 |
$type = trim( $type );
|
837 |
-
$default = explode( ' ', $default );
|
838 |
|
839 |
$classes = array_merge( array( 'wpcf7-form-control' ), $default );
|
840 |
|
58 |
public function __construct( $post = null ) {
|
59 |
$this->initial = true;
|
60 |
|
61 |
+
$this->form = '';
|
62 |
+
$this->mail = array();
|
63 |
+
$this->mail_2 = array();
|
64 |
+
$this->messages = array();
|
65 |
+
$this->additional_settings = '';
|
66 |
+
|
67 |
$post = get_post( $post );
|
68 |
|
69 |
if ( $post && self::post_type == get_post_type( $post ) ) {
|
155 |
|
156 |
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
157 |
|
158 |
+
$novalidate = apply_filters( 'wpcf7_form_novalidate',
|
159 |
+
wpcf7_support_html5() ? ' novalidate="novalidate"' : '' );
|
160 |
+
|
161 |
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
|
162 |
+
. ' class="' . esc_attr( $class ) . '"'
|
163 |
+
. $enctype . $novalidate . '>' . "\n";
|
164 |
|
165 |
$form .= $this->form_hidden_fields();
|
166 |
|
400 |
|
401 |
} else {
|
402 |
$result['message'] = $this->message( 'mail_sent_ng' );
|
403 |
+
|
404 |
+
do_action_ref_array( 'wpcf7_mail_failed', array( &$this ) );
|
405 |
}
|
406 |
|
407 |
if ( $ajax ) {
|
584 |
if ( $matches[1] == '[' && $matches[3] == ']' )
|
585 |
return substr( $matches[0], 1, -1 );
|
586 |
|
587 |
+
$tag = $matches[0];
|
588 |
+
$tagname = $matches[2];
|
589 |
+
|
590 |
+
$do_not_heat = false;
|
591 |
+
|
592 |
+
if ( preg_match( '/^_raw_(.+)$/', $tagname, $matches ) ) {
|
593 |
+
$tagname = trim( $matches[1] );
|
594 |
+
$do_not_heat = true;
|
595 |
+
}
|
596 |
+
|
597 |
+
if ( isset( $this->posted_data[$tagname] ) ) {
|
598 |
+
|
599 |
+
if ( $do_not_heat )
|
600 |
+
$submitted = isset( $_POST[$tagname] ) ? $_POST[$tagname] : '';
|
601 |
+
else
|
602 |
+
$submitted = $this->posted_data[$tagname];
|
603 |
|
604 |
if ( is_array( $submitted ) )
|
605 |
$replaced = join( ', ', $submitted );
|
611 |
$replaced = wptexturize( $replaced );
|
612 |
}
|
613 |
|
614 |
+
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced,
|
615 |
+
$submitted, $html );
|
616 |
|
617 |
return stripslashes( $replaced );
|
618 |
}
|
619 |
|
620 |
+
$special = apply_filters( 'wpcf7_special_mail_tags', '', $tagname, $html );
|
621 |
+
|
622 |
+
if ( ! empty( $special ) )
|
623 |
return $special;
|
624 |
|
625 |
+
return $tag;
|
626 |
}
|
627 |
|
628 |
/* Message */
|
673 |
/* Upgrade */
|
674 |
|
675 |
function upgrade() {
|
676 |
+
if ( is_array( $this->mail ) ) {
|
677 |
+
if ( ! isset( $this->mail['recipient'] ) )
|
678 |
+
$this->mail['recipient'] = get_option( 'admin_email' );
|
679 |
+
}
|
|
|
|
|
|
|
680 |
|
681 |
+
if ( is_array( $this->messages ) ) {
|
682 |
+
foreach ( wpcf7_messages() as $key => $arr ) {
|
683 |
+
if ( ! isset( $this->messages[$key] ) )
|
684 |
+
$this->messages[$key] = $arr['default'];
|
685 |
+
}
|
686 |
}
|
687 |
}
|
688 |
|
862 |
|
863 |
function wpcf7_form_controls_class( $type, $default = '' ) {
|
864 |
$type = trim( $type );
|
865 |
+
$default = array_filter( explode( ' ', $default ) );
|
866 |
|
867 |
$classes = array_merge( array( 'wpcf7-form-control' ), $default );
|
868 |
|
includes/controller.php
CHANGED
@@ -228,7 +228,7 @@ function wpcf7_enqueue_scripts() {
|
|
228 |
wp_deregister_script( 'jquery-form' );
|
229 |
wp_register_script( 'jquery-form',
|
230 |
wpcf7_plugin_url( 'includes/js/jquery.form.min.js' ),
|
231 |
-
array( 'jquery' ), '3.
|
232 |
|
233 |
$in_footer = true;
|
234 |
if ( 'header' === WPCF7_LOAD_JS )
|
228 |
wp_deregister_script( 'jquery-form' );
|
229 |
wp_register_script( 'jquery-form',
|
230 |
wpcf7_plugin_url( 'includes/js/jquery.form.min.js' ),
|
231 |
+
array( 'jquery' ), '3.32.0-2013.04.03', true );
|
232 |
|
233 |
$in_footer = true;
|
234 |
if ( 'header' === WPCF7_LOAD_JS )
|
includes/css/styles.css
CHANGED
@@ -60,6 +60,6 @@ div.wpcf7 img.ajax-loader {
|
|
60 |
margin-left: 4px;
|
61 |
}
|
62 |
|
63 |
-
div.wpcf7 .
|
64 |
color: #888;
|
65 |
}
|
60 |
margin-left: 4px;
|
61 |
}
|
62 |
|
63 |
+
div.wpcf7 .placeheld {
|
64 |
color: #888;
|
65 |
}
|
includes/formatting.php
CHANGED
@@ -118,4 +118,33 @@ function wpcf7_sanitize_unit_tag( $tag ) {
|
|
118 |
return $tag;
|
119 |
}
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
?>
|
118 |
return $tag;
|
119 |
}
|
120 |
|
121 |
+
function wpcf7_is_email( $email ) {
|
122 |
+
$result = is_email( $email );
|
123 |
+
return apply_filters( 'wpcf7_is_email', $result, $email );
|
124 |
+
}
|
125 |
+
|
126 |
+
function wpcf7_is_url( $url ) {
|
127 |
+
$result = ( false !== filter_var( $url, FILTER_VALIDATE_URL ) );
|
128 |
+
return apply_filters( 'wpcf7_is_url', $result, $url );
|
129 |
+
}
|
130 |
+
|
131 |
+
function wpcf7_is_tel( $tel ) {
|
132 |
+
$result = preg_match( '/^[0-9+-]*$/', $tel );
|
133 |
+
return apply_filters( 'wpcf7_is_tel', $result, $tel );
|
134 |
+
}
|
135 |
+
|
136 |
+
function wpcf7_is_number( $number ) {
|
137 |
+
$result = is_numeric( $number );
|
138 |
+
return apply_filters( 'wpcf7_is_number', $result, $number );
|
139 |
+
}
|
140 |
+
|
141 |
+
function wpcf7_is_date( $date ) {
|
142 |
+
$result = preg_match( '/^([0-9]{4,})-([0-9]{2})-([0-9]{2})$/', $date, $matches );
|
143 |
+
|
144 |
+
if ( $result )
|
145 |
+
$result = checkdate( $matches[2], $matches[3], $matches[1] );
|
146 |
+
|
147 |
+
return apply_filters( 'wpcf7_is_date', $result, $date );
|
148 |
+
}
|
149 |
+
|
150 |
?>
|
includes/functions.php
CHANGED
@@ -51,11 +51,6 @@ function wpcf7_messages() {
|
|
51 |
'default' => __( 'Please accept the terms to proceed.', 'wpcf7' )
|
52 |
),
|
53 |
|
54 |
-
'invalid_email' => array(
|
55 |
-
'description' => __( "Email address that the sender entered is invalid", 'wpcf7' ),
|
56 |
-
'default' => __( 'Email address seems invalid.', 'wpcf7' )
|
57 |
-
),
|
58 |
-
|
59 |
'invalid_required' => array(
|
60 |
'description' => __( "There is a field that the sender must fill in", 'wpcf7' ),
|
61 |
'default' => __( 'Please fill the required field.', 'wpcf7' )
|
@@ -135,47 +130,11 @@ function wpcf7_default_messages_template() {
|
|
135 |
}
|
136 |
|
137 |
function wpcf7_upload_dir( $type = false ) {
|
138 |
-
|
139 |
-
|
140 |
-
$siteurl = get_option( 'siteurl' );
|
141 |
-
$upload_path = trim( get_option( 'upload_path' ) );
|
142 |
-
|
143 |
-
$main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
|
144 |
-
|
145 |
-
if ( empty( $upload_path ) ) {
|
146 |
-
$dir = WP_CONTENT_DIR . '/uploads';
|
147 |
-
} else {
|
148 |
-
$dir = $upload_path;
|
149 |
-
|
150 |
-
if ( 'wp-content/uploads' == $upload_path ) {
|
151 |
-
$dir = WP_CONTENT_DIR . '/uploads';
|
152 |
-
} elseif ( 0 !== strpos( $dir, ABSPATH ) ) {
|
153 |
-
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
|
154 |
-
$dir = path_join( ABSPATH, $dir );
|
155 |
-
}
|
156 |
-
}
|
157 |
-
|
158 |
-
if ( ! $url = get_option( 'upload_url_path' ) ) {
|
159 |
-
if ( empty( $upload_path )
|
160 |
-
|| ( 'wp-content/uploads' == $upload_path )
|
161 |
-
|| ( $upload_path == $dir ) )
|
162 |
-
$url = WP_CONTENT_URL . '/uploads';
|
163 |
-
else
|
164 |
-
$url = trailingslashit( $siteurl ) . $upload_path;
|
165 |
-
}
|
166 |
-
|
167 |
-
if ( defined( 'UPLOADS' ) && ! $main_override
|
168 |
-
&& ( ! isset( $switched ) || $switched === false ) ) {
|
169 |
-
$dir = ABSPATH . UPLOADS;
|
170 |
-
$url = trailingslashit( $siteurl ) . UPLOADS;
|
171 |
-
|
172 |
-
if ( is_multisite() && defined( 'BLOGUPLOADDIR' ) ) {
|
173 |
-
$dir = untrailingslashit( BLOGUPLOADDIR );
|
174 |
-
$url = str_replace( UPLOADS, 'files', $url );
|
175 |
-
}
|
176 |
-
}
|
177 |
|
178 |
-
$uploads = apply_filters( 'wpcf7_upload_dir', array(
|
|
|
|
|
179 |
|
180 |
if ( 'dir' == $type )
|
181 |
return $uploads['dir'];
|
@@ -308,4 +267,33 @@ function wpcf7_array_flatten( $input ) {
|
|
308 |
return $output;
|
309 |
}
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
?>
|
51 |
'default' => __( 'Please accept the terms to proceed.', 'wpcf7' )
|
52 |
),
|
53 |
|
|
|
|
|
|
|
|
|
|
|
54 |
'invalid_required' => array(
|
55 |
'description' => __( "There is a field that the sender must fill in", 'wpcf7' ),
|
56 |
'default' => __( 'Please fill the required field.', 'wpcf7' )
|
130 |
}
|
131 |
|
132 |
function wpcf7_upload_dir( $type = false ) {
|
133 |
+
$uploads = wp_upload_dir();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
+
$uploads = apply_filters( 'wpcf7_upload_dir', array(
|
136 |
+
'dir' => $uploads['basedir'],
|
137 |
+
'url' => $uploads['baseurl'] ) );
|
138 |
|
139 |
if ( 'dir' == $type )
|
140 |
return $uploads['dir'];
|
267 |
return $output;
|
268 |
}
|
269 |
|
270 |
+
function wpcf7_support_html5() {
|
271 |
+
return (bool) apply_filters( 'wpcf7_support_html5', true );
|
272 |
+
}
|
273 |
+
|
274 |
+
function wpcf7_format_atts( $atts ) {
|
275 |
+
$html = '';
|
276 |
+
|
277 |
+
$prioritized_atts = array( 'type', 'name', 'value' );
|
278 |
+
|
279 |
+
foreach ( $prioritized_atts as $att ) {
|
280 |
+
if ( isset( $atts[$att] ) ) {
|
281 |
+
$value = trim( $atts[$att] );
|
282 |
+
$html .= sprintf( ' %s="%s"', $att, esc_attr( $value ) );
|
283 |
+
unset( $atts[$att] );
|
284 |
+
}
|
285 |
+
}
|
286 |
+
|
287 |
+
foreach ( $atts as $key => $value ) {
|
288 |
+
$value = trim( $value );
|
289 |
+
|
290 |
+
if ( '' !== $value )
|
291 |
+
$html .= sprintf( ' %s="%s"', $key, esc_attr( $value ) );
|
292 |
+
}
|
293 |
+
|
294 |
+
$html = trim( $html );
|
295 |
+
|
296 |
+
return $html;
|
297 |
+
}
|
298 |
+
|
299 |
?>
|
includes/js/jquery.form.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*!
|
2 |
* jQuery Form Plugin
|
3 |
-
* version: 3.
|
4 |
* @requires jQuery v1.5 or later
|
5 |
*
|
6 |
* Examples and documentation at: http://malsup.com/jquery/form/
|
@@ -9,7 +9,7 @@
|
|
9 |
* http://malsup.github.com/mit-license.txt
|
10 |
* http://malsup.github.com/gpl-license-v2.txt
|
11 |
*/
|
12 |
-
/*global ActiveXObject
|
13 |
;(function($) {
|
14 |
"use strict";
|
15 |
|
@@ -37,7 +37,7 @@
|
|
37 |
target: '#output'
|
38 |
});
|
39 |
});
|
40 |
-
|
41 |
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
|
42 |
form does not have to exist when you invoke ajaxForm:
|
43 |
|
@@ -45,7 +45,7 @@
|
|
45 |
delegation: true,
|
46 |
target: '#output'
|
47 |
});
|
48 |
-
|
49 |
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
50 |
at the appropriate time.
|
51 |
*/
|
@@ -57,6 +57,21 @@ var feature = {};
|
|
57 |
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
|
58 |
feature.formdata = window.FormData !== undefined;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
/**
|
61 |
* ajaxSubmit() provides a mechanism for immediately submitting
|
62 |
* an HTML form using AJAX.
|
@@ -69,15 +84,16 @@ $.fn.ajaxSubmit = function(options) {
|
|
69 |
log('ajaxSubmit: skipping submit process - no element selected');
|
70 |
return this;
|
71 |
}
|
72 |
-
|
73 |
var method, action, url, $form = this;
|
74 |
|
75 |
if (typeof options == 'function') {
|
76 |
options = { success: options };
|
77 |
}
|
78 |
|
79 |
-
method = this.
|
80 |
-
action = this.
|
|
|
81 |
url = (typeof action === 'string') ? $.trim(action) : '';
|
82 |
url = url || window.location.href || '';
|
83 |
if (url) {
|
@@ -111,7 +127,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
111 |
if ( traditional === undefined ) {
|
112 |
traditional = $.ajaxSettings.traditional;
|
113 |
}
|
114 |
-
|
115 |
var elements = [];
|
116 |
var qx, a = this.formToArray(options.semantic, elements);
|
117 |
if (options.data) {
|
@@ -135,7 +151,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
135 |
var q = $.param(a, traditional);
|
136 |
if (qx) {
|
137 |
q = ( q ? (q + '&' + qx) : qx );
|
138 |
-
}
|
139 |
if (options.type.toUpperCase() == 'GET') {
|
140 |
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
141 |
options.data = null; // data is null for 'get'
|
@@ -165,7 +181,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
165 |
}
|
166 |
|
167 |
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
168 |
-
var context = options.context || this ; // jQuery 1.4+ supports scope context
|
169 |
for (var i=0, max=callbacks.length; i < max; i++) {
|
170 |
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
171 |
}
|
@@ -175,7 +191,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
175 |
|
176 |
// [value] (issue #113), also see comment:
|
177 |
// https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
|
178 |
-
var fileInputs = $('input[type=file]:enabled[value!=""]', this);
|
179 |
|
180 |
var hasFileInputs = fileInputs.length > 0;
|
181 |
var mp = 'multipart/form-data';
|
@@ -222,13 +238,14 @@ $.fn.ajaxSubmit = function(options) {
|
|
222 |
function deepSerialize(extraData){
|
223 |
var serialized = $.param(extraData).split('&');
|
224 |
var len = serialized.length;
|
225 |
-
var result =
|
226 |
var i, part;
|
227 |
for (i=0; i < len; i++) {
|
228 |
// #252; undo param space replacement
|
229 |
serialized[i] = serialized[i].replace(/\+/g,' ');
|
230 |
part = serialized[i].split('=');
|
231 |
-
|
|
|
232 |
}
|
233 |
return result;
|
234 |
}
|
@@ -243,9 +260,9 @@ $.fn.ajaxSubmit = function(options) {
|
|
243 |
|
244 |
if (options.extraData) {
|
245 |
var serializedData = deepSerialize(options.extraData);
|
246 |
-
for (
|
247 |
-
if (serializedData
|
248 |
-
formdata.append(
|
249 |
}
|
250 |
|
251 |
options.data = null;
|
@@ -256,13 +273,13 @@ $.fn.ajaxSubmit = function(options) {
|
|
256 |
cache: false,
|
257 |
type: method || 'POST'
|
258 |
});
|
259 |
-
|
260 |
if (options.uploadProgress) {
|
261 |
// workaround because jqXHR does not expose upload property
|
262 |
s.xhr = function() {
|
263 |
var xhr = jQuery.ajaxSettings.xhr();
|
264 |
if (xhr.upload) {
|
265 |
-
xhr.upload.
|
266 |
var percent = 0;
|
267 |
var position = event.loaded || event.position; /*event.position is deprecated*/
|
268 |
var total = event.total;
|
@@ -270,7 +287,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
270 |
percent = Math.ceil(position / total * 100);
|
271 |
}
|
272 |
options.uploadProgress(event, position, total, percent);
|
273 |
-
};
|
274 |
}
|
275 |
return xhr;
|
276 |
};
|
@@ -289,22 +306,13 @@ $.fn.ajaxSubmit = function(options) {
|
|
289 |
// private function for handling file uploads (hat tip to YAHOO!)
|
290 |
function fileUploadIframe(a) {
|
291 |
var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
|
292 |
-
var useProp = !!$.fn.prop;
|
293 |
var deferred = $.Deferred();
|
294 |
|
295 |
-
if ($('[name=submit],[id=submit]', form).length) {
|
296 |
-
// if there is an input with a name or id of 'submit' then we won't be
|
297 |
-
// able to invoke the submit fn on the form (at least not x-browser)
|
298 |
-
alert('Error: Form elements must not have name or id of "submit".');
|
299 |
-
deferred.reject();
|
300 |
-
return deferred;
|
301 |
-
}
|
302 |
-
|
303 |
if (a) {
|
304 |
// ensure that every serialized input is still enabled
|
305 |
for (i=0; i < elements.length; i++) {
|
306 |
el = $(elements[i]);
|
307 |
-
if (
|
308 |
el.prop('disabled', false);
|
309 |
else
|
310 |
el.removeAttr('disabled');
|
@@ -316,9 +324,9 @@ $.fn.ajaxSubmit = function(options) {
|
|
316 |
id = 'jqFormIO' + (new Date().getTime());
|
317 |
if (s.iframeTarget) {
|
318 |
$io = $(s.iframeTarget);
|
319 |
-
n = $io.
|
320 |
if (!n)
|
321 |
-
$io.
|
322 |
else
|
323 |
id = n;
|
324 |
}
|
@@ -347,7 +355,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
347 |
if (io.contentWindow.document.execCommand) {
|
348 |
io.contentWindow.document.execCommand('Stop');
|
349 |
}
|
350 |
-
}
|
351 |
catch(ignore) {}
|
352 |
|
353 |
$io.attr('src', s.iframeSrc); // abort op in progress
|
@@ -395,15 +403,44 @@ $.fn.ajaxSubmit = function(options) {
|
|
395 |
}
|
396 |
}
|
397 |
}
|
398 |
-
|
399 |
var CLIENT_TIMEOUT_ABORT = 1;
|
400 |
var SERVER_ABORT = 2;
|
401 |
-
|
402 |
function getDoc(frame) {
|
403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
404 |
return doc;
|
405 |
}
|
406 |
-
|
407 |
// Rails CSRF hack (thanks to Yvan Barthelemy)
|
408 |
var csrf_token = $('meta[name=csrf-token]').attr('content');
|
409 |
var csrf_param = $('meta[name=csrf-param]').attr('content');
|
@@ -415,7 +452,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
415 |
// take a breath so that pending repaints get some cpu time before the upload starts
|
416 |
function doSubmit() {
|
417 |
// make sure form attrs are set
|
418 |
-
var t = $form.
|
419 |
|
420 |
// update form attrs in IE friendly way
|
421 |
form.setAttribute('target',id);
|
@@ -438,7 +475,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
438 |
if (s.timeout) {
|
439 |
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
|
440 |
}
|
441 |
-
|
442 |
// look for server aborts
|
443 |
function checkState() {
|
444 |
try {
|
@@ -485,7 +522,14 @@ $.fn.ajaxSubmit = function(options) {
|
|
485 |
io.addEventListener('load', cb, false);
|
486 |
}
|
487 |
setTimeout(checkState,15);
|
488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
490 |
finally {
|
491 |
// reset attrs and remove "extra" input elements
|
@@ -512,11 +556,10 @@ $.fn.ajaxSubmit = function(options) {
|
|
512 |
if (xhr.aborted || callbackProcessed) {
|
513 |
return;
|
514 |
}
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
log('cannot access response document: ', ex);
|
520 |
e = SERVER_ABORT;
|
521 |
}
|
522 |
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
|
@@ -537,7 +580,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
537 |
}
|
538 |
if (io.detachEvent)
|
539 |
io.detachEvent('onload', cb);
|
540 |
-
else
|
541 |
io.removeEventListener('load', cb, false);
|
542 |
|
543 |
var status = 'success', errMsg;
|
@@ -607,15 +650,15 @@ $.fn.ajaxSubmit = function(options) {
|
|
607 |
try {
|
608 |
data = httpData(xhr, dt, s);
|
609 |
}
|
610 |
-
catch (
|
611 |
status = 'parsererror';
|
612 |
-
xhr.error = errMsg = (
|
613 |
}
|
614 |
}
|
615 |
-
catch (
|
616 |
-
log('error caught: ',
|
617 |
status = 'error';
|
618 |
-
xhr.error = errMsg = (
|
619 |
}
|
620 |
|
621 |
if (xhr.aborted) {
|
@@ -728,7 +771,7 @@ $.fn.ajaxSubmit = function(options) {
|
|
728 |
$.fn.ajaxForm = function(options) {
|
729 |
options = options || {};
|
730 |
options.delegation = options.delegation && $.isFunction($.fn.on);
|
731 |
-
|
732 |
// in jQuery 1.3+ we can fix mistakes with the ready state
|
733 |
if (!options.delegation && this.length === 0) {
|
734 |
var o = { s: this.selector, c: this.context };
|
@@ -758,7 +801,7 @@ $.fn.ajaxForm = function(options) {
|
|
758 |
.bind('click.form-plugin', options, captureSubmittingElement);
|
759 |
};
|
760 |
|
761 |
-
// private event handlers
|
762 |
function doAjaxSubmit(e) {
|
763 |
/*jshint validthis:true */
|
764 |
var options = e.data;
|
@@ -767,7 +810,7 @@ function doAjaxSubmit(e) {
|
|
767 |
$(this).ajaxSubmit(options);
|
768 |
}
|
769 |
}
|
770 |
-
|
771 |
function captureSubmittingElement(e) {
|
772 |
/*jshint validthis:true */
|
773 |
var target = e.target;
|
@@ -832,13 +875,13 @@ $.fn.formToArray = function(semantic, elements) {
|
|
832 |
for(i=0, max=els.length; i < max; i++) {
|
833 |
el = els[i];
|
834 |
n = el.name;
|
835 |
-
if (!n) {
|
836 |
continue;
|
837 |
}
|
838 |
|
839 |
if (semantic && form.clk && el.type == "image") {
|
840 |
// handle image inputs on the fly when semantic == true
|
841 |
-
if(
|
842 |
a.push({name: n, value: $(el).val(), type: el.type });
|
843 |
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
844 |
}
|
@@ -847,14 +890,14 @@ $.fn.formToArray = function(semantic, elements) {
|
|
847 |
|
848 |
v = $.fieldValue(el, true);
|
849 |
if (v && v.constructor == Array) {
|
850 |
-
if (elements)
|
851 |
elements.push(el);
|
852 |
for(j=0, jmax=v.length; j < jmax; j++) {
|
853 |
a.push({name: n, value: v[j]});
|
854 |
}
|
855 |
}
|
856 |
-
else if (feature.fileapi && el.type == 'file'
|
857 |
-
if (elements)
|
858 |
elements.push(el);
|
859 |
var files = el.files;
|
860 |
if (files.length) {
|
@@ -868,7 +911,7 @@ $.fn.formToArray = function(semantic, elements) {
|
|
868 |
}
|
869 |
}
|
870 |
else if (v !== null && typeof v != 'undefined') {
|
871 |
-
if (elements)
|
872 |
elements.push(el);
|
873 |
a.push({name: n, value: v, type: el.type, required: el.required});
|
874 |
}
|
@@ -1047,7 +1090,7 @@ $.fn.clearFields = $.fn.clearInputs = function(includeHidden) {
|
|
1047 |
}
|
1048 |
else if (t == "file") {
|
1049 |
if (/MSIE/.test(navigator.userAgent)) {
|
1050 |
-
$(this).replaceWith($(this).clone());
|
1051 |
} else {
|
1052 |
$(this).val('');
|
1053 |
}
|
@@ -1118,7 +1161,7 @@ $.fn.ajaxSubmit.debug = false;
|
|
1118 |
|
1119 |
// helper fn for console logging
|
1120 |
function log() {
|
1121 |
-
if (!$.fn.ajaxSubmit.debug)
|
1122 |
return;
|
1123 |
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
1124 |
if (window.console && window.console.log) {
|
1 |
/*!
|
2 |
* jQuery Form Plugin
|
3 |
+
* version: 3.32.0-2013.04.03
|
4 |
* @requires jQuery v1.5 or later
|
5 |
*
|
6 |
* Examples and documentation at: http://malsup.com/jquery/form/
|
9 |
* http://malsup.github.com/mit-license.txt
|
10 |
* http://malsup.github.com/gpl-license-v2.txt
|
11 |
*/
|
12 |
+
/*global ActiveXObject */
|
13 |
;(function($) {
|
14 |
"use strict";
|
15 |
|
37 |
target: '#output'
|
38 |
});
|
39 |
});
|
40 |
+
|
41 |
You can also use ajaxForm with delegation (requires jQuery v1.7+), so the
|
42 |
form does not have to exist when you invoke ajaxForm:
|
43 |
|
45 |
delegation: true,
|
46 |
target: '#output'
|
47 |
});
|
48 |
+
|
49 |
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
50 |
at the appropriate time.
|
51 |
*/
|
57 |
feature.fileapi = $("<input type='file'/>").get(0).files !== undefined;
|
58 |
feature.formdata = window.FormData !== undefined;
|
59 |
|
60 |
+
var hasProp = !!$.fn.prop;
|
61 |
+
|
62 |
+
// attr2 uses prop when it can but checks the return type for
|
63 |
+
// an expected string. this accounts for the case where a form
|
64 |
+
// contains inputs with names like "action" or "method"; in those
|
65 |
+
// cases "prop" returns the element
|
66 |
+
$.fn.attr2 = function() {
|
67 |
+
if ( ! hasProp )
|
68 |
+
return this.attr.apply(this, arguments);
|
69 |
+
var val = this.prop.apply(this, arguments);
|
70 |
+
if ( ( val && val.jquery ) || typeof val === 'string' )
|
71 |
+
return val;
|
72 |
+
return this.attr.apply(this, arguments);
|
73 |
+
};
|
74 |
+
|
75 |
/**
|
76 |
* ajaxSubmit() provides a mechanism for immediately submitting
|
77 |
* an HTML form using AJAX.
|
84 |
log('ajaxSubmit: skipping submit process - no element selected');
|
85 |
return this;
|
86 |
}
|
87 |
+
|
88 |
var method, action, url, $form = this;
|
89 |
|
90 |
if (typeof options == 'function') {
|
91 |
options = { success: options };
|
92 |
}
|
93 |
|
94 |
+
method = this.attr2('method');
|
95 |
+
action = this.attr2('action');
|
96 |
+
|
97 |
url = (typeof action === 'string') ? $.trim(action) : '';
|
98 |
url = url || window.location.href || '';
|
99 |
if (url) {
|
127 |
if ( traditional === undefined ) {
|
128 |
traditional = $.ajaxSettings.traditional;
|
129 |
}
|
130 |
+
|
131 |
var elements = [];
|
132 |
var qx, a = this.formToArray(options.semantic, elements);
|
133 |
if (options.data) {
|
151 |
var q = $.param(a, traditional);
|
152 |
if (qx) {
|
153 |
q = ( q ? (q + '&' + qx) : qx );
|
154 |
+
}
|
155 |
if (options.type.toUpperCase() == 'GET') {
|
156 |
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
157 |
options.data = null; // data is null for 'get'
|
181 |
}
|
182 |
|
183 |
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
184 |
+
var context = options.context || this ; // jQuery 1.4+ supports scope context
|
185 |
for (var i=0, max=callbacks.length; i < max; i++) {
|
186 |
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
187 |
}
|
191 |
|
192 |
// [value] (issue #113), also see comment:
|
193 |
// https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
|
194 |
+
var fileInputs = $('input[type=file]:enabled[value!=""]', this);
|
195 |
|
196 |
var hasFileInputs = fileInputs.length > 0;
|
197 |
var mp = 'multipart/form-data';
|
238 |
function deepSerialize(extraData){
|
239 |
var serialized = $.param(extraData).split('&');
|
240 |
var len = serialized.length;
|
241 |
+
var result = [];
|
242 |
var i, part;
|
243 |
for (i=0; i < len; i++) {
|
244 |
// #252; undo param space replacement
|
245 |
serialized[i] = serialized[i].replace(/\+/g,' ');
|
246 |
part = serialized[i].split('=');
|
247 |
+
// #278; use array instead of object storage, favoring array serializations
|
248 |
+
result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]);
|
249 |
}
|
250 |
return result;
|
251 |
}
|
260 |
|
261 |
if (options.extraData) {
|
262 |
var serializedData = deepSerialize(options.extraData);
|
263 |
+
for (i=0; i < serializedData.length; i++)
|
264 |
+
if (serializedData[i])
|
265 |
+
formdata.append(serializedData[i][0], serializedData[i][1]);
|
266 |
}
|
267 |
|
268 |
options.data = null;
|
273 |
cache: false,
|
274 |
type: method || 'POST'
|
275 |
});
|
276 |
+
|
277 |
if (options.uploadProgress) {
|
278 |
// workaround because jqXHR does not expose upload property
|
279 |
s.xhr = function() {
|
280 |
var xhr = jQuery.ajaxSettings.xhr();
|
281 |
if (xhr.upload) {
|
282 |
+
xhr.upload.addEventListener('progress', function(event) {
|
283 |
var percent = 0;
|
284 |
var position = event.loaded || event.position; /*event.position is deprecated*/
|
285 |
var total = event.total;
|
287 |
percent = Math.ceil(position / total * 100);
|
288 |
}
|
289 |
options.uploadProgress(event, position, total, percent);
|
290 |
+
}, false);
|
291 |
}
|
292 |
return xhr;
|
293 |
};
|
306 |
// private function for handling file uploads (hat tip to YAHOO!)
|
307 |
function fileUploadIframe(a) {
|
308 |
var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
|
|
|
309 |
var deferred = $.Deferred();
|
310 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
311 |
if (a) {
|
312 |
// ensure that every serialized input is still enabled
|
313 |
for (i=0; i < elements.length; i++) {
|
314 |
el = $(elements[i]);
|
315 |
+
if ( hasProp )
|
316 |
el.prop('disabled', false);
|
317 |
else
|
318 |
el.removeAttr('disabled');
|
324 |
id = 'jqFormIO' + (new Date().getTime());
|
325 |
if (s.iframeTarget) {
|
326 |
$io = $(s.iframeTarget);
|
327 |
+
n = $io.attr2('name');
|
328 |
if (!n)
|
329 |
+
$io.attr2('name', id);
|
330 |
else
|
331 |
id = n;
|
332 |
}
|
355 |
if (io.contentWindow.document.execCommand) {
|
356 |
io.contentWindow.document.execCommand('Stop');
|
357 |
}
|
358 |
+
}
|
359 |
catch(ignore) {}
|
360 |
|
361 |
$io.attr('src', s.iframeSrc); // abort op in progress
|
403 |
}
|
404 |
}
|
405 |
}
|
406 |
+
|
407 |
var CLIENT_TIMEOUT_ABORT = 1;
|
408 |
var SERVER_ABORT = 2;
|
409 |
+
|
410 |
function getDoc(frame) {
|
411 |
+
/* it looks like contentWindow or contentDocument do not
|
412 |
+
* carry the protocol property in ie8, when running under ssl
|
413 |
+
* frame.document is the only valid response document, since
|
414 |
+
* the protocol is know but not on the other two objects. strange?
|
415 |
+
* "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy
|
416 |
+
*/
|
417 |
+
|
418 |
+
var doc = null;
|
419 |
+
|
420 |
+
// IE8 cascading access check
|
421 |
+
try {
|
422 |
+
if (frame.contentWindow) {
|
423 |
+
doc = frame.contentWindow.document;
|
424 |
+
}
|
425 |
+
} catch(err) {
|
426 |
+
// IE8 access denied under ssl & missing protocol
|
427 |
+
log('cannot get iframe.contentWindow document: ' + err);
|
428 |
+
}
|
429 |
+
|
430 |
+
if (doc) { // successful getting content
|
431 |
+
return doc;
|
432 |
+
}
|
433 |
+
|
434 |
+
try { // simply checking may throw in ie8 under ssl or mismatched protocol
|
435 |
+
doc = frame.contentDocument ? frame.contentDocument : frame.document;
|
436 |
+
} catch(err) {
|
437 |
+
// last attempt
|
438 |
+
log('cannot get iframe.contentDocument: ' + err);
|
439 |
+
doc = frame.document;
|
440 |
+
}
|
441 |
return doc;
|
442 |
}
|
443 |
+
|
444 |
// Rails CSRF hack (thanks to Yvan Barthelemy)
|
445 |
var csrf_token = $('meta[name=csrf-token]').attr('content');
|
446 |
var csrf_param = $('meta[name=csrf-param]').attr('content');
|
452 |
// take a breath so that pending repaints get some cpu time before the upload starts
|
453 |
function doSubmit() {
|
454 |
// make sure form attrs are set
|
455 |
+
var t = $form.attr2('target'), a = $form.attr2('action');
|
456 |
|
457 |
// update form attrs in IE friendly way
|
458 |
form.setAttribute('target',id);
|
475 |
if (s.timeout) {
|
476 |
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
|
477 |
}
|
478 |
+
|
479 |
// look for server aborts
|
480 |
function checkState() {
|
481 |
try {
|
522 |
io.addEventListener('load', cb, false);
|
523 |
}
|
524 |
setTimeout(checkState,15);
|
525 |
+
|
526 |
+
try {
|
527 |
+
form.submit();
|
528 |
+
} catch(err) {
|
529 |
+
// just in case form has element with name/id of 'submit'
|
530 |
+
var submitFn = document.createElement('form').submit;
|
531 |
+
submitFn.apply(form);
|
532 |
+
}
|
533 |
}
|
534 |
finally {
|
535 |
// reset attrs and remove "extra" input elements
|
556 |
if (xhr.aborted || callbackProcessed) {
|
557 |
return;
|
558 |
}
|
559 |
+
|
560 |
+
doc = getDoc(io);
|
561 |
+
if(!doc) {
|
562 |
+
log('cannot access response document');
|
|
|
563 |
e = SERVER_ABORT;
|
564 |
}
|
565 |
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
|
580 |
}
|
581 |
if (io.detachEvent)
|
582 |
io.detachEvent('onload', cb);
|
583 |
+
else
|
584 |
io.removeEventListener('load', cb, false);
|
585 |
|
586 |
var status = 'success', errMsg;
|
650 |
try {
|
651 |
data = httpData(xhr, dt, s);
|
652 |
}
|
653 |
+
catch (err) {
|
654 |
status = 'parsererror';
|
655 |
+
xhr.error = errMsg = (err || status);
|
656 |
}
|
657 |
}
|
658 |
+
catch (err) {
|
659 |
+
log('error caught: ',err);
|
660 |
status = 'error';
|
661 |
+
xhr.error = errMsg = (err || status);
|
662 |
}
|
663 |
|
664 |
if (xhr.aborted) {
|
771 |
$.fn.ajaxForm = function(options) {
|
772 |
options = options || {};
|
773 |
options.delegation = options.delegation && $.isFunction($.fn.on);
|
774 |
+
|
775 |
// in jQuery 1.3+ we can fix mistakes with the ready state
|
776 |
if (!options.delegation && this.length === 0) {
|
777 |
var o = { s: this.selector, c: this.context };
|
801 |
.bind('click.form-plugin', options, captureSubmittingElement);
|
802 |
};
|
803 |
|
804 |
+
// private event handlers
|
805 |
function doAjaxSubmit(e) {
|
806 |
/*jshint validthis:true */
|
807 |
var options = e.data;
|
810 |
$(this).ajaxSubmit(options);
|
811 |
}
|
812 |
}
|
813 |
+
|
814 |
function captureSubmittingElement(e) {
|
815 |
/*jshint validthis:true */
|
816 |
var target = e.target;
|
875 |
for(i=0, max=els.length; i < max; i++) {
|
876 |
el = els[i];
|
877 |
n = el.name;
|
878 |
+
if (!n || el.disabled) {
|
879 |
continue;
|
880 |
}
|
881 |
|
882 |
if (semantic && form.clk && el.type == "image") {
|
883 |
// handle image inputs on the fly when semantic == true
|
884 |
+
if(form.clk == el) {
|
885 |
a.push({name: n, value: $(el).val(), type: el.type });
|
886 |
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
887 |
}
|
890 |
|
891 |
v = $.fieldValue(el, true);
|
892 |
if (v && v.constructor == Array) {
|
893 |
+
if (elements)
|
894 |
elements.push(el);
|
895 |
for(j=0, jmax=v.length; j < jmax; j++) {
|
896 |
a.push({name: n, value: v[j]});
|
897 |
}
|
898 |
}
|
899 |
+
else if (feature.fileapi && el.type == 'file') {
|
900 |
+
if (elements)
|
901 |
elements.push(el);
|
902 |
var files = el.files;
|
903 |
if (files.length) {
|
911 |
}
|
912 |
}
|
913 |
else if (v !== null && typeof v != 'undefined') {
|
914 |
+
if (elements)
|
915 |
elements.push(el);
|
916 |
a.push({name: n, value: v, type: el.type, required: el.required});
|
917 |
}
|
1090 |
}
|
1091 |
else if (t == "file") {
|
1092 |
if (/MSIE/.test(navigator.userAgent)) {
|
1093 |
+
$(this).replaceWith($(this).clone(true));
|
1094 |
} else {
|
1095 |
$(this).val('');
|
1096 |
}
|
1161 |
|
1162 |
// helper fn for console logging
|
1163 |
function log() {
|
1164 |
+
if (!$.fn.ajaxSubmit.debug)
|
1165 |
return;
|
1166 |
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
1167 |
if (window.console && window.console.log) {
|
includes/js/jquery.form.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
/*!
|
2 |
* jQuery Form Plugin
|
3 |
-
* version: 3.
|
4 |
* @requires jQuery v1.5 or later
|
5 |
*
|
6 |
* Examples and documentation at: http://malsup.com/jquery/form/
|
@@ -9,4 +9,4 @@
|
|
9 |
* http://malsup.github.com/mit-license.txt
|
10 |
* http://malsup.github.com/gpl-license-v2.txt
|
11 |
*/
|
12 |
-
(function(e){var c={};c.fileapi=e("<input type='file'/>").get(0).files!==undefined;c.formdata=window.FormData!==undefined;e.fn.ajaxSubmit=function(h){if(!this.length){d("ajaxSubmit: skipping submit process - no element selected");return this}var g,y,j,m=this;if(typeof h=="function"){h={success:h}}g=this.attr("method");y=this.attr("action");j=(typeof y==="string")?e.trim(y):"";j=j||window.location.href||"";if(j){j=(j.match(/^([^#]+)/)||[])[1]}h=e.extend(true,{url:j,success:e.ajaxSettings.success,type:g||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},h);var s={};this.trigger("form-pre-serialize",[this,h,s]);if(s.veto){d("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(h.beforeSerialize&&h.beforeSerialize(this,h)===false){d("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var l=h.traditional;if(l===undefined){l=e.ajaxSettings.traditional}var p=[];var B,C=this.formToArray(h.semantic,p);if(h.data){h.extraData=h.data;B=e.param(h.data,l)}if(h.beforeSubmit&&h.beforeSubmit(C,this,h)===false){d("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[C,this,h,s]);if(s.veto){d("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var w=e.param(C,l);if(B){w=(w?(w+"&"+B):B)}if(h.type.toUpperCase()=="GET"){h.url+=(h.url.indexOf("?")>=0?"&":"?")+w;h.data=null}else{h.data=w}var E=[];if(h.resetForm){E.push(function(){m.resetForm()})}if(h.clearForm){E.push(function(){m.clearForm(h.includeHidden)})}if(!h.dataType&&h.target){var i=h.success||function(){};E.push(function(q){var k=h.replaceTarget?"replaceWith":"html";e(h.target)[k](q).each(i,arguments)})}else{if(h.success){E.push(h.success)}}h.success=function(H,q,I){var G=h.context||this;for(var F=0,k=E.length;F<k;F++){E[F].apply(G,[H,q,I||m,m])}};var A=e('input[type=file]:enabled[value!=""]',this);var n=A.length>0;var z="multipart/form-data";var v=(m.attr("enctype")==z||m.attr("encoding")==z);var u=c.fileapi&&c.formdata;d("fileAPI :"+u);var o=(n||v)&&!u;var t;if(h.iframe!==false&&(h.iframe||o)){if(h.closeKeepAlive){e.get(h.closeKeepAlive,function(){t=D(C)})}else{t=D(C)}}else{if((n||v)&&u){t=r(C)}else{t=e.ajax(h)}}m.removeData("jqxhr").data("jqxhr",t);for(var x=0;x<p.length;x++){p[x]=null}this.trigger("form-submit-notify",[this,h]);return this;function f(H){var I=e.param(H).split("&");var q=I.length;var k={};var G,F;for(G=0;G<q;G++){I[G]=I[G].replace(/\+/g," ");F=I[G].split("=");k[decodeURIComponent(F[0])]=decodeURIComponent(F[1])}return k}function r(q){var k=new FormData();for(var F=0;F<q.length;F++){k.append(q[F].name,q[F].value)}if(h.extraData){var I=f(h.extraData);for(var J in I){if(I.hasOwnProperty(J)){k.append(J,I[J])}}}h.data=null;var H=e.extend(true,{},e.ajaxSettings,h,{contentType:false,processData:false,cache:false,type:g||"POST"});if(h.uploadProgress){H.xhr=function(){var K=jQuery.ajaxSettings.xhr();if(K.upload){K.upload.onprogress=function(O){var N=0;var L=O.loaded||O.position;var M=O.total;if(O.lengthComputable){N=Math.ceil(L/M*100)}h.uploadProgress(O,L,M,N)}}return K}}H.data=null;var G=H.beforeSend;H.beforeSend=function(L,K){K.data=k;if(G){G.call(this,L,K)}};return e.ajax(H)}function D(ad){var I=m[0],H,Z,T,ab,W,K,O,M,N,X,aa,R;var L=!!e.fn.prop;var ag=e.Deferred();if(e("[name=submit],[id=submit]",I).length){alert('Error: Form elements must not have name or id of "submit".');ag.reject();return ag}if(ad){for(Z=0;Z<p.length;Z++){H=e(p[Z]);if(L){H.prop("disabled",false)}else{H.removeAttr("disabled")}}}T=e.extend(true,{},e.ajaxSettings,h);T.context=T.context||T;W="jqFormIO"+(new Date().getTime());if(T.iframeTarget){K=e(T.iframeTarget);X=K.attr("name");if(!X){K.attr("name",W)}else{W=X}}else{K=e('<iframe name="'+W+'" src="'+T.iframeSrc+'" />');K.css({position:"absolute",top:"-1000px",left:"-1000px"})}O=K[0];M={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(ah){var ai=(ah==="timeout"?"timeout":"aborted");d("aborting upload... "+ai);this.aborted=1;try{if(O.contentWindow.document.execCommand){O.contentWindow.document.execCommand("Stop")}}catch(aj){}K.attr("src",T.iframeSrc);M.error=ai;if(T.error){T.error.call(T.context,M,ai,ah)}if(ab){e.event.trigger("ajaxError",[M,T,ai])}if(T.complete){T.complete.call(T.context,M,ai)}}};ab=T.global;if(ab&&0===e.active++){e.event.trigger("ajaxStart")}if(ab){e.event.trigger("ajaxSend",[M,T])}if(T.beforeSend&&T.beforeSend.call(T.context,M,T)===false){if(T.global){e.active--}ag.reject();return ag}if(M.aborted){ag.reject();return ag}N=I.clk;if(N){X=N.name;if(X&&!N.disabled){T.extraData=T.extraData||{};T.extraData[X]=N.value;if(N.type=="image"){T.extraData[X+".x"]=I.clk_x;T.extraData[X+".y"]=I.clk_y}}}var S=1;var P=2;function Q(ai){var ah=ai.contentWindow?ai.contentWindow.document:ai.contentDocument?ai.contentDocument:ai.document;return ah}var G=e("meta[name=csrf-token]").attr("content");var F=e("meta[name=csrf-param]").attr("content");if(F&&G){T.extraData=T.extraData||{};T.extraData[F]=G}function Y(){var aj=m.attr("target"),ah=m.attr("action");I.setAttribute("target",W);if(!g){I.setAttribute("method","POST")}if(ah!=T.url){I.setAttribute("action",T.url)}if(!T.skipEncodingOverride&&(!g||/post/i.test(g))){m.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(T.timeout){R=setTimeout(function(){aa=true;V(S)},T.timeout)}function ak(){try{var am=Q(O).readyState;d("state = "+am);if(am&&am.toLowerCase()=="uninitialized"){setTimeout(ak,50)}}catch(an){d("Server abort: ",an," (",an.name,")");V(P);if(R){clearTimeout(R)}R=undefined}}var ai=[];try{if(T.extraData){for(var al in T.extraData){if(T.extraData.hasOwnProperty(al)){if(e.isPlainObject(T.extraData[al])&&T.extraData[al].hasOwnProperty("name")&&T.extraData[al].hasOwnProperty("value")){ai.push(e('<input type="hidden" name="'+T.extraData[al].name+'">').val(T.extraData[al].value).appendTo(I)[0])}else{ai.push(e('<input type="hidden" name="'+al+'">').val(T.extraData[al]).appendTo(I)[0])}}}}if(!T.iframeTarget){K.appendTo("body");if(O.attachEvent){O.attachEvent("onload",V)}else{O.addEventListener("load",V,false)}}setTimeout(ak,15);I.submit()}finally{I.setAttribute("action",ah);if(aj){I.setAttribute("target",aj)}else{m.removeAttr("target")}e(ai).remove()}}if(T.forceSync){Y()}else{setTimeout(Y,10)}var ae,af,ac=50,J;function V(am){if(M.aborted||J){return}try{af=Q(O)}catch(ap){d("cannot access response document: ",ap);am=P}if(am===S&&M){M.abort("timeout");ag.reject(M,"timeout");return}else{if(am==P&&M){M.abort("server abort");ag.reject(M,"error","server abort");return}}if(!af||af.location.href==T.iframeSrc){if(!aa){return}}if(O.detachEvent){O.detachEvent("onload",V)}else{O.removeEventListener("load",V,false)}var ak="success",ao;try{if(aa){throw"timeout"}var aj=T.dataType=="xml"||af.XMLDocument||e.isXMLDoc(af);d("isXml="+aj);if(!aj&&window.opera&&(af.body===null||!af.body.innerHTML)){if(--ac){d("requeing onLoad callback, DOM not available");setTimeout(V,250);return}}var aq=af.body?af.body:af.documentElement;M.responseText=aq?aq.innerHTML:null;M.responseXML=af.XMLDocument?af.XMLDocument:af;if(aj){T.dataType="xml"}M.getResponseHeader=function(au){var at={"content-type":T.dataType};return at[au]};if(aq){M.status=Number(aq.getAttribute("status"))||M.status;M.statusText=aq.getAttribute("statusText")||M.statusText}var ah=(T.dataType||"").toLowerCase();var an=/(json|script|text)/.test(ah);if(an||T.textarea){var al=af.getElementsByTagName("textarea")[0];if(al){M.responseText=al.value;M.status=Number(al.getAttribute("status"))||M.status;M.statusText=al.getAttribute("statusText")||M.statusText}else{if(an){var ai=af.getElementsByTagName("pre")[0];var ar=af.getElementsByTagName("body")[0];if(ai){M.responseText=ai.textContent?ai.textContent:ai.innerText}else{if(ar){M.responseText=ar.textContent?ar.textContent:ar.innerText}}}}}else{if(ah=="xml"&&!M.responseXML&&M.responseText){M.responseXML=U(M.responseText)}}try{ae=k(M,ah,T)}catch(am){ak="parsererror";M.error=ao=(am||ak)}}catch(am){d("error caught: ",am);ak="error";M.error=ao=(am||ak)}if(M.aborted){d("upload aborted");ak=null}if(M.status){ak=(M.status>=200&&M.status<300||M.status===304)?"success":"error"}if(ak==="success"){if(T.success){T.success.call(T.context,ae,"success",M)}ag.resolve(M.responseText,"success",M);if(ab){e.event.trigger("ajaxSuccess",[M,T])}}else{if(ak){if(ao===undefined){ao=M.statusText}if(T.error){T.error.call(T.context,M,ak,ao)}ag.reject(M,"error",ao);if(ab){e.event.trigger("ajaxError",[M,T,ao])}}}if(ab){e.event.trigger("ajaxComplete",[M,T])}if(ab&&!--e.active){e.event.trigger("ajaxStop")}if(T.complete){T.complete.call(T.context,M,ak)}J=true;if(T.timeout){clearTimeout(R)}setTimeout(function(){if(!T.iframeTarget){K.remove()}M.responseXML=null},100)}var U=e.parseXML||function(ah,ai){if(window.ActiveXObject){ai=new ActiveXObject("Microsoft.XMLDOM");ai.async="false";ai.loadXML(ah)}else{ai=(new DOMParser()).parseFromString(ah,"text/xml")}return(ai&&ai.documentElement&&ai.documentElement.nodeName!="parsererror")?ai:null};var q=e.parseJSON||function(ah){return window["eval"]("("+ah+")")};var k=function(am,ak,aj){var ai=am.getResponseHeader("content-type")||"",ah=ak==="xml"||!ak&&ai.indexOf("xml")>=0,al=ah?am.responseXML:am.responseText;if(ah&&al.documentElement.nodeName==="parsererror"){if(e.error){e.error("parsererror")}}if(aj&&aj.dataFilter){al=aj.dataFilter(al,ak)}if(typeof al==="string"){if(ak==="json"||!ak&&ai.indexOf("json")>=0){al=q(al)}else{if(ak==="script"||!ak&&ai.indexOf("javascript")>=0){e.globalEval(al)}}}return al};return ag}};e.fn.ajaxForm=function(f){f=f||{};f.delegation=f.delegation&&e.isFunction(e.fn.on);if(!f.delegation&&this.length===0){var g={s:this.selector,c:this.context};if(!e.isReady&&g.s){d("DOM not ready, queuing ajaxForm");e(function(){e(g.s,g.c).ajaxForm(f)});return this}d("terminating; zero elements found by selector"+(e.isReady?"":" (DOM not ready)"));return this}if(f.delegation){e(document).off("submit.form-plugin",this.selector,b).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,f,b).on("click.form-plugin",this.selector,f,a);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",f,b).bind("click.form-plugin",f,a)};function b(g){var f=g.data;if(!g.isDefaultPrevented()){g.preventDefault();e(this).ajaxSubmit(f)}}function a(j){var i=j.target;var g=e(i);if(!(g.is("[type=submit],[type=image]"))){var f=g.closest("[type=submit]");if(f.length===0){return}i=f[0]}var h=this;h.clk=i;if(i.type=="image"){if(j.offsetX!==undefined){h.clk_x=j.offsetX;h.clk_y=j.offsetY}else{if(typeof e.fn.offset=="function"){var k=g.offset();h.clk_x=j.pageX-k.left;h.clk_y=j.pageY-k.top}else{h.clk_x=j.pageX-i.offsetLeft;h.clk_y=j.pageY-i.offsetTop}}}setTimeout(function(){h.clk=h.clk_x=h.clk_y=null},100)}e.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};e.fn.formToArray=function(w,f){var u=[];if(this.length===0){return u}var k=this[0];var o=w?k.getElementsByTagName("*"):k.elements;if(!o){return u}var q,p,m,x,l,s,h;for(q=0,s=o.length;q<s;q++){l=o[q];m=l.name;if(!m){continue}if(w&&k.clk&&l.type=="image"){if(!l.disabled&&k.clk==l){u.push({name:m,value:e(l).val(),type:l.type});u.push({name:m+".x",value:k.clk_x},{name:m+".y",value:k.clk_y})}continue}x=e.fieldValue(l,true);if(x&&x.constructor==Array){if(f){f.push(l)}for(p=0,h=x.length;p<h;p++){u.push({name:m,value:x[p]})}}else{if(c.fileapi&&l.type=="file"&&!l.disabled){if(f){f.push(l)}var g=l.files;if(g.length){for(p=0;p<g.length;p++){u.push({name:m,value:g[p],type:l.type})}}else{u.push({name:m,value:"",type:l.type})}}else{if(x!==null&&typeof x!="undefined"){if(f){f.push(l)}u.push({name:m,value:x,type:l.type,required:l.required})}}}}if(!w&&k.clk){var r=e(k.clk),t=r[0];m=t.name;if(m&&!t.disabled&&t.type=="image"){u.push({name:m,value:r.val()});u.push({name:m+".x",value:k.clk_x},{name:m+".y",value:k.clk_y})}}return u};e.fn.formSerialize=function(f){return e.param(this.formToArray(f))};e.fn.fieldSerialize=function(g){var f=[];this.each(function(){var l=this.name;if(!l){return}var j=e.fieldValue(this,g);if(j&&j.constructor==Array){for(var k=0,h=j.length;k<h;k++){f.push({name:l,value:j[k]})}}else{if(j!==null&&typeof j!="undefined"){f.push({name:this.name,value:j})}}});return e.param(f)};e.fn.fieldValue=function(l){for(var k=[],h=0,f=this.length;h<f;h++){var j=this[h];var g=e.fieldValue(j,l);if(g===null||typeof g=="undefined"||(g.constructor==Array&&!g.length)){continue}if(g.constructor==Array){e.merge(k,g)}else{k.push(g)}}return k};e.fieldValue=function(f,m){var h=f.name,s=f.type,u=f.tagName.toLowerCase();if(m===undefined){m=true}if(m&&(!h||f.disabled||s=="reset"||s=="button"||(s=="checkbox"||s=="radio")&&!f.checked||(s=="submit"||s=="image")&&f.form&&f.form.clk!=f||u=="select"&&f.selectedIndex==-1)){return null}if(u=="select"){var o=f.selectedIndex;if(o<0){return null}var q=[],g=f.options;var k=(s=="select-one");var p=(k?o+1:g.length);for(var j=(k?o:0);j<p;j++){var l=g[j];if(l.selected){var r=l.value;if(!r){r=(l.attributes&&l.attributes.value&&!(l.attributes.value.specified))?l.text:l.value}if(k){return r}q.push(r)}}return q}return e(f).val()};e.fn.clearForm=function(f){return this.each(function(){e("input,select,textarea",this).clearFields(f)})};e.fn.clearFields=e.fn.clearInputs=function(f){var g=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var i=this.type,h=this.tagName.toLowerCase();if(g.test(i)||h=="textarea"){this.value=""}else{if(i=="checkbox"||i=="radio"){this.checked=false}else{if(h=="select"){this.selectedIndex=-1}else{if(i=="file"){if(/MSIE/.test(navigator.userAgent)){e(this).replaceWith(e(this).clone())}else{e(this).val("")}}else{if(f){if((f===true&&/hidden/.test(i))||(typeof f=="string"&&e(this).is(f))){this.value=""}}}}}}})};e.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};e.fn.enable=function(f){if(f===undefined){f=true}return this.each(function(){this.disabled=!f})};e.fn.selected=function(f){if(f===undefined){f=true}return this.each(function(){var g=this.type;if(g=="checkbox"||g=="radio"){this.checked=f}else{if(this.tagName.toLowerCase()=="option"){var h=e(this).parent("select");if(f&&h[0]&&h[0].type=="select-one"){h.find("option").selected(false)}this.selected=f}}})};e.fn.ajaxSubmit.debug=false;function d(){if(!e.fn.ajaxSubmit.debug){return}var f="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(f)}else{if(window.opera&&window.opera.postError){window.opera.postError(f)}}}})(jQuery);
|
1 |
/*!
|
2 |
* jQuery Form Plugin
|
3 |
+
* version: 3.32.0-2013.04.03
|
4 |
* @requires jQuery v1.5 or later
|
5 |
*
|
6 |
* Examples and documentation at: http://malsup.com/jquery/form/
|
9 |
* http://malsup.github.com/mit-license.txt
|
10 |
* http://malsup.github.com/gpl-license-v2.txt
|
11 |
*/
|
12 |
+
(function(f){var c={};c.fileapi=f("<input type='file'/>").get(0).files!==undefined;c.formdata=window.FormData!==undefined;var e=!!f.fn.prop;f.fn.attr2=function(){if(!e){return this.attr.apply(this,arguments)}var g=this.prop.apply(this,arguments);if((g&&g.jquery)||typeof g==="string"){return g}return this.attr.apply(this,arguments)};f.fn.ajaxSubmit=function(i){if(!this.length){d("ajaxSubmit: skipping submit process - no element selected");return this}var h,z,l,n=this;if(typeof i=="function"){i={success:i}}h=this.attr2("method");z=this.attr2("action");l=(typeof z==="string")?f.trim(z):"";l=l||window.location.href||"";if(l){l=(l.match(/^([^#]+)/)||[])[1]}i=f.extend(true,{url:l,success:f.ajaxSettings.success,type:h||"GET",iframeSrc:/^https/i.test(window.location.href||"")?"javascript:false":"about:blank"},i);var t={};this.trigger("form-pre-serialize",[this,i,t]);if(t.veto){d("ajaxSubmit: submit vetoed via form-pre-serialize trigger");return this}if(i.beforeSerialize&&i.beforeSerialize(this,i)===false){d("ajaxSubmit: submit aborted via beforeSerialize callback");return this}var m=i.traditional;if(m===undefined){m=f.ajaxSettings.traditional}var r=[];var C,D=this.formToArray(i.semantic,r);if(i.data){i.extraData=i.data;C=f.param(i.data,m)}if(i.beforeSubmit&&i.beforeSubmit(D,this,i)===false){d("ajaxSubmit: submit aborted via beforeSubmit callback");return this}this.trigger("form-submit-validate",[D,this,i,t]);if(t.veto){d("ajaxSubmit: submit vetoed via form-submit-validate trigger");return this}var x=f.param(D,m);if(C){x=(x?(x+"&"+C):C)}if(i.type.toUpperCase()=="GET"){i.url+=(i.url.indexOf("?")>=0?"&":"?")+x;i.data=null}else{i.data=x}var F=[];if(i.resetForm){F.push(function(){n.resetForm()})}if(i.clearForm){F.push(function(){n.clearForm(i.includeHidden)})}if(!i.dataType&&i.target){var j=i.success||function(){};F.push(function(q){var k=i.replaceTarget?"replaceWith":"html";f(i.target)[k](q).each(j,arguments)})}else{if(i.success){F.push(i.success)}}i.success=function(I,q,J){var H=i.context||this;for(var G=0,k=F.length;G<k;G++){F[G].apply(H,[I,q,J||n,n])}};var B=f('input[type=file]:enabled[value!=""]',this);var o=B.length>0;var A="multipart/form-data";var w=(n.attr("enctype")==A||n.attr("encoding")==A);var v=c.fileapi&&c.formdata;d("fileAPI :"+v);var p=(o||w)&&!v;var u;if(i.iframe!==false&&(i.iframe||p)){if(i.closeKeepAlive){f.get(i.closeKeepAlive,function(){u=E(D)})}else{u=E(D)}}else{if((o||w)&&v){u=s(D)}else{u=f.ajax(i)}}n.removeData("jqxhr").data("jqxhr",u);for(var y=0;y<r.length;y++){r[y]=null}this.trigger("form-submit-notify",[this,i]);return this;function g(I){var J=f.param(I).split("&");var q=J.length;var k=[];var H,G;for(H=0;H<q;H++){J[H]=J[H].replace(/\+/g," ");G=J[H].split("=");k.push([decodeURIComponent(G[0]),decodeURIComponent(G[1])])}return k}function s(q){var k=new FormData();for(var G=0;G<q.length;G++){k.append(q[G].name,q[G].value)}if(i.extraData){var J=g(i.extraData);for(G=0;G<J.length;G++){if(J[G]){k.append(J[G][0],J[G][1])}}}i.data=null;var I=f.extend(true,{},f.ajaxSettings,i,{contentType:false,processData:false,cache:false,type:h||"POST"});if(i.uploadProgress){I.xhr=function(){var K=jQuery.ajaxSettings.xhr();if(K.upload){K.upload.addEventListener("progress",function(O){var N=0;var L=O.loaded||O.position;var M=O.total;if(O.lengthComputable){N=Math.ceil(L/M*100)}i.uploadProgress(O,L,M,N)},false)}return K}}I.data=null;var H=I.beforeSend;I.beforeSend=function(L,K){K.data=k;if(H){H.call(this,L,K)}};return f.ajax(I)}function E(ad){var J=n[0],I,Z,T,ab,W,L,O,M,N,X,aa,R;var ag=f.Deferred();if(ad){for(Z=0;Z<r.length;Z++){I=f(r[Z]);if(e){I.prop("disabled",false)}else{I.removeAttr("disabled")}}}T=f.extend(true,{},f.ajaxSettings,i);T.context=T.context||T;W="jqFormIO"+(new Date().getTime());if(T.iframeTarget){L=f(T.iframeTarget);X=L.attr2("name");if(!X){L.attr2("name",W)}else{W=X}}else{L=f('<iframe name="'+W+'" src="'+T.iframeSrc+'" />');L.css({position:"absolute",top:"-1000px",left:"-1000px"})}O=L[0];M={aborted:0,responseText:null,responseXML:null,status:0,statusText:"n/a",getAllResponseHeaders:function(){},getResponseHeader:function(){},setRequestHeader:function(){},abort:function(ah){var ai=(ah==="timeout"?"timeout":"aborted");d("aborting upload... "+ai);this.aborted=1;try{if(O.contentWindow.document.execCommand){O.contentWindow.document.execCommand("Stop")}}catch(aj){}L.attr("src",T.iframeSrc);M.error=ai;if(T.error){T.error.call(T.context,M,ai,ah)}if(ab){f.event.trigger("ajaxError",[M,T,ai])}if(T.complete){T.complete.call(T.context,M,ai)}}};ab=T.global;if(ab&&0===f.active++){f.event.trigger("ajaxStart")}if(ab){f.event.trigger("ajaxSend",[M,T])}if(T.beforeSend&&T.beforeSend.call(T.context,M,T)===false){if(T.global){f.active--}ag.reject();return ag}if(M.aborted){ag.reject();return ag}N=J.clk;if(N){X=N.name;if(X&&!N.disabled){T.extraData=T.extraData||{};T.extraData[X]=N.value;if(N.type=="image"){T.extraData[X+".x"]=J.clk_x;T.extraData[X+".y"]=J.clk_y}}}var S=1;var P=2;function Q(aj){var ai=null;try{if(aj.contentWindow){ai=aj.contentWindow.document}}catch(ah){d("cannot get iframe.contentWindow document: "+ah)}if(ai){return ai}try{ai=aj.contentDocument?aj.contentDocument:aj.document}catch(ah){d("cannot get iframe.contentDocument: "+ah);ai=aj.document}return ai}var H=f("meta[name=csrf-token]").attr("content");var G=f("meta[name=csrf-param]").attr("content");if(G&&H){T.extraData=T.extraData||{};T.extraData[G]=H}function Y(){var aj=n.attr2("target"),ah=n.attr2("action");J.setAttribute("target",W);if(!h){J.setAttribute("method","POST")}if(ah!=T.url){J.setAttribute("action",T.url)}if(!T.skipEncodingOverride&&(!h||/post/i.test(h))){n.attr({encoding:"multipart/form-data",enctype:"multipart/form-data"})}if(T.timeout){R=setTimeout(function(){aa=true;V(S)},T.timeout)}function ak(){try{var ao=Q(O).readyState;d("state = "+ao);if(ao&&ao.toLowerCase()=="uninitialized"){setTimeout(ak,50)}}catch(ap){d("Server abort: ",ap," (",ap.name,")");V(P);if(R){clearTimeout(R)}R=undefined}}var ai=[];try{if(T.extraData){for(var an in T.extraData){if(T.extraData.hasOwnProperty(an)){if(f.isPlainObject(T.extraData[an])&&T.extraData[an].hasOwnProperty("name")&&T.extraData[an].hasOwnProperty("value")){ai.push(f('<input type="hidden" name="'+T.extraData[an].name+'">').val(T.extraData[an].value).appendTo(J)[0])}else{ai.push(f('<input type="hidden" name="'+an+'">').val(T.extraData[an]).appendTo(J)[0])}}}}if(!T.iframeTarget){L.appendTo("body");if(O.attachEvent){O.attachEvent("onload",V)}else{O.addEventListener("load",V,false)}}setTimeout(ak,15);try{J.submit()}catch(al){var am=document.createElement("form").submit;am.apply(J)}}finally{J.setAttribute("action",ah);if(aj){J.setAttribute("target",aj)}else{n.removeAttr("target")}f(ai).remove()}}if(T.forceSync){Y()}else{setTimeout(Y,10)}var ae,af,ac=50,K;function V(an){if(M.aborted||K){return}af=Q(O);if(!af){d("cannot access response document");an=P}if(an===S&&M){M.abort("timeout");ag.reject(M,"timeout");return}else{if(an==P&&M){M.abort("server abort");ag.reject(M,"error","server abort");return}}if(!af||af.location.href==T.iframeSrc){if(!aa){return}}if(O.detachEvent){O.detachEvent("onload",V)}else{O.removeEventListener("load",V,false)}var al="success",ap;try{if(aa){throw"timeout"}var ak=T.dataType=="xml"||af.XMLDocument||f.isXMLDoc(af);d("isXml="+ak);if(!ak&&window.opera&&(af.body===null||!af.body.innerHTML)){if(--ac){d("requeing onLoad callback, DOM not available");setTimeout(V,250);return}}var aq=af.body?af.body:af.documentElement;M.responseText=aq?aq.innerHTML:null;M.responseXML=af.XMLDocument?af.XMLDocument:af;if(ak){T.dataType="xml"}M.getResponseHeader=function(au){var at={"content-type":T.dataType};return at[au]};if(aq){M.status=Number(aq.getAttribute("status"))||M.status;M.statusText=aq.getAttribute("statusText")||M.statusText}var ah=(T.dataType||"").toLowerCase();var ao=/(json|script|text)/.test(ah);if(ao||T.textarea){var am=af.getElementsByTagName("textarea")[0];if(am){M.responseText=am.value;M.status=Number(am.getAttribute("status"))||M.status;M.statusText=am.getAttribute("statusText")||M.statusText}else{if(ao){var ai=af.getElementsByTagName("pre")[0];var ar=af.getElementsByTagName("body")[0];if(ai){M.responseText=ai.textContent?ai.textContent:ai.innerText}else{if(ar){M.responseText=ar.textContent?ar.textContent:ar.innerText}}}}}else{if(ah=="xml"&&!M.responseXML&&M.responseText){M.responseXML=U(M.responseText)}}try{ae=k(M,ah,T)}catch(aj){al="parsererror";M.error=ap=(aj||al)}}catch(aj){d("error caught: ",aj);al="error";M.error=ap=(aj||al)}if(M.aborted){d("upload aborted");al=null}if(M.status){al=(M.status>=200&&M.status<300||M.status===304)?"success":"error"}if(al==="success"){if(T.success){T.success.call(T.context,ae,"success",M)}ag.resolve(M.responseText,"success",M);if(ab){f.event.trigger("ajaxSuccess",[M,T])}}else{if(al){if(ap===undefined){ap=M.statusText}if(T.error){T.error.call(T.context,M,al,ap)}ag.reject(M,"error",ap);if(ab){f.event.trigger("ajaxError",[M,T,ap])}}}if(ab){f.event.trigger("ajaxComplete",[M,T])}if(ab&&!--f.active){f.event.trigger("ajaxStop")}if(T.complete){T.complete.call(T.context,M,al)}K=true;if(T.timeout){clearTimeout(R)}setTimeout(function(){if(!T.iframeTarget){L.remove()}M.responseXML=null},100)}var U=f.parseXML||function(ah,ai){if(window.ActiveXObject){ai=new ActiveXObject("Microsoft.XMLDOM");ai.async="false";ai.loadXML(ah)}else{ai=(new DOMParser()).parseFromString(ah,"text/xml")}return(ai&&ai.documentElement&&ai.documentElement.nodeName!="parsererror")?ai:null};var q=f.parseJSON||function(ah){return window["eval"]("("+ah+")")};var k=function(am,ak,aj){var ai=am.getResponseHeader("content-type")||"",ah=ak==="xml"||!ak&&ai.indexOf("xml")>=0,al=ah?am.responseXML:am.responseText;if(ah&&al.documentElement.nodeName==="parsererror"){if(f.error){f.error("parsererror")}}if(aj&&aj.dataFilter){al=aj.dataFilter(al,ak)}if(typeof al==="string"){if(ak==="json"||!ak&&ai.indexOf("json")>=0){al=q(al)}else{if(ak==="script"||!ak&&ai.indexOf("javascript")>=0){f.globalEval(al)}}}return al};return ag}};f.fn.ajaxForm=function(g){g=g||{};g.delegation=g.delegation&&f.isFunction(f.fn.on);if(!g.delegation&&this.length===0){var h={s:this.selector,c:this.context};if(!f.isReady&&h.s){d("DOM not ready, queuing ajaxForm");f(function(){f(h.s,h.c).ajaxForm(g)});return this}d("terminating; zero elements found by selector"+(f.isReady?"":" (DOM not ready)"));return this}if(g.delegation){f(document).off("submit.form-plugin",this.selector,b).off("click.form-plugin",this.selector,a).on("submit.form-plugin",this.selector,g,b).on("click.form-plugin",this.selector,g,a);return this}return this.ajaxFormUnbind().bind("submit.form-plugin",g,b).bind("click.form-plugin",g,a)};function b(h){var g=h.data;if(!h.isDefaultPrevented()){h.preventDefault();f(this).ajaxSubmit(g)}}function a(k){var j=k.target;var h=f(j);if(!(h.is("[type=submit],[type=image]"))){var g=h.closest("[type=submit]");if(g.length===0){return}j=g[0]}var i=this;i.clk=j;if(j.type=="image"){if(k.offsetX!==undefined){i.clk_x=k.offsetX;i.clk_y=k.offsetY}else{if(typeof f.fn.offset=="function"){var l=h.offset();i.clk_x=k.pageX-l.left;i.clk_y=k.pageY-l.top}else{i.clk_x=k.pageX-j.offsetLeft;i.clk_y=k.pageY-j.offsetTop}}}setTimeout(function(){i.clk=i.clk_x=i.clk_y=null},100)}f.fn.ajaxFormUnbind=function(){return this.unbind("submit.form-plugin click.form-plugin")};f.fn.formToArray=function(x,g){var w=[];if(this.length===0){return w}var l=this[0];var p=x?l.getElementsByTagName("*"):l.elements;if(!p){return w}var r,q,o,y,m,t,k;for(r=0,t=p.length;r<t;r++){m=p[r];o=m.name;if(!o||m.disabled){continue}if(x&&l.clk&&m.type=="image"){if(l.clk==m){w.push({name:o,value:f(m).val(),type:m.type});w.push({name:o+".x",value:l.clk_x},{name:o+".y",value:l.clk_y})}continue}y=f.fieldValue(m,true);if(y&&y.constructor==Array){if(g){g.push(m)}for(q=0,k=y.length;q<k;q++){w.push({name:o,value:y[q]})}}else{if(c.fileapi&&m.type=="file"){if(g){g.push(m)}var h=m.files;if(h.length){for(q=0;q<h.length;q++){w.push({name:o,value:h[q],type:m.type})}}else{w.push({name:o,value:"",type:m.type})}}else{if(y!==null&&typeof y!="undefined"){if(g){g.push(m)}w.push({name:o,value:y,type:m.type,required:m.required})}}}}if(!x&&l.clk){var s=f(l.clk),u=s[0];o=u.name;if(o&&!u.disabled&&u.type=="image"){w.push({name:o,value:s.val()});w.push({name:o+".x",value:l.clk_x},{name:o+".y",value:l.clk_y})}}return w};f.fn.formSerialize=function(g){return f.param(this.formToArray(g))};f.fn.fieldSerialize=function(h){var g=[];this.each(function(){var m=this.name;if(!m){return}var k=f.fieldValue(this,h);if(k&&k.constructor==Array){for(var l=0,j=k.length;l<j;l++){g.push({name:m,value:k[l]})}}else{if(k!==null&&typeof k!="undefined"){g.push({name:this.name,value:k})}}});return f.param(g)};f.fn.fieldValue=function(m){for(var l=[],j=0,g=this.length;j<g;j++){var k=this[j];var h=f.fieldValue(k,m);if(h===null||typeof h=="undefined"||(h.constructor==Array&&!h.length)){continue}if(h.constructor==Array){f.merge(l,h)}else{l.push(h)}}return l};f.fieldValue=function(g,o){var j=g.name,u=g.type,w=g.tagName.toLowerCase();if(o===undefined){o=true}if(o&&(!j||g.disabled||u=="reset"||u=="button"||(u=="checkbox"||u=="radio")&&!g.checked||(u=="submit"||u=="image")&&g.form&&g.form.clk!=g||w=="select"&&g.selectedIndex==-1)){return null}if(w=="select"){var p=g.selectedIndex;if(p<0){return null}var r=[],h=g.options;var l=(u=="select-one");var q=(l?p+1:h.length);for(var k=(l?p:0);k<q;k++){var m=h[k];if(m.selected){var s=m.value;if(!s){s=(m.attributes&&m.attributes.value&&!(m.attributes.value.specified))?m.text:m.value}if(l){return s}r.push(s)}}return r}return f(g).val()};f.fn.clearForm=function(g){return this.each(function(){f("input,select,textarea",this).clearFields(g)})};f.fn.clearFields=f.fn.clearInputs=function(g){var h=/^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i;return this.each(function(){var j=this.type,i=this.tagName.toLowerCase();if(h.test(j)||i=="textarea"){this.value=""}else{if(j=="checkbox"||j=="radio"){this.checked=false}else{if(i=="select"){this.selectedIndex=-1}else{if(j=="file"){if(/MSIE/.test(navigator.userAgent)){f(this).replaceWith(f(this).clone(true))}else{f(this).val("")}}else{if(g){if((g===true&&/hidden/.test(j))||(typeof g=="string"&&f(this).is(g))){this.value=""}}}}}}})};f.fn.resetForm=function(){return this.each(function(){if(typeof this.reset=="function"||(typeof this.reset=="object"&&!this.reset.nodeType)){this.reset()}})};f.fn.enable=function(g){if(g===undefined){g=true}return this.each(function(){this.disabled=!g})};f.fn.selected=function(g){if(g===undefined){g=true}return this.each(function(){var h=this.type;if(h=="checkbox"||h=="radio"){this.checked=g}else{if(this.tagName.toLowerCase()=="option"){var i=f(this).parent("select");if(g&&i[0]&&i[0].type=="select-one"){i.find("option").selected(false)}this.selected=g}}})};f.fn.ajaxSubmit.debug=false;function d(){if(!f.fn.ajaxSubmit.debug){return}var g="[jquery.form] "+Array.prototype.join.call(arguments,"");if(window.console&&window.console.log){window.console.log(g)}else{if(window.opera&&window.opera.postError){window.opera.postError(g)}}}})(jQuery);
|
includes/js/scripts.js
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
return true;
|
15 |
},
|
16 |
beforeSerialize: function(jqForm, options) {
|
17 |
-
jqForm.find('.
|
18 |
$(n).val('');
|
19 |
});
|
20 |
return true;
|
@@ -78,8 +78,8 @@
|
|
78 |
if (1 == data.mailSent)
|
79 |
$(data.into).find('form').resetForm().clearForm();
|
80 |
|
81 |
-
$(data.into).find('.
|
82 |
-
$(n).val($(n).attr('
|
83 |
});
|
84 |
|
85 |
$(data.into).wpcf7FillResponseOutput(data.message);
|
@@ -104,19 +104,25 @@
|
|
104 |
});
|
105 |
});
|
106 |
|
107 |
-
$(n).find('
|
108 |
var input = $(n);
|
109 |
-
|
110 |
-
input.
|
|
|
|
|
|
|
|
|
111 |
|
112 |
input.focus(function() {
|
113 |
-
if ($(this).hasClass('
|
114 |
-
$(this).val('').removeClass('
|
115 |
});
|
116 |
|
117 |
input.blur(function() {
|
118 |
-
if ('' == $(this).val())
|
119 |
-
$(this).val($(this).attr('
|
|
|
|
|
120 |
});
|
121 |
});
|
122 |
});
|
14 |
return true;
|
15 |
},
|
16 |
beforeSerialize: function(jqForm, options) {
|
17 |
+
jqForm.find('[placeholder].placeheld').each(function(i, n) {
|
18 |
$(n).val('');
|
19 |
});
|
20 |
return true;
|
78 |
if (1 == data.mailSent)
|
79 |
$(data.into).find('form').resetForm().clearForm();
|
80 |
|
81 |
+
$(data.into).find('[placeholder].placeheld').each(function(i, n) {
|
82 |
+
$(n).val($(n).attr('placeholder'));
|
83 |
});
|
84 |
|
85 |
$(data.into).wpcf7FillResponseOutput(data.message);
|
104 |
});
|
105 |
});
|
106 |
|
107 |
+
$(n).find('[placeholder]').each(function(i, n) {
|
108 |
var input = $(n);
|
109 |
+
|
110 |
+
if ('placeholder' in input.get(0))
|
111 |
+
return;
|
112 |
+
|
113 |
+
input.val(input.attr('placeholder'));
|
114 |
+
input.addClass('placeheld');
|
115 |
|
116 |
input.focus(function() {
|
117 |
+
if ($(this).hasClass('placeheld'))
|
118 |
+
$(this).val('').removeClass('placeheld');
|
119 |
});
|
120 |
|
121 |
input.blur(function() {
|
122 |
+
if ('' == $(this).val()) {
|
123 |
+
$(this).val($(this).attr('placeholder'));
|
124 |
+
$(this).addClass('placeheld');
|
125 |
+
}
|
126 |
});
|
127 |
});
|
128 |
});
|
includes/shortcodes.php
CHANGED
@@ -11,10 +11,16 @@ class WPCF7_ShortcodeManager {
|
|
11 |
var $exec = true;
|
12 |
|
13 |
function add_shortcode( $tag, $func, $has_name = false ) {
|
14 |
-
if ( is_callable( $func ) )
|
|
|
|
|
|
|
|
|
|
|
15 |
$this->shortcode_tags[$tag] = array(
|
16 |
'function' => $func,
|
17 |
'has_name' => (boolean) $has_name );
|
|
|
18 |
}
|
19 |
|
20 |
function remove_shortcode( $tag ) {
|
@@ -89,6 +95,7 @@ class WPCF7_ShortcodeManager {
|
|
89 |
|
90 |
$scanned_tag = array(
|
91 |
'type' => $tag,
|
|
|
92 |
'name' => '',
|
93 |
'options' => array(),
|
94 |
'raw_values' => array(),
|
@@ -166,30 +173,180 @@ class WPCF7_ShortcodeManager {
|
|
166 |
|
167 |
}
|
168 |
|
169 |
-
$wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();
|
170 |
-
|
171 |
function wpcf7_add_shortcode( $tag, $func, $has_name = false ) {
|
172 |
global $wpcf7_shortcode_manager;
|
173 |
|
174 |
-
|
|
|
175 |
}
|
176 |
|
177 |
function wpcf7_remove_shortcode( $tag ) {
|
178 |
global $wpcf7_shortcode_manager;
|
179 |
|
180 |
-
|
|
|
181 |
}
|
182 |
|
183 |
function wpcf7_do_shortcode( $content ) {
|
184 |
global $wpcf7_shortcode_manager;
|
185 |
|
186 |
-
|
|
|
187 |
}
|
188 |
|
189 |
function wpcf7_get_shortcode_regex() {
|
190 |
global $wpcf7_shortcode_manager;
|
191 |
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
}
|
194 |
|
195 |
?>
|
11 |
var $exec = true;
|
12 |
|
13 |
function add_shortcode( $tag, $func, $has_name = false ) {
|
14 |
+
if ( ! is_callable( $func ) )
|
15 |
+
return;
|
16 |
+
|
17 |
+
$tags = array_filter( array_unique( (array) $tag ) );
|
18 |
+
|
19 |
+
foreach ( $tags as $tag ) {
|
20 |
$this->shortcode_tags[$tag] = array(
|
21 |
'function' => $func,
|
22 |
'has_name' => (boolean) $has_name );
|
23 |
+
}
|
24 |
}
|
25 |
|
26 |
function remove_shortcode( $tag ) {
|
95 |
|
96 |
$scanned_tag = array(
|
97 |
'type' => $tag,
|
98 |
+
'basetype' => trim( $tag, '*' ),
|
99 |
'name' => '',
|
100 |
'options' => array(),
|
101 |
'raw_values' => array(),
|
173 |
|
174 |
}
|
175 |
|
|
|
|
|
176 |
function wpcf7_add_shortcode( $tag, $func, $has_name = false ) {
|
177 |
global $wpcf7_shortcode_manager;
|
178 |
|
179 |
+
if ( is_a( $wpcf7_shortcode_manager, 'WPCF7_ShortcodeManager' ) )
|
180 |
+
return $wpcf7_shortcode_manager->add_shortcode( $tag, $func, $has_name );
|
181 |
}
|
182 |
|
183 |
function wpcf7_remove_shortcode( $tag ) {
|
184 |
global $wpcf7_shortcode_manager;
|
185 |
|
186 |
+
if ( is_a( $wpcf7_shortcode_manager, 'WPCF7_ShortcodeManager' ) )
|
187 |
+
return $wpcf7_shortcode_manager->remove_shortcode( $tag );
|
188 |
}
|
189 |
|
190 |
function wpcf7_do_shortcode( $content ) {
|
191 |
global $wpcf7_shortcode_manager;
|
192 |
|
193 |
+
if ( is_a( $wpcf7_shortcode_manager, 'WPCF7_ShortcodeManager' ) )
|
194 |
+
return $wpcf7_shortcode_manager->do_shortcode( $content );
|
195 |
}
|
196 |
|
197 |
function wpcf7_get_shortcode_regex() {
|
198 |
global $wpcf7_shortcode_manager;
|
199 |
|
200 |
+
if ( is_a( $wpcf7_shortcode_manager, 'WPCF7_ShortcodeManager' ) )
|
201 |
+
return $wpcf7_shortcode_manager->get_shortcode_regex();
|
202 |
+
}
|
203 |
+
|
204 |
+
class WPCF7_Shortcode {
|
205 |
+
|
206 |
+
public $type;
|
207 |
+
public $basetype;
|
208 |
+
public $name = '';
|
209 |
+
public $options = array();
|
210 |
+
public $raw_values = array();
|
211 |
+
public $values = array();
|
212 |
+
public $pipes;
|
213 |
+
public $labels = array();
|
214 |
+
public $attr = '';
|
215 |
+
public $content = '';
|
216 |
+
|
217 |
+
public function __construct( $tag ) {
|
218 |
+
foreach ( $tag as $key => $value ) {
|
219 |
+
if ( property_exists( __CLASS__, $key ) )
|
220 |
+
$this->{$key} = $value;
|
221 |
+
}
|
222 |
+
}
|
223 |
+
|
224 |
+
public function is_required() {
|
225 |
+
return ( '*' == substr( $this->type, -1 ) );
|
226 |
+
}
|
227 |
+
|
228 |
+
public function has_option( $opt ) {
|
229 |
+
$pattern = sprintf( '/^%s(:.+)?$/i', preg_quote( $opt, '/' ) );
|
230 |
+
return (bool) preg_grep( $pattern, $this->options );
|
231 |
+
}
|
232 |
+
|
233 |
+
public function get_option( $opt, $pattern = '', $single = false ) {
|
234 |
+
$preset_patterns = array(
|
235 |
+
'date' => '[0-9]{4}-[0-9]{2}-[0-9]{2}',
|
236 |
+
'int' => '[0-9]+',
|
237 |
+
'signed_int' => '-?[0-9]+',
|
238 |
+
'class' => '[-0-9a-zA-Z_]+',
|
239 |
+
'id' => '[-0-9a-zA-Z_]+' );
|
240 |
+
|
241 |
+
if ( isset( $preset_patterns[$pattern] ) )
|
242 |
+
$pattern = $preset_patterns[$pattern];
|
243 |
+
|
244 |
+
if ( '' == $pattern )
|
245 |
+
$pattern = '.+';
|
246 |
+
|
247 |
+
$pattern = sprintf( '/^%s:%s$/i', preg_quote( $opt, '/' ), $pattern );
|
248 |
+
|
249 |
+
if ( $single ) {
|
250 |
+
$matches = $this->get_first_match_option( $pattern );
|
251 |
+
|
252 |
+
if ( ! $matches )
|
253 |
+
return false;
|
254 |
+
|
255 |
+
return substr( $matches[0], strlen( $opt ) + 1 );
|
256 |
+
} else {
|
257 |
+
$matches_a = $this->get_all_match_options( $pattern );
|
258 |
+
|
259 |
+
if ( ! $matches_a )
|
260 |
+
return false;
|
261 |
+
|
262 |
+
$results = array();
|
263 |
+
|
264 |
+
foreach ( $matches_a as $matches )
|
265 |
+
$results[] = substr( $matches[0], strlen( $opt ) + 1 );
|
266 |
+
|
267 |
+
return $results;
|
268 |
+
}
|
269 |
+
}
|
270 |
+
|
271 |
+
public function get_class_option( $default = '' ) {
|
272 |
+
if ( is_string( $default ) )
|
273 |
+
$default = explode( ' ', $default );
|
274 |
+
|
275 |
+
$options = array_merge(
|
276 |
+
(array) $default,
|
277 |
+
(array) $this->get_option( 'class', 'class' ) );
|
278 |
+
|
279 |
+
$options = array_filter( array_unique( $options ) );
|
280 |
+
|
281 |
+
return implode( ' ', $options );
|
282 |
+
}
|
283 |
+
|
284 |
+
public function get_size_option( $default = '' ) {
|
285 |
+
$matches_a = $this->get_all_match_options( '%^([0-9]*)/[0-9]*$%' );
|
286 |
+
|
287 |
+
foreach ( (array) $matches_a as $matches ) {
|
288 |
+
if ( isset( $matches[1] ) && '' !== $matches[1] )
|
289 |
+
return $matches[1];
|
290 |
+
}
|
291 |
+
|
292 |
+
return $default;
|
293 |
+
}
|
294 |
+
|
295 |
+
public function get_maxlength_option( $default = '' ) {
|
296 |
+
$matches_a = $this->get_all_match_options(
|
297 |
+
'%^(?:[0-9]*x?[0-9]*)?/([0-9]+)$%' );
|
298 |
+
|
299 |
+
foreach ( (array) $matches_a as $matches ) {
|
300 |
+
if ( isset( $matches[1] ) && '' !== $matches[1] )
|
301 |
+
return $matches[1];
|
302 |
+
}
|
303 |
+
|
304 |
+
return $default;
|
305 |
+
}
|
306 |
+
|
307 |
+
public function get_cols_option( $default = '' ) {
|
308 |
+
$matches_a = $this->get_all_match_options(
|
309 |
+
'%^([0-9]*)x([0-9]*)(?:/[0-9]+)?$%' );
|
310 |
+
|
311 |
+
foreach ( (array) $matches_a as $matches ) {
|
312 |
+
if ( isset( $matches[1] ) && '' !== $matches[1] )
|
313 |
+
return $matches[1];
|
314 |
+
}
|
315 |
+
|
316 |
+
return $default;
|
317 |
+
}
|
318 |
+
|
319 |
+
public function get_rows_option( $default = '' ) {
|
320 |
+
$matches_a = $this->get_all_match_options(
|
321 |
+
'%^([0-9]*)x([0-9]*)(?:/[0-9]+)?$%' );
|
322 |
+
|
323 |
+
foreach ( (array) $matches_a as $matches ) {
|
324 |
+
if ( isset( $matches[2] ) && '' !== $matches[2] )
|
325 |
+
return $matches[2];
|
326 |
+
}
|
327 |
+
|
328 |
+
return $default;
|
329 |
+
}
|
330 |
+
|
331 |
+
public function get_first_match_option( $pattern ) {
|
332 |
+
foreach( (array) $this->options as $option ) {
|
333 |
+
if ( preg_match( $pattern, $option, $matches ) )
|
334 |
+
return $matches;
|
335 |
+
}
|
336 |
+
|
337 |
+
return false;
|
338 |
+
}
|
339 |
+
|
340 |
+
public function get_all_match_options( $pattern ) {
|
341 |
+
$result = array();
|
342 |
+
|
343 |
+
foreach( (array) $this->options as $option ) {
|
344 |
+
if ( preg_match( $pattern, $option, $matches ) )
|
345 |
+
$result[] = $matches;
|
346 |
+
}
|
347 |
+
|
348 |
+
return $result;
|
349 |
+
}
|
350 |
}
|
351 |
|
352 |
?>
|
languages/wpcf7-ja.mo
CHANGED
Binary file
|
languages/wpcf7.pot
CHANGED
@@ -2,8 +2,8 @@ msgid ""
|
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Contact Form 7\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
-
"POT-Creation-Date: 2013-
|
6 |
-
"PO-Revision-Date: 2013-
|
7 |
"Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
@@ -13,14 +13,14 @@ msgstr ""
|
|
13 |
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_c\n"
|
14 |
"X-Poedit-Basepath: ../..\n"
|
15 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
16 |
-
"X-Generator: Poedit 1.5.
|
17 |
"X-Poedit-SearchPath-0: contact-form-7\n"
|
18 |
|
19 |
#: contact-form-7/wp-contact-form-7.php:5
|
20 |
msgid "Just another contact form plugin. Simple but flexible."
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: contact-form-7/settings.php:
|
24 |
#, php-format
|
25 |
msgid "Contact form %d"
|
26 |
msgstr ""
|
@@ -221,6 +221,7 @@ msgid "Author"
|
|
221 |
msgstr ""
|
222 |
|
223 |
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:14
|
|
|
224 |
msgid "Date"
|
225 |
msgstr ""
|
226 |
|
@@ -267,7 +268,7 @@ msgid "Use HTML content type"
|
|
267 |
msgstr ""
|
268 |
|
269 |
#: contact-form-7/admin/includes/meta-boxes.php:80
|
270 |
-
#: contact-form-7/includes/functions.php:
|
271 |
msgid "Message body:"
|
272 |
msgstr ""
|
273 |
|
@@ -275,7 +276,7 @@ msgstr ""
|
|
275 |
msgid "Contact Form"
|
276 |
msgstr ""
|
277 |
|
278 |
-
#: contact-form-7/includes/classes.php:
|
279 |
msgid "Untitled"
|
280 |
msgstr ""
|
281 |
|
@@ -338,429 +339,430 @@ msgid "Please accept the terms to proceed."
|
|
338 |
msgstr ""
|
339 |
|
340 |
#: contact-form-7/includes/functions.php:55
|
341 |
-
msgid "Email address that the sender entered is invalid"
|
342 |
-
msgstr ""
|
343 |
-
|
344 |
-
#: contact-form-7/includes/functions.php:56
|
345 |
-
msgid "Email address seems invalid."
|
346 |
-
msgstr ""
|
347 |
-
|
348 |
-
#: contact-form-7/includes/functions.php:60
|
349 |
msgid "There is a field that the sender must fill in"
|
350 |
msgstr ""
|
351 |
|
352 |
-
#: contact-form-7/includes/functions.php:
|
353 |
msgid "Please fill the required field."
|
354 |
msgstr ""
|
355 |
|
356 |
-
#: contact-form-7/includes/functions.php:
|
357 |
msgid "Your Name"
|
358 |
msgstr ""
|
359 |
|
360 |
-
#: contact-form-7/includes/functions.php:
|
361 |
-
#: contact-form-7/includes/functions.php:
|
362 |
msgid "(required)"
|
363 |
msgstr ""
|
364 |
|
365 |
-
#: contact-form-7/includes/functions.php:
|
366 |
msgid "Your Email"
|
367 |
msgstr ""
|
368 |
|
369 |
-
#: contact-form-7/includes/functions.php:
|
370 |
msgid "Subject"
|
371 |
msgstr ""
|
372 |
|
373 |
-
#: contact-form-7/includes/functions.php:
|
374 |
msgid "Your Message"
|
375 |
msgstr ""
|
376 |
|
377 |
-
#: contact-form-7/includes/functions.php:
|
378 |
-
#: contact-form-7/modules/submit.php:
|
379 |
msgid "Send"
|
380 |
msgstr ""
|
381 |
|
382 |
-
#: contact-form-7/includes/functions.php:
|
383 |
#, php-format
|
384 |
msgid "From: %s"
|
385 |
msgstr ""
|
386 |
|
387 |
-
#: contact-form-7/includes/functions.php:
|
388 |
#, php-format
|
389 |
msgid "Subject: %s"
|
390 |
msgstr ""
|
391 |
|
392 |
-
#: contact-form-7/includes/functions.php:
|
393 |
msgid "Message Body:"
|
394 |
msgstr ""
|
395 |
|
396 |
-
#: contact-form-7/includes/functions.php:
|
397 |
-
#: contact-form-7/includes/functions.php:
|
398 |
#, php-format
|
399 |
msgid "This mail is sent via contact form on %1$s %2$s"
|
400 |
msgstr ""
|
401 |
|
402 |
-
#: contact-form-7/includes/functions.php:
|
403 |
msgid "Afrikaans"
|
404 |
msgstr ""
|
405 |
|
406 |
-
#: contact-form-7/includes/functions.php:
|
407 |
msgid "Albanian"
|
408 |
msgstr ""
|
409 |
|
410 |
-
#: contact-form-7/includes/functions.php:
|
411 |
msgid "Arabic"
|
412 |
msgstr ""
|
413 |
|
414 |
-
#: contact-form-7/includes/functions.php:
|
415 |
msgid "Armenian"
|
416 |
msgstr ""
|
417 |
|
418 |
-
#: contact-form-7/includes/functions.php:
|
419 |
msgid "Azerbaijani"
|
420 |
msgstr ""
|
421 |
|
422 |
-
#: contact-form-7/includes/functions.php:
|
423 |
msgid "Bangla"
|
424 |
msgstr ""
|
425 |
|
426 |
-
#: contact-form-7/includes/functions.php:
|
427 |
msgid "Basque"
|
428 |
msgstr ""
|
429 |
|
430 |
-
#: contact-form-7/includes/functions.php:
|
431 |
msgid "Belarusian"
|
432 |
msgstr ""
|
433 |
|
434 |
-
#: contact-form-7/includes/functions.php:
|
435 |
msgid "Bosnian"
|
436 |
msgstr ""
|
437 |
|
438 |
-
#: contact-form-7/includes/functions.php:
|
439 |
msgid "Brazilian Portuguese"
|
440 |
msgstr ""
|
441 |
|
442 |
-
#: contact-form-7/includes/functions.php:
|
443 |
msgid "Bulgarian"
|
444 |
msgstr ""
|
445 |
|
446 |
-
#: contact-form-7/includes/functions.php:
|
447 |
msgid "Catalan"
|
448 |
msgstr ""
|
449 |
|
450 |
-
#: contact-form-7/includes/functions.php:
|
451 |
msgid "Chinese (Simplified)"
|
452 |
msgstr ""
|
453 |
|
454 |
-
#: contact-form-7/includes/functions.php:
|
455 |
msgid "Chinese (Traditional)"
|
456 |
msgstr ""
|
457 |
|
458 |
-
#: contact-form-7/includes/functions.php:
|
459 |
msgid "Croatian"
|
460 |
msgstr ""
|
461 |
|
462 |
-
#: contact-form-7/includes/functions.php:
|
463 |
msgid "Czech"
|
464 |
msgstr ""
|
465 |
|
466 |
-
#: contact-form-7/includes/functions.php:
|
467 |
msgid "Danish"
|
468 |
msgstr ""
|
469 |
|
470 |
-
#: contact-form-7/includes/functions.php:
|
471 |
msgid "Dutch"
|
472 |
msgstr ""
|
473 |
|
474 |
-
#: contact-form-7/includes/functions.php:
|
475 |
msgid "English"
|
476 |
msgstr ""
|
477 |
|
478 |
-
#: contact-form-7/includes/functions.php:
|
479 |
msgid "Esperanto"
|
480 |
msgstr ""
|
481 |
|
482 |
-
#: contact-form-7/includes/functions.php:
|
483 |
msgid "Estonian"
|
484 |
msgstr ""
|
485 |
|
486 |
-
#: contact-form-7/includes/functions.php:
|
487 |
msgid "Finnish"
|
488 |
msgstr ""
|
489 |
|
490 |
-
#: contact-form-7/includes/functions.php:
|
491 |
msgid "French"
|
492 |
msgstr ""
|
493 |
|
494 |
-
#: contact-form-7/includes/functions.php:
|
495 |
msgid "Galician"
|
496 |
msgstr ""
|
497 |
|
498 |
-
#: contact-form-7/includes/functions.php:
|
499 |
msgid "Georgian"
|
500 |
msgstr ""
|
501 |
|
502 |
-
#: contact-form-7/includes/functions.php:
|
503 |
msgid "German"
|
504 |
msgstr ""
|
505 |
|
506 |
-
#: contact-form-7/includes/functions.php:
|
507 |
msgid "Greek"
|
508 |
msgstr ""
|
509 |
|
510 |
-
#: contact-form-7/includes/functions.php:
|
511 |
msgid "Hebrew"
|
512 |
msgstr ""
|
513 |
|
514 |
-
#: contact-form-7/includes/functions.php:
|
515 |
msgid "Hindi"
|
516 |
msgstr ""
|
517 |
|
518 |
-
#: contact-form-7/includes/functions.php:
|
519 |
msgid "Hungarian"
|
520 |
msgstr ""
|
521 |
|
522 |
-
#: contact-form-7/includes/functions.php:
|
523 |
msgid "Indonesian"
|
524 |
msgstr ""
|
525 |
|
526 |
-
#: contact-form-7/includes/functions.php:
|
527 |
msgid "Irish"
|
528 |
msgstr ""
|
529 |
|
530 |
-
#: contact-form-7/includes/functions.php:
|
531 |
msgid "Italian"
|
532 |
msgstr ""
|
533 |
|
534 |
-
#: contact-form-7/includes/functions.php:
|
535 |
msgid "Japanese"
|
536 |
msgstr ""
|
537 |
|
538 |
-
#: contact-form-7/includes/functions.php:
|
539 |
msgid "Korean"
|
540 |
msgstr ""
|
541 |
|
542 |
-
#: contact-form-7/includes/functions.php:
|
543 |
msgid "Latvian"
|
544 |
msgstr ""
|
545 |
|
546 |
-
#: contact-form-7/includes/functions.php:
|
547 |
msgid "Lithuanian"
|
548 |
msgstr ""
|
549 |
|
550 |
-
#: contact-form-7/includes/functions.php:
|
551 |
msgid "Macedonian"
|
552 |
msgstr ""
|
553 |
|
554 |
-
#: contact-form-7/includes/functions.php:
|
555 |
msgid "Malay"
|
556 |
msgstr ""
|
557 |
|
558 |
-
#: contact-form-7/includes/functions.php:
|
559 |
msgid "Malayalam"
|
560 |
msgstr ""
|
561 |
|
562 |
-
#: contact-form-7/includes/functions.php:
|
563 |
msgid "Maltese"
|
564 |
msgstr ""
|
565 |
|
566 |
-
#: contact-form-7/includes/functions.php:
|
567 |
msgid "Norwegian"
|
568 |
msgstr ""
|
569 |
|
570 |
-
#: contact-form-7/includes/functions.php:
|
571 |
msgid "Persian"
|
572 |
msgstr ""
|
573 |
|
574 |
-
#: contact-form-7/includes/functions.php:
|
575 |
msgid "Polish"
|
576 |
msgstr ""
|
577 |
|
578 |
-
#: contact-form-7/includes/functions.php:
|
579 |
msgid "Portuguese"
|
580 |
msgstr ""
|
581 |
|
582 |
-
#: contact-form-7/includes/functions.php:
|
583 |
msgid "Russian"
|
584 |
msgstr ""
|
585 |
|
586 |
-
#: contact-form-7/includes/functions.php:
|
587 |
msgid "Romanian"
|
588 |
msgstr ""
|
589 |
|
590 |
-
#: contact-form-7/includes/functions.php:
|
591 |
msgid "Serbian"
|
592 |
msgstr ""
|
593 |
|
594 |
-
#: contact-form-7/includes/functions.php:
|
595 |
msgid "Sinhala"
|
596 |
msgstr ""
|
597 |
|
598 |
-
#: contact-form-7/includes/functions.php:
|
599 |
msgid "Slovak"
|
600 |
msgstr ""
|
601 |
|
602 |
-
#: contact-form-7/includes/functions.php:
|
603 |
msgid "Slovene"
|
604 |
msgstr ""
|
605 |
|
606 |
-
#: contact-form-7/includes/functions.php:
|
607 |
msgid "Spanish"
|
608 |
msgstr ""
|
609 |
|
610 |
-
#: contact-form-7/includes/functions.php:
|
611 |
msgid "Swedish"
|
612 |
msgstr ""
|
613 |
|
614 |
-
#: contact-form-7/includes/functions.php:
|
615 |
msgid "Tamil"
|
616 |
msgstr ""
|
617 |
|
618 |
-
#: contact-form-7/includes/functions.php:
|
619 |
msgid "Thai"
|
620 |
msgstr ""
|
621 |
|
622 |
-
#: contact-form-7/includes/functions.php:
|
623 |
msgid "Tagalog"
|
624 |
msgstr ""
|
625 |
|
626 |
-
#: contact-form-7/includes/functions.php:
|
627 |
msgid "Turkish"
|
628 |
msgstr ""
|
629 |
|
630 |
-
#: contact-form-7/includes/functions.php:
|
631 |
msgid "Ukrainian"
|
632 |
msgstr ""
|
633 |
|
634 |
-
#: contact-form-7/includes/functions.php:
|
635 |
msgid "Vietnamese"
|
636 |
msgstr ""
|
637 |
|
638 |
-
#: contact-form-7/modules/acceptance.php:
|
639 |
msgid "Acceptance"
|
640 |
msgstr ""
|
641 |
|
642 |
-
#: contact-form-7/modules/acceptance.php:
|
643 |
-
#: contact-form-7/modules/captcha.php:
|
644 |
-
#: contact-form-7/modules/checkbox.php:
|
645 |
-
#: contact-form-7/modules/
|
646 |
-
#: contact-form-7/modules/
|
|
|
647 |
msgid "Name"
|
648 |
msgstr ""
|
649 |
|
650 |
-
#: contact-form-7/modules/acceptance.php:
|
651 |
-
#: contact-form-7/modules/acceptance.php:
|
|
|
|
|
|
|
|
|
652 |
#: contact-form-7/modules/captcha.php:222
|
653 |
-
#: contact-form-7/modules/captcha.php:225
|
654 |
-
#: contact-form-7/modules/captcha.php:230
|
655 |
#: contact-form-7/modules/captcha.php:233
|
656 |
-
#: contact-form-7/modules/captcha.php:
|
657 |
-
#: contact-form-7/modules/captcha.php:
|
658 |
-
#: contact-form-7/modules/captcha.php:
|
659 |
-
#: contact-form-7/modules/
|
660 |
-
#: contact-form-7/modules/
|
661 |
-
#: contact-form-7/modules/
|
662 |
-
#: contact-form-7/modules/
|
663 |
-
#: contact-form-7/modules/
|
664 |
-
#: contact-form-7/modules/file.php:
|
665 |
-
#: contact-form-7/modules/
|
666 |
-
#: contact-form-7/modules/
|
667 |
-
#: contact-form-7/modules/
|
668 |
-
#: contact-form-7/modules/
|
669 |
-
#: contact-form-7/modules/
|
670 |
-
#: contact-form-7/modules/
|
671 |
-
#: contact-form-7/modules/
|
672 |
-
#: contact-form-7/modules/
|
673 |
-
#: contact-form-7/modules/
|
674 |
-
#: contact-form-7/modules/
|
675 |
-
#: contact-form-7/modules/
|
676 |
-
#: contact-form-7/modules/textarea.php:
|
|
|
|
|
|
|
|
|
|
|
677 |
msgid "optional"
|
678 |
msgstr ""
|
679 |
|
680 |
-
#: contact-form-7/modules/acceptance.php:
|
681 |
msgid "Make this checkbox checked by default?"
|
682 |
msgstr ""
|
683 |
|
684 |
-
#: contact-form-7/modules/acceptance.php:
|
685 |
msgid "Make this checkbox work inversely?"
|
686 |
msgstr ""
|
687 |
|
688 |
-
#: contact-form-7/modules/acceptance.php:
|
689 |
msgid "* That means visitor who accepts the term unchecks it."
|
690 |
msgstr ""
|
691 |
|
692 |
-
#: contact-form-7/modules/acceptance.php:
|
693 |
-
#: contact-form-7/modules/captcha.php:
|
694 |
-
#: contact-form-7/modules/checkbox.php:
|
695 |
-
#: contact-form-7/modules/
|
696 |
-
#: contact-form-7/modules/
|
697 |
-
#: contact-form-7/modules/
|
|
|
698 |
msgid "Copy this code and paste it into the form left."
|
699 |
msgstr ""
|
700 |
|
701 |
-
#: contact-form-7/modules/captcha.php:
|
702 |
msgid ""
|
703 |
"To use CAPTCHA, you need <a href=\"http://wordpress.org/extend/plugins/"
|
704 |
"really-simple-captcha/\">Really Simple CAPTCHA</a> plugin installed."
|
705 |
msgstr ""
|
706 |
|
707 |
-
#: contact-form-7/modules/captcha.php:
|
708 |
msgid "The code that sender entered does not match the CAPTCHA"
|
709 |
msgstr ""
|
710 |
|
711 |
-
#: contact-form-7/modules/captcha.php:
|
712 |
msgid "Your entered code is incorrect."
|
713 |
msgstr ""
|
714 |
|
715 |
-
#: contact-form-7/modules/captcha.php:
|
716 |
msgid "CAPTCHA"
|
717 |
msgstr ""
|
718 |
|
719 |
-
#: contact-form-7/modules/captcha.php:
|
720 |
msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
|
721 |
msgstr ""
|
722 |
|
723 |
-
#: contact-form-7/modules/captcha.php:
|
724 |
msgid "Image settings"
|
725 |
msgstr ""
|
726 |
|
727 |
-
#: contact-form-7/modules/captcha.php:
|
728 |
msgid "Foreground color"
|
729 |
msgstr ""
|
730 |
|
731 |
-
#: contact-form-7/modules/captcha.php:
|
732 |
msgid "Background color"
|
733 |
msgstr ""
|
734 |
|
735 |
-
#: contact-form-7/modules/captcha.php:
|
736 |
msgid "Image size"
|
737 |
msgstr ""
|
738 |
|
739 |
-
#: contact-form-7/modules/captcha.php:
|
740 |
msgid "Small"
|
741 |
msgstr ""
|
742 |
|
743 |
-
#: contact-form-7/modules/captcha.php:
|
744 |
msgid "Medium"
|
745 |
msgstr ""
|
746 |
|
747 |
-
#: contact-form-7/modules/captcha.php:
|
748 |
msgid "Large"
|
749 |
msgstr ""
|
750 |
|
751 |
-
#: contact-form-7/modules/captcha.php:
|
752 |
msgid "Input field settings"
|
753 |
msgstr ""
|
754 |
|
755 |
-
#: contact-form-7/modules/captcha.php:
|
756 |
msgid "For image"
|
757 |
msgstr ""
|
758 |
|
759 |
-
#: contact-form-7/modules/captcha.php:
|
760 |
msgid "For input field"
|
761 |
msgstr ""
|
762 |
|
763 |
-
#: contact-form-7/modules/captcha.php:
|
764 |
#, php-format
|
765 |
msgid ""
|
766 |
"This contact form contains CAPTCHA fields, but the temporary folder for the "
|
@@ -768,107 +770,142 @@ msgid ""
|
|
768 |
"change its permission manually."
|
769 |
msgstr ""
|
770 |
|
771 |
-
#: contact-form-7/modules/captcha.php:
|
772 |
msgid ""
|
773 |
"This contact form contains CAPTCHA fields, but the necessary libraries (GD "
|
774 |
"and FreeType) are not available on your server."
|
775 |
msgstr ""
|
776 |
|
777 |
-
#: contact-form-7/modules/checkbox.php:
|
778 |
msgid "Checkboxes"
|
779 |
msgstr ""
|
780 |
|
781 |
-
#: contact-form-7/modules/checkbox.php:
|
782 |
msgid "Radio buttons"
|
783 |
msgstr ""
|
784 |
|
785 |
-
#: contact-form-7/modules/checkbox.php:
|
786 |
-
#: contact-form-7/modules/
|
787 |
-
#: contact-form-7/modules/
|
|
|
788 |
msgid "Required field?"
|
789 |
msgstr ""
|
790 |
|
791 |
-
#: contact-form-7/modules/checkbox.php:
|
792 |
-
#: contact-form-7/modules/select.php:
|
793 |
msgid "Choices"
|
794 |
msgstr ""
|
795 |
|
796 |
-
#: contact-form-7/modules/checkbox.php:
|
797 |
-
#: contact-form-7/modules/select.php:
|
798 |
msgid "* One choice per line."
|
799 |
msgstr ""
|
800 |
|
801 |
-
#: contact-form-7/modules/checkbox.php:
|
802 |
msgid "Put a label first, a checkbox last?"
|
803 |
msgstr ""
|
804 |
|
805 |
-
#: contact-form-7/modules/checkbox.php:
|
806 |
msgid "Wrap each item with <label> tag?"
|
807 |
msgstr ""
|
808 |
|
809 |
-
#: contact-form-7/modules/checkbox.php:
|
810 |
msgid "Make checkboxes exclusive?"
|
811 |
msgstr ""
|
812 |
|
813 |
-
#: contact-form-7/modules/checkbox.php:
|
814 |
-
#: contact-form-7/modules/
|
815 |
-
#: contact-form-7/modules/textarea.php:
|
816 |
msgid "And, put this code into the Mail fields below."
|
817 |
msgstr ""
|
818 |
|
819 |
-
#: contact-form-7/modules/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
820 |
msgid "Uploading a file fails for any reason"
|
821 |
msgstr ""
|
822 |
|
823 |
-
#: contact-form-7/modules/file.php:
|
824 |
msgid "Failed to upload file."
|
825 |
msgstr ""
|
826 |
|
827 |
-
#: contact-form-7/modules/file.php:
|
828 |
msgid "Uploaded file is not allowed file type"
|
829 |
msgstr ""
|
830 |
|
831 |
-
#: contact-form-7/modules/file.php:
|
832 |
msgid "This file type is not allowed."
|
833 |
msgstr ""
|
834 |
|
835 |
-
#: contact-form-7/modules/file.php:
|
836 |
msgid "Uploaded file is too large"
|
837 |
msgstr ""
|
838 |
|
839 |
-
#: contact-form-7/modules/file.php:
|
840 |
msgid "This file is too large."
|
841 |
msgstr ""
|
842 |
|
843 |
-
#: contact-form-7/modules/file.php:
|
844 |
msgid "Uploading a file fails for PHP error"
|
845 |
msgstr ""
|
846 |
|
847 |
-
#: contact-form-7/modules/file.php:
|
848 |
msgid "Failed to upload file. Error occurred."
|
849 |
msgstr ""
|
850 |
|
851 |
-
#: contact-form-7/modules/file.php:
|
852 |
msgid "File upload"
|
853 |
msgstr ""
|
854 |
|
855 |
-
#: contact-form-7/modules/file.php:
|
856 |
msgid "File size limit"
|
857 |
msgstr ""
|
858 |
|
859 |
-
#: contact-form-7/modules/file.php:
|
860 |
msgid "bytes"
|
861 |
msgstr ""
|
862 |
|
863 |
-
#: contact-form-7/modules/file.php:
|
864 |
msgid "Acceptable file types"
|
865 |
msgstr ""
|
866 |
|
867 |
-
#: contact-form-7/modules/file.php:
|
868 |
msgid "And, put this code into the File Attachments field below."
|
869 |
msgstr ""
|
870 |
|
871 |
-
#: contact-form-7/modules/file.php:
|
872 |
#, php-format
|
873 |
msgid ""
|
874 |
"This contact form contains file uploading fields, but the temporary folder "
|
@@ -883,78 +920,134 @@ msgid ""
|
|
883 |
"strong> <a href=\"%s\" target=\"_blank\">See how to avoid it.</a>"
|
884 |
msgstr ""
|
885 |
|
886 |
-
#: contact-form-7/modules/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
887 |
msgid "Sender doesn't enter the correct answer to the quiz"
|
888 |
msgstr ""
|
889 |
|
890 |
-
#: contact-form-7/modules/quiz.php:
|
891 |
msgid "Your answer is not correct."
|
892 |
msgstr ""
|
893 |
|
894 |
-
#: contact-form-7/modules/quiz.php:
|
895 |
msgid "Quiz"
|
896 |
msgstr ""
|
897 |
|
898 |
-
#: contact-form-7/modules/quiz.php:
|
899 |
msgid "Quizzes"
|
900 |
msgstr ""
|
901 |
|
902 |
-
#: contact-form-7/modules/quiz.php:
|
903 |
msgid "* quiz|answer (e.g. 1+1=?|2)"
|
904 |
msgstr ""
|
905 |
|
906 |
-
#: contact-form-7/modules/select.php:
|
907 |
msgid "Drop-down menu"
|
908 |
msgstr ""
|
909 |
|
910 |
-
#: contact-form-7/modules/select.php:
|
911 |
msgid "Allow multiple selections?"
|
912 |
msgstr ""
|
913 |
|
914 |
-
#: contact-form-7/modules/select.php:
|
915 |
msgid "Insert a blank item as the first option?"
|
916 |
msgstr ""
|
917 |
|
918 |
-
#: contact-form-7/modules/submit.php:
|
919 |
msgid "Submit button"
|
920 |
msgstr ""
|
921 |
|
922 |
-
#: contact-form-7/modules/submit.php:
|
923 |
msgid "Label"
|
924 |
msgstr ""
|
925 |
|
926 |
-
#: contact-form-7/modules/text.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
927 |
msgid "Text field"
|
928 |
msgstr ""
|
929 |
|
930 |
-
#: contact-form-7/modules/text.php:
|
931 |
-
msgid "Email
|
932 |
msgstr ""
|
933 |
|
934 |
-
#: contact-form-7/modules/text.php:
|
935 |
-
msgid "
|
936 |
msgstr ""
|
937 |
|
938 |
-
#: contact-form-7/modules/text.php:
|
939 |
-
msgid "
|
940 |
msgstr ""
|
941 |
|
942 |
-
#: contact-form-7/modules/text.php:
|
943 |
-
msgid "
|
944 |
msgstr ""
|
945 |
|
946 |
-
#: contact-form-7/modules/text.php:
|
947 |
-
msgid "This field requires author's
|
948 |
msgstr ""
|
949 |
|
950 |
-
#: contact-form-7/modules/text.php:
|
951 |
-
msgid "
|
952 |
msgstr ""
|
953 |
|
954 |
-
#: contact-form-7/modules/text.php:
|
955 |
-
msgid "
|
956 |
msgstr ""
|
957 |
|
958 |
-
#: contact-form-7/modules/textarea.php:
|
959 |
msgid "Text area"
|
960 |
msgstr ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Contact Form 7\n"
|
4 |
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: 2013-04-06 18:43+0900\n"
|
6 |
+
"PO-Revision-Date: 2013-04-06 18:44+0900\n"
|
7 |
"Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
|
8 |
"Language-Team: \n"
|
9 |
"MIME-Version: 1.0\n"
|
13 |
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_c\n"
|
14 |
"X-Poedit-Basepath: ../..\n"
|
15 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
16 |
+
"X-Generator: Poedit 1.5.5\n"
|
17 |
"X-Poedit-SearchPath-0: contact-form-7\n"
|
18 |
|
19 |
#: contact-form-7/wp-contact-form-7.php:5
|
20 |
msgid "Just another contact form plugin. Simple but flexible."
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: contact-form-7/settings.php:202
|
24 |
#, php-format
|
25 |
msgid "Contact form %d"
|
26 |
msgstr ""
|
221 |
msgstr ""
|
222 |
|
223 |
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:14
|
224 |
+
#: contact-form-7/modules/date.php:138
|
225 |
msgid "Date"
|
226 |
msgstr ""
|
227 |
|
268 |
msgstr ""
|
269 |
|
270 |
#: contact-form-7/admin/includes/meta-boxes.php:80
|
271 |
+
#: contact-form-7/includes/functions.php:112
|
272 |
msgid "Message body:"
|
273 |
msgstr ""
|
274 |
|
276 |
msgid "Contact Form"
|
277 |
msgstr ""
|
278 |
|
279 |
+
#: contact-form-7/includes/classes.php:810
|
280 |
msgid "Untitled"
|
281 |
msgstr ""
|
282 |
|
339 |
msgstr ""
|
340 |
|
341 |
#: contact-form-7/includes/functions.php:55
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
342 |
msgid "There is a field that the sender must fill in"
|
343 |
msgstr ""
|
344 |
|
345 |
+
#: contact-form-7/includes/functions.php:56
|
346 |
msgid "Please fill the required field."
|
347 |
msgstr ""
|
348 |
|
349 |
+
#: contact-form-7/includes/functions.php:80
|
350 |
msgid "Your Name"
|
351 |
msgstr ""
|
352 |
|
353 |
+
#: contact-form-7/includes/functions.php:80
|
354 |
+
#: contact-form-7/includes/functions.php:82
|
355 |
msgid "(required)"
|
356 |
msgstr ""
|
357 |
|
358 |
+
#: contact-form-7/includes/functions.php:82
|
359 |
msgid "Your Email"
|
360 |
msgstr ""
|
361 |
|
362 |
+
#: contact-form-7/includes/functions.php:84
|
363 |
msgid "Subject"
|
364 |
msgstr ""
|
365 |
|
366 |
+
#: contact-form-7/includes/functions.php:86
|
367 |
msgid "Your Message"
|
368 |
msgstr ""
|
369 |
|
370 |
+
#: contact-form-7/includes/functions.php:88
|
371 |
+
#: contact-form-7/modules/submit.php:24
|
372 |
msgid "Send"
|
373 |
msgstr ""
|
374 |
|
375 |
+
#: contact-form-7/includes/functions.php:96
|
376 |
#, php-format
|
377 |
msgid "From: %s"
|
378 |
msgstr ""
|
379 |
|
380 |
+
#: contact-form-7/includes/functions.php:97
|
381 |
#, php-format
|
382 |
msgid "Subject: %s"
|
383 |
msgstr ""
|
384 |
|
385 |
+
#: contact-form-7/includes/functions.php:98
|
386 |
msgid "Message Body:"
|
387 |
msgstr ""
|
388 |
|
389 |
+
#: contact-form-7/includes/functions.php:99
|
390 |
+
#: contact-form-7/includes/functions.php:113
|
391 |
#, php-format
|
392 |
msgid "This mail is sent via contact form on %1$s %2$s"
|
393 |
msgstr ""
|
394 |
|
395 |
+
#: contact-form-7/includes/functions.php:149
|
396 |
msgid "Afrikaans"
|
397 |
msgstr ""
|
398 |
|
399 |
+
#: contact-form-7/includes/functions.php:150
|
400 |
msgid "Albanian"
|
401 |
msgstr ""
|
402 |
|
403 |
+
#: contact-form-7/includes/functions.php:151
|
404 |
msgid "Arabic"
|
405 |
msgstr ""
|
406 |
|
407 |
+
#: contact-form-7/includes/functions.php:152
|
408 |
msgid "Armenian"
|
409 |
msgstr ""
|
410 |
|
411 |
+
#: contact-form-7/includes/functions.php:153
|
412 |
msgid "Azerbaijani"
|
413 |
msgstr ""
|
414 |
|
415 |
+
#: contact-form-7/includes/functions.php:154
|
416 |
msgid "Bangla"
|
417 |
msgstr ""
|
418 |
|
419 |
+
#: contact-form-7/includes/functions.php:155
|
420 |
msgid "Basque"
|
421 |
msgstr ""
|
422 |
|
423 |
+
#: contact-form-7/includes/functions.php:156
|
424 |
msgid "Belarusian"
|
425 |
msgstr ""
|
426 |
|
427 |
+
#: contact-form-7/includes/functions.php:157
|
428 |
msgid "Bosnian"
|
429 |
msgstr ""
|
430 |
|
431 |
+
#: contact-form-7/includes/functions.php:158
|
432 |
msgid "Brazilian Portuguese"
|
433 |
msgstr ""
|
434 |
|
435 |
+
#: contact-form-7/includes/functions.php:159
|
436 |
msgid "Bulgarian"
|
437 |
msgstr ""
|
438 |
|
439 |
+
#: contact-form-7/includes/functions.php:160
|
440 |
msgid "Catalan"
|
441 |
msgstr ""
|
442 |
|
443 |
+
#: contact-form-7/includes/functions.php:161
|
444 |
msgid "Chinese (Simplified)"
|
445 |
msgstr ""
|
446 |
|
447 |
+
#: contact-form-7/includes/functions.php:162
|
448 |
msgid "Chinese (Traditional)"
|
449 |
msgstr ""
|
450 |
|
451 |
+
#: contact-form-7/includes/functions.php:163
|
452 |
msgid "Croatian"
|
453 |
msgstr ""
|
454 |
|
455 |
+
#: contact-form-7/includes/functions.php:164
|
456 |
msgid "Czech"
|
457 |
msgstr ""
|
458 |
|
459 |
+
#: contact-form-7/includes/functions.php:165
|
460 |
msgid "Danish"
|
461 |
msgstr ""
|
462 |
|
463 |
+
#: contact-form-7/includes/functions.php:166
|
464 |
msgid "Dutch"
|
465 |
msgstr ""
|
466 |
|
467 |
+
#: contact-form-7/includes/functions.php:167
|
468 |
msgid "English"
|
469 |
msgstr ""
|
470 |
|
471 |
+
#: contact-form-7/includes/functions.php:168
|
472 |
msgid "Esperanto"
|
473 |
msgstr ""
|
474 |
|
475 |
+
#: contact-form-7/includes/functions.php:169
|
476 |
msgid "Estonian"
|
477 |
msgstr ""
|
478 |
|
479 |
+
#: contact-form-7/includes/functions.php:170
|
480 |
msgid "Finnish"
|
481 |
msgstr ""
|
482 |
|
483 |
+
#: contact-form-7/includes/functions.php:171
|
484 |
msgid "French"
|
485 |
msgstr ""
|
486 |
|
487 |
+
#: contact-form-7/includes/functions.php:172
|
488 |
msgid "Galician"
|
489 |
msgstr ""
|
490 |
|
491 |
+
#: contact-form-7/includes/functions.php:173
|
492 |
msgid "Georgian"
|
493 |
msgstr ""
|
494 |
|
495 |
+
#: contact-form-7/includes/functions.php:174
|
496 |
msgid "German"
|
497 |
msgstr ""
|
498 |
|
499 |
+
#: contact-form-7/includes/functions.php:175
|
500 |
msgid "Greek"
|
501 |
msgstr ""
|
502 |
|
503 |
+
#: contact-form-7/includes/functions.php:176
|
504 |
msgid "Hebrew"
|
505 |
msgstr ""
|
506 |
|
507 |
+
#: contact-form-7/includes/functions.php:177
|
508 |
msgid "Hindi"
|
509 |
msgstr ""
|
510 |
|
511 |
+
#: contact-form-7/includes/functions.php:178
|
512 |
msgid "Hungarian"
|
513 |
msgstr ""
|
514 |
|
515 |
+
#: contact-form-7/includes/functions.php:179
|
516 |
msgid "Indonesian"
|
517 |
msgstr ""
|
518 |
|
519 |
+
#: contact-form-7/includes/functions.php:180
|
520 |
msgid "Irish"
|
521 |
msgstr ""
|
522 |
|
523 |
+
#: contact-form-7/includes/functions.php:181
|
524 |
msgid "Italian"
|
525 |
msgstr ""
|
526 |
|
527 |
+
#: contact-form-7/includes/functions.php:182
|
528 |
msgid "Japanese"
|
529 |
msgstr ""
|
530 |
|
531 |
+
#: contact-form-7/includes/functions.php:183
|
532 |
msgid "Korean"
|
533 |
msgstr ""
|
534 |
|
535 |
+
#: contact-form-7/includes/functions.php:184
|
536 |
msgid "Latvian"
|
537 |
msgstr ""
|
538 |
|
539 |
+
#: contact-form-7/includes/functions.php:185
|
540 |
msgid "Lithuanian"
|
541 |
msgstr ""
|
542 |
|
543 |
+
#: contact-form-7/includes/functions.php:186
|
544 |
msgid "Macedonian"
|
545 |
msgstr ""
|
546 |
|
547 |
+
#: contact-form-7/includes/functions.php:187
|
548 |
msgid "Malay"
|
549 |
msgstr ""
|
550 |
|
551 |
+
#: contact-form-7/includes/functions.php:188
|
552 |
msgid "Malayalam"
|
553 |
msgstr ""
|
554 |
|
555 |
+
#: contact-form-7/includes/functions.php:189
|
556 |
msgid "Maltese"
|
557 |
msgstr ""
|
558 |
|
559 |
+
#: contact-form-7/includes/functions.php:190
|
560 |
msgid "Norwegian"
|
561 |
msgstr ""
|
562 |
|
563 |
+
#: contact-form-7/includes/functions.php:191
|
564 |
msgid "Persian"
|
565 |
msgstr ""
|
566 |
|
567 |
+
#: contact-form-7/includes/functions.php:192
|
568 |
msgid "Polish"
|
569 |
msgstr ""
|
570 |
|
571 |
+
#: contact-form-7/includes/functions.php:193
|
572 |
msgid "Portuguese"
|
573 |
msgstr ""
|
574 |
|
575 |
+
#: contact-form-7/includes/functions.php:194
|
576 |
msgid "Russian"
|
577 |
msgstr ""
|
578 |
|
579 |
+
#: contact-form-7/includes/functions.php:195
|
580 |
msgid "Romanian"
|
581 |
msgstr ""
|
582 |
|
583 |
+
#: contact-form-7/includes/functions.php:196
|
584 |
msgid "Serbian"
|
585 |
msgstr ""
|
586 |
|
587 |
+
#: contact-form-7/includes/functions.php:197
|
588 |
msgid "Sinhala"
|
589 |
msgstr ""
|
590 |
|
591 |
+
#: contact-form-7/includes/functions.php:198
|
592 |
msgid "Slovak"
|
593 |
msgstr ""
|
594 |
|
595 |
+
#: contact-form-7/includes/functions.php:199
|
596 |
msgid "Slovene"
|
597 |
msgstr ""
|
598 |
|
599 |
+
#: contact-form-7/includes/functions.php:200
|
600 |
msgid "Spanish"
|
601 |
msgstr ""
|
602 |
|
603 |
+
#: contact-form-7/includes/functions.php:201
|
604 |
msgid "Swedish"
|
605 |
msgstr ""
|
606 |
|
607 |
+
#: contact-form-7/includes/functions.php:202
|
608 |
msgid "Tamil"
|
609 |
msgstr ""
|
610 |
|
611 |
+
#: contact-form-7/includes/functions.php:203
|
612 |
msgid "Thai"
|
613 |
msgstr ""
|
614 |
|
615 |
+
#: contact-form-7/includes/functions.php:204
|
616 |
msgid "Tagalog"
|
617 |
msgstr ""
|
618 |
|
619 |
+
#: contact-form-7/includes/functions.php:205
|
620 |
msgid "Turkish"
|
621 |
msgstr ""
|
622 |
|
623 |
+
#: contact-form-7/includes/functions.php:206
|
624 |
msgid "Ukrainian"
|
625 |
msgstr ""
|
626 |
|
627 |
+
#: contact-form-7/includes/functions.php:207
|
628 |
msgid "Vietnamese"
|
629 |
msgstr ""
|
630 |
|
631 |
+
#: contact-form-7/modules/acceptance.php:133
|
632 |
msgid "Acceptance"
|
633 |
msgstr ""
|
634 |
|
635 |
+
#: contact-form-7/modules/acceptance.php:142
|
636 |
+
#: contact-form-7/modules/captcha.php:200
|
637 |
+
#: contact-form-7/modules/checkbox.php:181 contact-form-7/modules/date.php:155
|
638 |
+
#: contact-form-7/modules/file.php:234 contact-form-7/modules/number.php:167
|
639 |
+
#: contact-form-7/modules/quiz.php:159 contact-form-7/modules/select.php:143
|
640 |
+
#: contact-form-7/modules/text.php:229 contact-form-7/modules/textarea.php:106
|
641 |
msgid "Name"
|
642 |
msgstr ""
|
643 |
|
644 |
+
#: contact-form-7/modules/acceptance.php:147
|
645 |
+
#: contact-form-7/modules/acceptance.php:150
|
646 |
+
#: contact-form-7/modules/captcha.php:207
|
647 |
+
#: contact-form-7/modules/captcha.php:210
|
648 |
+
#: contact-form-7/modules/captcha.php:215
|
649 |
+
#: contact-form-7/modules/captcha.php:218
|
650 |
#: contact-form-7/modules/captcha.php:222
|
|
|
|
|
651 |
#: contact-form-7/modules/captcha.php:233
|
652 |
+
#: contact-form-7/modules/captcha.php:236
|
653 |
+
#: contact-form-7/modules/captcha.php:241
|
654 |
+
#: contact-form-7/modules/captcha.php:244
|
655 |
+
#: contact-form-7/modules/checkbox.php:186
|
656 |
+
#: contact-form-7/modules/checkbox.php:189 contact-form-7/modules/date.php:160
|
657 |
+
#: contact-form-7/modules/date.php:163 contact-form-7/modules/date.php:168
|
658 |
+
#: contact-form-7/modules/date.php:171 contact-form-7/modules/date.php:176
|
659 |
+
#: contact-form-7/modules/date.php:181 contact-form-7/modules/file.php:239
|
660 |
+
#: contact-form-7/modules/file.php:242 contact-form-7/modules/file.php:247
|
661 |
+
#: contact-form-7/modules/file.php:250 contact-form-7/modules/number.php:172
|
662 |
+
#: contact-form-7/modules/number.php:175 contact-form-7/modules/number.php:180
|
663 |
+
#: contact-form-7/modules/number.php:183 contact-form-7/modules/number.php:188
|
664 |
+
#: contact-form-7/modules/number.php:193 contact-form-7/modules/quiz.php:164
|
665 |
+
#: contact-form-7/modules/quiz.php:167 contact-form-7/modules/quiz.php:172
|
666 |
+
#: contact-form-7/modules/quiz.php:175 contact-form-7/modules/select.php:148
|
667 |
+
#: contact-form-7/modules/select.php:151 contact-form-7/modules/submit.php:55
|
668 |
+
#: contact-form-7/modules/submit.php:58 contact-form-7/modules/submit.php:63
|
669 |
+
#: contact-form-7/modules/text.php:234 contact-form-7/modules/text.php:237
|
670 |
+
#: contact-form-7/modules/text.php:242 contact-form-7/modules/text.php:245
|
671 |
+
#: contact-form-7/modules/text.php:251 contact-form-7/modules/text.php:264
|
672 |
+
#: contact-form-7/modules/textarea.php:111
|
673 |
+
#: contact-form-7/modules/textarea.php:114
|
674 |
+
#: contact-form-7/modules/textarea.php:119
|
675 |
+
#: contact-form-7/modules/textarea.php:122
|
676 |
+
#: contact-form-7/modules/textarea.php:127
|
677 |
+
#: contact-form-7/modules/textarea.php:132
|
678 |
msgid "optional"
|
679 |
msgstr ""
|
680 |
|
681 |
+
#: contact-form-7/modules/acceptance.php:156
|
682 |
msgid "Make this checkbox checked by default?"
|
683 |
msgstr ""
|
684 |
|
685 |
+
#: contact-form-7/modules/acceptance.php:157
|
686 |
msgid "Make this checkbox work inversely?"
|
687 |
msgstr ""
|
688 |
|
689 |
+
#: contact-form-7/modules/acceptance.php:158
|
690 |
msgid "* That means visitor who accepts the term unchecks it."
|
691 |
msgstr ""
|
692 |
|
693 |
+
#: contact-form-7/modules/acceptance.php:163
|
694 |
+
#: contact-form-7/modules/captcha.php:249
|
695 |
+
#: contact-form-7/modules/checkbox.php:209 contact-form-7/modules/date.php:189
|
696 |
+
#: contact-form-7/modules/file.php:255 contact-form-7/modules/number.php:201
|
697 |
+
#: contact-form-7/modules/quiz.php:187 contact-form-7/modules/select.php:168
|
698 |
+
#: contact-form-7/modules/submit.php:70 contact-form-7/modules/text.php:272
|
699 |
+
#: contact-form-7/modules/textarea.php:140
|
700 |
msgid "Copy this code and paste it into the form left."
|
701 |
msgstr ""
|
702 |
|
703 |
+
#: contact-form-7/modules/captcha.php:15
|
704 |
msgid ""
|
705 |
"To use CAPTCHA, you need <a href=\"http://wordpress.org/extend/plugins/"
|
706 |
"really-simple-captcha/\">Really Simple CAPTCHA</a> plugin installed."
|
707 |
msgstr ""
|
708 |
|
709 |
+
#: contact-form-7/modules/captcha.php:172
|
710 |
msgid "The code that sender entered does not match the CAPTCHA"
|
711 |
msgstr ""
|
712 |
|
713 |
+
#: contact-form-7/modules/captcha.php:173
|
714 |
msgid "Your entered code is incorrect."
|
715 |
msgstr ""
|
716 |
|
717 |
+
#: contact-form-7/modules/captcha.php:186
|
718 |
msgid "CAPTCHA"
|
719 |
msgstr ""
|
720 |
|
721 |
+
#: contact-form-7/modules/captcha.php:197
|
722 |
msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
|
723 |
msgstr ""
|
724 |
|
725 |
+
#: contact-form-7/modules/captcha.php:204
|
726 |
msgid "Image settings"
|
727 |
msgstr ""
|
728 |
|
729 |
+
#: contact-form-7/modules/captcha.php:215
|
730 |
msgid "Foreground color"
|
731 |
msgstr ""
|
732 |
|
733 |
+
#: contact-form-7/modules/captcha.php:218
|
734 |
msgid "Background color"
|
735 |
msgstr ""
|
736 |
|
737 |
+
#: contact-form-7/modules/captcha.php:222
|
738 |
msgid "Image size"
|
739 |
msgstr ""
|
740 |
|
741 |
+
#: contact-form-7/modules/captcha.php:223
|
742 |
msgid "Small"
|
743 |
msgstr ""
|
744 |
|
745 |
+
#: contact-form-7/modules/captcha.php:224
|
746 |
msgid "Medium"
|
747 |
msgstr ""
|
748 |
|
749 |
+
#: contact-form-7/modules/captcha.php:225
|
750 |
msgid "Large"
|
751 |
msgstr ""
|
752 |
|
753 |
+
#: contact-form-7/modules/captcha.php:230
|
754 |
msgid "Input field settings"
|
755 |
msgstr ""
|
756 |
|
757 |
+
#: contact-form-7/modules/captcha.php:250
|
758 |
msgid "For image"
|
759 |
msgstr ""
|
760 |
|
761 |
+
#: contact-form-7/modules/captcha.php:252
|
762 |
msgid "For input field"
|
763 |
msgstr ""
|
764 |
|
765 |
+
#: contact-form-7/modules/captcha.php:282
|
766 |
#, php-format
|
767 |
msgid ""
|
768 |
"This contact form contains CAPTCHA fields, but the temporary folder for the "
|
770 |
"change its permission manually."
|
771 |
msgstr ""
|
772 |
|
773 |
+
#: contact-form-7/modules/captcha.php:288
|
774 |
msgid ""
|
775 |
"This contact form contains CAPTCHA fields, but the necessary libraries (GD "
|
776 |
"and FreeType) are not available on your server."
|
777 |
msgstr ""
|
778 |
|
779 |
+
#: contact-form-7/modules/checkbox.php:154
|
780 |
msgid "Checkboxes"
|
781 |
msgstr ""
|
782 |
|
783 |
+
#: contact-form-7/modules/checkbox.php:157
|
784 |
msgid "Radio buttons"
|
785 |
msgstr ""
|
786 |
|
787 |
+
#: contact-form-7/modules/checkbox.php:178 contact-form-7/modules/date.php:154
|
788 |
+
#: contact-form-7/modules/file.php:233 contact-form-7/modules/number.php:166
|
789 |
+
#: contact-form-7/modules/select.php:142 contact-form-7/modules/text.php:228
|
790 |
+
#: contact-form-7/modules/textarea.php:105
|
791 |
msgid "Required field?"
|
792 |
msgstr ""
|
793 |
|
794 |
+
#: contact-form-7/modules/checkbox.php:194
|
795 |
+
#: contact-form-7/modules/select.php:156
|
796 |
msgid "Choices"
|
797 |
msgstr ""
|
798 |
|
799 |
+
#: contact-form-7/modules/checkbox.php:196
|
800 |
+
#: contact-form-7/modules/select.php:158
|
801 |
msgid "* One choice per line."
|
802 |
msgstr ""
|
803 |
|
804 |
+
#: contact-form-7/modules/checkbox.php:200
|
805 |
msgid "Put a label first, a checkbox last?"
|
806 |
msgstr ""
|
807 |
|
808 |
+
#: contact-form-7/modules/checkbox.php:201
|
809 |
msgid "Wrap each item with <label> tag?"
|
810 |
msgstr ""
|
811 |
|
812 |
+
#: contact-form-7/modules/checkbox.php:203
|
813 |
msgid "Make checkboxes exclusive?"
|
814 |
msgstr ""
|
815 |
|
816 |
+
#: contact-form-7/modules/checkbox.php:211 contact-form-7/modules/date.php:191
|
817 |
+
#: contact-form-7/modules/number.php:203 contact-form-7/modules/select.php:170
|
818 |
+
#: contact-form-7/modules/text.php:274 contact-form-7/modules/textarea.php:142
|
819 |
msgid "And, put this code into the Mail fields below."
|
820 |
msgstr ""
|
821 |
|
822 |
+
#: contact-form-7/modules/date.php:114
|
823 |
+
msgid "Date format that the sender entered is invalid"
|
824 |
+
msgstr ""
|
825 |
+
|
826 |
+
#: contact-form-7/modules/date.php:115
|
827 |
+
msgid "Date format seems invalid."
|
828 |
+
msgstr ""
|
829 |
+
|
830 |
+
#: contact-form-7/modules/date.php:119
|
831 |
+
msgid "Date is earlier than minimum limit"
|
832 |
+
msgstr ""
|
833 |
+
|
834 |
+
#: contact-form-7/modules/date.php:120
|
835 |
+
msgid "This date is too early."
|
836 |
+
msgstr ""
|
837 |
+
|
838 |
+
#: contact-form-7/modules/date.php:124
|
839 |
+
msgid "Date is later than maximum limit"
|
840 |
+
msgstr ""
|
841 |
+
|
842 |
+
#: contact-form-7/modules/date.php:125
|
843 |
+
msgid "This date is too late."
|
844 |
+
msgstr ""
|
845 |
+
|
846 |
+
#: contact-form-7/modules/date.php:181 contact-form-7/modules/number.php:193
|
847 |
+
#: contact-form-7/modules/text.php:264 contact-form-7/modules/textarea.php:132
|
848 |
+
msgid "Default value"
|
849 |
+
msgstr ""
|
850 |
+
|
851 |
+
#: contact-form-7/modules/date.php:184 contact-form-7/modules/number.php:196
|
852 |
+
#: contact-form-7/modules/text.php:267 contact-form-7/modules/textarea.php:135
|
853 |
+
msgid "Use this text as placeholder?"
|
854 |
+
msgstr ""
|
855 |
+
|
856 |
+
#: contact-form-7/modules/file.php:194
|
857 |
msgid "Uploading a file fails for any reason"
|
858 |
msgstr ""
|
859 |
|
860 |
+
#: contact-form-7/modules/file.php:195
|
861 |
msgid "Failed to upload file."
|
862 |
msgstr ""
|
863 |
|
864 |
+
#: contact-form-7/modules/file.php:199
|
865 |
msgid "Uploaded file is not allowed file type"
|
866 |
msgstr ""
|
867 |
|
868 |
+
#: contact-form-7/modules/file.php:200
|
869 |
msgid "This file type is not allowed."
|
870 |
msgstr ""
|
871 |
|
872 |
+
#: contact-form-7/modules/file.php:204
|
873 |
msgid "Uploaded file is too large"
|
874 |
msgstr ""
|
875 |
|
876 |
+
#: contact-form-7/modules/file.php:205
|
877 |
msgid "This file is too large."
|
878 |
msgstr ""
|
879 |
|
880 |
+
#: contact-form-7/modules/file.php:209
|
881 |
msgid "Uploading a file fails for PHP error"
|
882 |
msgstr ""
|
883 |
|
884 |
+
#: contact-form-7/modules/file.php:210
|
885 |
msgid "Failed to upload file. Error occurred."
|
886 |
msgstr ""
|
887 |
|
888 |
+
#: contact-form-7/modules/file.php:224
|
889 |
msgid "File upload"
|
890 |
msgstr ""
|
891 |
|
892 |
+
#: contact-form-7/modules/file.php:247
|
893 |
msgid "File size limit"
|
894 |
msgstr ""
|
895 |
|
896 |
+
#: contact-form-7/modules/file.php:247
|
897 |
msgid "bytes"
|
898 |
msgstr ""
|
899 |
|
900 |
+
#: contact-form-7/modules/file.php:250
|
901 |
msgid "Acceptable file types"
|
902 |
msgstr ""
|
903 |
|
904 |
+
#: contact-form-7/modules/file.php:257
|
905 |
msgid "And, put this code into the File Attachments field below."
|
906 |
msgstr ""
|
907 |
|
908 |
+
#: contact-form-7/modules/file.php:282
|
909 |
#, php-format
|
910 |
msgid ""
|
911 |
"This contact form contains file uploading fields, but the temporary folder "
|
920 |
"strong> <a href=\"%s\" target=\"_blank\">See how to avoid it.</a>"
|
921 |
msgstr ""
|
922 |
|
923 |
+
#: contact-form-7/modules/number.php:119
|
924 |
+
msgid "Number format that the sender entered is invalid"
|
925 |
+
msgstr ""
|
926 |
+
|
927 |
+
#: contact-form-7/modules/number.php:120
|
928 |
+
msgid "Number format seems invalid."
|
929 |
+
msgstr ""
|
930 |
+
|
931 |
+
#: contact-form-7/modules/number.php:124
|
932 |
+
msgid "Number is smaller than minimum limit"
|
933 |
+
msgstr ""
|
934 |
+
|
935 |
+
#: contact-form-7/modules/number.php:125
|
936 |
+
msgid "This number is too small."
|
937 |
+
msgstr ""
|
938 |
+
|
939 |
+
#: contact-form-7/modules/number.php:129
|
940 |
+
msgid "Number is larger than maximum limit"
|
941 |
+
msgstr ""
|
942 |
+
|
943 |
+
#: contact-form-7/modules/number.php:130
|
944 |
+
msgid "This number is too large."
|
945 |
+
msgstr ""
|
946 |
+
|
947 |
+
#: contact-form-7/modules/number.php:143
|
948 |
+
msgid "Number (spinbox)"
|
949 |
+
msgstr ""
|
950 |
+
|
951 |
+
#: contact-form-7/modules/number.php:146
|
952 |
+
msgid "Number (slider)"
|
953 |
+
msgstr ""
|
954 |
+
|
955 |
+
#: contact-form-7/modules/quiz.php:136
|
956 |
msgid "Sender doesn't enter the correct answer to the quiz"
|
957 |
msgstr ""
|
958 |
|
959 |
+
#: contact-form-7/modules/quiz.php:137
|
960 |
msgid "Your answer is not correct."
|
961 |
msgstr ""
|
962 |
|
963 |
+
#: contact-form-7/modules/quiz.php:150
|
964 |
msgid "Quiz"
|
965 |
msgstr ""
|
966 |
|
967 |
+
#: contact-form-7/modules/quiz.php:180
|
968 |
msgid "Quizzes"
|
969 |
msgstr ""
|
970 |
|
971 |
+
#: contact-form-7/modules/quiz.php:182
|
972 |
msgid "* quiz|answer (e.g. 1+1=?|2)"
|
973 |
msgstr ""
|
974 |
|
975 |
+
#: contact-form-7/modules/select.php:133
|
976 |
msgid "Drop-down menu"
|
977 |
msgstr ""
|
978 |
|
979 |
+
#: contact-form-7/modules/select.php:162
|
980 |
msgid "Allow multiple selections?"
|
981 |
msgstr ""
|
982 |
|
983 |
+
#: contact-form-7/modules/select.php:163
|
984 |
msgid "Insert a blank item as the first option?"
|
985 |
msgstr ""
|
986 |
|
987 |
+
#: contact-form-7/modules/submit.php:45
|
988 |
msgid "Submit button"
|
989 |
msgstr ""
|
990 |
|
991 |
+
#: contact-form-7/modules/submit.php:63
|
992 |
msgid "Label"
|
993 |
msgstr ""
|
994 |
|
995 |
+
#: contact-form-7/modules/text.php:167
|
996 |
+
msgid "Email address that the sender entered is invalid"
|
997 |
+
msgstr ""
|
998 |
+
|
999 |
+
#: contact-form-7/modules/text.php:168
|
1000 |
+
msgid "Email address seems invalid."
|
1001 |
+
msgstr ""
|
1002 |
+
|
1003 |
+
#: contact-form-7/modules/text.php:172
|
1004 |
+
msgid "URL that the sender entered is invalid"
|
1005 |
+
msgstr ""
|
1006 |
+
|
1007 |
+
#: contact-form-7/modules/text.php:173
|
1008 |
+
msgid "URL seems invalid."
|
1009 |
+
msgstr ""
|
1010 |
+
|
1011 |
+
#: contact-form-7/modules/text.php:177
|
1012 |
+
msgid "Telephone number that the sender entered is invalid"
|
1013 |
+
msgstr ""
|
1014 |
+
|
1015 |
+
#: contact-form-7/modules/text.php:178
|
1016 |
+
msgid "Telephone number seems invalid."
|
1017 |
+
msgstr ""
|
1018 |
+
|
1019 |
+
#: contact-form-7/modules/text.php:191
|
1020 |
msgid "Text field"
|
1021 |
msgstr ""
|
1022 |
|
1023 |
+
#: contact-form-7/modules/text.php:194
|
1024 |
+
msgid "Email"
|
1025 |
msgstr ""
|
1026 |
|
1027 |
+
#: contact-form-7/modules/text.php:197
|
1028 |
+
msgid "URL"
|
1029 |
msgstr ""
|
1030 |
|
1031 |
+
#: contact-form-7/modules/text.php:200
|
1032 |
+
msgid "Telephone number"
|
1033 |
msgstr ""
|
1034 |
|
1035 |
+
#: contact-form-7/modules/text.php:251
|
1036 |
+
msgid "Akismet"
|
1037 |
msgstr ""
|
1038 |
|
1039 |
+
#: contact-form-7/modules/text.php:253
|
1040 |
+
msgid "This field requires author's name"
|
1041 |
msgstr ""
|
1042 |
|
1043 |
+
#: contact-form-7/modules/text.php:255
|
1044 |
+
msgid "This field requires author's email address"
|
1045 |
msgstr ""
|
1046 |
|
1047 |
+
#: contact-form-7/modules/text.php:257
|
1048 |
+
msgid "This field requires author's URL"
|
1049 |
msgstr ""
|
1050 |
|
1051 |
+
#: contact-form-7/modules/textarea.php:96
|
1052 |
msgid "Text area"
|
1053 |
msgstr ""
|
modules/acceptance.php
CHANGED
@@ -5,61 +5,47 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
|
10 |
-
function
|
11 |
-
|
12 |
-
|
|
|
13 |
|
14 |
-
|
15 |
-
$
|
16 |
-
$options = (array) $tag['options'];
|
17 |
-
$values = (array) $tag['values'];
|
18 |
|
19 |
-
if ( empty( $name ) )
|
20 |
return '';
|
21 |
|
22 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
23 |
|
24 |
-
$
|
25 |
-
|
26 |
-
$class_att = wpcf7_form_controls_class( $type );
|
27 |
|
28 |
if ( $validation_error )
|
29 |
-
$
|
30 |
-
|
31 |
-
foreach ( $options as $option ) {
|
32 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
33 |
-
$id_att = $matches[1];
|
34 |
-
|
35 |
-
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
36 |
-
$class_att .= ' ' . $matches[1];
|
37 |
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
-
$tabindex_att = (int) $matches[1];
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
if ( $id_att )
|
48 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
49 |
-
|
50 |
-
if ( $class_att )
|
51 |
-
$atts .= ' class="' . trim( $class_att ) . '"';
|
52 |
-
|
53 |
-
if ( '' !== $tabindex_att )
|
54 |
-
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
55 |
|
56 |
-
|
|
|
57 |
|
58 |
-
$
|
|
|
|
|
59 |
|
60 |
-
$
|
61 |
|
62 |
-
$html =
|
|
|
|
|
63 |
|
64 |
return $html;
|
65 |
}
|
@@ -73,16 +59,12 @@ function wpcf7_acceptance_validation_filter( $result, $tag ) {
|
|
73 |
if ( ! wpcf7_acceptance_as_validation() )
|
74 |
return $result;
|
75 |
|
76 |
-
$
|
77 |
-
|
78 |
-
if ( empty( $name ) )
|
79 |
-
return $result;
|
80 |
-
|
81 |
-
$options = (array) $tag['options'];
|
82 |
|
|
|
83 |
$value = ( ! empty( $_POST[$name] ) ? 1 : 0 );
|
84 |
|
85 |
-
$invert = (
|
86 |
|
87 |
if ( $invert && $value || ! $invert && ! $value ) {
|
88 |
$result['valid'] = false;
|
@@ -110,7 +92,7 @@ function wpcf7_acceptance_filter( $accepted ) {
|
|
110 |
if ( empty( $name ) )
|
111 |
continue;
|
112 |
|
113 |
-
$value = $_POST[$name] ? 1 : 0;
|
114 |
|
115 |
$invert = (bool) preg_grep( '%^invert$%', $options );
|
116 |
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_acceptance', 5 );
|
9 |
|
10 |
+
function wpcf7_add_shortcode_acceptance() {
|
11 |
+
wpcf7_add_shortcode( 'acceptance',
|
12 |
+
'wpcf7_acceptance_shortcode_handler', true );
|
13 |
+
}
|
14 |
|
15 |
+
function wpcf7_acceptance_shortcode_handler( $tag ) {
|
16 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
17 |
|
18 |
+
if ( empty( $tag->name ) )
|
19 |
return '';
|
20 |
|
21 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
22 |
|
23 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
|
|
|
|
24 |
|
25 |
if ( $validation_error )
|
26 |
+
$class .= ' wpcf7-not-valid';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
if ( $tag->has_option( 'invert' ) )
|
29 |
+
$class .= ' wpcf7-invert';
|
30 |
|
31 |
+
$atts = array();
|
|
|
32 |
|
33 |
+
$atts['class'] = $tag->get_class_option( $class );
|
34 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
35 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
|
37 |
+
if ( $tag->has_option( 'default:on' ) )
|
38 |
+
$atts['checked'] = 'checked';
|
39 |
|
40 |
+
$atts['type'] = 'checkbox';
|
41 |
+
$atts['name'] = $tag->name;
|
42 |
+
$atts['value'] = '1';
|
43 |
|
44 |
+
$atts = wpcf7_format_atts( $atts );
|
45 |
|
46 |
+
$html = sprintf(
|
47 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
|
48 |
+
$tag->name, $atts, $validation_error );
|
49 |
|
50 |
return $html;
|
51 |
}
|
59 |
if ( ! wpcf7_acceptance_as_validation() )
|
60 |
return $result;
|
61 |
|
62 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
$name = $tag->name;
|
65 |
$value = ( ! empty( $_POST[$name] ) ? 1 : 0 );
|
66 |
|
67 |
+
$invert = $tag->has_option( 'invert' );
|
68 |
|
69 |
if ( $invert && $value || ! $invert && ! $value ) {
|
70 |
$result['valid'] = false;
|
92 |
if ( empty( $name ) )
|
93 |
continue;
|
94 |
|
95 |
+
$value = ( ! empty( $_POST[$name] ) ? 1 : 0 );
|
96 |
|
97 |
$invert = (bool) preg_grep( '%^invert$%', $options );
|
98 |
|
modules/captcha.php
CHANGED
@@ -5,113 +5,97 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
10 |
|
11 |
function wpcf7_captcha_shortcode_handler( $tag ) {
|
12 |
-
|
13 |
-
return '';
|
14 |
|
15 |
-
|
16 |
-
|
17 |
-
$options = (array) $tag['options'];
|
18 |
-
$values = (array) $tag['values'];
|
19 |
|
20 |
-
if ( empty( $name ) )
|
21 |
return '';
|
22 |
|
23 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
24 |
-
|
25 |
-
$atts = $id_att = $size_att = $maxlength_att = $tabindex_att = $title_att = '';
|
26 |
-
|
27 |
-
$class_att = wpcf7_form_controls_class( $type );
|
28 |
-
|
29 |
-
if ( 'captchac' == $type )
|
30 |
-
$class_att .= ' wpcf7-captcha-' . $name;
|
31 |
|
32 |
-
|
33 |
-
$class_att .= ' wpcf7-not-valid';
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
$id_att = $matches[1];
|
38 |
|
39 |
-
|
40 |
-
$class_att .= ' ' . $matches[1];
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
$maxlength_att = (int) $matches[2];
|
45 |
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
}
|
51 |
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
56 |
-
|
|
|
57 |
|
58 |
-
|
59 |
-
|
60 |
-
$title_att .= sprintf( ' %s', $value );
|
61 |
-
$value = '';
|
62 |
}
|
63 |
-
}
|
64 |
|
65 |
-
|
66 |
-
$atts
|
67 |
|
68 |
-
|
69 |
-
$atts .= ' class="' . trim( $class_att ) . '"';
|
70 |
|
71 |
-
|
72 |
-
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
|
73 |
-
return '<em>' . __( 'To use CAPTCHA, you need <a href="http://wordpress.org/extend/plugins/really-simple-captcha/">Really Simple CAPTCHA</a> plugin installed.', 'wpcf7' ) . '</em>';
|
74 |
-
}
|
75 |
|
76 |
-
$
|
77 |
-
|
78 |
-
|
79 |
-
$op['base'] = array( 6, 18 );
|
80 |
-
$op['font_size'] = 14;
|
81 |
-
$op['font_char_width'] = 15;
|
82 |
|
83 |
-
|
84 |
|
85 |
-
|
86 |
-
|
|
|
87 |
|
88 |
-
|
89 |
-
$atts .= ' width="' . $op['img_size'][0] . '" height="' . $op['img_size'][1] . '"';
|
90 |
|
91 |
-
$
|
92 |
-
$
|
93 |
-
$
|
94 |
-
$
|
|
|
95 |
|
96 |
-
|
97 |
|
98 |
-
|
99 |
-
|
100 |
-
$atts .= ' size="' . $size_att . '"';
|
101 |
-
else
|
102 |
-
$atts .= ' size="40"'; // default size
|
103 |
|
104 |
-
if ( $
|
105 |
-
$atts
|
|
|
|
|
106 |
|
107 |
-
|
108 |
-
|
|
|
109 |
|
110 |
-
|
111 |
-
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_att ) ) );
|
112 |
|
113 |
-
$html =
|
114 |
-
|
|
|
115 |
|
116 |
return $html;
|
117 |
}
|
@@ -123,19 +107,24 @@ function wpcf7_captcha_shortcode_handler( $tag ) {
|
|
123 |
add_filter( 'wpcf7_validate_captchar', 'wpcf7_captcha_validation_filter', 10, 2 );
|
124 |
|
125 |
function wpcf7_captcha_validation_filter( $result, $tag ) {
|
126 |
-
$
|
127 |
-
$name = $tag['name'];
|
128 |
|
129 |
-
$
|
|
|
130 |
|
131 |
$captchac = '_wpcf7_captcha_challenge_' . $name;
|
132 |
|
133 |
-
|
134 |
-
|
135 |
-
$result['reason'][$name] = wpcf7_get_message( 'captcha_not_match' );
|
136 |
-
}
|
137 |
|
138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
return $result;
|
141 |
}
|
@@ -254,10 +243,10 @@ function wpcf7_tg_pane_captcha( &$contact_form ) {
|
|
254 |
|
255 |
<tr>
|
256 |
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
257 |
-
<input type="
|
258 |
|
259 |
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
260 |
-
<input type="
|
261 |
</tr>
|
262 |
</table>
|
263 |
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_captcha', 5 );
|
9 |
+
|
10 |
+
function wpcf7_add_shortcode_captcha() {
|
11 |
+
wpcf7_add_shortcode( array( 'captchac', 'captchar' ),
|
12 |
+
'wpcf7_captcha_shortcode_handler', true );
|
13 |
+
}
|
14 |
|
15 |
function wpcf7_captcha_shortcode_handler( $tag ) {
|
16 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
17 |
|
18 |
+
if ( 'captchac' == $tag->type && ! class_exists( 'ReallySimpleCaptcha' ) )
|
19 |
+
return '<em>' . __( 'To use CAPTCHA, you need <a href="http://wordpress.org/extend/plugins/really-simple-captcha/">Really Simple CAPTCHA</a> plugin installed.', 'wpcf7' ) . '</em>';
|
|
|
|
|
20 |
|
21 |
+
if ( empty( $tag->name ) )
|
22 |
return '';
|
23 |
|
24 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
|
|
27 |
|
28 |
+
if ( 'captchac' == $tag->type ) { // CAPTCHA-Challenge (image)
|
29 |
+
$class .= ' wpcf7-captcha-' . $tag->name;
|
|
|
30 |
|
31 |
+
$atts = array();
|
|
|
32 |
|
33 |
+
$atts['class'] = $tag->get_class_option( $class );
|
34 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
|
|
35 |
|
36 |
+
$op = array( // Default
|
37 |
+
'img_size' => array( 72, 24 ),
|
38 |
+
'base' => array( 6, 18 ),
|
39 |
+
'font_size' => 14,
|
40 |
+
'font_char_width' => 15 );
|
41 |
|
42 |
+
$op = array_merge( $op, wpcf7_captchac_options( $tag->options ) );
|
|
|
43 |
|
44 |
+
if ( ! $filename = wpcf7_generate_captcha( $op ) )
|
45 |
+
return '';
|
46 |
|
47 |
+
if ( ! empty( $op['img_size'] ) ) {
|
48 |
+
if ( isset( $op['img_size'][0] ) )
|
49 |
+
$atts['width'] = $op['img_size'][0];
|
50 |
|
51 |
+
if ( isset( $op['img_size'][1] ) )
|
52 |
+
$atts['height'] = $op['img_size'][1];
|
|
|
|
|
53 |
}
|
|
|
54 |
|
55 |
+
$atts['alt'] = 'captcha';
|
56 |
+
$atts['src'] = trailingslashit( wpcf7_captcha_tmp_url() ) . $filename;
|
57 |
|
58 |
+
$atts = wpcf7_format_atts( $atts );
|
|
|
59 |
|
60 |
+
$prefix = substr( $filename, 0, strrpos( $filename, '.' ) );
|
|
|
|
|
|
|
61 |
|
62 |
+
$html = sprintf(
|
63 |
+
'<input type="hidden" name="_wpcf7_captcha_challenge_%1$s" value="%2$s" /><img %3$s />',
|
64 |
+
$tag->name, $prefix, $atts );
|
|
|
|
|
|
|
65 |
|
66 |
+
return $html;
|
67 |
|
68 |
+
} elseif ( 'captchar' == $tag->type ) { // CAPTCHA-Response (input)
|
69 |
+
if ( $validation_error )
|
70 |
+
$class .= ' wpcf7-not-valid';
|
71 |
|
72 |
+
$atts = array();
|
|
|
73 |
|
74 |
+
$atts['size'] = $tag->get_size_option( '40' );
|
75 |
+
$atts['maxlength'] = $tag->get_maxlength_option();
|
76 |
+
$atts['class'] = $tag->get_class_option( $class );
|
77 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
78 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
79 |
|
80 |
+
$value = (string) reset( $tag->values );
|
81 |
|
82 |
+
if ( wpcf7_is_posted() )
|
83 |
+
$value = '';
|
|
|
|
|
|
|
84 |
|
85 |
+
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
86 |
+
$atts['placeholder'] = $value;
|
87 |
+
$value = '';
|
88 |
+
}
|
89 |
|
90 |
+
$atts['value'] = $value;
|
91 |
+
$atts['type'] = 'text';
|
92 |
+
$atts['name'] = $tag->name;
|
93 |
|
94 |
+
$atts = wpcf7_format_atts( $atts );
|
|
|
95 |
|
96 |
+
$html = sprintf(
|
97 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
|
98 |
+
$tag->name, $atts, $validation_error );
|
99 |
|
100 |
return $html;
|
101 |
}
|
107 |
add_filter( 'wpcf7_validate_captchar', 'wpcf7_captcha_validation_filter', 10, 2 );
|
108 |
|
109 |
function wpcf7_captcha_validation_filter( $result, $tag ) {
|
110 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
111 |
|
112 |
+
$type = $tag->type;
|
113 |
+
$name = $tag->name;
|
114 |
|
115 |
$captchac = '_wpcf7_captcha_challenge_' . $name;
|
116 |
|
117 |
+
$prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : '';
|
118 |
+
$response = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
|
|
|
|
|
119 |
|
120 |
+
if ( $prefix ) {
|
121 |
+
if ( ! wpcf7_check_captcha( $prefix, $response ) ) {
|
122 |
+
$result['valid'] = false;
|
123 |
+
$result['reason'][$name] = wpcf7_get_message( 'captcha_not_match' );
|
124 |
+
}
|
125 |
+
|
126 |
+
wpcf7_remove_captcha( $prefix );
|
127 |
+
}
|
128 |
|
129 |
return $result;
|
130 |
}
|
243 |
|
244 |
<tr>
|
245 |
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
246 |
+
<input type="number" name="size" class="numeric oneline option" min="1" /></td>
|
247 |
|
248 |
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
249 |
+
<input type="number" name="maxlength" class="numeric oneline option" min="1" /></td>
|
250 |
</tr>
|
251 |
</table>
|
252 |
|
modules/checkbox.php
CHANGED
@@ -5,116 +5,101 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
-
wpcf7_add_shortcode( 'checkbox*', 'wpcf7_checkbox_shortcode_handler', true );
|
10 |
-
wpcf7_add_shortcode( 'radio', 'wpcf7_checkbox_shortcode_handler', true );
|
11 |
|
12 |
-
function
|
13 |
-
|
14 |
-
|
|
|
15 |
|
16 |
-
|
17 |
-
$
|
18 |
-
$options = (array) $tag['options'];
|
19 |
-
$values = (array) $tag['values'];
|
20 |
-
$labels = (array) $tag['labels'];
|
21 |
|
22 |
-
if ( empty( $name ) )
|
23 |
return '';
|
24 |
|
25 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
26 |
-
|
27 |
-
$atts = $id_att = $tabindex_att = '';
|
28 |
-
|
29 |
-
$defaults = array();
|
30 |
-
|
31 |
-
$label_first = false;
|
32 |
-
$use_label_element = false;
|
33 |
|
34 |
-
$
|
35 |
|
36 |
if ( $validation_error )
|
37 |
-
$
|
38 |
-
|
39 |
-
foreach ( $options as $option ) {
|
40 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
41 |
-
$id_att = $matches[1];
|
42 |
-
|
43 |
-
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
44 |
-
$class_att .= ' ' . $matches[1];
|
45 |
-
|
46 |
-
} elseif ( preg_match( '/^default:([0-9_]+)$/', $option, $matches ) ) {
|
47 |
-
$defaults = explode( '_', $matches[1] );
|
48 |
-
|
49 |
-
} elseif ( preg_match( '%^label[_-]?first$%', $option ) ) {
|
50 |
-
$label_first = true;
|
51 |
-
|
52 |
-
} elseif ( preg_match( '%^use[_-]?label[_-]?element$%', $option ) ) {
|
53 |
-
$use_label_element = true;
|
54 |
-
|
55 |
-
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
56 |
-
$tabindex_att = (int) $matches[1];
|
57 |
-
|
58 |
-
}
|
59 |
-
}
|
60 |
|
|
|
|
|
|
|
61 |
$multiple = false;
|
62 |
-
$exclusive = (bool) preg_grep( '%^exclusive$%', $options );
|
63 |
|
64 |
-
if ( 'checkbox' == $
|
65 |
$multiple = ! $exclusive;
|
66 |
-
|
67 |
$exclusive = false;
|
68 |
-
}
|
69 |
|
70 |
if ( $exclusive )
|
71 |
-
$
|
72 |
|
73 |
-
|
74 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
75 |
|
76 |
-
|
77 |
-
|
|
|
78 |
|
79 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
|
81 |
-
$
|
82 |
|
83 |
-
$
|
84 |
|
85 |
-
foreach ( $values as $key => $value ) {
|
86 |
$checked = false;
|
87 |
|
88 |
-
if ( $
|
89 |
-
if ( $multiple && in_array( esc_sql( $value ), (array) $
|
90 |
$checked = true;
|
91 |
-
if ( ! $multiple && $
|
92 |
$checked = true;
|
93 |
} else {
|
94 |
if ( in_array( $key + 1, (array) $defaults ) )
|
95 |
$checked = true;
|
96 |
}
|
97 |
|
98 |
-
$
|
99 |
|
100 |
-
if ( '' !== $
|
101 |
-
$tabindex =
|
102 |
-
$
|
103 |
-
} else {
|
104 |
-
$tabindex = '';
|
105 |
}
|
106 |
|
107 |
-
if ( isset( $labels[$key] ) )
|
108 |
-
$label = $labels[$key];
|
109 |
else
|
110 |
$label = $value;
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
if ( $label_first ) { // put label first, input last
|
113 |
-
$item =
|
114 |
-
|
|
|
115 |
} else {
|
116 |
-
$item =
|
117 |
-
|
|
|
118 |
}
|
119 |
|
120 |
if ( $use_label_element )
|
@@ -124,9 +109,13 @@ function wpcf7_checkbox_shortcode_handler( $tag ) {
|
|
124 |
$html .= $item;
|
125 |
}
|
126 |
|
127 |
-
|
128 |
|
129 |
-
$
|
|
|
|
|
|
|
|
|
130 |
|
131 |
return $html;
|
132 |
}
|
@@ -139,11 +128,15 @@ add_filter( 'wpcf7_validate_checkbox*', 'wpcf7_checkbox_validation_filter', 10,
|
|
139 |
add_filter( 'wpcf7_validate_radio', 'wpcf7_checkbox_validation_filter', 10, 2 );
|
140 |
|
141 |
function wpcf7_checkbox_validation_filter( $result, $tag ) {
|
142 |
-
$
|
143 |
-
|
|
|
|
|
|
|
|
|
144 |
|
145 |
if ( 'checkbox*' == $type ) {
|
146 |
-
if ( empty( $
|
147 |
$result['valid'] = false;
|
148 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
149 |
}
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_checkbox', 5 );
|
|
|
|
|
9 |
|
10 |
+
function wpcf7_add_shortcode_checkbox() {
|
11 |
+
wpcf7_add_shortcode( array( 'checkbox', 'checkbox*', 'radio' ),
|
12 |
+
'wpcf7_checkbox_shortcode_handler', true );
|
13 |
+
}
|
14 |
|
15 |
+
function wpcf7_checkbox_shortcode_handler( $tag ) {
|
16 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
|
|
17 |
|
18 |
+
if ( empty( $tag->name ) )
|
19 |
return '';
|
20 |
|
21 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
24 |
|
25 |
if ( $validation_error )
|
26 |
+
$class .= ' wpcf7-not-valid';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
$label_first = $tag->has_option( 'label_first' );
|
29 |
+
$use_label_element = $tag->has_option( 'use_label_element' );
|
30 |
+
$exclusive = $tag->has_option( 'exclusive' );
|
31 |
$multiple = false;
|
|
|
32 |
|
33 |
+
if ( 'checkbox' == $tag->basetype )
|
34 |
$multiple = ! $exclusive;
|
35 |
+
else // radio
|
36 |
$exclusive = false;
|
|
|
37 |
|
38 |
if ( $exclusive )
|
39 |
+
$class .= ' wpcf7-exclusive-checkbox';
|
40 |
|
41 |
+
$atts = array();
|
|
|
42 |
|
43 |
+
$atts['class'] = $tag->get_class_option( $class );
|
44 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
45 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
46 |
|
47 |
+
$defaults = array();
|
48 |
+
|
49 |
+
if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) )
|
50 |
+
$defaults = explode( '_', $matches[1] );
|
51 |
+
|
52 |
+
if ( isset( $_POST[$tag->name] ) )
|
53 |
+
$post = $_POST[$tag->name];
|
54 |
+
else
|
55 |
+
$post = $multiple ? array() : '';
|
56 |
|
57 |
+
$is_posted = wpcf7_is_posted();
|
58 |
|
59 |
+
$html = '';
|
60 |
|
61 |
+
foreach ( (array) $tag->values as $key => $value ) {
|
62 |
$checked = false;
|
63 |
|
64 |
+
if ( $is_posted && ! empty( $post ) ) {
|
65 |
+
if ( $multiple && in_array( esc_sql( $value ), (array) $post ) )
|
66 |
$checked = true;
|
67 |
+
if ( ! $multiple && $post == esc_sql( $value ) )
|
68 |
$checked = true;
|
69 |
} else {
|
70 |
if ( in_array( $key + 1, (array) $defaults ) )
|
71 |
$checked = true;
|
72 |
}
|
73 |
|
74 |
+
$tabindex = '';
|
75 |
|
76 |
+
if ( '' !== $atts['tabindex'] ) {
|
77 |
+
$tabindex = $atts['tabindex'];
|
78 |
+
$atts['tabindex'] += 1;
|
|
|
|
|
79 |
}
|
80 |
|
81 |
+
if ( isset( $tag->labels[$key] ) )
|
82 |
+
$label = $tag->labels[$key];
|
83 |
else
|
84 |
$label = $value;
|
85 |
|
86 |
+
$item_atts = array(
|
87 |
+
'type' => $tag->basetype,
|
88 |
+
'name' => $tag->name . ( $multiple ? '[]' : '' ),
|
89 |
+
'value' => $value,
|
90 |
+
'checked' => $checked ? 'checked' : '',
|
91 |
+
'tabindex' => $tabindex ? $tabindex : '' );
|
92 |
+
|
93 |
+
$item_atts = wpcf7_format_atts( $item_atts );
|
94 |
+
|
95 |
if ( $label_first ) { // put label first, input last
|
96 |
+
$item = sprintf(
|
97 |
+
'<span class="wpcf7-list-item-label">%1$s</span> <input %2$s />',
|
98 |
+
esc_html( $label ), $item_atts );
|
99 |
} else {
|
100 |
+
$item = sprintf(
|
101 |
+
'<input %2$s /> <span class="wpcf7-list-item-label">%1$s</span>',
|
102 |
+
esc_html( $label ), $item_atts );
|
103 |
}
|
104 |
|
105 |
if ( $use_label_element )
|
109 |
$html .= $item;
|
110 |
}
|
111 |
|
112 |
+
unset( $atts['tabindex'] );
|
113 |
|
114 |
+
$atts = wpcf7_format_atts( $atts );
|
115 |
+
|
116 |
+
$html = sprintf(
|
117 |
+
'<span class="wpcf7-form-control-wrap %1$s"><span %2$s>%3$s</span>%4$s</span>',
|
118 |
+
$tag->name, $atts, $html, $validation_error );
|
119 |
|
120 |
return $html;
|
121 |
}
|
128 |
add_filter( 'wpcf7_validate_radio', 'wpcf7_checkbox_validation_filter', 10, 2 );
|
129 |
|
130 |
function wpcf7_checkbox_validation_filter( $result, $tag ) {
|
131 |
+
$tag = new WPCF7_Shortcode( $tag );
|
132 |
+
|
133 |
+
$type = $tag->type;
|
134 |
+
$name = $tag->name;
|
135 |
+
|
136 |
+
$value = isset( $_POST[$name] ) ? (array) $_POST[$name] : array();
|
137 |
|
138 |
if ( 'checkbox*' == $type ) {
|
139 |
+
if ( empty( $value ) ) {
|
140 |
$result['valid'] = false;
|
141 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
142 |
}
|
modules/date.php
ADDED
@@ -0,0 +1,201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
** A base module for the following types of tags:
|
4 |
+
** [date] and [date*] # Date
|
5 |
+
**/
|
6 |
+
|
7 |
+
/* Shortcode handler */
|
8 |
+
|
9 |
+
add_action( 'init', 'wpcf7_add_shortcode_date', 5 );
|
10 |
+
|
11 |
+
function wpcf7_add_shortcode_date() {
|
12 |
+
wpcf7_add_shortcode( array( 'date', 'date*' ),
|
13 |
+
'wpcf7_date_shortcode_handler', true );
|
14 |
+
}
|
15 |
+
|
16 |
+
function wpcf7_date_shortcode_handler( $tag ) {
|
17 |
+
$tag = new WPCF7_Shortcode( $tag );
|
18 |
+
|
19 |
+
if ( empty( $tag->name ) )
|
20 |
+
return '';
|
21 |
+
|
22 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
23 |
+
|
24 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
25 |
+
|
26 |
+
$class .= ' wpcf7-validates-as-date';
|
27 |
+
|
28 |
+
if ( $validation_error )
|
29 |
+
$class .= ' wpcf7-not-valid';
|
30 |
+
|
31 |
+
$atts = array();
|
32 |
+
|
33 |
+
$atts['class'] = $tag->get_class_option( $class );
|
34 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
35 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
36 |
+
$atts['min'] = $tag->get_option( 'min', 'date', true );
|
37 |
+
$atts['max'] = $tag->get_option( 'max', 'date', true );
|
38 |
+
$atts['step'] = $tag->get_option( 'step', 'int', true );
|
39 |
+
|
40 |
+
if ( $tag->has_option( 'readonly' ) )
|
41 |
+
$atts['readonly'] = 'readonly';
|
42 |
+
|
43 |
+
if ( $tag->is_required() )
|
44 |
+
$atts['aria-required'] = 'true';
|
45 |
+
|
46 |
+
$value = (string) reset( $tag->values );
|
47 |
+
|
48 |
+
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
49 |
+
$atts['placeholder'] = $value;
|
50 |
+
$value = '';
|
51 |
+
}
|
52 |
+
|
53 |
+
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
|
54 |
+
$value = stripslashes_deep( $_POST[$tag->name] );
|
55 |
+
|
56 |
+
$atts['value'] = $value;
|
57 |
+
|
58 |
+
if ( wpcf7_support_html5() ) {
|
59 |
+
$atts['type'] = $tag->basetype;
|
60 |
+
} else {
|
61 |
+
$atts['type'] = 'text';
|
62 |
+
}
|
63 |
+
|
64 |
+
$atts['name'] = $tag->name;
|
65 |
+
|
66 |
+
$atts = wpcf7_format_atts( $atts );
|
67 |
+
|
68 |
+
$html = sprintf(
|
69 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
|
70 |
+
$tag->name, $atts, $validation_error );
|
71 |
+
|
72 |
+
return $html;
|
73 |
+
}
|
74 |
+
|
75 |
+
|
76 |
+
/* Validation filter */
|
77 |
+
|
78 |
+
add_filter( 'wpcf7_validate_date', 'wpcf7_date_validation_filter', 10, 2 );
|
79 |
+
add_filter( 'wpcf7_validate_date*', 'wpcf7_date_validation_filter', 10, 2 );
|
80 |
+
|
81 |
+
function wpcf7_date_validation_filter( $result, $tag ) {
|
82 |
+
$tag = new WPCF7_Shortcode( $tag );
|
83 |
+
|
84 |
+
$name = $tag->name;
|
85 |
+
|
86 |
+
$min = $tag->get_option( 'min', 'date', true );
|
87 |
+
$max = $tag->get_option( 'max', 'date', true );
|
88 |
+
|
89 |
+
$value = isset( $_POST[$name] )
|
90 |
+
? trim( strtr( (string) $_POST[$name], "\n", " " ) )
|
91 |
+
: '';
|
92 |
+
|
93 |
+
if ( $tag->is_required() && '' == $value ) {
|
94 |
+
$result['valid'] = false;
|
95 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
96 |
+
} elseif ( '' != $value && ! wpcf7_is_date( $value ) ) {
|
97 |
+
$result['valid'] = false;
|
98 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_date' );
|
99 |
+
} elseif ( '' != $value && ! empty( $min ) && $value < $min ) {
|
100 |
+
$result['valid'] = false;
|
101 |
+
$result['reason'][$name] = wpcf7_get_message( 'date_too_early' );
|
102 |
+
} elseif ( '' != $value && ! empty( $max ) && $max < $value ) {
|
103 |
+
$result['valid'] = false;
|
104 |
+
$result['reason'][$name] = wpcf7_get_message( 'date_too_late' );
|
105 |
+
}
|
106 |
+
|
107 |
+
return $result;
|
108 |
+
}
|
109 |
+
|
110 |
+
|
111 |
+
/* Messages */
|
112 |
+
|
113 |
+
add_filter( 'wpcf7_messages', 'wpcf7_date_messages' );
|
114 |
+
|
115 |
+
function wpcf7_date_messages( $messages ) {
|
116 |
+
return array_merge( $messages, array(
|
117 |
+
'invalid_date' => array(
|
118 |
+
'description' => __( "Date format that the sender entered is invalid", 'wpcf7' ),
|
119 |
+
'default' => __( 'Date format seems invalid.', 'wpcf7' )
|
120 |
+
),
|
121 |
+
|
122 |
+
'date_too_early' => array(
|
123 |
+
'description' => __( "Date is earlier than minimum limit", 'wpcf7' ),
|
124 |
+
'default' => __( 'This date is too early.', 'wpcf7' )
|
125 |
+
),
|
126 |
+
|
127 |
+
'date_too_late' => array(
|
128 |
+
'description' => __( "Date is later than maximum limit", 'wpcf7' ),
|
129 |
+
'default' => __( 'This date is too late.', 'wpcf7' )
|
130 |
+
) ) );
|
131 |
+
}
|
132 |
+
|
133 |
+
|
134 |
+
/* Tag generator */
|
135 |
+
|
136 |
+
add_action( 'admin_init', 'wpcf7_add_tag_generator_date', 19 );
|
137 |
+
|
138 |
+
function wpcf7_add_tag_generator_date() {
|
139 |
+
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
|
140 |
+
return;
|
141 |
+
|
142 |
+
wpcf7_add_tag_generator( 'date', __( 'Date', 'wpcf7' ),
|
143 |
+
'wpcf7-tg-pane-date', 'wpcf7_tg_pane_date' );
|
144 |
+
}
|
145 |
+
|
146 |
+
function wpcf7_tg_pane_date( &$contact_form ) {
|
147 |
+
wpcf7_tg_pane_date_and_relatives( 'date' );
|
148 |
+
}
|
149 |
+
|
150 |
+
function wpcf7_tg_pane_date_and_relatives( $type = 'date' ) {
|
151 |
+
if ( ! in_array( $type, array() ) )
|
152 |
+
$type = 'date';
|
153 |
+
|
154 |
+
?>
|
155 |
+
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
|
156 |
+
<form action="">
|
157 |
+
<table>
|
158 |
+
<tr><td><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
|
159 |
+
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
|
160 |
+
</table>
|
161 |
+
|
162 |
+
<table>
|
163 |
+
<tr>
|
164 |
+
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
165 |
+
<input type="text" name="id" class="idvalue oneline option" /></td>
|
166 |
+
|
167 |
+
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
168 |
+
<input type="text" name="class" class="classvalue oneline option" /></td>
|
169 |
+
</tr>
|
170 |
+
|
171 |
+
<tr>
|
172 |
+
<td><code>min</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
173 |
+
<input type="date" name="min" class="date oneline option" /></td>
|
174 |
+
|
175 |
+
<td><code>max</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
176 |
+
<input type="date" name="max" class="date oneline option" /></td>
|
177 |
+
</tr>
|
178 |
+
|
179 |
+
<tr>
|
180 |
+
<td><code>step</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
181 |
+
<input type="number" name="step" class="numeric oneline option" min="1" /></td>
|
182 |
+
</tr>
|
183 |
+
|
184 |
+
<tr>
|
185 |
+
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
|
186 |
+
|
187 |
+
<td>
|
188 |
+
<br /><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as placeholder?', 'wpcf7' ) ); ?>
|
189 |
+
</td>
|
190 |
+
</tr>
|
191 |
+
</table>
|
192 |
+
|
193 |
+
<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>
|
194 |
+
|
195 |
+
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
196 |
+
</form>
|
197 |
+
</div>
|
198 |
+
<?php
|
199 |
+
}
|
200 |
+
|
201 |
+
?>
|
modules/file.php
CHANGED
@@ -5,63 +5,45 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
-
wpcf7_add_shortcode( 'file*', 'wpcf7_file_shortcode_handler', true );
|
10 |
|
11 |
-
function
|
12 |
-
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
$
|
17 |
-
$options = (array) $tag['options'];
|
18 |
-
$values = (array) $tag['values'];
|
19 |
|
20 |
-
if ( empty( $name ) )
|
21 |
return '';
|
22 |
|
23 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
24 |
|
25 |
-
$
|
26 |
-
|
27 |
-
$class_att = wpcf7_form_controls_class( $type );
|
28 |
|
29 |
if ( $validation_error )
|
30 |
-
$
|
31 |
-
|
32 |
-
foreach ( $options as $option ) {
|
33 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
34 |
-
$id_att = $matches[1];
|
35 |
-
|
36 |
-
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
37 |
-
$class_att .= ' ' . $matches[1];
|
38 |
|
39 |
-
|
40 |
-
$size_att = (int) $matches[1];
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
if ( $id_att )
|
49 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
50 |
-
|
51 |
-
if ( $class_att )
|
52 |
-
$atts .= ' class="' . trim( $class_att ) . '"';
|
53 |
-
|
54 |
-
if ( $size_att )
|
55 |
-
$atts .= ' size="' . $size_att . '"';
|
56 |
-
else
|
57 |
-
$atts .= ' size="40"'; // default size
|
58 |
|
59 |
-
|
60 |
-
|
|
|
61 |
|
62 |
-
$
|
63 |
|
64 |
-
$html =
|
|
|
|
|
65 |
|
66 |
return $html;
|
67 |
}
|
@@ -87,9 +69,9 @@ add_filter( 'wpcf7_validate_file', 'wpcf7_file_validation_filter', 10, 2 );
|
|
87 |
add_filter( 'wpcf7_validate_file*', 'wpcf7_file_validation_filter', 10, 2 );
|
88 |
|
89 |
function wpcf7_file_validation_filter( $result, $tag ) {
|
90 |
-
$
|
91 |
-
|
92 |
-
$
|
93 |
|
94 |
$file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
|
95 |
|
@@ -99,7 +81,7 @@ function wpcf7_file_validation_filter( $result, $tag ) {
|
|
99 |
return $result;
|
100 |
}
|
101 |
|
102 |
-
if ( empty( $file['tmp_name'] ) &&
|
103 |
$result['valid'] = false;
|
104 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
105 |
return $result;
|
@@ -108,29 +90,44 @@ function wpcf7_file_validation_filter( $result, $tag ) {
|
|
108 |
if ( ! is_uploaded_file( $file['tmp_name'] ) )
|
109 |
return $result;
|
110 |
|
111 |
-
$
|
112 |
-
|
|
|
|
|
|
|
113 |
|
114 |
-
foreach ( $options as $option ) {
|
115 |
-
if ( preg_match( '%^filetypes:(.+)$%', $option, $matches ) ) {
|
116 |
-
$file_types = explode( '|', $matches[1] );
|
117 |
foreach ( $file_types as $file_type ) {
|
118 |
$file_type = trim( $file_type, '.' );
|
119 |
-
$file_type = str_replace(
|
120 |
-
array( '
|
121 |
-
$
|
122 |
}
|
|
|
|
|
123 |
|
124 |
-
|
125 |
-
|
126 |
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
}
|
135 |
}
|
136 |
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_file', 5 );
|
|
|
9 |
|
10 |
+
function wpcf7_add_shortcode_file() {
|
11 |
+
wpcf7_add_shortcode( array( 'file', 'file*' ),
|
12 |
+
'wpcf7_file_shortcode_handler', true );
|
13 |
+
}
|
14 |
|
15 |
+
function wpcf7_file_shortcode_handler( $tag ) {
|
16 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
17 |
|
18 |
+
if ( empty( $tag->name ) )
|
19 |
return '';
|
20 |
|
21 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
22 |
|
23 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
|
|
|
|
24 |
|
25 |
if ( $validation_error )
|
26 |
+
$class .= ' wpcf7-not-valid';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
$atts = array();
|
|
|
29 |
|
30 |
+
$atts['size'] = $tag->get_size_option( '40' );
|
31 |
+
$atts['class'] = $tag->get_class_option( $class );
|
32 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
33 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
34 |
|
35 |
+
if ( $tag->is_required() )
|
36 |
+
$atts['aria-required'] = 'true';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
+
$atts['type'] = 'file';
|
39 |
+
$atts['name'] = $tag->name;
|
40 |
+
$atts['value'] = '1';
|
41 |
|
42 |
+
$atts = wpcf7_format_atts( $atts );
|
43 |
|
44 |
+
$html = sprintf(
|
45 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
|
46 |
+
$tag->name, $atts, $validation_error );
|
47 |
|
48 |
return $html;
|
49 |
}
|
69 |
add_filter( 'wpcf7_validate_file*', 'wpcf7_file_validation_filter', 10, 2 );
|
70 |
|
71 |
function wpcf7_file_validation_filter( $result, $tag ) {
|
72 |
+
$tag = new WPCF7_Shortcode( $tag );
|
73 |
+
|
74 |
+
$name = $tag->name;
|
75 |
|
76 |
$file = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
|
77 |
|
81 |
return $result;
|
82 |
}
|
83 |
|
84 |
+
if ( empty( $file['tmp_name'] ) && $tag->is_required() ) {
|
85 |
$result['valid'] = false;
|
86 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
87 |
return $result;
|
90 |
if ( ! is_uploaded_file( $file['tmp_name'] ) )
|
91 |
return $result;
|
92 |
|
93 |
+
$allowed_file_types = array();
|
94 |
+
|
95 |
+
if ( $file_types_a = $tag->get_option( 'filetypes' ) ) {
|
96 |
+
foreach ( $file_types_a as $file_types ) {
|
97 |
+
$file_types = explode( '|', $file_types );
|
98 |
|
|
|
|
|
|
|
99 |
foreach ( $file_types as $file_type ) {
|
100 |
$file_type = trim( $file_type, '.' );
|
101 |
+
$file_type = str_replace( array( '.', '+', '*', '?' ),
|
102 |
+
array( '\.', '\+', '\*', '\?' ), $file_type );
|
103 |
+
$allowed_file_types[] = $file_type;
|
104 |
}
|
105 |
+
}
|
106 |
+
}
|
107 |
|
108 |
+
$allowed_file_types = array_unique( $allowed_file_types );
|
109 |
+
$file_type_pattern = implode( '|', $allowed_file_types );
|
110 |
|
111 |
+
$allowed_size = 1048576; // default size 1 MB
|
112 |
+
|
113 |
+
if ( $file_size_a = $tag->get_option( 'limit' ) ) {
|
114 |
+
$limit_pattern = '/^([1-9][0-9]*)([kKmM]?[bB])?$/';
|
115 |
+
|
116 |
+
foreach ( $file_size_a as $file_size ) {
|
117 |
+
if ( preg_match( $limit_pattern, $file_size, $matches ) ) {
|
118 |
+
$allowed_size = (int) $matches[1];
|
119 |
|
120 |
+
if ( ! empty( $matches[2] ) ) {
|
121 |
+
$kbmb = strtolower( $matches[2] );
|
122 |
+
|
123 |
+
if ( 'kb' == $kbmb )
|
124 |
+
$allowed_size *= 1024;
|
125 |
+
elseif ( 'mb' == $kbmb )
|
126 |
+
$allowed_size *= 1024 * 1024;
|
127 |
+
}
|
128 |
+
|
129 |
+
break;
|
130 |
+
}
|
131 |
}
|
132 |
}
|
133 |
|
modules/number.php
ADDED
@@ -0,0 +1,211 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
** A base module for the following types of tags:
|
4 |
+
** [number] and [number*] # Number
|
5 |
+
** [range] and [range*] # Range
|
6 |
+
**/
|
7 |
+
|
8 |
+
/* Shortcode handler */
|
9 |
+
|
10 |
+
add_action( 'init', 'wpcf7_add_shortcode_number', 5 );
|
11 |
+
|
12 |
+
function wpcf7_add_shortcode_number() {
|
13 |
+
wpcf7_add_shortcode( array( 'number', 'number*', 'range', 'range*' ),
|
14 |
+
'wpcf7_number_shortcode_handler', true );
|
15 |
+
}
|
16 |
+
|
17 |
+
function wpcf7_number_shortcode_handler( $tag ) {
|
18 |
+
$tag = new WPCF7_Shortcode( $tag );
|
19 |
+
|
20 |
+
if ( empty( $tag->name ) )
|
21 |
+
return '';
|
22 |
+
|
23 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
24 |
+
|
25 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
26 |
+
|
27 |
+
$class .= ' wpcf7-validates-as-number';
|
28 |
+
|
29 |
+
if ( $validation_error )
|
30 |
+
$class .= ' wpcf7-not-valid';
|
31 |
+
|
32 |
+
$atts = array();
|
33 |
+
|
34 |
+
$atts['class'] = $tag->get_class_option( $class );
|
35 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
36 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
37 |
+
$atts['min'] = $tag->get_option( 'min', 'signed_int', true );
|
38 |
+
$atts['max'] = $tag->get_option( 'max', 'signed_int', true );
|
39 |
+
$atts['step'] = $tag->get_option( 'step', 'int', true );
|
40 |
+
|
41 |
+
if ( $tag->has_option( 'readonly' ) )
|
42 |
+
$atts['readonly'] = 'readonly';
|
43 |
+
|
44 |
+
if ( $tag->is_required() )
|
45 |
+
$atts['aria-required'] = 'true';
|
46 |
+
|
47 |
+
$value = (string) reset( $tag->values );
|
48 |
+
|
49 |
+
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
50 |
+
$atts['placeholder'] = $value;
|
51 |
+
$value = '';
|
52 |
+
}
|
53 |
+
|
54 |
+
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
|
55 |
+
$value = stripslashes_deep( $_POST[$tag->name] );
|
56 |
+
|
57 |
+
$atts['value'] = $value;
|
58 |
+
|
59 |
+
if ( wpcf7_support_html5() ) {
|
60 |
+
$atts['type'] = $tag->basetype;
|
61 |
+
} else {
|
62 |
+
$atts['type'] = 'text';
|
63 |
+
}
|
64 |
+
|
65 |
+
$atts['name'] = $tag->name;
|
66 |
+
|
67 |
+
$atts = wpcf7_format_atts( $atts );
|
68 |
+
|
69 |
+
$html = sprintf(
|
70 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
|
71 |
+
$tag->name, $atts, $validation_error );
|
72 |
+
|
73 |
+
return $html;
|
74 |
+
}
|
75 |
+
|
76 |
+
|
77 |
+
/* Validation filter */
|
78 |
+
|
79 |
+
add_filter( 'wpcf7_validate_number', 'wpcf7_number_validation_filter', 10, 2 );
|
80 |
+
add_filter( 'wpcf7_validate_number*', 'wpcf7_number_validation_filter', 10, 2 );
|
81 |
+
add_filter( 'wpcf7_validate_range', 'wpcf7_number_validation_filter', 10, 2 );
|
82 |
+
add_filter( 'wpcf7_validate_range*', 'wpcf7_number_validation_filter', 10, 2 );
|
83 |
+
|
84 |
+
function wpcf7_number_validation_filter( $result, $tag ) {
|
85 |
+
$tag = new WPCF7_Shortcode( $tag );
|
86 |
+
|
87 |
+
$name = $tag->name;
|
88 |
+
|
89 |
+
$value = isset( $_POST[$name] )
|
90 |
+
? trim( strtr( (string) $_POST[$name], "\n", " " ) )
|
91 |
+
: '';
|
92 |
+
|
93 |
+
$min = $tag->get_option( 'min', 'signed_int', true );
|
94 |
+
$max = $tag->get_option( 'max', 'signed_int', true );
|
95 |
+
|
96 |
+
if ( $tag->is_required() && '' == $value ) {
|
97 |
+
$result['valid'] = false;
|
98 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
99 |
+
} elseif ( '' != $value && ! wpcf7_is_number( $value ) ) {
|
100 |
+
$result['valid'] = false;
|
101 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_number' );
|
102 |
+
} elseif ( '' != $value && '' != $min && (float) $value < (float) $min ) {
|
103 |
+
$result['valid'] = false;
|
104 |
+
$result['reason'][$name] = wpcf7_get_message( 'number_too_small' );
|
105 |
+
} elseif ( '' != $value && '' != $max && (float) $max < (float) $value ) {
|
106 |
+
$result['valid'] = false;
|
107 |
+
$result['reason'][$name] = wpcf7_get_message( 'number_too_large' );
|
108 |
+
}
|
109 |
+
|
110 |
+
return $result;
|
111 |
+
}
|
112 |
+
|
113 |
+
|
114 |
+
/* Messages */
|
115 |
+
|
116 |
+
add_filter( 'wpcf7_messages', 'wpcf7_number_messages' );
|
117 |
+
|
118 |
+
function wpcf7_number_messages( $messages ) {
|
119 |
+
return array_merge( $messages, array(
|
120 |
+
'invalid_number' => array(
|
121 |
+
'description' => __( "Number format that the sender entered is invalid", 'wpcf7' ),
|
122 |
+
'default' => __( 'Number format seems invalid.', 'wpcf7' )
|
123 |
+
),
|
124 |
+
|
125 |
+
'number_too_small' => array(
|
126 |
+
'description' => __( "Number is smaller than minimum limit", 'wpcf7' ),
|
127 |
+
'default' => __( 'This number is too small.', 'wpcf7' )
|
128 |
+
),
|
129 |
+
|
130 |
+
'number_too_large' => array(
|
131 |
+
'description' => __( "Number is larger than maximum limit", 'wpcf7' ),
|
132 |
+
'default' => __( 'This number is too large.', 'wpcf7' )
|
133 |
+
) ) );
|
134 |
+
}
|
135 |
+
|
136 |
+
|
137 |
+
/* Tag generator */
|
138 |
+
|
139 |
+
add_action( 'admin_init', 'wpcf7_add_tag_generator_number', 18 );
|
140 |
+
|
141 |
+
function wpcf7_add_tag_generator_number() {
|
142 |
+
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
|
143 |
+
return;
|
144 |
+
|
145 |
+
wpcf7_add_tag_generator( 'number', __( 'Number (spinbox)', 'wpcf7' ),
|
146 |
+
'wpcf7-tg-pane-number', 'wpcf7_tg_pane_number' );
|
147 |
+
|
148 |
+
wpcf7_add_tag_generator( 'range', __( 'Number (slider)', 'wpcf7' ),
|
149 |
+
'wpcf7-tg-pane-range', 'wpcf7_tg_pane_range' );
|
150 |
+
}
|
151 |
+
|
152 |
+
function wpcf7_tg_pane_number( &$contact_form ) {
|
153 |
+
wpcf7_tg_pane_number_and_relatives( 'number' );
|
154 |
+
}
|
155 |
+
|
156 |
+
function wpcf7_tg_pane_range( &$contact_form ) {
|
157 |
+
wpcf7_tg_pane_number_and_relatives( 'range' );
|
158 |
+
}
|
159 |
+
|
160 |
+
function wpcf7_tg_pane_number_and_relatives( $type = 'number' ) {
|
161 |
+
if ( ! in_array( $type, array( 'range' ) ) )
|
162 |
+
$type = 'number';
|
163 |
+
|
164 |
+
?>
|
165 |
+
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
|
166 |
+
<form action="">
|
167 |
+
<table>
|
168 |
+
<tr><td><input type="checkbox" name="required" /> <?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
|
169 |
+
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
|
170 |
+
</table>
|
171 |
+
|
172 |
+
<table>
|
173 |
+
<tr>
|
174 |
+
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
175 |
+
<input type="text" name="id" class="idvalue oneline option" /></td>
|
176 |
+
|
177 |
+
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
178 |
+
<input type="text" name="class" class="classvalue oneline option" /></td>
|
179 |
+
</tr>
|
180 |
+
|
181 |
+
<tr>
|
182 |
+
<td><code>min</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
183 |
+
<input type="number" name="min" class="numeric oneline option" /></td>
|
184 |
+
|
185 |
+
<td><code>max</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
186 |
+
<input type="number" name="max" class="numeric oneline option" /></td>
|
187 |
+
</tr>
|
188 |
+
|
189 |
+
<tr>
|
190 |
+
<td><code>step</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
191 |
+
<input type="number" name="step" class="numeric oneline option" min="1" /></td>
|
192 |
+
</tr>
|
193 |
+
|
194 |
+
<tr>
|
195 |
+
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
|
196 |
+
|
197 |
+
<td>
|
198 |
+
<br /><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as placeholder?', 'wpcf7' ) ); ?>
|
199 |
+
</td>
|
200 |
+
</tr>
|
201 |
+
</table>
|
202 |
+
|
203 |
+
<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>
|
204 |
+
|
205 |
+
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
206 |
+
</form>
|
207 |
+
</div>
|
208 |
+
<?php
|
209 |
+
}
|
210 |
+
|
211 |
+
?>
|
modules/quiz.php
CHANGED
@@ -5,62 +5,35 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
|
10 |
-
function
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
$
|
16 |
-
$options = (array) $tag['options'];
|
17 |
-
$pipes = $tag['pipes'];
|
18 |
|
19 |
-
if ( empty( $name ) )
|
20 |
return '';
|
21 |
|
22 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
23 |
-
|
24 |
-
$atts = $id_att = $size_att = $maxlength_att = $tabindex_att = '';
|
25 |
|
26 |
-
$
|
27 |
|
28 |
if ( $validation_error )
|
29 |
-
$
|
30 |
|
31 |
-
|
32 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
33 |
-
$id_att = $matches[1];
|
34 |
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
$size_att = (int) $matches[1];
|
40 |
-
$maxlength_att = (int) $matches[2];
|
41 |
-
|
42 |
-
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
43 |
-
$tabindex_att = (int) $matches[1];
|
44 |
-
|
45 |
-
}
|
46 |
-
}
|
47 |
-
|
48 |
-
if ( $id_att )
|
49 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
50 |
-
|
51 |
-
if ( $class_att )
|
52 |
-
$atts .= ' class="' . trim( $class_att ) . '"';
|
53 |
-
|
54 |
-
if ( $size_att )
|
55 |
-
$atts .= ' size="' . $size_att . '"';
|
56 |
-
else
|
57 |
-
$atts .= ' size="40"'; // default size
|
58 |
-
|
59 |
-
if ( $maxlength_att )
|
60 |
-
$atts .= ' maxlength="' . $maxlength_att . '"';
|
61 |
-
|
62 |
-
if ( '' !== $tabindex_att )
|
63 |
-
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
64 |
|
65 |
if ( is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
66 |
$pipe = $pipes->random_pipe();
|
@@ -74,11 +47,15 @@ function wpcf7_quiz_shortcode_handler( $tag ) {
|
|
74 |
|
75 |
$answer = wpcf7_canonicalize( $answer );
|
76 |
|
77 |
-
$
|
78 |
-
$
|
79 |
-
|
|
|
80 |
|
81 |
-
$html =
|
|
|
|
|
|
|
82 |
|
83 |
return $html;
|
84 |
}
|
@@ -89,12 +66,16 @@ function wpcf7_quiz_shortcode_handler( $tag ) {
|
|
89 |
add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 );
|
90 |
|
91 |
function wpcf7_quiz_validation_filter( $result, $tag ) {
|
92 |
-
$
|
93 |
-
$name = $tag['name'];
|
94 |
|
95 |
-
$
|
|
|
|
|
96 |
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
|
97 |
-
|
|
|
|
|
|
|
98 |
|
99 |
if ( $answer_hash != $expected_hash ) {
|
100 |
$result['valid'] = false;
|
@@ -193,10 +174,10 @@ function wpcf7_tg_pane_quiz( &$contact_form ) {
|
|
193 |
|
194 |
<tr>
|
195 |
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
196 |
-
<input type="
|
197 |
|
198 |
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
199 |
-
<input type="
|
200 |
</tr>
|
201 |
|
202 |
<tr>
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_quiz', 5 );
|
9 |
|
10 |
+
function wpcf7_add_shortcode_quiz() {
|
11 |
+
wpcf7_add_shortcode( 'quiz', 'wpcf7_quiz_shortcode_handler', true );
|
12 |
+
}
|
13 |
|
14 |
+
function wpcf7_quiz_shortcode_handler( $tag ) {
|
15 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
16 |
|
17 |
+
if ( empty( $tag->name ) )
|
18 |
return '';
|
19 |
|
20 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
|
|
|
|
21 |
|
22 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
23 |
|
24 |
if ( $validation_error )
|
25 |
+
$class .= ' wpcf7-not-valid';
|
26 |
|
27 |
+
$atts = array();
|
|
|
|
|
28 |
|
29 |
+
$atts['size'] = $tag->get_size_option( '40' );
|
30 |
+
$atts['maxlength'] = $tag->get_maxlength_option();
|
31 |
+
$atts['class'] = $tag->get_class_option( $class );
|
32 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
33 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
34 |
+
$atts['aria-required'] = 'true';
|
35 |
|
36 |
+
$pipes = $tag->pipes;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
if ( is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
39 |
$pipe = $pipes->random_pipe();
|
47 |
|
48 |
$answer = wpcf7_canonicalize( $answer );
|
49 |
|
50 |
+
$atts['type'] = 'text';
|
51 |
+
$atts['name'] = $tag->name;
|
52 |
+
|
53 |
+
$atts = wpcf7_format_atts( $atts );
|
54 |
|
55 |
+
$html = sprintf(
|
56 |
+
'<span class="wpcf7-form-control-wrap %1$s"><span class="wpcf7-quiz-label">%2$s</span> <input %3$s /><input type="hidden" name="_wpcf7_quiz_answer_%1$s" value="%4$s" />%5$s</span>',
|
57 |
+
$tag->name, esc_html( $question ), $atts,
|
58 |
+
wp_hash( $answer, 'wpcf7_quiz' ), $validation_error );
|
59 |
|
60 |
return $html;
|
61 |
}
|
66 |
add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 );
|
67 |
|
68 |
function wpcf7_quiz_validation_filter( $result, $tag ) {
|
69 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
70 |
|
71 |
+
$name = $tag->name;
|
72 |
+
|
73 |
+
$answer = isset( $_POST[$name] ) ? wpcf7_canonicalize( $_POST[$name] ) : '';
|
74 |
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
|
75 |
+
|
76 |
+
$expected_hash = isset( $_POST['_wpcf7_quiz_answer_' . $name] )
|
77 |
+
? (string) $_POST['_wpcf7_quiz_answer_' . $name]
|
78 |
+
: '';
|
79 |
|
80 |
if ( $answer_hash != $expected_hash ) {
|
81 |
$result['valid'] = false;
|
174 |
|
175 |
<tr>
|
176 |
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
177 |
+
<input type="number" name="size" class="numeric oneline option" min="1" /></td>
|
178 |
|
179 |
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
180 |
+
<input type="number" name="maxlength" class="numeric oneline option" min="1" /></td>
|
181 |
</tr>
|
182 |
|
183 |
<tr>
|
modules/select.php
CHANGED
@@ -5,62 +5,49 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
-
wpcf7_add_shortcode( 'select*', 'wpcf7_select_shortcode_handler', true );
|
10 |
|
11 |
-
function
|
12 |
-
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
$
|
17 |
-
$options = (array) $tag['options'];
|
18 |
-
$values = (array) $tag['values'];
|
19 |
-
$labels = (array) $tag['labels'];
|
20 |
|
21 |
-
if ( empty( $name ) )
|
22 |
return '';
|
23 |
|
24 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
25 |
|
26 |
-
$
|
27 |
-
|
28 |
-
$defaults = array();
|
29 |
-
|
30 |
-
$class_att = wpcf7_form_controls_class( $type );
|
31 |
|
32 |
if ( $validation_error )
|
33 |
-
$
|
34 |
-
|
35 |
-
foreach ( $options as $option ) {
|
36 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
37 |
-
$id_att = $matches[1];
|
38 |
|
39 |
-
|
40 |
-
$class_att .= ' ' . $matches[1];
|
41 |
|
42 |
-
|
43 |
-
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
|
48 |
-
|
49 |
-
}
|
50 |
-
|
51 |
-
if ( $id_att )
|
52 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
53 |
|
54 |
-
if ( $
|
55 |
-
$
|
56 |
|
57 |
-
|
58 |
-
|
59 |
|
60 |
-
$
|
61 |
-
$
|
|
|
62 |
|
63 |
$empty_select = empty( $values );
|
|
|
64 |
if ( $empty_select || $include_blank ) {
|
65 |
array_unshift( $labels, '---' );
|
66 |
array_unshift( $values, '' );
|
@@ -83,22 +70,28 @@ function wpcf7_select_shortcode_handler( $tag ) {
|
|
83 |
$selected = true;
|
84 |
}
|
85 |
|
86 |
-
$
|
|
|
|
|
|
|
|
|
87 |
|
88 |
-
|
89 |
-
$label = $labels[$key];
|
90 |
-
else
|
91 |
-
$label = $value;
|
92 |
|
93 |
-
$html .= '<option
|
|
|
94 |
}
|
95 |
|
96 |
if ( $multiple )
|
97 |
-
$atts
|
98 |
|
99 |
-
$
|
100 |
|
101 |
-
$
|
|
|
|
|
|
|
|
|
102 |
|
103 |
return $html;
|
104 |
}
|
@@ -110,8 +103,9 @@ add_filter( 'wpcf7_validate_select', 'wpcf7_select_validation_filter', 10, 2 );
|
|
110 |
add_filter( 'wpcf7_validate_select*', 'wpcf7_select_validation_filter', 10, 2 );
|
111 |
|
112 |
function wpcf7_select_validation_filter( $result, $tag ) {
|
113 |
-
$
|
114 |
-
|
|
|
115 |
|
116 |
if ( isset( $_POST[$name] ) && is_array( $_POST[$name] ) ) {
|
117 |
foreach ( $_POST[$name] as $key => $value ) {
|
@@ -120,8 +114,9 @@ function wpcf7_select_validation_filter( $result, $tag ) {
|
|
120 |
}
|
121 |
}
|
122 |
|
123 |
-
if (
|
124 |
-
if ( ! isset( $_POST[$name] )
|
|
|
125 |
$result['valid'] = false;
|
126 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
127 |
}
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_select', 5 );
|
|
|
9 |
|
10 |
+
function wpcf7_add_shortcode_select() {
|
11 |
+
wpcf7_add_shortcode( array( 'select', 'select*' ),
|
12 |
+
'wpcf7_select_shortcode_handler', true );
|
13 |
+
}
|
14 |
|
15 |
+
function wpcf7_select_shortcode_handler( $tag ) {
|
16 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
|
|
17 |
|
18 |
+
if ( empty( $tag->name ) )
|
19 |
return '';
|
20 |
|
21 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
22 |
|
23 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
|
|
|
|
|
|
|
|
24 |
|
25 |
if ( $validation_error )
|
26 |
+
$class .= ' wpcf7-not-valid';
|
|
|
|
|
|
|
|
|
27 |
|
28 |
+
$atts = array();
|
|
|
29 |
|
30 |
+
$atts['class'] = $tag->get_class_option( $class );
|
31 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
32 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
33 |
|
34 |
+
if ( $tag->is_required() )
|
35 |
+
$atts['aria-required'] = 'true';
|
36 |
|
37 |
+
$defaults = array();
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
if ( $matches = $tag->get_first_match_option( '/^default:([0-9_]+)$/' ) )
|
40 |
+
$defaults = explode( '_', $matches[1] );
|
41 |
|
42 |
+
$multiple = $tag->has_option( 'multiple' );
|
43 |
+
$include_blank = $tag->has_option( 'include_blank' );
|
44 |
|
45 |
+
$name = $tag->name;
|
46 |
+
$values = $tag->values;
|
47 |
+
$labels = $tag->labels;
|
48 |
|
49 |
$empty_select = empty( $values );
|
50 |
+
|
51 |
if ( $empty_select || $include_blank ) {
|
52 |
array_unshift( $labels, '---' );
|
53 |
array_unshift( $values, '' );
|
70 |
$selected = true;
|
71 |
}
|
72 |
|
73 |
+
$item_atts = array(
|
74 |
+
'value' => $value,
|
75 |
+
'selected' => $selected ? 'selected' : '' );
|
76 |
+
|
77 |
+
$item_atts = wpcf7_format_atts( $item_atts );
|
78 |
|
79 |
+
$label = isset( $labels[$key] ) ? $labels[$key] : $value;
|
|
|
|
|
|
|
80 |
|
81 |
+
$html .= sprintf( '<option %1$s>%2$s</option>',
|
82 |
+
$item_atts, esc_html( $label ) );
|
83 |
}
|
84 |
|
85 |
if ( $multiple )
|
86 |
+
$atts['multiple'] = 'multiple';
|
87 |
|
88 |
+
$atts['name'] = $tag->name . ( $multiple ? '[]' : '' );
|
89 |
|
90 |
+
$atts = wpcf7_format_atts( $atts );
|
91 |
+
|
92 |
+
$html = sprintf(
|
93 |
+
'<span class="wpcf7-form-control-wrap %1$s"><select %2$s>%3$s</select>%4$s</span>',
|
94 |
+
$tag->name, $atts, $html, $validation_error );
|
95 |
|
96 |
return $html;
|
97 |
}
|
103 |
add_filter( 'wpcf7_validate_select*', 'wpcf7_select_validation_filter', 10, 2 );
|
104 |
|
105 |
function wpcf7_select_validation_filter( $result, $tag ) {
|
106 |
+
$tag = new WPCF7_Shortcode( $tag );
|
107 |
+
|
108 |
+
$name = $tag->name;
|
109 |
|
110 |
if ( isset( $_POST[$name] ) && is_array( $_POST[$name] ) ) {
|
111 |
foreach ( $_POST[$name] as $key => $value ) {
|
114 |
}
|
115 |
}
|
116 |
|
117 |
+
if ( $tag->is_required() ) {
|
118 |
+
if ( ! isset( $_POST[$name] )
|
119 |
+
|| empty( $_POST[$name] ) && '0' !== $_POST[$name] ) {
|
120 |
$result['valid'] = false;
|
121 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
122 |
}
|
modules/special-mail-tags.php
CHANGED
@@ -77,32 +77,4 @@ function wpcf7_special_mail_tag_for_post_data( $output, $name ) {
|
|
77 |
return $output;
|
78 |
}
|
79 |
|
80 |
-
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag_for_raw_post', 10, 3 );
|
81 |
-
|
82 |
-
function wpcf7_special_mail_tag_for_raw_post( $output, $name, $html ) {
|
83 |
-
if ( ! preg_match( '/^_raw_(.+)/', $name, $matches ) )
|
84 |
-
return $output;
|
85 |
-
|
86 |
-
$tag_name = trim( $matches[1] );
|
87 |
-
|
88 |
-
if ( empty( $_POST[$tag_name] ) )
|
89 |
-
return $output;
|
90 |
-
|
91 |
-
$submitted = $_POST[$tag_name];
|
92 |
-
|
93 |
-
if ( is_array( $submitted ) )
|
94 |
-
$replaced = implode( ', ', $submitted );
|
95 |
-
else
|
96 |
-
$replaced = $submitted;
|
97 |
-
|
98 |
-
if ( $html ) {
|
99 |
-
$replaced = strip_tags( $replaced );
|
100 |
-
$replaced = wptexturize( $replaced );
|
101 |
-
}
|
102 |
-
|
103 |
-
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced, $submitted, $html );
|
104 |
-
|
105 |
-
return stripslashes( $replaced );
|
106 |
-
}
|
107 |
-
|
108 |
?>
|
77 |
return $output;
|
78 |
}
|
79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
80 |
?>
|
modules/submit.php
CHANGED
@@ -5,46 +5,34 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
|
10 |
-
function
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
$options = (array) $tag['options'];
|
15 |
-
$values = (array) $tag['values'];
|
16 |
-
|
17 |
-
$atts = $id_att = $tabindex_att = '';
|
18 |
-
|
19 |
-
$class_att = wpcf7_form_controls_class( 'submit' );
|
20 |
-
|
21 |
-
foreach ( $options as $option ) {
|
22 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
23 |
-
$id_att = $matches[1];
|
24 |
-
|
25 |
-
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
26 |
-
$class_att .= ' ' . $matches[1];
|
27 |
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
|
32 |
-
}
|
33 |
|
34 |
-
|
35 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
36 |
|
37 |
-
|
38 |
-
|
|
|
39 |
|
40 |
-
|
41 |
-
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
42 |
|
43 |
-
$value = isset( $values[0] ) ? $values[0] : '';
|
44 |
if ( empty( $value ) )
|
45 |
$value = __( 'Send', 'wpcf7' );
|
46 |
|
47 |
-
$
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
return $html;
|
50 |
}
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_submit', 5 );
|
9 |
|
10 |
+
function wpcf7_add_shortcode_submit() {
|
11 |
+
wpcf7_add_shortcode( 'submit', 'wpcf7_submit_shortcode_handler' );
|
12 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
function wpcf7_submit_shortcode_handler( $tag ) {
|
15 |
+
$tag = new WPCF7_Shortcode( $tag );
|
16 |
|
17 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
|
|
18 |
|
19 |
+
$atts = array();
|
|
|
20 |
|
21 |
+
$atts['class'] = $tag->get_class_option( $class );
|
22 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
23 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
24 |
|
25 |
+
$value = isset( $tag->values[0] ) ? $tag->values[0] : '';
|
|
|
26 |
|
|
|
27 |
if ( empty( $value ) )
|
28 |
$value = __( 'Send', 'wpcf7' );
|
29 |
|
30 |
+
$atts['type'] = 'submit';
|
31 |
+
$atts['value'] = $value;
|
32 |
+
|
33 |
+
$atts = wpcf7_format_atts( $atts );
|
34 |
+
|
35 |
+
$html = sprintf( '<input %1$s />', $atts );
|
36 |
|
37 |
return $html;
|
38 |
}
|
modules/text.php
CHANGED
@@ -1,64 +1,57 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
** A base module for
|
|
|
|
|
|
|
|
|
4 |
**/
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
-
wpcf7_add_shortcode( 'text*', 'wpcf7_text_shortcode_handler', true );
|
10 |
-
wpcf7_add_shortcode( 'email', 'wpcf7_text_shortcode_handler', true );
|
11 |
-
wpcf7_add_shortcode( 'email*', 'wpcf7_text_shortcode_handler', true );
|
12 |
|
13 |
-
function
|
14 |
-
|
15 |
-
|
|
|
|
|
16 |
|
17 |
-
|
18 |
-
$
|
19 |
-
$options = (array) $tag['options'];
|
20 |
-
$values = (array) $tag['values'];
|
21 |
|
22 |
-
if ( empty( $name ) )
|
23 |
return '';
|
24 |
|
25 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
26 |
-
|
27 |
-
$atts = $id_att = $size_att = $maxlength_att = '';
|
28 |
-
$tabindex_att = $title_att = '';
|
29 |
|
30 |
-
$
|
31 |
|
32 |
-
if (
|
33 |
-
$
|
34 |
|
35 |
if ( $validation_error )
|
36 |
-
$
|
37 |
|
38 |
-
|
39 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
40 |
-
$id_att = $matches[1];
|
41 |
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
44 |
|
45 |
-
|
46 |
-
|
47 |
-
$maxlength_att = (int) $matches[2];
|
48 |
|
49 |
-
|
50 |
-
|
51 |
|
52 |
-
|
53 |
-
}
|
54 |
-
|
55 |
-
$value = (string) reset( $values );
|
56 |
|
57 |
-
if (
|
58 |
-
$
|
59 |
-
$title_att .= sprintf( ' %s', $value );
|
60 |
$value = '';
|
61 |
-
|
62 |
} elseif ( empty( $value ) && is_user_logged_in() ) {
|
63 |
$user = wp_get_current_user();
|
64 |
|
@@ -72,39 +65,31 @@ function wpcf7_text_shortcode_handler( $tag ) {
|
|
72 |
'default:user_display_name' => 'display_name' );
|
73 |
|
74 |
foreach ( $user_options as $option => $prop ) {
|
75 |
-
if (
|
76 |
$value = $user->{$prop};
|
77 |
break;
|
78 |
}
|
79 |
}
|
80 |
}
|
81 |
|
82 |
-
if ( wpcf7_is_posted() && isset( $_POST[$name] ) )
|
83 |
-
$value = stripslashes_deep( $_POST[$name] );
|
84 |
-
|
85 |
-
if ( $id_att )
|
86 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
87 |
|
88 |
-
|
89 |
-
$atts .= ' class="' . trim( $class_att ) . '"';
|
90 |
|
91 |
-
if (
|
92 |
-
$atts
|
93 |
-
else
|
94 |
-
$atts
|
95 |
-
|
96 |
-
if ( $maxlength_att )
|
97 |
-
$atts .= ' maxlength="' . $maxlength_att . '"';
|
98 |
-
|
99 |
-
if ( '' !== $tabindex_att )
|
100 |
-
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
101 |
|
102 |
-
|
103 |
-
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_att ) ) );
|
104 |
|
105 |
-
$
|
106 |
|
107 |
-
$html =
|
|
|
|
|
108 |
|
109 |
return $html;
|
110 |
}
|
@@ -116,59 +101,123 @@ add_filter( 'wpcf7_validate_text', 'wpcf7_text_validation_filter', 10, 2 );
|
|
116 |
add_filter( 'wpcf7_validate_text*', 'wpcf7_text_validation_filter', 10, 2 );
|
117 |
add_filter( 'wpcf7_validate_email', 'wpcf7_text_validation_filter', 10, 2 );
|
118 |
add_filter( 'wpcf7_validate_email*', 'wpcf7_text_validation_filter', 10, 2 );
|
|
|
|
|
|
|
|
|
119 |
|
120 |
function wpcf7_text_validation_filter( $result, $tag ) {
|
121 |
-
$
|
122 |
-
$name = $tag['name'];
|
123 |
|
124 |
-
$
|
125 |
|
126 |
-
|
127 |
-
|
|
|
|
|
|
|
|
|
128 |
$result['valid'] = false;
|
129 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
130 |
}
|
131 |
}
|
132 |
|
133 |
-
if ( 'email' == $
|
134 |
-
if (
|
135 |
$result['valid'] = false;
|
136 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
137 |
-
} elseif ( '' != $
|
138 |
$result['valid'] = false;
|
139 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_email' );
|
140 |
}
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
return $result;
|
144 |
}
|
145 |
|
146 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
/* Tag generator */
|
148 |
|
149 |
-
add_action( 'admin_init', '
|
150 |
|
151 |
-
function
|
152 |
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
|
153 |
return;
|
154 |
|
155 |
wpcf7_add_tag_generator( 'text', __( 'Text field', 'wpcf7' ),
|
156 |
'wpcf7-tg-pane-text', 'wpcf7_tg_pane_text' );
|
157 |
|
158 |
-
wpcf7_add_tag_generator( 'email', __( 'Email
|
159 |
'wpcf7-tg-pane-email', 'wpcf7_tg_pane_email' );
|
|
|
|
|
|
|
|
|
|
|
|
|
160 |
}
|
161 |
|
162 |
function wpcf7_tg_pane_text( &$contact_form ) {
|
163 |
-
|
164 |
}
|
165 |
|
166 |
function wpcf7_tg_pane_email( &$contact_form ) {
|
167 |
-
|
168 |
}
|
169 |
|
170 |
-
function
|
171 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
$type = 'text';
|
173 |
|
174 |
?>
|
@@ -190,28 +239,31 @@ function wpcf7_tg_pane_text_and_email( $type = 'text' ) {
|
|
190 |
|
191 |
<tr>
|
192 |
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
193 |
-
<input type="
|
194 |
|
195 |
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
196 |
-
<input type="
|
197 |
</tr>
|
198 |
|
|
|
199 |
<tr>
|
200 |
<td colspan="2"><?php echo esc_html( __( 'Akismet', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
201 |
<?php if ( 'text' == $type ) : ?>
|
202 |
-
<input type="checkbox" name="akismet:author" class="
|
203 |
-
|
204 |
-
<?php else : ?>
|
205 |
<input type="checkbox" name="akismet:author_email" class="option" /> <?php echo esc_html( __( "This field requires author's email address", 'wpcf7' ) ); ?>
|
|
|
|
|
206 |
<?php endif; ?>
|
207 |
</td>
|
208 |
</tr>
|
|
|
209 |
|
210 |
<tr>
|
211 |
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
|
212 |
|
213 |
<td>
|
214 |
-
<br /><input type="checkbox" name="
|
215 |
</td>
|
216 |
</tr>
|
217 |
</table>
|
1 |
<?php
|
2 |
/**
|
3 |
+
** A base module for the following types of tags:
|
4 |
+
** [text] and [text*] # Single-line text
|
5 |
+
** [email] and [email*] # Email address
|
6 |
+
** [url] and [url*] # URL
|
7 |
+
** [tel] and [tel*] # Telephone number
|
8 |
**/
|
9 |
|
10 |
/* Shortcode handler */
|
11 |
|
12 |
+
add_action( 'init', 'wpcf7_add_shortcode_text', 5 );
|
|
|
|
|
|
|
13 |
|
14 |
+
function wpcf7_add_shortcode_text() {
|
15 |
+
wpcf7_add_shortcode(
|
16 |
+
array( 'text', 'text*', 'email', 'email*', 'url', 'url*', 'tel', 'tel*' ),
|
17 |
+
'wpcf7_text_shortcode_handler', true );
|
18 |
+
}
|
19 |
|
20 |
+
function wpcf7_text_shortcode_handler( $tag ) {
|
21 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
22 |
|
23 |
+
if ( empty( $tag->name ) )
|
24 |
return '';
|
25 |
|
26 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
|
|
|
|
|
|
27 |
|
28 |
+
$class = wpcf7_form_controls_class( $tag->type, 'wpcf7-text' );
|
29 |
|
30 |
+
if ( in_array( $tag->basetype, array( 'email', 'url', 'tel' ) ) )
|
31 |
+
$class .= ' wpcf7-validates-as-' . $tag->basetype;
|
32 |
|
33 |
if ( $validation_error )
|
34 |
+
$class .= ' wpcf7-not-valid';
|
35 |
|
36 |
+
$atts = array();
|
|
|
|
|
37 |
|
38 |
+
$atts['size'] = $tag->get_size_option( '40' );
|
39 |
+
$atts['maxlength'] = $tag->get_maxlength_option();
|
40 |
+
$atts['class'] = $tag->get_class_option( $class );
|
41 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
42 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
43 |
|
44 |
+
if ( $tag->has_option( 'readonly' ) )
|
45 |
+
$atts['readonly'] = 'readonly';
|
|
|
46 |
|
47 |
+
if ( $tag->is_required() )
|
48 |
+
$atts['aria-required'] = 'true';
|
49 |
|
50 |
+
$value = (string) reset( $tag->values );
|
|
|
|
|
|
|
51 |
|
52 |
+
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
53 |
+
$atts['placeholder'] = $value;
|
|
|
54 |
$value = '';
|
|
|
55 |
} elseif ( empty( $value ) && is_user_logged_in() ) {
|
56 |
$user = wp_get_current_user();
|
57 |
|
65 |
'default:user_display_name' => 'display_name' );
|
66 |
|
67 |
foreach ( $user_options as $option => $prop ) {
|
68 |
+
if ( $tag->has_option( $option ) ) {
|
69 |
$value = $user->{$prop};
|
70 |
break;
|
71 |
}
|
72 |
}
|
73 |
}
|
74 |
|
75 |
+
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
|
76 |
+
$value = stripslashes_deep( $_POST[$tag->name] );
|
|
|
|
|
|
|
77 |
|
78 |
+
$atts['value'] = $value;
|
|
|
79 |
|
80 |
+
if ( wpcf7_support_html5() ) {
|
81 |
+
$atts['type'] = $tag->basetype;
|
82 |
+
} else {
|
83 |
+
$atts['type'] = 'text';
|
84 |
+
}
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
$atts['name'] = $tag->name;
|
|
|
87 |
|
88 |
+
$atts = wpcf7_format_atts( $atts );
|
89 |
|
90 |
+
$html = sprintf(
|
91 |
+
'<span class="wpcf7-form-control-wrap %1$s"><input %2$s />%3$s</span>',
|
92 |
+
$tag->name, $atts, $validation_error );
|
93 |
|
94 |
return $html;
|
95 |
}
|
101 |
add_filter( 'wpcf7_validate_text*', 'wpcf7_text_validation_filter', 10, 2 );
|
102 |
add_filter( 'wpcf7_validate_email', 'wpcf7_text_validation_filter', 10, 2 );
|
103 |
add_filter( 'wpcf7_validate_email*', 'wpcf7_text_validation_filter', 10, 2 );
|
104 |
+
add_filter( 'wpcf7_validate_url', 'wpcf7_text_validation_filter', 10, 2 );
|
105 |
+
add_filter( 'wpcf7_validate_url*', 'wpcf7_text_validation_filter', 10, 2 );
|
106 |
+
add_filter( 'wpcf7_validate_tel', 'wpcf7_text_validation_filter', 10, 2 );
|
107 |
+
add_filter( 'wpcf7_validate_tel*', 'wpcf7_text_validation_filter', 10, 2 );
|
108 |
|
109 |
function wpcf7_text_validation_filter( $result, $tag ) {
|
110 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
111 |
|
112 |
+
$name = $tag->name;
|
113 |
|
114 |
+
$value = isset( $_POST[$name] )
|
115 |
+
? trim( strtr( (string) $_POST[$name], "\n", " " ) )
|
116 |
+
: '';
|
117 |
+
|
118 |
+
if ( 'text*' == $tag->type ) {
|
119 |
+
if ( '' == $value ) {
|
120 |
$result['valid'] = false;
|
121 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
122 |
}
|
123 |
}
|
124 |
|
125 |
+
if ( 'email' == $tag->basetype ) {
|
126 |
+
if ( $tag->is_required() && '' == $value ) {
|
127 |
$result['valid'] = false;
|
128 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
129 |
+
} elseif ( '' != $value && ! wpcf7_is_email( $value ) ) {
|
130 |
$result['valid'] = false;
|
131 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_email' );
|
132 |
}
|
133 |
}
|
134 |
|
135 |
+
if ( 'url' == $tag->basetype ) {
|
136 |
+
if ( $tag->is_required() && '' == $value ) {
|
137 |
+
$result['valid'] = false;
|
138 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
139 |
+
} elseif ( '' != $value && ! wpcf7_is_url( $value ) ) {
|
140 |
+
$result['valid'] = false;
|
141 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_url' );
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
if ( 'tel' == $tag->basetype ) {
|
146 |
+
if ( $tag->is_required() && '' == $value ) {
|
147 |
+
$result['valid'] = false;
|
148 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
149 |
+
} elseif ( '' != $value && ! wpcf7_is_tel( $value ) ) {
|
150 |
+
$result['valid'] = false;
|
151 |
+
$result['reason'][$name] = wpcf7_get_message( 'invalid_tel' );
|
152 |
+
}
|
153 |
+
}
|
154 |
+
|
155 |
return $result;
|
156 |
}
|
157 |
|
158 |
|
159 |
+
/* Messages */
|
160 |
+
|
161 |
+
add_filter( 'wpcf7_messages', 'wpcf7_text_messages' );
|
162 |
+
|
163 |
+
function wpcf7_text_messages( $messages ) {
|
164 |
+
return array_merge( $messages, array(
|
165 |
+
'invalid_email' => array(
|
166 |
+
'description' => __( "Email address that the sender entered is invalid", 'wpcf7' ),
|
167 |
+
'default' => __( 'Email address seems invalid.', 'wpcf7' )
|
168 |
+
),
|
169 |
+
|
170 |
+
'invalid_url' => array(
|
171 |
+
'description' => __( "URL that the sender entered is invalid", 'wpcf7' ),
|
172 |
+
'default' => __( 'URL seems invalid.', 'wpcf7' )
|
173 |
+
),
|
174 |
+
|
175 |
+
'invalid_tel' => array(
|
176 |
+
'description' => __( "Telephone number that the sender entered is invalid", 'wpcf7' ),
|
177 |
+
'default' => __( 'Telephone number seems invalid.', 'wpcf7' )
|
178 |
+
) ) );
|
179 |
+
}
|
180 |
+
|
181 |
+
|
182 |
/* Tag generator */
|
183 |
|
184 |
+
add_action( 'admin_init', 'wpcf7_add_tag_generator_text', 15 );
|
185 |
|
186 |
+
function wpcf7_add_tag_generator_text() {
|
187 |
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
|
188 |
return;
|
189 |
|
190 |
wpcf7_add_tag_generator( 'text', __( 'Text field', 'wpcf7' ),
|
191 |
'wpcf7-tg-pane-text', 'wpcf7_tg_pane_text' );
|
192 |
|
193 |
+
wpcf7_add_tag_generator( 'email', __( 'Email', 'wpcf7' ),
|
194 |
'wpcf7-tg-pane-email', 'wpcf7_tg_pane_email' );
|
195 |
+
|
196 |
+
wpcf7_add_tag_generator( 'url', __( 'URL', 'wpcf7' ),
|
197 |
+
'wpcf7-tg-pane-url', 'wpcf7_tg_pane_url' );
|
198 |
+
|
199 |
+
wpcf7_add_tag_generator( 'tel', __( 'Telephone number', 'wpcf7' ),
|
200 |
+
'wpcf7-tg-pane-tel', 'wpcf7_tg_pane_tel' );
|
201 |
}
|
202 |
|
203 |
function wpcf7_tg_pane_text( &$contact_form ) {
|
204 |
+
wpcf7_tg_pane_text_and_relatives( 'text' );
|
205 |
}
|
206 |
|
207 |
function wpcf7_tg_pane_email( &$contact_form ) {
|
208 |
+
wpcf7_tg_pane_text_and_relatives( 'email' );
|
209 |
}
|
210 |
|
211 |
+
function wpcf7_tg_pane_url( &$contact_form ) {
|
212 |
+
wpcf7_tg_pane_text_and_relatives( 'url' );
|
213 |
+
}
|
214 |
+
|
215 |
+
function wpcf7_tg_pane_tel( &$contact_form ) {
|
216 |
+
wpcf7_tg_pane_text_and_relatives( 'tel' );
|
217 |
+
}
|
218 |
+
|
219 |
+
function wpcf7_tg_pane_text_and_relatives( $type = 'text' ) {
|
220 |
+
if ( ! in_array( $type, array( 'email', 'url', 'tel' ) ) )
|
221 |
$type = 'text';
|
222 |
|
223 |
?>
|
239 |
|
240 |
<tr>
|
241 |
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
242 |
+
<input type="number" name="size" class="numeric oneline option" min="1" /></td>
|
243 |
|
244 |
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
245 |
+
<input type="number" name="maxlength" class="numeric oneline option" min="1" /></td>
|
246 |
</tr>
|
247 |
|
248 |
+
<?php if ( in_array( $type, array( 'text', 'email', 'url' ) ) ) : ?>
|
249 |
<tr>
|
250 |
<td colspan="2"><?php echo esc_html( __( 'Akismet', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
251 |
<?php if ( 'text' == $type ) : ?>
|
252 |
+
<input type="checkbox" name="akismet:author" class="option" /> <?php echo esc_html( __( "This field requires author's name", 'wpcf7' ) ); ?><br />
|
253 |
+
<?php elseif ( 'email' == $type ) : ?>
|
|
|
254 |
<input type="checkbox" name="akismet:author_email" class="option" /> <?php echo esc_html( __( "This field requires author's email address", 'wpcf7' ) ); ?>
|
255 |
+
<?php elseif ( 'url' == $type ) : ?>
|
256 |
+
<input type="checkbox" name="akismet:author_url" class="option" /> <?php echo esc_html( __( "This field requires author's URL", 'wpcf7' ) ); ?>
|
257 |
<?php endif; ?>
|
258 |
</td>
|
259 |
</tr>
|
260 |
+
<?php endif; ?>
|
261 |
|
262 |
<tr>
|
263 |
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
|
264 |
|
265 |
<td>
|
266 |
+
<br /><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as placeholder?', 'wpcf7' ) ); ?>
|
267 |
</td>
|
268 |
</tr>
|
269 |
</table>
|
modules/textarea.php
CHANGED
@@ -5,93 +5,61 @@
|
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
-
|
9 |
-
wpcf7_add_shortcode( 'textarea*', 'wpcf7_textarea_shortcode_handler', true );
|
10 |
|
11 |
-
function
|
12 |
-
|
13 |
-
|
|
|
14 |
|
15 |
-
|
16 |
-
$
|
17 |
-
$options = (array) $tag['options'];
|
18 |
-
$values = (array) $tag['values'];
|
19 |
-
$content = $tag['content'];
|
20 |
|
21 |
-
if ( empty( $name ) )
|
22 |
return '';
|
23 |
|
24 |
-
$validation_error = wpcf7_get_validation_error( $name );
|
25 |
-
|
26 |
-
$atts = '';
|
27 |
-
$id_att = '';
|
28 |
-
$class_att = '';
|
29 |
-
$cols_att = '';
|
30 |
-
$rows_att = '';
|
31 |
-
$tabindex_att = '';
|
32 |
-
$title_att = '';
|
33 |
|
34 |
-
$
|
35 |
|
36 |
if ( $validation_error )
|
37 |
-
$
|
38 |
|
39 |
-
|
40 |
-
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
41 |
-
$id_att = $matches[1];
|
42 |
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
45 |
|
46 |
-
|
47 |
-
|
48 |
-
$rows_att = (int) $matches[2];
|
49 |
|
50 |
-
|
51 |
-
|
52 |
|
53 |
-
|
54 |
-
}
|
55 |
|
56 |
-
|
|
|
57 |
|
58 |
-
if (
|
59 |
-
$
|
60 |
-
|
61 |
-
if ( wpcf7_script_is() && preg_grep( '%^watermark$%', $options ) ) {
|
62 |
-
$class_att .= ' wpcf7-use-title-as-watermark';
|
63 |
-
$title_att .= sprintf( ' %s', $value );
|
64 |
$value = '';
|
65 |
}
|
66 |
|
67 |
-
if ( wpcf7_is_posted() && isset( $_POST[$name] ) )
|
68 |
-
$value = stripslashes_deep( $_POST[$name] );
|
69 |
-
|
70 |
-
if ( $id_att )
|
71 |
-
$atts .= ' id="' . trim( $id_att ) . '"';
|
72 |
|
73 |
-
|
74 |
-
$atts .= ' class="' . trim( $class_att ) . '"';
|
75 |
|
76 |
-
|
77 |
-
$atts .= ' cols="' . $cols_att . '"';
|
78 |
-
else
|
79 |
-
$atts .= ' cols="40"'; // default size
|
80 |
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
$atts .= ' rows="10"'; // default size
|
85 |
-
|
86 |
-
if ( '' !== $tabindex_att )
|
87 |
-
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
88 |
-
|
89 |
-
if ( $title_att )
|
90 |
-
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_att ) ) );
|
91 |
-
|
92 |
-
$html = '<textarea name="' . $name . '"' . $atts . '>' . esc_textarea( $value ) . '</textarea>';
|
93 |
-
|
94 |
-
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
95 |
|
96 |
return $html;
|
97 |
}
|
@@ -103,13 +71,15 @@ add_filter( 'wpcf7_validate_textarea', 'wpcf7_textarea_validation_filter', 10, 2
|
|
103 |
add_filter( 'wpcf7_validate_textarea*', 'wpcf7_textarea_validation_filter', 10, 2 );
|
104 |
|
105 |
function wpcf7_textarea_validation_filter( $result, $tag ) {
|
106 |
-
$
|
107 |
-
$name = $tag['name'];
|
108 |
|
109 |
-
$
|
|
|
|
|
|
|
110 |
|
111 |
if ( 'textarea*' == $type ) {
|
112 |
-
if ( '' == $
|
113 |
$result['valid'] = false;
|
114 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
115 |
}
|
@@ -151,17 +121,22 @@ function wpcf7_tg_pane_textarea( &$contact_form ) {
|
|
151 |
|
152 |
<tr>
|
153 |
<td><code>cols</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
154 |
-
<input type="
|
155 |
|
156 |
<td><code>rows</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
157 |
-
<input type="
|
|
|
|
|
|
|
|
|
|
|
158 |
</tr>
|
159 |
|
160 |
<tr>
|
161 |
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
|
162 |
|
163 |
<td>
|
164 |
-
<br /><input type="checkbox" name="
|
165 |
</td>
|
166 |
</tr>
|
167 |
</table>
|
5 |
|
6 |
/* Shortcode handler */
|
7 |
|
8 |
+
add_action( 'init', 'wpcf7_add_shortcode_textarea', 5 );
|
|
|
9 |
|
10 |
+
function wpcf7_add_shortcode_textarea() {
|
11 |
+
wpcf7_add_shortcode( array( 'textarea', 'textarea*' ),
|
12 |
+
'wpcf7_textarea_shortcode_handler', true );
|
13 |
+
}
|
14 |
|
15 |
+
function wpcf7_textarea_shortcode_handler( $tag ) {
|
16 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
|
|
|
|
17 |
|
18 |
+
if ( empty( $tag->name ) )
|
19 |
return '';
|
20 |
|
21 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
$class = wpcf7_form_controls_class( $tag->type );
|
24 |
|
25 |
if ( $validation_error )
|
26 |
+
$class .= ' wpcf7-not-valid';
|
27 |
|
28 |
+
$atts = array();
|
|
|
|
|
29 |
|
30 |
+
$atts['cols'] = $tag->get_cols_option( '40' );
|
31 |
+
$atts['rows'] = $tag->get_rows_option( '10' );
|
32 |
+
$atts['maxlength'] = $tag->get_maxlength_option();
|
33 |
+
$atts['class'] = $tag->get_class_option( $class );
|
34 |
+
$atts['id'] = $tag->get_option( 'id', 'id', true );
|
35 |
+
$atts['tabindex'] = $tag->get_option( 'tabindex', 'int', true );
|
36 |
|
37 |
+
if ( $tag->has_option( 'readonly' ) )
|
38 |
+
$atts['readonly'] = 'readonly';
|
|
|
39 |
|
40 |
+
if ( $tag->is_required() )
|
41 |
+
$atts['aria-required'] = 'true';
|
42 |
|
43 |
+
$value = (string) reset( $tag->values );
|
|
|
44 |
|
45 |
+
if ( '' !== $tag->content )
|
46 |
+
$value = $tag->content;
|
47 |
|
48 |
+
if ( $tag->has_option( 'placeholder' ) || $tag->has_option( 'watermark' ) ) {
|
49 |
+
$atts['placeholder'] = $value;
|
|
|
|
|
|
|
|
|
50 |
$value = '';
|
51 |
}
|
52 |
|
53 |
+
if ( wpcf7_is_posted() && isset( $_POST[$tag->name] ) )
|
54 |
+
$value = stripslashes_deep( $_POST[$tag->name] );
|
|
|
|
|
|
|
55 |
|
56 |
+
$atts['name'] = $tag->name;
|
|
|
57 |
|
58 |
+
$atts = wpcf7_format_atts( $atts );
|
|
|
|
|
|
|
59 |
|
60 |
+
$html = sprintf(
|
61 |
+
'<span class="wpcf7-form-control-wrap %1$s"><textarea %2$s>%3$s</textarea>%4$s</span>',
|
62 |
+
$tag->name, $atts, esc_textarea( $value ), $validation_error );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
return $html;
|
65 |
}
|
71 |
add_filter( 'wpcf7_validate_textarea*', 'wpcf7_textarea_validation_filter', 10, 2 );
|
72 |
|
73 |
function wpcf7_textarea_validation_filter( $result, $tag ) {
|
74 |
+
$tag = new WPCF7_Shortcode( $tag );
|
|
|
75 |
|
76 |
+
$type = $tag->type;
|
77 |
+
$name = $tag->name;
|
78 |
+
|
79 |
+
$value = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
|
80 |
|
81 |
if ( 'textarea*' == $type ) {
|
82 |
+
if ( '' == $value ) {
|
83 |
$result['valid'] = false;
|
84 |
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
85 |
}
|
121 |
|
122 |
<tr>
|
123 |
<td><code>cols</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
124 |
+
<input type="number" name="cols" class="numeric oneline option" min="1" /></td>
|
125 |
|
126 |
<td><code>rows</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
127 |
+
<input type="number" name="rows" class="numeric oneline option" min="1" /></td>
|
128 |
+
</tr>
|
129 |
+
|
130 |
+
<tr>
|
131 |
+
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
132 |
+
<input type="number" name="maxlength" class="numeric oneline option" min="1" /></td>
|
133 |
</tr>
|
134 |
|
135 |
<tr>
|
136 |
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
|
137 |
|
138 |
<td>
|
139 |
+
<br /><input type="checkbox" name="placeholder" class="option" /> <?php echo esc_html( __( 'Use this text as placeholder?', 'wpcf7' ) ); ?>
|
140 |
</td>
|
141 |
</tr>
|
142 |
</table>
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: takayukister
|
3 |
Donate link: http://contactform7.com/donate/
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
-
Requires at least: 3.
|
6 |
-
Tested up to: 3.5
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -84,7 +84,7 @@ The following are other recommended plugins by the author of Contact Form 7.
|
|
84 |
* Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net), Jani Roskar
|
85 |
* Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog), [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/), [Matias Baldanza](http://matiasbaldanza.com/), [Carlos Agnese](http://albumdecarlitos.com.ar/)
|
86 |
* Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/), [the Swedish community](http://wp-support.se/)
|
87 |
-
* Tagalog (tl) - [Rupert Agnew Lanuza](http://
|
88 |
* Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
|
89 |
* Thai (th) - [ToshiK](http://www.tuntikorn.com/), [kazama](http://blog.wordthai.com/)
|
90 |
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/), Burak Yavuz
|
@@ -93,10 +93,6 @@ The following are other recommended plugins by the author of Contact Form 7.
|
|
93 |
|
94 |
If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can download the latest [POT file](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot), and [PO files in each language](http://plugins.svn.wordpress.org/contact-form-7/branches/languages/).
|
95 |
|
96 |
-
= Icon Design =
|
97 |
-
|
98 |
-
* [Takao Honda](http://www.takaohonda.jp/)
|
99 |
-
|
100 |
== Installation ==
|
101 |
|
102 |
1. Upload the entire `contact-form-7` folder to the `/wp-content/plugins/` directory.
|
@@ -122,44 +118,15 @@ Do you have questions or issues with Contact Form 7? Use these support channels
|
|
122 |
|
123 |
== Changelog ==
|
124 |
|
125 |
-
= 3.
|
126 |
-
|
127 |
-
*
|
128 |
-
*
|
129 |
-
*
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
*
|
134 |
-
*
|
135 |
-
* The jQuery Form Plugin (jquery.form.js) has been updated to 3.
|
136 |
-
*
|
137 |
-
* Translations for German, Thai, Hungarian and Tagalog have been updated.
|
138 |
-
|
139 |
-
= 3.3.1 =
|
140 |
-
|
141 |
-
* Fixed: Apply esc_html() to response outputs. In the case it is necessary to use HTML tags in the response messages, new wpcf7_form_response_output filter is available.
|
142 |
-
* Fixed: Don't use $_POST for internal data passing. Use global $wpcf7 variable instead.
|
143 |
-
* Fixed: Treat array value correctly in the Akismet module.
|
144 |
-
* Fixed: Escape outputs of [_user_agent] spacial mail tags used in the HTML mode.
|
145 |
-
* Fixed: Don't show the notice about conflicting with Jetpack to new users who rarely see such conflicts.
|
146 |
-
* The jQuery Form Plugin (jquery.form.js) has been updated to 3.18.
|
147 |
-
* Translations for Danish and Finnish have been updated.
|
148 |
-
|
149 |
-
= 3.3 =
|
150 |
-
|
151 |
-
* New: Introduce a new special mail tag [_user_agent] for user agent information.
|
152 |
-
* New: Make WordPress Comment Blacklist applicable for inputs through contact forms.
|
153 |
-
* New: Introduce new form of mail tag [\_raw\_{field name}]. This allows to output raw user input those have not been modified with pipes.
|
154 |
-
* New: Make mail tags available in response messages.
|
155 |
-
* New: Introduce new additional setting on_submit. It works like on_sent_ok and has one-line JavaScript code, but on_submit code is fired regardless of whether or not the mail has been sent successfully.
|
156 |
-
* New: Introduce 5 new jQuery custom event triggers (invalid.wpcf7, spam.wpcf7, mailsent.wpcf7, mailfailed.wpcf7, submit.wpcf7).
|
157 |
-
* Fix: Nonce used in a form have been changed to have no time limit.
|
158 |
-
* Fix: Make every post meta’s key have underscore prefix.
|
159 |
-
* The jQuery Form Plugin (jquery.form.js) has been updated to 3.15 and compressed with YUI compressor.
|
160 |
-
* The required WordPress version has been changed and now requires WordPress 3.3 or higher. If you use WordPress 3.2, you will need to upgrade WordPress.
|
161 |
-
* Translations for Arabic and German have been updated.
|
162 |
-
|
163 |
-
== Upgrade Notice ==
|
164 |
-
|
165 |
-
The current version of Contact Form 7 requires WordPress 3.3 or higher. If you use older version of WordPress, you need to upgrade WordPress first.
|
2 |
Contributors: takayukister
|
3 |
Donate link: http://contactform7.com/donate/
|
4 |
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
5 |
+
Requires at least: 3.5
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: 3.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
84 |
* Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net), Jani Roskar
|
85 |
* Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog), [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/), [Matias Baldanza](http://matiasbaldanza.com/), [Carlos Agnese](http://albumdecarlitos.com.ar/)
|
86 |
* Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/), [the Swedish community](http://wp-support.se/)
|
87 |
+
* Tagalog (tl) - [Rupert Agnew Lanuza](http://www.rupertlanuza.com/), [Hanne](http://pointen.dk/)
|
88 |
* Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
|
89 |
* Thai (th) - [ToshiK](http://www.tuntikorn.com/), [kazama](http://blog.wordthai.com/)
|
90 |
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/), Burak Yavuz
|
93 |
|
94 |
If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can download the latest [POT file](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot), and [PO files in each language](http://plugins.svn.wordpress.org/contact-form-7/branches/languages/).
|
95 |
|
|
|
|
|
|
|
|
|
96 |
== Installation ==
|
97 |
|
98 |
1. Upload the entire `contact-form-7` folder to the `/wp-content/plugins/` directory.
|
118 |
|
119 |
== Changelog ==
|
120 |
|
121 |
+
= 3.4 =
|
122 |
+
|
123 |
+
* Introduced the following form-tags: [url] and [url\*] for URL field, [tel] and [tel\*] for telephone number field, [number], [number\*], [range] and [range\*] for number input field, and [date] and [date\*] for date input field.
|
124 |
+
* Changed the type attribute of email field ([email] and [email\*]) from text to email.
|
125 |
+
* Support the use of the maxlength attribute for textarea ([textarea] and [textarea\*]).
|
126 |
+
* Support the use of HTML5 placeholder attribute (watermark is still supported and works as an alias of placeholder).
|
127 |
+
* Support the use of readonly attribute.
|
128 |
+
* Add the attribute aria-required="true" to each required field.
|
129 |
+
* Introduced WPCF7_Shortcode class and rewrote all shortcode handler functions using it.
|
130 |
+
* The following action and filter hooks have been introduced: wpcf7_mail_failed, wpcf7_support_html5, wpcf7_form_novalidate, wpcf7_is_email, wpcf7_is_url, wpcf7_is_tel, wpcf7_is_number, wpcf7_is_date and wpcf7_map_meta_cap.
|
131 |
+
* The jQuery Form Plugin (jquery.form.js) has been updated to 3.32.0.
|
132 |
+
* The required WordPress version has been changed and now requires WordPress 3.5 or higher.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings.php
CHANGED
@@ -13,6 +13,14 @@ if ( is_admin() )
|
|
13 |
else
|
14 |
require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
/* Loading modules */
|
17 |
|
18 |
add_action( 'plugins_loaded', 'wpcf7_load_modules', 1 );
|
13 |
else
|
14 |
require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
|
15 |
|
16 |
+
add_action( 'plugins_loaded', 'wpcf7_init_shortcode_manager', 1 );
|
17 |
+
|
18 |
+
function wpcf7_init_shortcode_manager() {
|
19 |
+
global $wpcf7_shortcode_manager;
|
20 |
+
|
21 |
+
$wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();
|
22 |
+
}
|
23 |
+
|
24 |
/* Loading modules */
|
25 |
|
26 |
add_action( 'plugins_loaded', 'wpcf7_load_modules', 1 );
|
wp-contact-form-7.php
CHANGED
@@ -7,7 +7,7 @@ Author: Takayuki Miyoshi
|
|
7 |
Author URI: http://ideasilo.wordpress.com/
|
8 |
Text Domain: wpcf7
|
9 |
Domain Path: /languages/
|
10 |
-
Version: 3.
|
11 |
*/
|
12 |
|
13 |
/* Copyright 2007-2013 Takayuki Miyoshi (email: takayukister at gmail.com)
|
@@ -27,9 +27,9 @@ Version: 3.3.3
|
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
*/
|
29 |
|
30 |
-
define( 'WPCF7_VERSION', '3.
|
31 |
|
32 |
-
define( 'WPCF7_REQUIRED_WP_VERSION', '3.
|
33 |
|
34 |
if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
|
35 |
define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
7 |
Author URI: http://ideasilo.wordpress.com/
|
8 |
Text Domain: wpcf7
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 3.4
|
11 |
*/
|
12 |
|
13 |
/* Copyright 2007-2013 Takayuki Miyoshi (email: takayukister at gmail.com)
|
27 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
28 |
*/
|
29 |
|
30 |
+
define( 'WPCF7_VERSION', '3.4' );
|
31 |
|
32 |
+
define( 'WPCF7_REQUIRED_WP_VERSION', '3.5' );
|
33 |
|
34 |
if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
|
35 |
define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|