diff --git a/src/wp-content/plugins/contact-form-7/admin/admin.php b/src/wp-content/plugins/contact-form-7/admin/admin.php new file mode 100644 index 00000000..65fad53b --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/admin.php @@ -0,0 +1,310 @@ +initial = true; + } + + $contact_form->title = trim( $_POST['wpcf7-title'] ); + + $form = trim( $_POST['wpcf7-form'] ); + + $mail = array( + 'subject' => trim( $_POST['wpcf7-mail-subject'] ), + 'sender' => trim( $_POST['wpcf7-mail-sender'] ), + 'body' => trim( $_POST['wpcf7-mail-body'] ), + 'recipient' => trim( $_POST['wpcf7-mail-recipient'] ), + 'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ), + 'attachments' => trim( $_POST['wpcf7-mail-attachments'] ), + 'use_html' => + isset( $_POST['wpcf7-mail-use-html'] ) && 1 == $_POST['wpcf7-mail-use-html'] + ); + + $mail_2 = array( + 'active' => + isset( $_POST['wpcf7-mail-2-active'] ) && 1 == $_POST['wpcf7-mail-2-active'], + 'subject' => trim( $_POST['wpcf7-mail-2-subject'] ), + 'sender' => trim( $_POST['wpcf7-mail-2-sender'] ), + 'body' => trim( $_POST['wpcf7-mail-2-body'] ), + 'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ), + 'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ), + 'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ), + 'use_html' => + isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html'] + ); + + $messages = isset( $contact_form->messages ) ? $contact_form->messages : array(); + + foreach ( wpcf7_messages() as $key => $arr ) { + $field_name = 'wpcf7-message-' . strtr( $key, '_', '-' ); + if ( isset( $_POST[$field_name] ) ) + $messages[$key] = trim( $_POST[$field_name] ); + } + + $additional_settings = trim( $_POST['wpcf7-additional-settings'] ); + + $props = apply_filters( 'wpcf7_contact_form_admin_posted_properties', + compact( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ) ); + + foreach ( (array) $props as $key => $prop ) + $contact_form->{$key} = $prop; + + $query = array(); + $query['message'] = ( $contact_form->initial ) ? 'created' : 'saved'; + + $contact_form->save(); + + $query['contactform'] = $contact_form->id; + $redirect_to = wpcf7_admin_url( $query ); + wp_redirect( $redirect_to ); + exit(); + } + + if ( isset( $_POST['wpcf7-copy'] ) ) { + $id = $_POST['post_ID']; + check_admin_referer( 'wpcf7-copy_' . $id ); + + $query = array(); + + if ( $contact_form = wpcf7_contact_form( $id ) ) { + $new_contact_form = $contact_form->copy(); + $new_contact_form->save(); + + $query['contactform'] = $new_contact_form->id; + $query['message'] = 'created'; + } else { + $query['contactform'] = $contact_form->id; + } + + $redirect_to = wpcf7_admin_url( $query ); + wp_redirect( $redirect_to ); + exit(); + } + + if ( isset( $_POST['wpcf7-delete'] ) ) { + $id = $_POST['post_ID']; + check_admin_referer( 'wpcf7-delete_' . $id ); + + if ( $contact_form = wpcf7_contact_form( $id ) ) + $contact_form->delete(); + + $redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) ); + wp_redirect( $redirect_to ); + exit(); + } +} + +add_action( 'admin_menu', 'wpcf7_admin_menu', 9 ); + +function wpcf7_admin_menu() { + add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ), + WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' ); + + add_submenu_page( 'wpcf7', __( 'Edit Contact Forms', 'wpcf7' ), __( 'Edit', 'wpcf7' ), + WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' ); +} + +add_action( 'admin_print_styles', 'wpcf7_admin_enqueue_styles' ); + +function wpcf7_admin_enqueue_styles() { + global $plugin_page; + + if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page ) + return; + + wp_enqueue_style( 'thickbox' ); + + wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/styles.css' ), + array(), WPCF7_VERSION, 'all' ); + + if ( 'rtl' == get_bloginfo( 'text_direction' ) ) { + wp_enqueue_style( 'contact-form-7-admin-rtl', + wpcf7_plugin_url( 'admin/styles-rtl.css' ), array(), WPCF7_VERSION, 'all' ); + } +} + +add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' ); + +function wpcf7_admin_enqueue_scripts() { + global $plugin_page; + + if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page ) + return; + + wp_enqueue_script( 'thickbox' ); + wp_enqueue_script( 'postbox' ); + + wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/taggenerator.js' ), + array( 'jquery' ), WPCF7_VERSION, true ); + + wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/scripts.js' ), + array( 'jquery', 'wpcf7-admin-taggenerator' ), WPCF7_VERSION, true ); + wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array( + 'generateTag' => __( 'Generate Tag', 'wpcf7' ) ) ); +} + +add_action( 'admin_footer', 'wpcf7_admin_footer' ); + +function wpcf7_admin_footer() { + global $plugin_page; + + if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page ) + return; + +?> + + -1, + 'orderby' => 'ID', + 'order' => 'ASC', + 'post_type' => 'wpcf7_contact_form' ) ); + + $cf = null; + $unsaved = false; + + if ( ! isset( $_GET['contactform'] ) ) + $_GET['contactform'] = ''; + + if ( 'new' == $_GET['contactform'] && wpcf7_admin_has_edit_cap() ) { + $unsaved = true; + $current = -1; + $cf = wpcf7_get_contact_form_default_pack( + array( 'locale' => ( isset( $_GET['locale'] ) ? $_GET['locale'] : '' ) ) ); + } elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) { + $current = (int) $_GET['contactform']; + } else { + $first = reset( $contact_forms ); // Returns first item + + if ( $first ) { + $current = $first->ID; + $cf = wpcf7_contact_form( $current ); + } + } + + require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php'; + require_once WPCF7_PLUGIN_DIR . '/admin/edit.php'; +} + +/* Misc */ + +add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 ); + +function wpcf7_plugin_action_links( $links, $file ) { + if ( $file != WPCF7_PLUGIN_BASENAME ) + return $links; + + $url = wpcf7_admin_url( array( 'page' => 'wpcf7' ) ); + + $settings_link = '' + . esc_html( __( 'Settings', 'wpcf7' ) ) . ''; + + array_unshift( $links, $settings_link ); + + return $links; +} + +add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_cf7com_links', 9 ); + +function wpcf7_cf7com_links( &$contact_form ) { + $links = ''; + + echo apply_filters( 'wpcf7_cf7com_links', $links ); +} + +add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_updated_message' ); + +function wpcf7_updated_message( &$contact_form ) { + if ( ! isset( $_GET['message'] ) ) + return; + + switch ( $_GET['message'] ) { + case 'created': + $updated_message = __( "Contact form created.", 'wpcf7' ); + break; + case 'saved': + $updated_message = __( "Contact form saved.", 'wpcf7' ); + break; + case 'deleted': + $updated_message = __( "Contact form deleted.", 'wpcf7' ); + break; + } + + if ( ! $updated_message ) + return; + +?> +

+= 20 ) + $show_link = false; + + $show_link = apply_filters( 'wpcf7_show_donation_link', $show_link ); + + if ( ! $show_link ) + return; + + $texts = array( + __( "Contact Form 7 needs your support. Please donate today.", 'wpcf7' ), + __( "Your contribution is needed for making this plugin better.", 'wpcf7' ) ); + + $text = $texts[array_rand( $texts )]; + +?> +
+

+
+ \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/admin/edit.php b/src/wp-content/plugins/contact-form-7/admin/edit.php new file mode 100644 index 00000000..b4afe9e1 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/edit.php @@ -0,0 +1,159 @@ +
+ + + +

+ + + + + +
+ + + + +
> + + + + +
+ +
+ /> + + +

+
+ + +

+ + + + + +
+ +
+ + + + + +
+ + 'wpcf7-mail-2', + 'name' => 'mail_2', + 'use' => __( 'Use mail (2)', 'wpcf7' ) ) ); + + add_meta_box( 'messagesdiv', __( 'Messages', 'wpcf7' ), + 'wpcf7_messages_meta_box', 'cfseven', 'messages', 'core' ); + + add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'wpcf7' ), + 'wpcf7_additional_settings_meta_box', 'cfseven', 'additional_settings', 'core' ); +} + +do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) ); + +do_meta_boxes( 'cfseven', 'form', $cf ); + +do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) ); + +do_meta_boxes( 'cfseven', 'mail', $cf ); + +do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) ); + +do_meta_boxes( 'cfseven', 'mail_2', $cf ); + +do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$cf ) ); + +do_meta_boxes( 'cfseven', 'messages', $cf ); + +do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) ); + +do_meta_boxes( 'cfseven', 'additional_settings', $cf ); + +do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) ); + +wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); +wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); + +?> +
+ +
+ + + +
+ + + + diff --git a/src/wp-content/plugins/contact-form-7/admin/includes/meta-boxes.php b/src/wp-content/plugins/contact-form-7/admin/includes/meta-boxes.php new file mode 100644 index 00000000..a607f757 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/includes/meta-boxes.php @@ -0,0 +1,109 @@ + +
+ +
+ +
+ 'wpcf7-mail', 'name' => 'mail', 'use' => null ); + + if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) + $args = array(); + else + $args = $box['args']; + + extract( wp_parse_args( $args, $defaults ), EXTR_SKIP ); + + $id = esc_attr( $id ); + $mail = $post->{$name}; + + if ( ! empty( $use ) ) : +?> +
+ /> + +
+
+ +
+ + +
+
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ /> + +
+
+ +
+
+
+ +
+
+ +
+
+ $arr ) : + $field_name = 'wpcf7-message-' . strtr( $key, '_', '-' ); + +?> +
+
+ +
+ + + \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/admin/scripts.js b/src/wp-content/plugins/contact-form-7/admin/scripts.js new file mode 100644 index 00000000..081cef78 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/scripts.js @@ -0,0 +1,73 @@ +(function($) { + + $(function() { + try { + $.extend($.tgPanes, _wpcf7.tagGenerators); + $('#taggenerator').tagGenerator(_wpcf7L10n.generateTag, + { dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' }); + + $('input#wpcf7-title:disabled').css({cursor: 'default'}); + + $('input#wpcf7-title').mouseover(function() { + $(this).not('.focus').addClass('mouseover'); + }); + + $('input#wpcf7-title').mouseout(function() { + $(this).removeClass('mouseover'); + }); + + $('input#wpcf7-title').focus(function() { + $(this).addClass('focus').removeClass('mouseover'); + }); + + $('input#wpcf7-title').blur(function() { + $(this).removeClass('focus'); + }); + + $('input#wpcf7-title').change(function() { + updateTag(); + }); + + updateTag(); + + $('.check-if-these-fields-are-active').each(function(index) { + if (! $(this).is(':checked')) + $(this).parent().siblings('.mail-fields').hide(); + + $(this).click(function() { + if ($(this).parent().siblings('.mail-fields').is(':hidden') + && $(this).is(':checked')) { + $(this).parent().siblings('.mail-fields').slideDown('fast'); + } else if ($(this).parent().siblings('.mail-fields').is(':visible') + && $(this).not(':checked')) { + $(this).parent().siblings('.mail-fields').slideUp('fast'); + } + }); + }); + + postboxes.add_postbox_toggles('cfseven'); + + } catch (e) { + } + }); + + function updateTag() { + var title = $('input#wpcf7-title').val(); + + if (title) + title = title.replace(/["'\[\]]/g, ''); + + $('input#wpcf7-title').val(title); + var postId = $('input#post_ID').val(); + var tag = '[contact-form-7 id="' + postId + '" title="' + title + '"]'; + $('input#contact-form-anchor-text').val(tag); + + var oldId = $('input#wpcf7-id').val(); + + if (0 != oldId) { + var tagOld = '[contact-form ' + oldId + ' "' + title + '"]'; + $('input#contact-form-anchor-text-old').val(tagOld).parent('p.tagcode').show(); + } + } + +})(jQuery); \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/admin/styles-rtl.css b/src/wp-content/plugins/contact-form-7/admin/styles-rtl.css new file mode 100644 index 00000000..8f9cd0f0 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/styles-rtl.css @@ -0,0 +1,18 @@ +ul.subsubsub li.addnew { + margin-left: 0; + margin-right: 0.5em; +} +div.save-contact-form { + direction: rtl; +} +div.actions-link { + right: auto; + left: 0; +} +div.tg-pane table caption { + text-align: right; +} +div.tg-dropdown { + left: auto; + right: 0; +} \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/admin/styles.css b/src/wp-content/plugins/contact-form-7/admin/styles.css new file mode 100644 index 00000000..81dfde68 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/styles.css @@ -0,0 +1,279 @@ +div.wrap div.cf7com-links { + text-align: right; + font-size: .8em; + margin-top: -1.6em; +} + +div.wrap div.cf7com-links a { + text-decoration: none; +} + +div.wrap div.donation { + border-width: 1px; + border-style: solid; + padding: 0 0.6em; + margin: 5px 0 15px; + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; + background-color: #ffffe0; + border-color: #e6db55; + text-align: center; +} + +div.wrap div.donation p { + margin: .7em 0; + line-height: 1; + padding: 2px; + font-size: 107%; +} + +div.wrap div.donation p a { + font-weight: bold; + color: #3f3f3f; +} + +div.wrap div.donation p a.button { + margin-left: 1em; +} + +div.wrap ul.subsubsub { + white-space: normal; +} + +ul.subsubsub li.addnew { + margin-left: 0.5em; +} + +ul.subsubsub li.addnew a { + color: #e6255b; +} + +ul.subsubsub li.addnew a.current { + border: 1px solid #bbb; +} + +ul.subsubsub li.addnew a:hover, +ul.subsubsub li.addnew a:active { + color: #999; +} + +#titlediv { + margin-bottom: 20px; + position: relative; + border: 1px solid #c7c7c7; + padding: 6px; +} + +div.save-contact-form { + padding: 1.4em 0 0 0; + text-align: right; +} + +div.actions-link { + position: absolute; + top: 0; + right: 0; + margin: 0; + padding: 6px; +} + +div.actions-link input { + padding: 0; + margin: 0; + border: none; + font-size: 11px; + cursor: pointer; +} + +div.actions-link input.copy { + color: #006505; +} + +div.actions-link input.delete { + color: #bc0b0b; +} + +input#wpcf7-title { + color: #555; + border: none; + font: bold 20px serif; + cursor: pointer; + background-color: transparent; +} + +input#wpcf7-title.focus { + color: #333; + border: 1px solid #777; + font: normal 13px Verdana, Arial, Helvetica, sans-serif; + cursor: text; + background-color: transparent; +} + +input#wpcf7-title.mouseover { + background-color: #ffffdd; +} + +p.tagcode { + color: #333; + margin: 2ex 0 1ex 0; +} + +input#contact-form-anchor-text, input#contact-form-anchor-text-old { + color: #fff; + background: #7e4e0b; + border: none; + width: 100%; + -moz-border-radius: 6px; + -khtml-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; +} + +.postbox .half, .postbox .half-left, .postbox .half-right { + float: left; + width: 50%; +} + +.postbox .half-right > * { + margin-left: 10px; +} + +.postbox .mail-field, .postbox .message-field { + margin-top: 6px; + margin-bottom: 8px; +} + +.postbox .mail-field label, .postbox .message-field label { + line-height: 1.4em; +} + +div.pseudo-hr { + border-bottom: 1px solid transparent; + margin: 8px 0; +} + +input, textarea { + border: 1px solid #dfdfdf; +} + +input.wide { + width: 100%; +} + +textarea { + width: 100%; +} + +label.disabled { + color: #777; +} + +div.tag-generator { + position: relative; + background: transparent; + padding: 0 0 5px 1px; +} + +div.tg-pane { + border: 1px dashed #999; + background: #f1f1f1; + margin: 1ex 0 0 0; + padding: 10px; + -moz-border-radius: 6px; + -khtml-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; + line-height: 140%; +} + +div.tg-pane table { + width: 100%; + margin: 0 0 0.7em 0; +} + +div.tg-pane table caption { + text-align: left; + padding: 0 0 0.2em 0; + font-weight: bolder; + color: #777; +} + +div.tg-pane table code { + background-color: inherit; +} + +div.tg-pane table td { + vertical-align: top; + width: 50%; + border: none; + padding: 2px 0; +} + +div.tg-pane input.tag, div.tg-pane input.mail-tag { + width: 100%; + border: none; + color: #fff; + background-color: #7e4e0b; + -moz-border-radius: 6px; + -khtml-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; +} + +div.tg-pane input.mail-tag { + width: 50%; + background-color: #404f03; +} + +div.tg-mail-tag { + margin-top: 2.4em; + text-align: right; +} + +div.tg-pane span.arrow { + font-family: monospace; + font-size: 1.2em; + color: #333; +} + +div.tg-pane input.tg-name { + border-color: #555; +} + +div.tg-pane input.oneline { + width: 98%; + font-size: smaller; +} + +div.tg-pane textarea { + width: 98%; + height: 100px; + font-size: smaller; +} + +div.tg-pane div.tg-tag { + margin: .4em 0; +} + +div.tg-dropdown { + position: absolute; + top: 26px; + left: 0; + z-index: 10; + border: 1px solid #ddd; +} + +span.tg-closebutton { + color: #777; + font: bold 18px monospace; + padding: 1px 4px; + cursor: pointer; +} + +div.tg-panetitle { + font: bold 132% sans-serif; + margin: 0 0 10px; + color: #777; +} \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/admin/taggenerator.js b/src/wp-content/plugins/contact-form-7/admin/taggenerator.js new file mode 100644 index 00000000..dc01fe9e --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/taggenerator.js @@ -0,0 +1,262 @@ +(function($) { + + $.fn.tagGenerator = function(title, options) { + var menu = $('
'); + + var selector = $('' + title + ''); + + selector.css({ + border: '1px solid #ddd', + padding: '2px 4px', + background: '#fff url( ../wp-admin/images/fade-butt.png ) repeat-x 0 0', + '-moz-border-radius': '3px', + '-khtml-border-radius': '3px', + '-webkit-border-radius': '3px', + 'border-radius': '3px' + }); + + selector.mouseover(function() { + $(this).css({ 'border-color': '#bbb' }); + }); + selector.mouseout(function() { + $(this).css({ 'border-color': '#ddd' }); + }); + selector.mousedown(function() { + $(this).css({ background: '#ddd' }); + }); + selector.mouseup(function() { + $(this).css({ + background: '#fff url( ../wp-admin/images/fade-butt.png ) repeat-x 0 0' + }); + }); + selector.click(function() { + dropdown.slideDown('fast'); + return false; + }); + $('body').click(function() { + dropdown.hide(); + }); + + if (options.dropdownIconUrl) { + var dropdown_icon = $(''); + dropdown_icon.css({ 'vertical-align': 'bottom' }); + selector.append(dropdown_icon); + } + + menu.append(selector); + + var pane = $('
'); + pane.hide(); + menu.append(pane); + + var dropdown = $('
'); + dropdown.hide(); + menu.append(dropdown); + + $.each($.tgPanes, function(i, n) { + var submenu = $('
' + $.tgPanes[i].title + '
'); + submenu.css({ + margin: 0, + padding: '0 4px', + 'line-height': '180%', + background: '#fff' + }); + submenu.mouseover(function() { + $(this).css({ background: '#d4f2f2' }); + }); + submenu.mouseout(function() { + $(this).css({ background: '#fff' }); + }); + submenu.click(function() { + dropdown.hide(); + pane.hide(); + pane.empty(); + $.tgPane(pane, i); + pane.slideDown('fast'); + return false; + }); + dropdown.append(submenu); + }); + + this.append(menu); + }; + + $.tgPane = function(pane, tagType) { + var closeButtonDiv = $('
'); + closeButtonDiv.css({ float: 'right' }); + + var closeButton = $('×'); + closeButton.click(function() { + pane.slideUp('fast').empty(); + }); + closeButtonDiv.append(closeButton); + + pane.append(closeButtonDiv); + + var paneTitle = $('
' + $.tgPanes[tagType].title + '
'); + pane.append(paneTitle); + + pane.append($('#' + $.tgPanes[tagType].content).clone().contents()); + + pane.find(':checkbox.exclusive').change(function() { + if ($(this).is(':checked')) + $(this).siblings(':checkbox.exclusive').removeAttr('checked'); + }); + + if ($.isFunction($.tgPanes[tagType].change)) + $.tgPanes[tagType].change(pane, tagType); + else + $.tgCreateTag(pane, tagType); + + pane.find(':input').change(function() { + if ($.isFunction($.tgPanes[tagType].change)) + $.tgPanes[tagType].change(pane, tagType); + else + $.tgCreateTag(pane, tagType); + }); + } + + $.tgCreateTag = function(pane, tagType) { + pane.find('input[name="name"]').each(function(i) { + var val = $(this).val(); + val = val.replace(/[^0-9a-zA-Z:._-]/g, '').replace(/^[^a-zA-Z]+/, ''); + if ('' == val) { + var rand = Math.floor(Math.random() * 1000); + val = tagType + '-' + rand; + } + $(this).val(val); + }); + + pane.find(':input.numeric').each(function(i) { + var val = $(this).val(); + val = val.replace(/[^0-9]/g, ''); + $(this).val(val); + }); + + pane.find(':input.idvalue').each(function(i) { + var val = $(this).val(); + val = val.replace(/[^-0-9a-zA-Z_]/g, ''); + $(this).val(val); + }); + + pane.find(':input.classvalue').each(function(i) { + var val = $(this).val(); + val = $.map(val.split(' '), function(n) { + return n.replace(/[^-0-9a-zA-Z_]/g, ''); + }).join(' '); + val = $.trim(val.replace(/\s+/g, ' ')); + $(this).val(val); + }); + + pane.find(':input.color').each(function(i) { + var val = $(this).val(); + val = val.replace(/[^0-9a-fA-F]/g, ''); + $(this).val(val); + }); + + pane.find(':input.filesize').each(function(i) { + var val = $(this).val(); + val = val.replace(/[^0-9kKmMbB]/g, ''); + $(this).val(val); + }); + + pane.find(':input.filetype').each(function(i) { + var val = $(this).val(); + val = val.replace(/[^0-9a-zA-Z.\s]/g, ''); + $(this).val(val); + }); + + pane.find(':input.date').each(function(i) { + var val = $(this).val(); + if (! val.match(/^\d{4}-\d{1,2}-\d{1,2}$/)) // 'yyyy-mm-dd' ISO 8601 format + $(this).val(''); + }); + + pane.find(':input[name="values"]').each(function(i) { + var val = $(this).val(); + val = $.trim(val); + $(this).val(val); + }); + + pane.find('input.tag').each(function(i) { + var type = $(this).attr('name'); + + var scope = pane.find('.scope.' + type); + if (! scope.length) + scope = pane; + + if (pane.find(':input[name="required"]').is(':checked')) + type += '*'; + + var name = pane.find(':input[name="name"]').val(); + + var options = []; + + var size = scope.find(':input[name="size"]').val(); + var maxlength = scope.find(':input[name="maxlength"]').val(); + if (size || maxlength) + options.push(size + '/' + maxlength); + + var cols = scope.find(':input[name="cols"]').val(); + var rows = scope.find(':input[name="rows"]').val(); + if (cols || rows) + options.push(cols + 'x' + rows); + + scope.find('input:text.option').each(function(i) { + if (-1 < $.inArray($(this).attr('name'), ['size', 'maxlength', 'cols', 'rows'])) + return; + + var val = $(this).val(); + + if (! val) + return; + + if ($(this).hasClass('filetype')) + val = val.split(' ').join('|'); + + if ($(this).hasClass('color')) + val = '#' + val; + + if ('class' == $(this).attr('name')) { + $.each(val.split(' '), function(i, n) { options.push('class:' + n) }); + } else { + options.push($(this).attr('name') + ':' + val); + } + }); + + scope.find('input:checkbox.option').each(function(i) { + if ($(this).is(':checked')) + options.push($(this).attr('name')); + }); + + options = (options.length > 0) ? ' ' + options.join(' ') : ''; + + var value = ''; + + if (scope.find(':input[name="values"]').val()) { + $.each(scope.find(':input[name="values"]').val().split("\n"), function(i, n) { + value += ' "' + n.replace(/["]/g, '"') + '"'; + }); + } + + if ($.tgPanes[tagType].nameless) + var tag = '[' + type + options + value + ']'; + else + var tag = name ? '[' + type + ' ' + name + options + value + ']' : ''; + + $(this).val(tag); + }); + + pane.find('input.mail-tag').each(function(i) { + var name = pane.find(':input[name="name"]').val(); + + var tag = name ? '[' + name + ']' : ''; + + $(this).val(tag); + }); + + } + + $.tgPanes = {}; + +})(jQuery); \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/images/ajax-loader.gif b/src/wp-content/plugins/contact-form-7/images/ajax-loader.gif new file mode 100644 index 00000000..f2cfafd6 Binary files /dev/null and b/src/wp-content/plugins/contact-form-7/images/ajax-loader.gif differ diff --git a/src/wp-content/plugins/contact-form-7/images/dropdown.gif b/src/wp-content/plugins/contact-form-7/images/dropdown.gif new file mode 100644 index 00000000..a342dfdf Binary files /dev/null and b/src/wp-content/plugins/contact-form-7/images/dropdown.gif differ diff --git a/src/wp-content/plugins/contact-form-7/includes/classes.php b/src/wp-content/plugins/contact-form-7/includes/classes.php new file mode 100644 index 00000000..c007ed9e --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/classes.php @@ -0,0 +1,578 @@ +unit_tag == $_POST['_wpcf7_unit_tag'] ) + return true; + + return false; + } + + function clear_post() { + $fes = $this->form_scan_shortcode(); + + foreach ( $fes as $fe ) { + if ( ! isset( $fe['name'] ) || empty( $fe['name'] ) ) + continue; + + $name = $fe['name']; + + if ( isset( $_POST[$name] ) ) + unset( $_POST[$name] ); + } + } + + /* Generating Form HTML */ + + function form_html() { + $form = '
'; + + $url = wpcf7_get_request_uri(); + + if ( $frag = strstr( $url, '#' ) ) + $url = substr( $url, 0, -strlen( $frag ) ); + + $url .= '#' . $this->unit_tag; + + $url = apply_filters( 'wpcf7_form_action_url', $url ); + $enctype = apply_filters( 'wpcf7_form_enctype', '' ); + $class = apply_filters( 'wpcf7_form_class_attr', 'wpcf7-form' ); + + $form .= '
' . "\n"; + $form .= '
' . "\n"; + $form .= '' . "\n"; + $form .= '' . "\n"; + $form .= '' . "\n"; + $form .= '
' . "\n"; + $form .= $this->form_elements(); + + if ( ! $this->responses_count ) + $form .= $this->form_response_output(); + + $form .= '
'; + + $form .= '
'; + + return $form; + } + + function form_response_output() { + $class = 'wpcf7-response-output'; + $content = ''; + + if ( $this->is_posted() ) { // Post response output for non-AJAX + if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['id'] == $this->id ) { + if ( $_POST['_wpcf7_mail_sent']['ok'] ) { + $class .= ' wpcf7-mail-sent-ok'; + $content = $_POST['_wpcf7_mail_sent']['message']; + } else { + $class .= ' wpcf7-mail-sent-ng'; + if ( $_POST['_wpcf7_mail_sent']['spam'] ) + $class .= ' wpcf7-spam-blocked'; + $content = $_POST['_wpcf7_mail_sent']['message']; + } + } elseif ( isset( $_POST['_wpcf7_validation_errors'] ) && $_POST['_wpcf7_validation_errors']['id'] == $this->id ) { + $class .= ' wpcf7-validation-errors'; + $content = $this->message( 'validation_error' ); + } + } else { + $class .= ' wpcf7-display-none'; + } + + $class = ' class="' . $class . '"'; + + return '' . $content . ''; + } + + function validation_error( $name ) { + if ( ! $this->is_posted() ) + return ''; + + if ( ! isset( $_POST['_wpcf7_validation_errors']['messages'][$name] ) ) + return ''; + + $ve = trim( $_POST['_wpcf7_validation_errors']['messages'][$name] ); + + if ( ! empty( $ve ) ) { + $ve = '' . esc_html( $ve ) . ''; + return apply_filters( 'wpcf7_validation_error', $ve, $name, $this ); + } + + return ''; + } + + /* Form Elements */ + + function form_do_shortcode() { + global $wpcf7_shortcode_manager; + + $form = $this->form; + + if ( WPCF7_AUTOP ) { + $form = $wpcf7_shortcode_manager->normalize_shortcode( $form ); + $form = wpcf7_autop( $form ); + } + + $form = $wpcf7_shortcode_manager->do_shortcode( $form ); + $this->scanned_form_tags = $wpcf7_shortcode_manager->scanned_tags; + + return $form; + } + + function form_scan_shortcode( $cond = null ) { + global $wpcf7_shortcode_manager; + + if ( ! empty( $this->scanned_form_tags ) ) { + $scanned = $this->scanned_form_tags; + } else { + $scanned = $wpcf7_shortcode_manager->scan_shortcode( $this->form ); + $this->scanned_form_tags = $scanned; + } + + if ( empty( $scanned ) ) + return null; + + if ( ! is_array( $cond ) || empty( $cond ) ) + return $scanned; + + for ( $i = 0, $size = count( $scanned ); $i < $size; $i++ ) { + + if ( isset( $cond['type'] ) ) { + if ( is_string( $cond['type'] ) && ! empty( $cond['type'] ) ) { + if ( $scanned[$i]['type'] != $cond['type'] ) { + unset( $scanned[$i] ); + continue; + } + } elseif ( is_array( $cond['type'] ) ) { + if ( ! in_array( $scanned[$i]['type'], $cond['type'] ) ) { + unset( $scanned[$i] ); + continue; + } + } + } + + if ( isset( $cond['name'] ) ) { + if ( is_string( $cond['name'] ) && ! empty( $cond['name'] ) ) { + if ( $scanned[$i]['name'] != $cond['name'] ) { + unset ( $scanned[$i] ); + continue; + } + } elseif ( is_array( $cond['name'] ) ) { + if ( ! in_array( $scanned[$i]['name'], $cond['name'] ) ) { + unset( $scanned[$i] ); + continue; + } + } + } + } + + return array_values( $scanned ); + } + + function form_elements() { + return apply_filters( 'wpcf7_form_elements', $this->form_do_shortcode() ); + } + + /* Validate */ + + function validate() { + $fes = $this->form_scan_shortcode(); + + $result = array( 'valid' => true, 'reason' => array() ); + + foreach ( $fes as $fe ) { + $result = apply_filters( 'wpcf7_validate_' . $fe['type'], $result, $fe ); + } + + return $result; + } + + /* Mail */ + + function mail() { + $fes = $this->form_scan_shortcode(); + + foreach ( $fes as $fe ) { + if ( empty( $fe['name'] ) ) + continue; + + $name = $fe['name']; + $pipes = $fe['pipes']; + $value = $_POST[$name]; + + if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) { + if ( is_array( $value) ) { + $new_value = array(); + foreach ( $value as $v ) { + $new_value[] = $pipes->do_pipe( stripslashes( $v ) ); + } + $value = $new_value; + } else { + $value = $pipes->do_pipe( stripslashes( $value ) ); + } + } + + $this->posted_data[$name] = $value; + } + + if ( $this->in_demo_mode() ) + $this->skip_mail = true; + + do_action_ref_array( 'wpcf7_before_send_mail', array( &$this ) ); + + if ( $this->skip_mail ) + return true; + + if ( $this->compose_and_send_mail( $this->mail ) ) { + $additional_mail = array(); + + if ( $this->mail_2['active'] ) + $additional_mail[] = $this->mail_2; + + $additional_mail = apply_filters_ref_array( 'wpcf7_additional_mail', + array( $additional_mail, &$this ) ); + + foreach ( $additional_mail as $mail ) + $this->compose_and_send_mail( $mail ); + + return true; + } + + return false; + } + + function compose_and_send_mail( $mail_template ) { + $regex = '/\[\s*([a-zA-Z_][0-9a-zA-Z:._-]*)\s*\]/'; + + $use_html = (bool) $mail_template['use_html']; + + $callback = array( &$this, 'mail_callback' ); + $callback_html = array( &$this, 'mail_callback_html' ); + + $subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] ); + $sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] ); + $recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] ); + $additional_headers = + preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] ); + + if ( $use_html ) { + $body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] ); + $body = wpautop( $body ); + } else { + $body = preg_replace_callback( $regex, $callback, $mail_template['body'] ); + } + + $attachments = array(); + + foreach ( (array) $this->uploaded_files as $name => $path ) { + if ( false === strpos( $mail_template['attachments'], "[${name}]" ) || empty( $path ) ) + continue; + + $attachments[] = $path; + } + + extract( apply_filters_ref_array( 'wpcf7_mail_components', array( + compact( 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' ), + &$this ) ) ); + + $headers = "From: $sender\n"; + + if ( $use_html ) + $headers .= "Content-Type: text/html\n"; + + $headers .= trim( $additional_headers ) . "\n"; + + return @wp_mail( $recipient, $subject, $body, $headers, $attachments ); + } + + function mail_callback_html( $matches ) { + return $this->mail_callback( $matches, true ); + } + + function mail_callback( $matches, $html = false ) { + if ( isset( $this->posted_data[$matches[1]] ) ) { + $submitted = $this->posted_data[$matches[1]]; + + if ( is_array( $submitted ) ) + $replaced = join( ', ', $submitted ); + else + $replaced = $submitted; + + if ( $html ) { + $replaced = strip_tags( $replaced ); + $replaced = wptexturize( $replaced ); + } + + $replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced, $submitted ); + + return stripslashes( $replaced ); + } + + if ( $special = apply_filters( 'wpcf7_special_mail_tags', '', $matches[1] ) ) + return $special; + + return $matches[0]; + } + + /* Message */ + + function message( $status ) { + $messages = $this->messages; + $message = isset( $messages[$status] ) ? $messages[$status] : ''; + + return apply_filters( 'wpcf7_display_message', $message, $status ); + } + + /* Additional settings */ + + function additional_setting( $name, $max = 1 ) { + $tmp_settings = (array) explode( "\n", $this->additional_settings ); + + $count = 0; + $values = array(); + + foreach ( $tmp_settings as $setting ) { + if ( preg_match('/^([a-zA-Z0-9_]+)\s*:(.*)$/', $setting, $matches ) ) { + if ( $matches[1] != $name ) + continue; + + if ( ! $max || $count < (int) $max ) { + $values[] = trim( $matches[2] ); + $count += 1; + } + } + } + + return $values; + } + + function in_demo_mode() { + $settings = $this->additional_setting( 'demo_mode', false ); + + foreach ( $settings as $setting ) { + if ( in_array( $setting, array( 'on', 'true', '1' ) ) ) + return true; + } + + return false; + } + + /* Upgrade */ + + function upgrade() { + if ( ! isset( $this->mail['recipient'] ) ) + $this->mail['recipient'] = get_option( 'admin_email' ); + + + if ( ! is_array( $this->messages ) ) + $this->messages = array(); + + + foreach ( wpcf7_messages() as $key => $arr ) { + if ( ! isset( $this->messages[$key] ) ) + $this->messages[$key] = $arr['default']; + } + } + + /* Save */ + + function save() { + $postarr = array( + 'ID' => (int) $this->id, + 'post_type' => 'wpcf7_contact_form', + 'post_status' => 'publish', + 'post_title' => $this->title ); + + $post_id = wp_insert_post( $postarr ); + + if ( $post_id ) { + update_post_meta( $post_id, 'form', $this->form ); + update_post_meta( $post_id, 'mail', $this->mail ); + update_post_meta( $post_id, 'mail_2', $this->mail_2 ); + update_post_meta( $post_id, 'messages', $this->messages ); + update_post_meta( $post_id, 'additional_settings', $this->additional_settings ); + + if ( $this->initial ) { + $this->initial = false; + $this->id = $post_id; + do_action_ref_array( 'wpcf7_after_create', array( &$this ) ); + } else { + do_action_ref_array( 'wpcf7_after_update', array( &$this ) ); + } + + do_action_ref_array( 'wpcf7_after_save', array( &$this ) ); + } + + return $post_id; + } + + function copy() { + $new = new WPCF7_ContactForm(); + $new->initial = true; + $new->title = $this->title . '_copy'; + + $new->form = $this->form; + $new->mail = $this->mail; + $new->mail_2 = $this->mail_2; + $new->messages = $this->messages; + $new->additional_settings = $this->additional_settings; + + $new = apply_filters_ref_array( 'wpcf7_copy', array( &$new, &$this ) ); + + return $new; + } + + function delete() { + if ( $this->initial ) + return; + + wp_delete_post( $this->id, true ); + + $this->initial = true; + $this->id = null; + } +} + +function wpcf7_contact_form( $id ) { + $post = get_post( $id ); + + if ( empty( $post ) || 'wpcf7_contact_form' != get_post_type( $post ) ) + return false; + + $contact_form = new WPCF7_ContactForm(); + $contact_form->id = $post->ID; + $contact_form->title = $post->post_title; + + $contact_form->form = get_post_meta( $post->ID, 'form', true ); + $contact_form->mail = get_post_meta( $post->ID, 'mail', true ); + $contact_form->mail_2 = get_post_meta( $post->ID, 'mail_2', true ); + $contact_form->messages = get_post_meta( $post->ID, 'messages', true ); + $contact_form->additional_settings = get_post_meta( $post->ID, 'additional_settings', true ); + + $contact_form->upgrade(); + + $contact_form = apply_filters_ref_array( 'wpcf7_contact_form', array( &$contact_form ) ); + + return $contact_form; +} + +function wpcf7_get_contact_form_by_old_id( $old_id ) { + global $wpdb; + + $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'" + . $wpdb->prepare( " AND meta_value = %d", $old_id ); + + if ( $new_id = $wpdb->get_var( $q ) ) + return wpcf7_contact_form( $new_id ); +} + +function wpcf7_contact_form_default_pack( $locale = null ) { + // For backward compatibility + + return wpcf7_get_contact_form_default_pack( array( 'locale' => $locale ) ); +} + +function wpcf7_get_contact_form_default_pack( $args = '' ) { + global $l10n; + + $defaults = array( 'locale' => null, 'title' => '' ); + $args = wp_parse_args( $args, $defaults ); + + $locale = $args['locale']; + $title = $args['title']; + + if ( $locale && $locale != get_locale() ) { + $mo_orig = $l10n['wpcf7']; + unset( $l10n['wpcf7'] ); + + if ( 'en_US' != $locale ) { + $mofile = wpcf7_plugin_path( 'languages/wpcf7-' . $locale . '.mo' ); + if ( ! load_textdomain( 'wpcf7', $mofile ) ) { + $l10n['wpcf7'] = $mo_orig; + unset( $mo_orig ); + } + } + } + + $contact_form = new WPCF7_ContactForm(); + $contact_form->initial = true; + + $contact_form->title = ( $title ? $title : __( 'Untitled', 'wpcf7' ) ); + + $contact_form->form = wpcf7_get_default_template( 'form' ); + $contact_form->mail = wpcf7_get_default_template( 'mail' ); + $contact_form->mail_2 = wpcf7_get_default_template( 'mail_2' ); + $contact_form->messages = wpcf7_get_default_template( 'messages' ); + $contact_form->additional_settings = wpcf7_get_default_template( 'additional_settings' ); + + if ( isset( $mo_orig ) ) + $l10n['wpcf7'] = $mo_orig; + + $contact_form = apply_filters_ref_array( 'wpcf7_contact_form_default_pack', + array( &$contact_form, $args ) ); + + return $contact_form; +} + +function wpcf7_get_current_contact_form() { + global $wpcf7_contact_form; + + if ( ! is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) ) + return null; + + return $wpcf7_contact_form; +} + +function wpcf7_is_posted() { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) + return false; + + return $contact_form->is_posted(); +} + +function wpcf7_get_validation_error( $name ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) + return ''; + + return $contact_form->validation_error( $name ); +} + +function wpcf7_get_message( $status ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) + return ''; + + return $contact_form->message( $status ); +} + +function wpcf7_scan_shortcode( $cond = null ) { + if ( ! $contact_form = wpcf7_get_current_contact_form() ) + return null; + + return $contact_form->form_scan_shortcode( $cond ); +} + +?> \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/includes/controller.php b/src/wp-content/plugins/contact-form-7/includes/controller.php new file mode 100644 index 00000000..8b786a7a --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/controller.php @@ -0,0 +1,327 @@ + false, + 'into' => '#' . $unit_tag, + 'captcha' => null ); + + $result = wpcf7_submit( true ); + + if ( ! empty( $result['message'] ) ) + $items['message'] = $result['message']; + + if ( $result['mail_sent'] ) + $items['mailSent'] = true; + + if ( ! $result['valid'] ) { + $invalids = array(); + + foreach ( $result['invalid_reasons'] as $name => $reason ) { + $invalids[] = array( + 'into' => 'span.wpcf7-form-control-wrap.' . $name, + 'message' => $reason ); + } + + $items['invalids'] = $invalids; + } + + if ( $result['spam'] ) + $items['spam'] = true; + + if ( ! empty( $result['scripts_on_sent_ok'] ) ) + $items['onSentOk'] = $result['scripts_on_sent_ok']; + + $items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result ); + + $wpcf7_contact_form = null; + } + } + + $echo = json_encode( $items ); + + if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) { + @header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) ); + echo $echo; + } else { + @header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); + echo ''; + } + + exit(); +} + +add_action( 'init', 'wpcf7_submit_nonajax', 11 ); + +function wpcf7_submit_nonajax() { + global $wpcf7_contact_form; + + if ( ! isset( $_POST['_wpcf7'] ) ) + return; + + $id = (int) $_POST['_wpcf7']; + + if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) { + $result = wpcf7_submit(); + + if ( ! $result['valid'] ) { + $_POST['_wpcf7_validation_errors'] = array( + 'id' => $id, + 'messages' => $result['invalid_reasons'] ); + } else { + $_POST['_wpcf7_mail_sent'] = array( + 'id' => $id, + 'ok' => $result['mail_sent'], + 'message' => $result['message'], + 'spam' => $result['spam'] ); + } + + $wpcf7_contact_form = null; + } +} + +function wpcf7_submit( $ajax = false ) { + global $wpcf7_contact_form; + + if ( ! is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) ) + return false; + + $result = array( + 'valid' => true, + 'invalid_reasons' => array(), + 'spam' => false, + 'message' => '', + 'mail_sent' => false, + 'scripts_on_sent_ok' => null ); + + $validation = $wpcf7_contact_form->validate(); + + if ( ! $validation['valid'] ) { // Validation error occured + $result['valid'] = false; + $result['invalid_reasons'] = $validation['reason']; + $result['message'] = wpcf7_get_message( 'validation_error' ); + + } elseif ( ! apply_filters( 'wpcf7_acceptance', true ) ) { // Not accepted terms + $result['message'] = wpcf7_get_message( 'accept_terms' ); + + } elseif ( apply_filters( 'wpcf7_spam', false ) ) { // Spam! + $result['message'] = wpcf7_get_message( 'spam' ); + $result['spam'] = true; + + } elseif ( $wpcf7_contact_form->mail() ) { + $result['mail_sent'] = true; + $result['message'] = wpcf7_get_message( 'mail_sent_ok' ); + + do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) ); + + if ( $ajax ) { + $on_sent_ok = $wpcf7_contact_form->additional_setting( 'on_sent_ok', false ); + + if ( ! empty( $on_sent_ok ) ) + $result['scripts_on_sent_ok'] = array_map( 'wpcf7_strip_quote', $on_sent_ok ); + } else { + $wpcf7_contact_form->clear_post(); + } + + } else { + $result['message'] = wpcf7_get_message( 'mail_sent_ng' ); + } + + // remove upload files + foreach ( (array) $wpcf7_contact_form->uploaded_files as $name => $path ) { + @unlink( $path ); + } + + return $result; +} + +add_action( 'the_post', 'wpcf7_the_post' ); + +function wpcf7_the_post() { + global $wpcf7; + + $wpcf7->processing_within = 'p' . get_the_ID(); + $wpcf7->unit_count = 0; +} + +add_action( 'loop_end', 'wpcf7_loop_end' ); + +function wpcf7_loop_end() { + global $wpcf7; + + $wpcf7->processing_within = ''; +} + +add_filter( 'widget_text', 'wpcf7_widget_text_filter', 9 ); + +function wpcf7_widget_text_filter( $content ) { + global $wpcf7; + + if ( ! preg_match( '/\[\s*contact-form(-7)?\s.*?\]/', $content ) ) + return $content; + + $wpcf7->widget_count += 1; + $wpcf7->processing_within = 'w' . $wpcf7->widget_count; + $wpcf7->unit_count = 0; + + $content = do_shortcode( $content ); + + $wpcf7->processing_within = ''; + + return $content; +} + +/* Shortcodes */ + +add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' ); +add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' ); + +function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) { + global $wpcf7, $wpcf7_contact_form; + + if ( is_feed() ) + return '[contact-form-7]'; + + if ( 'contact-form-7' == $code ) { + $atts = shortcode_atts( array( 'id' => 0, 'title' => '' ), $atts ); + $id = (int) $atts['id']; + $wpcf7_contact_form = wpcf7_contact_form( $id ); + } else { + if ( is_string( $atts ) ) + $atts = explode( ' ', $atts, 2 ); + + $id = (int) array_shift( $atts ); + $wpcf7_contact_form = wpcf7_get_contact_form_by_old_id( $id ); + } + + if ( ! $wpcf7_contact_form ) + return '[contact-form-7 404 "Not Found"]'; + + if ( $wpcf7->processing_within ) { // Inside post content or text widget + $wpcf7->unit_count += 1; + $unit_count = $wpcf7->unit_count; + $processing_within = $wpcf7->processing_within; + + } else { // Inside template + + if ( ! isset( $wpcf7->global_unit_count ) ) + $wpcf7->global_unit_count = 0; + + $wpcf7->global_unit_count += 1; + $unit_count = 1; + $processing_within = 't' . $wpcf7->global_unit_count; + } + + $unit_tag = 'wpcf7-f' . $wpcf7_contact_form->id . '-' . $processing_within . '-o' . $unit_count; + $wpcf7_contact_form->unit_tag = $unit_tag; + + $form = $wpcf7_contact_form->form_html(); + + $wpcf7_contact_form = null; + + return $form; +} + +add_action( 'wp_head', 'wpcf7_head' ); + +function wpcf7_head() { + // Cached? + if ( wpcf7_script_is() && defined( 'WP_CACHE' ) && WP_CACHE ) : +?> + + \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/includes/formatting.php b/src/wp-content/plugins/contact-form-7/includes/formatting.php new file mode 100644 index 00000000..fc6240bd --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/formatting.php @@ -0,0 +1,88 @@ +\s*
|', "\n\n", $pee ); + // Space things out a little + /* wpcf7: remove select and input */ + $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; + $pee = preg_replace( '!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee ); + $pee = preg_replace( '!()!', "$1\n\n", $pee ); + $pee = str_replace( array( "\r\n", "\r" ), "\n", $pee ); // cross-platform newlines + if ( strpos( $pee, ']*)>\s*|', "", $pee ); // no pee inside object/embed + $pee = preg_replace( '|\s*\s*|', '', $pee ); + } + $pee = preg_replace( "/\n\n+/", "\n\n", $pee ); // take care of duplicates + // make paragraphs, including one at the end + $pees = preg_split( '/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY ); + $pee = ''; + foreach ( $pees as $tinkle ) + $pee .= '

' . trim( $tinkle, "\n" ) . "

\n"; + $pee = preg_replace( '|

\s*

|', '', $pee ); // under certain strange conditions it could create a P of entirely whitespace + $pee = preg_replace( '!

([^<]+)!', "

$1

", $pee ); + $pee = preg_replace( '!

\s*(]*>)\s*

!', "$1", $pee ); // don't pee all over a tag + $pee = preg_replace( "|

(|", "$1", $pee ); // problem with nested lists + $pee = preg_replace( '|

]*)>|i', "

", $pee ); + $pee = str_replace( '

', '

', $pee ); + $pee = preg_replace( '!

\s*(]*>)!', "$1", $pee ); + $pee = preg_replace( '!(]*>)\s*

!', "$1", $pee ); + if ( $br ) { + /* wpcf7: add textarea */ + $pee = preg_replace_callback( '/<(script|style|textarea).*?<\/\\1>/s', create_function( '$matches', 'return str_replace("\n", "", $matches[0]);' ), $pee ); + $pee = preg_replace( '|(?)\s*\n|', "
\n", $pee ); // optionally make line breaks + $pee = str_replace( '', "\n", $pee ); + } + $pee = preg_replace( '!(]*>)\s*
!', "$1", $pee ); + $pee = preg_replace( '!
(\s*]*>)!', '$1', $pee ); + if ( strpos( $pee, ']*>)(.*?)!is', 'clean_pre', $pee ); + $pee = preg_replace( "|\n

$|", '

', $pee ); + + return $pee; +} + +function wpcf7_strip_quote( $text ) { + $text = trim( $text ); + if ( preg_match( '/^"(.*)"$/', $text, $matches ) ) + $text = $matches[1]; + elseif ( preg_match( "/^'(.*)'$/", $text, $matches ) ) + $text = $matches[1]; + return $text; +} + +function wpcf7_strip_quote_deep( $arr ) { + if ( is_string( $arr ) ) + return wpcf7_strip_quote( $arr ); + + if ( is_array( $arr ) ) { + $result = array(); + foreach ( $arr as $key => $text ) { + $result[$key] = wpcf7_strip_quote( $text ); + } + return $result; + } +} + +function wpcf7_canonicalize( $text ) { + if ( function_exists( 'mb_convert_kana' ) && 'UTF-8' == get_option( 'blog_charset' ) ) + $text = mb_convert_kana( $text, 'asKV', 'UTF-8' ); + + $text = strtolower( $text ); + $text = trim( $text ); + return $text; +} + +function wpcf7_is_name( $string ) { + // See http://www.w3.org/TR/html401/types.html#h-6.2 + // ID and NAME tokens must begin with a letter ([A-Za-z]) + // and may be followed by any number of letters, digits ([0-9]), + // hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). + + return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string ); +} + +?> \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/includes/functions.php b/src/wp-content/plugins/contact-form-7/includes/functions.php new file mode 100644 index 00000000..ed6192dd --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/functions.php @@ -0,0 +1,222 @@ + array( + 'description' => __( "Sender's message was sent successfully", 'wpcf7' ), + 'default' => __( 'Your message was sent successfully. Thanks.', 'wpcf7' ) + ), + + 'mail_sent_ng' => array( + 'description' => __( "Sender's message was failed to send", 'wpcf7' ), + 'default' => __( 'Failed to send your message. Please try later or contact the administrator by another method.', 'wpcf7' ) + ), + + 'validation_error' => array( + 'description' => __( "Validation errors occurred", 'wpcf7' ), + 'default' => __( 'Validation errors occurred. Please confirm the fields and submit it again.', 'wpcf7' ) + ), + + 'accept_terms' => array( + 'description' => __( "There is a field of term that sender is needed to accept", 'wpcf7' ), + 'default' => __( 'Please accept the terms to proceed.', 'wpcf7' ) + ), + + 'invalid_email' => array( + 'description' => __( "Email address that sender entered is invalid", 'wpcf7' ), + 'default' => __( 'Email address seems invalid.', 'wpcf7' ) + ), + + 'invalid_required' => array( + 'description' => __( "There is a field that sender is needed to fill in", 'wpcf7' ), + 'default' => __( 'Please fill the required field.', 'wpcf7' ) + ) + ); + + return apply_filters( 'wpcf7_messages', $messages ); +} + +function wpcf7_get_default_template( $prop = 'form' ) { + if ( 'form' == $prop ) + $template = wpcf7_default_form_template(); + elseif ( 'mail' == $prop ) + $template = wpcf7_default_mail_template(); + elseif ( 'mail_2' == $prop ) + $template = wpcf7_default_mail_2_template(); + elseif ( 'messages' == $prop ) + $template = wpcf7_default_messages_template(); + else + $template = null; + + return apply_filters( 'wpcf7_default_template', $template, $prop ); +} + +function wpcf7_default_form_template() { + $template = + '

' . __( 'Your Name', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '
' . "\n" + . ' [text* your-name]

' . "\n\n" + . '

' . __( 'Your Email', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '
' . "\n" + . ' [email* your-email]

' . "\n\n" + . '

' . __( 'Subject', 'wpcf7' ) . '
' . "\n" + . ' [text your-subject]

' . "\n\n" + . '

' . __( 'Your Message', 'wpcf7' ) . '
' . "\n" + . ' [textarea your-message]

' . "\n\n" + . '

[submit "' . __( 'Send', 'wpcf7' ) . '"]

'; + + return $template; +} + +function wpcf7_default_mail_template() { + $subject = '[your-subject]'; + $sender = '[your-name] <[your-email]>'; + $body = sprintf( __( 'From: %s', 'wpcf7' ), '[your-name] <[your-email]>' ) . "\n" + . sprintf( __( 'Subject: %s', 'wpcf7' ), '[your-subject]' ) . "\n\n" + . __( 'Message Body:', 'wpcf7' ) . "\n" . '[your-message]' . "\n\n" . '--' . "\n" + . sprintf( __( 'This mail is sent via contact form on %1$s %2$s', 'wpcf7' ), + get_bloginfo( 'name' ), get_bloginfo( 'url' ) ); + $recipient = get_option( 'admin_email' ); + $additional_headers = ''; + $attachments = ''; + $use_html = 0; + return compact( 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments', 'use_html' ); +} + +function wpcf7_default_mail_2_template() { + $active = false; + $subject = '[your-subject]'; + $sender = '[your-name] <[your-email]>'; + $body = __( 'Message body:', 'wpcf7' ) . "\n" . '[your-message]' . "\n\n" . '--' . "\n" + . sprintf( __( 'This mail is sent via contact form on %1$s %2$s', 'wpcf7' ), + get_bloginfo( 'name' ), get_bloginfo( 'url' ) ); + $recipient = '[your-email]'; + $additional_headers = ''; + $attachments = ''; + $use_html = 0; + return compact( 'active', 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments', 'use_html' ); +} + +function wpcf7_default_messages_template() { + $messages = array(); + + foreach ( wpcf7_messages() as $key => $arr ) { + $messages[$key] = $arr['default']; + } + + return $messages; +} + +function wpcf7_upload_dir( $type = false ) { + global $switched; + + $siteurl = get_option( 'siteurl' ); + $upload_path = trim( get_option( 'upload_path' ) ); + + $main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site(); + + if ( empty( $upload_path ) ) { + $dir = WP_CONTENT_DIR . '/uploads'; + } else { + $dir = $upload_path; + + if ( 'wp-content/uploads' == $upload_path ) { + $dir = WP_CONTENT_DIR . '/uploads'; + } elseif ( 0 !== strpos( $dir, ABSPATH ) ) { + // $dir is absolute, $upload_path is (maybe) relative to ABSPATH + $dir = path_join( ABSPATH, $dir ); + } + } + + if ( ! $url = get_option( 'upload_url_path' ) ) { + if ( empty( $upload_path ) + || ( 'wp-content/uploads' == $upload_path ) + || ( $upload_path == $dir ) ) + $url = WP_CONTENT_URL . '/uploads'; + else + $url = trailingslashit( $siteurl ) . $upload_path; + } + + if ( defined( 'UPLOADS' ) && ! $main_override + && ( ! isset( $switched ) || $switched === false ) ) { + $dir = ABSPATH . UPLOADS; + $url = trailingslashit( $siteurl ) . UPLOADS; + } + + if ( is_multisite() && ! $main_override + && ( ! isset( $switched ) || $switched === false ) ) { + + if ( defined( 'BLOGUPLOADDIR' ) ) + $dir = untrailingslashit( BLOGUPLOADDIR ); + + $url = str_replace( UPLOADS, 'files', $url ); + } + + $uploads = apply_filters( 'wpcf7_upload_dir', array( 'dir' => $dir, 'url' => $url ) ); + + if ( 'dir' == $type ) + return $uploads['dir']; + if ( 'url' == $type ) + return $uploads['url']; + + return $uploads; +} + +function wpcf7_l10n() { + $l10n = array( + 'af' => __( 'Afrikaans', 'wpcf7' ), + 'sq' => __( 'Albanian', 'wpcf7' ), + 'ar' => __( 'Arabic', 'wpcf7' ), + 'hy_AM' => __( 'Armenian', 'wpcf7' ), + 'bn_BD' => __( 'Bangla', 'wpcf7' ), + 'bs' => __( 'Bosnian', 'wpcf7' ), + 'pt_BR' => __( 'Brazilian Portuguese', 'wpcf7' ), + 'bg_BG' => __( 'Bulgarian', 'wpcf7' ), + 'ca' => __( 'Catalan', 'wpcf7' ), + 'zh_CN' => __( 'Chinese (Simplified)', 'wpcf7' ), + 'zh_TW' => __( 'Chinese (Traditional)', 'wpcf7' ), + 'hr' => __( 'Croatian', 'wpcf7' ), + 'cs_CZ' => __( 'Czech', 'wpcf7' ), + 'da_DK' => __( 'Danish', 'wpcf7' ), + 'nl_NL' => __( 'Dutch', 'wpcf7' ), + 'en_US' => __( 'English', 'wpcf7' ), + 'et' => __( 'Estonian', 'wpcf7' ), + 'fi' => __( 'Finnish', 'wpcf7' ), + 'fr_FR' => __( 'French', 'wpcf7' ), + 'gl_ES' => __( 'Galician', 'wpcf7' ), + 'ka_GE' => __( 'Georgian', 'wpcf7' ), + 'de_DE' => __( 'German', 'wpcf7' ), + 'el' => __( 'Greek', 'wpcf7' ), + 'he_IL' => __( 'Hebrew', 'wpcf7' ), + 'hi_IN' => __( 'Hindi', 'wpcf7' ), + 'hu_HU' => __( 'Hungarian', 'wpcf7' ), + 'id_ID' => __( 'Indonesian', 'wpcf7' ), + 'it_IT' => __( 'Italian', 'wpcf7' ), + 'ja' => __( 'Japanese', 'wpcf7' ), + 'ko_KR' => __( 'Korean', 'wpcf7' ), + 'lv' => __( 'Latvian', 'wpcf7' ), + 'lt_LT' => __( 'Lithuanian', 'wpcf7' ), + 'mk_MK' => __( 'Macedonian', 'wpcf7' ), + 'ms_MY' => __( 'Malay', 'wpcf7' ), + 'ml_IN' => __( 'Malayalam', 'wpcf7' ), + 'nb_NO' => __( 'Norwegian', 'wpcf7' ), + 'fa_IR' => __( 'Persian', 'wpcf7' ), + 'pl_PL' => __( 'Polish', 'wpcf7' ), + 'pt_PT' => __( 'Portuguese', 'wpcf7' ), + 'ru_RU' => __( 'Russian', 'wpcf7' ), + 'ro_RO' => __( 'Romanian', 'wpcf7' ), + 'sr_RS' => __( 'Serbian', 'wpcf7' ), + 'si_LK' => __( 'Sinhala', 'wpcf7' ), + 'sk' => __( 'Slovak', 'wpcf7' ), + 'sl_SI' => __( 'Slovene', 'wpcf7' ), + 'es_ES' => __( 'Spanish', 'wpcf7' ), + 'sv_SE' => __( 'Swedish', 'wpcf7' ), + 'ta' => __( 'Tamil', 'wpcf7' ), + 'th' => __( 'Thai', 'wpcf7' ), + 'tr_TR' => __( 'Turkish', 'wpcf7' ), + 'uk' => __( 'Ukrainian', 'wpcf7' ), + 'vi' => __( 'Vietnamese', 'wpcf7' ) + ); + + return $l10n; +} + +?> \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/includes/pipe.php b/src/wp-content/plugins/contact-form-7/includes/pipe.php new file mode 100644 index 00000000..bd88ed9e --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/pipe.php @@ -0,0 +1,67 @@ +before = $this->after = $text; + } else { + $this->before = substr( $text, 0, $pipe_pos ); + $this->after = substr( $text, $pipe_pos + 1 ); + } + } +} + +class WPCF7_Pipes { + + var $pipes = array(); + + function WPCF7_Pipes( $texts ) { + if ( ! is_array( $texts ) ) + return; + + foreach ( $texts as $text ) { + $this->add_pipe( $text ); + } + } + + function add_pipe( $text ) { + $pipe = new WPCF7_Pipe( $text ); + $this->pipes[] = $pipe; + } + + function do_pipe( $before ) { + foreach ( $this->pipes as $pipe ) { + if ( $pipe->before == $before ) + return $pipe->after; + } + return $before; + } + + function collect_befores() { + $befores = array(); + + foreach ( $this->pipes as $pipe ) { + $befores[] = $pipe->before; + } + + return $befores; + } + + function zero() { + return empty( $this->pipes ); + } + + function random_pipe() { + if ( $this->zero() ) + return null; + + return $this->pipes[array_rand( $this->pipes )]; + } +} + +?> \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/includes/shortcodes.php b/src/wp-content/plugins/contact-form-7/includes/shortcodes.php new file mode 100644 index 00000000..1dfab995 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/shortcodes.php @@ -0,0 +1,185 @@ +shortcode_tags[$tag] = array( + 'function' => $func, + 'has_name' => (boolean) $has_name ); + } + + function remove_shortcode( $tag ) { + unset( $this->shortcode_tags[$tag] ); + } + + function normalize_shortcode( $content ) { + if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags ) ) + return $content; + + $pattern = $this->get_shortcode_regex(); + return preg_replace_callback( '/' . $pattern . '/s', + array( &$this, 'normalize_space_cb' ), $content ); + } + + function normalize_space_cb( $m ) { + // allow [[foo]] syntax for escaping a tag + if ( $m[1] == '[' && $m[6] == ']' ) + return $m[0]; + + $tag = $m[2]; + $attr = trim( preg_replace( '/\s+/', ' ', $m[3] ) ); + $content = trim( $m[5] ); + + $result = $m[1] . '[' . $tag + . ( $attr ? ' ' . $attr : '' ) + . ( $m[4] ? ' ' . $m[4] : '' ) + . ']' + . ( $content ? $content . '[/' . $tag . ']' : '' ) + . $m[6]; + + return $result; + } + + function do_shortcode( $content, $exec = true ) { + $this->exec = (bool) $exec; + $this->scanned_tags = array(); + + if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags ) ) + return $content; + + $pattern = $this->get_shortcode_regex(); + return preg_replace_callback( '/' . $pattern . '/s', + array( &$this, 'do_shortcode_tag' ), $content ); + } + + function scan_shortcode( $content ) { + $this->do_shortcode( $content, false ); + return $this->scanned_tags; + } + + function get_shortcode_regex() { + $tagnames = array_keys( $this->shortcode_tags ); + $tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) ); + + return '(\[?)' + . '\[(' . $tagregexp . ')(?:\s(.*?))?(?:\s(\/))?\]' + . '(?:([^[]*?)\[\/\2\])?' + . '(\]?)'; + } + + function do_shortcode_tag( $m ) { + // allow [[foo]] syntax for escaping a tag + if ( $m[1] == '[' && $m[6] == ']' ) { + return substr( $m[0], 1, -1 ); + } + + $tag = $m[2]; + $attr = $this->shortcode_parse_atts( $m[3] ); + + $scanned_tag = array(); + $scanned_tag['type'] = $tag; + + if ( is_array( $attr ) ) { + if ( is_array( $attr['options'] ) ) { + if ( $this->shortcode_tags[$tag]['has_name'] && ! empty( $attr['options'] ) ) { + $scanned_tag['name'] = array_shift( $attr['options'] ); + + if ( ! wpcf7_is_name( $scanned_tag['name'] ) ) + return $m[0]; // Invalid name is used. Ignore this tag. + } + + $scanned_tag['options'] = (array) $attr['options']; + } + + $scanned_tag['raw_values'] = (array) $attr['values']; + + if ( WPCF7_USE_PIPE ) { + $pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] ); + $scanned_tag['values'] = $pipes->collect_befores(); + $scanned_tag['pipes'] = $pipes; + } else { + $scanned_tag['values'] = $scanned_tag['raw_values']; + } + + $scanned_tag['labels'] = $scanned_tag['values']; + + } else { + $scanned_tag['attr'] = $attr; + } + + $content = trim( $m[5] ); + $content = preg_replace( "/$/m", '', $content ); + $scanned_tag['content'] = $content; + + $scanned_tag = apply_filters( 'wpcf7_form_tag', $scanned_tag, $this->exec ); + + $this->scanned_tags[] = $scanned_tag; + + if ( $this->exec ) { + $func = $this->shortcode_tags[$tag]['function']; + return $m[1] . call_user_func( $func, $scanned_tag ) . $m[6]; + } else { + return $m[0]; + } + } + + function shortcode_parse_atts( $text ) { + $atts = array( 'options' => array(), 'values' => array() ); + $text = preg_replace( "/[\x{00a0}\x{200b}]+/u", " ", $text ); + $text = stripcslashes( trim( $text ) ); + + $pattern = '%^([-+*=0-9a-zA-Z:.!?#$&@_/|\%\s]*?)((?:\s*"[^"]*"|\s*\'[^\']*\')*)$%'; + + if ( preg_match( $pattern, $text, $match ) ) { + if ( ! empty( $match[1] ) ) { + $atts['options'] = preg_split( '/[\s]+/', trim( $match[1] ) ); + } + if ( ! empty( $match[2] ) ) { + preg_match_all( '/"[^"]*"|\'[^\']*\'/', $match[2], $matched_values ); + $atts['values'] = wpcf7_strip_quote_deep( $matched_values[0] ); + } + } else { + $atts = $text; + } + + return $atts; + } + +} + +$wpcf7_shortcode_manager = new WPCF7_ShortcodeManager(); + +function wpcf7_add_shortcode( $tag, $func, $has_name = false ) { + global $wpcf7_shortcode_manager; + + return $wpcf7_shortcode_manager->add_shortcode( $tag, $func, $has_name ); +} + +function wpcf7_remove_shortcode( $tag ) { + global $wpcf7_shortcode_manager; + + return $wpcf7_shortcode_manager->remove_shortcode( $tag ); +} + +function wpcf7_do_shortcode( $content ) { + global $wpcf7_shortcode_manager; + + return $wpcf7_shortcode_manager->do_shortcode( $content ); +} + +function wpcf7_get_shortcode_regex() { + global $wpcf7_shortcode_manager; + + return $wpcf7_shortcode_manager->get_shortcode_regex(); +} + +?> \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/includes/taggenerator.php b/src/wp-content/plugins/contact-form-7/includes/taggenerator.php new file mode 100644 index 00000000..beb41f8f --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/taggenerator.php @@ -0,0 +1,49 @@ + $title, + 'content' => $elm_id, + 'options' => $options ); + + if ( is_callable( $callback ) ) + add_action( 'wpcf7_admin_footer', $callback ); + + return true; +} + +function wpcf7_print_tag_generators() { + global $wpcf7_tag_generators; + + $output = array(); + + foreach ( (array) $wpcf7_tag_generators as $name => $tg ) { + $pane = " " . esc_js( $name ) . ": { "; + $pane .= "title: '" . esc_js( $tg['title'] ) . "'"; + $pane .= ", content: '" . esc_js( $tg['content'] ) . "'"; + + foreach ( (array) $tg['options'] as $option_name => $option_value ) { + if ( is_int( $option_value ) ) + $pane .= ", $option_name: $option_value"; + else + $pane .= ", $option_name: '" . esc_js( $option_value ) . "'"; + } + + $pane .= " }"; + + $output[] = $pane; + } + + echo implode( ",\n", $output ) . "\n"; +} + +?> \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7/jquery.form.js b/src/wp-content/plugins/contact-form-7/jquery.form.js new file mode 100644 index 00000000..fdcdd15a --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/jquery.form.js @@ -0,0 +1,911 @@ +/*! + * jQuery Form Plugin + * version: 2.84 (12-AUG-2011) + * @requires jQuery v1.3.2 or later + * + * Examples and documentation at: http://malsup.com/jquery/form/ + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +;(function($) { + +/* + Usage Note: + ----------- + Do not use both ajaxSubmit and ajaxForm on the same form. These + functions are intended to be exclusive. Use ajaxSubmit if you want + to bind your own submit handler to the form. For example, + + $(document).ready(function() { + $('#myForm').bind('submit', function(e) { + e.preventDefault(); // <-- important + $(this).ajaxSubmit({ + target: '#output' + }); + }); + }); + + Use ajaxForm when you want the plugin to manage all the event binding + for you. For example, + + $(document).ready(function() { + $('#myForm').ajaxForm({ + target: '#output' + }); + }); + + When using ajaxForm, the ajaxSubmit function will be invoked for you + at the appropriate time. +*/ + +/** + * ajaxSubmit() provides a mechanism for immediately submitting + * an HTML form using AJAX. + */ +$.fn.ajaxSubmit = function(options) { + // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) + if (!this.length) { + log('ajaxSubmit: skipping submit process - no element selected'); + return this; + } + + var method, action, url, $form = this; + + if (typeof options == 'function') { + options = { success: options }; + } + + method = this.attr('method'); + action = this.attr('action'); + url = (typeof action === 'string') ? $.trim(action) : ''; + url = url || window.location.href || ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: method || 'GET', + iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' + }, options); + + // hook for manipulating the form data before it is extracted; + // convenient for use with rich editors like tinyMCE or FCKEditor + var veto = {}; + this.trigger('form-pre-serialize', [this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); + return this; + } + + // provide opportunity to alter form data before it is serialized + if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSerialize callback'); + return this; + } + + var n,v,a = this.formToArray(options.semantic); + if (options.data) { + options.extraData = options.data; + for (n in options.data) { + if( $.isArray(options.data[n]) ) { + for (var k in options.data[n]) { + a.push( { name: n, value: options.data[n][k] } ); + } + } + else { + v = options.data[n]; + v = $.isFunction(v) ? v() : v; // if value is fn, invoke it + a.push( { name: n, value: v } ); + } + } + } + + // give pre-submit callback an opportunity to abort the submit + if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { + log('ajaxSubmit: submit aborted via beforeSubmit callback'); + return this; + } + + // fire vetoable 'validate' event + this.trigger('form-submit-validate', [a, this, options, veto]); + if (veto.veto) { + log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); + return this; + } + + var q = $.param(a); + + if (options.type.toUpperCase() == 'GET') { + options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; + options.data = null; // data is null for 'get' + } + else { + options.data = q; // data is the query string for 'post' + } + + var callbacks = []; + if (options.resetForm) { + callbacks.push(function() { $form.resetForm(); }); + } + if (options.clearForm) { + callbacks.push(function() { $form.clearForm(); }); + } + + // perform a load on the target only if dataType is not provided + if (!options.dataType && options.target) { + var oldSuccess = options.success || function(){}; + callbacks.push(function(data) { + var fn = options.replaceTarget ? 'replaceWith' : 'html'; + $(options.target)[fn](data).each(oldSuccess, arguments); + }); + } + else if (options.success) { + callbacks.push(options.success); + } + + options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg + var context = options.context || options; // jQuery 1.4+ supports scope context + for (var i=0, max=callbacks.length; i < max; i++) { + callbacks[i].apply(context, [data, status, xhr || $form, $form]); + } + }; + + // are there files to upload? + var fileInputs = $('input:file', this).length > 0; + var mp = 'multipart/form-data'; + var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); + + // options.iframe allows user to force iframe mode + // 06-NOV-09: now defaulting to iframe mode if file input is detected + if (options.iframe !== false && (fileInputs || options.iframe || multipart)) { + // hack to fix Safari hang (thanks to Tim Molendijk for this) + // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d + if (options.closeKeepAlive) { + $.get(options.closeKeepAlive, function() { fileUpload(a); }); + } + else { + fileUpload(a); + } + } + else { + // IE7 massage (see issue 57) + if ($.browser.msie && method == 'get') { + var ieMeth = $form[0].getAttribute('method'); + if (typeof ieMeth === 'string') + options.type = ieMeth; + } + $.ajax(options); + } + + // fire 'notify' event + this.trigger('form-submit-notify', [this, options]); + return this; + + + // private function for handling file uploads (hat tip to YAHOO!) + function fileUpload(a) { + var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; + var useProp = !!$.fn.prop; + + if (a) { + // ensure that every serialized input is still enabled + for (i=0; i < a.length; i++) { + el = $(form[a[i].name]); + el[ useProp ? 'prop' : 'attr' ]('disabled', false); + } + } + + if ($(':input[name=submit],:input[id=submit]', form).length) { + // if there is an input with a name or id of 'submit' then we won't be + // able to invoke the submit fn on the form (at least not x-browser) + alert('Error: Form elements must not have name or id of "submit".'); + return; + } + + s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + id = 'jqFormIO' + (new Date().getTime()); + if (s.iframeTarget) { + $io = $(s.iframeTarget); + n = $io.attr('name'); + if (n == null) + $io.attr('name', id); + else + id = n; + } + else { + $io = $('