Cambios + webcam

git-svn-id: https://192.168.0.254/svn/Proyectos.FundacionLQDVI_Web/trunk@5 77ab8c26-3d69-2c4d-86f2-786f4ba54905
This commit is contained in:
David Arranz 2011-06-07 20:43:12 +00:00
parent 28551557f8
commit eeec5f5b48
197 changed files with 19717 additions and 495 deletions

BIN
información/LQDVI-mapa.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
información/guinea-1.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
información/guinea-2.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
información/kliquers-1.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

BIN
información/kliquers-2.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

1
src/webcam/GUID.as Normal file
View File

@ -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<x.length; i += 16) { var olda:Number = a, oldb:Number = b; var oldc:Number = c, oldd:Number = d, olde:Number = e; for (var j:Number = 0; j<80; j++) { if (j<16) w[j] = x[i+j]; else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1); var t:Number = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)), safe_add(safe_add(e, w[j]), sha1_kt(j))); e = d; d = c; c = rol(b, 30); b = a; a = t; } a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); e = safe_add(e, olde); } return new Array(a, b, c, d, e); } private static function sha1_ft(t:Number, b:Number, c:Number, d:Number):Number { if (t<20) return (b & c) | ((~b) & d); if (t<40) return b ^ c ^ d; if (t<60) return (b & c) | (b & d) | (c & d); return b ^ c ^ d; } private static function sha1_kt(t:Number):Number { return (t<20) ? 1518500249 : (t<40) ? 1859775393 : (t<60) ? -1894007588 : -899497514; } private static function safe_add(x:Number, y:Number):Number { var lsw:Number = (x & 0xFFFF)+(y & 0xFFFF); var msw:Number = (x >> 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<str.length*8; i += 8) { bin[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<binarray.length*4; i++) { str += tab.charAt((binarray[i >> 2] >> ((3-i%4)*8+4)) & 0xF) + tab.charAt((binarray[i >> 2] >> ((3-i%4)*8)) & 0xF); } return str; } } }

BIN
src/webcam/ReadMe.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,111 @@
<?php echo
$pixels = $_POST["pixels"];
if(is_null($pixels))
{
$pixels = "";
}
$width = $_POST["width"];
if(is_null($width))
{
$width = 250;
}
$height = $_POST["height"];
if(is_null($height))
{
$height = 250;
}
// Generate New File Name
if (!isset($_POST['guid']) || trim($_POST['guid']) == "") {
die ('ERROR: Enter GUID');
}
else {
$guid =$_POST['guid'];
//sanitize for illegal characters
$guid = mysql_real_escape_string(stripslashes($guid));
$fileName = "images/".$guid.".jpg";
}
/// Get Pixel Data and generate new Bitmap Data
/// Then save to server
/// <param name="pixels">pixelData from swf</param>
/// <param name="fileName">Image Save Path</param>
/// <param name="width">Image Width</param>
/// <param name="height">Image Height</param>
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);
}
?>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,183 @@
<?php
/*
Plugin Name: Contact Form 7 Modules: Hidden Fields
Plugin URI: http://www.seodenver.com/contact-form-7-hidden-fields/
Description: Add hidden fields to the popular Contact Form 7 plugin.
Author: Katz Web Services, Inc.
Author URI: http://www.katzwebservices.com
Version: 1.1.2
*/
/* Copyright 2011 Katz Web Services, Inc. (email: info at katzwebservices.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
** A base module for [hidden] and [hidden*]
**/
/* Shortcode handler */
#if(function_exists('wpcf7_add_shortcode')) {
add_action('plugins_loaded', 'contact_form_7_hidden_fields', 10);
function contact_form_7_hidden_fields() {
global $pagenow;
if(function_exists('wpcf7_add_shortcode')) {
wpcf7_add_shortcode( 'hidden', 'wpcf7_hidden_shortcode_handler', true );
wpcf7_add_shortcode( 'hidden*', 'wpcf7_hidden_shortcode_handler', true );
} else {
if($pagenow != 'plugins.php') { return; }
add_action('admin_notices', 'cfhiddenfieldserror');
wp_enqueue_script('thickbox');
function cfhiddenfieldserror() {
$out = '<div class="error" id="messages"><p>';
if(file_exists(WP_PLUGIN_DIR.'/contact-form-7/wp-contact-form-7.php')) {
$out .= 'The Contact Form 7 is installed, but <strong>you must activate Contact Form 7</strong> 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. <a href="'.admin_url('plugin-install.php?tab=plugin-information&plugin=contact-form-7&from=plugins&TB_iframe=true&width=600&height=550').'" class="thickbox" title="Contact Form 7">Install Now.</a>';
}
$out .= '</p></div>';
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 = '<input type="hidden" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
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() {
?>
<div id="wpcf7-tg-pane-hidden" class="hidden">
<form action="">
<table>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
<td>
<br /><input type="checkbox" name="watermark" class="option" />&nbsp;<?php echo esc_html( __( 'Use this text as watermark?', 'wpcf7' ) ); ?>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="hidden" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -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&currency_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 <em>million</em> 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`
<strong>You can also use a filter:</strong> hook into the `wpcf7_hidden_field_value` filter to modify the value of the hidden field using <a href="http://codex.wordpress.org/Function_Reference/add_filter" rel="nofollow"><code>add_filter()</code></a>. 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.
<h4>Visit the official <a href="http://www.seodenver.com/contact-form-7-hidden-fields/">Contact Form 7 Modules plugin page</a> for more support & additional information</h4>
== 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, <a href="http://www.seodenver.com/contact-form-7-hidden-fields/#comment-116384456"> as reported by BDN Online</a>
= 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 <a href="http://codex.wordpress.org/Function_Reference/add_filter" rel="nofollow"><code>add_filter()</code></a>
= 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, <a href="http://www.seodenver.com/contact-form-7-hidden-fields/#comment-116384456"> as reported by BDN Online</a>
= 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 <a href="http://codex.wordpress.org/Function_Reference/add_filter" rel="nofollow"><code>add_filter()</code></a>
= 1.0 =
* Woot!

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@ -0,0 +1,370 @@
<?php
function wpcf7_admin_has_edit_cap() {
return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
}
add_action( 'admin_menu', 'wpcf7_admin_add_pages', 9 );
function wpcf7_admin_add_pages() {
if ( isset( $_POST['wpcf7-save'] ) && wpcf7_admin_has_edit_cap() ) {
$id = $_POST['wpcf7-id'];
check_admin_referer( 'wpcf7-save_' . $id );
if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
$contact_form = new WPCF7_ContactForm();
$contact_form->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;
?>
<script type="text/javascript">
/* <![CDATA[ */
var _wpcf7 = {
pluginUrl: '<?php echo wpcf7_plugin_url(); ?>',
tagGenerators: {
<?php wpcf7_print_tag_generators(); ?>
}
};
/* ]]> */
</script>
<?php
}
function wpcf7_admin_management_page() {
$contact_forms = wpcf7_contact_forms();
$unsaved = false;
if ( ! isset( $_GET['contactform'] ) )
$_GET['contactform'] = '';
if ( 'new' == $_GET['contactform'] ) {
$unsaved = true;
$current = -1;
$cf = wpcf7_contact_form_default_pack( isset( $_GET['locale'] ) ? $_GET['locale'] : '' );
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
$current = (int) $_GET['contactform'];
} else {
$first = reset( $contact_forms ); // Returns first item
$current = $first->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 = '<a href="' . esc_attr( $url ) . '">'
. esc_html( __( 'Settings', 'wpcf7' ) ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_cf7com_links', 9 );
function wpcf7_cf7com_links( &$contact_form ) {
$links = '<div class="cf7com-links">'
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/', 'wpcf7' ) ) . '" target="_blank">'
. esc_html( __( 'Contactform7.com', 'wpcf7' ) ) . '</a>&ensp;'
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/docs/', 'wpcf7' ) ) . '" target="_blank">'
. esc_html( __( 'Docs', 'wpcf7' ) ) . '</a> - '
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/faq/', 'wpcf7' ) ) . '" target="_blank">'
. esc_html( __( 'FAQ', 'wpcf7' ) ) . '</a> - '
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/support/', 'wpcf7' ) ) . '" target="_blank">'
. esc_html( __( 'Support', 'wpcf7' ) ) . '</a>'
. '</div>';
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;
?>
<div id="message" class="updated fade"><p><?php echo esc_html( $updated_message ); ?></p></div>
<?php
}
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_donation_link' );
function wpcf7_donation_link( &$contact_form ) {
if ( ! WPCF7_SHOW_DONATION_LINK )
return;
if ( 'new' == $_GET['contactform'] || ! empty($_GET['message']) )
return;
$show_link = true;
$num = mt_rand( 0, 99 );
if ( $num >= 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 )];
?>
<div class="donation">
<p><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'wpcf7' ) ); ?>"><?php echo esc_html( $text ); ?></a> <a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'wpcf7' ) ); ?>" class="button"><?php echo esc_html( __( "Donate", 'wpcf7' ) ); ?></a></p>
</div>
<?php
}
?>

View File

@ -0,0 +1,351 @@
<?php
/* No table warning */
if ( ! wpcf7_table_exists() ) {
if ( current_user_can( 'activate_plugins' ) ) {
$create_table_link_url = wpcf7_admin_url( array( 'wpcf7-create-table' => 1 ) );
$create_table_link_url = wp_nonce_url( $create_table_link_url, 'wpcf7-create-table' );
$message = sprintf(
__( '<strong>The database table for Contact Form 7 does not exist.</strong> You must <a href="%s">create the table</a> for it to work.', 'wpcf7' ),
$create_table_link_url );
} else {
$message = __( "<strong>The database table for Contact Form 7 does not exist.</strong>", 'wpcf7' );
}
?>
<div class="wrap">
<?php screen_icon( 'edit-pages' ); ?>
<h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
<div id="message" class="updated fade">
<p><?php echo $message; ?></p>
</div>
</div>
<?php
return;
}
?><div class="wrap wpcf7">
<?php screen_icon( 'edit-pages' ); ?>
<h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
<?php do_action_ref_array( 'wpcf7_admin_before_subsubsub', array( &$cf ) ); ?>
<ul class="subsubsub">
<?php
$first = array_shift( $contact_forms );
if ( ! is_null( $first ) ) : ?>
<li><a href="<?php echo wpcf7_admin_url( array( 'contactform' => $first->id ) ); ?>"<?php if ( $first->id == $current ) echo ' class="current"'; ?>><?php echo esc_html( $first->title ); ?></a></li>
<?php endif;
foreach ( $contact_forms as $v ) : ?>
<li>| <a href="<?php echo wpcf7_admin_url( array( 'contactform' => $v->id ) ); ?>"<?php if ( $v->id == $current ) echo ' class="current"'; ?>><?php echo esc_html( $v->title ); ?></a></li>
<?php endforeach; ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<li class="addnew"><a class="thickbox<?php if ( $unsaved ) echo ' current'; ?>" href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal"><?php echo esc_html( __( 'Add new', 'wpcf7' ) ); ?></a></li>
<?php endif; ?>
</ul>
<br class="clear" />
<?php if ( $cf ) : ?>
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
<form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element">
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo $current; ?>" />
<table class="widefat">
<tbody>
<tr>
<td scope="col">
<div style="position: relative;">
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo esc_attr( $cf->title ); ?>"<?php echo $disabled; ?> />
<?php if ( ! $unsaved ) : ?>
<p class="tagcode">
<?php echo esc_html( __( "Copy this code and paste it into your post, page or text widget content.", 'wpcf7' ) ); ?><br />
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
</p>
<?php endif; ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<div class="save-contact-form">
<input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
</div>
<?php endif; ?>
<?php if ( wpcf7_admin_has_edit_cap() && ! $unsaved ) : ?>
<div class="actions-link">
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy_' . $current ); ?>
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Copy', 'wpcf7' ) ); ?>"
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; return true;\""; ?> />
|
<?php $delete_nonce = wp_create_nonce( 'wpcf7-delete_' . $current ); ?>
<input type="submit" name="wpcf7-delete" class="delete" value="<?php echo esc_attr( __( 'Delete', 'wpcf7' ) ); ?>"
<?php echo "onclick=\"if (confirm('" .
esc_js( __( "You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7' ) ) .
"')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
</div>
<?php endif; ?>
</div>
</td>
</tr>
</tbody>
</table>
<?php do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) ); ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<table class="widefat" style="margin-top: 1em;">
<thead><tr><th scope="col" colspan="2"><?php echo esc_html( __( 'Form', 'wpcf7' ) ); ?></th></tr></thead>
<tbody>
<tr>
<td scope="col" style="width: 50%;">
<div><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="20"><?php echo esc_html( $cf->form ); ?></textarea></div>
</td>
<td scope="col" style="width: 50%;">
<div id="taggenerator"></div>
</td>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) ); ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<table class="widefat" style="margin-top: 1em;">
<thead><tr><th scope="col" colspan="2"><?php echo esc_html( __( 'Mail', 'wpcf7' ) ); ?></th></tr></thead>
<tbody>
<tr>
<td scope="col" style="width: 50%;">
<div class="mail-field">
<label for="wpcf7-mail-recipient"><?php echo esc_html( __( 'To:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-recipient" name="wpcf7-mail-recipient" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['recipient'] ); ?>" />
</div>
<div class="mail-field">
<label for="wpcf7-mail-sender"><?php echo esc_html( __( 'From:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-sender" name="wpcf7-mail-sender" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['sender'] ); ?>" />
</div>
<div class="mail-field">
<label for="wpcf7-mail-subject"><?php echo esc_html( __( 'Subject:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-subject" name="wpcf7-mail-subject" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['subject'] ); ?>" />
</div>
<div class="pseudo-hr"></div>
<div class="mail-field">
<label for="wpcf7-mail-additional-headers"><?php echo esc_html( __( 'Additional headers:', 'wpcf7' ) ); ?></label><br />
<textarea id="wpcf7-mail-additional-headers" name="wpcf7-mail-additional-headers" cols="100" rows="2"><?php echo esc_html( $cf->mail['additional_headers'] ); ?></textarea>
</div>
<div class="mail-field">
<label for="wpcf7-mail-attachments"><?php echo esc_html( __( 'File attachments:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-attachments" name="wpcf7-mail-attachments" class="wide" size="70" value="<?php echo esc_attr( $cf->mail['attachments'] ); ?>" />
</div>
<div class="pseudo-hr"></div>
<div class="mail-field">
<input type="checkbox" id="wpcf7-mail-use-html" name="wpcf7-mail-use-html" value="1"<?php echo ( $cf->mail['use_html'] ) ? ' checked="checked"' : ''; ?> />
<label for="wpcf7-mail-use-html"><?php echo esc_html( __( 'Use HTML content type', 'wpcf7' ) ); ?></label>
</div>
</td>
<td scope="col" style="width: 50%;">
<div class="mail-field">
<label for="wpcf7-mail-body"><?php echo esc_html( __( 'Message body:', 'wpcf7' ) ); ?></label><br />
<textarea id="wpcf7-mail-body" name="wpcf7-mail-body" cols="100" rows="16"><?php echo esc_html( $cf->mail['body'] ); ?></textarea>
</div>
</td>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) ); ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<table class="widefat" style="margin-top: 1em;">
<thead><tr><th scope="col" colspan="2"><?php echo esc_html( __( 'Mail (2)', 'wpcf7' ) ); ?></th></tr></thead>
<tbody>
<tr>
<td scope="col" colspan="2">
<input type="checkbox" id="wpcf7-mail-2-active" name="wpcf7-mail-2-active" value="1"<?php echo ( $cf->mail_2['active'] ) ? ' checked="checked"' : ''; ?> />
<label for="wpcf7-mail-2-active"><?php echo esc_html( __( 'Use mail (2)', 'wpcf7' ) ); ?></label>
</td>
</tr>
<tr id="mail-2-fields">
<td scope="col" style="width: 50%;">
<div class="mail-field">
<label for="wpcf7-mail-2-recipient"><?php echo esc_html( __( 'To:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-2-recipient" name="wpcf7-mail-2-recipient" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['recipient'] ); ?>" />
</div>
<div class="mail-field">
<label for="wpcf7-mail-2-sender"><?php echo esc_html( __( 'From:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-2-sender" name="wpcf7-mail-2-sender" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['sender'] ); ?>" />
</div>
<div class="mail-field">
<label for="wpcf7-mail-2-subject"><?php echo esc_html( __( 'Subject:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-2-subject" name="wpcf7-mail-2-subject" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['subject'] ); ?>" />
</div>
<div class="pseudo-hr"></div>
<div class="mail-field">
<label for="wpcf7-mail-2-additional-headers"><?php echo esc_html( __( 'Additional headers:', 'wpcf7' ) ); ?></label><br />
<textarea id="wpcf7-mail-2-additional-headers" name="wpcf7-mail-2-additional-headers" cols="100" rows="2"><?php echo esc_html( $cf->mail_2['additional_headers'] ); ?></textarea>
</div>
<div class="mail-field">
<label for="wpcf7-mail-2-attachments"><?php echo esc_html( __( 'File attachments:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="wpcf7-mail-2-attachments" name="wpcf7-mail-2-attachments" class="wide" size="70" value="<?php echo esc_attr( $cf->mail_2['attachments'] ); ?>" />
</div>
<div class="pseudo-hr"></div>
<div class="mail-field">
<input type="checkbox" id="wpcf7-mail-2-use-html" name="wpcf7-mail-2-use-html" value="1"<?php echo ( $cf->mail_2['use_html'] ) ? ' checked="checked"' : ''; ?> />
<label for="wpcf7-mail-2-use-html"><?php echo esc_html( __( 'Use HTML content type', 'wpcf7' ) ); ?></label>
</div>
</td>
<td scope="col" style="width: 50%;">
<div class="mail-field">
<label for="wpcf7-mail-2-body"><?php echo esc_html( __( 'Message body:', 'wpcf7' ) ); ?></label><br />
<textarea id="wpcf7-mail-2-body" name="wpcf7-mail-2-body" cols="100" rows="16"><?php echo esc_html( $cf->mail_2['body'] ); ?></textarea>
</div>
</td>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$cf ) ); ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<table class="widefat" style="margin-top: 1em;">
<thead><tr><th scope="col"><?php echo esc_html( __( 'Messages', 'wpcf7' ) ); ?> <span id="message-fields-toggle-switch"></span></th></tr></thead>
<tbody>
<tr>
<td scope="col">
<div id="message-fields">
<?php foreach ( wpcf7_messages() as $key => $arr ) :
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
?>
<div class="message-field">
<label for="<?php echo $field_name; ?>"><em># <?php echo esc_html( $arr['description'] ); ?></em></label><br />
<input type="text" id="<?php echo $field_name; ?>" name="<?php echo $field_name; ?>" class="wide" size="70" value="<?php echo esc_attr( $cf->messages[$key] ); ?>" />
</div>
<?php endforeach; ?>
</div>
</td>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) ); ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<table class="widefat" style="margin-top: 1em;">
<thead><tr><th scope="col"><?php echo esc_html( __( 'Additional Settings', 'wpcf7' ) ); ?> <span id="additional-settings-fields-toggle-switch"></span></th></tr></thead>
<tbody>
<tr>
<td scope="col">
<div id="additional-settings-fields">
<textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8"><?php echo esc_html( $cf->additional_settings ); ?></textarea>
</div>
</td>
</tr>
</tbody>
</table>
<?php endif; ?>
<?php do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) ); ?>
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
<table class="widefat" style="margin-top: 1em;">
<tbody>
<tr>
<td scope="col">
<div class="save-contact-form">
<input type="submit" class="button button-highlighted" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
</div>
</td>
</tr>
</tbody>
</table>
<?php endif; ?>
</form>
<?php endif; ?>
</div>
<div id="wpcf7-lang-select-modal" class="hidden">
<?php
$available_locales = wpcf7_l10n();
$default_locale = get_locale();
if ( ! isset( $available_locales[$default_locale] ) )
$default_locale = 'en_US';
?>
<h4><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'wpcf7' ), $available_locales[$default_locale] ) ); ?></h4>
<p><a href="<?php echo wpcf7_admin_url( array( 'contactform' => 'new' ) ); ?>" class="button" /><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></p>
<?php unset( $available_locales[$default_locale] ); ?>
<h4><?php echo esc_html( __( 'Or', 'wpcf7' ) ); ?></h4>
<form action="" method="get">
<input type="hidden" name="page" value="wpcf7" />
<input type="hidden" name="contactform" value="new" />
<select name="locale">
<option value="" selected="selected"><?php echo esc_html( __( '(select language)', 'wpcf7' ) ); ?></option>
<?php foreach ( $available_locales as $code => $locale ) : ?>
<option value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $locale ); ?></option>
<?php endforeach; ?>
</select>
<input type="submit" class="button" value="<?php echo esc_attr( __( 'Add New', 'wpcf7' ) ); ?>" />
</form>
</div>
<?php do_action_ref_array( 'wpcf7_admin_footer', array( &$cf ) ); ?>

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,262 @@
(function($) {
$.fn.tagGenerator = function(title, options) {
var menu = $('<div class="tag-generator"></div>');
var selector = $('<span>' + title + '</span>');
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 = $('<img src="' + options.dropdownIconUrl + '" />');
dropdown_icon.css({ 'vertical-align': 'bottom' });
selector.append(dropdown_icon);
}
menu.append(selector);
var pane = $('<div class="tg-pane"></div>');
pane.hide();
menu.append(pane);
var dropdown = $('<div class="tg-dropdown"></div>');
dropdown.hide();
menu.append(dropdown);
$.each($.tgPanes, function(i, n) {
var submenu = $('<div>' + $.tgPanes[i].title + '</div>');
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 = $('<div></div>');
closeButtonDiv.css({ float: 'right' });
var closeButton = $('<span class="tg-closebutton">&#215;</span>');
closeButton.click(function() {
pane.slideUp('fast').empty();
});
closeButtonDiv.append(closeButton);
pane.append(closeButtonDiv);
var paneTitle = $('<div class="tg-panetitle">' + $.tgPanes[tagType].title + '</div>');
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, '&quot;') + '"';
});
}
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);

Binary file not shown.

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

View File

@ -0,0 +1,645 @@
<?php
class WPCF7_ContactForm {
var $initial = false;
var $id;
var $title;
var $form;
var $mail;
var $mail_2;
var $messages;
var $additional_settings;
var $unit_tag;
var $responses_count = 0;
var $scanned_form_tags;
var $posted_data;
var $uploaded_files;
var $skip_mail = false;
// Return true if this form is the same one as currently POSTed.
function is_posted() {
if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
return false;
if ( $this->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 = '<div class="wpcf7" id="' . $this->unit_tag . '">';
$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 .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
. ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";
$form .= '<div style="display: none;">' . "\n";
$form .= '<input type="hidden" name="_wpcf7" value="'
. esc_attr( $this->id ) . '" />' . "\n";
$form .= '<input type="hidden" name="_wpcf7_version" value="'
. esc_attr( WPCF7_VERSION ) . '" />' . "\n";
$form .= '<input type="hidden" name="_wpcf7_unit_tag" value="'
. esc_attr( $this->unit_tag ) . '" />' . "\n";
$form .= '</div>' . "\n";
$form .= $this->form_elements();
if ( ! $this->responses_count )
$form .= $this->form_response_output();
$form .= '</form>';
$form .= '</div>';
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 '<div' . $class . '>' . $content . '</div>';
}
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 = '<span class="wpcf7-not-valid-tip-no-ajax">' . esc_html( $ve ) . '</span>';
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 );
}
?>

View File

@ -0,0 +1,288 @@
<?php
add_action( 'init', 'wpcf7_init_switch', 11 );
function wpcf7_init_switch() {
if ( 'GET' == $_SERVER['REQUEST_METHOD'] && isset( $_GET['_wpcf7_is_ajax_call'] ) ) {
wpcf7_ajax_onload();
exit();
} elseif ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset( $_POST['_wpcf7_is_ajax_call'] ) ) {
wpcf7_ajax_json_echo();
exit();
} elseif ( isset( $_POST['_wpcf7'] ) ) {
wpcf7_process_nonajax_submitting();
}
}
function wpcf7_ajax_onload() {
global $wpcf7_contact_form;
$echo = '';
if ( isset( $_GET['_wpcf7'] ) ) {
$id = (int) $_GET['_wpcf7'];
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
$items = apply_filters( 'wpcf7_ajax_onload', array() );
$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;
}
}
function wpcf7_ajax_json_echo() {
global $wpcf7_contact_form;
$echo = '';
if ( isset( $_POST['_wpcf7'] ) ) {
$id = (int) $_POST['_wpcf7'];
$unit_tag = $_POST['_wpcf7_unit_tag'];
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
$validation = $wpcf7_contact_form->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 '<textarea>' . $echo . '</textarea>';
}
}
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 ) :
?>
<script type="text/javascript">
//<![CDATA[
var _wpcf7 = { cached: 1 };
//]]>
</script>
<?php
endif;
}
if ( WPCF7_LOAD_JS )
add_action( 'wp_enqueue_scripts', 'wpcf7_enqueue_scripts' );
function wpcf7_enqueue_scripts() {
// jquery.form.js originally bundled with WordPress is out of date and deprecated
// so we need to deregister it and re-register the latest one
wp_deregister_script( 'jquery-form' );
wp_register_script( 'jquery-form', wpcf7_plugin_url( 'jquery.form.js' ),
array( 'jquery' ), '2.52', true );
$in_footer = true;
if ( 'header' === WPCF7_LOAD_JS )
$in_footer = false;
wp_enqueue_script( 'contact-form-7', wpcf7_plugin_url( 'scripts.js' ),
array( 'jquery', 'jquery-form' ), WPCF7_VERSION, $in_footer );
do_action( 'wpcf7_enqueue_scripts' );
}
function wpcf7_script_is() {
return wp_script_is( 'contact-form-7' );
}
if ( WPCF7_LOAD_CSS )
add_action( 'wp_print_styles', 'wpcf7_enqueue_styles' );
function wpcf7_enqueue_styles() {
wp_enqueue_style( 'contact-form-7', wpcf7_plugin_url( 'styles.css' ),
array(), WPCF7_VERSION, 'all' );
if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
wp_enqueue_style( 'contact-form-7-rtl', wpcf7_plugin_url( 'styles-rtl.css' ),
array(), WPCF7_VERSION, 'all' );
}
do_action( 'wpcf7_enqueue_styles' );
}
function wpcf7_style_is() {
return wp_style_is( 'contact-form-7' );
}
?>

View File

@ -0,0 +1,144 @@
<?php
function wpcf7_autop( $pee, $br = 1 ) {
if ( trim( $pee ) === '' )
return '';
$pee = $pee . "\n"; // just to make things a little easier, pad the end
$pee = preg_replace( '|<br />\s*<br />|', "\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( '!(</' . $allblocks . '>)!', "$1\n\n", $pee );
$pee = str_replace( array( "\r\n", "\r" ), "\n", $pee ); // cross-platform newlines
if ( strpos( $pee, '<object' ) !== false ) {
$pee = preg_replace( '|\s*<param([^>]*)>\s*|', "<param$1>", $pee ); // no pee inside object/embed
$pee = preg_replace( '|\s*</embed>\s*|', '</embed>', $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 .= '<p>' . trim( $tinkle, "\n" ) . "</p>\n";
$pee = preg_replace( '|<p>\s*</p>|', '', $pee ); // under certain strange conditions it could create a P of entirely whitespace
$pee = preg_replace( '!<p>([^<]+)</(div|address|form|fieldset)>!', "<p>$1</p></$2>", $pee );
$pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee ); // don't pee all over a tag
$pee = preg_replace( "|<p>(<li.+?)</p>|", "$1", $pee ); // problem with nested lists
$pee = preg_replace( '|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee );
$pee = str_replace( '</blockquote></p>', '</p></blockquote>', $pee );
$pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee );
$pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee );
if ( $br ) {
/* wpcf7: add textarea */
$pee = preg_replace_callback( '/<(script|style|textarea).*?<\/\\1>/s', create_function( '$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);' ), $pee );
$pee = preg_replace( '|(?<!<br />)\s*\n|', "<br />\n", $pee ); // optionally make line breaks
$pee = str_replace( '<WPPreserveNewline />', "\n", $pee );
}
$pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee );
$pee = preg_replace( '!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee );
if ( strpos( $pee, '<pre' ) !== false )
$pee = preg_replace_callback( '!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
$pee = preg_replace( "|\n</p>$|", '</p>', $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 );
}
?>

View File

@ -0,0 +1,226 @@
<?php
function wpcf7_messages() {
$messages = array(
'mail_sent_ok' => 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 =
'<p>' . __( 'Your Name', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '<br />' . "\n"
. ' [text* your-name] </p>' . "\n\n"
. '<p>' . __( 'Your Email', 'wpcf7' ) . ' ' . __( '(required)', 'wpcf7' ) . '<br />' . "\n"
. ' [email* your-email] </p>' . "\n\n"
. '<p>' . __( 'Subject', 'wpcf7' ) . '<br />' . "\n"
. ' [text your-subject] </p>' . "\n\n"
. '<p>' . __( 'Your Message', 'wpcf7' ) . '<br />' . "\n"
. ' [textarea your-message] </p>' . "\n\n"
. '<p>[submit "' . __( 'Send', 'wpcf7' ) . '"]</p>';
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;
}
?>

View File

@ -0,0 +1,67 @@
<?php
class WPCF7_Pipe {
var $before = '';
var $after = '';
function WPCF7_Pipe( $text ) {
$pipe_pos = strpos( $text, '|' );
if ( false === $pipe_pos ) {
$this->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 )];
}
}
?>

View File

@ -0,0 +1,185 @@
<?php
class WPCF7_ShortcodeManager {
var $shortcode_tags = array();
// Taggs scanned at the last time of do_shortcode()
var $scanned_tags = null;
// Executing shortcodes (true) or just scanning (false)
var $exec = true;
function add_shortcode( $tag, $func, $has_name = false ) {
if ( is_callable( $func ) )
$this->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( "/<br\s*\/?>$/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();
}
?>

View File

@ -0,0 +1,49 @@
<?php
function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) {
global $wpcf7_tag_generators;
$name = trim( $name );
if ( '' == $name )
return false;
if ( ! is_array( $wpcf7_tag_generators ) )
$wpcf7_tag_generators = array();
$wpcf7_tag_generators[$name] = array(
'title' => $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";
}
?>

View File

@ -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 = $('<iframe id="' + id + '" name="' + id + '" src="'+ s.iframeSrc +'" />');
var io = $io[0];
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
var xhr = { // mock object
aborted: 0,
responseText: null,
responseXML: null,
status: 0,
statusText: 'n/a',
getAllResponseHeaders: function() {},
getResponseHeader: function() {},
setRequestHeader: function() {},
abort: function(status) {
var e = (status === 'timeout' ? 'timeout' : 'aborted');
log('aborting upload... ' + e);
this.aborted = 1;
$io.attr('src', s.iframeSrc); // abort op in progress
xhr.error = e;
s.error && s.error.call(s.context, xhr, e, e);
g && $.event.trigger("ajaxError", [xhr, s, e]);
s.complete && s.complete.call(s.context, xhr, e);
}
};
var g = s.global;
// trigger ajax global events so that activity/block indicators work like normal
if (g && ! $.active++) {
$.event.trigger("ajaxStart");
}
if (g) {
$.event.trigger("ajaxSend", [xhr, s]);
}
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
if (s.global) {
$.active--;
}
return;
}
if (xhr.aborted) {
return;
}
var timedOut = 0, timeoutHandle;
// add submitting element to data if we know it
var sub = form.clk;
if (sub) {
var n = sub.name;
if (n && !sub.disabled) {
s.extraData = s.extraData || {};
s.extraData[n] = sub.value;
if (sub.type == "image") {
s.extraData[n+'.x'] = form.clk_x;
s.extraData[n+'.y'] = form.clk_y;
}
}
}
// take a breath so that pending repaints get some cpu time before the upload starts
function doSubmit() {
// make sure form attrs are set
var t = $form.attr('target'), a = $form.attr('action');
// update form attrs in IE friendly way
form.setAttribute('target',id);
if (form.getAttribute('method') != 'POST') {
form.setAttribute('method', 'POST');
}
if (form.getAttribute('action') != s.url) {
form.setAttribute('action', s.url);
}
// ie borks in some cases when setting encoding
if (! s.skipEncodingOverride) {
$form.attr({
encoding: 'multipart/form-data',
enctype: 'multipart/form-data'
});
}
// support timout
if (s.timeout) {
timeoutHandle = setTimeout(function() { timedOut = true; cb(true); }, s.timeout);
}
// add "extra" data to form if provided in options
var extraInputs = [];
try {
if (s.extraData) {
for (var n in s.extraData) {
extraInputs.push(
$('<input type="hidden" name="'+n+'" value="'+s.extraData[n]+'" />')
.appendTo(form)[0]);
}
}
// add iframe to doc and submit the form
$io.appendTo('body');
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
form.submit();
}
finally {
// reset attrs and remove "extra" input elements
form.setAttribute('action',a);
if(t) {
form.setAttribute('target', t);
} else {
$form.removeAttr('target');
}
$(extraInputs).remove();
}
}
if (s.forceSync) {
doSubmit();
}
else {
setTimeout(doSubmit, 10); // this lets dom updates render
}
var data, doc, domCheckCount = 50, callbackProcessed;
function cb(e) {
if (xhr.aborted || callbackProcessed) {
return;
}
if (e === true && xhr) {
xhr.abort('timeout');
return;
}
var doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
if (!doc || doc.location.href == s.iframeSrc) {
// response not received yet
if (!timedOut)
return;
}
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
var ok = true;
try {
if (timedOut) {
throw 'timeout';
}
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
log('isXml='+isXml);
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
if (--domCheckCount) {
// in some browsers (Opera) the iframe DOM is not always traversable when
// the onload callback fires, so we loop a bit to accommodate
log('requeing onLoad callback, DOM not available');
setTimeout(cb, 250);
return;
}
// let this fall through because server response could be an empty document
//log('Could not access iframe DOM after mutiple tries.');
//throw 'DOMException: not available';
}
//log('response detected');
xhr.responseText = doc.body ? doc.body.innerHTML : doc.documentElement ? doc.documentElement.innerHTML : null;
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
if (!xhr.responseText && xhr.responseXML && !s.dataType)
s.dataType = 'xml';
xhr.getResponseHeader = function(header){
var headers = {'content-type': s.dataType};
return headers[header];
};
var scr = /(json|script|text)/.test(s.dataType);
if (scr || s.textarea) {
// see if user embedded response in textarea
var ta = doc.getElementsByTagName('textarea')[0];
if (ta) {
xhr.responseText = ta.value;
}
else if (scr) {
// account for browsers injecting pre around json response
var pre = doc.getElementsByTagName('pre')[0];
var b = doc.getElementsByTagName('body')[0];
if (pre) {
xhr.responseText = pre.textContent;
}
else if (b) {
xhr.responseText = b.innerHTML;
}
}
}
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
xhr.responseXML = toXml(xhr.responseText);
}
data = httpData(xhr, s.dataType, s);
}
catch(e){
log('error caught:',e);
ok = false;
xhr.error = e;
s.error && s.error.call(s.context, xhr, 'error', e);
g && $.event.trigger("ajaxError", [xhr, s, e]);
}
if (xhr.aborted) {
log('upload aborted');
ok = false;
}
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
if (ok) {
s.success && s.success.call(s.context, data, 'success', xhr);
g && $.event.trigger("ajaxSuccess", [xhr, s]);
}
g && $.event.trigger("ajaxComplete", [xhr, s]);
if (g && ! --$.active) {
$.event.trigger("ajaxStop");
}
s.complete && s.complete.call(s.context, xhr, ok ? 'success' : 'error');
callbackProcessed = true;
if (s.timeout)
clearTimeout(timeoutHandle);
// clean up
setTimeout(function() {
$io.removeData('form-plugin-onload');
$io.remove();
xhr.responseXML = null;
}, 100);
}
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
if (window.ActiveXObject) {
doc = new ActiveXObject('Microsoft.XMLDOM');
doc.async = 'false';
doc.loadXML(s);
}
else {
doc = (new DOMParser()).parseFromString(s, 'text/xml');
}
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
};
var parseJSON = $.parseJSON || function(s) {
return window['eval']('(' + s + ')');
};
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
var ct = xhr.getResponseHeader('content-type') || '',
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
data = xml ? xhr.responseXML : xhr.responseText;
if (xml && data.documentElement.nodeName === 'parsererror') {
$.error && $.error('parsererror');
}
if (s && s.dataFilter) {
data = s.dataFilter(data, type);
}
if (typeof data === 'string') {
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
data = parseJSON(data);
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
$.globalEval(data);
}
}
return data;
};
}
};
/**
* ajaxForm() provides a mechanism for fully automating form submission.
*
* The advantages of using this method instead of ajaxSubmit() are:
*
* 1: This method will include coordinates for <input type="image" /> elements (if the element
* is used to submit the form).
* 2. This method will include the submit element's name/value data (for the element that was
* used to submit the form).
* 3. This method binds the submit() method to the form for you.
*
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
* passes the options argument along after properly binding events for submit elements and
* the form itself.
*/
$.fn.ajaxForm = function(options) {
// in jQuery 1.3+ we can fix mistakes with the ready state
if (this.length === 0) {
var o = { s: this.selector, c: this.context };
if (!$.isReady && o.s) {
log('DOM not ready, queuing ajaxForm');
$(function() {
$(o.s,o.c).ajaxForm(options);
});
return this;
}
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
return this;
}
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
e.preventDefault();
$(this).ajaxSubmit(options);
}
}).bind('click.form-plugin', function(e) {
var target = e.target;
var $el = $(target);
if (!($el.is(":submit,input:image"))) {
// is this a child element of the submit el? (ex: a span within a button)
var t = $el.closest(':submit');
if (t.length == 0) {
return;
}
target = t[0];
}
var form = this;
form.clk = target;
if (target.type == 'image') {
if (e.offsetX != undefined) {
form.clk_x = e.offsetX;
form.clk_y = e.offsetY;
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
var offset = $el.offset();
form.clk_x = e.pageX - offset.left;
form.clk_y = e.pageY - offset.top;
} else {
form.clk_x = e.pageX - target.offsetLeft;
form.clk_y = e.pageY - target.offsetTop;
}
}
// clear form vars
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
});
};
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
return this.unbind('submit.form-plugin click.form-plugin');
};
/**
* formToArray() gathers form element data into an array of objects that can
* be passed to any of the following ajax functions: $.get, $.post, or load.
* Each object in the array has both a 'name' and 'value' property. An example of
* an array for a simple login form might be:
*
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
*
* It is this array that is passed to pre-submit callback functions provided to the
* ajaxSubmit() and ajaxForm() methods.
*/
$.fn.formToArray = function(semantic) {
var a = [];
if (this.length === 0) {
return a;
}
var form = this[0];
var els = semantic ? form.getElementsByTagName('*') : form.elements;
if (!els) {
return a;
}
var i,j,n,v,el,max,jmax;
for(i=0, max=els.length; i < max; i++) {
el = els[i];
n = el.name;
if (!n) {
continue;
}
if (semantic && form.clk && el.type == "image") {
// handle image inputs on the fly when semantic == true
if(!el.disabled && form.clk == el) {
a.push({name: n, value: $(el).val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
continue;
}
v = $.fieldValue(el, true);
if (v && v.constructor == Array) {
for(j=0, jmax=v.length; j < jmax; j++) {
a.push({name: n, value: v[j]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: n, value: v});
}
}
if (!semantic && form.clk) {
// input type=='image' are not found in elements array! handle it here
var $input = $(form.clk), input = $input[0];
n = input.name;
if (n && !input.disabled && input.type == 'image') {
a.push({name: n, value: $input.val()});
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
}
}
return a;
};
/**
* Serializes form data into a 'submittable' string. This method will return a string
* in the format: name1=value1&amp;name2=value2
*/
$.fn.formSerialize = function(semantic) {
//hand off to jQuery.param for proper encoding
return $.param(this.formToArray(semantic));
};
/**
* Serializes all field elements in the jQuery object into a query string.
* This method will return a string in the format: name1=value1&amp;name2=value2
*/
$.fn.fieldSerialize = function(successful) {
var a = [];
this.each(function() {
var n = this.name;
if (!n) {
return;
}
var v = $.fieldValue(this, successful);
if (v && v.constructor == Array) {
for (var i=0,max=v.length; i < max; i++) {
a.push({name: n, value: v[i]});
}
}
else if (v !== null && typeof v != 'undefined') {
a.push({name: this.name, value: v});
}
});
//hand off to jQuery.param for proper encoding
return $.param(a);
};
/**
* Returns the value(s) of the element in the matched set. For example, consider the following form:
*
* <form><fieldset>
* <input name="A" type="text" />
* <input name="A" type="text" />
* <input name="B" type="checkbox" value="B1" />
* <input name="B" type="checkbox" value="B2"/>
* <input name="C" type="radio" value="C1" />
* <input name="C" type="radio" value="C2" />
* </fieldset></form>
*
* var v = $(':text').fieldValue();
* // if no values are entered into the text inputs
* v == ['','']
* // if values entered into the text inputs are 'foo' and 'bar'
* v == ['foo','bar']
*
* var v = $(':checkbox').fieldValue();
* // if neither checkbox is checked
* v === undefined
* // if both checkboxes are checked
* v == ['B1', 'B2']
*
* var v = $(':radio').fieldValue();
* // if neither radio is checked
* v === undefined
* // if first radio is checked
* v == ['C1']
*
* The successful argument controls whether or not the field element must be 'successful'
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
* The default value of the successful argument is true. If this value is false the value(s)
* for each element is returned.
*
* Note: This method *always* returns an array. If no valid value can be determined the
* array will be empty, otherwise it will contain one or more values.
*/
$.fn.fieldValue = function(successful) {
for (var val=[], i=0, max=this.length; i < max; i++) {
var el = this[i];
var v = $.fieldValue(el, successful);
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
continue;
}
v.constructor == Array ? $.merge(val, v) : val.push(v);
}
return val;
};
/**
* Returns the value of the field element.
*/
$.fieldValue = function(el, successful) {
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
if (successful === undefined) {
successful = true;
}
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
(t == 'checkbox' || t == 'radio') && !el.checked ||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
tag == 'select' && el.selectedIndex == -1)) {
return null;
}
if (tag == 'select') {
var index = el.selectedIndex;
if (index < 0) {
return null;
}
var a = [], ops = el.options;
var one = (t == 'select-one');
var max = (one ? index+1 : ops.length);
for(var i=(one ? index : 0); i < max; i++) {
var op = ops[i];
if (op.selected) {
var v = op.value;
if (!v) { // extra pain for IE...
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
}
if (one) {
return v;
}
a.push(v);
}
}
return a;
}
return $(el).val();
};
/**
* Clears the form data. Takes the following actions on the form's input fields:
* - input text fields will have their 'value' property set to the empty string
* - select elements will have their 'selectedIndex' property set to -1
* - checkbox and radio inputs will have their 'checked' property set to false
* - inputs of type submit, button, reset, and hidden will *not* be effected
* - button elements will *not* be effected
*/
$.fn.clearForm = function() {
return this.each(function() {
$('input,select,textarea', this).clearFields();
});
};
/**
* Clears the selected form elements.
*/
$.fn.clearFields = $.fn.clearInputs = function() {
return this.each(function() {
var t = this.type, tag = this.tagName.toLowerCase();
if (t == 'text' || t == 'password' || tag == 'textarea') {
this.value = '';
}
else if (t == 'checkbox' || t == 'radio') {
this.checked = false;
}
else if (tag == 'select') {
this.selectedIndex = -1;
}
});
};
/**
* Resets the form data. Causes all form elements to be reset to their original value.
*/
$.fn.resetForm = function() {
return this.each(function() {
// guard against an input with the name of 'reset'
// note that IE reports the reset function as an 'object'
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
this.reset();
}
});
};
/**
* Enables or disables any matching elements.
*/
$.fn.enable = function(b) {
if (b === undefined) {
b = true;
}
return this.each(function() {
this.disabled = !b;
});
};
/**
* Checks/unchecks any matching checkboxes or radio buttons and
* selects/deselects and matching option elements.
*/
$.fn.selected = function(select) {
if (select === undefined) {
select = true;
}
return this.each(function() {
var t = this.type;
if (t == 'checkbox' || t == 'radio') {
this.checked = select;
}
else if (this.tagName.toLowerCase() == 'option') {
var $sel = $(this).parent('select');
if (select && $sel[0] && $sel[0].type == 'select-one') {
// deselect all other options
$sel.find('option').selected(false);
}
this.selected = select;
}
});
};
// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
if ($.fn.ajaxSubmit.debug) {
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
if (window.console && window.console.log) {
window.console.log(msg);
}
else if (window.opera && window.opera.postError) {
window.opera.postError(msg);
}
}
};
})(jQuery);

View File

@ -0,0 +1,9 @@
== For Translators ==
Note: this folder contains MO files and POT file only. If you are looking for PO file, you can download it from here:
http://plugins.svn.wordpress.org/contact-form-7/branches/languages/
If you have created your own translation, or have an update of an existing one, please send it to Takayuki Miyoshi <takayukister@gmail.com> so that I can bundle it into the next release of Contact Form 7.
Thank you.

View File

@ -0,0 +1,842 @@
msgid ""
msgstr ""
"Project-Id-Version: Contact Form 7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2011-01-06 09:35+0900\n"
"PO-Revision-Date: 2011-01-06 09:35+0900\n"
"Last-Translator: Takayuki Miyoshi <takayukister@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Poedit-SourceCharset: utf-8\n"
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_c\n"
"X-Poedit-Basepath: ../..\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Poedit-SearchPath-0: contact-form-7\n"
#: contact-form-7/admin/admin.php:120
#: contact-form-7/admin/edit.php:17
#: contact-form-7/admin/edit.php:30
msgid "Contact Form 7"
msgstr ""
#: contact-form-7/admin/admin.php:120
msgid "Contact"
msgstr ""
#: contact-form-7/admin/admin.php:123
msgid "Edit Contact Forms"
msgstr ""
#: contact-form-7/admin/admin.php:123
msgid "Edit"
msgstr ""
#: contact-form-7/admin/admin.php:162
msgid "Generate Tag"
msgstr ""
#: contact-form-7/admin/admin.php:163
msgid "Show"
msgstr ""
#: contact-form-7/admin/admin.php:164
msgid "Hide"
msgstr ""
#: contact-form-7/admin/admin.php:261
msgid "Contact form"
msgstr ""
#: contact-form-7/admin/admin.php:280
msgid "Settings"
msgstr ""
#: contact-form-7/admin/admin.php:291
msgid "http://contactform7.com/"
msgstr ""
#: contact-form-7/admin/admin.php:292
msgid "Contactform7.com"
msgstr ""
#: contact-form-7/admin/admin.php:293
msgid "http://contactform7.com/docs/"
msgstr ""
#: contact-form-7/admin/admin.php:294
msgid "Docs"
msgstr ""
#: contact-form-7/admin/admin.php:295
msgid "http://contactform7.com/faq/"
msgstr ""
#: contact-form-7/admin/admin.php:296
msgid "FAQ"
msgstr ""
#: contact-form-7/admin/admin.php:297
msgid "http://contactform7.com/support/"
msgstr ""
#: contact-form-7/admin/admin.php:298
msgid "Support"
msgstr ""
#: contact-form-7/admin/admin.php:312
msgid "Contact form created."
msgstr ""
#: contact-form-7/admin/admin.php:315
msgid "Contact form saved."
msgstr ""
#: contact-form-7/admin/admin.php:318
msgid "Contact form deleted."
msgstr ""
#: contact-form-7/admin/admin.php:321
msgid "Database table created."
msgstr ""
#: contact-form-7/admin/admin.php:324
msgid "Failed to create database table."
msgstr ""
#: contact-form-7/admin/admin.php:358
msgid "Contact Form 7 needs your support. Please donate today."
msgstr ""
#: contact-form-7/admin/admin.php:359
msgid "Your contribution is needed for making this plugin better."
msgstr ""
#: contact-form-7/admin/admin.php:365
msgid "http://contactform7.com/donate/"
msgstr ""
#: contact-form-7/admin/admin.php:365
msgid "Donate"
msgstr ""
#: contact-form-7/admin/edit.php:9
#, php-format
msgid "<strong>The database table for Contact Form 7 does not exist.</strong> You must <a href=\"%s\">create the table</a> for it to work."
msgstr ""
#: contact-form-7/admin/edit.php:12
msgid "<strong>The database table for Contact Form 7 does not exist.</strong>"
msgstr ""
#: contact-form-7/admin/edit.php:45
msgid "Add new"
msgstr ""
#: contact-form-7/admin/edit.php:67
msgid "Copy this code and paste it into your post, page or text widget content."
msgstr ""
#: contact-form-7/admin/edit.php:75
#: contact-form-7/admin/edit.php:309
msgid "Save"
msgstr ""
#: contact-form-7/admin/edit.php:82
msgid "Copy"
msgstr ""
#: contact-form-7/admin/edit.php:87
msgid "Delete"
msgstr ""
#: contact-form-7/admin/edit.php:89
msgid ""
"You are about to delete this contact form.\n"
" 'Cancel' to stop, 'OK' to delete."
msgstr ""
#: contact-form-7/admin/edit.php:104
msgid "Form"
msgstr ""
#: contact-form-7/admin/edit.php:128
msgid "Mail"
msgstr ""
#: contact-form-7/admin/edit.php:135
#: contact-form-7/admin/edit.php:202
msgid "To:"
msgstr ""
#: contact-form-7/admin/edit.php:140
#: contact-form-7/admin/edit.php:207
msgid "From:"
msgstr ""
#: contact-form-7/admin/edit.php:145
#: contact-form-7/admin/edit.php:212
msgid "Subject:"
msgstr ""
#: contact-form-7/admin/edit.php:152
#: contact-form-7/admin/edit.php:219
msgid "Additional headers:"
msgstr ""
#: contact-form-7/admin/edit.php:157
#: contact-form-7/admin/edit.php:224
msgid "File attachments:"
msgstr ""
#: contact-form-7/admin/edit.php:165
#: contact-form-7/admin/edit.php:232
msgid "Use HTML content type"
msgstr ""
#: contact-form-7/admin/edit.php:172
#: contact-form-7/admin/edit.php:239
#: contact-form-7/includes/functions.php:78
msgid "Message body:"
msgstr ""
#: contact-form-7/admin/edit.php:188
msgid "Mail (2)"
msgstr ""
#: contact-form-7/admin/edit.php:194
msgid "Use mail (2)"
msgstr ""
#: contact-form-7/admin/edit.php:255
msgid "Messages"
msgstr ""
#: contact-form-7/admin/edit.php:285
msgid "Additional Settings"
msgstr ""
#: contact-form-7/admin/edit.php:333
#, php-format
msgid "Use the default language (%s)"
msgstr ""
#: contact-form-7/admin/edit.php:334
#: contact-form-7/admin/edit.php:347
msgid "Add New"
msgstr ""
#: contact-form-7/admin/edit.php:337
msgid "Or"
msgstr ""
#: contact-form-7/admin/edit.php:342
msgid "(select language)"
msgstr ""
#: contact-form-7/includes/classes.php:596
msgid "Untitled"
msgstr ""
#: contact-form-7/includes/functions.php:6
msgid "Sender's message was sent successfully"
msgstr ""
#: contact-form-7/includes/functions.php:7
msgid "Your message was sent successfully. Thanks."
msgstr ""
#: contact-form-7/includes/functions.php:11
msgid "Sender's message was failed to send"
msgstr ""
#: contact-form-7/includes/functions.php:12
#: contact-form-7/includes/functions.php:17
msgid "Failed to send your message. Please try later or contact administrator by other way."
msgstr ""
#: contact-form-7/includes/functions.php:16
msgid "Akismet judged the sending activity as spamming"
msgstr ""
#: contact-form-7/includes/functions.php:21
msgid "Validation errors occurred"
msgstr ""
#: contact-form-7/includes/functions.php:22
msgid "Validation errors occurred. Please confirm the fields and submit it again."
msgstr ""
#: contact-form-7/includes/functions.php:26
msgid "There is a field of term that sender is needed to accept"
msgstr ""
#: contact-form-7/includes/functions.php:27
msgid "Please accept the terms to proceed."
msgstr ""
#: contact-form-7/includes/functions.php:31
msgid "Email address that sender entered is invalid"
msgstr ""
#: contact-form-7/includes/functions.php:32
msgid "Email address seems invalid."
msgstr ""
#: contact-form-7/includes/functions.php:36
msgid "There is a field that sender is needed to fill in"
msgstr ""
#: contact-form-7/includes/functions.php:37
msgid "Please fill the required field."
msgstr ""
#: contact-form-7/includes/functions.php:46
msgid "Your Name"
msgstr ""
#: contact-form-7/includes/functions.php:46
#: contact-form-7/includes/functions.php:48
msgid "(required)"
msgstr ""
#: contact-form-7/includes/functions.php:48
msgid "Your Email"
msgstr ""
#: contact-form-7/includes/functions.php:50
msgid "Subject"
msgstr ""
#: contact-form-7/includes/functions.php:52
msgid "Your Message"
msgstr ""
#: contact-form-7/includes/functions.php:54
msgid "Send"
msgstr ""
#: contact-form-7/includes/functions.php:62
#, php-format
msgid "From: %s"
msgstr ""
#: contact-form-7/includes/functions.php:63
#, php-format
msgid "Subject: %s"
msgstr ""
#: contact-form-7/includes/functions.php:64
msgid "Message Body:"
msgstr ""
#: contact-form-7/includes/functions.php:65
#: contact-form-7/includes/functions.php:79
#, php-format
msgid "This mail is sent via contact form on %1$s %2$s"
msgstr ""
#: contact-form-7/includes/functions.php:169
msgid "Afrikaans"
msgstr ""
#: contact-form-7/includes/functions.php:170
msgid "Albanian"
msgstr ""
#: contact-form-7/includes/functions.php:171
msgid "Arabic"
msgstr ""
#: contact-form-7/includes/functions.php:172
msgid "Armenian"
msgstr ""
#: contact-form-7/includes/functions.php:173
msgid "Bangla"
msgstr ""
#: contact-form-7/includes/functions.php:174
msgid "Bosnian"
msgstr ""
#: contact-form-7/includes/functions.php:175
msgid "Brazilian Portuguese"
msgstr ""
#: contact-form-7/includes/functions.php:176
msgid "Bulgarian"
msgstr ""
#: contact-form-7/includes/functions.php:177
msgid "Catalan"
msgstr ""
#: contact-form-7/includes/functions.php:178
msgid "Chinese (Simplified)"
msgstr ""
#: contact-form-7/includes/functions.php:179
msgid "Chinese (Traditional)"
msgstr ""
#: contact-form-7/includes/functions.php:180
msgid "Croatian"
msgstr ""
#: contact-form-7/includes/functions.php:181
msgid "Czech"
msgstr ""
#: contact-form-7/includes/functions.php:182
msgid "Danish"
msgstr ""
#: contact-form-7/includes/functions.php:183
msgid "Dutch"
msgstr ""
#: contact-form-7/includes/functions.php:184
msgid "English"
msgstr ""
#: contact-form-7/includes/functions.php:185
msgid "Estonian"
msgstr ""
#: contact-form-7/includes/functions.php:186
msgid "Finnish"
msgstr ""
#: contact-form-7/includes/functions.php:187
msgid "French"
msgstr ""
#: contact-form-7/includes/functions.php:188
msgid "Galician"
msgstr ""
#: contact-form-7/includes/functions.php:189
msgid "Georgian"
msgstr ""
#: contact-form-7/includes/functions.php:190
msgid "German"
msgstr ""
#: contact-form-7/includes/functions.php:191
msgid "Greek"
msgstr ""
#: contact-form-7/includes/functions.php:192
msgid "Hebrew"
msgstr ""
#: contact-form-7/includes/functions.php:193
msgid "Hindi"
msgstr ""
#: contact-form-7/includes/functions.php:194
msgid "Hungarian"
msgstr ""
#: contact-form-7/includes/functions.php:195
msgid "Indonesian"
msgstr ""
#: contact-form-7/includes/functions.php:196
msgid "Italian"
msgstr ""
#: contact-form-7/includes/functions.php:197
msgid "Japanese"
msgstr ""
#: contact-form-7/includes/functions.php:198
msgid "Korean"
msgstr ""
#: contact-form-7/includes/functions.php:199
msgid "Latvian"
msgstr ""
#: contact-form-7/includes/functions.php:200
msgid "Lithuanian"
msgstr ""
#: contact-form-7/includes/functions.php:201
msgid "Macedonian"
msgstr ""
#: contact-form-7/includes/functions.php:202
msgid "Malay"
msgstr ""
#: contact-form-7/includes/functions.php:203
msgid "Malayalam"
msgstr ""
#: contact-form-7/includes/functions.php:204
msgid "Norwegian"
msgstr ""
#: contact-form-7/includes/functions.php:205
msgid "Persian"
msgstr ""
#: contact-form-7/includes/functions.php:206
msgid "Polish"
msgstr ""
#: contact-form-7/includes/functions.php:207
msgid "Portuguese"
msgstr ""
#: contact-form-7/includes/functions.php:208
msgid "Russian"
msgstr ""
#: contact-form-7/includes/functions.php:209
msgid "Romanian"
msgstr ""
#: contact-form-7/includes/functions.php:210
msgid "Serbian"
msgstr ""
#: contact-form-7/includes/functions.php:211
msgid "Slovak"
msgstr ""
#: contact-form-7/includes/functions.php:212
msgid "Slovene"
msgstr ""
#: contact-form-7/includes/functions.php:213
msgid "Spanish"
msgstr ""
#: contact-form-7/includes/functions.php:214
msgid "Swedish"
msgstr ""
#: contact-form-7/includes/functions.php:215
msgid "Tamil"
msgstr ""
#: contact-form-7/includes/functions.php:216
msgid "Thai"
msgstr ""
#: contact-form-7/includes/functions.php:217
msgid "Turkish"
msgstr ""
#: contact-form-7/includes/functions.php:218
msgid "Ukrainian"
msgstr ""
#: contact-form-7/includes/functions.php:219
msgid "Vietnamese"
msgstr ""
#: contact-form-7/modules/acceptance.php:150
msgid "Acceptance"
msgstr ""
#: contact-form-7/modules/acceptance.php:159
#: contact-form-7/modules/captcha.php:202
#: contact-form-7/modules/checkbox.php:208
#: contact-form-7/modules/file.php:244
msgid "Name"
msgstr ""
#: contact-form-7/modules/acceptance.php:164
#: contact-form-7/modules/acceptance.php:167
#: contact-form-7/modules/captcha.php:209
#: contact-form-7/modules/captcha.php:212
#: contact-form-7/modules/captcha.php:217
#: contact-form-7/modules/captcha.php:220
#: contact-form-7/modules/captcha.php:224
#: contact-form-7/modules/captcha.php:235
#: contact-form-7/modules/captcha.php:238
#: contact-form-7/modules/captcha.php:243
#: contact-form-7/modules/captcha.php:246
#: contact-form-7/modules/checkbox.php:213
#: contact-form-7/modules/checkbox.php:216
#: contact-form-7/modules/file.php:249
#: contact-form-7/modules/file.php:252
#: contact-form-7/modules/file.php:257
#: contact-form-7/modules/file.php:260
msgid "optional"
msgstr ""
#: contact-form-7/modules/acceptance.php:173
msgid "Make this checkbox checked by default?"
msgstr ""
#: contact-form-7/modules/acceptance.php:174
msgid "Make this checkbox work inversely?"
msgstr ""
#: contact-form-7/modules/acceptance.php:175
msgid "* That means visitor who accepts the term unchecks it."
msgstr ""
#: contact-form-7/modules/acceptance.php:180
#: contact-form-7/modules/captcha.php:251
#: contact-form-7/modules/checkbox.php:236
#: contact-form-7/modules/file.php:265
msgid "Copy this code and paste it into the form left."
msgstr ""
#: contact-form-7/modules/captcha.php:66
msgid "To use CAPTCHA, you need <a href=\"http://wordpress.org/extend/plugins/really-simple-captcha/\">Really Simple CAPTCHA</a> plugin installed."
msgstr ""
#: contact-form-7/modules/captcha.php:177
msgid "The code that sender entered does not match the CAPTCHA"
msgstr ""
#: contact-form-7/modules/captcha.php:178
msgid "Your entered code is incorrect."
msgstr ""
#: contact-form-7/modules/captcha.php:188
msgid "CAPTCHA"
msgstr ""
#: contact-form-7/modules/captcha.php:199
msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
msgstr ""
#: contact-form-7/modules/captcha.php:206
msgid "Image settings"
msgstr ""
#: contact-form-7/modules/captcha.php:217
msgid "Foreground color"
msgstr ""
#: contact-form-7/modules/captcha.php:220
msgid "Background color"
msgstr ""
#: contact-form-7/modules/captcha.php:224
msgid "Image size"
msgstr ""
#: contact-form-7/modules/captcha.php:225
msgid "Small"
msgstr ""
#: contact-form-7/modules/captcha.php:226
msgid "Medium"
msgstr ""
#: contact-form-7/modules/captcha.php:227
msgid "Large"
msgstr ""
#: contact-form-7/modules/captcha.php:232
msgid "Input field settings"
msgstr ""
#: contact-form-7/modules/captcha.php:252
msgid "For image"
msgstr ""
#: contact-form-7/modules/captcha.php:254
msgid "For input field"
msgstr ""
#: contact-form-7/modules/captcha.php:284
#, php-format
msgid "This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually."
msgstr ""
#: contact-form-7/modules/captcha.php:290
msgid "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server."
msgstr ""
#: contact-form-7/modules/checkbox.php:181
msgid "Checkboxes"
msgstr ""
#: contact-form-7/modules/checkbox.php:184
msgid "Radio buttons"
msgstr ""
#: contact-form-7/modules/checkbox.php:205
#: contact-form-7/modules/file.php:243
msgid "Required field?"
msgstr ""
#: contact-form-7/modules/checkbox.php:221
msgid "Choices"
msgstr ""
#: contact-form-7/modules/checkbox.php:223
msgid "* One choice per line."
msgstr ""
#: contact-form-7/modules/checkbox.php:227
msgid "Put a label first, a checkbox last?"
msgstr ""
#: contact-form-7/modules/checkbox.php:228
msgid "Wrap each item with <label> tag?"
msgstr ""
#: contact-form-7/modules/checkbox.php:230
msgid "Make checkboxes exclusive?"
msgstr ""
#: contact-form-7/modules/checkbox.php:238
msgid "And, put this code into the Mail fields below."
msgstr ""
#: contact-form-7/modules/file.php:207
msgid "Uploading a file fails for any reason"
msgstr ""
#: contact-form-7/modules/file.php:208
msgid "Failed to upload file."
msgstr ""
#: contact-form-7/modules/file.php:212
msgid "Uploaded file is not allowed file type"
msgstr ""
#: contact-form-7/modules/file.php:213
msgid "This file type is not allowed."
msgstr ""
#: contact-form-7/modules/file.php:217
msgid "Uploaded file is too large"
msgstr ""
#: contact-form-7/modules/file.php:218
msgid "This file is too large."
msgstr ""
#: contact-form-7/modules/file.php:222
msgid "Uploading a file fails for PHP error"
msgstr ""
#: contact-form-7/modules/file.php:223
msgid "Failed to upload file. Error occurred."
msgstr ""
#: contact-form-7/modules/file.php:234
msgid "File upload"
msgstr ""
#: contact-form-7/modules/file.php:257
msgid "File size limit"
msgstr ""
#: contact-form-7/modules/file.php:257
msgid "bytes"
msgstr ""
#: contact-form-7/modules/file.php:260
msgid "Acceptable file types"
msgstr ""
#: contact-form-7/modules/file.php:267
msgid "And, put this code into the File Attachments field below."
msgstr ""
#: contact-form-7/modules/file.php:292
#, php-format
msgid "This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually."
msgstr ""
#: contact-form-7/modules/icl.php:74
msgid "This contact form contains [icl] tags, but they are obsolete and no longer functioning on this version of Contact Form 7. <a href=\"http://contactform7.com/2009/12/25/contact-form-in-your-language/#Creating_contact_form_in_different_languages\" target=\"_blank\">There is a simpler way for creating contact forms of other languages</a> and you are recommended to use it."
msgstr ""
#: contact-form-7/modules/quiz.php:160
msgid "Sender doesn't enter the correct answer to the quiz"
msgstr ""
#: contact-form-7/modules/quiz.php:161
msgid "Your answer is not correct."
msgstr ""
#: contact-form-7/modules/quiz.php:171
msgid "Quiz"
msgstr ""
#: contact-form-7/modules/quiz.php:201
msgid "Quizzes"
msgstr ""
#: contact-form-7/modules/quiz.php:203
msgid "* quiz|answer (e.g. 1+1=?|2)"
msgstr ""
#: contact-form-7/modules/select.php:150
msgid "Drop-down menu"
msgstr ""
#: contact-form-7/modules/select.php:179
msgid "Allow multiple selections?"
msgstr ""
#: contact-form-7/modules/select.php:180
msgid "Insert a blank item as the first option?"
msgstr ""
#: contact-form-7/modules/submit.php:54
msgid "Sending ..."
msgstr ""
#: contact-form-7/modules/submit.php:66
msgid "Submit button"
msgstr ""
#: contact-form-7/modules/submit.php:84
msgid "Label"
msgstr ""
#: contact-form-7/modules/text.php:138
msgid "Text field"
msgstr ""
#: contact-form-7/modules/text.php:141
msgid "Email field"
msgstr ""
#: contact-form-7/modules/text.php:183
msgid "Akismet"
msgstr ""
#: contact-form-7/modules/text.php:185
msgid "This field requires author's name"
msgstr ""
#: contact-form-7/modules/text.php:186
msgid "This field requires author's URL"
msgstr ""
#: contact-form-7/modules/text.php:188
msgid "This field requires author's email address"
msgstr ""
#: contact-form-7/modules/text.php:194
#: contact-form-7/modules/textarea.php:156
msgid "Default value"
msgstr ""
#: contact-form-7/modules/text.php:197
#: contact-form-7/modules/textarea.php:159
msgid "Use this text as watermark?"
msgstr ""
#: contact-form-7/modules/textarea.php:125
msgid "Text area"
msgstr ""

View File

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

View File

@ -0,0 +1,186 @@
<?php
/**
** A base module for [acceptance]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'acceptance', 'wpcf7_acceptance_shortcode_handler', true );
function wpcf7_acceptance_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 = '';
$tabindex_att = '';
$class_att .= ' wpcf7-acceptance';
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];
} elseif ( 'invert' == $option ) {
$class_att .= ' wpcf7-invert';
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
$default_on = (bool) preg_grep( '/^default:on$/i', $options );
$checked = $default_on ? ' checked="checked"' : '';
$html = '<input type="checkbox" name="' . $name . '" value="1"' . $atts . $checked . ' />';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Validation filter */
add_filter( 'wpcf7_validate_acceptance', 'wpcf7_acceptance_validation_filter', 10, 2 );
function wpcf7_acceptance_validation_filter( $result, $tag ) {
if ( ! wpcf7_acceptance_as_validation() )
return $result;
$name = $tag['name'];
if ( empty( $name ) )
return $result;
$options = (array) $tag['options'];
$value = $_POST[$name] ? 1 : 0;
$invert = (bool) preg_grep( '%^invert$%', $options );
if ( $invert && $value || ! $invert && ! $value ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'accept_terms' );
}
return $result;
}
/* Acceptance filter */
add_filter( 'wpcf7_acceptance', 'wpcf7_acceptance_filter' );
function wpcf7_acceptance_filter( $accepted ) {
$fes = wpcf7_scan_shortcode( array( 'type' => 'acceptance' ) );
foreach ( $fes as $fe ) {
$name = $fe['name'];
$options = (array) $fe['options'];
if ( empty( $name ) )
continue;
$value = $_POST[$name] ? 1 : 0;
$invert = (bool) preg_grep( '%^invert$%', $options );
if ( $invert && $value || ! $invert && ! $value )
$accepted = false;
}
return $accepted;
}
add_filter( 'wpcf7_form_class_attr', 'wpcf7_acceptance_form_class_attr' );
function wpcf7_acceptance_form_class_attr( $class ) {
if ( wpcf7_acceptance_as_validation() )
return $class . ' wpcf7-acceptance-as-validation';
return $class;
}
function wpcf7_acceptance_as_validation() {
if ( ! $contact_form = wpcf7_get_current_contact_form() )
return false;
$settings = $contact_form->additional_setting( 'acceptance_as_validation', false );
foreach ( $settings as $setting ) {
if ( in_array( $setting, array( 'on', 'true', '1' ) ) )
return true;
}
return false;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_acceptance', 35 );
function wpcf7_add_tag_generator_acceptance() {
wpcf7_add_tag_generator( 'acceptance', __( 'Acceptance', 'wpcf7' ),
'wpcf7-tg-pane-acceptance', 'wpcf7_tg_pane_acceptance' );
}
function wpcf7_tg_pane_acceptance( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-acceptance" class="hidden">
<form action="">
<table>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td colspan="2">
<br /><input type="checkbox" name="default:on" class="option" />&nbsp;<?php echo esc_html( __( "Make this checkbox checked by default?", 'wpcf7' ) ); ?>
<br /><input type="checkbox" name="invert" class="option" />&nbsp;<?php echo esc_html( __( "Make this checkbox work inversely?", 'wpcf7' ) ); ?>
<br /><span style="font-size: smaller;"><?php echo esc_html( __( "* That means visitor who accepts the term unchecks it.", 'wpcf7' ) ); ?></span>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="acceptance" class="tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,490 @@
<?php
/**
** A base module for [captchac] and [captchar]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'captchac', 'wpcf7_captcha_shortcode_handler', true );
wpcf7_add_shortcode( 'captchar', 'wpcf7_captcha_shortcode_handler', true );
function wpcf7_captcha_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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = '';
$id_att = '';
$class_att = '';
$size_att = '';
$maxlength_att = '';
$tabindex_att = '';
if ( 'captchac' == $type )
$class_att .= ' wpcf7-captcha-' . $name;
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];
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
$size_att = (int) $matches[1];
$maxlength_att = (int) $matches[2];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
// Value.
if ( ! wpcf7_is_posted() && isset( $values[0] ) )
$value = $values[0];
else
$value = '';
if ( 'captchac' == $type ) {
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
return '<em>' . __( 'To use CAPTCHA, you need <a href="http://wordpress.org/extend/plugins/really-simple-captcha/">Really Simple CAPTCHA</a> plugin installed.', 'wpcf7' ) . '</em>';
}
$op = array();
// Default
$op['img_size'] = array( 72, 24 );
$op['base'] = array( 6, 18 );
$op['font_size'] = 14;
$op['font_char_width'] = 15;
$op = array_merge( $op, wpcf7_captchac_options( $options ) );
if ( ! $filename = wpcf7_generate_captcha( $op ) )
return '';
if ( is_array( $op['img_size'] ) )
$atts .= ' width="' . $op['img_size'][0] . '" height="' . $op['img_size'][1] . '"';
$captcha_url = trailingslashit( wpcf7_captcha_tmp_url() ) . $filename;
$html = '<img alt="captcha" src="' . $captcha_url . '"' . $atts . ' />';
$ref = substr( $filename, 0, strrpos( $filename, '.' ) );
$html = '<input type="hidden" name="_wpcf7_captcha_challenge_' . $name . '" value="' . $ref . '" />' . $html;
return $html;
} elseif ( 'captchar' == $type ) {
if ( $size_att )
$atts .= ' size="' . $size_att . '"';
else
$atts .= ' size="40"'; // default size
if ( $maxlength_att )
$atts .= ' maxlength="' . $maxlength_att . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
}
/* Validation filter */
add_filter( 'wpcf7_validate_captchar', 'wpcf7_captcha_validation_filter', 10, 2 );
function wpcf7_captcha_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$_POST[$name] = (string) $_POST[$name];
$captchac = '_wpcf7_captcha_challenge_' . $name;
if ( ! wpcf7_check_captcha( $_POST[$captchac], $_POST[$name] ) ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'captcha_not_match' );
}
wpcf7_remove_captcha( $_POST[$captchac] );
return $result;
}
/* Ajax echo filter */
add_filter( 'wpcf7_ajax_onload', 'wpcf7_captcha_ajax_refill' );
add_filter( 'wpcf7_ajax_json_echo', 'wpcf7_captcha_ajax_refill' );
function wpcf7_captcha_ajax_refill( $items ) {
if ( ! is_array( $items ) )
return $items;
$fes = wpcf7_scan_shortcode( array( 'type' => 'captchac' ) );
if ( empty( $fes ) )
return $items;
$refill = array();
foreach ( $fes as $fe ) {
$name = $fe['name'];
$options = $fe['options'];
if ( empty( $name ) )
continue;
$op = wpcf7_captchac_options( $options );
if ( $filename = wpcf7_generate_captcha( $op ) ) {
$captcha_url = trailingslashit( wpcf7_captcha_tmp_url() ) . $filename;
$refill[$name] = $captcha_url;
}
}
if ( ! empty( $refill ) )
$items['captcha'] = $refill;
return $items;
}
/* Messages */
add_filter( 'wpcf7_messages', 'wpcf7_captcha_messages' );
function wpcf7_captcha_messages( $messages ) {
return array_merge( $messages, array( 'captcha_not_match' => array(
'description' => __( "The code that sender entered does not match the CAPTCHA", 'wpcf7' ),
'default' => __( 'Your entered code is incorrect.', 'wpcf7' )
) ) );
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_captcha', 45 );
function wpcf7_add_tag_generator_captcha() {
wpcf7_add_tag_generator( 'captcha', __( 'CAPTCHA', 'wpcf7' ),
'wpcf7-tg-pane-captcha', 'wpcf7_tg_pane_captcha' );
}
function wpcf7_tg_pane_captcha( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-captcha" class="hidden">
<form action="">
<table>
<?php if ( ! class_exists( 'ReallySimpleCaptcha' ) ) : ?>
<tr><td colspan="2"><strong style="color: #e6255b"><?php echo esc_html( __( "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed.", 'wpcf7' ) ); ?></strong><br /><a href="http://wordpress.org/extend/plugins/really-simple-captcha/">http://wordpress.org/extend/plugins/really-simple-captcha/</a></td></tr>
<?php endif; ?>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table class="scope captchac">
<caption><?php echo esc_html( __( "Image settings", 'wpcf7' ) ); ?></caption>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( "Foreground color", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="fg" class="color oneline option" /></td>
<td><?php echo esc_html( __( "Background color", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="bg" class="color oneline option" /></td>
</tr>
<tr><td colspan="2"><?php echo esc_html( __( "Image size", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="checkbox" name="size:s" class="exclusive option" />&nbsp;<?php echo esc_html( __( "Small", 'wpcf7' ) ); ?>&emsp;
<input type="checkbox" name="size:m" class="exclusive option" />&nbsp;<?php echo esc_html( __( "Medium", 'wpcf7' ) ); ?>&emsp;
<input type="checkbox" name="size:l" class="exclusive option" />&nbsp;<?php echo esc_html( __( "Large", 'wpcf7' ) ); ?>
</td></tr>
</table>
<table class="scope captchar">
<caption><?php echo esc_html( __( "Input field settings", 'wpcf7' ) ); ?></caption>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="size" class="numeric oneline option" /></td>
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="maxlength" class="numeric oneline option" /></td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?>
<br />1) <?php echo esc_html( __( "For image", 'wpcf7' ) ); ?>
<input type="text" name="captchac" class="tag" readonly="readonly" onfocus="this.select()" />
<br />2) <?php echo esc_html( __( "For input field", 'wpcf7' ) ); ?>
<input type="text" name="captchar" class="tag" readonly="readonly" onfocus="this.select()" />
</div>
</form>
</div>
<?php
}
/* Warning message */
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_captcha_display_warning_message' );
function wpcf7_captcha_display_warning_message( &$contact_form ) {
if ( ! $contact_form )
return;
$has_tags = (bool) $contact_form->form_scan_shortcode(
array( 'type' => array( 'captchac' ) ) );
if ( ! $has_tags )
return;
if ( ! class_exists( 'ReallySimpleCaptcha' ) )
return;
$uploads_dir = wpcf7_captcha_tmp_dir();
wpcf7_init_captcha();
if ( ! is_dir( $uploads_dir ) || ! is_writable( $uploads_dir ) ) {
$message = sprintf( __( 'This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'wpcf7' ), $uploads_dir );
echo '<div class="error"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
}
if ( ! function_exists( 'imagecreatetruecolor' ) || ! function_exists( 'imagettftext' ) ) {
$message = __( 'This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server.', 'wpcf7' );
echo '<div class="error"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
}
}
/* CAPTCHA functions */
function wpcf7_init_captcha() {
global $wpcf7_captcha;
if ( ! class_exists( 'ReallySimpleCaptcha' ) )
return false;
if ( ! is_object( $wpcf7_captcha ) )
$wpcf7_captcha = new ReallySimpleCaptcha();
$captcha =& $wpcf7_captcha;
$captcha->tmp_dir = trailingslashit( wpcf7_captcha_tmp_dir() );
wp_mkdir_p( $captcha->tmp_dir );
return true;
}
function wpcf7_captcha_tmp_dir() {
if ( defined( 'WPCF7_CAPTCHA_TMP_DIR' ) )
return WPCF7_CAPTCHA_TMP_DIR;
else
return wpcf7_upload_dir( 'dir' ) . '/wpcf7_captcha';
}
function wpcf7_captcha_tmp_url() {
if ( defined( 'WPCF7_CAPTCHA_TMP_URL' ) )
return WPCF7_CAPTCHA_TMP_URL;
else
return wpcf7_upload_dir( 'url' ) . '/wpcf7_captcha';
}
function wpcf7_generate_captcha( $options = null ) {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
$captcha =& $wpcf7_captcha;
if ( ! is_dir( $captcha->tmp_dir ) || ! is_writable( $captcha->tmp_dir ) )
return false;
$img_type = imagetypes();
if ( $img_type & IMG_PNG )
$captcha->img_type = 'png';
elseif ( $img_type & IMG_GIF )
$captcha->img_type = 'gif';
elseif ( $img_type & IMG_JPG )
$captcha->img_type = 'jpeg';
else
return false;
if ( is_array( $options ) ) {
if ( isset( $options['img_size'] ) )
$captcha->img_size = $options['img_size'];
if ( isset( $options['base'] ) )
$captcha->base = $options['base'];
if ( isset( $options['font_size'] ) )
$captcha->font_size = $options['font_size'];
if ( isset( $options['font_char_width'] ) )
$captcha->font_char_width = $options['font_char_width'];
if ( isset( $options['fg'] ) )
$captcha->fg = $options['fg'];
if ( isset( $options['bg'] ) )
$captcha->bg = $options['bg'];
}
$prefix = mt_rand();
$captcha_word = $captcha->generate_random_word();
return $captcha->generate_image( $prefix, $captcha_word );
}
function wpcf7_check_captcha( $prefix, $response ) {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
$captcha =& $wpcf7_captcha;
return $captcha->check( $prefix, $response );
}
function wpcf7_remove_captcha( $prefix ) {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
$captcha =& $wpcf7_captcha;
if ( preg_match( '/[^0-9]/', $prefix ) ) // Contact Form 7 generates $prefix with mt_rand()
return false;
$captcha->remove( $prefix );
}
function wpcf7_cleanup_captcha_files() {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
$captcha =& $wpcf7_captcha;
if ( is_callable( array( $captcha, 'cleanup' ) ) )
return $captcha->cleanup();
$dir = trailingslashit( wpcf7_captcha_tmp_dir() );
if ( ! is_dir( $dir ) || ! is_readable( $dir ) || ! is_writable( $dir ) )
return false;
if ( $handle = @opendir( $dir ) ) {
while ( false !== ( $file = readdir( $handle ) ) ) {
if ( ! preg_match( '/^[0-9]+\.(php|png|gif|jpeg)$/', $file ) )
continue;
$stat = @stat( $dir . $file );
if ( $stat['mtime'] + 3600 < time() ) // 3600 secs == 1 hour
@unlink( $dir . $file );
}
closedir( $handle );
}
}
if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
wpcf7_cleanup_captcha_files();
function wpcf7_captchac_options( $options ) {
if ( ! is_array( $options ) )
return array();
$op = array();
$image_size_array = preg_grep( '%^size:[smlSML]$%', $options );
if ( $image_size = array_shift( $image_size_array ) ) {
preg_match( '%^size:([smlSML])$%', $image_size, $is_matches );
switch ( strtolower( $is_matches[1] ) ) {
case 's':
$op['img_size'] = array( 60, 20 );
$op['base'] = array( 6, 15 );
$op['font_size'] = 11;
$op['font_char_width'] = 13;
break;
case 'l':
$op['img_size'] = array( 84, 28 );
$op['base'] = array( 6, 20 );
$op['font_size'] = 17;
$op['font_char_width'] = 19;
break;
case 'm':
default:
$op['img_size'] = array( 72, 24 );
$op['base'] = array( 6, 18 );
$op['font_size'] = 14;
$op['font_char_width'] = 15;
}
}
$fg_color_array = preg_grep( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options );
if ( $fg_color = array_shift( $fg_color_array ) ) {
preg_match( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $fg_color, $fc_matches );
if ( 3 == strlen( $fc_matches[1] ) ) {
$r = substr( $fc_matches[1], 0, 1 );
$g = substr( $fc_matches[1], 1, 1 );
$b = substr( $fc_matches[1], 2, 1 );
$op['fg'] = array( hexdec( $r . $r ), hexdec( $g . $g ), hexdec( $b . $b ) );
} elseif ( 6 == strlen( $fc_matches[1] ) ) {
$r = substr( $fc_matches[1], 0, 2 );
$g = substr( $fc_matches[1], 2, 2 );
$b = substr( $fc_matches[1], 4, 2 );
$op['fg'] = array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
}
}
$bg_color_array = preg_grep( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options );
if ( $bg_color = array_shift( $bg_color_array ) ) {
preg_match( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $bg_color, $bc_matches );
if ( 3 == strlen( $bc_matches[1] ) ) {
$r = substr( $bc_matches[1], 0, 1 );
$g = substr( $bc_matches[1], 1, 1 );
$b = substr( $bc_matches[1], 2, 1 );
$op['bg'] = array( hexdec( $r . $r ), hexdec( $g . $g ), hexdec( $b . $b ) );
} elseif ( 6 == strlen( $bc_matches[1] ) ) {
$r = substr( $bc_matches[1], 0, 2 );
$g = substr( $bc_matches[1], 2, 2 );
$b = substr( $bc_matches[1], 4, 2 );
$op['bg'] = array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
}
}
return $op;
}
$wpcf7_captcha = null;
?>

View File

@ -0,0 +1,246 @@
<?php
/**
** A base module for [checkbox], [checkbox*], and [radio]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'checkbox', 'wpcf7_checkbox_shortcode_handler', true );
wpcf7_add_shortcode( 'checkbox*', 'wpcf7_checkbox_shortcode_handler', true );
wpcf7_add_shortcode( 'radio', 'wpcf7_checkbox_shortcode_handler', true );
function wpcf7_checkbox_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$values = (array) $tag['values'];
$labels = (array) $tag['labels'];
if ( empty( $name ) )
return '';
$atts = '';
$id_att = '';
$class_att = '';
$tabindex_att = '';
$defaults = array();
$label_first = false;
$use_label_element = false;
if ( 'checkbox*' == $type )
$class_att .= ' wpcf7-validates-as-required';
if ( 'checkbox' == $type || 'checkbox*' == $type )
$class_att .= ' wpcf7-checkbox';
if ( 'radio' == $type )
$class_att .= ' wpcf7-radio';
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];
} elseif ( preg_match( '/^default:([0-9_]+)$/', $option, $matches ) ) {
$defaults = explode( '_', $matches[1] );
} elseif ( preg_match( '%^label[_-]?first$%', $option ) ) {
$label_first = true;
} elseif ( preg_match( '%^use[_-]?label[_-]?element$%', $option ) ) {
$use_label_element = true;
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
$multiple = false;
$exclusive = (bool) preg_grep( '%^exclusive$%', $options );
if ( 'checkbox' == $type || 'checkbox*' == $type ) {
$multiple = ! $exclusive;
} else { // radio
$exclusive = false;
}
if ( $exclusive )
$class_att .= ' wpcf7-exclusive-checkbox';
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
$html = '';
$input_type = rtrim( $type, '*' );
$posted = wpcf7_is_posted();
foreach ( $values as $key => $value ) {
$checked = false;
if ( $posted && ! empty( $_POST[$name] ) ) {
if ( $multiple && in_array( esc_sql( $value ), (array) $_POST[$name] ) )
$checked = true;
if ( ! $multiple && $_POST[$name] == esc_sql( $value ) )
$checked = true;
} else {
if ( in_array( $key + 1, (array) $defaults ) )
$checked = true;
}
$checked = $checked ? ' checked="checked"' : '';
if ( '' !== $tabindex_att ) {
$tabindex = sprintf( ' tabindex="%d"', $tabindex_att );
$tabindex_att += 1;
} else {
$tabindex = '';
}
if ( isset( $labels[$key] ) )
$label = $labels[$key];
else
$label = $value;
if ( $label_first ) { // put label first, input last
$item = '<span class="wpcf7-list-item-label">' . esc_html( $label ) . '</span>&nbsp;';
$item .= '<input type="' . $input_type . '" name="' . $name . ( $multiple ? '[]' : '' ) . '" value="' . esc_attr( $value ) . '"' . $checked . $tabindex . ' />';
} else {
$item = '<input type="' . $input_type . '" name="' . $name . ( $multiple ? '[]' : '' ) . '" value="' . esc_attr( $value ) . '"' . $checked . $tabindex . ' />';
$item .= '&nbsp;<span class="wpcf7-list-item-label">' . esc_html( $label ) . '</span>';
}
if ( $use_label_element )
$item = '<label>' . $item . '</label>';
$item = '<span class="wpcf7-list-item">' . $item . '</span>';
$html .= $item;
}
$html = '<span' . $atts . '>' . $html . '</span>';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Validation filter */
add_filter( 'wpcf7_validate_checkbox', 'wpcf7_checkbox_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_checkbox*', 'wpcf7_checkbox_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_radio', 'wpcf7_checkbox_validation_filter', 10, 2 );
function wpcf7_checkbox_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$values = $tag['values'];
if ( ! empty( $_POST[$name] ) ) {
if ( is_array( $_POST[$name] ) ) {
foreach ( $_POST[$name] as $key => $value ) {
$value = stripslashes( $value );
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
unset( $_POST[$name][$key] );
}
} else {
$value = stripslashes( $_POST[$name] );
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
$_POST[$name] = '';
}
}
if ( 'checkbox*' == $type ) {
if ( empty( $_POST[$name] ) ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
}
}
return $result;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_checkbox_and_radio', 30 );
function wpcf7_add_tag_generator_checkbox_and_radio() {
wpcf7_add_tag_generator( 'checkbox', __( 'Checkboxes', 'wpcf7' ),
'wpcf7-tg-pane-checkbox', 'wpcf7_tg_pane_checkbox' );
wpcf7_add_tag_generator( 'radio', __( 'Radio buttons', 'wpcf7' ),
'wpcf7-tg-pane-radio', 'wpcf7_tg_pane_radio' );
}
function wpcf7_tg_pane_checkbox( &$contact_form ) {
wpcf7_tg_pane_checkbox_and_radio( 'checkbox' );
}
function wpcf7_tg_pane_radio( &$contact_form ) {
wpcf7_tg_pane_checkbox_and_radio( 'radio' );
}
function wpcf7_tg_pane_checkbox_and_radio( $type = 'checkbox' ) {
if ( 'radio' != $type )
$type = 'checkbox';
?>
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
<form action="">
<table>
<?php if ( 'checkbox' == $type ) : ?>
<tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
<?php endif; ?>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Choices', 'wpcf7' ) ); ?><br />
<textarea name="values"></textarea><br />
<span style="font-size: smaller"><?php echo esc_html( __( "* One choice per line.", 'wpcf7' ) ); ?></span>
</td>
<td>
<br /><input type="checkbox" name="label_first" class="option" />&nbsp;<?php echo esc_html( __( 'Put a label first, a checkbox last?', 'wpcf7' ) ); ?>
<br /><input type="checkbox" name="use_label_element" class="option" />&nbsp;<?php echo esc_html( __( 'Wrap each item with <label> tag?', 'wpcf7' ) ); ?>
<?php if ( 'checkbox' == $type ) : ?>
<br /><input type="checkbox" name="exclusive" class="option" />&nbsp;<?php echo esc_html( __( 'Make checkboxes exclusive?', 'wpcf7' ) ); ?>
<?php endif; ?>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="<?php echo $type; ?>" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,349 @@
<?php
/**
** A base module for [file] and [file*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'file', 'wpcf7_file_shortcode_handler', true );
wpcf7_add_shortcode( 'file*', 'wpcf7_file_shortcode_handler', true );
function wpcf7_file_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 = '';
$tabindex_att = '';
$class_att .= ' wpcf7-file';
if ( 'file*' == $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];
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
$size_att = (int) $matches[1];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( $size_att )
$atts .= ' size="' . $size_att . '"';
else
$atts .= ' size="40"'; // default size
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
$html = '<input type="file" name="' . $name . '"' . $atts . ' value="1" />';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Encode type filter */
add_filter( 'wpcf7_form_enctype', 'wpcf7_file_form_enctype_filter' );
function wpcf7_file_form_enctype_filter( $enctype ) {
$multipart = (bool) wpcf7_scan_shortcode( array( 'type' => array( 'file', 'file*' ) ) );
if ( $multipart )
$enctype = ' enctype="multipart/form-data"';
return $enctype;
}
/* Validation + upload handling filter */
add_filter( 'wpcf7_validate_file', 'wpcf7_file_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_file*', 'wpcf7_file_validation_filter', 10, 2 );
function wpcf7_file_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$file = $_FILES[$name];
if ( $file['error'] && UPLOAD_ERR_NO_FILE != $file['error'] ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'upload_failed_php_error' );
return $result;
}
if ( empty( $file['tmp_name'] ) && 'file*' == $type ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
return $result;
}
if ( ! is_uploaded_file( $file['tmp_name'] ) )
return $result;
$file_type_pattern = '';
$allowed_size = 1048576; // default size 1 MB
foreach ( $options as $option ) {
if ( preg_match( '%^filetypes:(.+)$%', $option, $matches ) ) {
$file_types = explode( '|', $matches[1] );
foreach ( $file_types as $file_type ) {
$file_type = trim( $file_type, '.' );
$file_type = str_replace(
array( '.', '+', '*', '?' ), array( '\.', '\+', '\*', '\?' ), $file_type );
$file_type_pattern .= '|' . $file_type;
}
} elseif ( preg_match( '/^limit:([1-9][0-9]*)([kKmM]?[bB])?$/', $option, $matches ) ) {
$allowed_size = (int) $matches[1];
$kbmb = strtolower( $matches[2] );
if ( 'kb' == $kbmb ) {
$allowed_size *= 1024;
} elseif ( 'mb' == $kbmb ) {
$allowed_size *= 1024 * 1024;
}
}
}
/* File type validation */
// Default file-type restriction
if ( '' == $file_type_pattern )
$file_type_pattern = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
$file_type_pattern = trim( $file_type_pattern, '|' );
$file_type_pattern = '(' . $file_type_pattern . ')';
$file_type_pattern = '/\.' . $file_type_pattern . '$/i';
if ( ! preg_match( $file_type_pattern, $file['name'] ) ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'upload_file_type_invalid' );
return $result;
}
/* File size validation */
if ( $file['size'] > $allowed_size ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'upload_file_too_large' );
return $result;
}
$uploads_dir = wpcf7_upload_tmp_dir();
wpcf7_init_uploads(); // Confirm upload dir
$filename = $file['name'];
// If you get script file, it's a danger. Make it TXT file.
if ( preg_match( '/\.(php|pl|py|rb|cgi)\d?$/', $filename ) )
$filename .= '.txt';
// foo.php.jpg => foo.php_.jpg
$filename = wpcf7_sanitize_file_name( $filename );
$filename = wp_unique_filename( $uploads_dir, $filename );
$new_file = trailingslashit( $uploads_dir ) . $filename;
if ( false === @move_uploaded_file( $file['tmp_name'], $new_file ) ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'upload_failed' );
return $result;
}
// Make sure the uploaded file is only readable for the owner process
@chmod( $new_file, 0400 );
if ( $contact_form = wpcf7_get_current_contact_form() )
$contact_form->uploaded_files[$name] = $new_file;
if ( ! isset( $_POST[$name] ) )
$_POST[$name] = $filename;
return $result;
}
/* Messages */
add_filter( 'wpcf7_messages', 'wpcf7_file_messages' );
function wpcf7_file_messages( $messages ) {
return array_merge( $messages, array(
'upload_failed' => array(
'description' => __( "Uploading a file fails for any reason", 'wpcf7' ),
'default' => __( 'Failed to upload file.', 'wpcf7' )
),
'upload_file_type_invalid' => array(
'description' => __( "Uploaded file is not allowed file type", 'wpcf7' ),
'default' => __( 'This file type is not allowed.', 'wpcf7' )
),
'upload_file_too_large' => array(
'description' => __( "Uploaded file is too large", 'wpcf7' ),
'default' => __( 'This file is too large.', 'wpcf7' )
),
'upload_failed_php_error' => array(
'description' => __( "Uploading a file fails for PHP error", 'wpcf7' ),
'default' => __( 'Failed to upload file. Error occurred.', 'wpcf7' )
)
) );
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_file', 50 );
function wpcf7_add_tag_generator_file() {
wpcf7_add_tag_generator( 'file', __( 'File upload', 'wpcf7' ),
'wpcf7-tg-pane-file', 'wpcf7_tg_pane_file' );
}
function wpcf7_tg_pane_file( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-file" class="hidden">
<form action="">
<table>
<tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( "File size limit", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'bytes', 'wpcf7' ) ); ?>) (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="limit" class="filesize oneline option" /></td>
<td><?php echo esc_html( __( "Acceptable file types", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="filetypes" class="filetype oneline option" /></td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="file" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the File Attachments field below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
/* Warning message */
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_file_display_warning_message' );
function wpcf7_file_display_warning_message( &$contact_form ) {
if ( ! $contact_form )
return;
$has_tags = (bool) $contact_form->form_scan_shortcode(
array( 'type' => array( 'file', 'file*' ) ) );
if ( ! $has_tags )
return;
$uploads_dir = wpcf7_upload_tmp_dir();
wpcf7_init_uploads();
if ( ! is_dir( $uploads_dir ) || ! is_writable( $uploads_dir ) ) {
$message = sprintf( __( 'This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'wpcf7' ), $uploads_dir );
echo '<div class="error"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
}
}
/* File uploading functions */
function wpcf7_init_uploads() {
$dir = wpcf7_upload_tmp_dir();
wp_mkdir_p( trailingslashit( $dir ) );
@chmod( $dir, 0733 );
$htaccess_file = trailingslashit( $dir ) . '.htaccess';
if ( file_exists( $htaccess_file ) )
return;
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
fwrite( $handle, "Deny from all\n" );
fclose( $handle );
}
}
function wpcf7_upload_tmp_dir() {
if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) )
return WPCF7_UPLOADS_TMP_DIR;
else
return wpcf7_upload_dir( 'dir' ) . '/wpcf7_uploads';
}
function wpcf7_cleanup_upload_files() {
$dir = trailingslashit( wpcf7_upload_tmp_dir() );
if ( ! is_dir( $dir ) )
return false;
if ( ! is_readable( $dir ) )
return false;
if ( ! is_writable( $dir ) )
return false;
if ( $handle = @opendir( $dir ) ) {
while ( false !== ( $file = readdir( $handle ) ) ) {
if ( $file == "." || $file == ".." || $file == ".htaccess" )
continue;
$stat = stat( $dir . $file );
if ( $stat['mtime'] + 60 < time() ) // 60 secs
@unlink( $dir . $file );
}
closedir( $handle );
}
}
if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
wpcf7_cleanup_upload_files();
?>

View File

@ -0,0 +1,79 @@
<?php
/**
** Note: This ICL module is obsolete and no longer functioning on this version.
** There is a simpler way for creating contact forms of other languages.
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'icl', 'icl_wpcf7_shortcode_handler', true );
function icl_wpcf7_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$name = $tag['name'];
$values = (array) $tag['values'];
$content = $tag['content'];
// Just return the content.
$content = trim( $content );
if ( ! empty( $content ) )
return $content;
$value = trim( $values[0] );
if ( ! empty( $value ) )
return $value;
return '';
}
/* Message dispaly filter */
add_filter( 'wpcf7_display_message', 'icl_wpcf7_display_message_filter' );
function icl_wpcf7_display_message_filter( $message ) {
$shortcode_manager = new WPCF7_ShortcodeManager();
$shortcode_manager->add_shortcode( 'icl', 'icl_wpcf7_shortcode_handler', true );
return $shortcode_manager->do_shortcode( $message );
}
/* Warning message */
add_action( 'wpcf7_admin_before_subsubsub', 'icl_wpcf7_display_warning_message' );
function icl_wpcf7_display_warning_message( &$contact_form ) {
if ( ! $contact_form )
return;
$has_icl_tags = (bool) $contact_form->form_scan_shortcode(
array( 'type' => array( 'icl' ) ) );
if ( ! $has_icl_tags ) {
$messages = (array) $contact_form->messages;
$shortcode_manager = new WPCF7_ShortcodeManager();
$shortcode_manager->add_shortcode( 'icl', create_function( '$tag', 'return null;' ), true );
foreach ( $messages as $message ) {
if ( $shortcode_manager->scan_shortcode( $message ) ) {
$has_icl_tags = true;
break;
}
}
}
if ( ! $has_icl_tags )
return;
$message = __( "This contact form contains [icl] tags, but they are obsolete and no longer functioning on this version of Contact Form 7. <a href=\"http://contactform7.com/2009/12/25/contact-form-in-your-language/#Creating_contact_form_in_different_languages\" target=\"_blank\">There is a simpler way for creating contact forms of other languages</a> and you are recommended to use it.", 'wpcf7' );
echo '<div class="error"><p><strong>' . $message . '</strong></p></div>';
}
?>

View File

@ -0,0 +1,214 @@
<?php
/**
** A base module for [quiz]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'quiz', 'wpcf7_quiz_shortcode_handler', true );
function wpcf7_quiz_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$pipes = $tag['pipes'];
if ( empty( $name ) )
return '';
$atts = '';
$id_att = '';
$class_att = '';
$size_att = '';
$maxlength_att = '';
$tabindex_att = '';
$class_att .= ' wpcf7-quiz';
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];
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
$size_att = (int) $matches[1];
$maxlength_att = (int) $matches[2];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( $size_att )
$atts .= ' size="' . $size_att . '"';
else
$atts .= ' size="40"'; // default size
if ( $maxlength_att )
$atts .= ' maxlength="' . $maxlength_att . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
if ( is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
$pipe = $pipes->random_pipe();
$question = $pipe->before;
$answer = $pipe->after;
} else {
// default quiz
$question = '1+1=?';
$answer = '2';
}
$answer = wpcf7_canonicalize( $answer );
$html = '<span class="wpcf7-quiz-label">' . esc_html( $question ) . '</span>&nbsp;';
$html .= '<input type="text" name="' . $name . '"' . $atts . ' />';
$html .= '<input type="hidden" name="_wpcf7_quiz_answer_' . $name . '" value="' . wp_hash( $answer, 'wpcf7_quiz' ) . '" />';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Validation filter */
add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 );
function wpcf7_quiz_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$answer = wpcf7_canonicalize( $_POST[$name] );
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
$expected_hash = $_POST['_wpcf7_quiz_answer_' . $name];
if ( $answer_hash != $expected_hash ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'quiz_answer_not_correct' );
}
return $result;
}
/* Ajax echo filter */
add_filter( 'wpcf7_ajax_onload', 'wpcf7_quiz_ajax_refill' );
add_filter( 'wpcf7_ajax_json_echo', 'wpcf7_quiz_ajax_refill' );
function wpcf7_quiz_ajax_refill( $items ) {
if ( ! is_array( $items ) )
return $items;
$fes = wpcf7_scan_shortcode( array( 'type' => 'quiz' ) );
if ( empty( $fes ) )
return $items;
$refill = array();
foreach ( $fes as $fe ) {
$name = $fe['name'];
$pipes = $fe['pipes'];
if ( empty( $name ) )
continue;
if ( is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
$pipe = $pipes->random_pipe();
$question = $pipe->before;
$answer = $pipe->after;
} else {
// default quiz
$question = '1+1=?';
$answer = '2';
}
$answer = wpcf7_canonicalize( $answer );
$refill[$name] = array( $question, wp_hash( $answer, 'wpcf7_quiz' ) );
}
if ( ! empty( $refill ) )
$items['quiz'] = $refill;
return $items;
}
/* Messages */
add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages' );
function wpcf7_quiz_messages( $messages ) {
return array_merge( $messages, array( 'quiz_answer_not_correct' => array(
'description' => __( "Sender doesn't enter the correct answer to the quiz", 'wpcf7' ),
'default' => __( 'Your answer is not correct.', 'wpcf7' )
) ) );
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_quiz', 40 );
function wpcf7_add_tag_generator_quiz() {
wpcf7_add_tag_generator( 'quiz', __( 'Quiz', 'wpcf7' ),
'wpcf7-tg-pane-quiz', 'wpcf7_tg_pane_quiz' );
}
function wpcf7_tg_pane_quiz( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-quiz" class="hidden">
<form action="">
<table>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="size" class="numeric oneline option" /></td>
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="maxlength" class="numeric oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Quizzes', 'wpcf7' ) ); ?><br />
<textarea name="values"></textarea><br />
<span style="font-size: smaller"><?php echo esc_html( __( "* quiz|answer (e.g. 1+1=?|2)", 'wpcf7' ) ); ?></span>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="quiz" class="tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,17 @@
<?php
/**
** A base module for [response]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'response', 'wpcf7_response_shortcode_handler' );
function wpcf7_response_shortcode_handler( $tag ) {
if ( $contact_form = wpcf7_get_current_contact_form() ) {
$contact_form->responses_count += 1;
return $contact_form->form_response_output();
}
}
?>

View File

@ -0,0 +1,195 @@
<?php
/**
** A base module for [select] and [select*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'select', 'wpcf7_select_shortcode_handler', true );
wpcf7_add_shortcode( 'select*', 'wpcf7_select_shortcode_handler', true );
function wpcf7_select_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$values = (array) $tag['values'];
$labels = (array) $tag['labels'];
if ( empty( $name ) )
return '';
$atts = '';
$id_att = '';
$class_att = '';
$tabindex_att = '';
$defaults = array();
$class_att .= ' wpcf7-select';
if ( 'select*' == $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];
} elseif ( preg_match( '/^default:([0-9_]+)$/', $option, $matches ) ) {
$defaults = explode( '_', $matches[1] );
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
$multiple = (bool) preg_grep( '%^multiple$%', $options );
$include_blank = (bool) preg_grep( '%^include_blank$%', $options );
$empty_select = empty( $values );
if ( $empty_select || $include_blank ) {
array_unshift( $labels, '---' );
array_unshift( $values, '---' );
}
$html = '';
$posted = wpcf7_is_posted();
foreach ( $values as $key => $value ) {
$selected = false;
if ( $posted && ! empty( $_POST[$name] ) ) {
if ( $multiple && in_array( esc_sql( $value ), (array) $_POST[$name] ) )
$selected = true;
if ( ! $multiple && $_POST[$name] == esc_sql( $value ) )
$selected = true;
} else {
if ( ! $empty_select && in_array( $key + 1, (array) $defaults ) )
$selected = true;
}
$selected = $selected ? ' selected="selected"' : '';
if ( isset( $labels[$key] ) )
$label = $labels[$key];
else
$label = $value;
$html .= '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . esc_html( $label ) . '</option>';
}
if ( $multiple )
$atts .= ' multiple="multiple"';
$html = '<select name="' . $name . ( $multiple ? '[]' : '' ) . '"' . $atts . '>' . $html . '</select>';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Validation filter */
add_filter( 'wpcf7_validate_select', 'wpcf7_select_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_select*', 'wpcf7_select_validation_filter', 10, 2 );
function wpcf7_select_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$values = $tag['values'];
if ( ! empty( $_POST[$name] ) ) {
if ( is_array( $_POST[$name] ) ) {
foreach ( $_POST[$name] as $key => $value ) {
$value = stripslashes( $value );
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
unset( $_POST[$name][$key] );
}
} else {
$value = stripslashes( $_POST[$name] );
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
$_POST[$name] = '';
}
}
if ( 'select*' == $type ) {
if ( empty( $_POST[$name] ) ||
! is_array( $_POST[$name] ) && '---' == $_POST[$name] ||
is_array( $_POST[$name] ) && 1 == count( $_POST[$name] ) && '---' == $_POST[$name][0] ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
}
}
return $result;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_menu', 25 );
function wpcf7_add_tag_generator_menu() {
wpcf7_add_tag_generator( 'menu', __( 'Drop-down menu', 'wpcf7' ),
'wpcf7-tg-pane-menu', 'wpcf7_tg_pane_menu' );
}
function wpcf7_tg_pane_menu( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-menu" class="hidden">
<form action="">
<table>
<tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Choices', 'wpcf7' ) ); ?><br />
<textarea name="values"></textarea><br />
<span style="font-size: smaller"><?php echo esc_html( __( "* One choice per line.", 'wpcf7' ) ); ?></span>
</td>
<td>
<br /><input type="checkbox" name="multiple" class="option" />&nbsp;<?php echo esc_html( __( 'Allow multiple selections?', 'wpcf7' ) ); ?>
<br /><input type="checkbox" name="include_blank" class="option" />&nbsp;<?php echo esc_html( __( 'Insert a blank item as the first option?', 'wpcf7' ) ); ?>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="select" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,73 @@
<?php
/**
** Filters for Special Mail Tags
**/
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag', 10, 2 );
function wpcf7_special_mail_tag( $output, $name ) {
// For backwards compat.
$name = preg_replace( '/^wpcf7\./', '_', $name );
if ( '_remote_ip' == $name )
$output = preg_replace( '/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR'] );
elseif ( '_url' == $name ) {
$url = untrailingslashit( home_url() );
$url = preg_replace( '%(?<!:|/)/.*$%', '', $url );
$url .= wpcf7_get_request_uri();
$output = $url;
}
elseif ( '_date' == $name )
$output = date_i18n( get_option( 'date_format' ) );
elseif ( '_time' == $name )
$output = date_i18n( get_option( 'time_format' ) );
return $output;
}
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag_for_post_data', 10, 2 );
function wpcf7_special_mail_tag_for_post_data( $output, $name ) {
if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
return $output;
if ( ! preg_match( '/^wpcf7-f(\d+)-p(\d+)-o(\d+)$/', $_POST['_wpcf7_unit_tag'], $matches ) )
return $output;
$post_id = (int) $matches[2];
if ( ! $post = get_post( $post_id ) )
return $output;
$user = new WP_User( $post->post_author );
// For backwards compat.
$name = preg_replace( '/^wpcf7\./', '_', $name );
if ( '_post_id' == $name )
$output = (string) $post->ID;
elseif ( '_post_name' == $name )
$output = $post->post_name;
elseif ( '_post_title' == $name )
$output = $post->post_title;
elseif ( '_post_url' == $name )
$output = get_permalink( $post->ID );
elseif ( '_post_author' == $name )
$output = $user->display_name;
elseif ( '_post_author_email' == $name )
$output = $user->user_email;
return $output;
}
?>

View File

@ -0,0 +1,97 @@
<?php
/**
** A base module for [submit]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'submit', 'wpcf7_submit_shortcode_handler' );
function wpcf7_submit_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$options = (array) $tag['options'];
$values = (array) $tag['values'];
$atts = '';
$id_att = '';
$class_att = '';
$tabindex_att = '';
$class_att .= ' wpcf7-submit';
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];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
$value = isset( $values[0] ) ? $values[0] : '';
if ( empty( $value ) )
$value = __( 'Send', 'wpcf7' );
$html = '<input type="submit" value="' . esc_attr( $value ) . '"' . $atts . ' />';
if ( wpcf7_script_is() ) {
$src = apply_filters( 'wpcf7_ajax_loader', wpcf7_plugin_url( 'images/ajax-loader.gif' ) );
$html .= '<img class="ajax-loader" style="visibility: hidden;" alt="' . esc_attr( __( 'Sending ...', 'wpcf7' ) ) . '" src="' . esc_url_raw( $src ) . '" />';
}
return $html;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_submit', 55 );
function wpcf7_add_tag_generator_submit() {
wpcf7_add_tag_generator( 'submit', __( 'Submit button', 'wpcf7' ),
'wpcf7-tg-pane-submit', 'wpcf7_tg_pane_submit', array( 'nameless' => 1 ) );
}
function wpcf7_tg_pane_submit( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-submit" class="hidden">
<form action="">
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Label', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="values" class="oneline" /></td>
<td></td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="submit" class="tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,210 @@
<?php
/**
** A base module for [text], [text*], [email], and [email*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'text', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'text*', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'email', 'wpcf7_text_shortcode_handler', true );
wpcf7_add_shortcode( 'email*', 'wpcf7_text_shortcode_handler', true );
function wpcf7_text_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-text';
if ( 'email' == $type || 'email*' == $type )
$class_att .= ' wpcf7-validates-as-email';
if ( 'text*' == $type || 'email*' == $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];
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
$size_att = (int) $matches[1];
$maxlength_att = (int) $matches[2];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
$value = (string) reset( $values );
if ( wpcf7_script_is() && 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 )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( $size_att )
$atts .= ' size="' . $size_att . '"';
else
$atts .= ' size="40"'; // default size
if ( $maxlength_att )
$atts .= ' maxlength="' . $maxlength_att . '"';
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
if ( $title_att )
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_att ) ) );
$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Validation filter */
add_filter( 'wpcf7_validate_text', 'wpcf7_text_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_text*', 'wpcf7_text_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_email', 'wpcf7_text_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_email*', 'wpcf7_text_validation_filter', 10, 2 );
function wpcf7_text_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
if ( 'text*' == $type ) {
if ( '' == $_POST[$name] ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
}
}
if ( 'email' == $type || 'email*' == $type ) {
if ( 'email*' == $type && '' == $_POST[$name] ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
} elseif ( '' != $_POST[$name] && ! is_email( $_POST[$name] ) ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_email' );
}
}
return $result;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_text_and_email', 15 );
function wpcf7_add_tag_generator_text_and_email() {
wpcf7_add_tag_generator( 'text', __( 'Text field', 'wpcf7' ),
'wpcf7-tg-pane-text', 'wpcf7_tg_pane_text' );
wpcf7_add_tag_generator( 'email', __( 'Email field', 'wpcf7' ),
'wpcf7-tg-pane-email', 'wpcf7_tg_pane_email' );
}
function wpcf7_tg_pane_text( &$contact_form ) {
wpcf7_tg_pane_text_and_email( 'text' );
}
function wpcf7_tg_pane_email( &$contact_form ) {
wpcf7_tg_pane_text_and_email( 'email' );
}
function wpcf7_tg_pane_text_and_email( $type = 'text' ) {
if ( 'email' != $type )
$type = 'text';
?>
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
<form action="">
<table>
<tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="size" class="numeric oneline option" /></td>
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="maxlength" class="numeric oneline option" /></td>
</tr>
<tr>
<td colspan="2"><?php echo esc_html( __( 'Akismet', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<?php if ( 'text' == $type ) : ?>
<input type="checkbox" name="akismet:author" class="exclusive option" />&nbsp;<?php echo esc_html( __( "This field requires author's name", 'wpcf7' ) ); ?><br />
<input type="checkbox" name="akismet:author_url" class="exclusive option" />&nbsp;<?php echo esc_html( __( "This field requires author's URL", 'wpcf7' ) ); ?>
<?php else : ?>
<input type="checkbox" name="akismet:author_email" class="option" />&nbsp;<?php echo esc_html( __( "This field requires author's email address", 'wpcf7' ) ); ?>
<?php endif; ?>
</td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
<td>
<br /><input type="checkbox" name="watermark" class="option" />&nbsp;<?php echo esc_html( __( 'Use this text as watermark?', 'wpcf7' ) ); ?>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="<?php echo $type; ?>" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,172 @@
<?php
/**
** A base module for [textarea] and [textarea*]
**/
/* Shortcode handler */
wpcf7_add_shortcode( 'textarea', 'wpcf7_textarea_shortcode_handler', true );
wpcf7_add_shortcode( 'textarea*', 'wpcf7_textarea_shortcode_handler', true );
function wpcf7_textarea_shortcode_handler( $tag ) {
if ( ! is_array( $tag ) )
return '';
$type = $tag['type'];
$name = $tag['name'];
$options = (array) $tag['options'];
$values = (array) $tag['values'];
$content = $tag['content'];
if ( empty( $name ) )
return '';
$atts = '';
$id_att = '';
$class_att = '';
$cols_att = '';
$rows_att = '';
$tabindex_att = '';
$title_att = '';
if ( 'textarea*' == $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];
} elseif ( preg_match( '%^([0-9]*)[x/]([0-9]*)$%', $option, $matches ) ) {
$cols_att = (int) $matches[1];
$rows_att = (int) $matches[2];
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
$tabindex_att = (int) $matches[1];
}
}
$value = (string) reset( $values );
if ( ! empty( $content ) )
$value = $content;
if ( wpcf7_script_is() && 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 )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
if ( $cols_att )
$atts .= ' cols="' . $cols_att . '"';
else
$atts .= ' cols="40"'; // default size
if ( $rows_att )
$atts .= ' rows="' . $rows_att . '"';
else
$atts .= ' rows="10"'; // default size
if ( '' !== $tabindex_att )
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
if ( $title_att )
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_att ) ) );
$html = '<textarea name="' . $name . '"' . $atts . '>' . esc_html( $value ) . '</textarea>';
$validation_error = wpcf7_get_validation_error( $name );
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
return $html;
}
/* Validation filter */
add_filter( 'wpcf7_validate_textarea', 'wpcf7_textarea_validation_filter', 10, 2 );
add_filter( 'wpcf7_validate_textarea*', 'wpcf7_textarea_validation_filter', 10, 2 );
function wpcf7_textarea_validation_filter( $result, $tag ) {
$type = $tag['type'];
$name = $tag['name'];
$_POST[$name] = (string) $_POST[$name];
if ( 'textarea*' == $type ) {
if ( '' == $_POST[$name] ) {
$result['valid'] = false;
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
}
}
return $result;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_textarea', 20 );
function wpcf7_add_tag_generator_textarea() {
wpcf7_add_tag_generator( 'textarea', __( 'Text area', 'wpcf7' ),
'wpcf7-tg-pane-textarea', 'wpcf7_tg_pane_textarea' );
}
function wpcf7_tg_pane_textarea( &$contact_form ) {
?>
<div id="wpcf7-tg-pane-textarea" class="hidden">
<form action="">
<table>
<tr><td><input type="checkbox" name="required" />&nbsp;<?php echo esc_html( __( 'Required field?', 'wpcf7' ) ); ?></td></tr>
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
</table>
<table>
<tr>
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="id" class="idvalue oneline option" /></td>
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="class" class="classvalue oneline option" /></td>
</tr>
<tr>
<td><code>cols</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="cols" class="numeric oneline option" /></td>
<td><code>rows</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
<input type="text" name="rows" class="numeric oneline option" /></td>
</tr>
<tr>
<td><?php echo esc_html( __( 'Default value', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br /><input type="text" name="values" class="oneline" /></td>
<td>
<br /><input type="checkbox" name="watermark" class="option" />&nbsp;<?php echo esc_html( __( 'Use this text as watermark?', 'wpcf7' ) ); ?>
</td>
</tr>
</table>
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="textarea" class="tag" readonly="readonly" onfocus="this.select()" /></div>
<div class="tg-mail-tag"><?php echo esc_html( __( "And, put this code into the Mail fields below.", 'wpcf7' ) ); ?><br /><span class="arrow">&#11015;</span>&nbsp;<input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
</form>
</div>
<?php
}
?>

View File

@ -0,0 +1,153 @@
=== Contact Form 7 ===
Contributors: takayukister
Donate link: http://contactform7.com/donate/
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
Requires at least: 2.9
Tested up to: 3.1.2
Stable tag: 2.4.4
Just another contact form plugin. Simple but flexible.
== Description ==
Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on.
= Plugin's Official Site =
Contact Form 7 ([http://contactform7.com](http://contactform7.com/))
* [Docs](http://contactform7.com/docs/) - [FAQ](http://contactform7.com/faq/) - [Support](http://contactform7.com/support/)
= Contact Form 7 Needs Your Support =
It is hard to continue development and support for this plugin without contributions from users like you. If you enjoy using Contact Form 7 and find it useful, please consider [__making a donation__](http://contactform7.com/donate/). Your donation will help encourage and support the plugin's continued development and better user support.
= Translators =
* Afrikaans (af) - [Schalk Burger](http://www.schalkburger.za.net/)
* Albanian (sq) - [Olgi Zenullari](http://www.olgizenullari.com/)
* Arabic (ar) - [Tarek Chaaban](http://www.chaaban.info/), Muhammed Lardi, [Yaser Mohammed](http://www.englize.com/)
* Armenian (hy_AM) - [Emmanuelle Traduction](http://www.translatonline.com/)
* Bangla (bn_BD) - [SM Mehdi Akram](http://www.shamokaldarpon.com/)
* Bosnian (bs) - [Vedran](http://www.seorabbit.com/)
* Brazilian Portuguese (pt_BR) - [Leonardo Pinheiro](http://www.eletrikabarbarella.com.br/), [Henrique Vianna](http://henriquevianna.com/), [Caciano Gabriel Batista](http://www.gn10.com.br/), [Gervásio Antônio](http://twitter.com/gervasioantonio)
* Bulgarian (bg_BG) - [Iliyan Darganov](http://www.darganov.com/)
* Catalan (ca) - [Jordi Sancho](http://www.qasolutions.net/blog), Robert Buj
* Chinese, Simplified (zh_CN) - [Soz](http://www.webtoolol.com/), [Keefe Dunn](http://dengkefu.com/)
* Chinese, Traditional (zh_TW) - [James Wu](http://jameswublog.com)
* Croatian (hr) - [tolingo Translation Services](http://www.tolingo.com)
* Czech (cs_CZ) - Korry, [Radovan Fiser](http://algymsa.cz/), [Tomas Vesely](http://www.mcmotylek.cz/)
* Danish (da_DK) - [Jens Griebel](http://www.kompas-it.dk/), [Georg S. Adamsen](http://wordpress.blogos.dk/)
* Dutch (nl_NL) - [Chris Devriese](http://www.100it.be/), [Martin Hein](http://www.split-a-pixel.nl/), [Rene](http://wpwebshop.com/)
* Estonian (et) - [Peeter Rahuvarm](http://www.kraabus.ee), Egon Elbre
* Finnish (fi) - [Miika Turunen](http://www.webwork.fi/), [Mediajalostamo](http://www.mediajalostamo.fi/)
* French (fr_FR) - [Jillij](http://www.jillij.com/), [Oncle Tom](http://case.oncle-tom.net/), [Maître Mô](http://maitremo.fr/)
* Galician (gl_ES) - [Arume Desenvolvementos Informáticos](http://www.arumeinformatica.es/)
* Georgian (ka_GE) - [Nodar Davituri](http://omedia.ge/)
* German (de_DE) - [Marcel Spitau](http://blog.spitau.de), [Ivan Graf](http://blog.bildergallery.com/)
* Greek (el) - [Nick Mouratidis](http://www.kepik.gr/), [Pr. friedlich](http://friedlich.wordpress.com/)
* Hebrew (he_IL) - [Yaron Ofer](http://www.gadgetguru.co.il/)
* Hindi (hi_IN) - [Tarun Joshi](http://www.readers-cafe.net/), [Ashish](http://outshinesolutions.com/)
* Hungarian (hu_HU) - [Andras Hirschler](http://hia.itblog.hu/), [János Csárdi-Braunstein](http://blogocska.org/), [Farkas Győző](http://www.sakraft.hu/)
* Indonesian (id_ID) - [Hendry Lee](http://blogbuildingu.com/)
* Italian (it_IT) - [Bruno](http://www.brunosalzano.com), [Gianni Diurno](http://gidibao.net/)
* Japanese (ja) - [Takayuki Miyoshi](http://ideasilo.wordpress.com)
* Korean (ko_KR) - Seong Eun Lee, [Jong-In Kim](http://incommunity.codex.kr/wordpress/)
* Latvian (lv) - [Sandis Veinbergs](http://www.kleofass.lv/)
* Lithuanian (lt_LT) - [Ernestas Kardzys](http://www.ernestas.info/)
* Macedonian (mk_MK) - [Darko](http://www.findermind.com/)
* Malay (ms_MY) - [Zairul Azmil](http://www.zairul.com/)
* Malayalam (ml_IN) - [RAHUL.S.A](http://www.infution.co.cc/)
* Norwegian (nb_NO) - Kjetil M. Bergem, [aanvik.net](http://www.aanvik.net), [Peter Holme](http://holme.se/nettsteder/)
* Persian (Farsi; fa_IR) - [Mohammad Musavi](http://www.musavis.com/)
* Polish (pl_PL) - [Zbigniew Czernik](http://zibik.jogger.pl/), [Daniel Fruzynski](http://www.poradnik-webmastera.com), [RafalDesign](http://www.rafaldesign.pl/)
* Portuguese (pt_PT) - [Hugo Baeta](http://hugobaeta.com)
* Russian (ru_RU) - Dmitry Volotovich, [Denis Voituk](http://artprima.cz/)
* Romanian (ro_RO) - [Stas Sushkov](http://stas.nerd.ro/), [Anunturi Jibo](http://www.jibo.ro/)
* Serbian (sr_RS) - [Vedran](http://www.seorabbit.com/), [Aleksandar Urošević](http://blog.urosevic.net/)
* Sinhala (si_LK) - [Nitin Aggarwal](http://offshoreally.com/)
* Slovak (sk) - [Patrik Bóna](http://www.mrhead.sk/)
* Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net)
* Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog), [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/), [Matias Baldanza](http://matiasbaldanza.com/)
* Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/), [the Swedish community](http://wp-support.se/)
* Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
* Thai (th) - [kazama](http://blog.wordthai.com/)
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/)
* Ukrainian (uk) - [Andrey Kovba](http://myserver.com.ua/), [Ukrainian WordPress localization team](http://wordpress.co.ua/plugins/contact-form-7.html)
* Vietnamese (vi) - Thanh Hải, Hà
If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can [download the latest POT file from here](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot).
== Installation ==
1. Upload the entire `contact-form-7` folder to the `/wp-content/plugins/` directory.
1. Activate the plugin through the 'Plugins' menu in WordPress.
You will find 'Contact' menu in your WordPress admin panel.
For basic usage, you can also have a look at the [plugin homepage](http://contactform7.com/).
== Frequently Asked Questions ==
Do you have questions or issues with Contact Form 7? Use these support channels appropriately.
1. [Docs](http://contactform7.com/docs/)
1. [FAQ](http://contactform7.com/faq/)
1. [Support Forum](http://wordpress.org/tags/contact-form-7?forum_id=10)
1. [WordPress HelpCenter](http://wphelpcenter.com/)
[Support](http://contactform7.com/support/)
== Screenshots ==
1. screenshot-1.png
== Changelog ==
= 2.4.5 =
* Fixed the bug that makes it not accept "0" value as watermark.
* Fixed too much normalization to form-tag shortcode with content.
* Fixed wrong regexp pattern for form-tag shortcode with content.
* Check $_POST of checkboxes and select menus to avoid warnings.
* Use proper action hook for enqueueing scripts: wp_enqueue_scripts and admin_enqueue_scripts.
* Bundled jquery.form has been updated to 2.72.
* Translations for Czech (Tomas Vesely) has been updated.
= 2.4.4 =
* Translation for Sinhala has been created by Nitin Aggarwal.
* Translations for German (Ivan Graf), Russian (Denis Voituk), Simplified Chinese (Keefe Dunn) and Polish (RafalDesign) have been updated.
* Fixed wrong [_url] special mail tag output.
= 2.4.3 =
* Translation for Armenian has been created by Emmanuelle Traduction.
* Translation for Tamil has been created by Nitin Aggarwal.
* Translations for German (Ivan Graf), Dutch (Rene), Arabic (Yaser Mohammed) and Romanian (Anunturi Jibo) have been updated.
* Bundled jquery.form has been updated to 2.52.
= 2.4.2 =
* Translation for Macedonian has been created by Darko.
* Translation for Malay has been created by Zairul Azmil.
* Translations for Danish (Georg S. Adamsen), French (Maître Mô), German (Ivan Graf), Latvian (Sandis Veinbergs) and Persian (Mohammad Musavi) have been updated.
= 2.4.1 =
* Fixed a bug causing fatal error on WordPress 2.9.
* Translations for Norwegian (Peter Holme) and Italian (Gianni Diurno) have been updated.
= 2.4 =
* Moved PO files to the external branch. They were space-consuming and enlarging the plugin package.
* Added an option for size attribute of &lt;input type="file"&gt;.
* Added 'acceptance_as_validation' additional setting. This setting allows you to use acceptance checkbox as object of validation.
* Added watermark support to text, email and textarea tags.
* Use the latest jQuery Form plugin instead of the old one which WordPress bundles.
[Releases](http://contactform7.com/category/releases/)
== Upgrade Notice ==
The required WordPress version has been changed and now requires WordPress 2.9 or higher. If you use WordPress 2.8, you will need to upgrade WordPress.

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 KiB

View File

@ -0,0 +1,198 @@
(function($) {
$(function() {
try {
if (typeof _wpcf7 == 'undefined' || _wpcf7 === null)
_wpcf7 = {};
_wpcf7 = $.extend({ cached: 0 }, _wpcf7);
$('div.wpcf7 > form').ajaxForm({
beforeSubmit: function(formData, jqForm, options) {
jqForm.wpcf7ClearResponseOutput();
jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
return true;
},
beforeSerialize: function(jqForm, options) {
jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
$(n).val('');
});
return true;
},
data: { '_wpcf7_is_ajax_call': 1 },
dataType: 'json',
success: function(data) {
var ro = $(data.into).find('div.wpcf7-response-output');
$(data.into).wpcf7ClearResponseOutput();
if (data.invalids) {
$.each(data.invalids, function(i, n) {
$(data.into).find(n.into).wpcf7NotValidTip(n.message);
});
ro.addClass('wpcf7-validation-errors');
}
if (data.captcha)
$(data.into).wpcf7RefillCaptcha(data.captcha);
if (data.quiz)
$(data.into).wpcf7RefillQuiz(data.quiz);
if (1 == data.spam)
ro.addClass('wpcf7-spam-blocked');
if (1 == data.mailSent) {
$(data.into).find('form').resetForm().clearForm();
ro.addClass('wpcf7-mail-sent-ok');
if (data.onSentOk)
$.each(data.onSentOk, function(i, n) { eval(n) });
} else {
ro.addClass('wpcf7-mail-sent-ng');
}
if (data.onSubmit)
$.each(data.onSubmit, function(i, n) { eval(n) });
$(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
$(n).val($(n).attr('title'));
});
ro.append(data.message).slideDown('fast');
}
});
$('div.wpcf7 > form').each(function(i, n) {
if (_wpcf7.cached)
$(n).wpcf7OnloadRefill();
$(n).wpcf7ToggleSubmit();
$(n).find('.wpcf7-acceptance').click(function() {
$(n).wpcf7ToggleSubmit();
});
$(n).find('.wpcf7-exclusive-checkbox').each(function(i, n) {
$(n).find('input:checkbox').click(function() {
$(n).find('input:checkbox').not(this).removeAttr('checked');
});
});
$(n).find('.wpcf7-use-title-as-watermark').each(function(i, n) {
var input = $(n);
input.val(input.attr('title'));
input.addClass('watermark');
input.focus(function() {
if ($(this).hasClass('watermark'))
$(this).val('').removeClass('watermark');
});
input.blur(function() {
if ('' == $(this).val())
$(this).val($(this).attr('title')).addClass('watermark');
});
});
});
} catch (e) {
}
});
$.fn.wpcf7ToggleSubmit = function() {
return this.each(function() {
var form = $(this);
if (this.tagName.toLowerCase() != 'form')
form = $(this).find('form').first();
if (form.hasClass('wpcf7-acceptance-as-validation'))
return;
var submit = form.find('input:submit');
if (! submit.length) return;
var acceptances = form.find('input:checkbox.wpcf7-acceptance');
if (! acceptances.length) return;
submit.removeAttr('disabled');
acceptances.each(function(i, n) {
n = $(n);
if (n.hasClass('wpcf7-invert') && n.is(':checked')
|| ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
submit.attr('disabled', 'disabled');
});
});
};
$.fn.wpcf7NotValidTip = function(message) {
return this.each(function() {
var into = $(this);
into.append('<span class="wpcf7-not-valid-tip">' + message + '</span>');
$('span.wpcf7-not-valid-tip').mouseover(function() {
$(this).fadeOut('fast');
});
into.find(':input').mouseover(function() {
into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
});
into.find(':input').focus(function() {
into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
});
});
};
$.fn.wpcf7OnloadRefill = function() {
return this.each(function() {
var url = $(this).attr('action');
if (0 < url.indexOf('#'))
url = url.substr(0, url.indexOf('#'));
var id = $(this).find('input[name="_wpcf7"]').val();
var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val();
$.getJSON(url,
{ _wpcf7_is_ajax_call: 1, _wpcf7: id },
function(data) {
if (data && data.captcha)
$('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
if (data && data.quiz)
$('#' + unitTag).wpcf7RefillQuiz(data.quiz);
}
);
});
};
$.fn.wpcf7RefillCaptcha = function(captcha) {
return this.each(function() {
var form = $(this);
$.each(captcha, function(i, n) {
form.find(':input[name="' + i + '"]').clearFields();
form.find('img.wpcf7-captcha-' + i).attr('src', n);
var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
});
});
};
$.fn.wpcf7RefillQuiz = function(quiz) {
return this.each(function() {
var form = $(this);
$.each(quiz, function(i, n) {
form.find(':input[name="' + i + '"]').clearFields();
form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
});
});
};
$.fn.wpcf7ClearResponseOutput = function() {
return this.each(function() {
$(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
$(this).find('span.wpcf7-not-valid-tip').remove();
$(this).find('img.ajax-loader').css({ visibility: 'hidden' });
});
};
})(jQuery);

View File

@ -0,0 +1,111 @@
<?php
function wpcf7_plugin_path( $path = '' ) {
return path_join( WPCF7_PLUGIN_DIR, trim( $path, '/' ) );
}
function wpcf7_plugin_url( $path = '' ) {
return plugins_url( $path, WPCF7_PLUGIN_BASENAME );
}
function wpcf7_admin_url( $query = array() ) {
global $plugin_page;
if ( ! isset( $query['page'] ) )
$query['page'] = $plugin_page;
$path = 'admin.php';
if ( $query = build_query( $query ) )
$path .= '?' . $query;
$url = admin_url( $path );
return esc_url_raw( $url );
}
function wpcf7_table_exists( $table = 'contactforms' ) {
global $wpdb, $wpcf7;
if ( 'contactforms' != $table )
return false;
if ( ! $table = $wpcf7->{$table} )
return false;
return strtolower( $wpdb->get_var( "SHOW TABLES LIKE '$table'" ) ) == strtolower( $table );
}
function wpcf7() {
global $wpdb, $wpcf7;
if ( is_object( $wpcf7 ) )
return;
$wpcf7 = (object) array(
'contactforms' => $wpdb->prefix . "contact_form_7",
'processing_within' => '',
'widget_count' => 0,
'unit_count' => 0,
'global_unit_count' => 0 );
}
wpcf7();
require_once WPCF7_PLUGIN_DIR . '/includes/functions.php';
require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php';
require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php';
require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php';
require_once WPCF7_PLUGIN_DIR . '/includes/classes.php';
require_once WPCF7_PLUGIN_DIR . '/includes/taggenerator.php';
if ( is_admin() )
require_once WPCF7_PLUGIN_DIR . '/admin/admin.php';
else
require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
function wpcf7_contact_forms() {
global $wpdb, $wpcf7;
return $wpdb->get_results( "SELECT cf7_unit_id as id, title FROM $wpcf7->contactforms" );
}
add_action( 'plugins_loaded', 'wpcf7_set_request_uri', 9 );
function wpcf7_set_request_uri() {
global $wpcf7_request_uri;
$wpcf7_request_uri = add_query_arg( array() );
}
function wpcf7_get_request_uri() {
global $wpcf7_request_uri;
return (string) $wpcf7_request_uri;
}
/* Loading modules */
add_action( 'plugins_loaded', 'wpcf7_load_modules', 1 );
function wpcf7_load_modules() {
$dir = WPCF7_PLUGIN_MODULES_DIR;
if ( ! ( is_dir( $dir ) && $dh = opendir( $dir ) ) )
return false;
while ( ( $module = readdir( $dh ) ) !== false ) {
if ( substr( $module, -4 ) == '.php' )
include_once $dir . '/' . $module;
}
}
/* L10N */
add_action( 'init', 'wpcf7_load_plugin_textdomain' );
function wpcf7_load_plugin_textdomain() {
load_plugin_textdomain( 'wpcf7', false, 'contact-form-7/languages' );
}
?>

Some files were not shown because too many files have changed in this diff Show More