Tarea #1007 -> Hacer página de "contact us" con formulario

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@120 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-24 11:41:35 +00:00
parent 0243f1b34b
commit 2956df8f6b
105 changed files with 8995 additions and 0 deletions

View File

@ -0,0 +1,52 @@
<?php
function wpcf7_current_action() {
if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] )
return $_REQUEST['action'];
if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] )
return $_REQUEST['action2'];
return false;
}
function wpcf7_admin_has_edit_cap() {
return current_user_can( 'wpcf7_edit_contact_forms' );
}
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_tag_generators() {
global $wpcf7_tag_generators;
$taggenerators = array();
foreach ( (array) $wpcf7_tag_generators as $name => $tg ) {
$taggenerators[$name] = array_merge(
(array) $tg['options'],
array( 'title' => $tg['title'], 'content' => $tg['content'] ) );
}
return $taggenerators;
}
?>

View File

@ -0,0 +1,487 @@
<?php
require_once WPCF7_PLUGIN_DIR . '/admin/admin-functions.php';
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
function wpcf7_admin_menu() {
add_object_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
'wpcf7_read_contact_forms', 'wpcf7', 'wpcf7_admin_management_page',
wpcf7_plugin_url( 'admin/images/menu-icon.png' ) );
$contact_form_admin = add_submenu_page( 'wpcf7',
__( 'Edit Contact Forms', 'wpcf7' ), __( 'Edit', 'wpcf7' ),
'wpcf7_read_contact_forms', 'wpcf7', 'wpcf7_admin_management_page' );
add_action( 'load-' . $contact_form_admin, 'wpcf7_load_contact_form_admin' );
}
add_filter( 'set-screen-option', 'wpcf7_set_screen_options', 10, 3 );
function wpcf7_set_screen_options( $result, $option, $value ) {
$wpcf7_screens = array(
'cfseven_contact_forms_per_page' );
if ( in_array( $option, $wpcf7_screens ) )
$result = $value;
return $result;
}
function wpcf7_load_contact_form_admin() {
global $wpcf7_contact_form;
$action = wpcf7_current_action();
if ( 'save' == $action ) {
$id = $_POST['post_ID'];
check_admin_referer( 'wpcf7-save-contact-form_' . $id );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) )
wp_die( __( 'You are not allowed to edit this item.', 'wpcf7' ) );
if ( ! $contact_form = wpcf7_contact_form( $id ) ) {
$contact_form = new WPCF7_ContactForm();
$contact_form->initial = true;
}
$contact_form->title = trim( $_POST['wpcf7-title'] );
$form = trim( $_POST['wpcf7-form'] );
$mail = array(
'subject' => trim( $_POST['wpcf7-mail-subject'] ),
'sender' => trim( $_POST['wpcf7-mail-sender'] ),
'body' => trim( $_POST['wpcf7-mail-body'] ),
'recipient' => trim( $_POST['wpcf7-mail-recipient'] ),
'additional_headers' => trim( $_POST['wpcf7-mail-additional-headers'] ),
'attachments' => trim( $_POST['wpcf7-mail-attachments'] ),
'use_html' =>
isset( $_POST['wpcf7-mail-use-html'] ) && 1 == $_POST['wpcf7-mail-use-html']
);
$mail_2 = array(
'active' =>
isset( $_POST['wpcf7-mail-2-active'] ) && 1 == $_POST['wpcf7-mail-2-active'],
'subject' => trim( $_POST['wpcf7-mail-2-subject'] ),
'sender' => trim( $_POST['wpcf7-mail-2-sender'] ),
'body' => trim( $_POST['wpcf7-mail-2-body'] ),
'recipient' => trim( $_POST['wpcf7-mail-2-recipient'] ),
'additional_headers' => trim( $_POST['wpcf7-mail-2-additional-headers'] ),
'attachments' => trim( $_POST['wpcf7-mail-2-attachments'] ),
'use_html' =>
isset( $_POST['wpcf7-mail-2-use-html'] ) && 1 == $_POST['wpcf7-mail-2-use-html']
);
$messages = isset( $contact_form->messages ) ? $contact_form->messages : array();
foreach ( wpcf7_messages() as $key => $arr ) {
$field_name = 'wpcf7-message-' . strtr( $key, '_', '-' );
if ( isset( $_POST[$field_name] ) )
$messages[$key] = trim( $_POST[$field_name] );
}
$additional_settings = trim( $_POST['wpcf7-additional-settings'] );
$props = apply_filters( 'wpcf7_contact_form_admin_posted_properties',
compact( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ) );
foreach ( (array) $props as $key => $prop )
$contact_form->{$key} = $prop;
$query = array();
$query['message'] = ( $contact_form->initial ) ? 'created' : 'saved';
$contact_form->save();
$query['post'] = $contact_form->id;
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
exit();
}
if ( 'copy' == $action ) {
$id = empty( $_POST['post_ID'] )
? absint( $_REQUEST['post'] )
: absint( $_POST['post_ID'] );
check_admin_referer( 'wpcf7-copy-contact-form_' . $id );
if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) )
wp_die( __( 'You are not allowed to edit this item.', 'wpcf7' ) );
$query = array();
if ( $contact_form = wpcf7_contact_form( $id ) ) {
$new_contact_form = $contact_form->copy();
$new_contact_form->save();
$query['post'] = $new_contact_form->id;
$query['message'] = 'created';
} else {
$query['post'] = $contact_form->id;
}
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
exit();
}
if ( 'delete' == $action ) {
if ( ! empty( $_POST['post_ID'] ) )
check_admin_referer( 'wpcf7-delete-contact-form_' . $_POST['post_ID'] );
elseif ( ! is_array( $_REQUEST['post'] ) )
check_admin_referer( 'wpcf7-delete-contact-form_' . $_REQUEST['post'] );
else
check_admin_referer( 'bulk-posts' );
$posts = empty( $_POST['post_ID'] )
? (array) $_REQUEST['post']
: (array) $_POST['post_ID'];
$deleted = 0;
foreach ( $posts as $post ) {
$post = new WPCF7_ContactForm( $post );
if ( empty( $post ) )
continue;
if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id ) )
wp_die( __( 'You are not allowed to delete this item.', 'wpcf7' ) );
if ( ! $post->delete() )
wp_die( __( 'Error in deleting.', 'wpcf7' ) );
$deleted += 1;
}
$query = array();
if ( ! empty( $deleted ) )
$query['message'] = 'deleted';
$redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) );
wp_safe_redirect( $redirect_to );
exit();
}
$_GET['post'] = isset( $_GET['post'] ) ? $_GET['post'] : '';
$post = null;
if ( 'new' == $_GET['post'] && current_user_can( 'wpcf7_edit_contact_forms' ) )
$post = wpcf7_get_contact_form_default_pack(
array( 'locale' => ( isset( $_GET['locale'] ) ? $_GET['locale'] : '' ) ) );
elseif ( ! empty( $_GET['post'] ) )
$post = wpcf7_contact_form( $_GET['post'] );
if ( $post && current_user_can( 'wpcf7_edit_contact_form', $post->id ) ) {
wpcf7_add_meta_boxes( $post->id );
} else {
$current_screen = get_current_screen();
if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) )
require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php';
add_filter( 'manage_' . $current_screen->id . '_columns',
array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ) );
add_screen_option( 'per_page', array(
'label' => __( 'Contact Forms', 'wpcf7' ),
'default' => 20,
'option' => 'cfseven_contact_forms_per_page' ) );
}
$wpcf7_contact_form = $post;
}
add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' );
function wpcf7_admin_enqueue_scripts( $hook_suffix ) {
if ( false === strpos( $hook_suffix, 'wpcf7' ) )
return;
wp_enqueue_style( 'contact-form-7-admin',
wpcf7_plugin_url( 'admin/css/styles.css' ),
array( 'thickbox' ), WPCF7_VERSION, 'all' );
if ( wpcf7_is_rtl() ) {
wp_enqueue_style( 'contact-form-7-admin-rtl',
wpcf7_plugin_url( 'admin/css/styles-rtl.css' ),
array(), WPCF7_VERSION, 'all' );
}
wp_enqueue_script( 'wpcf7-admin-taggenerator',
wpcf7_plugin_url( 'admin/js/taggenerator.js' ),
array( 'jquery' ), WPCF7_VERSION, true );
wp_enqueue_script( 'wpcf7-admin',
wpcf7_plugin_url( 'admin/js/scripts.js' ),
array( 'jquery', 'thickbox', 'postbox', 'wpcf7-admin-taggenerator' ),
WPCF7_VERSION, true );
$current_screen = get_current_screen();
wp_localize_script( 'wpcf7-admin', '_wpcf7', array(
'screenId' => $current_screen->id,
'generateTag' => __( 'Generate Tag', 'wpcf7' ),
'pluginUrl' => wpcf7_plugin_url(),
'tagGenerators' => wpcf7_tag_generators() ) );
}
add_action( 'admin_print_footer_scripts', 'wpcf7_print_taggenerators_json', 20 );
function wpcf7_print_taggenerators_json() { // for backward compatibility
global $plugin_page, $wpcf7_tag_generators;
if ( ! version_compare( get_bloginfo( 'version' ), '3.3-dev', '<' ) )
return;
if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
return;
$taggenerators = array();
foreach ( (array) $wpcf7_tag_generators as $name => $tg ) {
$taggenerators[$name] = array_merge(
(array) $tg['options'],
array( 'title' => $tg['title'], 'content' => $tg['content'] ) );
}
?>
<script type="text/javascript">
/* <![CDATA[ */
_wpcf7.tagGenerators = <?php echo json_encode( $taggenerators ) ?>;
/* ]]> */
</script>
<?php
}
function wpcf7_admin_management_page() {
global $wpcf7_contact_form;
if ( $wpcf7_contact_form ) {
$post =& $wpcf7_contact_form;
$post_id = $post->initial ? -1 : $post->id;
require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
return;
}
$list_table = new WPCF7_Contact_Form_List_Table();
$list_table->prepare_items();
?>
<div class="wrap">
<?php screen_icon(); ?>
<h2><?php
echo esc_html( __( 'Contact Form 7', 'wpcf7' ) );
echo ' <a href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal" class="add-new-h2 thickbox">' . esc_html( __( 'Add New', 'wpcf7' ) ) . '</a>';
if ( ! empty( $_REQUEST['s'] ) ) {
echo sprintf( '<span class="subtitle">'
. __( 'Search results for &#8220;%s&#8221;', 'wpcf7' )
. '</span>', esc_html( $_REQUEST['s'] ) );
}
?></h2>
<?php do_action( 'wpcf7_admin_notices' ); ?>
<form method="get" action="">
<input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" />
<?php $list_table->search_box( __( 'Search Contact Forms', 'wpcf7' ), 'wpcf7-contact' ); ?>
<?php $list_table->display(); ?>
</form>
</div>
<?php
wpcf7_admin_lang_select_modal();
}
function wpcf7_admin_lang_select_modal() {
$available_locales = wpcf7_l10n();
$default_locale = get_locale();
if ( ! isset( $available_locales[$default_locale] ) )
$default_locale = 'en_US';
?>
<div id="wpcf7-lang-select-modal" class="hidden">
<h4><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'wpcf7' ), $available_locales[$default_locale] ) ); ?></h4>
<p><a href="<?php echo esc_url( add_query_arg( array( 'post' => 'new' ), menu_page_url( 'wpcf7', false ) ) ); ?>" 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="post" 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
}
function wpcf7_add_meta_boxes( $post_id ) {
add_meta_box( 'formdiv', __( 'Form', 'wpcf7' ),
'wpcf7_form_meta_box', null, 'form', 'core' );
add_meta_box( 'maildiv', __( 'Mail', 'wpcf7' ),
'wpcf7_mail_meta_box', null, 'mail', 'core' );
add_meta_box( 'mail2div', __( 'Mail (2)', 'wpcf7' ),
'wpcf7_mail_meta_box', null, 'mail_2', 'core',
array(
'id' => 'wpcf7-mail-2',
'name' => 'mail_2',
'use' => __( 'Use mail (2)', 'wpcf7' ) ) );
add_meta_box( 'messagesdiv', __( 'Messages', 'wpcf7' ),
'wpcf7_messages_meta_box', null, 'messages', 'core' );
add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'wpcf7' ),
'wpcf7_additional_settings_meta_box', null, 'additional_settings', 'core' );
do_action( 'wpcf7_add_meta_boxes', $post_id );
}
/* Misc */
add_action( 'wpcf7_admin_notices', 'wpcf7_admin_before_subsubsub' );
function wpcf7_admin_before_subsubsub() {
// wpcf7_admin_before_subsubsub is deprecated. Use wpcf7_admin_notices instead.
$current_screen = get_current_screen();
if ( 'toplevel_page_wpcf7' != $current_screen->id )
return;
if ( empty( $_GET['post'] ) || ! $contact_form = wpcf7_contact_form( $_GET['post'] ) )
return;
do_action_ref_array( 'wpcf7_admin_before_subsubsub', array( &$contact_form ) );
}
add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message' );
function wpcf7_admin_updated_message() {
if ( empty( $_REQUEST['message'] ) )
return;
if ( 'created' == $_REQUEST['message'] )
$updated_message = esc_html( __( 'Contact form created.', 'wpcf7' ) );
elseif ( 'saved' == $_REQUEST['message'] )
$updated_message = esc_html( __( 'Contact form saved.', 'wpcf7' ) );
elseif ( 'deleted' == $_REQUEST['message'] )
$updated_message = esc_html( __( 'Contact form deleted.', 'wpcf7' ) );
if ( empty( $updated_message ) )
return;
?>
<div id="message" class="updated"><p><?php echo $updated_message; ?></p></div>
<?php
}
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;
$settings_link = '<a href="' . menu_page_url( 'wpcf7', false ) . '">'
. esc_html( __( 'Settings', 'wpcf7' ) ) . '</a>';
array_unshift( $links, $settings_link );
return $links;
}
add_action( 'wpcf7_admin_notices', 'wpcf7_cf7com_links', 9 );
function wpcf7_cf7com_links() {
$links = '<div class="cf7com-links">'
. '<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_notices', 'wpcf7_donation_link' );
function wpcf7_donation_link() {
if ( ! WPCF7_SHOW_DONATION_LINK )
return;
if ( ! empty( $_REQUEST['post'] ) && 'new' == $_REQUEST['post'] )
return;
if ( ! empty( $_REQUEST['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
}
add_action( 'admin_notices', 'wpcf7_old_wp_version_error', 9 );
function wpcf7_old_wp_version_error() {
global $plugin_page;
if ( 'wpcf7' != $plugin_page )
return;
$wp_version = get_bloginfo( 'version' );
if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) )
return;
?>
<div class="error">
<p><?php echo sprintf( __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'wpcf7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) ); ?></p>
</div>
<?php
}
?>

View File

@ -0,0 +1,21 @@
div.save-contact-form {
direction: rtl;
}
div.actions-link {
right: auto;
left: 0;
}
div.tg-pane table caption {
text-align: right;
}
div.tg-dropdown {
left: auto;
right: 0;
}
div.wrap div.cf7com-links {
text-align: left;
}

View File

@ -0,0 +1,260 @@
#icon-wpcf7 {
background: transparent url(../images/screen-icon.png) no-repeat 2px 1px;
}
div.wrap div.cf7com-links {
text-align: right;
font-size: .9em;
margin: -2em 1em 1em 0;
}
div.wrap div.cf7com-links a {
text-decoration: none;
font-weight: bold;
}
div.wrap div.donation {
border-width: 1px;
border-style: solid;
padding: 0 0.6em;
margin: 5px 0 15px;
-webkit-border-radius: 3px;
border-radius: 3px;
background-color: #ffffe0;
border-color: #e6db55;
}
div.wrap div.donation p {
margin: .7em 0;
line-height: 1;
padding: 2px;
font-size: 107%;
}
div.wrap div.donation p a {
color: #3f3f3f;
text-decoration: none;
}
div.wrap div.donation p a.button {
margin-left: 1em;
font-weight: bold;
}
#titlediv {
margin-bottom: 20px;
position: relative;
border: 1px solid #c7c7c7;
padding: 6px;
}
div.save-contact-form {
padding: 1.4em 0 0 0;
text-align: right;
}
div.actions-link {
position: absolute;
top: 0;
right: 0;
margin: 0;
padding: 6px;
}
div.actions-link input {
padding: 0;
margin: 0;
border: none;
font-size: 11px;
cursor: pointer;
}
div.actions-link input.copy {
color: #006505;
}
div.actions-link input.delete {
color: #bc0b0b;
}
input#wpcf7-title {
color: #555;
border: none;
font: bold 20px serif;
cursor: pointer;
background-color: transparent;
}
input#wpcf7-title.focus {
color: #333;
border: 1px solid #777;
font: normal 13px Verdana, Arial, Helvetica, sans-serif;
cursor: text;
background-color: transparent;
}
input#wpcf7-title.mouseover {
background-color: #ffffdd;
}
p.tagcode {
color: #333;
margin: 2ex 0 1ex 0;
}
input#contact-form-anchor-text, input#contact-form-anchor-text-old {
color: #fff;
background: #7e4e0b;
border: none;
width: 100%;
-webkit-border-radius: 6px;
border-radius: 6px;
}
.postbox .half, .postbox .half-left, .postbox .half-right {
float: left;
width: 50%;
}
.postbox .half-right > * {
margin-left: 10px;
}
.postbox .mail-field, .postbox .message-field {
margin-top: 6px;
margin-bottom: 8px;
}
.postbox .mail-field label, .postbox .message-field label {
line-height: 1.4em;
}
div.pseudo-hr {
border-bottom: 1px solid transparent;
margin: 8px 0;
}
input, textarea {
border: 1px solid #dfdfdf;
}
input.wide {
width: 100%;
}
textarea {
width: 100%;
}
label.disabled {
color: #777;
}
div.tag-generator {
position: relative;
background: transparent;
padding: 0 0 5px 1px;
}
div.tg-pane {
border: 1px dashed #999;
background: #f1f1f1;
margin: 1ex 0 0 0;
padding: 10px;
-webkit-border-radius: 6px;
border-radius: 6px;
line-height: 140%;
}
div.tg-pane table {
width: 100%;
margin: 0 0 0.7em 0;
}
div.tg-pane table caption {
text-align: left;
padding: 0 0 0.2em 0;
font-weight: bolder;
color: #777;
}
div.tg-pane table code {
background-color: inherit;
}
div.tg-pane table td {
vertical-align: top;
width: 50%;
border: none;
padding: 2px 0;
}
div.tg-pane input.tag, div.tg-pane input.mail-tag {
width: 100%;
border: none;
color: #fff;
background-color: #7e4e0b;
-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;
}
input.shortcode-in-list-table {
width: 100%;
border: none;
}

View File

@ -0,0 +1,118 @@
<?php
// don't load directly
if ( ! defined( 'ABSPATH' ) )
die( '-1' );
?><div class="wrap">
<?php screen_icon(); ?>
<h2><?php
echo esc_html( __( 'Contact Form 7', 'wpcf7' ) );
if ( ! $post->initial ) {
echo ' <a href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal" class="add-new-h2 thickbox">' . esc_html( __( 'Add New', 'wpcf7' ) ) . '</a>';
}
?></h2>
<?php do_action( 'wpcf7_admin_notices' ); ?>
<br class="clear" />
<?php
if ( $post ) :
if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) )
$disabled = '';
else
$disabled = ' disabled="disabled"';
?>
<form method="post" action="<?php echo esc_url( add_query_arg( array( 'post' => $post_id ), menu_page_url( 'wpcf7', false ) ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>>
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) )
wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id ); ?>
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $post_id; ?>" />
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $post->id, '_old_cf7_unit_id', true ); ?>" />
<input type="hidden" id="hiddenaction" name="action" value="save" />
<div id="poststuff" class="metabox-holder">
<div id="titlediv">
<input type="text" id="wpcf7-title" name="wpcf7-title" size="40" value="<?php echo esc_attr( $post->title ); ?>"<?php echo $disabled; ?> />
<?php if ( ! $post->initial ) : ?>
<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>
<p class="tagcode" style="display: none;">
<?php echo esc_html( __( "Old code is also available.", 'wpcf7' ) ); ?><br />
<input type="text" id="contact-form-anchor-text-old" onfocus="this.select();" readonly="readonly" />
</p>
<?php endif; ?>
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) : ?>
<div class="save-contact-form">
<input type="submit" class="button-primary" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
</div>
<?php endif; ?>
<?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) && ! $post->initial ) : ?>
<div class="actions-link">
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy-contact-form_' . $post_id ); ?>
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Copy', 'wpcf7' ) ); ?>"
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; this.form.action.value = 'copy'; return true;\""; ?> />
|
<?php $delete_nonce = wp_create_nonce( 'wpcf7-delete-contact-form_' . $post_id ); ?>
<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'; this.form.action.value = 'delete'; return true;} return false;\""; ?> />
</div>
<?php endif; ?>
</div>
<?php
do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$post ) );
do_meta_boxes( null, 'form', $post );
do_action_ref_array( 'wpcf7_admin_after_form', array( &$post ) );
do_meta_boxes( null, 'mail', $post );
do_action_ref_array( 'wpcf7_admin_after_mail', array( &$post ) );
do_meta_boxes( null, 'mail_2', $post );
do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$post ) );
do_meta_boxes( null, 'messages', $post );
do_action_ref_array( 'wpcf7_admin_after_messages', array( &$post ) );
do_meta_boxes( null, 'additional_settings', $post );
do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$post ) );
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
?>
</div>
</form>
<?php endif; ?>
</div>
<?php wpcf7_admin_lang_select_modal(); ?>
<?php do_action_ref_array( 'wpcf7_admin_footer', array( &$post ) ); ?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,169 @@
<?php
if ( ! class_exists( 'WP_List_Table' ) )
require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
class WPCF7_Contact_Form_List_Table extends WP_List_Table {
public static function define_columns() {
$columns = array(
'cb' => '<input type="checkbox" />',
'title' => __( 'Title', 'wpcf7' ),
'shortcode' => __( 'Shortcode', 'wpcf7' ),
'author' => __( 'Author', 'wpcf7' ),
'date' => __( 'Date', 'wpcf7' ) );
return $columns;
}
function __construct() {
parent::__construct( array(
'singular' => 'post',
'plural' => 'posts',
'ajax' => false ) );
}
function prepare_items() {
$current_screen = get_current_screen();
$per_page = $this->get_items_per_page( 'cfseven_contact_forms_per_page' );
$this->_column_headers = $this->get_column_info();
$args = array(
'posts_per_page' => $per_page,
'orderby' => 'title',
'order' => 'ASC',
'offset' => ( $this->get_pagenum() - 1 ) * $per_page );
if ( ! empty( $_REQUEST['s'] ) )
$args['s'] = $_REQUEST['s'];
if ( ! empty( $_REQUEST['orderby'] ) ) {
if ( 'title' == $_REQUEST['orderby'] )
$args['orderby'] = 'title';
elseif ( 'author' == $_REQUEST['orderby'] )
$args['orderby'] = 'author';
elseif ( 'date' == $_REQUEST['orderby'] )
$args['orderby'] = 'date';
}
if ( ! empty( $_REQUEST['order'] ) ) {
if ( 'asc' == strtolower( $_REQUEST['order'] ) )
$args['order'] = 'ASC';
elseif ( 'desc' == strtolower( $_REQUEST['order'] ) )
$args['order'] = 'DESC';
}
$this->items = WPCF7_ContactForm::find( $args );
$total_items = WPCF7_ContactForm::$found_items;
$total_pages = ceil( $total_items / $per_page );
$this->set_pagination_args( array(
'total_items' => $total_items,
'total_pages' => $total_pages,
'per_page' => $per_page ) );
}
function get_columns() {
return get_column_headers( get_current_screen() );
}
function get_sortable_columns() {
$columns = array(
'title' => array( 'title', true ),
'author' => array( 'author', false ),
'date' => array( 'date', false ) );
return $columns;
}
function get_bulk_actions() {
$actions = array(
'delete' => __( 'Delete', 'wpcf7' ) );
return $actions;
}
function column_default( $item, $column_name ) {
return '';
}
function column_cb( $item ) {
return sprintf(
'<input type="checkbox" name="%1$s[]" value="%2$s" />',
$this->_args['singular'],
$item->id );
}
function column_title( $item ) {
$url = admin_url( 'admin.php?page=wpcf7&post=' . absint( $item->id ) );
$edit_link = add_query_arg( array( 'action' => 'edit' ), $url );
$actions = array(
'edit' => '<a href="' . $edit_link . '">' . __( 'Edit', 'wpcf7' ) . '</a>' );
if ( current_user_can( 'wpcf7_edit_contact_form', $item->id ) ) {
$copy_link = wp_nonce_url(
add_query_arg( array( 'action' => 'copy' ), $url ),
'wpcf7-copy-contact-form_' . absint( $item->id ) );
$actions = array_merge( $actions, array(
'copy' => '<a href="' . $copy_link . '">' . __( 'Copy', 'wpcf7' ) . '</a>' ) );
}
$a = sprintf( '<a class="row-title" href="%1$s" title="%2$s">%3$s</a>',
$edit_link,
esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;', 'wpcf7' ), $item->title ) ),
esc_html( $item->title ) );
return '<strong>' . $a . '</strong> ' . $this->row_actions( $actions );
}
function column_author( $item ) {
$post = get_post( $item->id );
if ( ! $post )
return;
$author = get_userdata( $post->post_author );
return esc_html( $author->display_name );
}
function column_shortcode( $item ) {
$shortcodes = array(
sprintf( '[contact-form-7 id="%1$d" title="%2$s"]', $item->id, $item->title ) );
$output = '';
foreach ( $shortcodes as $shortcode ) {
$output .= "\n" . '<input type="text" onfocus="this.select();" readonly="readonly"
value="' . esc_attr( $shortcode ) . '" class="shortcode-in-list-table" />';
}
return trim( $output );
}
function column_date( $item ) {
$post = get_post( $item->id );
if ( ! $post )
return;
$t_time = mysql2date( __( 'Y/m/d g:i:s A', 'wpcf7' ), $post->post_date, true );
$m_time = $post->post_date;
$time = mysql2date( 'G', $post->post_date ) - get_option( 'gmt_offset' ) * 3600;
$time_diff = time() - $time;
if ( $time_diff > 0 && $time_diff < 24*60*60 )
$h_time = sprintf( __( '%s ago', 'wpcf7' ), human_time_diff( $time ) );
else
$h_time = mysql2date( __( 'Y/m/d', 'wpcf7' ), $m_time );
return '<abbr title="' . $t_time . '">' . $h_time . '</abbr>';
}
}
?>

View File

@ -0,0 +1,109 @@
<?php
/* Form */
function wpcf7_form_meta_box( $post ) {
?>
<div class="half-left"><textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="20"><?php echo esc_textarea( $post->form ); ?></textarea></div>
<div class="half-right"><div id="taggenerator"></div></div>
<br class="clear" />
<?php
}
/* Mail */
function wpcf7_mail_meta_box( $post, $box ) {
$defaults = array( 'id' => 'wpcf7-mail', 'name' => 'mail', 'use' => null );
if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) )
$args = array();
else
$args = $box['args'];
extract( wp_parse_args( $args, $defaults ), EXTR_SKIP );
$id = esc_attr( $id );
$mail = $post->{$name};
if ( ! empty( $use ) ) :
?>
<div class="mail-field">
<input type="checkbox" id="<?php echo $id; ?>-active" name="<?php echo $id; ?>-active" class="check-if-these-fields-are-active" value="1"<?php echo ( $mail['active'] ) ? ' checked="checked"' : ''; ?> />
<label for="<?php echo $id; ?>-active"><?php echo esc_html( $use ); ?></label>
<div class="pseudo-hr"></div>
</div>
<br class="clear" />
<?php endif; ?>
<div class="mail-fields">
<div class="half-left">
<div class="mail-field">
<label for="<?php echo $id; ?>-recipient"><?php echo esc_html( __( 'To:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="<?php echo $id; ?>-recipient" name="<?php echo $id; ?>-recipient" class="wide" size="70" value="<?php echo esc_attr( $mail['recipient'] ); ?>" />
</div>
<div class="mail-field">
<label for="<?php echo $id; ?>-sender"><?php echo esc_html( __( 'From:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="<?php echo $id; ?>-sender" name="<?php echo $id; ?>-sender" class="wide" size="70" value="<?php echo esc_attr( $mail['sender'] ); ?>" />
</div>
<div class="mail-field">
<label for="<?php echo $id; ?>-subject"><?php echo esc_html( __( 'Subject:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="<?php echo $id; ?>-subject" name="<?php echo $id; ?>-subject" class="wide" size="70" value="<?php echo esc_attr( $mail['subject'] ); ?>" />
</div>
<div class="pseudo-hr"></div>
<div class="mail-field">
<label for="<?php echo $id; ?>-additional-headers"><?php echo esc_html( __( 'Additional headers:', 'wpcf7' ) ); ?></label><br />
<textarea id="<?php echo $id; ?>-additional-headers" name="<?php echo $id; ?>-additional-headers" cols="100" rows="2"><?php echo esc_textarea( $mail['additional_headers'] ); ?></textarea>
</div>
<div class="mail-field">
<label for="<?php echo $id; ?>-attachments"><?php echo esc_html( __( 'File attachments:', 'wpcf7' ) ); ?></label><br />
<input type="text" id="<?php echo $id; ?>-attachments" name="<?php echo $id; ?>-attachments" class="wide" size="70" value="<?php echo esc_attr( $mail['attachments'] ); ?>" />
</div>
<div class="pseudo-hr"></div>
<div class="mail-field">
<input type="checkbox" id="<?php echo $id; ?>-use-html" name="<?php echo $id; ?>-use-html" value="1"<?php echo ( $mail['use_html'] ) ? ' checked="checked"' : ''; ?> />
<label for="<?php echo $id; ?>-use-html"><?php echo esc_html( __( 'Use HTML content type', 'wpcf7' ) ); ?></label>
</div>
</div>
<div class="half-right">
<div class="mail-field">
<label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message body:', 'wpcf7' ) ); ?></label><br />
<textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>-body" cols="100" rows="16"><?php echo esc_textarea( $mail['body'] ); ?></textarea>
</div>
</div>
<br class="clear" />
</div>
<?php
}
function wpcf7_messages_meta_box( $post ) {
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( $post->messages[$key] ); ?>" />
</div>
<?php
endforeach;
}
function wpcf7_additional_settings_meta_box( $post ) {
?>
<textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8"><?php echo esc_textarea( $post->additional_settings ); ?></textarea>
<?php
}
?>

View File

@ -0,0 +1,75 @@
(function($) {
$(function() {
try {
$('div.cf7com-links').insertAfter($('div.wrap h2:first'));
$.extend($.tgPanes, _wpcf7.tagGenerators);
$('#taggenerator').tagGenerator(_wpcf7.generateTag,
{ dropdownIconUrl: _wpcf7.pluginUrl + '/admin/images/dropdown.gif' });
$('input#wpcf7-title:disabled').css({cursor: 'default'});
$('input#wpcf7-title').mouseover(function() {
$(this).not('.focus').addClass('mouseover');
});
$('input#wpcf7-title').mouseout(function() {
$(this).removeClass('mouseover');
});
$('input#wpcf7-title').focus(function() {
$(this).addClass('focus').removeClass('mouseover');
});
$('input#wpcf7-title').blur(function() {
$(this).removeClass('focus');
});
$('input#wpcf7-title').change(function() {
updateTag();
});
updateTag();
$('.check-if-these-fields-are-active').each(function(index) {
if (! $(this).is(':checked'))
$(this).parent().siblings('.mail-fields').hide();
$(this).click(function() {
if ($(this).parent().siblings('.mail-fields').is(':hidden')
&& $(this).is(':checked')) {
$(this).parent().siblings('.mail-fields').slideDown('fast');
} else if ($(this).parent().siblings('.mail-fields').is(':visible')
&& $(this).not(':checked')) {
$(this).parent().siblings('.mail-fields').slideUp('fast');
}
});
});
postboxes.add_postbox_toggles(_wpcf7.screenId);
} catch (e) {
}
});
function updateTag() {
var title = $('input#wpcf7-title').val();
if (title)
title = title.replace(/["'\[\]]/g, '');
$('input#wpcf7-title').val(title);
var postId = $('input#post_ID').val();
var tag = '[contact-form-7 id="' + postId + '" title="' + title + '"]';
$('input#contact-form-anchor-text').val(tag);
var oldId = $('input#wpcf7-id').val();
if (0 != oldId) {
var tagOld = '[contact-form ' + oldId + ' "' + title + '"]';
$('input#contact-form-anchor-text-old').val(tagOld).parent('p.tagcode').show();
}
}
})(jQuery);

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(/[,|\s]+/).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

View File

@ -0,0 +1,20 @@
<?php
add_filter( 'map_meta_cap', 'wpcf7_map_meta_cap', 10, 4 );
function wpcf7_map_meta_cap( $caps, $cap, $user_id, $args ) {
$meta_caps = array(
'wpcf7_edit_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
'wpcf7_edit_contact_forms' => WPCF7_ADMIN_READ_WRITE_CAPABILITY,
'wpcf7_read_contact_forms' => WPCF7_ADMIN_READ_CAPABILITY,
'wpcf7_delete_contact_form' => WPCF7_ADMIN_READ_WRITE_CAPABILITY );
$caps = array_diff( $caps, array_keys( $meta_caps ) );
if ( isset( $meta_caps[$cap] ) )
$caps[] = $meta_caps[$cap];
return $caps;
}
?>

View File

@ -0,0 +1,812 @@
<?php
class WPCF7_ContactForm {
const post_type = 'wpcf7_contact_form';
public static $found_items = 0;
var $initial = false;
var $id;
var $title;
var $unit_tag;
var $responses_count = 0;
var $scanned_form_tags;
var $posted_data;
var $uploaded_files = array();
var $skip_mail = false;
public static function register_post_type() {
register_post_type( self::post_type, array(
'labels' => array(
'name' => __( 'Contact Forms', 'wpcf7' ),
'singular_name' => __( 'Contact Form', 'wpcf7' ) ),
'rewrite' => false,
'query_var' => false ) );
}
public static function find( $args = '' ) {
$defaults = array(
'post_status' => 'any',
'posts_per_page' => -1,
'offset' => 0,
'orderby' => 'ID',
'order' => 'ASC' );
$args = wp_parse_args( $args, $defaults );
$args['post_type'] = self::post_type;
$q = new WP_Query();
$posts = $q->query( $args );
self::$found_items = $q->found_posts;
$objs = array();
foreach ( (array) $posts as $post )
$objs[] = new self( $post );
return $objs;
}
public function __construct( $post = null ) {
$this->initial = true;
$post = get_post( $post );
if ( $post && self::post_type == get_post_type( $post ) ) {
$this->initial = false;
$this->id = $post->ID;
$this->title = $post->post_title;
$this->form = get_post_meta( $post->ID, 'form', true );
$this->mail = get_post_meta( $post->ID, 'mail', true );
$this->mail_2 = get_post_meta( $post->ID, 'mail_2', true );
$this->messages = get_post_meta( $post->ID, 'messages', true );
$this->additional_settings = get_post_meta( $post->ID, 'additional_settings', true );
$this->upgrade();
}
do_action_ref_array( 'wpcf7_contact_form', array( &$this ) );
}
// 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 ) {
if ( ! isset( $fe['name'] ) || empty( $fe['name'] ) )
continue;
$name = $fe['name'];
if ( isset( $_POST[$name] ) )
unset( $_POST[$name] );
}
}
/* Generating Form HTML */
function form_html() {
$form = '<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 );
$class = 'wpcf7-form';
if ( $this->is_posted() ) {
if ( ! empty( $_POST['_wpcf7_validation_errors'] ) ) {
$class .= ' invalid';
} elseif ( ! empty( $_POST['_wpcf7_mail_sent'] ) ) {
if ( ! empty( $_POST['_wpcf7_mail_sent']['spam'] ) )
$class .= ' spam';
elseif ( ! empty( $_POST['_wpcf7_mail_sent']['ok'] ) )
$class .= ' sent';
else
$class .= ' failed';
}
}
$class = apply_filters( 'wpcf7_form_class_attr', $class );
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
. ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";
$form .= $this->form_hidden_fields();
$form .= $this->form_elements();
if ( ! $this->responses_count )
$form .= $this->form_response_output();
$form .= '</form>';
$form .= '</div>';
return $form;
}
function form_hidden_fields() {
$hidden_fields = array(
'_wpcf7' => $this->id,
'_wpcf7_version' => WPCF7_VERSION,
'_wpcf7_unit_tag' => $this->unit_tag );
if ( WPCF7_VERIFY_NONCE )
$hidden_fields['_wpnonce'] = wpcf7_create_nonce( $this->unit_tag );
$content = '';
foreach ( $hidden_fields as $name => $value ) {
$content .= '<input type="hidden"'
. ' name="' . esc_attr( $name ) . '"'
. ' value="' . esc_attr( $value ) . '" />' . "\n";
}
return '<div style="display: none;">' . "\n" . $content . '</div>' . "\n";
}
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() );
}
function setup_posted_data() {
$posted_data = (array) $_POST;
$fes = $this->form_scan_shortcode();
foreach ( $fes as $fe ) {
if ( empty( $fe['name'] ) )
continue;
$name = $fe['name'];
$value = '';
if ( isset( $posted_data[$name] ) )
$value = $posted_data[$name];
$pipes = $fe['pipes'];
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 ) );
}
}
$posted_data[$name] = $value;
}
$this->posted_data = apply_filters( 'wpcf7_posted_data', $posted_data );
return $this->posted_data;
}
function submit( $ajax = false ) {
$result = array(
'valid' => true,
'invalid_reasons' => array(),
'spam' => false,
'message' => '',
'mail_sent' => false,
'scripts_on_sent_ok' => null );
$this->setup_posted_data();
$validation = $this->validate();
if ( ! $validation['valid'] ) { // Validation error occured
$result['valid'] = false;
$result['invalid_reasons'] = $validation['reason'];
$result['message'] = $this->message( 'validation_error' );
} elseif ( ! $this->accepted() ) { // Not accepted terms
$result['message'] = $this->message( 'accept_terms' );
} elseif ( $this->spam() ) { // Spam!
$result['message'] = $this->message( 'spam' );
$result['spam'] = true;
} elseif ( $this->mail() ) {
$result['mail_sent'] = true;
$result['message'] = $this->message( 'mail_sent_ok' );
do_action_ref_array( 'wpcf7_mail_sent', array( &$this ) );
if ( $ajax ) {
$on_sent_ok = $this->additional_setting( 'on_sent_ok', false );
if ( ! empty( $on_sent_ok ) )
$result['scripts_on_sent_ok'] = array_map( 'wpcf7_strip_quote', $on_sent_ok );
} else {
$this->clear_post();
}
} else {
$result['message'] = $this->message( 'mail_sent_ng' );
}
// remove upload files
foreach ( (array) $this->uploaded_files as $name => $path ) {
@unlink( $path );
}
return $result;
}
/* 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 );
}
$result = apply_filters( 'wpcf7_validate', $result );
return $result;
}
function accepted() {
$accepted = true;
return apply_filters( 'wpcf7_acceptance', $accepted );
}
function spam() {
$spam = false;
if ( WPCF7_VERIFY_NONCE && ! $this->verify_nonce() )
$spam = true;
return apply_filters( 'wpcf7_spam', $spam );
}
function verify_nonce() {
return wpcf7_verify_nonce( $_POST['_wpnonce'], $_POST['_wpcf7_unit_tag'] );
}
/* Mail */
function mail() {
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;
$result = $this->compose_mail( $this->setup_mail_template( $this->mail, 'mail' ) );
if ( $result ) {
$additional_mail = array();
if ( $this->mail_2['active'] )
$additional_mail[] = $this->setup_mail_template( $this->mail_2, 'mail_2' );
$additional_mail = apply_filters_ref_array( 'wpcf7_additional_mail',
array( $additional_mail, &$this ) );
foreach ( $additional_mail as $mail )
$this->compose_mail( $mail );
return true;
}
return false;
}
function setup_mail_template( $mail_template, $name = '' ) {
$defaults = array(
'subject' => '', 'sender' => '', 'body' => '',
'recipient' => '', 'additional_headers' => '',
'attachments' => '', 'use_html' => false );
$mail_template = wp_parse_args( $mail_template, $defaults );
$name = trim( $name );
if ( ! empty( $name ) )
$mail_template['name'] = $name;
return $mail_template;
}
function compose_mail( $mail_template, $send = true ) {
$this->mail_template_in_process = $mail_template;
$regex = '/(\[?)\[\s*([a-zA-Z_][0-9a-zA-Z:._-]*)\s*\](\]?)/';
$use_html = (bool) $mail_template['use_html'];
$callback = array( &$this, 'mail_callback' );
$callback_html = array( &$this, 'mail_callback_html' );
$subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] );
$sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] );
$recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] );
$additional_headers =
preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] );
if ( $use_html ) {
$body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] );
$body = wpautop( $body );
} else {
$body = preg_replace_callback( $regex, $callback, $mail_template['body'] );
}
$attachments = array();
foreach ( (array) $this->uploaded_files as $name => $path ) {
if ( false === strpos( $mail_template['attachments'], "[${name}]" ) || empty( $path ) )
continue;
$attachments[] = $path;
}
$components = compact(
'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' );
$components = apply_filters_ref_array( 'wpcf7_mail_components',
array( $components, &$this ) );
extract( $components );
$headers = "From: $sender\n";
if ( $use_html )
$headers .= "Content-Type: text/html\n";
$headers .= trim( $additional_headers ) . "\n";
if ( $send )
return @wp_mail( $recipient, $subject, $body, $headers, $attachments );
return compact( 'subject', 'sender', 'body', 'recipient', 'headers', 'attachments' );
}
function mail_callback_html( $matches ) {
return $this->mail_callback( $matches, true );
}
function mail_callback( $matches, $html = false ) {
// allow [[foo]] syntax for escaping a tag
if ( $matches[1] == '[' && $matches[3] == ']' )
return substr( $matches[0], 1, -1 );
if ( isset( $this->posted_data[$matches[2]] ) ) {
$submitted = $this->posted_data[$matches[2]];
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[2] ) )
return $special;
return $matches[0];
}
/* Message */
function message( $status ) {
$messages = $this->messages;
$message = isset( $messages[$status] ) ? $messages[$status] : '';
return apply_filters( 'wpcf7_display_message', $message, $status );
}
/* Additional settings */
function additional_setting( $name, $max = 1 ) {
$tmp_settings = (array) explode( "\n", $this->additional_settings );
$count = 0;
$values = array();
foreach ( $tmp_settings as $setting ) {
if ( preg_match('/^([a-zA-Z0-9_]+)[\t ]*:(.*)$/', $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() {
$metas = array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' );
$post_content = '';
foreach ( $metas as $meta ) {
$props = (array) $this->{$meta};
foreach ( $props as $prop )
$post_content .= "\n" . trim( $prop );
}
if ( $this->initial ) {
$post_id = wp_insert_post( array(
'post_type' => self::post_type,
'post_status' => 'publish',
'post_title' => $this->title,
'post_content' => trim( $post_content ) ) );
} else {
$post_id = wp_update_post( array(
'ID' => (int) $this->id,
'post_status' => 'publish',
'post_title' => $this->title,
'post_content' => trim( $post_content ) ) );
}
if ( $post_id ) {
foreach ( $metas as $meta )
update_post_meta( $post_id, $meta, wpcf7_normalize_newline_deep( $this->{$meta} ) );
if ( $this->initial ) {
$this->initial = false;
$this->id = $post_id;
do_action_ref_array( 'wpcf7_after_create', array( &$this ) );
} else {
do_action_ref_array( 'wpcf7_after_update', array( &$this ) );
}
do_action_ref_array( 'wpcf7_after_save', array( &$this ) );
}
return $post_id;
}
function copy() {
$new = new WPCF7_ContactForm();
$new->initial = true;
$new->title = $this->title . '_copy';
$new->form = $this->form;
$new->mail = $this->mail;
$new->mail_2 = $this->mail_2;
$new->messages = $this->messages;
$new->additional_settings = $this->additional_settings;
$new = apply_filters_ref_array( 'wpcf7_copy', array( &$new, &$this ) );
return $new;
}
function delete() {
if ( $this->initial )
return;
if ( wp_delete_post( $this->id, true ) ) {
$this->initial = true;
$this->id = null;
return true;
}
return false;
}
}
function wpcf7_contact_form( $id ) {
$contact_form = new WPCF7_ContactForm( $id );
if ( $contact_form->initial )
return false;
return $contact_form;
}
function wpcf7_get_contact_form_by_old_id( $old_id ) {
global $wpdb;
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
. $wpdb->prepare( " AND meta_value = %d", $old_id );
if ( $new_id = $wpdb->get_var( $q ) )
return wpcf7_contact_form( $new_id );
}
function wpcf7_get_contact_form_by_title( $title ) {
$page = get_page_by_title( $title, OBJECT, WPCF7_ContactForm::post_type );
if ( $page )
return wpcf7_contact_form( $page->ID );
return null;
}
function wpcf7_get_contact_form_default_pack( $args = '' ) {
global $l10n;
$defaults = array( 'locale' => null, 'title' => '' );
$args = wp_parse_args( $args, $defaults );
$locale = $args['locale'];
$title = $args['title'];
if ( $locale && $locale != get_locale() ) {
$mo_orig = $l10n['wpcf7'];
unset( $l10n['wpcf7'] );
if ( 'en_US' != $locale ) {
$mofile = wpcf7_plugin_path( 'languages/wpcf7-' . $locale . '.mo' );
if ( ! load_textdomain( 'wpcf7', $mofile ) ) {
$l10n['wpcf7'] = $mo_orig;
unset( $mo_orig );
}
}
}
$contact_form = new WPCF7_ContactForm();
$contact_form->initial = true;
$contact_form->title = ( $title ? $title : __( 'Untitled', 'wpcf7' ) );
$contact_form->form = wpcf7_get_default_template( 'form' );
$contact_form->mail = wpcf7_get_default_template( 'mail' );
$contact_form->mail_2 = wpcf7_get_default_template( 'mail_2' );
$contact_form->messages = wpcf7_get_default_template( 'messages' );
$contact_form->additional_settings = wpcf7_get_default_template( 'additional_settings' );
if ( isset( $mo_orig ) )
$l10n['wpcf7'] = $mo_orig;
$contact_form = apply_filters_ref_array( 'wpcf7_contact_form_default_pack',
array( &$contact_form, $args ) );
return $contact_form;
}
function wpcf7_get_current_contact_form() {
global $wpcf7_contact_form;
if ( ! is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
return null;
return $wpcf7_contact_form;
}
function wpcf7_is_posted() {
if ( ! $contact_form = wpcf7_get_current_contact_form() )
return false;
return $contact_form->is_posted();
}
function wpcf7_get_validation_error( $name ) {
if ( ! $contact_form = wpcf7_get_current_contact_form() )
return '';
return $contact_form->validation_error( $name );
}
function wpcf7_get_message( $status ) {
if ( ! $contact_form = wpcf7_get_current_contact_form() )
return '';
return $contact_form->message( $status );
}
function wpcf7_scan_shortcode( $cond = null ) {
if ( ! $contact_form = wpcf7_get_current_contact_form() )
return null;
return $contact_form->form_scan_shortcode( $cond );
}
function wpcf7_form_controls_class( $type, $default = '' ) {
$type = trim( $type );
$default = explode( ' ', $default );
$classes = array_merge( array( 'wpcf7-form-control' ), $default );
$typebase = rtrim( $type, '*' );
$required = ( '*' == substr( $type, -1 ) );
$classes[] = 'wpcf7-' . $typebase;
if ( $required )
$classes[] = 'wpcf7-validates-as-required';
$classes = array_unique( $classes );
return implode( ' ', $classes );
}
?>

View File

@ -0,0 +1,288 @@
<?php
add_action( 'init', 'wpcf7_control_init', 11 );
function wpcf7_control_init() {
wpcf7_ajax_onload();
wpcf7_ajax_json_echo();
wpcf7_submit_nonajax();
}
function wpcf7_ajax_onload() {
global $wpcf7_contact_form;
if ( 'GET' != $_SERVER['REQUEST_METHOD'] || ! isset( $_GET['_wpcf7_is_ajax_call'] ) )
return;
$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 ( wpcf7_is_xhr() ) {
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
echo $echo;
}
exit();
}
function wpcf7_ajax_json_echo() {
global $wpcf7_contact_form;
if ( 'POST' != $_SERVER['REQUEST_METHOD'] || ! isset( $_POST['_wpcf7_is_ajax_call'] ) )
return;
$echo = '';
if ( isset( $_POST['_wpcf7'] ) ) {
$id = (int) $_POST['_wpcf7'];
$unit_tag = wpcf7_sanitize_unit_tag( $_POST['_wpcf7_unit_tag'] );
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
$items = array(
'mailSent' => false,
'into' => '#' . $unit_tag,
'captcha' => null );
$result = $wpcf7_contact_form->submit( true );
if ( ! empty( $result['message'] ) )
$items['message'] = $result['message'];
if ( $result['mail_sent'] )
$items['mailSent'] = true;
if ( ! $result['valid'] ) {
$invalids = array();
foreach ( $result['invalid_reasons'] as $name => $reason ) {
$invalids[] = array(
'into' => 'span.wpcf7-form-control-wrap.' . $name,
'message' => $reason );
}
$items['invalids'] = $invalids;
}
if ( $result['spam'] )
$items['spam'] = true;
if ( ! empty( $result['scripts_on_sent_ok'] ) )
$items['onSentOk'] = $result['scripts_on_sent_ok'];
$items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result );
$wpcf7_contact_form = null;
}
}
$echo = json_encode( $items );
if ( wpcf7_is_xhr() ) {
@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>';
}
exit();
}
function wpcf7_is_xhr() {
if ( ! isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) )
return false;
return $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
}
function wpcf7_submit_nonajax() {
global $wpcf7_contact_form;
if ( ! isset( $_POST['_wpcf7'] ) )
return;
$id = (int) $_POST['_wpcf7'];
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
$result = $wpcf7_contact_form->submit();
if ( ! $result['valid'] ) {
$_POST['_wpcf7_validation_errors'] = array(
'id' => $id,
'messages' => $result['invalid_reasons'] );
} else {
$_POST['_wpcf7_mail_sent'] = array(
'id' => $id,
'ok' => $result['mail_sent'],
'message' => $result['message'],
'spam' => $result['spam'] );
}
$wpcf7_contact_form = null;
}
}
add_action( 'the_post', 'wpcf7_the_post' );
function wpcf7_the_post() {
global $wpcf7;
$wpcf7->processing_within = 'p' . get_the_ID();
$wpcf7->unit_count = 0;
}
add_action( 'loop_end', 'wpcf7_loop_end' );
function wpcf7_loop_end() {
global $wpcf7;
$wpcf7->processing_within = '';
}
add_filter( 'widget_text', 'wpcf7_widget_text_filter', 9 );
function wpcf7_widget_text_filter( $content ) {
global $wpcf7;
if ( ! preg_match( '/\[[\r\n\t ]*contact-form(-7)?[\r\n\t ].*?\]/', $content ) )
return $content;
$wpcf7->widget_count += 1;
$wpcf7->processing_within = 'w' . $wpcf7->widget_count;
$wpcf7->unit_count = 0;
$content = do_shortcode( $content );
$wpcf7->processing_within = '';
return $content;
}
/* Shortcodes */
add_action( 'plugins_loaded', 'wpcf7_add_shortcodes', 1 );
function wpcf7_add_shortcodes() {
add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' );
add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' );
}
function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) {
global $wpcf7, $wpcf7_contact_form;
if ( is_feed() )
return '[contact-form-7]';
if ( 'contact-form-7' == $code ) {
$atts = shortcode_atts( array( 'id' => 0, 'title' => '' ), $atts );
$id = (int) $atts['id'];
$title = trim( $atts['title'] );
if ( ! $wpcf7_contact_form = wpcf7_contact_form( $id ) )
$wpcf7_contact_form = wpcf7_get_contact_form_by_title( $title );
} else {
if ( is_string( $atts ) )
$atts = explode( ' ', $atts, 2 );
$id = (int) array_shift( $atts );
$wpcf7_contact_form = wpcf7_get_contact_form_by_old_id( $id );
}
if ( ! $wpcf7_contact_form )
return '[contact-form-7 404 "Not Found"]';
if ( $wpcf7->processing_within ) { // Inside post content or text widget
$wpcf7->unit_count += 1;
$unit_count = $wpcf7->unit_count;
$processing_within = $wpcf7->processing_within;
} else { // Inside template
if ( ! isset( $wpcf7->global_unit_count ) )
$wpcf7->global_unit_count = 0;
$wpcf7->global_unit_count += 1;
$unit_count = 1;
$processing_within = 't' . $wpcf7->global_unit_count;
}
$unit_tag = 'wpcf7-f' . $wpcf7_contact_form->id . '-' . $processing_within . '-o' . $unit_count;
$wpcf7_contact_form->unit_tag = $unit_tag;
$form = $wpcf7_contact_form->form_html();
$wpcf7_contact_form = null;
return $form;
}
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( 'includes/js/jquery.form.js' ),
array( 'jquery' ), '3.14', true );
$in_footer = true;
if ( 'header' === WPCF7_LOAD_JS )
$in_footer = false;
wp_enqueue_script( 'contact-form-7',
wpcf7_plugin_url( 'includes/js/scripts.js' ),
array( 'jquery', 'jquery-form' ), WPCF7_VERSION, $in_footer );
$_wpcf7 = array(
'loaderUrl' => wpcf7_ajax_loader(),
'sending' => __( 'Sending ...', 'wpcf7' ) );
if ( defined( 'WP_CACHE' ) && WP_CACHE )
$_wpcf7['cached'] = 1;
wp_localize_script( 'contact-form-7', '_wpcf7', $_wpcf7 );
do_action( 'wpcf7_enqueue_scripts' );
}
function wpcf7_script_is() {
return wp_script_is( 'contact-form-7' );
}
if ( WPCF7_LOAD_CSS )
add_action( 'wp_enqueue_scripts', 'wpcf7_enqueue_styles' );
function wpcf7_enqueue_styles() {
wp_enqueue_style( 'contact-form-7',
wpcf7_plugin_url( 'includes/css/styles.css' ),
array(), WPCF7_VERSION, 'all' );
if ( wpcf7_is_rtl() ) {
wp_enqueue_style( 'contact-form-7-rtl',
wpcf7_plugin_url( 'includes/css/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,12 @@
span.wpcf7-not-valid-tip {
left: auto;
right: 20%;
direction: rtl;
}
span.wpcf7-not-valid-tip-no-ajax {
direction: rtl;
}
span.wpcf7-list-item {
margin-left: 0;
margin-right: 0.5em;
}

View File

@ -0,0 +1,65 @@
div.wpcf7 {
margin: 0;
padding: 0;
}
div.wpcf7-response-output {
margin: 2em 0.5em 1em;
padding: 0.2em 1em;
}
div.wpcf7-mail-sent-ok {
border: 2px solid #398f14;
}
div.wpcf7-mail-sent-ng {
border: 2px solid #ff0000;
}
div.wpcf7-spam-blocked {
border: 2px solid #ffa500;
}
div.wpcf7-validation-errors {
border: 2px solid #f7e700;
}
span.wpcf7-form-control-wrap {
position: relative;
}
span.wpcf7-not-valid-tip {
position: absolute;
top: 20%;
left: 20%;
z-index: 100;
background: #fff;
border: 1px solid #ff0000;
font-size: 10pt;
width: 280px;
padding: 2px;
}
span.wpcf7-not-valid-tip-no-ajax {
color: #f00;
font-size: 10pt;
display: block;
}
span.wpcf7-list-item {
margin-left: 0.5em;
}
.wpcf7-display-none {
display: none;
}
div.wpcf7 img.ajax-loader {
border: none;
vertical-align: middle;
margin-left: 4px;
}
div.wpcf7 .watermark {
color: #888;
}

View File

@ -0,0 +1,26 @@
<?php
/*
* Deprecated functions come here to die.
*/
function wpcf7_admin_url( $args = array() ) {
wpcf7_deprecated_function( __FUNCTION__, '3.2', 'admin_url()' );
$defaults = array( 'page' => 'wpcf7' );
$args = wp_parse_args( $args, $defaults );
$url = menu_page_url( $args['page'], false );
unset( $args['page'] );
$url = add_query_arg( $args, $url );
return esc_url_raw( $url );
}
function wpcf7_contact_form_default_pack( $locale = null ) {
wpcf7_deprecated_function( __FUNCTION__, '3.0', 'wpcf7_get_contact_form_default_pack()' );
return wpcf7_get_contact_form_default_pack( array( 'locale' => $locale ) );
}
?>

View File

@ -0,0 +1,121 @@
<?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_deep( $text );
return $result;
}
}
function wpcf7_normalize_newline( $text, $to = "\n" ) {
if ( ! is_string( $text ) )
return $text;
$nls = array( "\r\n", "\r", "\n" );
if ( ! in_array( $to, $nls ) )
return $text;
return str_replace( $nls, $to, $text );
}
function wpcf7_normalize_newline_deep( $arr, $to = "\n" ) {
if ( is_array( $arr ) ) {
$result = array();
foreach ( $arr as $key => $text )
$result[$key] = wpcf7_normalize_newline_deep( $text, $to );
return $result;
}
return wpcf7_normalize_newline( $arr, $to );
}
function wpcf7_canonicalize( $text ) {
if ( function_exists( 'mb_convert_kana' ) && 'UTF-8' == get_option( 'blog_charset' ) )
$text = mb_convert_kana( $text, 'asKV', 'UTF-8' );
$text = strtolower( $text );
$text = trim( $text );
return $text;
}
function wpcf7_is_name( $string ) {
// See http://www.w3.org/TR/html401/types.html#h-6.2
// ID and NAME tokens must begin with a letter ([A-Za-z])
// and may be followed by any number of letters, digits ([0-9]),
// hyphens ("-"), underscores ("_"), colons (":"), and periods (".").
return preg_match( '/^[A-Za-z][-A-Za-z0-9_:.]*$/', $string );
}
function wpcf7_sanitize_unit_tag( $tag ) {
$tag = preg_replace( '/[^A-Za-z0-9_-]/', '', $tag );
return $tag;
}
?>

View File

@ -0,0 +1,293 @@
<?php
function wpcf7_plugin_path( $path = '' ) {
return path_join( WPCF7_PLUGIN_DIR, trim( $path, '/' ) );
}
function wpcf7_plugin_url( $path = '' ) {
$url = untrailingslashit( WPCF7_PLUGIN_URL );
if ( ! empty( $path ) && is_string( $path ) && false === strpos( $path, '..' ) )
$url .= '/' . ltrim( $path, '/' );
return $url;
}
function wpcf7_deprecated_function( $function, $version, $replacement = null ) {
do_action( 'wpcf7_deprecated_function_run', $function, $replacement, $version );
if ( WP_DEBUG && apply_filters( 'wpcf7_deprecated_function_trigger_error', true ) ) {
if ( ! is_null( $replacement ) )
trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead.', 'wpcf7' ), $function, $version, $replacement ) );
else
trigger_error( sprintf( __( '%1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s with no alternative available.', 'wpcf7' ), $function, $version ) );
}
}
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 the administrator by another method.', 'wpcf7' )
),
'validation_error' => array(
'description' => __( "Validation errors occurred", 'wpcf7' ),
'default' => __( 'Validation errors occurred. Please confirm the fields and submit it again.', 'wpcf7' )
),
'accept_terms' => array(
'description' => __( "There are terms that the sender must accept", 'wpcf7' ),
'default' => __( 'Please accept the terms to proceed.', 'wpcf7' )
),
'invalid_email' => array(
'description' => __( "Email address that the sender entered is invalid", 'wpcf7' ),
'default' => __( 'Email address seems invalid.', 'wpcf7' )
),
'invalid_required' => array(
'description' => __( "There is a field that the sender must fill in", 'wpcf7' ),
'default' => __( 'Please fill the required field.', 'wpcf7' )
)
);
return apply_filters( 'wpcf7_messages', $messages );
}
function wpcf7_get_default_template( $prop = 'form' ) {
if ( 'form' == $prop )
$template = wpcf7_default_form_template();
elseif ( 'mail' == $prop )
$template = wpcf7_default_mail_template();
elseif ( 'mail_2' == $prop )
$template = wpcf7_default_mail_2_template();
elseif ( 'messages' == $prop )
$template = wpcf7_default_messages_template();
else
$template = null;
return apply_filters( 'wpcf7_default_template', $template, $prop );
}
function wpcf7_default_form_template() {
$template =
'<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_upload_dir( $type = false ) {
global $switched;
$siteurl = get_option( 'siteurl' );
$upload_path = trim( get_option( 'upload_path' ) );
$main_override = is_multisite() && defined( 'MULTISITE' ) && is_main_site();
if ( empty( $upload_path ) ) {
$dir = WP_CONTENT_DIR . '/uploads';
} else {
$dir = $upload_path;
if ( 'wp-content/uploads' == $upload_path ) {
$dir = WP_CONTENT_DIR . '/uploads';
} elseif ( 0 !== strpos( $dir, ABSPATH ) ) {
// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
$dir = path_join( ABSPATH, $dir );
}
}
if ( ! $url = get_option( 'upload_url_path' ) ) {
if ( empty( $upload_path )
|| ( 'wp-content/uploads' == $upload_path )
|| ( $upload_path == $dir ) )
$url = WP_CONTENT_URL . '/uploads';
else
$url = trailingslashit( $siteurl ) . $upload_path;
}
if ( defined( 'UPLOADS' ) && ! $main_override
&& ( ! isset( $switched ) || $switched === false ) ) {
$dir = ABSPATH . UPLOADS;
$url = trailingslashit( $siteurl ) . UPLOADS;
}
if ( is_multisite() && ! $main_override
&& ( ! isset( $switched ) || $switched === false ) ) {
if ( defined( 'BLOGUPLOADDIR' ) )
$dir = untrailingslashit( BLOGUPLOADDIR );
$url = str_replace( UPLOADS, 'files', $url );
}
$uploads = apply_filters( 'wpcf7_upload_dir', array( 'dir' => $dir, 'url' => $url ) );
if ( 'dir' == $type )
return $uploads['dir'];
if ( 'url' == $type )
return $uploads['url'];
return $uploads;
}
function wpcf7_l10n() {
$l10n = array(
'af' => __( 'Afrikaans', 'wpcf7' ),
'sq' => __( 'Albanian', 'wpcf7' ),
'ar' => __( 'Arabic', 'wpcf7' ),
'hy_AM' => __( 'Armenian', 'wpcf7' ),
'az_AZ' => __( 'Azerbaijani', 'wpcf7' ),
'bn_BD' => __( 'Bangla', 'wpcf7' ),
'eu' => __( 'Basque', 'wpcf7' ),
'be_BY' => __( 'Belarusian', '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' ),
'eo_EO' => __( 'Esperanto', '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' ),
'mt_MT' => __( 'Maltese', '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_SK' => __( 'Slovak', 'wpcf7' ),
'sl_SI' => __( 'Slovene', 'wpcf7' ),
'es_ES' => __( 'Spanish', 'wpcf7' ),
'sv_SE' => __( 'Swedish', 'wpcf7' ),
'ta' => __( 'Tamil', 'wpcf7' ),
'th' => __( 'Thai', 'wpcf7' ),
'tl' => __( 'Tagalog', 'wpcf7' ),
'tr_TR' => __( 'Turkish', 'wpcf7' ),
'uk' => __( 'Ukrainian', 'wpcf7' ),
'vi' => __( 'Vietnamese', 'wpcf7' )
);
return $l10n;
}
function wpcf7_is_rtl() {
if ( function_exists( 'is_rtl' ) )
return is_rtl();
return false;
}
function wpcf7_ajax_loader() {
$url = wpcf7_plugin_url( 'images/ajax-loader.gif' );
return apply_filters( 'wpcf7_ajax_loader', $url );
}
/* Nonce functions: wpcf7_verify_nonce() and wpcf7_create_nonce()
* For front-end use only.
* Almost the same as wp_verify_nonce() and wp_create_nonce() except that $uid is always 0.
*/
function wpcf7_verify_nonce( $nonce, $action = -1 ) {
$i = wp_nonce_tick();
$uid = 0;
// Nonce generated 0-12 hours ago
if ( substr( wp_hash( $i . $action . $uid, 'nonce' ), -12, 10 ) == $nonce )
return 1;
// Nonce generated 12-24 hours ago
if ( substr( wp_hash( ( $i - 1 ) . $action . $uid, 'nonce' ), -12, 10 ) == $nonce )
return 2;
// Invalid nonce
return false;
}
function wpcf7_create_nonce( $action = -1 ) {
$i = wp_nonce_tick();
$uid = 0;
return substr( wp_hash( $i . $action . $uid, 'nonce' ), -12, 10 );
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,227 @@
(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();
$(data.into).find('.wpcf7-form-control').removeClass('wpcf7-not-valid');
$(data.into).find('form.wpcf7-form').removeClass('invalid spam sent failed');
if (data.captcha)
$(data.into).wpcf7RefillCaptcha(data.captcha);
if (data.quiz)
$(data.into).wpcf7RefillQuiz(data.quiz);
if (data.invalids) {
$.each(data.invalids, function(i, n) {
$(data.into).find(n.into).wpcf7NotValidTip(n.message);
$(data.into).find(n.into).find('.wpcf7-form-control').addClass('wpcf7-not-valid');
});
ro.addClass('wpcf7-validation-errors');
$(data.into).find('form.wpcf7-form').addClass('invalid');
} else if (1 == data.spam) {
ro.addClass('wpcf7-spam-blocked');
$(data.into).find('form.wpcf7-form').addClass('spam');
} else if (1 == data.mailSent) {
ro.addClass('wpcf7-mail-sent-ok');
$(data.into).find('form.wpcf7-form').addClass('sent');
if (data.onSentOk)
$.each(data.onSentOk, function(i, n) { eval(n) });
} else {
ro.addClass('wpcf7-mail-sent-ng');
$(data.into).find('form.wpcf7-form').addClass('failed');
}
if (data.onSubmit)
$.each(data.onSubmit, function(i, n) { eval(n) });
if (1 == data.mailSent)
$(data.into).find('form').resetForm().clearForm();
$(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
$(n).val($(n).attr('title'));
});
$(data.into).wpcf7FillResponseOutput(data.message);
}
});
$('div.wpcf7 > form').each(function(i, n) {
if (_wpcf7.cached)
$(n).wpcf7OnloadRefill();
$(n).wpcf7ToggleSubmit();
$(n).find('.wpcf7-submit').wpcf7AjaxLoader();
$(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.wpcf7AjaxLoader = function() {
return this.each(function() {
var loader = $('<img class="ajax-loader" />')
.attr({ src: _wpcf7.loaderUrl, alt: _wpcf7.sending })
.css('visibility', 'hidden');
$(this).after(loader);
});
};
$.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' });
});
};
$.fn.wpcf7FillResponseOutput = function(message) {
return this.each(function() {
$(this).find('div.wpcf7-response-output').append(message).slideDown('fast');
});
};
})(jQuery);

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,195 @@
<?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( '/[\r\n\t ]+/', ' ', $m[3] ) );
$content = trim( $m[5] );
$content = str_replace( "\n", '<WPPreserveNewline />', $content );
$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 . ')(?:[\r\n\t ](.*?))?(?:[\r\n\t ](\/))?\]'
. '(?:([^[]*?)\[\/\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(
'type' => $tag,
'name' => '',
'options' => array(),
'raw_values' => array(),
'values' => array(),
'pipes' => null,
'labels' => array(),
'attr' => '',
'content' => '' );
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[\r\n\t ]*\/?>$/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:.!?#$&@_/|\%\r\n\t ]*?)((?:[\r\n\t ]*"[^"]*"|[\r\n\t ]*\'[^\']*\')*)$%';
if ( preg_match( $pattern, $text, $match ) ) {
if ( ! empty( $match[1] ) ) {
$atts['options'] = preg_split( '/[\r\n\t ]+/', 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,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,956 @@
msgid ""
msgstr ""
"Project-Id-Version: Contact Form 7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-30 18:56+0900\n"
"PO-Revision-Date: 2012-07-30 18:56+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/wp-contact-form-7.php:5
msgid "Just another contact form plugin. Simple but flexible."
msgstr ""
#: contact-form-7/settings.php:167
#, php-format
msgid "Contact form %d"
msgstr ""
#: contact-form-7/admin/admin.php:8
#: contact-form-7/admin/admin.php:286
#: contact-form-7/admin/edit-contact-form.php:12
msgid "Contact Form 7"
msgstr ""
#: contact-form-7/admin/admin.php:8
msgid "Contact"
msgstr ""
#: contact-form-7/admin/admin.php:13
msgid "Edit Contact Forms"
msgstr ""
#: contact-form-7/admin/admin.php:13
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:104
msgid "Edit"
msgstr ""
#: contact-form-7/admin/admin.php:41
#: contact-form-7/admin/admin.php:113
msgid "You are not allowed to edit this item."
msgstr ""
#: contact-form-7/admin/admin.php:154
msgid "You are not allowed to delete this item."
msgstr ""
#: contact-form-7/admin/admin.php:157
msgid "Error in deleting."
msgstr ""
#: contact-form-7/admin/admin.php:196
#: contact-form-7/includes/classes.php:27
msgid "Contact Forms"
msgstr ""
#: contact-form-7/admin/admin.php:233
msgid "Generate Tag"
msgstr ""
#: contact-form-7/admin/admin.php:288
#: contact-form-7/admin/admin.php:320
#: contact-form-7/admin/admin.php:333
#: contact-form-7/admin/edit-contact-form.php:15
msgid "Add New"
msgstr ""
#: contact-form-7/admin/admin.php:292
#, php-format
msgid "Search results for &#8220;%s&#8221;"
msgstr ""
#: contact-form-7/admin/admin.php:301
msgid "Search Contact Forms"
msgstr ""
#: contact-form-7/admin/admin.php:319
#, php-format
msgid "Use the default language (%s)"
msgstr ""
#: contact-form-7/admin/admin.php:323
msgid "Or"
msgstr ""
#: contact-form-7/admin/admin.php:328
msgid "(select language)"
msgstr ""
#: contact-form-7/admin/admin.php:340
msgid "Form"
msgstr ""
#: contact-form-7/admin/admin.php:343
msgid "Mail"
msgstr ""
#: contact-form-7/admin/admin.php:346
msgid "Mail (2)"
msgstr ""
#: contact-form-7/admin/admin.php:351
msgid "Use mail (2)"
msgstr ""
#: contact-form-7/admin/admin.php:353
msgid "Messages"
msgstr ""
#: contact-form-7/admin/admin.php:356
msgid "Additional Settings"
msgstr ""
#: contact-form-7/admin/admin.php:387
msgid "Contact form created."
msgstr ""
#: contact-form-7/admin/admin.php:389
msgid "Contact form saved."
msgstr ""
#: contact-form-7/admin/admin.php:391
msgid "Contact form deleted."
msgstr ""
#: contact-form-7/admin/admin.php:408
msgid "Settings"
msgstr ""
#: contact-form-7/admin/admin.php:419
msgid "http://contactform7.com/docs/"
msgstr ""
#: contact-form-7/admin/admin.php:420
msgid "Docs"
msgstr ""
#: contact-form-7/admin/admin.php:421
msgid "http://contactform7.com/faq/"
msgstr ""
#: contact-form-7/admin/admin.php:422
msgid "FAQ"
msgstr ""
#: contact-form-7/admin/admin.php:423
msgid "http://contactform7.com/support/"
msgstr ""
#: contact-form-7/admin/admin.php:424
msgid "Support"
msgstr ""
#: contact-form-7/admin/admin.php:455
msgid "Contact Form 7 needs your support. Please donate today."
msgstr ""
#: contact-form-7/admin/admin.php:456
msgid "Your contribution is needed for making this plugin better."
msgstr ""
#: contact-form-7/admin/admin.php:462
msgid "http://contactform7.com/donate/"
msgstr ""
#: contact-form-7/admin/admin.php:462
msgid "Donate"
msgstr ""
#: contact-form-7/admin/admin.php:482
#, php-format
msgid "<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href=\"%3$s\">update WordPress</a> first."
msgstr ""
#: contact-form-7/admin/edit-contact-form.php:46
msgid "Copy this code and paste it into your post, page or text widget content."
msgstr ""
#: contact-form-7/admin/edit-contact-form.php:52
msgid "Old code is also available."
msgstr ""
#: contact-form-7/admin/edit-contact-form.php:60
msgid "Save"
msgstr ""
#: contact-form-7/admin/edit-contact-form.php:67
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:112
msgid "Copy"
msgstr ""
#: contact-form-7/admin/edit-contact-form.php:72
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:83
msgid "Delete"
msgstr ""
#: contact-form-7/admin/edit-contact-form.php:74
msgid ""
"You are about to delete this contact form.\n"
" 'Cancel' to stop, 'OK' to delete."
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:11
msgid "Title"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:12
msgid "Shortcode"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:13
msgid "Author"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:14
msgid "Date"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:117
#, php-format
msgid "Edit &#8220;%s&#8221;"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:154
msgid "Y/m/d g:i:s A"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:161
#, php-format
msgid "%s ago"
msgstr ""
#: contact-form-7/admin/includes/class-contact-forms-list-table.php:163
msgid "Y/m/d"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:44
msgid "To:"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:49
msgid "From:"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:54
msgid "Subject:"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:61
msgid "Additional headers:"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:66
msgid "File attachments:"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:74
msgid "Use HTML content type"
msgstr ""
#: contact-form-7/admin/includes/meta-boxes.php:80
#: contact-form-7/includes/functions.php:112
msgid "Message body:"
msgstr ""
#: contact-form-7/includes/classes.php:28
msgid "Contact Form"
msgstr ""
#: contact-form-7/includes/classes.php:739
msgid "Untitled"
msgstr ""
#: contact-form-7/includes/controller.php:253
msgid "Sending ..."
msgstr ""
#: contact-form-7/includes/functions.php:21
#, php-format
msgid "%1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s! Use %3$s instead."
msgstr ""
#: contact-form-7/includes/functions.php:23
#, php-format
msgid "%1$s is <strong>deprecated</strong> since Contact Form 7 version %2$s with no alternative available."
msgstr ""
#: contact-form-7/includes/functions.php:30
msgid "Sender's message was sent successfully"
msgstr ""
#: contact-form-7/includes/functions.php:31
msgid "Your message was sent successfully. Thanks."
msgstr ""
#: contact-form-7/includes/functions.php:35
msgid "Sender's message was failed to send"
msgstr ""
#: contact-form-7/includes/functions.php:36
msgid "Failed to send your message. Please try later or contact the administrator by another method."
msgstr ""
#: contact-form-7/includes/functions.php:40
msgid "Validation errors occurred"
msgstr ""
#: contact-form-7/includes/functions.php:41
msgid "Validation errors occurred. Please confirm the fields and submit it again."
msgstr ""
#: contact-form-7/includes/functions.php:45
msgid "There are terms that the sender must accept"
msgstr ""
#: contact-form-7/includes/functions.php:46
msgid "Please accept the terms to proceed."
msgstr ""
#: contact-form-7/includes/functions.php:50
msgid "Email address that the sender entered is invalid"
msgstr ""
#: contact-form-7/includes/functions.php:51
msgid "Email address seems invalid."
msgstr ""
#: contact-form-7/includes/functions.php:55
msgid "There is a field that the sender must fill in"
msgstr ""
#: contact-form-7/includes/functions.php:56
msgid "Please fill the required field."
msgstr ""
#: contact-form-7/includes/functions.php:80
msgid "Your Name"
msgstr ""
#: contact-form-7/includes/functions.php:80
#: contact-form-7/includes/functions.php:82
msgid "(required)"
msgstr ""
#: contact-form-7/includes/functions.php:82
msgid "Your Email"
msgstr ""
#: contact-form-7/includes/functions.php:84
msgid "Subject"
msgstr ""
#: contact-form-7/includes/functions.php:86
msgid "Your Message"
msgstr ""
#: contact-form-7/includes/functions.php:88
msgid "Send"
msgstr ""
#: contact-form-7/includes/functions.php:96
#, php-format
msgid "From: %s"
msgstr ""
#: contact-form-7/includes/functions.php:97
#, php-format
msgid "Subject: %s"
msgstr ""
#: contact-form-7/includes/functions.php:98
msgid "Message Body:"
msgstr ""
#: contact-form-7/includes/functions.php:99
#: contact-form-7/includes/functions.php:113
#, php-format
msgid "This mail is sent via contact form on %1$s %2$s"
msgstr ""
#: contact-form-7/includes/functions.php:189
msgid "Afrikaans"
msgstr ""
#: contact-form-7/includes/functions.php:190
msgid "Albanian"
msgstr ""
#: contact-form-7/includes/functions.php:191
msgid "Arabic"
msgstr ""
#: contact-form-7/includes/functions.php:192
msgid "Armenian"
msgstr ""
#: contact-form-7/includes/functions.php:193
msgid "Azerbaijani"
msgstr ""
#: contact-form-7/includes/functions.php:194
msgid "Bangla"
msgstr ""
#: contact-form-7/includes/functions.php:195
msgid "Basque"
msgstr ""
#: contact-form-7/includes/functions.php:196
msgid "Belarusian"
msgstr ""
#: contact-form-7/includes/functions.php:197
msgid "Bosnian"
msgstr ""
#: contact-form-7/includes/functions.php:198
msgid "Brazilian Portuguese"
msgstr ""
#: contact-form-7/includes/functions.php:199
msgid "Bulgarian"
msgstr ""
#: contact-form-7/includes/functions.php:200
msgid "Catalan"
msgstr ""
#: contact-form-7/includes/functions.php:201
msgid "Chinese (Simplified)"
msgstr ""
#: contact-form-7/includes/functions.php:202
msgid "Chinese (Traditional)"
msgstr ""
#: contact-form-7/includes/functions.php:203
msgid "Croatian"
msgstr ""
#: contact-form-7/includes/functions.php:204
msgid "Czech"
msgstr ""
#: contact-form-7/includes/functions.php:205
msgid "Danish"
msgstr ""
#: contact-form-7/includes/functions.php:206
msgid "Dutch"
msgstr ""
#: contact-form-7/includes/functions.php:207
msgid "English"
msgstr ""
#: contact-form-7/includes/functions.php:208
msgid "Esperanto"
msgstr ""
#: contact-form-7/includes/functions.php:209
msgid "Estonian"
msgstr ""
#: contact-form-7/includes/functions.php:210
msgid "Finnish"
msgstr ""
#: contact-form-7/includes/functions.php:211
msgid "French"
msgstr ""
#: contact-form-7/includes/functions.php:212
msgid "Galician"
msgstr ""
#: contact-form-7/includes/functions.php:213
msgid "Georgian"
msgstr ""
#: contact-form-7/includes/functions.php:214
msgid "German"
msgstr ""
#: contact-form-7/includes/functions.php:215
msgid "Greek"
msgstr ""
#: contact-form-7/includes/functions.php:216
msgid "Hebrew"
msgstr ""
#: contact-form-7/includes/functions.php:217
msgid "Hindi"
msgstr ""
#: contact-form-7/includes/functions.php:218
msgid "Hungarian"
msgstr ""
#: contact-form-7/includes/functions.php:219
msgid "Indonesian"
msgstr ""
#: contact-form-7/includes/functions.php:220
msgid "Italian"
msgstr ""
#: contact-form-7/includes/functions.php:221
msgid "Japanese"
msgstr ""
#: contact-form-7/includes/functions.php:222
msgid "Korean"
msgstr ""
#: contact-form-7/includes/functions.php:223
msgid "Latvian"
msgstr ""
#: contact-form-7/includes/functions.php:224
msgid "Lithuanian"
msgstr ""
#: contact-form-7/includes/functions.php:225
msgid "Macedonian"
msgstr ""
#: contact-form-7/includes/functions.php:226
msgid "Malay"
msgstr ""
#: contact-form-7/includes/functions.php:227
msgid "Malayalam"
msgstr ""
#: contact-form-7/includes/functions.php:228
msgid "Maltese"
msgstr ""
#: contact-form-7/includes/functions.php:229
msgid "Norwegian"
msgstr ""
#: contact-form-7/includes/functions.php:230
msgid "Persian"
msgstr ""
#: contact-form-7/includes/functions.php:231
msgid "Polish"
msgstr ""
#: contact-form-7/includes/functions.php:232
msgid "Portuguese"
msgstr ""
#: contact-form-7/includes/functions.php:233
msgid "Russian"
msgstr ""
#: contact-form-7/includes/functions.php:234
msgid "Romanian"
msgstr ""
#: contact-form-7/includes/functions.php:235
msgid "Serbian"
msgstr ""
#: contact-form-7/includes/functions.php:236
msgid "Sinhala"
msgstr ""
#: contact-form-7/includes/functions.php:237
msgid "Slovak"
msgstr ""
#: contact-form-7/includes/functions.php:238
msgid "Slovene"
msgstr ""
#: contact-form-7/includes/functions.php:239
msgid "Spanish"
msgstr ""
#: contact-form-7/includes/functions.php:240
msgid "Swedish"
msgstr ""
#: contact-form-7/includes/functions.php:241
msgid "Tamil"
msgstr ""
#: contact-form-7/includes/functions.php:242
msgid "Thai"
msgstr ""
#: contact-form-7/includes/functions.php:243
msgid "Tagalog"
msgstr ""
#: contact-form-7/includes/functions.php:244
msgid "Turkish"
msgstr ""
#: contact-form-7/includes/functions.php:245
msgid "Ukrainian"
msgstr ""
#: contact-form-7/includes/functions.php:246
msgid "Vietnamese"
msgstr ""
#: contact-form-7/modules/acceptance.php:156
msgid "Acceptance"
msgstr ""
#: contact-form-7/modules/acceptance.php:165
#: contact-form-7/modules/captcha.php:215
#: contact-form-7/modules/checkbox.php:191
#: contact-form-7/modules/file.php:241
#: contact-form-7/modules/quiz.php:182
#: contact-form-7/modules/select.php:152
#: contact-form-7/modules/text.php:179
#: contact-form-7/modules/textarea.php:140
msgid "Name"
msgstr ""
#: contact-form-7/modules/acceptance.php:170
#: contact-form-7/modules/acceptance.php:173
#: contact-form-7/modules/captcha.php:222
#: contact-form-7/modules/captcha.php:225
#: contact-form-7/modules/captcha.php:230
#: contact-form-7/modules/captcha.php:233
#: contact-form-7/modules/captcha.php:237
#: contact-form-7/modules/captcha.php:248
#: contact-form-7/modules/captcha.php:251
#: contact-form-7/modules/captcha.php:256
#: contact-form-7/modules/captcha.php:259
#: contact-form-7/modules/checkbox.php:196
#: contact-form-7/modules/checkbox.php:199
#: contact-form-7/modules/file.php:246
#: contact-form-7/modules/file.php:249
#: contact-form-7/modules/file.php:254
#: contact-form-7/modules/file.php:257
#: contact-form-7/modules/quiz.php:187
#: contact-form-7/modules/quiz.php:190
#: contact-form-7/modules/quiz.php:195
#: contact-form-7/modules/quiz.php:198
#: contact-form-7/modules/select.php:157
#: contact-form-7/modules/select.php:160
#: contact-form-7/modules/submit.php:71
#: contact-form-7/modules/submit.php:74
#: contact-form-7/modules/submit.php:79
#: contact-form-7/modules/text.php:184
#: contact-form-7/modules/text.php:187
#: contact-form-7/modules/text.php:192
#: contact-form-7/modules/text.php:195
#: contact-form-7/modules/text.php:200
#: contact-form-7/modules/text.php:211
#: contact-form-7/modules/textarea.php:145
#: contact-form-7/modules/textarea.php:148
#: contact-form-7/modules/textarea.php:153
#: contact-form-7/modules/textarea.php:156
#: contact-form-7/modules/textarea.php:161
msgid "optional"
msgstr ""
#: contact-form-7/modules/acceptance.php:179
msgid "Make this checkbox checked by default?"
msgstr ""
#: contact-form-7/modules/acceptance.php:180
msgid "Make this checkbox work inversely?"
msgstr ""
#: contact-form-7/modules/acceptance.php:181
msgid "* That means visitor who accepts the term unchecks it."
msgstr ""
#: contact-form-7/modules/acceptance.php:186
#: contact-form-7/modules/captcha.php:264
#: contact-form-7/modules/checkbox.php:219
#: contact-form-7/modules/file.php:262
#: contact-form-7/modules/quiz.php:210
#: contact-form-7/modules/select.php:177
#: contact-form-7/modules/submit.php:86
#: contact-form-7/modules/text.php:219
#: contact-form-7/modules/textarea.php:169
msgid "Copy this code and paste it into the form left."
msgstr ""
#: contact-form-7/modules/akismet.php:110
msgid "Akismet judged the sending activity as spamming"
msgstr ""
#: contact-form-7/modules/captcha.php:73
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:187
msgid "The code that sender entered does not match the CAPTCHA"
msgstr ""
#: contact-form-7/modules/captcha.php:188
msgid "Your entered code is incorrect."
msgstr ""
#: contact-form-7/modules/captcha.php:201
msgid "CAPTCHA"
msgstr ""
#: contact-form-7/modules/captcha.php:212
msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
msgstr ""
#: contact-form-7/modules/captcha.php:219
msgid "Image settings"
msgstr ""
#: contact-form-7/modules/captcha.php:230
msgid "Foreground color"
msgstr ""
#: contact-form-7/modules/captcha.php:233
msgid "Background color"
msgstr ""
#: contact-form-7/modules/captcha.php:237
msgid "Image size"
msgstr ""
#: contact-form-7/modules/captcha.php:238
msgid "Small"
msgstr ""
#: contact-form-7/modules/captcha.php:239
msgid "Medium"
msgstr ""
#: contact-form-7/modules/captcha.php:240
msgid "Large"
msgstr ""
#: contact-form-7/modules/captcha.php:245
msgid "Input field settings"
msgstr ""
#: contact-form-7/modules/captcha.php:265
msgid "For image"
msgstr ""
#: contact-form-7/modules/captcha.php:267
msgid "For input field"
msgstr ""
#: contact-form-7/modules/captcha.php:297
#, 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:303
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:164
msgid "Checkboxes"
msgstr ""
#: contact-form-7/modules/checkbox.php:167
msgid "Radio buttons"
msgstr ""
#: contact-form-7/modules/checkbox.php:188
#: contact-form-7/modules/file.php:240
#: contact-form-7/modules/select.php:151
#: contact-form-7/modules/text.php:178
#: contact-form-7/modules/textarea.php:139
msgid "Required field?"
msgstr ""
#: contact-form-7/modules/checkbox.php:204
#: contact-form-7/modules/select.php:165
msgid "Choices"
msgstr ""
#: contact-form-7/modules/checkbox.php:206
#: contact-form-7/modules/select.php:167
msgid "* One choice per line."
msgstr ""
#: contact-form-7/modules/checkbox.php:210
msgid "Put a label first, a checkbox last?"
msgstr ""
#: contact-form-7/modules/checkbox.php:211
msgid "Wrap each item with <label> tag?"
msgstr ""
#: contact-form-7/modules/checkbox.php:213
msgid "Make checkboxes exclusive?"
msgstr ""
#: contact-form-7/modules/checkbox.php:221
#: contact-form-7/modules/select.php:179
#: contact-form-7/modules/text.php:221
#: contact-form-7/modules/textarea.php:171
msgid "And, put this code into the Mail fields below."
msgstr ""
#: contact-form-7/modules/file.php:201
msgid "Uploading a file fails for any reason"
msgstr ""
#: contact-form-7/modules/file.php:202
msgid "Failed to upload file."
msgstr ""
#: contact-form-7/modules/file.php:206
msgid "Uploaded file is not allowed file type"
msgstr ""
#: contact-form-7/modules/file.php:207
msgid "This file type is not allowed."
msgstr ""
#: contact-form-7/modules/file.php:211
msgid "Uploaded file is too large"
msgstr ""
#: contact-form-7/modules/file.php:212
msgid "This file is too large."
msgstr ""
#: contact-form-7/modules/file.php:216
msgid "Uploading a file fails for PHP error"
msgstr ""
#: contact-form-7/modules/file.php:217
msgid "Failed to upload file. Error occurred."
msgstr ""
#: contact-form-7/modules/file.php:231
msgid "File upload"
msgstr ""
#: contact-form-7/modules/file.php:254
msgid "File size limit"
msgstr ""
#: contact-form-7/modules/file.php:254
msgid "bytes"
msgstr ""
#: contact-form-7/modules/file.php:257
msgid "Acceptable file types"
msgstr ""
#: contact-form-7/modules/file.php:264
msgid "And, put this code into the File Attachments field below."
msgstr ""
#: contact-form-7/modules/file.php:289
#, 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/jetpack.php:14
#, php-format
msgid "<strong>Jetpack may cause problems for other plugins in certain cases.</strong> <a href=\"%s\" target=\"_blank\">See how to avoid it.</a>"
msgstr ""
#: contact-form-7/modules/quiz.php:159
msgid "Sender doesn't enter the correct answer to the quiz"
msgstr ""
#: contact-form-7/modules/quiz.php:160
msgid "Your answer is not correct."
msgstr ""
#: contact-form-7/modules/quiz.php:173
msgid "Quiz"
msgstr ""
#: contact-form-7/modules/quiz.php:203
msgid "Quizzes"
msgstr ""
#: contact-form-7/modules/quiz.php:205
msgid "* quiz|answer (e.g. 1+1=?|2)"
msgstr ""
#: contact-form-7/modules/select.php:142
msgid "Drop-down menu"
msgstr ""
#: contact-form-7/modules/select.php:171
msgid "Allow multiple selections?"
msgstr ""
#: contact-form-7/modules/select.php:172
msgid "Insert a blank item as the first option?"
msgstr ""
#: contact-form-7/modules/submit.php:61
msgid "Submit button"
msgstr ""
#: contact-form-7/modules/submit.php:79
msgid "Label"
msgstr ""
#: contact-form-7/modules/text.php:155
msgid "Text field"
msgstr ""
#: contact-form-7/modules/text.php:158
msgid "Email field"
msgstr ""
#: contact-form-7/modules/text.php:200
msgid "Akismet"
msgstr ""
#: contact-form-7/modules/text.php:202
msgid "This field requires author's name"
msgstr ""
#: contact-form-7/modules/text.php:203
msgid "This field requires author's URL"
msgstr ""
#: contact-form-7/modules/text.php:205
msgid "This field requires author's email address"
msgstr ""
#: contact-form-7/modules/text.php:211
#: contact-form-7/modules/textarea.php:161
msgid "Default value"
msgstr ""
#: contact-form-7/modules/text.php:214
#: contact-form-7/modules/textarea.php:164
msgid "Use this text as watermark?"
msgstr ""
#: contact-form-7/modules/textarea.php:130
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,192 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = $id_att = $tabindex_att = '';
$class_att = wpcf7_form_controls_class( $type );
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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 . ' />';
$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 = ( ! empty( $_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 ) {
if ( ! $accepted )
return $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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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,124 @@
<?php
/**
** Akismet Filter
** Akismet API: http://akismet.com/development/api/
**/
add_filter( 'wpcf7_spam', 'wpcf7_akismet' );
function wpcf7_akismet( $spam ) {
global $akismet_api_host, $akismet_api_port;
if ( $spam )
return $spam;
if ( ! function_exists( 'akismet_get_key' ) || ! akismet_get_key() )
return false;
$akismet_ready = false;
$author = $author_email = $author_url = $content = '';
$fes = wpcf7_scan_shortcode();
foreach ( $fes as $fe ) {
if ( ! isset( $fe['name'] ) || ! isset( $_POST[$fe['name']] ) )
continue;
if ( ! is_array( $fe['options'] ) )
continue;
if ( preg_grep( '%^akismet:author$%', $fe['options'] ) ) {
$author .= ' ' . $_POST[$fe['name']];
$author = trim( $author );
$akismet_ready = true;
}
if ( preg_grep( '%^akismet:author_email$%', $fe['options'] ) && '' == $author_email ) {
$author_email = trim( $_POST[$fe['name']] );
$akismet_ready = true;
}
if ( preg_grep( '%^akismet:author_url$%', $fe['options'] ) && '' == $author_url ) {
$author_url = trim( $_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['blog_lang'] = get_locale();
$c['blog_charset'] = get_option( 'blog_charset' );
$c['user_ip'] = preg_replace( '/[^0-9., ]/', '', $_SERVER['REMOTE_ADDR'] );
$c['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
$c['referrer'] = $_SERVER['HTTP_REFERER'];
// http://blog.akismet.com/2012/06/19/pro-tip-tell-us-your-comment_type/
$c['comment_type'] = 'contact-form';
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', 'HTTP_COOKIE2', 'PHP_AUTH_PW' );
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] )
$spam = true;
$spam = apply_filters( 'wpcf7_akismet_comment_check', $spam, $c );
return $spam;
}
/* Messages */
add_filter( 'wpcf7_messages', 'wpcf7_akismet_messages' );
function wpcf7_akismet_messages( $messages ) {
return array_merge( $messages, array( 'akismet_says_spam' => array(
'description' => __( "Akismet judged the sending activity as spamming", 'wpcf7' ),
'default' => __( 'Failed to send your message. Please try later or contact the administrator by another method.', 'wpcf7' )
) ) );
}
add_filter( 'wpcf7_display_message', 'wpcf7_akismet_display_message', 10, 2 );
function wpcf7_akismet_display_message( $message, $status ) {
if ( 'spam' == $status && empty( $message ) )
$message = wpcf7_get_message( 'akismet_says_spam' );
return $message;
}
?>

View File

@ -0,0 +1,520 @@
<?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 = $size_att = $maxlength_att = $tabindex_att = $title_att = '';
$class_att = wpcf7_form_controls_class( $type );
if ( 'captchac' == $type )
$class_att .= ' wpcf7-captcha-' . $name;
if ( $validation_error && 'captchar' == $type )
$class_att .= ' wpcf7-not-valid';
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.
$value = '';
if ( 'captchar' == $type && ! wpcf7_is_posted() && isset( $values[0] ) ) {
$value = $values[0];
if ( wpcf7_script_is() && preg_grep( '%^watermark$%', $options ) ) {
$class_att .= ' wpcf7-use-title-as-watermark';
$title_att .= sprintf( ' %s', $value );
$value = '';
}
}
if ( $id_att )
$atts .= ' id="' . trim( $id_att ) . '"';
if ( $class_att )
$atts .= ' class="' . trim( $class_att ) . '"';
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 );
if ( '' !== $title_att )
$atts .= sprintf( ' title="%s"', trim( esc_attr( $title_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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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_notices', 'wpcf7_captcha_display_warning_message' );
function wpcf7_captcha_display_warning_message() {
if ( empty( $_GET['post'] ) || ! $contact_form = wpcf7_contact_form( $_GET['post'] ) )
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();
$dir = trailingslashit( wpcf7_captcha_tmp_dir() );
$wpcf7_captcha->tmp_dir = $dir;
if ( is_callable( array( $wpcf7_captcha, 'make_tmp_dir' ) ) )
return $wpcf7_captcha->make_tmp_dir();
if ( ! wp_mkdir_p( $dir ) )
return false;
$htaccess_file = $dir . '.htaccess';
if ( file_exists( $htaccess_file ) )
return true;
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
fwrite( $handle, 'Order deny,allow' . "\n" );
fwrite( $handle, 'Deny from all' . "\n" );
fwrite( $handle, '<Files ~ "^[0-9A-Za-z]+\\.(jpeg|gif|png)$">' . "\n" );
fwrite( $handle, ' Allow from all' . "\n" );
fwrite( $handle, '</Files>' . "\n" );
fclose( $handle );
}
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;
if ( ! is_dir( $wpcf7_captcha->tmp_dir ) || ! is_writable( $wpcf7_captcha->tmp_dir ) )
return false;
$img_type = imagetypes();
if ( $img_type & IMG_PNG )
$wpcf7_captcha->img_type = 'png';
elseif ( $img_type & IMG_GIF )
$wpcf7_captcha->img_type = 'gif';
elseif ( $img_type & IMG_JPG )
$wpcf7_captcha->img_type = 'jpeg';
else
return false;
if ( is_array( $options ) ) {
if ( isset( $options['img_size'] ) )
$wpcf7_captcha->img_size = $options['img_size'];
if ( isset( $options['base'] ) )
$wpcf7_captcha->base = $options['base'];
if ( isset( $options['font_size'] ) )
$wpcf7_captcha->font_size = $options['font_size'];
if ( isset( $options['font_char_width'] ) )
$wpcf7_captcha->font_char_width = $options['font_char_width'];
if ( isset( $options['fg'] ) )
$wpcf7_captcha->fg = $options['fg'];
if ( isset( $options['bg'] ) )
$wpcf7_captcha->bg = $options['bg'];
}
$prefix = mt_rand();
$captcha_word = $wpcf7_captcha->generate_random_word();
return $wpcf7_captcha->generate_image( $prefix, $captcha_word );
}
function wpcf7_check_captcha( $prefix, $response ) {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
return $wpcf7_captcha->check( $prefix, $response );
}
function wpcf7_remove_captcha( $prefix ) {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
if ( preg_match( '/[^0-9]/', $prefix ) ) // Contact Form 7 generates $prefix with mt_rand()
return false;
$wpcf7_captcha->remove( $prefix );
}
function wpcf7_cleanup_captcha_files() {
global $wpcf7_captcha;
if ( ! wpcf7_init_captcha() )
return false;
if ( is_callable( array( $wpcf7_captcha, 'cleanup' ) ) )
return $wpcf7_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|txt|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,227 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = $id_att = $tabindex_att = '';
$defaults = array();
$label_first = false;
$use_label_element = false;
$class_att = wpcf7_form_controls_class( $type );
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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>';
$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'];
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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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,346 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = $id_att = $size_att = $tabindex_att = '';
$class_att = wpcf7_form_controls_class( $type );
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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" />';
$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 = isset( $_FILES[$name] ) ? $_FILES[$name] : null;
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';
$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 ( empty( $contact_form->posted_data[$name] ) )
$contact_form->posted_data[$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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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_notices', 'wpcf7_file_display_warning_message' );
function wpcf7_file_display_warning_message() {
if ( empty( $_GET['post'] ) || ! $contact_form = wpcf7_contact_form( $_GET['post'] ) )
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,80 @@
<?php
/**
** Module for Flamingo plugin.
** http://wordpress.org/extend/plugins/flamingo/
**/
add_action( 'flamingo_init', 'wpcf7_flamingo_init' );
function wpcf7_flamingo_init() {
if ( ! class_exists( 'Flamingo_Inbound_Message' ) )
return;
if ( ! term_exists( 'contact-form-7', Flamingo_Inbound_Message::channel_taxonomy ) ) {
wp_insert_term( __( 'Contact Form 7', 'wpcf7' ),
Flamingo_Inbound_Message::channel_taxonomy,
array( 'slug' => 'contact-form-7' ) );
}
}
add_action( 'wpcf7_before_send_mail', 'wpcf7_flamingo_before_send_mail' );
function wpcf7_flamingo_before_send_mail( $contactform ) {
if ( ! ( class_exists( 'Flamingo_Contact' ) && class_exists( 'Flamingo_Inbound_Message' ) ) )
return;
if ( empty( $contactform->posted_data ) || ! empty( $contactform->skip_mail ) )
return;
$fields_senseless = $contactform->form_scan_shortcode(
array( 'type' => array( 'captchar', 'quiz', 'acceptance' ) ) );
$exclude_names = array();
foreach ( $fields_senseless as $tag )
$exclude_names[] = $tag['name'];
$posted_data = $contactform->posted_data;
foreach ( $posted_data as $key => $value ) {
if ( '_' == substr( $key, 0, 1 ) || in_array( $key, $exclude_names ) )
unset( $posted_data[$key] );
}
$meta = array(
'remote_ip' => apply_filters( 'wpcf7_special_mail_tags', '', '_remote_ip' ),
'url' => apply_filters( 'wpcf7_special_mail_tags', '', '_url' ),
'date' => apply_filters( 'wpcf7_special_mail_tags', '', '_date' ),
'time' => apply_filters( 'wpcf7_special_mail_tags', '', '_time' ),
'post_id' => apply_filters( 'wpcf7_special_mail_tags', '', '_post_id' ),
'post_name' => apply_filters( 'wpcf7_special_mail_tags', '', '_post_name' ),
'post_title' => apply_filters( 'wpcf7_special_mail_tags', '', '_post_title' ),
'post_url' => apply_filters( 'wpcf7_special_mail_tags', '', '_post_url' ),
'post_author' => apply_filters( 'wpcf7_special_mail_tags', '', '_post_author' ),
'post_author_email' => apply_filters( 'wpcf7_special_mail_tags', '', '_post_author_email' ) );
$args = array(
'channel' => 'contact-form-7',
'fields' => $posted_data,
'meta' => $meta,
'email' => '',
'name' => '',
'from' => '',
'subject' => '' );
if ( ! empty( $posted_data['your-email'] ) )
$args['from_email'] = $args['email'] = trim( $posted_data['your-email'] );
if ( ! empty( $posted_data['your-name'] ) )
$args['from_name'] = $args['name'] = trim( $posted_data['your-name'] );
if ( ! empty( $posted_data['your-subject'] ) )
$args['subject'] = trim( $posted_data['your-subject'] );
$args['from'] = trim( sprintf( '%s <%s>', $args['from_name'], $args['from_email'] ) );
Flamingo_Contact::add( $args );
Flamingo_Inbound_Message::add( $args );
}
?>

View File

@ -0,0 +1,19 @@
<?php
add_action( 'wpcf7_admin_notices', 'wpcf7_jetpack_admin_notices' );
function wpcf7_jetpack_admin_notices() {
if ( ! class_exists( 'Jetpack' )
|| ! Jetpack::is_module( 'contact-form' )
|| ! in_array( 'contact-form', Jetpack::get_active_modules() ) )
return;
$url = 'http://contactform7.com/jetpack-overrides-contact-forms/';
?>
<div class="error">
<p><?php echo sprintf( __( '<strong>Jetpack may cause problems for other plugins in certain cases.</strong> <a href="%s" target="_blank">See how to avoid it.</a>', 'wpcf7' ), $url ); ?></p>
</div>
<?php
}
?>

View File

@ -0,0 +1,216 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = $id_att = $size_att = $maxlength_att = $tabindex_att = '';
$class_att = wpcf7_form_controls_class( $type );
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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' ) . '" />';
$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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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,185 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = $id_att = $tabindex_att = '';
$defaults = array();
$class_att = wpcf7_form_controls_class( $type );
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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>';
$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'];
if ( isset( $_POST[$name] ) && is_array( $_POST[$name] ) ) {
foreach ( $_POST[$name] as $key => $value ) {
if ( '' === $value )
unset( $_POST[$name][$key] );
}
}
if ( 'select*' == $type ) {
if ( ! isset( $_POST[$name] ) || empty( $_POST[$name] ) && '0' !== $_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_menu', 25 );
function wpcf7_add_tag_generator_menu() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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 = esc_url( $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,92 @@
<?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 = $tabindex_att = '';
$class_att = wpcf7_form_controls_class( '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 . ' />';
return $html;
}
/* Tag generator */
add_action( 'admin_init', 'wpcf7_add_tag_generator_submit', 55 );
function wpcf7_add_tag_generator_submit() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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,227 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = $id_att = $size_att = $maxlength_att = '';
$tabindex_att = $title_att = '';
$class_att = wpcf7_form_controls_class( $type, 'wpcf7-text' );
if ( 'email' == $type || 'email*' == $type )
$class_att .= ' wpcf7-validates-as-email';
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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 = '';
} elseif ( empty( $value ) && is_user_logged_in() ) {
$user = wp_get_current_user();
$user_options = array(
'default:user_login' => 'user_login',
'default:user_email' => 'user_email',
'default:user_url' => 'user_url',
'default:user_first_name' => 'first_name',
'default:user_last_name' => 'last_name',
'default:user_nickname' => 'nickname',
'default:user_display_name' => 'display_name' );
foreach ( $user_options as $option => $prop ) {
if ( preg_grep( '%^' . $option . '$%', $options ) ) {
$value = $user->{$prop};
break;
}
}
}
if ( wpcf7_is_posted() && isset( $_POST[$name] ) )
$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 . ' />';
$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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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,177 @@
<?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 '';
$validation_error = wpcf7_get_validation_error( $name );
$atts = '';
$id_att = '';
$class_att = '';
$cols_att = '';
$rows_att = '';
$tabindex_att = '';
$title_att = '';
$class_att = wpcf7_form_controls_class( $type );
if ( $validation_error )
$class_att .= ' wpcf7-not-valid';
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() && isset( $_POST[$name] ) )
$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_textarea( $value ) . '</textarea>';
$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() {
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
return;
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
}
?>

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