diff --git a/información/LQDVI-mapa.jpg b/información/LQDVI-mapa.jpg new file mode 100644 index 00000000..17cf3a32 Binary files /dev/null and b/información/LQDVI-mapa.jpg differ diff --git a/información/guinea-1.JPG b/información/guinea-1.JPG new file mode 100644 index 00000000..8d1b54aa Binary files /dev/null and b/información/guinea-1.JPG differ diff --git a/información/guinea-2.JPG b/información/guinea-2.JPG new file mode 100644 index 00000000..632f982c Binary files /dev/null and b/información/guinea-2.JPG differ diff --git a/información/kliquers-1.JPG b/información/kliquers-1.JPG new file mode 100644 index 00000000..13b1f135 Binary files /dev/null and b/información/kliquers-1.JPG differ diff --git a/información/kliquers-2.JPG b/información/kliquers-2.JPG new file mode 100644 index 00000000..b20032b6 Binary files /dev/null and b/información/kliquers-2.JPG differ diff --git a/referencia/webcam/web-cam-capture-phpflash.zip b/referencia/webcam/web-cam-capture-phpflash.zip new file mode 100644 index 00000000..24d91495 Binary files /dev/null and b/referencia/webcam/web-cam-capture-phpflash.zip differ diff --git a/src/webcam/GUID.as b/src/webcam/GUID.as new file mode 100644 index 00000000..be350800 --- /dev/null +++ b/src/webcam/GUID.as @@ -0,0 +1 @@ +package { import flash.display.Sprite; import flash.system.Capabilities; public class GUID extends Sprite { private static var counter:Number = 0; function GUID(){ } public static function create():String { var dt:Date = new Date(); var id1:Number = dt.getTime(); var id2:Number = Math.random()*Number.MAX_VALUE; var id3:String = Capabilities.serverString; var rawID:String = calculate(id1+id3+id2+counter++).toUpperCase(); var finalString:String = rawID.substring(0, 8) + "-" + rawID.substring(8, 12) + "-" + rawID.substring(12, 16) + "-" + rawID.substring(16, 20) + "-" + rawID.substring(20, 32); return finalString; } private static function calculate(src:String):String { return hex_sha1(src); } private static function hex_sha1(src:String):String { return binb2hex(core_sha1(str2binb(src), src.length*8)); } private static function core_sha1(x:Array, len:Number):Array { x[len >> 5] |= 0x80 << (24-len%32); x[((len+64 >> 9) << 4)+15] = len; var w:Array = new Array(80), a:Number = 1732584193; var b:Number = -271733879, c:Number = -1732584194; var d:Number = 271733878, e:Number = -1009589776; for (var i:Number = 0; i> 16)+(y >> 16)+(lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } private static function rol(num:Number, cnt:Number):Number { return (num << cnt) | (num >>> (32-cnt)); } private static function str2binb(str:String):Array { var bin:Array = new Array(); var mask:Number = (1 << 8)-1; for (var i:Number = 0; i> 5] |= (str.charCodeAt(i/8) & mask) << (24-i%32); } return bin; } private static function binb2hex(binarray:Array):String { var str:String = new String(""); var tab:String = new String("0123456789abcdef"); for (var i:Number = 0; i> 2] >> ((3-i%4)*8+4)) & 0xF) + tab.charAt((binarray[i >> 2] >> ((3-i%4)*8)) & 0xF); } return str; } } } \ No newline at end of file diff --git a/src/webcam/ReadMe.pdf b/src/webcam/ReadMe.pdf new file mode 100644 index 00000000..ac20c260 Binary files /dev/null and b/src/webcam/ReadMe.pdf differ diff --git a/src/webcam/getwebcamdata.php b/src/webcam/getwebcamdata.php new file mode 100644 index 00000000..10d36a91 --- /dev/null +++ b/src/webcam/getwebcamdata.php @@ -0,0 +1,111 @@ +pixelData from swf + /// Image Save Path + /// Image Width + /// Image Height + if ((!is_null($height)) && (!is_null($width)) && + (!is_null($guid)) && (!is_null($pixels))) { + GetPixelAndSave($fileName, $pixels, $width, $height); + } else { + die ('ERROR'); + } + + +function GetPixelAndSave($fileName, $pixels, $width, $height) +{ + $pixelsLen = strlen($pixels); + $x = 0; + $y = 0; + + $im = imagecreatetruecolor($width, $height); + + for ($i = 0; $i < $pixelsLen / 6; $i++) { + $curPixelColor = substr($pixels, $i * 6, 6); + $rgb_arr = html2rgb ("#".$curPixelColor); + $color = imagecolorallocate( $im, $rgb_arr[0], $rgb_arr[1], $rgb_arr[2] ); + imagesetpixel( $im, $x, $y, $color ); + + if ($x == $width - 1) + { + $x = 0; + $y++; + } + else + { + $x++; + } + } + + // start buffering + ob_start(); + // output jpeg (or any other chosen) format & quality + imagejpeg($im, NULL, 85); + // capture output to string + $contents = ob_get_contents(); + // end capture + ob_end_clean(); + // free up memory + imagedestroy($im); + + $fh = fopen($fileName, "a+" ); + fwrite( $fh, $contents ); + fclose( $fh ); + + //$fh = fopen("images/cap-test.jpg", "w" ); + //fwrite( $fh, $contents ); + //fclose( $fh ); + +} + +function html2rgb($color) +{ + if ($color[0] == '#') + $color = substr($color, 1); + + if (strlen($color) == 6) + list($r, $g, $b) = array($color[0].$color[1], + $color[2].$color[3], + $color[4].$color[5]); + elseif (strlen($color) == 3) + list($r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]); + else + return false; + + $r = hexdec($r); $g = hexdec($g); $b = hexdec($b); + + return array($r, $g, $b); +} + +?> \ No newline at end of file diff --git a/src/webcam/webCamCapture.fla b/src/webcam/webCamCapture.fla new file mode 100644 index 00000000..b9e24b73 Binary files /dev/null and b/src/webcam/webCamCapture.fla differ diff --git a/src/webcam/webCamCapture.swf b/src/webcam/webCamCapture.swf new file mode 100644 index 00000000..2020f67e Binary files /dev/null and b/src/webcam/webCamCapture.swf differ diff --git a/src/wp-content/plugins/contact-form-7-modules/hidden.php b/src/wp-content/plugins/contact-form-7-modules/hidden.php new file mode 100644 index 00000000..714a68c4 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7-modules/hidden.php @@ -0,0 +1,183 @@ +

'; + if(file_exists(WP_PLUGIN_DIR.'/contact-form-7/wp-contact-form-7.php')) { + $out .= 'The Contact Form 7 is installed, but you must activate Contact Form 7 below for the Hidden Fields Module to work.'; + } else { + $out .= 'The Contact Form 7 plugin must be installed for the Hidden Fields Module to work. Install Now.'; + } + $out .= '

'; + echo $out; + } + } +} + +/** +** A base module for [hidden], [hidden*] +**/ + +/* Shortcode handler */ + +function wpcf7_hidden_shortcode_handler( $tag ) { + if ( ! is_array( $tag ) ) + return ''; + + $type = $tag['type']; + $name = $tag['name']; + $options = (array) $tag['options']; + $values = (array) $tag['values']; + + if ( empty( $name ) ) + return ''; + + $atts = ''; + $id_att = ''; + $class_att = ''; + $size_att = ''; + $maxlength_att = ''; + $tabindex_att = ''; + $title_att = ''; + + $class_att .= ' wpcf7-hidden'; + + if ( 'hidden*' == $type ) + $class_att .= ' wpcf7-validates-as-required'; + + foreach ( $options as $option ) { + if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) { + $id_att = $matches[1]; + + } elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) { + $class_att .= ' ' . $matches[1]; + } + } + + $value = (string) reset( $values ); + + if ( wpcf7_script_is() && $value && preg_grep( '%^watermark$%', $options ) ) { + $class_att .= ' wpcf7-use-title-as-watermark'; + $title_att .= sprintf( ' %s', $value ); + $value = ''; + } + + if ( wpcf7_is_posted() ) + $value = stripslashes_deep( $_POST[$name] ); + + if ( $id_att ) { + $id_att = trim( $id_att ); + $atts .= ' id="' . trim( $id_att ) . '"'; + } + if ( $class_att ) + $atts .= ' class="' . trim( $class_att ) . '"'; + + global $post; + if(is_object($post)) { + if (strtolower($value) == 'post_title' || strtolower($value) == 'post-title') { $value = $post->post_title; } + if (strtolower($value) == 'post_url') { $value = $post->guid; } + if (strtolower($value) == 'post_category') { + $categories = get_the_category();$catnames = array(); + foreach($categories as $cat) { $catnames[] = $cat->cat_name; } + if(is_array($catnames)) { $value = implode(', ', $catnames); } + } + if (strtolower($value) == 'post_author') { $value = $post->post_author; } + if (strtolower($value) == 'post_date') { $value = $post->post_date; } + if (preg_match('/^custom_field\-(.*?)$/ism', $value)) { + $custom_field = preg_replace('/custom_field\-(.*?)/ism', '$1', $value); + $value = get_post_meta($post->ID, $custom_field, true) ? get_post_meta($post->ID, $custom_field, true) : ''; + } + } + + $value = apply_filters('wpcf7_hidden_field_value', apply_filters('wpcf7_hidden_field_value_'.$id_att, $value)); + + $html = ''; + + return $html; +} + + +/* Tag generator */ + +add_action( 'admin_init', 'wpcf7_add_tag_generator_hidden', 30 ); + +function wpcf7_add_tag_generator_hidden() { + if(function_exists('wpcf7_add_tag_generator')) { + wpcf7_add_tag_generator( 'hidden', __( 'Hidden field', 'wpcf7' ), + 'wpcf7-tg-pane-hidden', 'wpcf7_tg_pane_hidden' ); + } +} + +function wpcf7_tg_pane_hidden() { +?> + + \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7-modules/readme.txt b/src/wp-content/plugins/contact-form-7-modules/readme.txt new file mode 100644 index 00000000..5fedc715 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7-modules/readme.txt @@ -0,0 +1,75 @@ +=== Contact Form 7 Modules === +Tags: form, forms, contact form 7, contactform7, contact form, hidden fields, hidden, cf7, cforms ii, cforms, Contact Forms 7, Contact Forms, contacted, contacts +Requires at least: 2.8 +Tested up to: 3.1 +Stable tag: trunk +Contributors: katzwebdesign +Donate link:https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=zackkatz%40gmail%2ecom&item_name=Contact%20Form%207%20Modules&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8 + +Contact Form 7 - Add modules such as hidden fields to the Contact Form 7 plugin for more informative form contacts + +== Description == + +### Add Hidden Fields to Contact Form 7 + +The Contact Form 7 plugin has over 2.8 million downloads, yet the great plugin still lacks a simple feature: hidden fields. This plugin adds hidden fields to Contact Form 7 once and for all. + +#### Inserting dynamic values + +You can also choose to have the value of the hidden field dynamically populated in your form when you are contacted. To do so, choose the "Default value" to be: + +* `post_title` - Inserts the title of the post/page +* `post_category` - The categories of the post or page +* `post_url` - The URL of the post or page +* `post_author` - The author of the post or page +* `custom_field-[Name]` - The value of a post or page's custom field. If you had a custom field "Foo", you would use the following as the hidden field value: `custom_field-Foo` + +You can also use a filter: hook into the `wpcf7_hidden_field_value` filter to modify the value of the hidden field using add_filter(). If you know the ID of the input, you can also use the `wpcf7_hidden_field_value_[#ID]` filter. + +Now, when someone contacts you using your Contact Form 7 contact form, you can have lots more information about their visit - and you'll see it when you receive the email that tells you you've been contacted. + +

Visit the official Contact Form 7 Modules plugin page for more support & additional information

+ +== Installation == + +1. Upload plugin files to your plugins folder, or install using WordPress' built-in Add New Plugin installer +1. Activate the plugin +1. Edit a form in Contact Form 7 +1. Choose "Hidden field" from the Generate Tag dropdown +1. Follow the instructions on the page + +== Screenshots == + +1. The new Hidden fields tag generator + +== Frequently Asked Questions == + += What is the plugin license? = + +* This plugin is released under a GPL license. + +== Changelog == + += 1.1.1 = +* Fixed `Parameter 1 to wpcf7_add_tag_generator_hidden() expected to be a reference, value given` error, as reported by BDN Online + += 1.1 = +* Added support for using post titles as hidden fields +* Added support for using custom field values as hidden fields +* Added `wpcf7_hidden_field_value` filter to hook into using add_filter() + += 1.0 = +* Initial plugin release. + +== Upgrade Notice == + += 1.1.1 = +* Fixed `Parameter 1 to wpcf7_add_tag_generator_hidden() expected to be a reference, value given` error, as reported by BDN Online + += 1.1 = +* Added support for using post titles as hidden fields +* Added support for using custom field values as hidden fields +* Added `wpcf7_hidden_field_value` filter to hook into using add_filter() + += 1.0 = +* Woot! \ No newline at end of file diff --git a/src/wp-content/plugins/contact-form-7-modules/screenshot-1.jpg b/src/wp-content/plugins/contact-form-7-modules/screenshot-1.jpg new file mode 100644 index 00000000..58cf2fae Binary files /dev/null and b/src/wp-content/plugins/contact-form-7-modules/screenshot-1.jpg differ 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..e4596dd2 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/admin.php @@ -0,0 +1,370 @@ +initial = true; + } + + $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 = $contact_form->messages; + 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'] ); + + $query = array(); + $query['message'] = ( $contact_form->initial ) ? 'created' : 'saved'; + + $contact_form->title = $title; + $contact_form->form = $form; + $contact_form->mail = $mail; + $contact_form->mail_2 = $mail_2; + $contact_form->messages = $messages; + $contact_form->additional_settings = $additional_settings; + + $contact_form->save(); + + $query['contactform'] = $contact_form->id; + $redirect_to = wpcf7_admin_url( $query ); + wp_redirect( $redirect_to ); + exit(); + } elseif ( isset( $_POST['wpcf7-copy'] ) && wpcf7_admin_has_edit_cap() ) { + $id = $_POST['wpcf7-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(); + } elseif ( isset( $_POST['wpcf7-delete'] ) && wpcf7_admin_has_edit_cap() ) { + $id = $_POST['wpcf7-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(); + } elseif ( isset( $_GET['wpcf7-create-table'] ) ) { + check_admin_referer( 'wpcf7-create-table' ); + + $query = array(); + + if ( ! wpcf7_table_exists() && current_user_can( 'activate_plugins' ) ) { + wpcf7_install(); + if ( wpcf7_table_exists() ) { + $query['message'] = 'table_created'; + } else { + $query['message'] = 'table_not_created'; + } + } + + wp_redirect( wpcf7_admin_url( $query ) ); + exit(); + } + + 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( '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' ), + 'show' => __( "Show", 'wpcf7' ), + 'hide' => __( "Hide", 'wpcf7' ) ) ); +} + +add_action( 'admin_footer', 'wpcf7_admin_footer' ); + +function wpcf7_admin_footer() { + global $plugin_page; + + if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page ) + return; + +?> + +id; + $cf = wpcf7_contact_form( $current ); + } + + require_once WPCF7_PLUGIN_DIR . '/admin/edit.php'; +} + +/* Install and default settings */ + +add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' ); + +function wpcf7_install() { + global $wpdb, $wpcf7; + + if ( wpcf7_table_exists() ) + return; // Exists already + + $charset_collate = ''; + if ( $wpdb->has_cap( 'collation' ) ) { + if ( ! empty( $wpdb->charset ) ) + $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; + if ( ! empty( $wpdb->collate ) ) + $charset_collate .= " COLLATE $wpdb->collate"; + } + + $wpdb->query( "CREATE TABLE IF NOT EXISTS $wpcf7->contactforms ( + cf7_unit_id bigint(20) unsigned NOT NULL auto_increment, + title varchar(200) NOT NULL default '', + form text NOT NULL, + mail text NOT NULL, + mail_2 text NOT NULL, + messages text NOT NULL, + additional_settings text NOT NULL, + PRIMARY KEY (cf7_unit_id)) $charset_collate;" ); + + if ( ! wpcf7_table_exists() ) + return false; // Failed to create + + $legacy_data = get_option( 'wpcf7' ); + if ( is_array( $legacy_data ) + && is_array( $legacy_data['contact_forms'] ) && $legacy_data['contact_forms'] ) { + foreach ( $legacy_data['contact_forms'] as $key => $value ) { + $wpdb->insert( $wpcf7->contactforms, array( + 'cf7_unit_id' => $key, + 'title' => $value['title'], + 'form' => maybe_serialize( $value['form'] ), + 'mail' => maybe_serialize( $value['mail'] ), + 'mail_2' => maybe_serialize( $value['mail_2'] ), + 'messages' => maybe_serialize( $value['messages'] ), + 'additional_settings' => maybe_serialize( $value['additional_settings'] ) + ), array( '%d', '%s', '%s', '%s', '%s', '%s', '%s' ) ); + } + } else { + wpcf7_load_plugin_textdomain(); + + $wpdb->insert( $wpcf7->contactforms, array( + 'title' => __( 'Contact form', 'wpcf7' ) . ' 1', + 'form' => maybe_serialize( wpcf7_default_form_template() ), + 'mail' => maybe_serialize( wpcf7_default_mail_template() ), + 'mail_2' => maybe_serialize ( wpcf7_default_mail_2_template() ), + 'messages' => maybe_serialize( wpcf7_default_messages_template() ) ) ); + } +} + +/* 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; + case 'table_created': + $updated_message = __( "Database table created.", 'wpcf7' ); + break; + case 'table_not_created': + $updated_message = __( "Failed to create database table.", '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..2877fcc5 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/edit.php @@ -0,0 +1,351 @@ + 1 ) ); + $create_table_link_url = wp_nonce_url( $create_table_link_url, 'wpcf7-create-table' ); + $message = sprintf( + __( 'The database table for Contact Form 7 does not exist. You must create the table for it to work.', 'wpcf7' ), + $create_table_link_url ); + } else { + $message = __( "The database table for Contact Form 7 does not exist.", 'wpcf7' ); + } +?> +
+ +

+
+

+
+
+
+ + + +

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

+
+ + +

+ + + +
+ +
+ + + + + +
+
+ + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + + + + + + + + + + + + +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ mail['use_html'] ) ? ' checked="checked"' : ''; ?> /> + +
+ +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + +
+ mail_2['active'] ) ? ' checked="checked"' : ''; ?> /> + +
+ +
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+ +
+ mail_2['use_html'] ) ? ' checked="checked"' : ''; ?> /> + +
+ +
+ +
+
+ +
+ +
+ + + + + + + + + + + + + + + +
+
+ + $arr ) : + $field_name = 'wpcf7-message-' . strtr( $key, '_', '-' ); +?> +
+
+ +
+ + + +
+
+ + + + + + + + + + + + + + + +
+
+ +
+
+ + + + + + + + + + + + + +
+
+ +
+
+ + + +
+ + + +
+ + + + 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..dee427f5 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/scripts.js @@ -0,0 +1,116 @@ +(function($) { + + $(function() { + try { + $.extend($.tgPanes, _wpcf7.tagGenerators); + $('#taggenerator').tagGenerator(_wpcf7L10n.generateTag, + { dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' }); + + $('input#wpcf7-title:enabled').css({ + cursor: 'pointer' + }); + + $('input#wpcf7-title').mouseover(function() { + $(this).not('.focus').css({ + 'background-color': '#ffffdd' + }); + }); + + $('input#wpcf7-title').mouseout(function() { + $(this).css({ + 'background-color': '#fff' + }); + }); + + $('input#wpcf7-title').focus(function() { + $(this).addClass('focus'); + $(this).css({ + cursor: 'text', + color: '#333', + border: '1px solid #777', + font: 'normal 13px Verdana, Arial, Helvetica, sans-serif', + 'background-color': '#fff' + }); + }); + + $('input#wpcf7-title').blur(function() { + $(this).removeClass('focus'); + $(this).css({ + cursor: 'pointer', + color: '#555', + border: 'none', + font: 'bold 20px serif', + 'background-color': '#fff' + }); + }); + + $('input#wpcf7-title').change(function() { + updateTag(); + }); + + updateTag(); + + if ($.support.objectAll) { + if (! $('#wpcf7-mail-2-active').is(':checked')) + $('#mail-2-fields').hide(); + + $('#wpcf7-mail-2-active').click(function() { + if ($('#mail-2-fields').is(':hidden') + && $('#wpcf7-mail-2-active').is(':checked')) { + $('#mail-2-fields').slideDown('fast'); + } else if ($('#mail-2-fields').is(':visible') + && $('#wpcf7-mail-2-active').not(':checked')) { + $('#mail-2-fields').slideUp('fast'); + } + }); + } + + $('#message-fields-toggle-switch').text(_wpcf7L10n.show); + $('#message-fields').hide(); + + $('#message-fields-toggle-switch').click(function() { + if ($('#message-fields').is(':hidden')) { + $('#message-fields').slideDown('fast'); + $('#message-fields-toggle-switch').text(_wpcf7L10n.hide); + } else { + $('#message-fields').hide('fast'); + $('#message-fields-toggle-switch').text(_wpcf7L10n.show); + } + }); + + if ('' == $.trim($('#wpcf7-additional-settings').text())) { + $('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show); + $('#additional-settings-fields').hide(); + } else { + $('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide); + $('#additional-settings-fields').show(); + } + + $('#additional-settings-fields-toggle-switch').click(function() { + if ($('#additional-settings-fields').is(':hidden')) { + $('#additional-settings-fields').slideDown('fast'); + $('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.hide); + } else { + $('#additional-settings-fields').hide('fast'); + $('#additional-settings-fields-toggle-switch').text(_wpcf7L10n.show); + } + }); + + } catch (e) { + } + }); + + function updateTag() { + var title = $('input#wpcf7-title').val(); + + if (title) + title = title.replace(/["'\[\]]/g, ''); + + $('input#wpcf7-title').val(title); + var current = $('input#wpcf7-id').val(); + var tag = '[contact-form ' + current + ' "' + title + '"]'; + + $('input#contact-form-anchor-text').val(tag); + } + +})(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..831d02b9 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/styles-rtl.css @@ -0,0 +1,22 @@ +ul.subsubsub li.addnew { + margin-left: 0; + margin-right: 0.5em; +} +div.save-contact-form { + direction: rtl; +} +div.actions-link { + right: auto; + left: 0; +} +span#message-fields-toggle-switch { + margin-left: 0; + margin-right: 1em; +} +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..958de7c9 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/admin/styles.css @@ -0,0 +1,248 @@ +div.wpcf7 div.cf7com-links { + text-align: right; + font-size: .8em; + margin-top: -1.6em; +} + +div.wpcf7 div.cf7com-links a { + text-decoration: none; +} + +div.wpcf7 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.wpcf7 div.donation p { + margin: .7em 0; + line-height: 1; + padding: 2px; + font-size: 107%; +} + +div.wpcf7 div.donation p a { + font-weight: bold; + color: #3f3f3f; +} + +div.wpcf7 div.donation p a.button { + margin-left: 1em; +} + +div.wpcf7 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:hover, +ul.subsubsub li.addnew a:active { + color: #999; +} + +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: 0; +} + +div.actions-link input { + padding: 0; + margin: 0; + border: none; + background-color: #fff; + font-size: 11px; + cursor: pointer; +} + +div.actions-link input.copy { + color: #006505; +} + +div.actions-link input.delete { + color: #bc0b0b; +} + +input#wpcf7-title { + color: #555; + background-color: #fff; + border: none; + font: bold 20px serif; +} + +p.tagcode { + color: #333; + margin: 2ex 0 1ex 1em; +} + +input#contact-form-anchor-text { + color: #fff; + background: #7e4e0b; + border: none; + width: 99%; + -moz-border-radius: 6px; + -khtml-border-radius: 6px; + -webkit-border-radius: 6px; + border-radius: 6px; +} + +span#message-fields-toggle-switch, span#additional-settings-fields-toggle-switch { + margin-left: 1em; + font-weight: normal; + font-size: smaller; + color: #2583ad; + cursor: pointer; +} + +div.pseudo-hr { + border-bottom: 1px solid #fff; + margin: 0.7em 0; +} + +input, textarea { + border: 1px solid #dfdfdf; +} + +input.wide { + width: 100%; +} + +textarea { + width: 100%; +} + +label.disabled { + color: #777; +} + +div.message-field { + margin: .2em 0 .4em; +} + +div.tag-generator { + position: relative; + background: #fff; + padding: 5px 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; +} + +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; +} + +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..f372b24e --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/classes.php @@ -0,0 +1,645 @@ +unit_tag == $_POST['_wpcf7_unit_tag'] ) + return true; + + return false; + } + + function clear_post() { + $fes = $this->form_scan_shortcode(); + + foreach ( $fes as $fe ) { + $name = $fe['name']; + + if ( empty( $name ) ) + continue; + + 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; + } + + /* Acceptance */ + + function accepted() { + $accepted = true; + + return apply_filters( 'wpcf7_acceptance', $accepted ); + } + + /* Akismet */ + + function akismet() { + global $akismet_api_host, $akismet_api_port; + + if ( ! function_exists( 'akismet_http_post' ) || + ! ( get_option( 'wordpress_api_key' ) || $wpcom_api_key ) ) + return false; + + $akismet_ready = false; + $author = $author_email = $author_url = $content = ''; + $fes = $this->form_scan_shortcode(); + + foreach ( $fes as $fe ) { + if ( ! is_array( $fe['options'] ) ) continue; + + if ( preg_grep( '%^akismet:author$%', $fe['options'] ) && '' == $author ) { + $author = $_POST[$fe['name']]; + $akismet_ready = true; + } + + if ( preg_grep( '%^akismet:author_email$%', $fe['options'] ) && '' == $author_email ) { + $author_email = $_POST[$fe['name']]; + $akismet_ready = true; + } + + if ( preg_grep( '%^akismet:author_url$%', $fe['options'] ) && '' == $author_url ) { + $author_url = $_POST[$fe['name']]; + $akismet_ready = true; + } + + if ( '' != $content ) + $content .= "\n\n"; + + $content .= $_POST[$fe['name']]; + } + + if ( ! $akismet_ready ) + return false; + + $c['blog'] = get_option( 'home' ); + $c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] ); + $c['user_agent'] = $_SERVER['HTTP_USER_AGENT']; + $c['referrer'] = $_SERVER['HTTP_REFERER']; + $c['comment_type'] = 'contactform7'; + if ( $permalink = get_permalink() ) + $c['permalink'] = $permalink; + if ( '' != $author ) + $c['comment_author'] = $author; + if ( '' != $author_email ) + $c['comment_author_email'] = $author_email; + if ( '' != $author_url ) + $c['comment_author_url'] = $author_url; + if ( '' != $content ) + $c['comment_content'] = $content; + + $ignore = array( 'HTTP_COOKIE' ); + + foreach ( $_SERVER as $key => $value ) + if ( ! in_array( $key, (array) $ignore ) ) + $c["$key"] = $value; + + $query_string = ''; + foreach ( $c as $key => $data ) + $query_string .= $key . '=' . urlencode( stripslashes( (string) $data ) ) . '&'; + + $response = akismet_http_post( $query_string, $akismet_api_host, + '/1.1/comment-check', $akismet_api_port ); + if ( 'true' == $response[1] ) + return true; + else + return false; + } + + /* 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 ) ) { + if ( $this->mail_2['active'] ) + $this->compose_and_send_mail( $this->mail_2 ); + + 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']; + + if ( $use_html ) + $callback = array( &$this, 'mail_callback_html' ); + else + $callback = array( &$this, 'mail_callback' ); + + $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'] ); + $body = preg_replace_callback( $regex, $callback, $mail_template['body'] ); + + if ( $use_html ) + $body = wpautop( $body ); + + extract( apply_filters( 'wpcf7_mail_components', + compact( 'subject', 'sender', 'body', 'recipient', 'additional_headers' ) ) ); + + $headers = "From: $sender\n"; + + if ( $use_html ) + $headers .= "Content-Type: text/html\n"; + + $headers .= trim( $additional_headers ) . "\n"; + + if ( $this->uploaded_files ) { + $for_this_mail = array(); + foreach ( $this->uploaded_files as $name => $path ) { + if ( false === strpos( $mail_template['attachments'], "[${name}]" ) ) + continue; + $for_this_mail[] = $path; + } + + return @wp_mail( $recipient, $subject, $body, $headers, $for_this_mail ); + } else { + return @wp_mail( $recipient, $subject, $body, $headers ); + } + } + + 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 = $messages[$status]; + + return apply_filters( 'wpcf7_display_message', $message ); + } + + /* 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() { + global $wpdb, $wpcf7; + + $fields = array( + 'title' => maybe_serialize( stripslashes_deep( $this->title ) ), + 'form' => maybe_serialize( stripslashes_deep( $this->form ) ), + 'mail' => maybe_serialize( stripslashes_deep( $this->mail ) ), + 'mail_2' => maybe_serialize ( stripslashes_deep( $this->mail_2 ) ), + 'messages' => maybe_serialize( stripslashes_deep( $this->messages ) ), + 'additional_settings' => + maybe_serialize( stripslashes_deep( $this->additional_settings ) ) ); + + if ( $this->initial ) { + $result = $wpdb->insert( $wpcf7->contactforms, $fields ); + + if ( $result ) { + $this->initial = false; + $this->id = $wpdb->insert_id; + + do_action_ref_array( 'wpcf7_after_create', array( &$this ) ); + } else { + return false; // Failed to save + } + + } else { // Update + if ( ! (int) $this->id ) + return false; // Missing ID + + $result = $wpdb->update( $wpcf7->contactforms, $fields, + array( 'cf7_unit_id' => absint( $this->id ) ) ); + + if ( false !== $result ) { + do_action_ref_array( 'wpcf7_after_update', array( &$this ) ); + } else { + return false; // Failed to save + } + } + + do_action_ref_array( 'wpcf7_after_save', array( &$this ) ); + return true; // Succeeded to save + } + + 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; + + return $new; + } + + function delete() { + global $wpdb, $wpcf7; + + if ( $this->initial ) + return; + + $query = $wpdb->prepare( + "DELETE FROM $wpcf7->contactforms WHERE cf7_unit_id = %d LIMIT 1", + absint( $this->id ) ); + + $wpdb->query( $query ); + + $this->initial = true; + $this->id = null; + } +} + +function wpcf7_contact_form( $id ) { + global $wpdb, $wpcf7; + + $query = $wpdb->prepare( "SELECT * FROM $wpcf7->contactforms WHERE cf7_unit_id = %d", $id ); + + if ( ! $row = $wpdb->get_row( $query ) ) + return false; // No data + + $contact_form = new WPCF7_ContactForm(); + $contact_form->id = $row->cf7_unit_id; + $contact_form->title = maybe_unserialize( $row->title ); + $contact_form->form = maybe_unserialize( $row->form ); + $contact_form->mail = maybe_unserialize( $row->mail ); + $contact_form->mail_2 = maybe_unserialize( $row->mail_2 ); + $contact_form->messages = maybe_unserialize( $row->messages ); + $contact_form->additional_settings = maybe_unserialize( $row->additional_settings ); + + $contact_form->upgrade(); + + return $contact_form; +} + +function wpcf7_contact_form_default_pack( $locale = null ) { + global $l10n; + + 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 = __( 'Untitled', 'wpcf7' ); + $contact_form->form = wpcf7_default_form_template(); + $contact_form->mail = wpcf7_default_mail_template(); + $contact_form->mail_2 = wpcf7_default_mail_2_template(); + $contact_form->messages = wpcf7_default_messages_template(); + + if ( isset( $mo_orig ) ) + $l10n['wpcf7'] = $mo_orig; + + 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..b18e607a --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/controller.php @@ -0,0 +1,288 @@ +validate(); + + $items = array( + 'mailSent' => false, + 'into' => '#' . $unit_tag, + 'captcha' => null ); + + $items = apply_filters( 'wpcf7_ajax_json_echo', $items ); + + if ( ! $validation['valid'] ) { // Validation error occured + $invalids = array(); + foreach ( $validation['reason'] as $name => $reason ) { + $invalids[] = array( + 'into' => 'span.wpcf7-form-control-wrap.' . $name, + 'message' => $reason ); + } + + $items['message'] = wpcf7_get_message( 'validation_error' ); + $items['invalids'] = $invalids; + + } elseif ( ! $wpcf7_contact_form->accepted() ) { // Not accepted terms + $items['message'] = wpcf7_get_message( 'accept_terms' ); + + } elseif ( $wpcf7_contact_form->akismet() ) { // Spam! + $items['message'] = wpcf7_get_message( 'akismet_says_spam' ); + $items['spam'] = true; + + } elseif ( $wpcf7_contact_form->mail() ) { + $items['mailSent'] = true; + $items['message'] = wpcf7_get_message( 'mail_sent_ok' ); + + $on_sent_ok = $wpcf7_contact_form->additional_setting( 'on_sent_ok', false ); + if ( ! empty( $on_sent_ok ) ) { + $on_sent_ok = array_map( 'wpcf7_strip_quote', $on_sent_ok ); + } else { + $on_sent_ok = null; + } + $items['onSentOk'] = $on_sent_ok; + + do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) ); + + } else { + $items['message'] = wpcf7_get_message( 'mail_sent_ng' ); + } + + // remove upload files + foreach ( (array) $wpcf7_contact_form->uploaded_files as $name => $path ) { + @unlink( $path ); + } + + $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 ''; + } +} + +function wpcf7_process_nonajax_submitting() { + global $wpcf7_contact_form; + + if ( ! isset($_POST['_wpcf7'] ) ) + return; + + $id = (int) $_POST['_wpcf7']; + + if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) { + $validation = $wpcf7_contact_form->validate(); + + if ( ! $validation['valid'] ) { + $_POST['_wpcf7_validation_errors'] = array( 'id' => $id, 'messages' => $validation['reason'] ); + } elseif ( ! $wpcf7_contact_form->accepted() ) { // Not accepted terms + $_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'accept_terms' ) ); + } elseif ( $wpcf7_contact_form->akismet() ) { // Spam! + $_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'akismet_says_spam' ), 'spam' => true ); + } elseif ( $wpcf7_contact_form->mail() ) { + $_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => true, 'message' => wpcf7_get_message( 'mail_sent_ok' ) ); + + do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) ); + + $wpcf7_contact_form->clear_post(); + } else { + $_POST['_wpcf7_mail_sent'] = array( 'id' => $id, 'ok' => false, 'message' => wpcf7_get_message( 'mail_sent_ng' ) ); + } + + // remove upload files + foreach ( (array) $wpcf7_contact_form->uploaded_files as $name => $path ) { + @unlink( $path ); + } + + $wpcf7_contact_form = null; + } +} + +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; + + $wpcf7->widget_count += 1; + $wpcf7->processing_within = 'w' . $wpcf7->widget_count; + $wpcf7->unit_count = 0; + + $regex = '/\[\s*contact-form\s+(\d+(?:\s+.*)?)\]/'; + $content = preg_replace_callback( $regex, 'wpcf7_widget_text_filter_callback', $content ); + + $wpcf7->processing_within = ''; + return $content; +} + +function wpcf7_widget_text_filter_callback( $matches ) { + return do_shortcode( $matches[0] ); +} + +add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' ); + +function wpcf7_contact_form_tag_func( $atts ) { + global $wpcf7, $wpcf7_contact_form; + + if ( is_feed() ) + return '[contact-form]'; + + if ( is_string( $atts ) ) + $atts = explode( ' ', $atts, 2 ); + + $atts = (array) $atts; + + $id = (int) array_shift( $atts ); + + if ( ! ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) ) + return '[contact-form 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' . $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..8584d5c1 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/formatting.php @@ -0,0 +1,144 @@ +\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_sanitize_file_name( $filename ) { + /* Memo: + // This function does sanitization introduced in http://core.trac.wordpress.org/ticket/11122 + // WordPress 2.8.6 will implement it in sanitize_file_name(). + // While Contact Form 7's file uploading function uses wp_unique_filename(), and + // it in turn calls sanitize_file_name(). Therefore this wpcf7_sanitize_file_name() will be + // redundant and unnecessary when you use Contact Form 7 on WordPress 2.8.6 or higher. + // This function is provided just for the sake of protecting who uses older WordPress. + */ + + // Split the filename into a base and extension[s] + $parts = explode( '.', $filename ); + + // Return if only one extension + if ( count( $parts ) <= 2 ) + return $filename; + + // Process multiple extensions + $filename = array_shift( $parts ); + $extension = array_pop( $parts ); + + $mimes = array( 'jpg|jpeg|jpe', 'gif', 'png', 'bmp', + 'tif|tiff', 'ico', 'asf|asx|wax|wmv|wmx', 'avi', + 'divx', 'mov|qt', 'mpeg|mpg|mpe', 'txt|c|cc|h', + 'rtx', 'css', 'htm|html', 'mp3|m4a', 'mp4|m4v', + 'ra|ram', 'wav', 'ogg', 'mid|midi', 'wma', 'rtf', + 'js', 'pdf', 'doc|docx', 'pot|pps|ppt|pptx', 'wri', + 'xla|xls|xlsx|xlt|xlw', 'mdb', 'mpp', 'swf', 'class', + 'tar', 'zip', 'gz|gzip', 'exe', + // openoffice formats + 'odt', 'odp', 'ods', 'odg', 'odc', 'odb', 'odf' ); + + // Loop over any intermediate extensions. + // Munge them with a trailing underscore if they are a 2 - 5 character + // long alpha string not in the extension whitelist. + foreach ( (array) $parts as $part) { + $filename .= '.' . $part; + + if ( preg_match( '/^[a-zA-Z]{2,5}\d?$/', $part ) ) { + $allowed = false; + foreach ( $mimes as $ext_preg ) { + $ext_preg = '!(^' . $ext_preg . ')$!i'; + if ( preg_match( $ext_preg, $part ) ) { + $allowed = true; + break; + } + } + if ( ! $allowed ) + $filename .= '_'; + } + } + $filename .= '.' . $extension; + + return $filename; +} + +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..604c04b2 --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/includes/functions.php @@ -0,0 +1,226 @@ + 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 administrator by other way.', 'wpcf7' ) + ), + + 'akismet_says_spam' => array( + 'description' => __( "Akismet judged the sending activity as spamming", 'wpcf7' ), + 'default' => __( 'Failed to send your message. Please try later or contact administrator by other way.', '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_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_is_multisite() { // will be removed when WordPress 2.9 is not supported + if ( function_exists( 'is_multisite' ) ) + return is_multisite(); + + return false; +} + +function wpcf7_is_main_site() { // will be removed when WordPress 2.9 is not supported + if ( function_exists( 'is_main_site' ) ) + return is_main_site(); + + return false; +} + +function wpcf7_upload_dir( $type = false ) { + global $switched; + + $siteurl = get_option( 'siteurl' ); + $upload_path = trim( get_option( 'upload_path' ) ); + + $main_override = wpcf7_is_multisite() && defined( 'MULTISITE' ) && wpcf7_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 ( wpcf7_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..d4692f60 --- /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(\/))?\]' + . '(?:((?!.*?\[(?:' . $tagregexp . ')\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..2be0471c --- /dev/null +++ b/src/wp-content/plugins/contact-form-7/jquery.form.js @@ -0,0 +1,825 @@ +/*! + * jQuery Form Plugin + * version: 2.72 (28-APR-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; + } + + if (typeof options == 'function') { + options = { success: options }; + } + + var action = this.attr('action'); + var url = (typeof action === 'string') ? $.trim(action) : ''; + if (url) { + // clean url (don't include hash vaue) + url = (url.match(/^([^#]+)/)||[])[1]; + } + url = url || window.location.href || ''; + + options = $.extend(true, { + url: url, + success: $.ajaxSettings.success, + type: this[0].getAttribute('method') || 'GET', // IE7 massage (see issue 57) + 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(options.data[n] instanceof Array) { + 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 $form = this, 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, fileUpload); + } + else { + fileUpload(); + } + } + else { + $.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() { + var form = $form[0]; + + 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; + } + + var s = $.extend(true, {}, $.ajaxSettings, options); + s.context = s.context || s; + var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id; + var $io = $('