Actualización Contactforms 7
git-svn-id: https://192.168.0.254/svn/Proyectos.FundacionLQDVI_Web/trunk@44 77ab8c26-3d69-2c4d-86f2-786f4ba54905
This commit is contained in:
parent
f90fda9a16
commit
e561dcfc13
310
src/wp-content/plugins/contact-form-7/admin/admin.php
Normal file
310
src/wp-content/plugins/contact-form-7/admin/admin.php
Normal file
@ -0,0 +1,310 @@
|
||||
<?php
|
||||
|
||||
function wpcf7_admin_has_edit_cap() {
|
||||
return current_user_can( WPCF7_ADMIN_READ_WRITE_CAPABILITY );
|
||||
}
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_admin_init' );
|
||||
|
||||
function wpcf7_admin_init() {
|
||||
if ( ! wpcf7_admin_has_edit_cap() )
|
||||
return;
|
||||
|
||||
if ( isset( $_POST['wpcf7-save'] ) ) {
|
||||
$id = $_POST['post_ID'];
|
||||
check_admin_referer( 'wpcf7-save_' . $id );
|
||||
|
||||
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['contactform'] = $contact_form->id;
|
||||
$redirect_to = wpcf7_admin_url( $query );
|
||||
wp_redirect( $redirect_to );
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( isset( $_POST['wpcf7-copy'] ) ) {
|
||||
$id = $_POST['post_ID'];
|
||||
check_admin_referer( 'wpcf7-copy_' . $id );
|
||||
|
||||
$query = array();
|
||||
|
||||
if ( $contact_form = wpcf7_contact_form( $id ) ) {
|
||||
$new_contact_form = $contact_form->copy();
|
||||
$new_contact_form->save();
|
||||
|
||||
$query['contactform'] = $new_contact_form->id;
|
||||
$query['message'] = 'created';
|
||||
} else {
|
||||
$query['contactform'] = $contact_form->id;
|
||||
}
|
||||
|
||||
$redirect_to = wpcf7_admin_url( $query );
|
||||
wp_redirect( $redirect_to );
|
||||
exit();
|
||||
}
|
||||
|
||||
if ( isset( $_POST['wpcf7-delete'] ) ) {
|
||||
$id = $_POST['post_ID'];
|
||||
check_admin_referer( 'wpcf7-delete_' . $id );
|
||||
|
||||
if ( $contact_form = wpcf7_contact_form( $id ) )
|
||||
$contact_form->delete();
|
||||
|
||||
$redirect_to = wpcf7_admin_url( array( 'message' => 'deleted' ) );
|
||||
wp_redirect( $redirect_to );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_menu', 'wpcf7_admin_menu', 9 );
|
||||
|
||||
function wpcf7_admin_menu() {
|
||||
add_menu_page( __( 'Contact Form 7', 'wpcf7' ), __( 'Contact', 'wpcf7' ),
|
||||
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
|
||||
|
||||
add_submenu_page( 'wpcf7', __( 'Edit Contact Forms', 'wpcf7' ), __( 'Edit', 'wpcf7' ),
|
||||
WPCF7_ADMIN_READ_CAPABILITY, 'wpcf7', 'wpcf7_admin_management_page' );
|
||||
}
|
||||
|
||||
add_action( 'admin_print_styles', 'wpcf7_admin_enqueue_styles' );
|
||||
|
||||
function wpcf7_admin_enqueue_styles() {
|
||||
global $plugin_page;
|
||||
|
||||
if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
|
||||
return;
|
||||
|
||||
wp_enqueue_style( 'thickbox' );
|
||||
|
||||
wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/styles.css' ),
|
||||
array(), WPCF7_VERSION, 'all' );
|
||||
|
||||
if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
|
||||
wp_enqueue_style( 'contact-form-7-admin-rtl',
|
||||
wpcf7_plugin_url( 'admin/styles-rtl.css' ), array(), WPCF7_VERSION, 'all' );
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts' );
|
||||
|
||||
function wpcf7_admin_enqueue_scripts() {
|
||||
global $plugin_page;
|
||||
|
||||
if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
|
||||
return;
|
||||
|
||||
wp_enqueue_script( 'thickbox' );
|
||||
wp_enqueue_script( 'postbox' );
|
||||
|
||||
wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/taggenerator.js' ),
|
||||
array( 'jquery' ), WPCF7_VERSION, true );
|
||||
|
||||
wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/scripts.js' ),
|
||||
array( 'jquery', 'wpcf7-admin-taggenerator' ), WPCF7_VERSION, true );
|
||||
wp_localize_script( 'wpcf7-admin', '_wpcf7L10n', array(
|
||||
'generateTag' => __( 'Generate Tag', 'wpcf7' ) ) );
|
||||
}
|
||||
|
||||
add_action( 'admin_footer', 'wpcf7_admin_footer' );
|
||||
|
||||
function wpcf7_admin_footer() {
|
||||
global $plugin_page;
|
||||
|
||||
if ( ! isset( $plugin_page ) || 'wpcf7' != $plugin_page )
|
||||
return;
|
||||
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var _wpcf7 = {
|
||||
pluginUrl: '<?php echo wpcf7_plugin_url(); ?>',
|
||||
tagGenerators: {
|
||||
<?php wpcf7_print_tag_generators(); ?>
|
||||
}
|
||||
};
|
||||
/* ]]> */
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
function wpcf7_admin_management_page() {
|
||||
$contact_forms = get_posts( array(
|
||||
'numberposts' => -1,
|
||||
'orderby' => 'ID',
|
||||
'order' => 'ASC',
|
||||
'post_type' => 'wpcf7_contact_form' ) );
|
||||
|
||||
$cf = null;
|
||||
$unsaved = false;
|
||||
|
||||
if ( ! isset( $_GET['contactform'] ) )
|
||||
$_GET['contactform'] = '';
|
||||
|
||||
if ( 'new' == $_GET['contactform'] && wpcf7_admin_has_edit_cap() ) {
|
||||
$unsaved = true;
|
||||
$current = -1;
|
||||
$cf = wpcf7_get_contact_form_default_pack(
|
||||
array( 'locale' => ( isset( $_GET['locale'] ) ? $_GET['locale'] : '' ) ) );
|
||||
} elseif ( $cf = wpcf7_contact_form( $_GET['contactform'] ) ) {
|
||||
$current = (int) $_GET['contactform'];
|
||||
} else {
|
||||
$first = reset( $contact_forms ); // Returns first item
|
||||
|
||||
if ( $first ) {
|
||||
$current = $first->ID;
|
||||
$cf = wpcf7_contact_form( $current );
|
||||
}
|
||||
}
|
||||
|
||||
require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
|
||||
require_once WPCF7_PLUGIN_DIR . '/admin/edit.php';
|
||||
}
|
||||
|
||||
/* Misc */
|
||||
|
||||
add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 );
|
||||
|
||||
function wpcf7_plugin_action_links( $links, $file ) {
|
||||
if ( $file != WPCF7_PLUGIN_BASENAME )
|
||||
return $links;
|
||||
|
||||
$url = wpcf7_admin_url( array( 'page' => 'wpcf7' ) );
|
||||
|
||||
$settings_link = '<a href="' . esc_attr( $url ) . '">'
|
||||
. esc_html( __( 'Settings', 'wpcf7' ) ) . '</a>';
|
||||
|
||||
array_unshift( $links, $settings_link );
|
||||
|
||||
return $links;
|
||||
}
|
||||
|
||||
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_cf7com_links', 9 );
|
||||
|
||||
function wpcf7_cf7com_links( &$contact_form ) {
|
||||
$links = '<div class="cf7com-links">'
|
||||
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/', 'wpcf7' ) ) . '" target="_blank">'
|
||||
. esc_html( __( 'Contactform7.com', 'wpcf7' ) ) . '</a> '
|
||||
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/docs/', 'wpcf7' ) ) . '" target="_blank">'
|
||||
. esc_html( __( 'Docs', 'wpcf7' ) ) . '</a> - '
|
||||
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/faq/', 'wpcf7' ) ) . '" target="_blank">'
|
||||
. esc_html( __( 'FAQ', 'wpcf7' ) ) . '</a> - '
|
||||
. '<a href="' . esc_url_raw( __( 'http://contactform7.com/support/', 'wpcf7' ) ) . '" target="_blank">'
|
||||
. esc_html( __( 'Support', 'wpcf7' ) ) . '</a>'
|
||||
. '</div>';
|
||||
|
||||
echo apply_filters( 'wpcf7_cf7com_links', $links );
|
||||
}
|
||||
|
||||
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_updated_message' );
|
||||
|
||||
function wpcf7_updated_message( &$contact_form ) {
|
||||
if ( ! isset( $_GET['message'] ) )
|
||||
return;
|
||||
|
||||
switch ( $_GET['message'] ) {
|
||||
case 'created':
|
||||
$updated_message = __( "Contact form created.", 'wpcf7' );
|
||||
break;
|
||||
case 'saved':
|
||||
$updated_message = __( "Contact form saved.", 'wpcf7' );
|
||||
break;
|
||||
case 'deleted':
|
||||
$updated_message = __( "Contact form deleted.", 'wpcf7' );
|
||||
break;
|
||||
}
|
||||
|
||||
if ( ! $updated_message )
|
||||
return;
|
||||
|
||||
?>
|
||||
<div id="message" class="updated"><p><?php echo esc_html( $updated_message ); ?></p></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_donation_link' );
|
||||
|
||||
function wpcf7_donation_link( &$contact_form ) {
|
||||
if ( ! WPCF7_SHOW_DONATION_LINK )
|
||||
return;
|
||||
|
||||
if ( 'new' == $_GET['contactform'] || ! empty($_GET['message']) )
|
||||
return;
|
||||
|
||||
$show_link = true;
|
||||
|
||||
$num = mt_rand( 0, 99 );
|
||||
|
||||
if ( $num >= 20 )
|
||||
$show_link = false;
|
||||
|
||||
$show_link = apply_filters( 'wpcf7_show_donation_link', $show_link );
|
||||
|
||||
if ( ! $show_link )
|
||||
return;
|
||||
|
||||
$texts = array(
|
||||
__( "Contact Form 7 needs your support. Please donate today.", 'wpcf7' ),
|
||||
__( "Your contribution is needed for making this plugin better.", 'wpcf7' ) );
|
||||
|
||||
$text = $texts[array_rand( $texts )];
|
||||
|
||||
?>
|
||||
<div class="donation">
|
||||
<p><a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'wpcf7' ) ); ?>"><?php echo esc_html( $text ); ?></a> <a href="<?php echo esc_url_raw( __( 'http://contactform7.com/donate/', 'wpcf7' ) ); ?>" class="button"><?php echo esc_html( __( "Donate", 'wpcf7' ) ); ?></a></p>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
159
src/wp-content/plugins/contact-form-7/admin/edit.php
Normal file
159
src/wp-content/plugins/contact-form-7/admin/edit.php
Normal file
@ -0,0 +1,159 @@
|
||||
<div class="wrap">
|
||||
|
||||
<?php screen_icon( 'edit-pages' ); ?>
|
||||
|
||||
<h2><?php echo esc_html( __( 'Contact Form 7', 'wpcf7' ) ); ?></h2>
|
||||
|
||||
<?php do_action_ref_array( 'wpcf7_admin_before_subsubsub', array( &$cf ) ); ?>
|
||||
|
||||
<ul class="subsubsub">
|
||||
<?php
|
||||
$first = array_shift( $contact_forms );
|
||||
if ( ! is_null( $first ) ) : ?>
|
||||
<li><a href="<?php echo wpcf7_admin_url( array( 'contactform' => $first->ID ) ); ?>"<?php if ( $first->ID == $current ) echo ' class="current"'; ?>><?php echo esc_html( $first->post_title ); ?></a></li>
|
||||
<?php endif;
|
||||
foreach ( $contact_forms as $v ) : ?>
|
||||
<li>| <a href="<?php echo wpcf7_admin_url( array( 'contactform' => $v->ID ) ); ?>"<?php if ( $v->ID == $current ) echo ' class="current"'; ?>><?php echo esc_html( $v->post_title ); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( wpcf7_admin_has_edit_cap() ) : ?>
|
||||
<li class="addnew"><a class="button thickbox<?php if ( $unsaved ) echo ' current'; ?>" href="#TB_inline?height=300&width=400&inlineId=wpcf7-lang-select-modal"><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
<?php if ( $cf ) : ?>
|
||||
<?php $disabled = ( wpcf7_admin_has_edit_cap() ) ? '' : ' disabled="disabled"'; ?>
|
||||
|
||||
<form method="post" action="<?php echo wpcf7_admin_url( array( 'contactform' => $current ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>>
|
||||
<?php if ( wpcf7_admin_has_edit_cap() ) wp_nonce_field( 'wpcf7-save_' . $current ); ?>
|
||||
<input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $current; ?>" />
|
||||
<input type="hidden" id="wpcf7-id" name="wpcf7-id" value="<?php echo (int) get_post_meta( $cf->id, '_old_cf7_unit_id', true ); ?>" />
|
||||
|
||||
<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( $cf->title ); ?>"<?php echo $disabled; ?> />
|
||||
|
||||
<?php if ( ! $unsaved ) : ?>
|
||||
<p class="tagcode">
|
||||
<?php echo esc_html( __( "Copy this code and paste it into your post, page or text widget content.", 'wpcf7' ) ); ?><br />
|
||||
|
||||
<input type="text" id="contact-form-anchor-text" onfocus="this.select();" readonly="readonly" />
|
||||
</p>
|
||||
|
||||
<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 ( wpcf7_admin_has_edit_cap() ) : ?>
|
||||
<div class="save-contact-form">
|
||||
<input type="submit" class="button" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'wpcf7' ) ); ?>" />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( wpcf7_admin_has_edit_cap() && ! $unsaved ) : ?>
|
||||
<div class="actions-link">
|
||||
<?php $copy_nonce = wp_create_nonce( 'wpcf7-copy_' . $current ); ?>
|
||||
<input type="submit" name="wpcf7-copy" class="copy" value="<?php echo esc_attr( __( 'Copy', 'wpcf7' ) ); ?>"
|
||||
<?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; return true;\""; ?> />
|
||||
|
|
||||
|
||||
<?php $delete_nonce = wp_create_nonce( 'wpcf7-delete_' . $current ); ?>
|
||||
<input type="submit" name="wpcf7-delete" class="delete" value="<?php echo esc_attr( __( 'Delete', 'wpcf7' ) ); ?>"
|
||||
<?php echo "onclick=\"if (confirm('" .
|
||||
esc_js( __( "You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'wpcf7' ) ) .
|
||||
"')) {this.form._wpnonce.value = '$delete_nonce'; return true;} return false;\""; ?> />
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
|
||||
if ( wpcf7_admin_has_edit_cap() ) {
|
||||
add_meta_box( 'formdiv', __( 'Form', 'wpcf7' ),
|
||||
'wpcf7_form_meta_box', 'cfseven', 'form', 'core' );
|
||||
|
||||
add_meta_box( 'maildiv', __( 'Mail', 'wpcf7' ),
|
||||
'wpcf7_mail_meta_box', 'cfseven', 'mail', 'core' );
|
||||
|
||||
add_meta_box( 'mail2div', __( 'Mail (2)', 'wpcf7' ),
|
||||
'wpcf7_mail_meta_box', 'cfseven', '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', 'cfseven', 'messages', 'core' );
|
||||
|
||||
add_meta_box( 'additionalsettingsdiv', __( 'Additional Settings', 'wpcf7' ),
|
||||
'wpcf7_additional_settings_meta_box', 'cfseven', 'additional_settings', 'core' );
|
||||
}
|
||||
|
||||
do_action_ref_array( 'wpcf7_admin_after_general_settings', array( &$cf ) );
|
||||
|
||||
do_meta_boxes( 'cfseven', 'form', $cf );
|
||||
|
||||
do_action_ref_array( 'wpcf7_admin_after_form', array( &$cf ) );
|
||||
|
||||
do_meta_boxes( 'cfseven', 'mail', $cf );
|
||||
|
||||
do_action_ref_array( 'wpcf7_admin_after_mail', array( &$cf ) );
|
||||
|
||||
do_meta_boxes( 'cfseven', 'mail_2', $cf );
|
||||
|
||||
do_action_ref_array( 'wpcf7_admin_after_mail_2', array( &$cf ) );
|
||||
|
||||
do_meta_boxes( 'cfseven', 'messages', $cf );
|
||||
|
||||
do_action_ref_array( 'wpcf7_admin_after_messages', array( &$cf ) );
|
||||
|
||||
do_meta_boxes( 'cfseven', 'additional_settings', $cf );
|
||||
|
||||
do_action_ref_array( 'wpcf7_admin_after_additional_settings', array( &$cf ) );
|
||||
|
||||
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
|
||||
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
|
||||
|
||||
?>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="wpcf7-lang-select-modal" class="hidden">
|
||||
<?php
|
||||
$available_locales = wpcf7_l10n();
|
||||
$default_locale = get_locale();
|
||||
|
||||
if ( ! isset( $available_locales[$default_locale] ) )
|
||||
$default_locale = 'en_US';
|
||||
|
||||
?>
|
||||
<h4><?php echo esc_html( sprintf( __( 'Use the default language (%s)', 'wpcf7' ), $available_locales[$default_locale] ) ); ?></h4>
|
||||
<p><a href="<?php echo wpcf7_admin_url( array( 'contactform' => 'new' ) ); ?>" class="button" /><?php echo esc_html( __( 'Add New', 'wpcf7' ) ); ?></a></p>
|
||||
|
||||
<?php unset( $available_locales[$default_locale] ); ?>
|
||||
<h4><?php echo esc_html( __( 'Or', 'wpcf7' ) ); ?></h4>
|
||||
<form action="" method="get">
|
||||
<input type="hidden" name="page" value="wpcf7" />
|
||||
<input type="hidden" name="contactform" value="new" />
|
||||
<select name="locale">
|
||||
<option value="" selected="selected"><?php echo esc_html( __( '(select language)', 'wpcf7' ) ); ?></option>
|
||||
<?php foreach ( $available_locales as $code => $locale ) : ?>
|
||||
<option value="<?php echo esc_attr( $code ); ?>"><?php echo esc_html( $locale ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input type="submit" class="button" value="<?php echo esc_attr( __( 'Add New', 'wpcf7' ) ); ?>" />
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php do_action_ref_array( 'wpcf7_admin_footer', array( &$cf ) ); ?>
|
||||
@ -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
|
||||
}
|
||||
|
||||
?>
|
||||
73
src/wp-content/plugins/contact-form-7/admin/scripts.js
Normal file
73
src/wp-content/plugins/contact-form-7/admin/scripts.js
Normal file
@ -0,0 +1,73 @@
|
||||
(function($) {
|
||||
|
||||
$(function() {
|
||||
try {
|
||||
$.extend($.tgPanes, _wpcf7.tagGenerators);
|
||||
$('#taggenerator').tagGenerator(_wpcf7L10n.generateTag,
|
||||
{ dropdownIconUrl: _wpcf7.pluginUrl + '/images/dropdown.gif' });
|
||||
|
||||
$('input#wpcf7-title:disabled').css({cursor: 'default'});
|
||||
|
||||
$('input#wpcf7-title').mouseover(function() {
|
||||
$(this).not('.focus').addClass('mouseover');
|
||||
});
|
||||
|
||||
$('input#wpcf7-title').mouseout(function() {
|
||||
$(this).removeClass('mouseover');
|
||||
});
|
||||
|
||||
$('input#wpcf7-title').focus(function() {
|
||||
$(this).addClass('focus').removeClass('mouseover');
|
||||
});
|
||||
|
||||
$('input#wpcf7-title').blur(function() {
|
||||
$(this).removeClass('focus');
|
||||
});
|
||||
|
||||
$('input#wpcf7-title').change(function() {
|
||||
updateTag();
|
||||
});
|
||||
|
||||
updateTag();
|
||||
|
||||
$('.check-if-these-fields-are-active').each(function(index) {
|
||||
if (! $(this).is(':checked'))
|
||||
$(this).parent().siblings('.mail-fields').hide();
|
||||
|
||||
$(this).click(function() {
|
||||
if ($(this).parent().siblings('.mail-fields').is(':hidden')
|
||||
&& $(this).is(':checked')) {
|
||||
$(this).parent().siblings('.mail-fields').slideDown('fast');
|
||||
} else if ($(this).parent().siblings('.mail-fields').is(':visible')
|
||||
&& $(this).not(':checked')) {
|
||||
$(this).parent().siblings('.mail-fields').slideUp('fast');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
postboxes.add_postbox_toggles('cfseven');
|
||||
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
|
||||
function updateTag() {
|
||||
var title = $('input#wpcf7-title').val();
|
||||
|
||||
if (title)
|
||||
title = title.replace(/["'\[\]]/g, '');
|
||||
|
||||
$('input#wpcf7-title').val(title);
|
||||
var postId = $('input#post_ID').val();
|
||||
var tag = '[contact-form-7 id="' + postId + '" title="' + title + '"]';
|
||||
$('input#contact-form-anchor-text').val(tag);
|
||||
|
||||
var oldId = $('input#wpcf7-id').val();
|
||||
|
||||
if (0 != oldId) {
|
||||
var tagOld = '[contact-form ' + oldId + ' "' + title + '"]';
|
||||
$('input#contact-form-anchor-text-old').val(tagOld).parent('p.tagcode').show();
|
||||
}
|
||||
}
|
||||
|
||||
})(jQuery);
|
||||
18
src/wp-content/plugins/contact-form-7/admin/styles-rtl.css
Normal file
18
src/wp-content/plugins/contact-form-7/admin/styles-rtl.css
Normal file
@ -0,0 +1,18 @@
|
||||
ul.subsubsub li.addnew {
|
||||
margin-left: 0;
|
||||
margin-right: 0.5em;
|
||||
}
|
||||
div.save-contact-form {
|
||||
direction: rtl;
|
||||
}
|
||||
div.actions-link {
|
||||
right: auto;
|
||||
left: 0;
|
||||
}
|
||||
div.tg-pane table caption {
|
||||
text-align: right;
|
||||
}
|
||||
div.tg-dropdown {
|
||||
left: auto;
|
||||
right: 0;
|
||||
}
|
||||
279
src/wp-content/plugins/contact-form-7/admin/styles.css
Normal file
279
src/wp-content/plugins/contact-form-7/admin/styles.css
Normal file
@ -0,0 +1,279 @@
|
||||
div.wrap div.cf7com-links {
|
||||
text-align: right;
|
||||
font-size: .8em;
|
||||
margin-top: -1.6em;
|
||||
}
|
||||
|
||||
div.wrap div.cf7com-links a {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
div.wrap div.donation {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
padding: 0 0.6em;
|
||||
margin: 5px 0 15px;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background-color: #ffffe0;
|
||||
border-color: #e6db55;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.wrap div.donation p {
|
||||
margin: .7em 0;
|
||||
line-height: 1;
|
||||
padding: 2px;
|
||||
font-size: 107%;
|
||||
}
|
||||
|
||||
div.wrap div.donation p a {
|
||||
font-weight: bold;
|
||||
color: #3f3f3f;
|
||||
}
|
||||
|
||||
div.wrap div.donation p a.button {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
div.wrap ul.subsubsub {
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
ul.subsubsub li.addnew {
|
||||
margin-left: 0.5em;
|
||||
}
|
||||
|
||||
ul.subsubsub li.addnew a {
|
||||
color: #e6255b;
|
||||
}
|
||||
|
||||
ul.subsubsub li.addnew a.current {
|
||||
border: 1px solid #bbb;
|
||||
}
|
||||
|
||||
ul.subsubsub li.addnew a:hover,
|
||||
ul.subsubsub li.addnew a:active {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
#titlediv {
|
||||
margin-bottom: 20px;
|
||||
position: relative;
|
||||
border: 1px solid #c7c7c7;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
div.save-contact-form {
|
||||
padding: 1.4em 0 0 0;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.actions-link {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
margin: 0;
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
div.actions-link input {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
font-size: 11px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.actions-link input.copy {
|
||||
color: #006505;
|
||||
}
|
||||
|
||||
div.actions-link input.delete {
|
||||
color: #bc0b0b;
|
||||
}
|
||||
|
||||
input#wpcf7-title {
|
||||
color: #555;
|
||||
border: none;
|
||||
font: bold 20px serif;
|
||||
cursor: pointer;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
input#wpcf7-title.focus {
|
||||
color: #333;
|
||||
border: 1px solid #777;
|
||||
font: normal 13px Verdana, Arial, Helvetica, sans-serif;
|
||||
cursor: text;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
input#wpcf7-title.mouseover {
|
||||
background-color: #ffffdd;
|
||||
}
|
||||
|
||||
p.tagcode {
|
||||
color: #333;
|
||||
margin: 2ex 0 1ex 0;
|
||||
}
|
||||
|
||||
input#contact-form-anchor-text, input#contact-form-anchor-text-old {
|
||||
color: #fff;
|
||||
background: #7e4e0b;
|
||||
border: none;
|
||||
width: 100%;
|
||||
-moz-border-radius: 6px;
|
||||
-khtml-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.postbox .half, .postbox .half-left, .postbox .half-right {
|
||||
float: left;
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.postbox .half-right > * {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.postbox .mail-field, .postbox .message-field {
|
||||
margin-top: 6px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.postbox .mail-field label, .postbox .message-field label {
|
||||
line-height: 1.4em;
|
||||
}
|
||||
|
||||
div.pseudo-hr {
|
||||
border-bottom: 1px solid transparent;
|
||||
margin: 8px 0;
|
||||
}
|
||||
|
||||
input, textarea {
|
||||
border: 1px solid #dfdfdf;
|
||||
}
|
||||
|
||||
input.wide {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
label.disabled {
|
||||
color: #777;
|
||||
}
|
||||
|
||||
div.tag-generator {
|
||||
position: relative;
|
||||
background: transparent;
|
||||
padding: 0 0 5px 1px;
|
||||
}
|
||||
|
||||
div.tg-pane {
|
||||
border: 1px dashed #999;
|
||||
background: #f1f1f1;
|
||||
margin: 1ex 0 0 0;
|
||||
padding: 10px;
|
||||
-moz-border-radius: 6px;
|
||||
-khtml-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
line-height: 140%;
|
||||
}
|
||||
|
||||
div.tg-pane table {
|
||||
width: 100%;
|
||||
margin: 0 0 0.7em 0;
|
||||
}
|
||||
|
||||
div.tg-pane table caption {
|
||||
text-align: left;
|
||||
padding: 0 0 0.2em 0;
|
||||
font-weight: bolder;
|
||||
color: #777;
|
||||
}
|
||||
|
||||
div.tg-pane table code {
|
||||
background-color: inherit;
|
||||
}
|
||||
|
||||
div.tg-pane table td {
|
||||
vertical-align: top;
|
||||
width: 50%;
|
||||
border: none;
|
||||
padding: 2px 0;
|
||||
}
|
||||
|
||||
div.tg-pane input.tag, div.tg-pane input.mail-tag {
|
||||
width: 100%;
|
||||
border: none;
|
||||
color: #fff;
|
||||
background-color: #7e4e0b;
|
||||
-moz-border-radius: 6px;
|
||||
-khtml-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
div.tg-pane input.mail-tag {
|
||||
width: 50%;
|
||||
background-color: #404f03;
|
||||
}
|
||||
|
||||
div.tg-mail-tag {
|
||||
margin-top: 2.4em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
div.tg-pane span.arrow {
|
||||
font-family: monospace;
|
||||
font-size: 1.2em;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
div.tg-pane input.tg-name {
|
||||
border-color: #555;
|
||||
}
|
||||
|
||||
div.tg-pane input.oneline {
|
||||
width: 98%;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
div.tg-pane textarea {
|
||||
width: 98%;
|
||||
height: 100px;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
div.tg-pane div.tg-tag {
|
||||
margin: .4em 0;
|
||||
}
|
||||
|
||||
div.tg-dropdown {
|
||||
position: absolute;
|
||||
top: 26px;
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
border: 1px solid #ddd;
|
||||
}
|
||||
|
||||
span.tg-closebutton {
|
||||
color: #777;
|
||||
font: bold 18px monospace;
|
||||
padding: 1px 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
div.tg-panetitle {
|
||||
font: bold 132% sans-serif;
|
||||
margin: 0 0 10px;
|
||||
color: #777;
|
||||
}
|
||||
262
src/wp-content/plugins/contact-form-7/admin/taggenerator.js
Normal file
262
src/wp-content/plugins/contact-form-7/admin/taggenerator.js
Normal 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">×</span>');
|
||||
closeButton.click(function() {
|
||||
pane.slideUp('fast').empty();
|
||||
});
|
||||
closeButtonDiv.append(closeButton);
|
||||
|
||||
pane.append(closeButtonDiv);
|
||||
|
||||
var paneTitle = $('<div class="tg-panetitle">' + $.tgPanes[tagType].title + '</div>');
|
||||
pane.append(paneTitle);
|
||||
|
||||
pane.append($('#' + $.tgPanes[tagType].content).clone().contents());
|
||||
|
||||
pane.find(':checkbox.exclusive').change(function() {
|
||||
if ($(this).is(':checked'))
|
||||
$(this).siblings(':checkbox.exclusive').removeAttr('checked');
|
||||
});
|
||||
|
||||
if ($.isFunction($.tgPanes[tagType].change))
|
||||
$.tgPanes[tagType].change(pane, tagType);
|
||||
else
|
||||
$.tgCreateTag(pane, tagType);
|
||||
|
||||
pane.find(':input').change(function() {
|
||||
if ($.isFunction($.tgPanes[tagType].change))
|
||||
$.tgPanes[tagType].change(pane, tagType);
|
||||
else
|
||||
$.tgCreateTag(pane, tagType);
|
||||
});
|
||||
}
|
||||
|
||||
$.tgCreateTag = function(pane, tagType) {
|
||||
pane.find('input[name="name"]').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = val.replace(/[^0-9a-zA-Z:._-]/g, '').replace(/^[^a-zA-Z]+/, '');
|
||||
if ('' == val) {
|
||||
var rand = Math.floor(Math.random() * 1000);
|
||||
val = tagType + '-' + rand;
|
||||
}
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.numeric').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = val.replace(/[^0-9]/g, '');
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.idvalue').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = val.replace(/[^-0-9a-zA-Z_]/g, '');
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.classvalue').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = $.map(val.split(' '), function(n) {
|
||||
return n.replace(/[^-0-9a-zA-Z_]/g, '');
|
||||
}).join(' ');
|
||||
val = $.trim(val.replace(/\s+/g, ' '));
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.color').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = val.replace(/[^0-9a-fA-F]/g, '');
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.filesize').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = val.replace(/[^0-9kKmMbB]/g, '');
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.filetype').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = val.replace(/[^0-9a-zA-Z.\s]/g, '');
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find(':input.date').each(function(i) {
|
||||
var val = $(this).val();
|
||||
if (! val.match(/^\d{4}-\d{1,2}-\d{1,2}$/)) // 'yyyy-mm-dd' ISO 8601 format
|
||||
$(this).val('');
|
||||
});
|
||||
|
||||
pane.find(':input[name="values"]').each(function(i) {
|
||||
var val = $(this).val();
|
||||
val = $.trim(val);
|
||||
$(this).val(val);
|
||||
});
|
||||
|
||||
pane.find('input.tag').each(function(i) {
|
||||
var type = $(this).attr('name');
|
||||
|
||||
var scope = pane.find('.scope.' + type);
|
||||
if (! scope.length)
|
||||
scope = pane;
|
||||
|
||||
if (pane.find(':input[name="required"]').is(':checked'))
|
||||
type += '*';
|
||||
|
||||
var name = pane.find(':input[name="name"]').val();
|
||||
|
||||
var options = [];
|
||||
|
||||
var size = scope.find(':input[name="size"]').val();
|
||||
var maxlength = scope.find(':input[name="maxlength"]').val();
|
||||
if (size || maxlength)
|
||||
options.push(size + '/' + maxlength);
|
||||
|
||||
var cols = scope.find(':input[name="cols"]').val();
|
||||
var rows = scope.find(':input[name="rows"]').val();
|
||||
if (cols || rows)
|
||||
options.push(cols + 'x' + rows);
|
||||
|
||||
scope.find('input:text.option').each(function(i) {
|
||||
if (-1 < $.inArray($(this).attr('name'), ['size', 'maxlength', 'cols', 'rows']))
|
||||
return;
|
||||
|
||||
var val = $(this).val();
|
||||
|
||||
if (! val)
|
||||
return;
|
||||
|
||||
if ($(this).hasClass('filetype'))
|
||||
val = val.split(' ').join('|');
|
||||
|
||||
if ($(this).hasClass('color'))
|
||||
val = '#' + val;
|
||||
|
||||
if ('class' == $(this).attr('name')) {
|
||||
$.each(val.split(' '), function(i, n) { options.push('class:' + n) });
|
||||
} else {
|
||||
options.push($(this).attr('name') + ':' + val);
|
||||
}
|
||||
});
|
||||
|
||||
scope.find('input:checkbox.option').each(function(i) {
|
||||
if ($(this).is(':checked'))
|
||||
options.push($(this).attr('name'));
|
||||
});
|
||||
|
||||
options = (options.length > 0) ? ' ' + options.join(' ') : '';
|
||||
|
||||
var value = '';
|
||||
|
||||
if (scope.find(':input[name="values"]').val()) {
|
||||
$.each(scope.find(':input[name="values"]').val().split("\n"), function(i, n) {
|
||||
value += ' "' + n.replace(/["]/g, '"') + '"';
|
||||
});
|
||||
}
|
||||
|
||||
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);
|
||||
BIN
src/wp-content/plugins/contact-form-7/images/ajax-loader.gif
Normal file
BIN
src/wp-content/plugins/contact-form-7/images/ajax-loader.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 847 B |
BIN
src/wp-content/plugins/contact-form-7/images/dropdown.gif
Normal file
BIN
src/wp-content/plugins/contact-form-7/images/dropdown.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 67 B |
578
src/wp-content/plugins/contact-form-7/includes/classes.php
Normal file
578
src/wp-content/plugins/contact-form-7/includes/classes.php
Normal file
@ -0,0 +1,578 @@
|
||||
<?php
|
||||
|
||||
class WPCF7_ContactForm {
|
||||
|
||||
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;
|
||||
|
||||
// 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 );
|
||||
$enctype = apply_filters( 'wpcf7_form_enctype', '' );
|
||||
$class = apply_filters( 'wpcf7_form_class_attr', 'wpcf7-form' );
|
||||
|
||||
$form .= '<form action="' . esc_url_raw( $url ) . '" method="post"'
|
||||
. ' class="' . esc_attr( $class ) . '"' . $enctype . '>' . "\n";
|
||||
$form .= '<div style="display: none;">' . "\n";
|
||||
$form .= '<input type="hidden" name="_wpcf7" value="'
|
||||
. esc_attr( $this->id ) . '" />' . "\n";
|
||||
$form .= '<input type="hidden" name="_wpcf7_version" value="'
|
||||
. esc_attr( WPCF7_VERSION ) . '" />' . "\n";
|
||||
$form .= '<input type="hidden" name="_wpcf7_unit_tag" value="'
|
||||
. esc_attr( $this->unit_tag ) . '" />' . "\n";
|
||||
$form .= '</div>' . "\n";
|
||||
$form .= $this->form_elements();
|
||||
|
||||
if ( ! $this->responses_count )
|
||||
$form .= $this->form_response_output();
|
||||
|
||||
$form .= '</form>';
|
||||
|
||||
$form .= '</div>';
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function form_response_output() {
|
||||
$class = 'wpcf7-response-output';
|
||||
$content = '';
|
||||
|
||||
if ( $this->is_posted() ) { // Post response output for non-AJAX
|
||||
if ( isset( $_POST['_wpcf7_mail_sent'] ) && $_POST['_wpcf7_mail_sent']['id'] == $this->id ) {
|
||||
if ( $_POST['_wpcf7_mail_sent']['ok'] ) {
|
||||
$class .= ' wpcf7-mail-sent-ok';
|
||||
$content = $_POST['_wpcf7_mail_sent']['message'];
|
||||
} else {
|
||||
$class .= ' wpcf7-mail-sent-ng';
|
||||
if ( $_POST['_wpcf7_mail_sent']['spam'] )
|
||||
$class .= ' wpcf7-spam-blocked';
|
||||
$content = $_POST['_wpcf7_mail_sent']['message'];
|
||||
}
|
||||
} elseif ( isset( $_POST['_wpcf7_validation_errors'] ) && $_POST['_wpcf7_validation_errors']['id'] == $this->id ) {
|
||||
$class .= ' wpcf7-validation-errors';
|
||||
$content = $this->message( 'validation_error' );
|
||||
}
|
||||
} else {
|
||||
$class .= ' wpcf7-display-none';
|
||||
}
|
||||
|
||||
$class = ' class="' . $class . '"';
|
||||
|
||||
return '<div' . $class . '>' . $content . '</div>';
|
||||
}
|
||||
|
||||
function validation_error( $name ) {
|
||||
if ( ! $this->is_posted() )
|
||||
return '';
|
||||
|
||||
if ( ! isset( $_POST['_wpcf7_validation_errors']['messages'][$name] ) )
|
||||
return '';
|
||||
|
||||
$ve = trim( $_POST['_wpcf7_validation_errors']['messages'][$name] );
|
||||
|
||||
if ( ! empty( $ve ) ) {
|
||||
$ve = '<span class="wpcf7-not-valid-tip-no-ajax">' . esc_html( $ve ) . '</span>';
|
||||
return apply_filters( 'wpcf7_validation_error', $ve, $name, $this );
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/* Form Elements */
|
||||
|
||||
function form_do_shortcode() {
|
||||
global $wpcf7_shortcode_manager;
|
||||
|
||||
$form = $this->form;
|
||||
|
||||
if ( WPCF7_AUTOP ) {
|
||||
$form = $wpcf7_shortcode_manager->normalize_shortcode( $form );
|
||||
$form = wpcf7_autop( $form );
|
||||
}
|
||||
|
||||
$form = $wpcf7_shortcode_manager->do_shortcode( $form );
|
||||
$this->scanned_form_tags = $wpcf7_shortcode_manager->scanned_tags;
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function form_scan_shortcode( $cond = null ) {
|
||||
global $wpcf7_shortcode_manager;
|
||||
|
||||
if ( ! empty( $this->scanned_form_tags ) ) {
|
||||
$scanned = $this->scanned_form_tags;
|
||||
} else {
|
||||
$scanned = $wpcf7_shortcode_manager->scan_shortcode( $this->form );
|
||||
$this->scanned_form_tags = $scanned;
|
||||
}
|
||||
|
||||
if ( empty( $scanned ) )
|
||||
return null;
|
||||
|
||||
if ( ! is_array( $cond ) || empty( $cond ) )
|
||||
return $scanned;
|
||||
|
||||
for ( $i = 0, $size = count( $scanned ); $i < $size; $i++ ) {
|
||||
|
||||
if ( isset( $cond['type'] ) ) {
|
||||
if ( is_string( $cond['type'] ) && ! empty( $cond['type'] ) ) {
|
||||
if ( $scanned[$i]['type'] != $cond['type'] ) {
|
||||
unset( $scanned[$i] );
|
||||
continue;
|
||||
}
|
||||
} elseif ( is_array( $cond['type'] ) ) {
|
||||
if ( ! in_array( $scanned[$i]['type'], $cond['type'] ) ) {
|
||||
unset( $scanned[$i] );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset( $cond['name'] ) ) {
|
||||
if ( is_string( $cond['name'] ) && ! empty( $cond['name'] ) ) {
|
||||
if ( $scanned[$i]['name'] != $cond['name'] ) {
|
||||
unset ( $scanned[$i] );
|
||||
continue;
|
||||
}
|
||||
} elseif ( is_array( $cond['name'] ) ) {
|
||||
if ( ! in_array( $scanned[$i]['name'], $cond['name'] ) ) {
|
||||
unset( $scanned[$i] );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array_values( $scanned );
|
||||
}
|
||||
|
||||
function form_elements() {
|
||||
return apply_filters( 'wpcf7_form_elements', $this->form_do_shortcode() );
|
||||
}
|
||||
|
||||
/* Validate */
|
||||
|
||||
function validate() {
|
||||
$fes = $this->form_scan_shortcode();
|
||||
|
||||
$result = array( 'valid' => true, 'reason' => array() );
|
||||
|
||||
foreach ( $fes as $fe ) {
|
||||
$result = apply_filters( 'wpcf7_validate_' . $fe['type'], $result, $fe );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* Mail */
|
||||
|
||||
function mail() {
|
||||
$fes = $this->form_scan_shortcode();
|
||||
|
||||
foreach ( $fes as $fe ) {
|
||||
if ( empty( $fe['name'] ) )
|
||||
continue;
|
||||
|
||||
$name = $fe['name'];
|
||||
$pipes = $fe['pipes'];
|
||||
$value = $_POST[$name];
|
||||
|
||||
if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
||||
if ( is_array( $value) ) {
|
||||
$new_value = array();
|
||||
foreach ( $value as $v ) {
|
||||
$new_value[] = $pipes->do_pipe( stripslashes( $v ) );
|
||||
}
|
||||
$value = $new_value;
|
||||
} else {
|
||||
$value = $pipes->do_pipe( stripslashes( $value ) );
|
||||
}
|
||||
}
|
||||
|
||||
$this->posted_data[$name] = $value;
|
||||
}
|
||||
|
||||
if ( $this->in_demo_mode() )
|
||||
$this->skip_mail = true;
|
||||
|
||||
do_action_ref_array( 'wpcf7_before_send_mail', array( &$this ) );
|
||||
|
||||
if ( $this->skip_mail )
|
||||
return true;
|
||||
|
||||
if ( $this->compose_and_send_mail( $this->mail ) ) {
|
||||
$additional_mail = array();
|
||||
|
||||
if ( $this->mail_2['active'] )
|
||||
$additional_mail[] = $this->mail_2;
|
||||
|
||||
$additional_mail = apply_filters_ref_array( 'wpcf7_additional_mail',
|
||||
array( $additional_mail, &$this ) );
|
||||
|
||||
foreach ( $additional_mail as $mail )
|
||||
$this->compose_and_send_mail( $mail );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function compose_and_send_mail( $mail_template ) {
|
||||
$regex = '/\[\s*([a-zA-Z_][0-9a-zA-Z:._-]*)\s*\]/';
|
||||
|
||||
$use_html = (bool) $mail_template['use_html'];
|
||||
|
||||
$callback = array( &$this, 'mail_callback' );
|
||||
$callback_html = array( &$this, 'mail_callback_html' );
|
||||
|
||||
$subject = preg_replace_callback( $regex, $callback, $mail_template['subject'] );
|
||||
$sender = preg_replace_callback( $regex, $callback, $mail_template['sender'] );
|
||||
$recipient = preg_replace_callback( $regex, $callback, $mail_template['recipient'] );
|
||||
$additional_headers =
|
||||
preg_replace_callback( $regex, $callback, $mail_template['additional_headers'] );
|
||||
|
||||
if ( $use_html ) {
|
||||
$body = preg_replace_callback( $regex, $callback_html, $mail_template['body'] );
|
||||
$body = wpautop( $body );
|
||||
} else {
|
||||
$body = preg_replace_callback( $regex, $callback, $mail_template['body'] );
|
||||
}
|
||||
|
||||
$attachments = array();
|
||||
|
||||
foreach ( (array) $this->uploaded_files as $name => $path ) {
|
||||
if ( false === strpos( $mail_template['attachments'], "[${name}]" ) || empty( $path ) )
|
||||
continue;
|
||||
|
||||
$attachments[] = $path;
|
||||
}
|
||||
|
||||
extract( apply_filters_ref_array( 'wpcf7_mail_components', array(
|
||||
compact( 'subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments' ),
|
||||
&$this ) ) );
|
||||
|
||||
$headers = "From: $sender\n";
|
||||
|
||||
if ( $use_html )
|
||||
$headers .= "Content-Type: text/html\n";
|
||||
|
||||
$headers .= trim( $additional_headers ) . "\n";
|
||||
|
||||
return @wp_mail( $recipient, $subject, $body, $headers, $attachments );
|
||||
}
|
||||
|
||||
function mail_callback_html( $matches ) {
|
||||
return $this->mail_callback( $matches, true );
|
||||
}
|
||||
|
||||
function mail_callback( $matches, $html = false ) {
|
||||
if ( isset( $this->posted_data[$matches[1]] ) ) {
|
||||
$submitted = $this->posted_data[$matches[1]];
|
||||
|
||||
if ( is_array( $submitted ) )
|
||||
$replaced = join( ', ', $submitted );
|
||||
else
|
||||
$replaced = $submitted;
|
||||
|
||||
if ( $html ) {
|
||||
$replaced = strip_tags( $replaced );
|
||||
$replaced = wptexturize( $replaced );
|
||||
}
|
||||
|
||||
$replaced = apply_filters( 'wpcf7_mail_tag_replaced', $replaced, $submitted );
|
||||
|
||||
return stripslashes( $replaced );
|
||||
}
|
||||
|
||||
if ( $special = apply_filters( 'wpcf7_special_mail_tags', '', $matches[1] ) )
|
||||
return $special;
|
||||
|
||||
return $matches[0];
|
||||
}
|
||||
|
||||
/* Message */
|
||||
|
||||
function message( $status ) {
|
||||
$messages = $this->messages;
|
||||
$message = isset( $messages[$status] ) ? $messages[$status] : '';
|
||||
|
||||
return apply_filters( 'wpcf7_display_message', $message, $status );
|
||||
}
|
||||
|
||||
/* Additional settings */
|
||||
|
||||
function additional_setting( $name, $max = 1 ) {
|
||||
$tmp_settings = (array) explode( "\n", $this->additional_settings );
|
||||
|
||||
$count = 0;
|
||||
$values = array();
|
||||
|
||||
foreach ( $tmp_settings as $setting ) {
|
||||
if ( preg_match('/^([a-zA-Z0-9_]+)\s*:(.*)$/', $setting, $matches ) ) {
|
||||
if ( $matches[1] != $name )
|
||||
continue;
|
||||
|
||||
if ( ! $max || $count < (int) $max ) {
|
||||
$values[] = trim( $matches[2] );
|
||||
$count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $values;
|
||||
}
|
||||
|
||||
function in_demo_mode() {
|
||||
$settings = $this->additional_setting( 'demo_mode', false );
|
||||
|
||||
foreach ( $settings as $setting ) {
|
||||
if ( in_array( $setting, array( 'on', 'true', '1' ) ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Upgrade */
|
||||
|
||||
function upgrade() {
|
||||
if ( ! isset( $this->mail['recipient'] ) )
|
||||
$this->mail['recipient'] = get_option( 'admin_email' );
|
||||
|
||||
|
||||
if ( ! is_array( $this->messages ) )
|
||||
$this->messages = array();
|
||||
|
||||
|
||||
foreach ( wpcf7_messages() as $key => $arr ) {
|
||||
if ( ! isset( $this->messages[$key] ) )
|
||||
$this->messages[$key] = $arr['default'];
|
||||
}
|
||||
}
|
||||
|
||||
/* Save */
|
||||
|
||||
function save() {
|
||||
$postarr = array(
|
||||
'ID' => (int) $this->id,
|
||||
'post_type' => 'wpcf7_contact_form',
|
||||
'post_status' => 'publish',
|
||||
'post_title' => $this->title );
|
||||
|
||||
$post_id = wp_insert_post( $postarr );
|
||||
|
||||
if ( $post_id ) {
|
||||
update_post_meta( $post_id, 'form', $this->form );
|
||||
update_post_meta( $post_id, 'mail', $this->mail );
|
||||
update_post_meta( $post_id, 'mail_2', $this->mail_2 );
|
||||
update_post_meta( $post_id, 'messages', $this->messages );
|
||||
update_post_meta( $post_id, 'additional_settings', $this->additional_settings );
|
||||
|
||||
if ( $this->initial ) {
|
||||
$this->initial = false;
|
||||
$this->id = $post_id;
|
||||
do_action_ref_array( 'wpcf7_after_create', array( &$this ) );
|
||||
} else {
|
||||
do_action_ref_array( 'wpcf7_after_update', array( &$this ) );
|
||||
}
|
||||
|
||||
do_action_ref_array( 'wpcf7_after_save', array( &$this ) );
|
||||
}
|
||||
|
||||
return $post_id;
|
||||
}
|
||||
|
||||
function copy() {
|
||||
$new = new WPCF7_ContactForm();
|
||||
$new->initial = true;
|
||||
$new->title = $this->title . '_copy';
|
||||
|
||||
$new->form = $this->form;
|
||||
$new->mail = $this->mail;
|
||||
$new->mail_2 = $this->mail_2;
|
||||
$new->messages = $this->messages;
|
||||
$new->additional_settings = $this->additional_settings;
|
||||
|
||||
$new = apply_filters_ref_array( 'wpcf7_copy', array( &$new, &$this ) );
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
function delete() {
|
||||
if ( $this->initial )
|
||||
return;
|
||||
|
||||
wp_delete_post( $this->id, true );
|
||||
|
||||
$this->initial = true;
|
||||
$this->id = null;
|
||||
}
|
||||
}
|
||||
|
||||
function wpcf7_contact_form( $id ) {
|
||||
$post = get_post( $id );
|
||||
|
||||
if ( empty( $post ) || 'wpcf7_contact_form' != get_post_type( $post ) )
|
||||
return false;
|
||||
|
||||
$contact_form = new WPCF7_ContactForm();
|
||||
$contact_form->id = $post->ID;
|
||||
$contact_form->title = $post->post_title;
|
||||
|
||||
$contact_form->form = get_post_meta( $post->ID, 'form', true );
|
||||
$contact_form->mail = get_post_meta( $post->ID, 'mail', true );
|
||||
$contact_form->mail_2 = get_post_meta( $post->ID, 'mail_2', true );
|
||||
$contact_form->messages = get_post_meta( $post->ID, 'messages', true );
|
||||
$contact_form->additional_settings = get_post_meta( $post->ID, 'additional_settings', true );
|
||||
|
||||
$contact_form->upgrade();
|
||||
|
||||
$contact_form = apply_filters_ref_array( 'wpcf7_contact_form', array( &$contact_form ) );
|
||||
|
||||
return $contact_form;
|
||||
}
|
||||
|
||||
function wpcf7_get_contact_form_by_old_id( $old_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
|
||||
. $wpdb->prepare( " AND meta_value = %d", $old_id );
|
||||
|
||||
if ( $new_id = $wpdb->get_var( $q ) )
|
||||
return wpcf7_contact_form( $new_id );
|
||||
}
|
||||
|
||||
function wpcf7_contact_form_default_pack( $locale = null ) {
|
||||
// For backward compatibility
|
||||
|
||||
return wpcf7_get_contact_form_default_pack( array( 'locale' => $locale ) );
|
||||
}
|
||||
|
||||
function wpcf7_get_contact_form_default_pack( $args = '' ) {
|
||||
global $l10n;
|
||||
|
||||
$defaults = array( 'locale' => null, 'title' => '' );
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
$locale = $args['locale'];
|
||||
$title = $args['title'];
|
||||
|
||||
if ( $locale && $locale != get_locale() ) {
|
||||
$mo_orig = $l10n['wpcf7'];
|
||||
unset( $l10n['wpcf7'] );
|
||||
|
||||
if ( 'en_US' != $locale ) {
|
||||
$mofile = wpcf7_plugin_path( 'languages/wpcf7-' . $locale . '.mo' );
|
||||
if ( ! load_textdomain( 'wpcf7', $mofile ) ) {
|
||||
$l10n['wpcf7'] = $mo_orig;
|
||||
unset( $mo_orig );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$contact_form = new WPCF7_ContactForm();
|
||||
$contact_form->initial = true;
|
||||
|
||||
$contact_form->title = ( $title ? $title : __( 'Untitled', 'wpcf7' ) );
|
||||
|
||||
$contact_form->form = wpcf7_get_default_template( 'form' );
|
||||
$contact_form->mail = wpcf7_get_default_template( 'mail' );
|
||||
$contact_form->mail_2 = wpcf7_get_default_template( 'mail_2' );
|
||||
$contact_form->messages = wpcf7_get_default_template( 'messages' );
|
||||
$contact_form->additional_settings = wpcf7_get_default_template( 'additional_settings' );
|
||||
|
||||
if ( isset( $mo_orig ) )
|
||||
$l10n['wpcf7'] = $mo_orig;
|
||||
|
||||
$contact_form = apply_filters_ref_array( 'wpcf7_contact_form_default_pack',
|
||||
array( &$contact_form, $args ) );
|
||||
|
||||
return $contact_form;
|
||||
}
|
||||
|
||||
function wpcf7_get_current_contact_form() {
|
||||
global $wpcf7_contact_form;
|
||||
|
||||
if ( ! is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
|
||||
return null;
|
||||
|
||||
return $wpcf7_contact_form;
|
||||
}
|
||||
|
||||
function wpcf7_is_posted() {
|
||||
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
||||
return false;
|
||||
|
||||
return $contact_form->is_posted();
|
||||
}
|
||||
|
||||
function wpcf7_get_validation_error( $name ) {
|
||||
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
||||
return '';
|
||||
|
||||
return $contact_form->validation_error( $name );
|
||||
}
|
||||
|
||||
function wpcf7_get_message( $status ) {
|
||||
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
||||
return '';
|
||||
|
||||
return $contact_form->message( $status );
|
||||
}
|
||||
|
||||
function wpcf7_scan_shortcode( $cond = null ) {
|
||||
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
||||
return null;
|
||||
|
||||
return $contact_form->form_scan_shortcode( $cond );
|
||||
}
|
||||
|
||||
?>
|
||||
327
src/wp-content/plugins/contact-form-7/includes/controller.php
Normal file
327
src/wp-content/plugins/contact-form-7/includes/controller.php
Normal file
@ -0,0 +1,327 @@
|
||||
<?php
|
||||
|
||||
add_action( 'init', 'wpcf7_ajax_onload', 11 );
|
||||
|
||||
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 ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
|
||||
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
||||
echo $echo;
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
add_action( 'init', 'wpcf7_ajax_json_echo', 11 );
|
||||
|
||||
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 = $_POST['_wpcf7_unit_tag'];
|
||||
|
||||
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
|
||||
|
||||
$items = array(
|
||||
'mailSent' => false,
|
||||
'into' => '#' . $unit_tag,
|
||||
'captcha' => null );
|
||||
|
||||
$result = wpcf7_submit( true );
|
||||
|
||||
if ( ! empty( $result['message'] ) )
|
||||
$items['message'] = $result['message'];
|
||||
|
||||
if ( $result['mail_sent'] )
|
||||
$items['mailSent'] = true;
|
||||
|
||||
if ( ! $result['valid'] ) {
|
||||
$invalids = array();
|
||||
|
||||
foreach ( $result['invalid_reasons'] as $name => $reason ) {
|
||||
$invalids[] = array(
|
||||
'into' => 'span.wpcf7-form-control-wrap.' . $name,
|
||||
'message' => $reason );
|
||||
}
|
||||
|
||||
$items['invalids'] = $invalids;
|
||||
}
|
||||
|
||||
if ( $result['spam'] )
|
||||
$items['spam'] = true;
|
||||
|
||||
if ( ! empty( $result['scripts_on_sent_ok'] ) )
|
||||
$items['onSentOk'] = $result['scripts_on_sent_ok'];
|
||||
|
||||
$items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result );
|
||||
|
||||
$wpcf7_contact_form = null;
|
||||
}
|
||||
}
|
||||
|
||||
$echo = json_encode( $items );
|
||||
|
||||
if ( $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ) {
|
||||
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
|
||||
echo $echo;
|
||||
} else {
|
||||
@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
|
||||
echo '<textarea>' . $echo . '</textarea>';
|
||||
}
|
||||
|
||||
exit();
|
||||
}
|
||||
|
||||
add_action( 'init', 'wpcf7_submit_nonajax', 11 );
|
||||
|
||||
function wpcf7_submit_nonajax() {
|
||||
global $wpcf7_contact_form;
|
||||
|
||||
if ( ! isset( $_POST['_wpcf7'] ) )
|
||||
return;
|
||||
|
||||
$id = (int) $_POST['_wpcf7'];
|
||||
|
||||
if ( $wpcf7_contact_form = wpcf7_contact_form( $id ) ) {
|
||||
$result = wpcf7_submit();
|
||||
|
||||
if ( ! $result['valid'] ) {
|
||||
$_POST['_wpcf7_validation_errors'] = array(
|
||||
'id' => $id,
|
||||
'messages' => $result['invalid_reasons'] );
|
||||
} else {
|
||||
$_POST['_wpcf7_mail_sent'] = array(
|
||||
'id' => $id,
|
||||
'ok' => $result['mail_sent'],
|
||||
'message' => $result['message'],
|
||||
'spam' => $result['spam'] );
|
||||
}
|
||||
|
||||
$wpcf7_contact_form = null;
|
||||
}
|
||||
}
|
||||
|
||||
function wpcf7_submit( $ajax = false ) {
|
||||
global $wpcf7_contact_form;
|
||||
|
||||
if ( ! is_a( $wpcf7_contact_form, 'WPCF7_ContactForm' ) )
|
||||
return false;
|
||||
|
||||
$result = array(
|
||||
'valid' => true,
|
||||
'invalid_reasons' => array(),
|
||||
'spam' => false,
|
||||
'message' => '',
|
||||
'mail_sent' => false,
|
||||
'scripts_on_sent_ok' => null );
|
||||
|
||||
$validation = $wpcf7_contact_form->validate();
|
||||
|
||||
if ( ! $validation['valid'] ) { // Validation error occured
|
||||
$result['valid'] = false;
|
||||
$result['invalid_reasons'] = $validation['reason'];
|
||||
$result['message'] = wpcf7_get_message( 'validation_error' );
|
||||
|
||||
} elseif ( ! apply_filters( 'wpcf7_acceptance', true ) ) { // Not accepted terms
|
||||
$result['message'] = wpcf7_get_message( 'accept_terms' );
|
||||
|
||||
} elseif ( apply_filters( 'wpcf7_spam', false ) ) { // Spam!
|
||||
$result['message'] = wpcf7_get_message( 'spam' );
|
||||
$result['spam'] = true;
|
||||
|
||||
} elseif ( $wpcf7_contact_form->mail() ) {
|
||||
$result['mail_sent'] = true;
|
||||
$result['message'] = wpcf7_get_message( 'mail_sent_ok' );
|
||||
|
||||
do_action_ref_array( 'wpcf7_mail_sent', array( &$wpcf7_contact_form ) );
|
||||
|
||||
if ( $ajax ) {
|
||||
$on_sent_ok = $wpcf7_contact_form->additional_setting( 'on_sent_ok', false );
|
||||
|
||||
if ( ! empty( $on_sent_ok ) )
|
||||
$result['scripts_on_sent_ok'] = array_map( 'wpcf7_strip_quote', $on_sent_ok );
|
||||
} else {
|
||||
$wpcf7_contact_form->clear_post();
|
||||
}
|
||||
|
||||
} else {
|
||||
$result['message'] = wpcf7_get_message( 'mail_sent_ng' );
|
||||
}
|
||||
|
||||
// remove upload files
|
||||
foreach ( (array) $wpcf7_contact_form->uploaded_files as $name => $path ) {
|
||||
@unlink( $path );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
add_action( 'the_post', 'wpcf7_the_post' );
|
||||
|
||||
function wpcf7_the_post() {
|
||||
global $wpcf7;
|
||||
|
||||
$wpcf7->processing_within = 'p' . get_the_ID();
|
||||
$wpcf7->unit_count = 0;
|
||||
}
|
||||
|
||||
add_action( 'loop_end', 'wpcf7_loop_end' );
|
||||
|
||||
function wpcf7_loop_end() {
|
||||
global $wpcf7;
|
||||
|
||||
$wpcf7->processing_within = '';
|
||||
}
|
||||
|
||||
add_filter( 'widget_text', 'wpcf7_widget_text_filter', 9 );
|
||||
|
||||
function wpcf7_widget_text_filter( $content ) {
|
||||
global $wpcf7;
|
||||
|
||||
if ( ! preg_match( '/\[\s*contact-form(-7)?\s.*?\]/', $content ) )
|
||||
return $content;
|
||||
|
||||
$wpcf7->widget_count += 1;
|
||||
$wpcf7->processing_within = 'w' . $wpcf7->widget_count;
|
||||
$wpcf7->unit_count = 0;
|
||||
|
||||
$content = do_shortcode( $content );
|
||||
|
||||
$wpcf7->processing_within = '';
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/* Shortcodes */
|
||||
|
||||
add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' );
|
||||
add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' );
|
||||
|
||||
function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) {
|
||||
global $wpcf7, $wpcf7_contact_form;
|
||||
|
||||
if ( is_feed() )
|
||||
return '[contact-form-7]';
|
||||
|
||||
if ( 'contact-form-7' == $code ) {
|
||||
$atts = shortcode_atts( array( 'id' => 0, 'title' => '' ), $atts );
|
||||
$id = (int) $atts['id'];
|
||||
$wpcf7_contact_form = wpcf7_contact_form( $id );
|
||||
} else {
|
||||
if ( is_string( $atts ) )
|
||||
$atts = explode( ' ', $atts, 2 );
|
||||
|
||||
$id = (int) array_shift( $atts );
|
||||
$wpcf7_contact_form = wpcf7_get_contact_form_by_old_id( $id );
|
||||
}
|
||||
|
||||
if ( ! $wpcf7_contact_form )
|
||||
return '[contact-form-7 404 "Not Found"]';
|
||||
|
||||
if ( $wpcf7->processing_within ) { // Inside post content or text widget
|
||||
$wpcf7->unit_count += 1;
|
||||
$unit_count = $wpcf7->unit_count;
|
||||
$processing_within = $wpcf7->processing_within;
|
||||
|
||||
} else { // Inside template
|
||||
|
||||
if ( ! isset( $wpcf7->global_unit_count ) )
|
||||
$wpcf7->global_unit_count = 0;
|
||||
|
||||
$wpcf7->global_unit_count += 1;
|
||||
$unit_count = 1;
|
||||
$processing_within = 't' . $wpcf7->global_unit_count;
|
||||
}
|
||||
|
||||
$unit_tag = 'wpcf7-f' . $wpcf7_contact_form->id . '-' . $processing_within . '-o' . $unit_count;
|
||||
$wpcf7_contact_form->unit_tag = $unit_tag;
|
||||
|
||||
$form = $wpcf7_contact_form->form_html();
|
||||
|
||||
$wpcf7_contact_form = null;
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
add_action( 'wp_head', 'wpcf7_head' );
|
||||
|
||||
function wpcf7_head() {
|
||||
// Cached?
|
||||
if ( wpcf7_script_is() && defined( 'WP_CACHE' ) && WP_CACHE ) :
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var _wpcf7 = { cached: 1 };
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
}
|
||||
|
||||
if ( WPCF7_LOAD_JS )
|
||||
add_action( 'wp_enqueue_scripts', 'wpcf7_enqueue_scripts' );
|
||||
|
||||
function wpcf7_enqueue_scripts() {
|
||||
// jquery.form.js originally bundled with WordPress is out of date and deprecated
|
||||
// so we need to deregister it and re-register the latest one
|
||||
wp_deregister_script( 'jquery-form' );
|
||||
wp_register_script( 'jquery-form', wpcf7_plugin_url( 'jquery.form.js' ),
|
||||
array( 'jquery' ), '2.52', true );
|
||||
|
||||
$in_footer = true;
|
||||
if ( 'header' === WPCF7_LOAD_JS )
|
||||
$in_footer = false;
|
||||
|
||||
wp_enqueue_script( 'contact-form-7', wpcf7_plugin_url( 'scripts.js' ),
|
||||
array( 'jquery', 'jquery-form' ), WPCF7_VERSION, $in_footer );
|
||||
|
||||
do_action( 'wpcf7_enqueue_scripts' );
|
||||
}
|
||||
|
||||
function wpcf7_script_is() {
|
||||
return wp_script_is( 'contact-form-7' );
|
||||
}
|
||||
|
||||
if ( WPCF7_LOAD_CSS )
|
||||
add_action( 'wp_print_styles', 'wpcf7_enqueue_styles' );
|
||||
|
||||
function wpcf7_enqueue_styles() {
|
||||
wp_enqueue_style( 'contact-form-7', wpcf7_plugin_url( 'styles.css' ),
|
||||
array(), WPCF7_VERSION, 'all' );
|
||||
|
||||
if ( 'rtl' == get_bloginfo( 'text_direction' ) ) {
|
||||
wp_enqueue_style( 'contact-form-7-rtl', wpcf7_plugin_url( 'styles-rtl.css' ),
|
||||
array(), WPCF7_VERSION, 'all' );
|
||||
}
|
||||
|
||||
do_action( 'wpcf7_enqueue_styles' );
|
||||
}
|
||||
|
||||
function wpcf7_style_is() {
|
||||
return wp_style_is( 'contact-form-7' );
|
||||
}
|
||||
|
||||
?>
|
||||
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
function wpcf7_autop( $pee, $br = 1 ) {
|
||||
|
||||
if ( trim( $pee ) === '' )
|
||||
return '';
|
||||
$pee = $pee . "\n"; // just to make things a little easier, pad the end
|
||||
$pee = preg_replace( '|<br />\s*<br />|', "\n\n", $pee );
|
||||
// Space things out a little
|
||||
/* wpcf7: remove select and input */
|
||||
$allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';
|
||||
$pee = preg_replace( '!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee );
|
||||
$pee = preg_replace( '!(</' . $allblocks . '>)!', "$1\n\n", $pee );
|
||||
$pee = str_replace( array( "\r\n", "\r" ), "\n", $pee ); // cross-platform newlines
|
||||
if ( strpos( $pee, '<object' ) !== false ) {
|
||||
$pee = preg_replace( '|\s*<param([^>]*)>\s*|', "<param$1>", $pee ); // no pee inside object/embed
|
||||
$pee = preg_replace( '|\s*</embed>\s*|', '</embed>', $pee );
|
||||
}
|
||||
$pee = preg_replace( "/\n\n+/", "\n\n", $pee ); // take care of duplicates
|
||||
// make paragraphs, including one at the end
|
||||
$pees = preg_split( '/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY );
|
||||
$pee = '';
|
||||
foreach ( $pees as $tinkle )
|
||||
$pee .= '<p>' . trim( $tinkle, "\n" ) . "</p>\n";
|
||||
$pee = preg_replace( '|<p>\s*</p>|', '', $pee ); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace( '!<p>([^<]+)</(div|address|form|fieldset)>!', "<p>$1</p></$2>", $pee );
|
||||
$pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee ); // don't pee all over a tag
|
||||
$pee = preg_replace( "|<p>(<li.+?)</p>|", "$1", $pee ); // problem with nested lists
|
||||
$pee = preg_replace( '|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee );
|
||||
$pee = str_replace( '</blockquote></p>', '</p></blockquote>', $pee );
|
||||
$pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee );
|
||||
$pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee );
|
||||
if ( $br ) {
|
||||
/* wpcf7: add textarea */
|
||||
$pee = preg_replace_callback( '/<(script|style|textarea).*?<\/\\1>/s', create_function( '$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);' ), $pee );
|
||||
$pee = preg_replace( '|(?<!<br />)\s*\n|', "<br />\n", $pee ); // optionally make line breaks
|
||||
$pee = str_replace( '<WPPreserveNewline />', "\n", $pee );
|
||||
}
|
||||
$pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee );
|
||||
$pee = preg_replace( '!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee );
|
||||
if ( strpos( $pee, '<pre' ) !== false )
|
||||
$pee = preg_replace_callback( '!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
|
||||
$pee = preg_replace( "|\n</p>$|", '</p>', $pee );
|
||||
|
||||
return $pee;
|
||||
}
|
||||
|
||||
function wpcf7_strip_quote( $text ) {
|
||||
$text = trim( $text );
|
||||
if ( preg_match( '/^"(.*)"$/', $text, $matches ) )
|
||||
$text = $matches[1];
|
||||
elseif ( preg_match( "/^'(.*)'$/", $text, $matches ) )
|
||||
$text = $matches[1];
|
||||
return $text;
|
||||
}
|
||||
|
||||
function wpcf7_strip_quote_deep( $arr ) {
|
||||
if ( is_string( $arr ) )
|
||||
return wpcf7_strip_quote( $arr );
|
||||
|
||||
if ( is_array( $arr ) ) {
|
||||
$result = array();
|
||||
foreach ( $arr as $key => $text ) {
|
||||
$result[$key] = wpcf7_strip_quote( $text );
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
function wpcf7_canonicalize( $text ) {
|
||||
if ( function_exists( 'mb_convert_kana' ) && 'UTF-8' == get_option( 'blog_charset' ) )
|
||||
$text = mb_convert_kana( $text, 'asKV', 'UTF-8' );
|
||||
|
||||
$text = strtolower( $text );
|
||||
$text = trim( $text );
|
||||
return $text;
|
||||
}
|
||||
|
||||
function wpcf7_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 );
|
||||
}
|
||||
|
||||
?>
|
||||
222
src/wp-content/plugins/contact-form-7/includes/functions.php
Normal file
222
src/wp-content/plugins/contact-form-7/includes/functions.php
Normal file
@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
function wpcf7_messages() {
|
||||
$messages = array(
|
||||
'mail_sent_ok' => array(
|
||||
'description' => __( "Sender's message was sent successfully", 'wpcf7' ),
|
||||
'default' => __( 'Your message was sent successfully. Thanks.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'mail_sent_ng' => array(
|
||||
'description' => __( "Sender's message was failed to send", 'wpcf7' ),
|
||||
'default' => __( 'Failed to send your message. Please try later or contact the administrator by another method.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'validation_error' => array(
|
||||
'description' => __( "Validation errors occurred", 'wpcf7' ),
|
||||
'default' => __( 'Validation errors occurred. Please confirm the fields and submit it again.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'accept_terms' => array(
|
||||
'description' => __( "There is a field of term that sender is needed to accept", 'wpcf7' ),
|
||||
'default' => __( 'Please accept the terms to proceed.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'invalid_email' => array(
|
||||
'description' => __( "Email address that sender entered is invalid", 'wpcf7' ),
|
||||
'default' => __( 'Email address seems invalid.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'invalid_required' => array(
|
||||
'description' => __( "There is a field that sender is needed to fill in", 'wpcf7' ),
|
||||
'default' => __( 'Please fill the required field.', 'wpcf7' )
|
||||
)
|
||||
);
|
||||
|
||||
return apply_filters( 'wpcf7_messages', $messages );
|
||||
}
|
||||
|
||||
function wpcf7_get_default_template( $prop = 'form' ) {
|
||||
if ( 'form' == $prop )
|
||||
$template = wpcf7_default_form_template();
|
||||
elseif ( 'mail' == $prop )
|
||||
$template = wpcf7_default_mail_template();
|
||||
elseif ( 'mail_2' == $prop )
|
||||
$template = wpcf7_default_mail_2_template();
|
||||
elseif ( 'messages' == $prop )
|
||||
$template = wpcf7_default_messages_template();
|
||||
else
|
||||
$template = null;
|
||||
|
||||
return apply_filters( 'wpcf7_default_template', $template, $prop );
|
||||
}
|
||||
|
||||
function wpcf7_default_form_template() {
|
||||
$template =
|
||||
'<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' ),
|
||||
'bn_BD' => __( 'Bangla', 'wpcf7' ),
|
||||
'bs' => __( 'Bosnian', 'wpcf7' ),
|
||||
'pt_BR' => __( 'Brazilian Portuguese', 'wpcf7' ),
|
||||
'bg_BG' => __( 'Bulgarian', 'wpcf7' ),
|
||||
'ca' => __( 'Catalan', 'wpcf7' ),
|
||||
'zh_CN' => __( 'Chinese (Simplified)', 'wpcf7' ),
|
||||
'zh_TW' => __( 'Chinese (Traditional)', 'wpcf7' ),
|
||||
'hr' => __( 'Croatian', 'wpcf7' ),
|
||||
'cs_CZ' => __( 'Czech', 'wpcf7' ),
|
||||
'da_DK' => __( 'Danish', 'wpcf7' ),
|
||||
'nl_NL' => __( 'Dutch', 'wpcf7' ),
|
||||
'en_US' => __( 'English', 'wpcf7' ),
|
||||
'et' => __( 'Estonian', 'wpcf7' ),
|
||||
'fi' => __( 'Finnish', 'wpcf7' ),
|
||||
'fr_FR' => __( 'French', 'wpcf7' ),
|
||||
'gl_ES' => __( 'Galician', 'wpcf7' ),
|
||||
'ka_GE' => __( 'Georgian', 'wpcf7' ),
|
||||
'de_DE' => __( 'German', 'wpcf7' ),
|
||||
'el' => __( 'Greek', 'wpcf7' ),
|
||||
'he_IL' => __( 'Hebrew', 'wpcf7' ),
|
||||
'hi_IN' => __( 'Hindi', 'wpcf7' ),
|
||||
'hu_HU' => __( 'Hungarian', 'wpcf7' ),
|
||||
'id_ID' => __( 'Indonesian', 'wpcf7' ),
|
||||
'it_IT' => __( 'Italian', 'wpcf7' ),
|
||||
'ja' => __( 'Japanese', 'wpcf7' ),
|
||||
'ko_KR' => __( 'Korean', 'wpcf7' ),
|
||||
'lv' => __( 'Latvian', 'wpcf7' ),
|
||||
'lt_LT' => __( 'Lithuanian', 'wpcf7' ),
|
||||
'mk_MK' => __( 'Macedonian', 'wpcf7' ),
|
||||
'ms_MY' => __( 'Malay', 'wpcf7' ),
|
||||
'ml_IN' => __( 'Malayalam', 'wpcf7' ),
|
||||
'nb_NO' => __( 'Norwegian', 'wpcf7' ),
|
||||
'fa_IR' => __( 'Persian', 'wpcf7' ),
|
||||
'pl_PL' => __( 'Polish', 'wpcf7' ),
|
||||
'pt_PT' => __( 'Portuguese', 'wpcf7' ),
|
||||
'ru_RU' => __( 'Russian', 'wpcf7' ),
|
||||
'ro_RO' => __( 'Romanian', 'wpcf7' ),
|
||||
'sr_RS' => __( 'Serbian', 'wpcf7' ),
|
||||
'si_LK' => __( 'Sinhala', 'wpcf7' ),
|
||||
'sk' => __( 'Slovak', 'wpcf7' ),
|
||||
'sl_SI' => __( 'Slovene', 'wpcf7' ),
|
||||
'es_ES' => __( 'Spanish', 'wpcf7' ),
|
||||
'sv_SE' => __( 'Swedish', 'wpcf7' ),
|
||||
'ta' => __( 'Tamil', 'wpcf7' ),
|
||||
'th' => __( 'Thai', 'wpcf7' ),
|
||||
'tr_TR' => __( 'Turkish', 'wpcf7' ),
|
||||
'uk' => __( 'Ukrainian', 'wpcf7' ),
|
||||
'vi' => __( 'Vietnamese', 'wpcf7' )
|
||||
);
|
||||
|
||||
return $l10n;
|
||||
}
|
||||
|
||||
?>
|
||||
67
src/wp-content/plugins/contact-form-7/includes/pipe.php
Normal file
67
src/wp-content/plugins/contact-form-7/includes/pipe.php
Normal 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 )];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
185
src/wp-content/plugins/contact-form-7/includes/shortcodes.php
Normal file
185
src/wp-content/plugins/contact-form-7/includes/shortcodes.php
Normal file
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
class WPCF7_ShortcodeManager {
|
||||
|
||||
var $shortcode_tags = array();
|
||||
|
||||
// Taggs scanned at the last time of do_shortcode()
|
||||
var $scanned_tags = null;
|
||||
|
||||
// Executing shortcodes (true) or just scanning (false)
|
||||
var $exec = true;
|
||||
|
||||
function add_shortcode( $tag, $func, $has_name = false ) {
|
||||
if ( is_callable( $func ) )
|
||||
$this->shortcode_tags[$tag] = array(
|
||||
'function' => $func,
|
||||
'has_name' => (boolean) $has_name );
|
||||
}
|
||||
|
||||
function remove_shortcode( $tag ) {
|
||||
unset( $this->shortcode_tags[$tag] );
|
||||
}
|
||||
|
||||
function normalize_shortcode( $content ) {
|
||||
if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags ) )
|
||||
return $content;
|
||||
|
||||
$pattern = $this->get_shortcode_regex();
|
||||
return preg_replace_callback( '/' . $pattern . '/s',
|
||||
array( &$this, 'normalize_space_cb' ), $content );
|
||||
}
|
||||
|
||||
function normalize_space_cb( $m ) {
|
||||
// allow [[foo]] syntax for escaping a tag
|
||||
if ( $m[1] == '[' && $m[6] == ']' )
|
||||
return $m[0];
|
||||
|
||||
$tag = $m[2];
|
||||
$attr = trim( preg_replace( '/\s+/', ' ', $m[3] ) );
|
||||
$content = trim( $m[5] );
|
||||
|
||||
$result = $m[1] . '[' . $tag
|
||||
. ( $attr ? ' ' . $attr : '' )
|
||||
. ( $m[4] ? ' ' . $m[4] : '' )
|
||||
. ']'
|
||||
. ( $content ? $content . '[/' . $tag . ']' : '' )
|
||||
. $m[6];
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
function do_shortcode( $content, $exec = true ) {
|
||||
$this->exec = (bool) $exec;
|
||||
$this->scanned_tags = array();
|
||||
|
||||
if ( empty( $this->shortcode_tags ) || ! is_array( $this->shortcode_tags ) )
|
||||
return $content;
|
||||
|
||||
$pattern = $this->get_shortcode_regex();
|
||||
return preg_replace_callback( '/' . $pattern . '/s',
|
||||
array( &$this, 'do_shortcode_tag' ), $content );
|
||||
}
|
||||
|
||||
function scan_shortcode( $content ) {
|
||||
$this->do_shortcode( $content, false );
|
||||
return $this->scanned_tags;
|
||||
}
|
||||
|
||||
function get_shortcode_regex() {
|
||||
$tagnames = array_keys( $this->shortcode_tags );
|
||||
$tagregexp = join( '|', array_map( 'preg_quote', $tagnames ) );
|
||||
|
||||
return '(\[?)'
|
||||
. '\[(' . $tagregexp . ')(?:\s(.*?))?(?:\s(\/))?\]'
|
||||
. '(?:([^[]*?)\[\/\2\])?'
|
||||
. '(\]?)';
|
||||
}
|
||||
|
||||
function do_shortcode_tag( $m ) {
|
||||
// allow [[foo]] syntax for escaping a tag
|
||||
if ( $m[1] == '[' && $m[6] == ']' ) {
|
||||
return substr( $m[0], 1, -1 );
|
||||
}
|
||||
|
||||
$tag = $m[2];
|
||||
$attr = $this->shortcode_parse_atts( $m[3] );
|
||||
|
||||
$scanned_tag = array();
|
||||
$scanned_tag['type'] = $tag;
|
||||
|
||||
if ( is_array( $attr ) ) {
|
||||
if ( is_array( $attr['options'] ) ) {
|
||||
if ( $this->shortcode_tags[$tag]['has_name'] && ! empty( $attr['options'] ) ) {
|
||||
$scanned_tag['name'] = array_shift( $attr['options'] );
|
||||
|
||||
if ( ! wpcf7_is_name( $scanned_tag['name'] ) )
|
||||
return $m[0]; // Invalid name is used. Ignore this tag.
|
||||
}
|
||||
|
||||
$scanned_tag['options'] = (array) $attr['options'];
|
||||
}
|
||||
|
||||
$scanned_tag['raw_values'] = (array) $attr['values'];
|
||||
|
||||
if ( WPCF7_USE_PIPE ) {
|
||||
$pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] );
|
||||
$scanned_tag['values'] = $pipes->collect_befores();
|
||||
$scanned_tag['pipes'] = $pipes;
|
||||
} else {
|
||||
$scanned_tag['values'] = $scanned_tag['raw_values'];
|
||||
}
|
||||
|
||||
$scanned_tag['labels'] = $scanned_tag['values'];
|
||||
|
||||
} else {
|
||||
$scanned_tag['attr'] = $attr;
|
||||
}
|
||||
|
||||
$content = trim( $m[5] );
|
||||
$content = preg_replace( "/<br\s*\/?>$/m", '', $content );
|
||||
$scanned_tag['content'] = $content;
|
||||
|
||||
$scanned_tag = apply_filters( 'wpcf7_form_tag', $scanned_tag, $this->exec );
|
||||
|
||||
$this->scanned_tags[] = $scanned_tag;
|
||||
|
||||
if ( $this->exec ) {
|
||||
$func = $this->shortcode_tags[$tag]['function'];
|
||||
return $m[1] . call_user_func( $func, $scanned_tag ) . $m[6];
|
||||
} else {
|
||||
return $m[0];
|
||||
}
|
||||
}
|
||||
|
||||
function shortcode_parse_atts( $text ) {
|
||||
$atts = array( 'options' => array(), 'values' => array() );
|
||||
$text = preg_replace( "/[\x{00a0}\x{200b}]+/u", " ", $text );
|
||||
$text = stripcslashes( trim( $text ) );
|
||||
|
||||
$pattern = '%^([-+*=0-9a-zA-Z:.!?#$&@_/|\%\s]*?)((?:\s*"[^"]*"|\s*\'[^\']*\')*)$%';
|
||||
|
||||
if ( preg_match( $pattern, $text, $match ) ) {
|
||||
if ( ! empty( $match[1] ) ) {
|
||||
$atts['options'] = preg_split( '/[\s]+/', trim( $match[1] ) );
|
||||
}
|
||||
if ( ! empty( $match[2] ) ) {
|
||||
preg_match_all( '/"[^"]*"|\'[^\']*\'/', $match[2], $matched_values );
|
||||
$atts['values'] = wpcf7_strip_quote_deep( $matched_values[0] );
|
||||
}
|
||||
} else {
|
||||
$atts = $text;
|
||||
}
|
||||
|
||||
return $atts;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$wpcf7_shortcode_manager = new WPCF7_ShortcodeManager();
|
||||
|
||||
function wpcf7_add_shortcode( $tag, $func, $has_name = false ) {
|
||||
global $wpcf7_shortcode_manager;
|
||||
|
||||
return $wpcf7_shortcode_manager->add_shortcode( $tag, $func, $has_name );
|
||||
}
|
||||
|
||||
function wpcf7_remove_shortcode( $tag ) {
|
||||
global $wpcf7_shortcode_manager;
|
||||
|
||||
return $wpcf7_shortcode_manager->remove_shortcode( $tag );
|
||||
}
|
||||
|
||||
function wpcf7_do_shortcode( $content ) {
|
||||
global $wpcf7_shortcode_manager;
|
||||
|
||||
return $wpcf7_shortcode_manager->do_shortcode( $content );
|
||||
}
|
||||
|
||||
function wpcf7_get_shortcode_regex() {
|
||||
global $wpcf7_shortcode_manager;
|
||||
|
||||
return $wpcf7_shortcode_manager->get_shortcode_regex();
|
||||
}
|
||||
|
||||
?>
|
||||
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) {
|
||||
global $wpcf7_tag_generators;
|
||||
|
||||
$name = trim( $name );
|
||||
if ( '' == $name )
|
||||
return false;
|
||||
|
||||
if ( ! is_array( $wpcf7_tag_generators ) )
|
||||
$wpcf7_tag_generators = array();
|
||||
|
||||
$wpcf7_tag_generators[$name] = array(
|
||||
'title' => $title,
|
||||
'content' => $elm_id,
|
||||
'options' => $options );
|
||||
|
||||
if ( is_callable( $callback ) )
|
||||
add_action( 'wpcf7_admin_footer', $callback );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function wpcf7_print_tag_generators() {
|
||||
global $wpcf7_tag_generators;
|
||||
|
||||
$output = array();
|
||||
|
||||
foreach ( (array) $wpcf7_tag_generators as $name => $tg ) {
|
||||
$pane = " " . esc_js( $name ) . ": { ";
|
||||
$pane .= "title: '" . esc_js( $tg['title'] ) . "'";
|
||||
$pane .= ", content: '" . esc_js( $tg['content'] ) . "'";
|
||||
|
||||
foreach ( (array) $tg['options'] as $option_name => $option_value ) {
|
||||
if ( is_int( $option_value ) )
|
||||
$pane .= ", $option_name: $option_value";
|
||||
else
|
||||
$pane .= ", $option_name: '" . esc_js( $option_value ) . "'";
|
||||
}
|
||||
|
||||
$pane .= " }";
|
||||
|
||||
$output[] = $pane;
|
||||
}
|
||||
|
||||
echo implode( ",\n", $output ) . "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
911
src/wp-content/plugins/contact-form-7/jquery.form.js
Normal file
911
src/wp-content/plugins/contact-form-7/jquery.form.js
Normal file
@ -0,0 +1,911 @@
|
||||
/*!
|
||||
* jQuery Form Plugin
|
||||
* version: 2.84 (12-AUG-2011)
|
||||
* @requires jQuery v1.3.2 or later
|
||||
*
|
||||
* Examples and documentation at: http://malsup.com/jquery/form/
|
||||
* Dual licensed under the MIT and GPL licenses:
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
* http://www.gnu.org/licenses/gpl.html
|
||||
*/
|
||||
;(function($) {
|
||||
|
||||
/*
|
||||
Usage Note:
|
||||
-----------
|
||||
Do not use both ajaxSubmit and ajaxForm on the same form. These
|
||||
functions are intended to be exclusive. Use ajaxSubmit if you want
|
||||
to bind your own submit handler to the form. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').bind('submit', function(e) {
|
||||
e.preventDefault(); // <-- important
|
||||
$(this).ajaxSubmit({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Use ajaxForm when you want the plugin to manage all the event binding
|
||||
for you. For example,
|
||||
|
||||
$(document).ready(function() {
|
||||
$('#myForm').ajaxForm({
|
||||
target: '#output'
|
||||
});
|
||||
});
|
||||
|
||||
When using ajaxForm, the ajaxSubmit function will be invoked for you
|
||||
at the appropriate time.
|
||||
*/
|
||||
|
||||
/**
|
||||
* ajaxSubmit() provides a mechanism for immediately submitting
|
||||
* an HTML form using AJAX.
|
||||
*/
|
||||
$.fn.ajaxSubmit = function(options) {
|
||||
// fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
|
||||
if (!this.length) {
|
||||
log('ajaxSubmit: skipping submit process - no element selected');
|
||||
return this;
|
||||
}
|
||||
|
||||
var method, action, url, $form = this;
|
||||
|
||||
if (typeof options == 'function') {
|
||||
options = { success: options };
|
||||
}
|
||||
|
||||
method = this.attr('method');
|
||||
action = this.attr('action');
|
||||
url = (typeof action === 'string') ? $.trim(action) : '';
|
||||
url = url || window.location.href || '';
|
||||
if (url) {
|
||||
// clean url (don't include hash vaue)
|
||||
url = (url.match(/^([^#]+)/)||[])[1];
|
||||
}
|
||||
|
||||
options = $.extend(true, {
|
||||
url: url,
|
||||
success: $.ajaxSettings.success,
|
||||
type: method || 'GET',
|
||||
iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
|
||||
}, options);
|
||||
|
||||
// hook for manipulating the form data before it is extracted;
|
||||
// convenient for use with rich editors like tinyMCE or FCKEditor
|
||||
var veto = {};
|
||||
this.trigger('form-pre-serialize', [this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
// provide opportunity to alter form data before it is serialized
|
||||
if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSerialize callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
var n,v,a = this.formToArray(options.semantic);
|
||||
if (options.data) {
|
||||
options.extraData = options.data;
|
||||
for (n in options.data) {
|
||||
if( $.isArray(options.data[n]) ) {
|
||||
for (var k in options.data[n]) {
|
||||
a.push( { name: n, value: options.data[n][k] } );
|
||||
}
|
||||
}
|
||||
else {
|
||||
v = options.data[n];
|
||||
v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
|
||||
a.push( { name: n, value: v } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// give pre-submit callback an opportunity to abort the submit
|
||||
if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
|
||||
log('ajaxSubmit: submit aborted via beforeSubmit callback');
|
||||
return this;
|
||||
}
|
||||
|
||||
// fire vetoable 'validate' event
|
||||
this.trigger('form-submit-validate', [a, this, options, veto]);
|
||||
if (veto.veto) {
|
||||
log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
|
||||
return this;
|
||||
}
|
||||
|
||||
var q = $.param(a);
|
||||
|
||||
if (options.type.toUpperCase() == 'GET') {
|
||||
options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
|
||||
options.data = null; // data is null for 'get'
|
||||
}
|
||||
else {
|
||||
options.data = q; // data is the query string for 'post'
|
||||
}
|
||||
|
||||
var callbacks = [];
|
||||
if (options.resetForm) {
|
||||
callbacks.push(function() { $form.resetForm(); });
|
||||
}
|
||||
if (options.clearForm) {
|
||||
callbacks.push(function() { $form.clearForm(); });
|
||||
}
|
||||
|
||||
// perform a load on the target only if dataType is not provided
|
||||
if (!options.dataType && options.target) {
|
||||
var oldSuccess = options.success || function(){};
|
||||
callbacks.push(function(data) {
|
||||
var fn = options.replaceTarget ? 'replaceWith' : 'html';
|
||||
$(options.target)[fn](data).each(oldSuccess, arguments);
|
||||
});
|
||||
}
|
||||
else if (options.success) {
|
||||
callbacks.push(options.success);
|
||||
}
|
||||
|
||||
options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
|
||||
var context = options.context || options; // jQuery 1.4+ supports scope context
|
||||
for (var i=0, max=callbacks.length; i < max; i++) {
|
||||
callbacks[i].apply(context, [data, status, xhr || $form, $form]);
|
||||
}
|
||||
};
|
||||
|
||||
// are there files to upload?
|
||||
var fileInputs = $('input:file', this).length > 0;
|
||||
var mp = 'multipart/form-data';
|
||||
var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
|
||||
|
||||
// options.iframe allows user to force iframe mode
|
||||
// 06-NOV-09: now defaulting to iframe mode if file input is detected
|
||||
if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
|
||||
// hack to fix Safari hang (thanks to Tim Molendijk for this)
|
||||
// see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
|
||||
if (options.closeKeepAlive) {
|
||||
$.get(options.closeKeepAlive, function() { fileUpload(a); });
|
||||
}
|
||||
else {
|
||||
fileUpload(a);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// IE7 massage (see issue 57)
|
||||
if ($.browser.msie && method == 'get') {
|
||||
var ieMeth = $form[0].getAttribute('method');
|
||||
if (typeof ieMeth === 'string')
|
||||
options.type = ieMeth;
|
||||
}
|
||||
$.ajax(options);
|
||||
}
|
||||
|
||||
// fire 'notify' event
|
||||
this.trigger('form-submit-notify', [this, options]);
|
||||
return this;
|
||||
|
||||
|
||||
// private function for handling file uploads (hat tip to YAHOO!)
|
||||
function fileUpload(a) {
|
||||
var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle;
|
||||
var useProp = !!$.fn.prop;
|
||||
|
||||
if (a) {
|
||||
// ensure that every serialized input is still enabled
|
||||
for (i=0; i < a.length; i++) {
|
||||
el = $(form[a[i].name]);
|
||||
el[ useProp ? 'prop' : 'attr' ]('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
if ($(':input[name=submit],:input[id=submit]', form).length) {
|
||||
// if there is an input with a name or id of 'submit' then we won't be
|
||||
// able to invoke the submit fn on the form (at least not x-browser)
|
||||
alert('Error: Form elements must not have name or id of "submit".');
|
||||
return;
|
||||
}
|
||||
|
||||
s = $.extend(true, {}, $.ajaxSettings, options);
|
||||
s.context = s.context || s;
|
||||
id = 'jqFormIO' + (new Date().getTime());
|
||||
if (s.iframeTarget) {
|
||||
$io = $(s.iframeTarget);
|
||||
n = $io.attr('name');
|
||||
if (n == null)
|
||||
$io.attr('name', id);
|
||||
else
|
||||
id = n;
|
||||
}
|
||||
else {
|
||||
$io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />');
|
||||
$io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
|
||||
}
|
||||
io = $io[0];
|
||||
|
||||
|
||||
xhr = { // mock object
|
||||
aborted: 0,
|
||||
responseText: null,
|
||||
responseXML: null,
|
||||
status: 0,
|
||||
statusText: 'n/a',
|
||||
getAllResponseHeaders: function() {},
|
||||
getResponseHeader: function() {},
|
||||
setRequestHeader: function() {},
|
||||
abort: function(status) {
|
||||
var e = (status === 'timeout' ? 'timeout' : 'aborted');
|
||||
log('aborting upload... ' + e);
|
||||
this.aborted = 1;
|
||||
$io.attr('src', s.iframeSrc); // abort op in progress
|
||||
xhr.error = e;
|
||||
s.error && s.error.call(s.context, xhr, e, status);
|
||||
g && $.event.trigger("ajaxError", [xhr, s, e]);
|
||||
s.complete && s.complete.call(s.context, xhr, e);
|
||||
}
|
||||
};
|
||||
|
||||
g = s.global;
|
||||
// trigger ajax global events so that activity/block indicators work like normal
|
||||
if (g && ! $.active++) {
|
||||
$.event.trigger("ajaxStart");
|
||||
}
|
||||
if (g) {
|
||||
$.event.trigger("ajaxSend", [xhr, s]);
|
||||
}
|
||||
|
||||
if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
|
||||
if (s.global) {
|
||||
$.active--;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (xhr.aborted) {
|
||||
return;
|
||||
}
|
||||
|
||||
// add submitting element to data if we know it
|
||||
sub = form.clk;
|
||||
if (sub) {
|
||||
n = sub.name;
|
||||
if (n && !sub.disabled) {
|
||||
s.extraData = s.extraData || {};
|
||||
s.extraData[n] = sub.value;
|
||||
if (sub.type == "image") {
|
||||
s.extraData[n+'.x'] = form.clk_x;
|
||||
s.extraData[n+'.y'] = form.clk_y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var CLIENT_TIMEOUT_ABORT = 1;
|
||||
var SERVER_ABORT = 2;
|
||||
|
||||
function getDoc(frame) {
|
||||
var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
|
||||
return doc;
|
||||
}
|
||||
|
||||
// take a breath so that pending repaints get some cpu time before the upload starts
|
||||
function doSubmit() {
|
||||
// make sure form attrs are set
|
||||
var t = $form.attr('target'), a = $form.attr('action');
|
||||
|
||||
// update form attrs in IE friendly way
|
||||
form.setAttribute('target',id);
|
||||
if (!method) {
|
||||
form.setAttribute('method', 'POST');
|
||||
}
|
||||
if (a != s.url) {
|
||||
form.setAttribute('action', s.url);
|
||||
}
|
||||
|
||||
// ie borks in some cases when setting encoding
|
||||
if (! s.skipEncodingOverride && (!method || /post/i.test(method))) {
|
||||
$form.attr({
|
||||
encoding: 'multipart/form-data',
|
||||
enctype: 'multipart/form-data'
|
||||
});
|
||||
}
|
||||
|
||||
// support timout
|
||||
if (s.timeout) {
|
||||
timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout);
|
||||
}
|
||||
|
||||
// look for server aborts
|
||||
function checkState() {
|
||||
try {
|
||||
var state = getDoc(io).readyState;
|
||||
log('state = ' + state);
|
||||
if (state.toLowerCase() == 'uninitialized')
|
||||
setTimeout(checkState,50);
|
||||
}
|
||||
catch(e) {
|
||||
log('Server abort: ' , e, ' (', e.name, ')');
|
||||
cb(SERVER_ABORT);
|
||||
timeoutHandle && clearTimeout(timeoutHandle);
|
||||
timeoutHandle = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
// add "extra" data to form if provided in options
|
||||
var extraInputs = [];
|
||||
try {
|
||||
if (s.extraData) {
|
||||
for (var n in s.extraData) {
|
||||
extraInputs.push(
|
||||
$('<input type="hidden" name="'+n+'" />').attr('value',s.extraData[n])
|
||||
.appendTo(form)[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!s.iframeTarget) {
|
||||
// add iframe to doc and submit the form
|
||||
$io.appendTo('body');
|
||||
io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
|
||||
}
|
||||
setTimeout(checkState,15);
|
||||
form.submit();
|
||||
}
|
||||
finally {
|
||||
// reset attrs and remove "extra" input elements
|
||||
form.setAttribute('action',a);
|
||||
if(t) {
|
||||
form.setAttribute('target', t);
|
||||
} else {
|
||||
$form.removeAttr('target');
|
||||
}
|
||||
$(extraInputs).remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (s.forceSync) {
|
||||
doSubmit();
|
||||
}
|
||||
else {
|
||||
setTimeout(doSubmit, 10); // this lets dom updates render
|
||||
}
|
||||
|
||||
var data, doc, domCheckCount = 50, callbackProcessed;
|
||||
|
||||
function cb(e) {
|
||||
if (xhr.aborted || callbackProcessed) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
doc = getDoc(io);
|
||||
}
|
||||
catch(ex) {
|
||||
log('cannot access response document: ', ex);
|
||||
e = SERVER_ABORT;
|
||||
}
|
||||
if (e === CLIENT_TIMEOUT_ABORT && xhr) {
|
||||
xhr.abort('timeout');
|
||||
return;
|
||||
}
|
||||
else if (e == SERVER_ABORT && xhr) {
|
||||
xhr.abort('server abort');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!doc || doc.location.href == s.iframeSrc) {
|
||||
// response not received yet
|
||||
if (!timedOut)
|
||||
return;
|
||||
}
|
||||
io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);
|
||||
|
||||
var status = 'success', errMsg;
|
||||
try {
|
||||
if (timedOut) {
|
||||
throw 'timeout';
|
||||
}
|
||||
|
||||
var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
|
||||
log('isXml='+isXml);
|
||||
if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
|
||||
if (--domCheckCount) {
|
||||
// in some browsers (Opera) the iframe DOM is not always traversable when
|
||||
// the onload callback fires, so we loop a bit to accommodate
|
||||
log('requeing onLoad callback, DOM not available');
|
||||
setTimeout(cb, 250);
|
||||
return;
|
||||
}
|
||||
// let this fall through because server response could be an empty document
|
||||
//log('Could not access iframe DOM after mutiple tries.');
|
||||
//throw 'DOMException: not available';
|
||||
}
|
||||
|
||||
//log('response detected');
|
||||
var docRoot = doc.body ? doc.body : doc.documentElement;
|
||||
xhr.responseText = docRoot ? docRoot.innerHTML : null;
|
||||
xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
|
||||
if (isXml)
|
||||
s.dataType = 'xml';
|
||||
xhr.getResponseHeader = function(header){
|
||||
var headers = {'content-type': s.dataType};
|
||||
return headers[header];
|
||||
};
|
||||
// support for XHR 'status' & 'statusText' emulation :
|
||||
if (docRoot) {
|
||||
xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status;
|
||||
xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText;
|
||||
}
|
||||
|
||||
var dt = s.dataType || '';
|
||||
var scr = /(json|script|text)/.test(dt.toLowerCase());
|
||||
if (scr || s.textarea) {
|
||||
// see if user embedded response in textarea
|
||||
var ta = doc.getElementsByTagName('textarea')[0];
|
||||
if (ta) {
|
||||
xhr.responseText = ta.value;
|
||||
// support for XHR 'status' & 'statusText' emulation :
|
||||
xhr.status = Number( ta.getAttribute('status') ) || xhr.status;
|
||||
xhr.statusText = ta.getAttribute('statusText') || xhr.statusText;
|
||||
}
|
||||
else if (scr) {
|
||||
// account for browsers injecting pre around json response
|
||||
var pre = doc.getElementsByTagName('pre')[0];
|
||||
var b = doc.getElementsByTagName('body')[0];
|
||||
if (pre) {
|
||||
xhr.responseText = pre.textContent ? pre.textContent : pre.innerHTML;
|
||||
}
|
||||
else if (b) {
|
||||
xhr.responseText = b.innerHTML;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
|
||||
xhr.responseXML = toXml(xhr.responseText);
|
||||
}
|
||||
|
||||
try {
|
||||
data = httpData(xhr, s.dataType, s);
|
||||
}
|
||||
catch (e) {
|
||||
status = 'parsererror';
|
||||
xhr.error = errMsg = (e || status);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
log('error caught: ',e);
|
||||
status = 'error';
|
||||
xhr.error = errMsg = (e || status);
|
||||
}
|
||||
|
||||
if (xhr.aborted) {
|
||||
log('upload aborted');
|
||||
status = null;
|
||||
}
|
||||
|
||||
if (xhr.status) { // we've set xhr.status
|
||||
status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error';
|
||||
}
|
||||
|
||||
// ordering of these callbacks/triggers is odd, but that's how $.ajax does it
|
||||
if (status === 'success') {
|
||||
s.success && s.success.call(s.context, data, 'success', xhr);
|
||||
g && $.event.trigger("ajaxSuccess", [xhr, s]);
|
||||
}
|
||||
else if (status) {
|
||||
if (errMsg == undefined)
|
||||
errMsg = xhr.statusText;
|
||||
s.error && s.error.call(s.context, xhr, status, errMsg);
|
||||
g && $.event.trigger("ajaxError", [xhr, s, errMsg]);
|
||||
}
|
||||
|
||||
g && $.event.trigger("ajaxComplete", [xhr, s]);
|
||||
|
||||
if (g && ! --$.active) {
|
||||
$.event.trigger("ajaxStop");
|
||||
}
|
||||
|
||||
s.complete && s.complete.call(s.context, xhr, status);
|
||||
|
||||
callbackProcessed = true;
|
||||
if (s.timeout)
|
||||
clearTimeout(timeoutHandle);
|
||||
|
||||
// clean up
|
||||
setTimeout(function() {
|
||||
if (!s.iframeTarget)
|
||||
$io.remove();
|
||||
xhr.responseXML = null;
|
||||
}, 100);
|
||||
}
|
||||
|
||||
var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+)
|
||||
if (window.ActiveXObject) {
|
||||
doc = new ActiveXObject('Microsoft.XMLDOM');
|
||||
doc.async = 'false';
|
||||
doc.loadXML(s);
|
||||
}
|
||||
else {
|
||||
doc = (new DOMParser()).parseFromString(s, 'text/xml');
|
||||
}
|
||||
return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null;
|
||||
};
|
||||
var parseJSON = $.parseJSON || function(s) {
|
||||
return window['eval']('(' + s + ')');
|
||||
};
|
||||
|
||||
var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4
|
||||
|
||||
var ct = xhr.getResponseHeader('content-type') || '',
|
||||
xml = type === 'xml' || !type && ct.indexOf('xml') >= 0,
|
||||
data = xml ? xhr.responseXML : xhr.responseText;
|
||||
|
||||
if (xml && data.documentElement.nodeName === 'parsererror') {
|
||||
$.error && $.error('parsererror');
|
||||
}
|
||||
if (s && s.dataFilter) {
|
||||
data = s.dataFilter(data, type);
|
||||
}
|
||||
if (typeof data === 'string') {
|
||||
if (type === 'json' || !type && ct.indexOf('json') >= 0) {
|
||||
data = parseJSON(data);
|
||||
} else if (type === "script" || !type && ct.indexOf("javascript") >= 0) {
|
||||
$.globalEval(data);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ajaxForm() provides a mechanism for fully automating form submission.
|
||||
*
|
||||
* The advantages of using this method instead of ajaxSubmit() are:
|
||||
*
|
||||
* 1: This method will include coordinates for <input type="image" /> elements (if the element
|
||||
* is used to submit the form).
|
||||
* 2. This method will include the submit element's name/value data (for the element that was
|
||||
* used to submit the form).
|
||||
* 3. This method binds the submit() method to the form for you.
|
||||
*
|
||||
* The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
|
||||
* passes the options argument along after properly binding events for submit elements and
|
||||
* the form itself.
|
||||
*/
|
||||
$.fn.ajaxForm = function(options) {
|
||||
// in jQuery 1.3+ we can fix mistakes with the ready state
|
||||
if (this.length === 0) {
|
||||
var o = { s: this.selector, c: this.context };
|
||||
if (!$.isReady && o.s) {
|
||||
log('DOM not ready, queuing ajaxForm');
|
||||
$(function() {
|
||||
$(o.s,o.c).ajaxForm(options);
|
||||
});
|
||||
return this;
|
||||
}
|
||||
// is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
|
||||
log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
|
||||
return this;
|
||||
}
|
||||
|
||||
return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
|
||||
if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
|
||||
e.preventDefault();
|
||||
$(this).ajaxSubmit(options);
|
||||
}
|
||||
}).bind('click.form-plugin', function(e) {
|
||||
var target = e.target;
|
||||
var $el = $(target);
|
||||
if (!($el.is(":submit,input:image"))) {
|
||||
// is this a child element of the submit el? (ex: a span within a button)
|
||||
var t = $el.closest(':submit');
|
||||
if (t.length == 0) {
|
||||
return;
|
||||
}
|
||||
target = t[0];
|
||||
}
|
||||
var form = this;
|
||||
form.clk = target;
|
||||
if (target.type == 'image') {
|
||||
if (e.offsetX != undefined) {
|
||||
form.clk_x = e.offsetX;
|
||||
form.clk_y = e.offsetY;
|
||||
} else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
|
||||
var offset = $el.offset();
|
||||
form.clk_x = e.pageX - offset.left;
|
||||
form.clk_y = e.pageY - offset.top;
|
||||
} else {
|
||||
form.clk_x = e.pageX - target.offsetLeft;
|
||||
form.clk_y = e.pageY - target.offsetTop;
|
||||
}
|
||||
}
|
||||
// clear form vars
|
||||
setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
|
||||
});
|
||||
};
|
||||
|
||||
// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
|
||||
$.fn.ajaxFormUnbind = function() {
|
||||
return this.unbind('submit.form-plugin click.form-plugin');
|
||||
};
|
||||
|
||||
/**
|
||||
* formToArray() gathers form element data into an array of objects that can
|
||||
* be passed to any of the following ajax functions: $.get, $.post, or load.
|
||||
* Each object in the array has both a 'name' and 'value' property. An example of
|
||||
* an array for a simple login form might be:
|
||||
*
|
||||
* [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
|
||||
*
|
||||
* It is this array that is passed to pre-submit callback functions provided to the
|
||||
* ajaxSubmit() and ajaxForm() methods.
|
||||
*/
|
||||
$.fn.formToArray = function(semantic) {
|
||||
var a = [];
|
||||
if (this.length === 0) {
|
||||
return a;
|
||||
}
|
||||
|
||||
var form = this[0];
|
||||
var els = semantic ? form.getElementsByTagName('*') : form.elements;
|
||||
if (!els) {
|
||||
return a;
|
||||
}
|
||||
|
||||
var i,j,n,v,el,max,jmax;
|
||||
for(i=0, max=els.length; i < max; i++) {
|
||||
el = els[i];
|
||||
n = el.name;
|
||||
if (!n) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (semantic && form.clk && el.type == "image") {
|
||||
// handle image inputs on the fly when semantic == true
|
||||
if(!el.disabled && form.clk == el) {
|
||||
a.push({name: n, value: $(el).val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
v = $.fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(j=0, jmax=v.length; j < jmax; j++) {
|
||||
a.push({name: n, value: v[j]});
|
||||
}
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined') {
|
||||
a.push({name: n, value: v});
|
||||
}
|
||||
}
|
||||
|
||||
if (!semantic && form.clk) {
|
||||
// input type=='image' are not found in elements array! handle it here
|
||||
var $input = $(form.clk), input = $input[0];
|
||||
n = input.name;
|
||||
if (n && !input.disabled && input.type == 'image') {
|
||||
a.push({name: n, value: $input.val()});
|
||||
a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
|
||||
}
|
||||
}
|
||||
return a;
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes form data into a 'submittable' string. This method will return a string
|
||||
* in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.formSerialize = function(semantic) {
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(this.formToArray(semantic));
|
||||
};
|
||||
|
||||
/**
|
||||
* Serializes all field elements in the jQuery object into a query string.
|
||||
* This method will return a string in the format: name1=value1&name2=value2
|
||||
*/
|
||||
$.fn.fieldSerialize = function(successful) {
|
||||
var a = [];
|
||||
this.each(function() {
|
||||
var n = this.name;
|
||||
if (!n) {
|
||||
return;
|
||||
}
|
||||
var v = $.fieldValue(this, successful);
|
||||
if (v && v.constructor == Array) {
|
||||
for (var i=0,max=v.length; i < max; i++) {
|
||||
a.push({name: n, value: v[i]});
|
||||
}
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined') {
|
||||
a.push({name: this.name, value: v});
|
||||
}
|
||||
});
|
||||
//hand off to jQuery.param for proper encoding
|
||||
return $.param(a);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value(s) of the element in the matched set. For example, consider the following form:
|
||||
*
|
||||
* <form><fieldset>
|
||||
* <input name="A" type="text" />
|
||||
* <input name="A" type="text" />
|
||||
* <input name="B" type="checkbox" value="B1" />
|
||||
* <input name="B" type="checkbox" value="B2"/>
|
||||
* <input name="C" type="radio" value="C1" />
|
||||
* <input name="C" type="radio" value="C2" />
|
||||
* </fieldset></form>
|
||||
*
|
||||
* var v = $(':text').fieldValue();
|
||||
* // if no values are entered into the text inputs
|
||||
* v == ['','']
|
||||
* // if values entered into the text inputs are 'foo' and 'bar'
|
||||
* v == ['foo','bar']
|
||||
*
|
||||
* var v = $(':checkbox').fieldValue();
|
||||
* // if neither checkbox is checked
|
||||
* v === undefined
|
||||
* // if both checkboxes are checked
|
||||
* v == ['B1', 'B2']
|
||||
*
|
||||
* var v = $(':radio').fieldValue();
|
||||
* // if neither radio is checked
|
||||
* v === undefined
|
||||
* // if first radio is checked
|
||||
* v == ['C1']
|
||||
*
|
||||
* The successful argument controls whether or not the field element must be 'successful'
|
||||
* (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
|
||||
* The default value of the successful argument is true. If this value is false the value(s)
|
||||
* for each element is returned.
|
||||
*
|
||||
* Note: This method *always* returns an array. If no valid value can be determined the
|
||||
* array will be empty, otherwise it will contain one or more values.
|
||||
*/
|
||||
$.fn.fieldValue = function(successful) {
|
||||
for (var val=[], i=0, max=this.length; i < max; i++) {
|
||||
var el = this[i];
|
||||
var v = $.fieldValue(el, successful);
|
||||
if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
|
||||
continue;
|
||||
}
|
||||
v.constructor == Array ? $.merge(val, v) : val.push(v);
|
||||
}
|
||||
return val;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the value of the field element.
|
||||
*/
|
||||
$.fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (successful === undefined) {
|
||||
successful = true;
|
||||
}
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) {
|
||||
return null;
|
||||
}
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
var v = op.value;
|
||||
if (!v) { // extra pain for IE...
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
}
|
||||
if (one) {
|
||||
return v;
|
||||
}
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return $(el).val();
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the form data. Takes the following actions on the form's input fields:
|
||||
* - input text fields will have their 'value' property set to the empty string
|
||||
* - select elements will have their 'selectedIndex' property set to -1
|
||||
* - checkbox and radio inputs will have their 'checked' property set to false
|
||||
* - inputs of type submit, button, reset, and hidden will *not* be effected
|
||||
* - button elements will *not* be effected
|
||||
*/
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
$('input,select,textarea', this).clearFields();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Clears the selected form elements.
|
||||
*/
|
||||
$.fn.clearFields = $.fn.clearInputs = function() {
|
||||
var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list
|
||||
return this.each(function() {
|
||||
var t = this.type, tag = this.tagName.toLowerCase();
|
||||
if (re.test(t) || tag == 'textarea') {
|
||||
this.value = '';
|
||||
}
|
||||
else if (t == 'checkbox' || t == 'radio') {
|
||||
this.checked = false;
|
||||
}
|
||||
else if (tag == 'select') {
|
||||
this.selectedIndex = -1;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Resets the form data. Causes all form elements to be reset to their original value.
|
||||
*/
|
||||
$.fn.resetForm = function() {
|
||||
return this.each(function() {
|
||||
// guard against an input with the name of 'reset'
|
||||
// note that IE reports the reset function as an 'object'
|
||||
if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
|
||||
this.reset();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Enables or disables any matching elements.
|
||||
*/
|
||||
$.fn.enable = function(b) {
|
||||
if (b === undefined) {
|
||||
b = true;
|
||||
}
|
||||
return this.each(function() {
|
||||
this.disabled = !b;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks/unchecks any matching checkboxes or radio buttons and
|
||||
* selects/deselects and matching option elements.
|
||||
*/
|
||||
$.fn.selected = function(select) {
|
||||
if (select === undefined) {
|
||||
select = true;
|
||||
}
|
||||
return this.each(function() {
|
||||
var t = this.type;
|
||||
if (t == 'checkbox' || t == 'radio') {
|
||||
this.checked = select;
|
||||
}
|
||||
else if (this.tagName.toLowerCase() == 'option') {
|
||||
var $sel = $(this).parent('select');
|
||||
if (select && $sel[0] && $sel[0].type == 'select-one') {
|
||||
// deselect all other options
|
||||
$sel.find('option').selected(false);
|
||||
}
|
||||
this.selected = select;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// helper fn for console logging
|
||||
function log() {
|
||||
var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
|
||||
if (window.console && window.console.log) {
|
||||
window.console.log(msg);
|
||||
}
|
||||
else if (window.opera && window.opera.postError) {
|
||||
window.opera.postError(msg);
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
@ -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.
|
||||
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-af.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-af.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ar.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ar.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-bg_BG.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-bg_BG.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-bn_BD.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-bn_BD.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-bs.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-bs.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ca.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ca.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-cs_CZ.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-cs_CZ.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-da_DK.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-da_DK.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-de_DE.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-de_DE.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-el.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-el.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-es_ES.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-es_ES.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-et.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-et.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-fa_IR.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-fa_IR.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-fi.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-fi.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-fr_FR.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-fr_FR.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-gl_ES.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-gl_ES.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-he_IL.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-he_IL.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hi_IN.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hi_IN.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hr.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hr.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hu_HU.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hu_HU.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hy_AM.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-hy_AM.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-id_ID.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-id_ID.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-it_IT.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-it_IT.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ja.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ja.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ka_GE.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ka_GE.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ko_KR.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ko_KR.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-lt_LT.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-lt_LT.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-lv.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-lv.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-mk_MK.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-mk_MK.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ml_IN.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ml_IN.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ms_MY.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ms_MY.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-nb_NO.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-nb_NO.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-nl_NL.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-nl_NL.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-pl_PL.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-pl_PL.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-pt_BR.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-pt_BR.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-pt_PT.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-pt_PT.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ro_RO.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ro_RO.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ru_RU.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ru_RU.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-si_LK.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-si_LK.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sk.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sk.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sl_SI.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sl_SI.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sq.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sq.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sr_RS.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sr_RS.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sv_SE.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-sv_SE.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ta.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-ta.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-th.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-th.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-tr_TR.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-tr_TR.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-uk.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-uk.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-vi.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-vi.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-zh_CN.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-zh_CN.mo
Normal file
Binary file not shown.
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-zh_TW.mo
Normal file
BIN
src/wp-content/plugins/contact-form-7/languages/wpcf7-zh_TW.mo
Normal file
Binary file not shown.
824
src/wp-content/plugins/contact-form-7/languages/wpcf7.pot
Normal file
824
src/wp-content/plugins/contact-form-7/languages/wpcf7.pot
Normal file
@ -0,0 +1,824 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Contact Form 7\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2011-09-17 22:01+0900\n"
|
||||
"PO-Revision-Date: 2011-09-17 22:01+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:99
|
||||
msgid "Contact Forms"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/settings.php:100
|
||||
msgid "Contact Form"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/settings.php:191
|
||||
#, php-format
|
||||
msgid "Contact form %d"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:114
|
||||
#: contact-form-7/admin/edit.php:5
|
||||
msgid "Contact Form 7"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:114
|
||||
msgid "Contact"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:117
|
||||
msgid "Edit Contact Forms"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:117
|
||||
msgid "Edit"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:157
|
||||
msgid "Generate Tag"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:226
|
||||
msgid "Settings"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:237
|
||||
msgid "http://contactform7.com/"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:238
|
||||
msgid "Contactform7.com"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:239
|
||||
msgid "http://contactform7.com/docs/"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:240
|
||||
msgid "Docs"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:241
|
||||
msgid "http://contactform7.com/faq/"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:242
|
||||
msgid "FAQ"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:243
|
||||
msgid "http://contactform7.com/support/"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:244
|
||||
msgid "Support"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:258
|
||||
msgid "Contact form created."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:261
|
||||
msgid "Contact form saved."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:264
|
||||
msgid "Contact form deleted."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:298
|
||||
msgid "Contact Form 7 needs your support. Please donate today."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:299
|
||||
msgid "Your contribution is needed for making this plugin better."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:305
|
||||
msgid "http://contactform7.com/donate/"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/admin.php:305
|
||||
msgid "Donate"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:20
|
||||
#: contact-form-7/admin/edit.php:142
|
||||
#: contact-form-7/admin/edit.php:155
|
||||
msgid "Add New"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:41
|
||||
msgid "Copy this code and paste it into your post, page or text widget content."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:47
|
||||
msgid "Old code is also available."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:55
|
||||
msgid "Save"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:62
|
||||
msgid "Copy"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:67
|
||||
msgid "Delete"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:69
|
||||
msgid ""
|
||||
"You are about to delete this contact form.\n"
|
||||
" 'Cancel' to stop, 'OK' to delete."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:78
|
||||
msgid "Form"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:81
|
||||
msgid "Mail"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:84
|
||||
msgid "Mail (2)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:89
|
||||
msgid "Use mail (2)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:91
|
||||
msgid "Messages"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:94
|
||||
msgid "Additional Settings"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:141
|
||||
#, php-format
|
||||
msgid "Use the default language (%s)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:145
|
||||
msgid "Or"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/admin/edit.php:150
|
||||
msgid "(select language)"
|
||||
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:88
|
||||
msgid "Message body:"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/classes.php:524
|
||||
msgid "Untitled"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:6
|
||||
msgid "Sender's message was sent successfully"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:7
|
||||
msgid "Your message was sent successfully. Thanks."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:11
|
||||
msgid "Sender's message was failed to send"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:12
|
||||
#: contact-form-7/modules/akismet.php:101
|
||||
msgid "Failed to send your message. Please try later or contact the administrator by another method."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:16
|
||||
msgid "Validation errors occurred"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:17
|
||||
msgid "Validation errors occurred. Please confirm the fields and submit it again."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:21
|
||||
msgid "There is a field of term that sender is needed to accept"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:22
|
||||
msgid "Please accept the terms to proceed."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:26
|
||||
msgid "Email address that sender entered is invalid"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:27
|
||||
msgid "Email address seems invalid."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:31
|
||||
msgid "There is a field that sender is needed to fill in"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:32
|
||||
msgid "Please fill the required field."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:56
|
||||
msgid "Your Name"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:56
|
||||
#: contact-form-7/includes/functions.php:58
|
||||
msgid "(required)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:58
|
||||
msgid "Your Email"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:60
|
||||
msgid "Subject"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:62
|
||||
msgid "Your Message"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:64
|
||||
msgid "Send"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:72
|
||||
#, php-format
|
||||
msgid "From: %s"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:73
|
||||
#, php-format
|
||||
msgid "Subject: %s"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:74
|
||||
msgid "Message Body:"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:75
|
||||
#: contact-form-7/includes/functions.php:89
|
||||
#, php-format
|
||||
msgid "This mail is sent via contact form on %1$s %2$s"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:165
|
||||
msgid "Afrikaans"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:166
|
||||
msgid "Albanian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:167
|
||||
msgid "Arabic"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:168
|
||||
msgid "Armenian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:169
|
||||
msgid "Bangla"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:170
|
||||
msgid "Bosnian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:171
|
||||
msgid "Brazilian Portuguese"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:172
|
||||
msgid "Bulgarian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:173
|
||||
msgid "Catalan"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:174
|
||||
msgid "Chinese (Simplified)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:175
|
||||
msgid "Chinese (Traditional)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:176
|
||||
msgid "Croatian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:177
|
||||
msgid "Czech"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:178
|
||||
msgid "Danish"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:179
|
||||
msgid "Dutch"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:180
|
||||
msgid "English"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:181
|
||||
msgid "Estonian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:182
|
||||
msgid "Finnish"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:183
|
||||
msgid "French"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:184
|
||||
msgid "Galician"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:185
|
||||
msgid "Georgian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:186
|
||||
msgid "German"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:187
|
||||
msgid "Greek"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:188
|
||||
msgid "Hebrew"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:189
|
||||
msgid "Hindi"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:190
|
||||
msgid "Hungarian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:191
|
||||
msgid "Indonesian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:192
|
||||
msgid "Italian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:193
|
||||
msgid "Japanese"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:194
|
||||
msgid "Korean"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:195
|
||||
msgid "Latvian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:196
|
||||
msgid "Lithuanian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:197
|
||||
msgid "Macedonian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:198
|
||||
msgid "Malay"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:199
|
||||
msgid "Malayalam"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:200
|
||||
msgid "Norwegian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:201
|
||||
msgid "Persian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:202
|
||||
msgid "Polish"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:203
|
||||
msgid "Portuguese"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:204
|
||||
msgid "Russian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:205
|
||||
msgid "Romanian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:206
|
||||
msgid "Serbian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:207
|
||||
msgid "Sinhala"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:208
|
||||
msgid "Slovak"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:209
|
||||
msgid "Slovene"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:210
|
||||
msgid "Spanish"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:211
|
||||
msgid "Swedish"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:212
|
||||
msgid "Tamil"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:213
|
||||
msgid "Thai"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:214
|
||||
msgid "Turkish"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:215
|
||||
msgid "Ukrainian"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/includes/functions.php:216
|
||||
msgid "Vietnamese"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:150
|
||||
msgid "Acceptance"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:159
|
||||
#: contact-form-7/modules/captcha.php:202
|
||||
msgid "Name"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:164
|
||||
#: contact-form-7/modules/acceptance.php:167
|
||||
#: contact-form-7/modules/captcha.php:209
|
||||
#: contact-form-7/modules/captcha.php:212
|
||||
#: contact-form-7/modules/captcha.php:217
|
||||
#: contact-form-7/modules/captcha.php:220
|
||||
#: contact-form-7/modules/captcha.php:224
|
||||
#: contact-form-7/modules/captcha.php:235
|
||||
#: contact-form-7/modules/captcha.php:238
|
||||
#: contact-form-7/modules/captcha.php:243
|
||||
#: contact-form-7/modules/captcha.php:246
|
||||
msgid "optional"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:173
|
||||
msgid "Make this checkbox checked by default?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:174
|
||||
msgid "Make this checkbox work inversely?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:175
|
||||
msgid "* That means visitor who accepts the term unchecks it."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/acceptance.php:180
|
||||
#: contact-form-7/modules/captcha.php:251
|
||||
msgid "Copy this code and paste it into the form left."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/akismet.php:100
|
||||
msgid "Akismet judged the sending activity as spamming"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:66
|
||||
msgid "To use CAPTCHA, you need <a href=\"http://wordpress.org/extend/plugins/really-simple-captcha/\">Really Simple CAPTCHA</a> plugin installed."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:177
|
||||
msgid "The code that sender entered does not match the CAPTCHA"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:178
|
||||
msgid "Your entered code is incorrect."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:188
|
||||
msgid "CAPTCHA"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:199
|
||||
msgid "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:206
|
||||
msgid "Image settings"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:217
|
||||
msgid "Foreground color"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:220
|
||||
msgid "Background color"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:224
|
||||
msgid "Image size"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:225
|
||||
msgid "Small"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:226
|
||||
msgid "Medium"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:227
|
||||
msgid "Large"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:232
|
||||
msgid "Input field settings"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:252
|
||||
msgid "For image"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:254
|
||||
msgid "For input field"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:284
|
||||
#, php-format
|
||||
msgid "This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/captcha.php:290
|
||||
msgid "This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:183
|
||||
msgid "Checkboxes"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:186
|
||||
msgid "Radio buttons"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:207
|
||||
#: contact-form-7/modules/file.php:240
|
||||
#: contact-form-7/modules/select.php:159
|
||||
#: contact-form-7/modules/text.php:161
|
||||
#: contact-form-7/modules/textarea.php:134
|
||||
msgid "Required field?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:223
|
||||
#: contact-form-7/modules/select.php:173
|
||||
msgid "Choices"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:225
|
||||
#: contact-form-7/modules/select.php:175
|
||||
msgid "* One choice per line."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:229
|
||||
msgid "Put a label first, a checkbox last?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:230
|
||||
msgid "Wrap each item with <label> tag?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:232
|
||||
msgid "Make checkboxes exclusive?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/checkbox.php:240
|
||||
#: contact-form-7/modules/select.php:187
|
||||
#: contact-form-7/modules/text.php:204
|
||||
#: contact-form-7/modules/textarea.php:166
|
||||
msgid "And, put this code into the Mail fields below."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:204
|
||||
msgid "Uploading a file fails for any reason"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:205
|
||||
msgid "Failed to upload file."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:209
|
||||
msgid "Uploaded file is not allowed file type"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:210
|
||||
msgid "This file type is not allowed."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:214
|
||||
msgid "Uploaded file is too large"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:215
|
||||
msgid "This file is too large."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:219
|
||||
msgid "Uploading a file fails for PHP error"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/file.php:220
|
||||
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/icl.php:74
|
||||
msgid "This contact form contains [icl] tags, but they are obsolete and no longer functioning on this version of Contact Form 7. <a href=\"http://contactform7.com/2009/12/25/contact-form-in-your-language/#Creating_contact_form_in_different_languages\" target=\"_blank\">There is a simpler way for creating contact forms of other languages</a> and you are recommended to use it."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/quiz.php:160
|
||||
msgid "Sender doesn't enter the correct answer to the quiz"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/quiz.php:161
|
||||
msgid "Your answer is not correct."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/quiz.php:171
|
||||
msgid "Quiz"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/quiz.php:201
|
||||
msgid "Quizzes"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/quiz.php:203
|
||||
msgid "* quiz|answer (e.g. 1+1=?|2)"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/select.php:150
|
||||
msgid "Drop-down menu"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/select.php:179
|
||||
msgid "Allow multiple selections?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/select.php:180
|
||||
msgid "Insert a blank item as the first option?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/submit.php:54
|
||||
msgid "Sending ..."
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/submit.php:66
|
||||
msgid "Submit button"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/submit.php:84
|
||||
msgid "Label"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:138
|
||||
msgid "Text field"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:141
|
||||
msgid "Email field"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:183
|
||||
msgid "Akismet"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:185
|
||||
msgid "This field requires author's name"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:186
|
||||
msgid "This field requires author's URL"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:188
|
||||
msgid "This field requires author's email address"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:194
|
||||
#: contact-form-7/modules/textarea.php:156
|
||||
msgid "Default value"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/text.php:197
|
||||
#: contact-form-7/modules/textarea.php:159
|
||||
msgid "Use this text as watermark?"
|
||||
msgstr ""
|
||||
|
||||
#: contact-form-7/modules/textarea.php:125
|
||||
msgid "Text area"
|
||||
msgstr ""
|
||||
|
||||
339
src/wp-content/plugins/contact-form-7/license.txt
Normal file
339
src/wp-content/plugins/contact-form-7/license.txt
Normal 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.
|
||||
186
src/wp-content/plugins/contact-form-7/modules/acceptance.php
Normal file
186
src/wp-content/plugins/contact-form-7/modules/acceptance.php
Normal file
@ -0,0 +1,186 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [acceptance]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'acceptance', 'wpcf7_acceptance_shortcode_handler', true );
|
||||
|
||||
function wpcf7_acceptance_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
$class_att .= ' wpcf7-acceptance';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( 'invert' == $option ) {
|
||||
$class_att .= ' wpcf7-invert';
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
if ( '' !== $tabindex_att )
|
||||
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
|
||||
$default_on = (bool) preg_grep( '/^default:on$/i', $options );
|
||||
|
||||
$checked = $default_on ? ' checked="checked"' : '';
|
||||
|
||||
$html = '<input type="checkbox" name="' . $name . '" value="1"' . $atts . $checked . ' />';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_acceptance', 'wpcf7_acceptance_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_acceptance_validation_filter( $result, $tag ) {
|
||||
if ( ! wpcf7_acceptance_as_validation() )
|
||||
return $result;
|
||||
|
||||
$name = $tag['name'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return $result;
|
||||
|
||||
$options = (array) $tag['options'];
|
||||
|
||||
$value = $_POST[$name] ? 1 : 0;
|
||||
|
||||
$invert = (bool) preg_grep( '%^invert$%', $options );
|
||||
|
||||
if ( $invert && $value || ! $invert && ! $value ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'accept_terms' );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Acceptance filter */
|
||||
|
||||
add_filter( 'wpcf7_acceptance', 'wpcf7_acceptance_filter' );
|
||||
|
||||
function wpcf7_acceptance_filter( $accepted ) {
|
||||
$fes = wpcf7_scan_shortcode( array( 'type' => 'acceptance' ) );
|
||||
|
||||
foreach ( $fes as $fe ) {
|
||||
$name = $fe['name'];
|
||||
$options = (array) $fe['options'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
continue;
|
||||
|
||||
$value = $_POST[$name] ? 1 : 0;
|
||||
|
||||
$invert = (bool) preg_grep( '%^invert$%', $options );
|
||||
|
||||
if ( $invert && $value || ! $invert && ! $value )
|
||||
$accepted = false;
|
||||
}
|
||||
|
||||
return $accepted;
|
||||
}
|
||||
|
||||
add_filter( 'wpcf7_form_class_attr', 'wpcf7_acceptance_form_class_attr' );
|
||||
|
||||
function wpcf7_acceptance_form_class_attr( $class ) {
|
||||
if ( wpcf7_acceptance_as_validation() )
|
||||
return $class . ' wpcf7-acceptance-as-validation';
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
function wpcf7_acceptance_as_validation() {
|
||||
if ( ! $contact_form = wpcf7_get_current_contact_form() )
|
||||
return false;
|
||||
|
||||
$settings = $contact_form->additional_setting( 'acceptance_as_validation', false );
|
||||
|
||||
foreach ( $settings as $setting ) {
|
||||
if ( in_array( $setting, array( 'on', 'true', '1' ) ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_acceptance', 35 );
|
||||
|
||||
function wpcf7_add_tag_generator_acceptance() {
|
||||
wpcf7_add_tag_generator( 'acceptance', __( 'Acceptance', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-acceptance', 'wpcf7_tg_pane_acceptance' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_acceptance( &$contact_form ) {
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-acceptance" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="id" class="idvalue oneline option" /></td>
|
||||
|
||||
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="class" class="classvalue oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<br /><input type="checkbox" name="default:on" class="option" /> <?php echo esc_html( __( "Make this checkbox checked by default?", 'wpcf7' ) ); ?>
|
||||
<br /><input type="checkbox" name="invert" class="option" /> <?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
|
||||
}
|
||||
|
||||
?>
|
||||
114
src/wp-content/plugins/contact-form-7/modules/akismet.php
Normal file
114
src/wp-content/plugins/contact-form-7/modules/akismet.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
** Akismet Filter
|
||||
**/
|
||||
|
||||
add_filter( 'wpcf7_spam', 'wpcf7_akismet' );
|
||||
|
||||
function wpcf7_akismet( $spam ) {
|
||||
global $akismet_api_host, $akismet_api_port;
|
||||
|
||||
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'] ) || ! 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'];
|
||||
|
||||
$c['comment_type'] = 'contactform7';
|
||||
|
||||
if ( $permalink = get_permalink() )
|
||||
$c['permalink'] = $permalink;
|
||||
|
||||
if ( '' != $author )
|
||||
$c['comment_author'] = $author;
|
||||
|
||||
if ( '' != $author_email )
|
||||
$c['comment_author_email'] = $author_email;
|
||||
|
||||
if ( '' != $author_url )
|
||||
$c['comment_author_url'] = $author_url;
|
||||
|
||||
if ( '' != $content )
|
||||
$c['comment_content'] = $content;
|
||||
|
||||
$ignore = array( 'HTTP_COOKIE', '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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
?>
|
||||
490
src/wp-content/plugins/contact-form-7/modules/captcha.php
Normal file
490
src/wp-content/plugins/contact-form-7/modules/captcha.php
Normal file
@ -0,0 +1,490 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [captchac] and [captchar]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'captchac', 'wpcf7_captcha_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'captchar', 'wpcf7_captcha_shortcode_handler', true );
|
||||
|
||||
function wpcf7_captcha_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$size_att = '';
|
||||
$maxlength_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
if ( 'captchac' == $type )
|
||||
$class_att .= ' wpcf7-captcha-' . $name;
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
|
||||
$size_att = (int) $matches[1];
|
||||
$maxlength_att = (int) $matches[2];
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
// Value.
|
||||
if ( ! wpcf7_is_posted() && isset( $values[0] ) )
|
||||
$value = $values[0];
|
||||
else
|
||||
$value = '';
|
||||
|
||||
if ( 'captchac' == $type ) {
|
||||
if ( ! class_exists( 'ReallySimpleCaptcha' ) ) {
|
||||
return '<em>' . __( 'To use CAPTCHA, you need <a href="http://wordpress.org/extend/plugins/really-simple-captcha/">Really Simple CAPTCHA</a> plugin installed.', 'wpcf7' ) . '</em>';
|
||||
}
|
||||
|
||||
$op = array();
|
||||
// Default
|
||||
$op['img_size'] = array( 72, 24 );
|
||||
$op['base'] = array( 6, 18 );
|
||||
$op['font_size'] = 14;
|
||||
$op['font_char_width'] = 15;
|
||||
|
||||
$op = array_merge( $op, wpcf7_captchac_options( $options ) );
|
||||
|
||||
if ( ! $filename = wpcf7_generate_captcha( $op ) )
|
||||
return '';
|
||||
|
||||
if ( is_array( $op['img_size'] ) )
|
||||
$atts .= ' width="' . $op['img_size'][0] . '" height="' . $op['img_size'][1] . '"';
|
||||
|
||||
$captcha_url = trailingslashit( wpcf7_captcha_tmp_url() ) . $filename;
|
||||
$html = '<img alt="captcha" src="' . $captcha_url . '"' . $atts . ' />';
|
||||
$ref = substr( $filename, 0, strrpos( $filename, '.' ) );
|
||||
$html = '<input type="hidden" name="_wpcf7_captcha_challenge_' . $name . '" value="' . $ref . '" />' . $html;
|
||||
|
||||
return $html;
|
||||
|
||||
} elseif ( 'captchar' == $type ) {
|
||||
if ( $size_att )
|
||||
$atts .= ' size="' . $size_att . '"';
|
||||
else
|
||||
$atts .= ' size="40"'; // default size
|
||||
|
||||
if ( $maxlength_att )
|
||||
$atts .= ' maxlength="' . $maxlength_att . '"';
|
||||
|
||||
if ( '' !== $tabindex_att )
|
||||
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
|
||||
$html = '<input type="text" name="' . $name . '" value="' . esc_attr( $value ) . '"' . $atts . ' />';
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_captchar', 'wpcf7_captcha_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_captcha_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
|
||||
$_POST[$name] = (string) $_POST[$name];
|
||||
|
||||
$captchac = '_wpcf7_captcha_challenge_' . $name;
|
||||
|
||||
if ( ! wpcf7_check_captcha( $_POST[$captchac], $_POST[$name] ) ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'captcha_not_match' );
|
||||
}
|
||||
|
||||
wpcf7_remove_captcha( $_POST[$captchac] );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Ajax echo filter */
|
||||
|
||||
add_filter( 'wpcf7_ajax_onload', 'wpcf7_captcha_ajax_refill' );
|
||||
add_filter( 'wpcf7_ajax_json_echo', 'wpcf7_captcha_ajax_refill' );
|
||||
|
||||
function wpcf7_captcha_ajax_refill( $items ) {
|
||||
if ( ! is_array( $items ) )
|
||||
return $items;
|
||||
|
||||
$fes = wpcf7_scan_shortcode( array( 'type' => 'captchac' ) );
|
||||
|
||||
if ( empty( $fes ) )
|
||||
return $items;
|
||||
|
||||
$refill = array();
|
||||
|
||||
foreach ( $fes as $fe ) {
|
||||
$name = $fe['name'];
|
||||
$options = $fe['options'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
continue;
|
||||
|
||||
$op = wpcf7_captchac_options( $options );
|
||||
if ( $filename = wpcf7_generate_captcha( $op ) ) {
|
||||
$captcha_url = trailingslashit( wpcf7_captcha_tmp_url() ) . $filename;
|
||||
$refill[$name] = $captcha_url;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $refill ) )
|
||||
$items['captcha'] = $refill;
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/* Messages */
|
||||
|
||||
add_filter( 'wpcf7_messages', 'wpcf7_captcha_messages' );
|
||||
|
||||
function wpcf7_captcha_messages( $messages ) {
|
||||
return array_merge( $messages, array( 'captcha_not_match' => array(
|
||||
'description' => __( "The code that sender entered does not match the CAPTCHA", 'wpcf7' ),
|
||||
'default' => __( 'Your entered code is incorrect.', 'wpcf7' )
|
||||
) ) );
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_captcha', 45 );
|
||||
|
||||
function wpcf7_add_tag_generator_captcha() {
|
||||
wpcf7_add_tag_generator( 'captcha', __( 'CAPTCHA', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-captcha', 'wpcf7_tg_pane_captcha' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_captcha( &$contact_form ) {
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-captcha" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
|
||||
<?php if ( ! class_exists( 'ReallySimpleCaptcha' ) ) : ?>
|
||||
<tr><td colspan="2"><strong style="color: #e6255b"><?php echo esc_html( __( "Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed.", 'wpcf7' ) ); ?></strong><br /><a href="http://wordpress.org/extend/plugins/really-simple-captcha/">http://wordpress.org/extend/plugins/really-simple-captcha/</a></td></tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
<table class="scope captchac">
|
||||
<caption><?php echo esc_html( __( "Image settings", 'wpcf7' ) ); ?></caption>
|
||||
|
||||
<tr>
|
||||
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="id" class="idvalue oneline option" /></td>
|
||||
|
||||
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="class" class="classvalue oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo esc_html( __( "Foreground color", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="fg" class="color oneline option" /></td>
|
||||
|
||||
<td><?php echo esc_html( __( "Background color", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="bg" class="color oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr><td colspan="2"><?php echo esc_html( __( "Image size", 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="checkbox" name="size:s" class="exclusive option" /> <?php echo esc_html( __( "Small", 'wpcf7' ) ); ?> 
|
||||
<input type="checkbox" name="size:m" class="exclusive option" /> <?php echo esc_html( __( "Medium", 'wpcf7' ) ); ?> 
|
||||
<input type="checkbox" name="size:l" class="exclusive option" /> <?php echo esc_html( __( "Large", 'wpcf7' ) ); ?>
|
||||
</td></tr>
|
||||
</table>
|
||||
|
||||
<table class="scope captchar">
|
||||
<caption><?php echo esc_html( __( "Input field settings", 'wpcf7' ) ); ?></caption>
|
||||
|
||||
<tr>
|
||||
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="id" class="idvalue oneline option" /></td>
|
||||
|
||||
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="class" class="classvalue oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="size" class="numeric oneline option" /></td>
|
||||
|
||||
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="maxlength" class="numeric oneline option" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?>
|
||||
<br />1) <?php echo esc_html( __( "For image", 'wpcf7' ) ); ?>
|
||||
<input type="text" name="captchac" class="tag" readonly="readonly" onfocus="this.select()" />
|
||||
<br />2) <?php echo esc_html( __( "For input field", 'wpcf7' ) ); ?>
|
||||
<input type="text" name="captchar" class="tag" readonly="readonly" onfocus="this.select()" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/* Warning message */
|
||||
|
||||
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_captcha_display_warning_message' );
|
||||
|
||||
function wpcf7_captcha_display_warning_message( &$contact_form ) {
|
||||
if ( ! $contact_form )
|
||||
return;
|
||||
|
||||
$has_tags = (bool) $contact_form->form_scan_shortcode(
|
||||
array( 'type' => array( 'captchac' ) ) );
|
||||
|
||||
if ( ! $has_tags )
|
||||
return;
|
||||
|
||||
if ( ! class_exists( 'ReallySimpleCaptcha' ) )
|
||||
return;
|
||||
|
||||
$uploads_dir = wpcf7_captcha_tmp_dir();
|
||||
wpcf7_init_captcha();
|
||||
|
||||
if ( ! is_dir( $uploads_dir ) || ! is_writable( $uploads_dir ) ) {
|
||||
$message = sprintf( __( 'This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'wpcf7' ), $uploads_dir );
|
||||
|
||||
echo '<div class="error"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'imagecreatetruecolor' ) || ! function_exists( 'imagettftext' ) ) {
|
||||
$message = __( 'This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server.', 'wpcf7' );
|
||||
|
||||
echo '<div class="error"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* CAPTCHA functions */
|
||||
|
||||
function wpcf7_init_captcha() {
|
||||
global $wpcf7_captcha;
|
||||
|
||||
if ( ! class_exists( 'ReallySimpleCaptcha' ) )
|
||||
return false;
|
||||
|
||||
if ( ! is_object( $wpcf7_captcha ) )
|
||||
$wpcf7_captcha = new ReallySimpleCaptcha();
|
||||
$captcha =& $wpcf7_captcha;
|
||||
|
||||
$captcha->tmp_dir = trailingslashit( wpcf7_captcha_tmp_dir() );
|
||||
wp_mkdir_p( $captcha->tmp_dir );
|
||||
return true;
|
||||
}
|
||||
|
||||
function wpcf7_captcha_tmp_dir() {
|
||||
if ( defined( 'WPCF7_CAPTCHA_TMP_DIR' ) )
|
||||
return WPCF7_CAPTCHA_TMP_DIR;
|
||||
else
|
||||
return wpcf7_upload_dir( 'dir' ) . '/wpcf7_captcha';
|
||||
}
|
||||
|
||||
function wpcf7_captcha_tmp_url() {
|
||||
if ( defined( 'WPCF7_CAPTCHA_TMP_URL' ) )
|
||||
return WPCF7_CAPTCHA_TMP_URL;
|
||||
else
|
||||
return wpcf7_upload_dir( 'url' ) . '/wpcf7_captcha';
|
||||
}
|
||||
|
||||
function wpcf7_generate_captcha( $options = null ) {
|
||||
global $wpcf7_captcha;
|
||||
|
||||
if ( ! wpcf7_init_captcha() )
|
||||
return false;
|
||||
$captcha =& $wpcf7_captcha;
|
||||
|
||||
if ( ! is_dir( $captcha->tmp_dir ) || ! is_writable( $captcha->tmp_dir ) )
|
||||
return false;
|
||||
|
||||
$img_type = imagetypes();
|
||||
if ( $img_type & IMG_PNG )
|
||||
$captcha->img_type = 'png';
|
||||
elseif ( $img_type & IMG_GIF )
|
||||
$captcha->img_type = 'gif';
|
||||
elseif ( $img_type & IMG_JPG )
|
||||
$captcha->img_type = 'jpeg';
|
||||
else
|
||||
return false;
|
||||
|
||||
if ( is_array( $options ) ) {
|
||||
if ( isset( $options['img_size'] ) )
|
||||
$captcha->img_size = $options['img_size'];
|
||||
if ( isset( $options['base'] ) )
|
||||
$captcha->base = $options['base'];
|
||||
if ( isset( $options['font_size'] ) )
|
||||
$captcha->font_size = $options['font_size'];
|
||||
if ( isset( $options['font_char_width'] ) )
|
||||
$captcha->font_char_width = $options['font_char_width'];
|
||||
if ( isset( $options['fg'] ) )
|
||||
$captcha->fg = $options['fg'];
|
||||
if ( isset( $options['bg'] ) )
|
||||
$captcha->bg = $options['bg'];
|
||||
}
|
||||
|
||||
$prefix = mt_rand();
|
||||
$captcha_word = $captcha->generate_random_word();
|
||||
return $captcha->generate_image( $prefix, $captcha_word );
|
||||
}
|
||||
|
||||
function wpcf7_check_captcha( $prefix, $response ) {
|
||||
global $wpcf7_captcha;
|
||||
|
||||
if ( ! wpcf7_init_captcha() )
|
||||
return false;
|
||||
$captcha =& $wpcf7_captcha;
|
||||
|
||||
return $captcha->check( $prefix, $response );
|
||||
}
|
||||
|
||||
function wpcf7_remove_captcha( $prefix ) {
|
||||
global $wpcf7_captcha;
|
||||
|
||||
if ( ! wpcf7_init_captcha() )
|
||||
return false;
|
||||
$captcha =& $wpcf7_captcha;
|
||||
|
||||
if ( preg_match( '/[^0-9]/', $prefix ) ) // Contact Form 7 generates $prefix with mt_rand()
|
||||
return false;
|
||||
|
||||
$captcha->remove( $prefix );
|
||||
}
|
||||
|
||||
function wpcf7_cleanup_captcha_files() {
|
||||
global $wpcf7_captcha;
|
||||
|
||||
if ( ! wpcf7_init_captcha() )
|
||||
return false;
|
||||
$captcha =& $wpcf7_captcha;
|
||||
|
||||
if ( is_callable( array( $captcha, 'cleanup' ) ) )
|
||||
return $captcha->cleanup();
|
||||
|
||||
$dir = trailingslashit( wpcf7_captcha_tmp_dir() );
|
||||
|
||||
if ( ! is_dir( $dir ) || ! is_readable( $dir ) || ! is_writable( $dir ) )
|
||||
return false;
|
||||
|
||||
if ( $handle = @opendir( $dir ) ) {
|
||||
while ( false !== ( $file = readdir( $handle ) ) ) {
|
||||
if ( ! preg_match( '/^[0-9]+\.(php|png|gif|jpeg)$/', $file ) )
|
||||
continue;
|
||||
|
||||
$stat = @stat( $dir . $file );
|
||||
if ( $stat['mtime'] + 3600 < time() ) // 3600 secs == 1 hour
|
||||
@unlink( $dir . $file );
|
||||
}
|
||||
closedir( $handle );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
|
||||
wpcf7_cleanup_captcha_files();
|
||||
|
||||
function wpcf7_captchac_options( $options ) {
|
||||
if ( ! is_array( $options ) )
|
||||
return array();
|
||||
|
||||
$op = array();
|
||||
$image_size_array = preg_grep( '%^size:[smlSML]$%', $options );
|
||||
|
||||
if ( $image_size = array_shift( $image_size_array ) ) {
|
||||
preg_match( '%^size:([smlSML])$%', $image_size, $is_matches );
|
||||
switch ( strtolower( $is_matches[1] ) ) {
|
||||
case 's':
|
||||
$op['img_size'] = array( 60, 20 );
|
||||
$op['base'] = array( 6, 15 );
|
||||
$op['font_size'] = 11;
|
||||
$op['font_char_width'] = 13;
|
||||
break;
|
||||
case 'l':
|
||||
$op['img_size'] = array( 84, 28 );
|
||||
$op['base'] = array( 6, 20 );
|
||||
$op['font_size'] = 17;
|
||||
$op['font_char_width'] = 19;
|
||||
break;
|
||||
case 'm':
|
||||
default:
|
||||
$op['img_size'] = array( 72, 24 );
|
||||
$op['base'] = array( 6, 18 );
|
||||
$op['font_size'] = 14;
|
||||
$op['font_char_width'] = 15;
|
||||
}
|
||||
}
|
||||
|
||||
$fg_color_array = preg_grep( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options );
|
||||
if ( $fg_color = array_shift( $fg_color_array ) ) {
|
||||
preg_match( '%^fg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $fg_color, $fc_matches );
|
||||
if ( 3 == strlen( $fc_matches[1] ) ) {
|
||||
$r = substr( $fc_matches[1], 0, 1 );
|
||||
$g = substr( $fc_matches[1], 1, 1 );
|
||||
$b = substr( $fc_matches[1], 2, 1 );
|
||||
$op['fg'] = array( hexdec( $r . $r ), hexdec( $g . $g ), hexdec( $b . $b ) );
|
||||
} elseif ( 6 == strlen( $fc_matches[1] ) ) {
|
||||
$r = substr( $fc_matches[1], 0, 2 );
|
||||
$g = substr( $fc_matches[1], 2, 2 );
|
||||
$b = substr( $fc_matches[1], 4, 2 );
|
||||
$op['fg'] = array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
|
||||
}
|
||||
}
|
||||
|
||||
$bg_color_array = preg_grep( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $options );
|
||||
if ( $bg_color = array_shift( $bg_color_array ) ) {
|
||||
preg_match( '%^bg:#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$%', $bg_color, $bc_matches );
|
||||
if ( 3 == strlen( $bc_matches[1] ) ) {
|
||||
$r = substr( $bc_matches[1], 0, 1 );
|
||||
$g = substr( $bc_matches[1], 1, 1 );
|
||||
$b = substr( $bc_matches[1], 2, 1 );
|
||||
$op['bg'] = array( hexdec( $r . $r ), hexdec( $g . $g ), hexdec( $b . $b ) );
|
||||
} elseif ( 6 == strlen( $bc_matches[1] ) ) {
|
||||
$r = substr( $bc_matches[1], 0, 2 );
|
||||
$g = substr( $bc_matches[1], 2, 2 );
|
||||
$b = substr( $bc_matches[1], 4, 2 );
|
||||
$op['bg'] = array( hexdec( $r ), hexdec( $g ), hexdec( $b ) );
|
||||
}
|
||||
}
|
||||
|
||||
return $op;
|
||||
}
|
||||
|
||||
$wpcf7_captcha = null;
|
||||
|
||||
?>
|
||||
246
src/wp-content/plugins/contact-form-7/modules/checkbox.php
Normal file
246
src/wp-content/plugins/contact-form-7/modules/checkbox.php
Normal file
@ -0,0 +1,246 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [checkbox], [checkbox*], and [radio]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'checkbox', 'wpcf7_checkbox_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'checkbox*', 'wpcf7_checkbox_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'radio', 'wpcf7_checkbox_shortcode_handler', true );
|
||||
|
||||
function wpcf7_checkbox_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
$labels = (array) $tag['labels'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
$defaults = array();
|
||||
|
||||
$label_first = false;
|
||||
$use_label_element = false;
|
||||
|
||||
if ( 'checkbox*' == $type )
|
||||
$class_att .= ' wpcf7-validates-as-required';
|
||||
|
||||
if ( 'checkbox' == $type || 'checkbox*' == $type )
|
||||
$class_att .= ' wpcf7-checkbox';
|
||||
|
||||
if ( 'radio' == $type )
|
||||
$class_att .= ' wpcf7-radio';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '/^default:([0-9_]+)$/', $option, $matches ) ) {
|
||||
$defaults = explode( '_', $matches[1] );
|
||||
|
||||
} elseif ( preg_match( '%^label[_-]?first$%', $option ) ) {
|
||||
$label_first = true;
|
||||
|
||||
} elseif ( preg_match( '%^use[_-]?label[_-]?element$%', $option ) ) {
|
||||
$use_label_element = true;
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$multiple = false;
|
||||
$exclusive = (bool) preg_grep( '%^exclusive$%', $options );
|
||||
|
||||
if ( 'checkbox' == $type || 'checkbox*' == $type ) {
|
||||
$multiple = ! $exclusive;
|
||||
} else { // radio
|
||||
$exclusive = false;
|
||||
}
|
||||
|
||||
if ( $exclusive )
|
||||
$class_att .= ' wpcf7-exclusive-checkbox';
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
$html = '';
|
||||
|
||||
$input_type = rtrim( $type, '*' );
|
||||
|
||||
$posted = wpcf7_is_posted();
|
||||
|
||||
foreach ( $values as $key => $value ) {
|
||||
$checked = false;
|
||||
|
||||
if ( $posted && ! empty( $_POST[$name] ) ) {
|
||||
if ( $multiple && in_array( esc_sql( $value ), (array) $_POST[$name] ) )
|
||||
$checked = true;
|
||||
if ( ! $multiple && $_POST[$name] == esc_sql( $value ) )
|
||||
$checked = true;
|
||||
} else {
|
||||
if ( in_array( $key + 1, (array) $defaults ) )
|
||||
$checked = true;
|
||||
}
|
||||
|
||||
$checked = $checked ? ' checked="checked"' : '';
|
||||
|
||||
if ( '' !== $tabindex_att ) {
|
||||
$tabindex = sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
$tabindex_att += 1;
|
||||
} else {
|
||||
$tabindex = '';
|
||||
}
|
||||
|
||||
if ( isset( $labels[$key] ) )
|
||||
$label = $labels[$key];
|
||||
else
|
||||
$label = $value;
|
||||
|
||||
if ( $label_first ) { // put label first, input last
|
||||
$item = '<span class="wpcf7-list-item-label">' . esc_html( $label ) . '</span> ';
|
||||
$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 .= ' <span class="wpcf7-list-item-label">' . esc_html( $label ) . '</span>';
|
||||
}
|
||||
|
||||
if ( $use_label_element )
|
||||
$item = '<label>' . $item . '</label>';
|
||||
|
||||
$item = '<span class="wpcf7-list-item">' . $item . '</span>';
|
||||
$html .= $item;
|
||||
}
|
||||
|
||||
$html = '<span' . $atts . '>' . $html . '</span>';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_checkbox', 'wpcf7_checkbox_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_checkbox*', 'wpcf7_checkbox_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_radio', 'wpcf7_checkbox_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_checkbox_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$values = $tag['values'];
|
||||
|
||||
if ( ! empty( $_POST[$name] ) ) {
|
||||
if ( is_array( $_POST[$name] ) ) {
|
||||
foreach ( $_POST[$name] as $key => $value ) {
|
||||
$value = stripslashes( $value );
|
||||
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
|
||||
unset( $_POST[$name][$key] );
|
||||
}
|
||||
} else {
|
||||
$value = stripslashes( $_POST[$name] );
|
||||
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
|
||||
$_POST[$name] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'checkbox*' == $type ) {
|
||||
if ( empty( $_POST[$name] ) ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_checkbox_and_radio', 30 );
|
||||
|
||||
function wpcf7_add_tag_generator_checkbox_and_radio() {
|
||||
wpcf7_add_tag_generator( 'checkbox', __( 'Checkboxes', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-checkbox', 'wpcf7_tg_pane_checkbox' );
|
||||
|
||||
wpcf7_add_tag_generator( 'radio', __( 'Radio buttons', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-radio', 'wpcf7_tg_pane_radio' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_checkbox( &$contact_form ) {
|
||||
wpcf7_tg_pane_checkbox_and_radio( 'checkbox' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_radio( &$contact_form ) {
|
||||
wpcf7_tg_pane_checkbox_and_radio( 'radio' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_checkbox_and_radio( $type = 'checkbox' ) {
|
||||
if ( 'radio' != $type )
|
||||
$type = 'checkbox';
|
||||
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<?php if ( 'checkbox' == $type ) : ?>
|
||||
<tr><td><input type="checkbox" name="required" /> <?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" /> <?php echo esc_html( __( 'Put a label first, a checkbox last?', 'wpcf7' ) ); ?>
|
||||
<br /><input type="checkbox" name="use_label_element" class="option" /> <?php echo esc_html( __( 'Wrap each item with <label> tag?', 'wpcf7' ) ); ?>
|
||||
<?php if ( 'checkbox' == $type ) : ?>
|
||||
<br /><input type="checkbox" name="exclusive" class="option" /> <?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">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
346
src/wp-content/plugins/contact-form-7/modules/file.php
Normal file
346
src/wp-content/plugins/contact-form-7/modules/file.php
Normal 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 '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$size_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
$class_att .= ' wpcf7-file';
|
||||
|
||||
if ( 'file*' == $type )
|
||||
$class_att .= ' wpcf7-validates-as-required';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
|
||||
$size_att = (int) $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
if ( $size_att )
|
||||
$atts .= ' size="' . $size_att . '"';
|
||||
else
|
||||
$atts .= ' size="40"'; // default size
|
||||
|
||||
if ( '' !== $tabindex_att )
|
||||
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
|
||||
$html = '<input type="file" name="' . $name . '"' . $atts . ' value="1" />';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Encode type filter */
|
||||
|
||||
add_filter( 'wpcf7_form_enctype', 'wpcf7_file_form_enctype_filter' );
|
||||
|
||||
function wpcf7_file_form_enctype_filter( $enctype ) {
|
||||
$multipart = (bool) wpcf7_scan_shortcode( array( 'type' => array( 'file', 'file*' ) ) );
|
||||
|
||||
if ( $multipart )
|
||||
$enctype = ' enctype="multipart/form-data"';
|
||||
|
||||
return $enctype;
|
||||
}
|
||||
|
||||
|
||||
/* Validation + upload handling filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_file', 'wpcf7_file_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_file*', 'wpcf7_file_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_file_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
|
||||
$file = $_FILES[$name];
|
||||
|
||||
if ( $file['error'] && UPLOAD_ERR_NO_FILE != $file['error'] ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'upload_failed_php_error' );
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ( empty( $file['tmp_name'] ) && 'file*' == $type ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
||||
return $result;
|
||||
}
|
||||
|
||||
if ( ! is_uploaded_file( $file['tmp_name'] ) )
|
||||
return $result;
|
||||
|
||||
$file_type_pattern = '';
|
||||
$allowed_size = 1048576; // default size 1 MB
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^filetypes:(.+)$%', $option, $matches ) ) {
|
||||
$file_types = explode( '|', $matches[1] );
|
||||
foreach ( $file_types as $file_type ) {
|
||||
$file_type = trim( $file_type, '.' );
|
||||
$file_type = str_replace(
|
||||
array( '.', '+', '*', '?' ), array( '\.', '\+', '\*', '\?' ), $file_type );
|
||||
$file_type_pattern .= '|' . $file_type;
|
||||
}
|
||||
|
||||
} elseif ( preg_match( '/^limit:([1-9][0-9]*)([kKmM]?[bB])?$/', $option, $matches ) ) {
|
||||
$allowed_size = (int) $matches[1];
|
||||
|
||||
$kbmb = strtolower( $matches[2] );
|
||||
if ( 'kb' == $kbmb ) {
|
||||
$allowed_size *= 1024;
|
||||
} elseif ( 'mb' == $kbmb ) {
|
||||
$allowed_size *= 1024 * 1024;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* File type validation */
|
||||
|
||||
// Default file-type restriction
|
||||
if ( '' == $file_type_pattern )
|
||||
$file_type_pattern = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
|
||||
|
||||
$file_type_pattern = trim( $file_type_pattern, '|' );
|
||||
$file_type_pattern = '(' . $file_type_pattern . ')';
|
||||
$file_type_pattern = '/\.' . $file_type_pattern . '$/i';
|
||||
|
||||
if ( ! preg_match( $file_type_pattern, $file['name'] ) ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'upload_file_type_invalid' );
|
||||
return $result;
|
||||
}
|
||||
|
||||
/* File size validation */
|
||||
|
||||
if ( $file['size'] > $allowed_size ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'upload_file_too_large' );
|
||||
return $result;
|
||||
}
|
||||
|
||||
$uploads_dir = wpcf7_upload_tmp_dir();
|
||||
wpcf7_init_uploads(); // Confirm upload dir
|
||||
|
||||
$filename = $file['name'];
|
||||
|
||||
// If you get script file, it's a danger. Make it TXT file.
|
||||
if ( preg_match( '/\.(php|pl|py|rb|cgi)\d?$/', $filename ) )
|
||||
$filename .= '.txt';
|
||||
|
||||
$filename = wp_unique_filename( $uploads_dir, $filename );
|
||||
|
||||
$new_file = trailingslashit( $uploads_dir ) . $filename;
|
||||
|
||||
if ( false === @move_uploaded_file( $file['tmp_name'], $new_file ) ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'upload_failed' );
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Make sure the uploaded file is only readable for the owner process
|
||||
@chmod( $new_file, 0400 );
|
||||
|
||||
if ( $contact_form = wpcf7_get_current_contact_form() )
|
||||
$contact_form->uploaded_files[$name] = $new_file;
|
||||
|
||||
if ( ! isset( $_POST[$name] ) )
|
||||
$_POST[$name] = $filename;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Messages */
|
||||
|
||||
add_filter( 'wpcf7_messages', 'wpcf7_file_messages' );
|
||||
|
||||
function wpcf7_file_messages( $messages ) {
|
||||
return array_merge( $messages, array(
|
||||
'upload_failed' => array(
|
||||
'description' => __( "Uploading a file fails for any reason", 'wpcf7' ),
|
||||
'default' => __( 'Failed to upload file.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'upload_file_type_invalid' => array(
|
||||
'description' => __( "Uploaded file is not allowed file type", 'wpcf7' ),
|
||||
'default' => __( 'This file type is not allowed.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'upload_file_too_large' => array(
|
||||
'description' => __( "Uploaded file is too large", 'wpcf7' ),
|
||||
'default' => __( 'This file is too large.', 'wpcf7' )
|
||||
),
|
||||
|
||||
'upload_failed_php_error' => array(
|
||||
'description' => __( "Uploading a file fails for PHP error", 'wpcf7' ),
|
||||
'default' => __( 'Failed to upload file. Error occurred.', 'wpcf7' )
|
||||
)
|
||||
) );
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_file', 50 );
|
||||
|
||||
function wpcf7_add_tag_generator_file() {
|
||||
wpcf7_add_tag_generator( 'file', __( 'File upload', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-file', 'wpcf7_tg_pane_file' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_file( &$contact_form ) {
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-file" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<tr><td><input type="checkbox" name="required" /> <?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">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/* Warning message */
|
||||
|
||||
add_action( 'wpcf7_admin_before_subsubsub', 'wpcf7_file_display_warning_message' );
|
||||
|
||||
function wpcf7_file_display_warning_message( &$contact_form ) {
|
||||
if ( ! $contact_form )
|
||||
return;
|
||||
|
||||
$has_tags = (bool) $contact_form->form_scan_shortcode(
|
||||
array( 'type' => array( 'file', 'file*' ) ) );
|
||||
|
||||
if ( ! $has_tags )
|
||||
return;
|
||||
|
||||
$uploads_dir = wpcf7_upload_tmp_dir();
|
||||
wpcf7_init_uploads();
|
||||
|
||||
if ( ! is_dir( $uploads_dir ) || ! is_writable( $uploads_dir ) ) {
|
||||
$message = sprintf( __( 'This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'wpcf7' ), $uploads_dir );
|
||||
|
||||
echo '<div class="error"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* File uploading functions */
|
||||
|
||||
function wpcf7_init_uploads() {
|
||||
$dir = wpcf7_upload_tmp_dir();
|
||||
wp_mkdir_p( trailingslashit( $dir ) );
|
||||
@chmod( $dir, 0733 );
|
||||
|
||||
$htaccess_file = trailingslashit( $dir ) . '.htaccess';
|
||||
if ( file_exists( $htaccess_file ) )
|
||||
return;
|
||||
|
||||
if ( $handle = @fopen( $htaccess_file, 'w' ) ) {
|
||||
fwrite( $handle, "Deny from all\n" );
|
||||
fclose( $handle );
|
||||
}
|
||||
}
|
||||
|
||||
function wpcf7_upload_tmp_dir() {
|
||||
if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) )
|
||||
return WPCF7_UPLOADS_TMP_DIR;
|
||||
else
|
||||
return wpcf7_upload_dir( 'dir' ) . '/wpcf7_uploads';
|
||||
}
|
||||
|
||||
function wpcf7_cleanup_upload_files() {
|
||||
$dir = trailingslashit( wpcf7_upload_tmp_dir() );
|
||||
|
||||
if ( ! is_dir( $dir ) )
|
||||
return false;
|
||||
if ( ! is_readable( $dir ) )
|
||||
return false;
|
||||
if ( ! is_writable( $dir ) )
|
||||
return false;
|
||||
|
||||
if ( $handle = @opendir( $dir ) ) {
|
||||
while ( false !== ( $file = readdir( $handle ) ) ) {
|
||||
if ( $file == "." || $file == ".." || $file == ".htaccess" )
|
||||
continue;
|
||||
|
||||
$stat = stat( $dir . $file );
|
||||
if ( $stat['mtime'] + 60 < time() ) // 60 secs
|
||||
@unlink( $dir . $file );
|
||||
}
|
||||
closedir( $handle );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! is_admin() && 'GET' == $_SERVER['REQUEST_METHOD'] )
|
||||
wpcf7_cleanup_upload_files();
|
||||
|
||||
?>
|
||||
79
src/wp-content/plugins/contact-form-7/modules/icl.php
Normal file
79
src/wp-content/plugins/contact-form-7/modules/icl.php
Normal file
@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/**
|
||||
** Note: This ICL module is obsolete and no longer functioning on this version.
|
||||
** There is a simpler way for creating contact forms of other languages.
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'icl', 'icl_wpcf7_shortcode_handler', true );
|
||||
|
||||
function icl_wpcf7_shortcode_handler( $tag ) {
|
||||
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$name = $tag['name'];
|
||||
$values = (array) $tag['values'];
|
||||
$content = $tag['content'];
|
||||
|
||||
// Just return the content.
|
||||
|
||||
$content = trim( $content );
|
||||
if ( ! empty( $content ) )
|
||||
return $content;
|
||||
|
||||
$value = trim( $values[0] );
|
||||
if ( ! empty( $value ) )
|
||||
return $value;
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
|
||||
/* Message dispaly filter */
|
||||
|
||||
add_filter( 'wpcf7_display_message', 'icl_wpcf7_display_message_filter' );
|
||||
|
||||
function icl_wpcf7_display_message_filter( $message ) {
|
||||
$shortcode_manager = new WPCF7_ShortcodeManager();
|
||||
$shortcode_manager->add_shortcode( 'icl', 'icl_wpcf7_shortcode_handler', true );
|
||||
|
||||
return $shortcode_manager->do_shortcode( $message );
|
||||
}
|
||||
|
||||
|
||||
/* Warning message */
|
||||
|
||||
add_action( 'wpcf7_admin_before_subsubsub', 'icl_wpcf7_display_warning_message' );
|
||||
|
||||
function icl_wpcf7_display_warning_message( &$contact_form ) {
|
||||
if ( ! $contact_form )
|
||||
return;
|
||||
|
||||
$has_icl_tags = (bool) $contact_form->form_scan_shortcode(
|
||||
array( 'type' => array( 'icl' ) ) );
|
||||
|
||||
if ( ! $has_icl_tags ) {
|
||||
$messages = (array) $contact_form->messages;
|
||||
|
||||
$shortcode_manager = new WPCF7_ShortcodeManager();
|
||||
$shortcode_manager->add_shortcode( 'icl', create_function( '$tag', 'return null;' ), true );
|
||||
|
||||
foreach ( $messages as $message ) {
|
||||
if ( $shortcode_manager->scan_shortcode( $message ) ) {
|
||||
$has_icl_tags = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $has_icl_tags )
|
||||
return;
|
||||
|
||||
$message = __( "This contact form contains [icl] tags, but they are obsolete and no longer functioning on this version of Contact Form 7. <a href=\"http://contactform7.com/2009/12/25/contact-form-in-your-language/#Creating_contact_form_in_different_languages\" target=\"_blank\">There is a simpler way for creating contact forms of other languages</a> and you are recommended to use it.", 'wpcf7' );
|
||||
|
||||
echo '<div class="error"><p><strong>' . $message . '</strong></p></div>';
|
||||
}
|
||||
|
||||
?>
|
||||
214
src/wp-content/plugins/contact-form-7/modules/quiz.php
Normal file
214
src/wp-content/plugins/contact-form-7/modules/quiz.php
Normal file
@ -0,0 +1,214 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [quiz]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'quiz', 'wpcf7_quiz_shortcode_handler', true );
|
||||
|
||||
function wpcf7_quiz_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$pipes = $tag['pipes'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$size_att = '';
|
||||
$maxlength_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
$class_att .= ' wpcf7-quiz';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
|
||||
$size_att = (int) $matches[1];
|
||||
$maxlength_att = (int) $matches[2];
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
if ( $size_att )
|
||||
$atts .= ' size="' . $size_att . '"';
|
||||
else
|
||||
$atts .= ' size="40"'; // default size
|
||||
|
||||
if ( $maxlength_att )
|
||||
$atts .= ' maxlength="' . $maxlength_att . '"';
|
||||
|
||||
if ( '' !== $tabindex_att )
|
||||
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
|
||||
if ( is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
||||
$pipe = $pipes->random_pipe();
|
||||
$question = $pipe->before;
|
||||
$answer = $pipe->after;
|
||||
} else {
|
||||
// default quiz
|
||||
$question = '1+1=?';
|
||||
$answer = '2';
|
||||
}
|
||||
|
||||
$answer = wpcf7_canonicalize( $answer );
|
||||
|
||||
$html = '<span class="wpcf7-quiz-label">' . esc_html( $question ) . '</span> ';
|
||||
$html .= '<input type="text" name="' . $name . '"' . $atts . ' />';
|
||||
$html .= '<input type="hidden" name="_wpcf7_quiz_answer_' . $name . '" value="' . wp_hash( $answer, 'wpcf7_quiz' ) . '" />';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_quiz_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
|
||||
$answer = wpcf7_canonicalize( $_POST[$name] );
|
||||
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
|
||||
$expected_hash = $_POST['_wpcf7_quiz_answer_' . $name];
|
||||
if ( $answer_hash != $expected_hash ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'quiz_answer_not_correct' );
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Ajax echo filter */
|
||||
|
||||
add_filter( 'wpcf7_ajax_onload', 'wpcf7_quiz_ajax_refill' );
|
||||
add_filter( 'wpcf7_ajax_json_echo', 'wpcf7_quiz_ajax_refill' );
|
||||
|
||||
function wpcf7_quiz_ajax_refill( $items ) {
|
||||
if ( ! is_array( $items ) )
|
||||
return $items;
|
||||
|
||||
$fes = wpcf7_scan_shortcode( array( 'type' => 'quiz' ) );
|
||||
|
||||
if ( empty( $fes ) )
|
||||
return $items;
|
||||
|
||||
$refill = array();
|
||||
|
||||
foreach ( $fes as $fe ) {
|
||||
$name = $fe['name'];
|
||||
$pipes = $fe['pipes'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
continue;
|
||||
|
||||
if ( is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) {
|
||||
$pipe = $pipes->random_pipe();
|
||||
$question = $pipe->before;
|
||||
$answer = $pipe->after;
|
||||
} else {
|
||||
// default quiz
|
||||
$question = '1+1=?';
|
||||
$answer = '2';
|
||||
}
|
||||
|
||||
$answer = wpcf7_canonicalize( $answer );
|
||||
|
||||
$refill[$name] = array( $question, wp_hash( $answer, 'wpcf7_quiz' ) );
|
||||
}
|
||||
|
||||
if ( ! empty( $refill ) )
|
||||
$items['quiz'] = $refill;
|
||||
|
||||
return $items;
|
||||
}
|
||||
|
||||
|
||||
/* Messages */
|
||||
|
||||
add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages' );
|
||||
|
||||
function wpcf7_quiz_messages( $messages ) {
|
||||
return array_merge( $messages, array( 'quiz_answer_not_correct' => array(
|
||||
'description' => __( "Sender doesn't enter the correct answer to the quiz", 'wpcf7' ),
|
||||
'default' => __( 'Your answer is not correct.', 'wpcf7' )
|
||||
) ) );
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_quiz', 40 );
|
||||
|
||||
function wpcf7_add_tag_generator_quiz() {
|
||||
wpcf7_add_tag_generator( 'quiz', __( 'Quiz', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-quiz', 'wpcf7_tg_pane_quiz' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_quiz( &$contact_form ) {
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-quiz" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<tr><td><?php echo esc_html( __( 'Name', 'wpcf7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="id" class="idvalue oneline option" /></td>
|
||||
|
||||
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="class" class="classvalue oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><code>size</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="size" class="numeric oneline option" /></td>
|
||||
|
||||
<td><code>maxlength</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="maxlength" class="numeric oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo esc_html( __( 'Quizzes', 'wpcf7' ) ); ?><br />
|
||||
<textarea name="values"></textarea><br />
|
||||
<span style="font-size: smaller"><?php echo esc_html( __( "* quiz|answer (e.g. 1+1=?|2)", 'wpcf7' ) ); ?></span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="quiz" class="tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
17
src/wp-content/plugins/contact-form-7/modules/response.php
Normal file
17
src/wp-content/plugins/contact-form-7/modules/response.php
Normal 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();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
193
src/wp-content/plugins/contact-form-7/modules/select.php
Normal file
193
src/wp-content/plugins/contact-form-7/modules/select.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [select] and [select*]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'select', 'wpcf7_select_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'select*', 'wpcf7_select_shortcode_handler', true );
|
||||
|
||||
function wpcf7_select_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
$labels = (array) $tag['labels'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
$defaults = array();
|
||||
|
||||
$class_att .= ' wpcf7-select';
|
||||
|
||||
if ( 'select*' == $type )
|
||||
$class_att .= ' wpcf7-validates-as-required';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '/^default:([0-9_]+)$/', $option, $matches ) ) {
|
||||
$defaults = explode( '_', $matches[1] );
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
if ( '' !== $tabindex_att )
|
||||
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
|
||||
$multiple = (bool) preg_grep( '%^multiple$%', $options );
|
||||
$include_blank = (bool) preg_grep( '%^include_blank$%', $options );
|
||||
|
||||
$empty_select = empty( $values );
|
||||
if ( $empty_select || $include_blank ) {
|
||||
array_unshift( $labels, '---' );
|
||||
array_unshift( $values, '---' );
|
||||
}
|
||||
|
||||
$html = '';
|
||||
|
||||
$posted = wpcf7_is_posted();
|
||||
|
||||
foreach ( $values as $key => $value ) {
|
||||
$selected = false;
|
||||
|
||||
if ( $posted && ! empty( $_POST[$name] ) ) {
|
||||
if ( $multiple && in_array( esc_sql( $value ), (array) $_POST[$name] ) )
|
||||
$selected = true;
|
||||
if ( ! $multiple && $_POST[$name] == esc_sql( $value ) )
|
||||
$selected = true;
|
||||
} else {
|
||||
if ( ! $empty_select && in_array( $key + 1, (array) $defaults ) )
|
||||
$selected = true;
|
||||
}
|
||||
|
||||
$selected = $selected ? ' selected="selected"' : '';
|
||||
|
||||
if ( isset( $labels[$key] ) )
|
||||
$label = $labels[$key];
|
||||
else
|
||||
$label = $value;
|
||||
|
||||
$html .= '<option value="' . esc_attr( $value ) . '"' . $selected . '>' . esc_html( $label ) . '</option>';
|
||||
}
|
||||
|
||||
if ( $multiple )
|
||||
$atts .= ' multiple="multiple"';
|
||||
|
||||
$html = '<select name="' . $name . ( $multiple ? '[]' : '' ) . '"' . $atts . '>' . $html . '</select>';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_select', 'wpcf7_select_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_select*', 'wpcf7_select_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_select_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$values = $tag['values'];
|
||||
|
||||
if ( ! empty( $_POST[$name] ) ) {
|
||||
if ( is_array( $_POST[$name] ) ) {
|
||||
foreach ( $_POST[$name] as $key => $value ) {
|
||||
$value = stripslashes( $value );
|
||||
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
|
||||
unset( $_POST[$name][$key] );
|
||||
}
|
||||
} else {
|
||||
$value = stripslashes( $_POST[$name] );
|
||||
if ( ! in_array( $value, (array) $values ) ) // Not in given choices.
|
||||
$_POST[$name] = '';
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'select*' == $type ) {
|
||||
if ( empty( $_POST[$name] ) && '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() {
|
||||
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" /> <?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" /> <?php echo esc_html( __( 'Allow multiple selections?', 'wpcf7' ) ); ?>
|
||||
<br /><input type="checkbox" name="include_blank" class="option" /> <?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">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
** Filters for Special Mail Tags
|
||||
**/
|
||||
|
||||
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag', 10, 2 );
|
||||
|
||||
function wpcf7_special_mail_tag( $output, $name ) {
|
||||
|
||||
// For backwards compat.
|
||||
$name = preg_replace( '/^wpcf7\./', '_', $name );
|
||||
|
||||
if ( '_remote_ip' == $name )
|
||||
$output = preg_replace( '/[^0-9a-f.:, ]/', '', $_SERVER['REMOTE_ADDR'] );
|
||||
|
||||
elseif ( '_url' == $name ) {
|
||||
$url = untrailingslashit( home_url() );
|
||||
$url = preg_replace( '%(?<!:|/)/.*$%', '', $url );
|
||||
$url .= wpcf7_get_request_uri();
|
||||
$output = $url;
|
||||
}
|
||||
|
||||
elseif ( '_date' == $name )
|
||||
$output = date_i18n( get_option( 'date_format' ) );
|
||||
|
||||
elseif ( '_time' == $name )
|
||||
$output = date_i18n( get_option( 'time_format' ) );
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
add_filter( 'wpcf7_special_mail_tags', 'wpcf7_special_mail_tag_for_post_data', 10, 2 );
|
||||
|
||||
function wpcf7_special_mail_tag_for_post_data( $output, $name ) {
|
||||
|
||||
if ( ! isset( $_POST['_wpcf7_unit_tag'] ) || empty( $_POST['_wpcf7_unit_tag'] ) )
|
||||
return $output;
|
||||
|
||||
if ( ! preg_match( '/^wpcf7-f(\d+)-p(\d+)-o(\d+)$/', $_POST['_wpcf7_unit_tag'], $matches ) )
|
||||
return $output;
|
||||
|
||||
$post_id = (int) $matches[2];
|
||||
|
||||
if ( ! $post = get_post( $post_id ) )
|
||||
return $output;
|
||||
|
||||
$user = new WP_User( $post->post_author );
|
||||
|
||||
// For backwards compat.
|
||||
$name = preg_replace( '/^wpcf7\./', '_', $name );
|
||||
|
||||
if ( '_post_id' == $name )
|
||||
$output = (string) $post->ID;
|
||||
|
||||
elseif ( '_post_name' == $name )
|
||||
$output = $post->post_name;
|
||||
|
||||
elseif ( '_post_title' == $name )
|
||||
$output = $post->post_title;
|
||||
|
||||
elseif ( '_post_url' == $name )
|
||||
$output = get_permalink( $post->ID );
|
||||
|
||||
elseif ( '_post_author' == $name )
|
||||
$output = $user->display_name;
|
||||
|
||||
elseif ( '_post_author_email' == $name )
|
||||
$output = $user->user_email;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
?>
|
||||
97
src/wp-content/plugins/contact-form-7/modules/submit.php
Normal file
97
src/wp-content/plugins/contact-form-7/modules/submit.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [submit]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'submit', 'wpcf7_submit_shortcode_handler' );
|
||||
|
||||
function wpcf7_submit_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$tabindex_att = '';
|
||||
|
||||
$class_att .= ' wpcf7-submit';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ( $id_att )
|
||||
$atts .= ' id="' . trim( $id_att ) . '"';
|
||||
|
||||
if ( $class_att )
|
||||
$atts .= ' class="' . trim( $class_att ) . '"';
|
||||
|
||||
if ( '' !== $tabindex_att )
|
||||
$atts .= sprintf( ' tabindex="%d"', $tabindex_att );
|
||||
|
||||
$value = isset( $values[0] ) ? $values[0] : '';
|
||||
if ( empty( $value ) )
|
||||
$value = __( 'Send', 'wpcf7' );
|
||||
|
||||
$html = '<input type="submit" value="' . esc_attr( $value ) . '"' . $atts . ' />';
|
||||
|
||||
if ( wpcf7_script_is() ) {
|
||||
$src = apply_filters( 'wpcf7_ajax_loader', wpcf7_plugin_url( 'images/ajax-loader.gif' ) );
|
||||
$html .= '<img class="ajax-loader" style="visibility: hidden;" alt="' . esc_attr( __( 'Sending ...', 'wpcf7' ) ) . '" src="' . esc_url_raw( $src ) . '" />';
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_submit', 55 );
|
||||
|
||||
function wpcf7_add_tag_generator_submit() {
|
||||
wpcf7_add_tag_generator( 'submit', __( 'Submit button', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-submit', 'wpcf7_tg_pane_submit', array( 'nameless' => 1 ) );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_submit( &$contact_form ) {
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-submit" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<tr>
|
||||
<td><code>id</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="id" class="idvalue oneline option" /></td>
|
||||
|
||||
<td><code>class</code> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="class" class="classvalue oneline option" /></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><?php echo esc_html( __( 'Label', 'wpcf7' ) ); ?> (<?php echo esc_html( __( 'optional', 'wpcf7' ) ); ?>)<br />
|
||||
<input type="text" name="values" class="oneline" /></td>
|
||||
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="tg-tag"><?php echo esc_html( __( "Copy this code and paste it into the form left.", 'wpcf7' ) ); ?><br /><input type="text" name="submit" class="tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
210
src/wp-content/plugins/contact-form-7/modules/text.php
Normal file
210
src/wp-content/plugins/contact-form-7/modules/text.php
Normal file
@ -0,0 +1,210 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [text], [text*], [email], and [email*]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'text', 'wpcf7_text_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'text*', 'wpcf7_text_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'email', 'wpcf7_text_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'email*', 'wpcf7_text_shortcode_handler', true );
|
||||
|
||||
function wpcf7_text_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$size_att = '';
|
||||
$maxlength_att = '';
|
||||
$tabindex_att = '';
|
||||
$title_att = '';
|
||||
|
||||
$class_att .= ' wpcf7-text';
|
||||
|
||||
if ( 'email' == $type || 'email*' == $type )
|
||||
$class_att .= ' wpcf7-validates-as-email';
|
||||
|
||||
if ( 'text*' == $type || 'email*' == $type )
|
||||
$class_att .= ' wpcf7-validates-as-required';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^([0-9]*)[/x]([0-9]*)$%', $option, $matches ) ) {
|
||||
$size_att = (int) $matches[1];
|
||||
$maxlength_att = (int) $matches[2];
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$value = (string) reset( $values );
|
||||
|
||||
if ( wpcf7_script_is() && preg_grep( '%^watermark$%', $options ) ) {
|
||||
$class_att .= ' wpcf7-use-title-as-watermark';
|
||||
$title_att .= sprintf( ' %s', $value );
|
||||
$value = '';
|
||||
}
|
||||
|
||||
if ( wpcf7_is_posted() && 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 . ' />';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_text', 'wpcf7_text_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_text*', 'wpcf7_text_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_email', 'wpcf7_text_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_email*', 'wpcf7_text_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_text_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
|
||||
$_POST[$name] = trim( strtr( (string) $_POST[$name], "\n", " " ) );
|
||||
|
||||
if ( 'text*' == $type ) {
|
||||
if ( '' == $_POST[$name] ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'email' == $type || 'email*' == $type ) {
|
||||
if ( 'email*' == $type && '' == $_POST[$name] ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
||||
} elseif ( '' != $_POST[$name] && ! is_email( $_POST[$name] ) ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'invalid_email' );
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_text_and_email', 15 );
|
||||
|
||||
function wpcf7_add_tag_generator_text_and_email() {
|
||||
wpcf7_add_tag_generator( 'text', __( 'Text field', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-text', 'wpcf7_tg_pane_text' );
|
||||
|
||||
wpcf7_add_tag_generator( 'email', __( 'Email field', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-email', 'wpcf7_tg_pane_email' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_text( &$contact_form ) {
|
||||
wpcf7_tg_pane_text_and_email( 'text' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_email( &$contact_form ) {
|
||||
wpcf7_tg_pane_text_and_email( 'email' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_text_and_email( $type = 'text' ) {
|
||||
if ( 'email' != $type )
|
||||
$type = 'text';
|
||||
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<tr><td><input type="checkbox" name="required" /> <?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" /> <?php echo esc_html( __( "This field requires author's name", 'wpcf7' ) ); ?><br />
|
||||
<input type="checkbox" name="akismet:author_url" class="exclusive option" /> <?php echo esc_html( __( "This field requires author's URL", 'wpcf7' ) ); ?>
|
||||
<?php else : ?>
|
||||
<input type="checkbox" name="akismet:author_email" class="option" /> <?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" /> <?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">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
172
src/wp-content/plugins/contact-form-7/modules/textarea.php
Normal file
172
src/wp-content/plugins/contact-form-7/modules/textarea.php
Normal file
@ -0,0 +1,172 @@
|
||||
<?php
|
||||
/**
|
||||
** A base module for [textarea] and [textarea*]
|
||||
**/
|
||||
|
||||
/* Shortcode handler */
|
||||
|
||||
wpcf7_add_shortcode( 'textarea', 'wpcf7_textarea_shortcode_handler', true );
|
||||
wpcf7_add_shortcode( 'textarea*', 'wpcf7_textarea_shortcode_handler', true );
|
||||
|
||||
function wpcf7_textarea_shortcode_handler( $tag ) {
|
||||
if ( ! is_array( $tag ) )
|
||||
return '';
|
||||
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
$options = (array) $tag['options'];
|
||||
$values = (array) $tag['values'];
|
||||
$content = $tag['content'];
|
||||
|
||||
if ( empty( $name ) )
|
||||
return '';
|
||||
|
||||
$atts = '';
|
||||
$id_att = '';
|
||||
$class_att = '';
|
||||
$cols_att = '';
|
||||
$rows_att = '';
|
||||
$tabindex_att = '';
|
||||
$title_att = '';
|
||||
|
||||
if ( 'textarea*' == $type )
|
||||
$class_att .= ' wpcf7-validates-as-required';
|
||||
|
||||
foreach ( $options as $option ) {
|
||||
if ( preg_match( '%^id:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$id_att = $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^class:([-0-9a-zA-Z_]+)$%', $option, $matches ) ) {
|
||||
$class_att .= ' ' . $matches[1];
|
||||
|
||||
} elseif ( preg_match( '%^([0-9]*)[x/]([0-9]*)$%', $option, $matches ) ) {
|
||||
$cols_att = (int) $matches[1];
|
||||
$rows_att = (int) $matches[2];
|
||||
|
||||
} elseif ( preg_match( '%^tabindex:(\d+)$%', $option, $matches ) ) {
|
||||
$tabindex_att = (int) $matches[1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$value = (string) reset( $values );
|
||||
|
||||
if ( ! empty( $content ) )
|
||||
$value = $content;
|
||||
|
||||
if ( wpcf7_script_is() && preg_grep( '%^watermark$%', $options ) ) {
|
||||
$class_att .= ' wpcf7-use-title-as-watermark';
|
||||
$title_att .= sprintf( ' %s', $value );
|
||||
$value = '';
|
||||
}
|
||||
|
||||
if ( wpcf7_is_posted() && 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>';
|
||||
|
||||
$validation_error = wpcf7_get_validation_error( $name );
|
||||
|
||||
$html = '<span class="wpcf7-form-control-wrap ' . $name . '">' . $html . $validation_error . '</span>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
|
||||
/* Validation filter */
|
||||
|
||||
add_filter( 'wpcf7_validate_textarea', 'wpcf7_textarea_validation_filter', 10, 2 );
|
||||
add_filter( 'wpcf7_validate_textarea*', 'wpcf7_textarea_validation_filter', 10, 2 );
|
||||
|
||||
function wpcf7_textarea_validation_filter( $result, $tag ) {
|
||||
$type = $tag['type'];
|
||||
$name = $tag['name'];
|
||||
|
||||
$_POST[$name] = (string) $_POST[$name];
|
||||
|
||||
if ( 'textarea*' == $type ) {
|
||||
if ( '' == $_POST[$name] ) {
|
||||
$result['valid'] = false;
|
||||
$result['reason'][$name] = wpcf7_get_message( 'invalid_required' );
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'admin_init', 'wpcf7_add_tag_generator_textarea', 20 );
|
||||
|
||||
function wpcf7_add_tag_generator_textarea() {
|
||||
wpcf7_add_tag_generator( 'textarea', __( 'Text area', 'wpcf7' ),
|
||||
'wpcf7-tg-pane-textarea', 'wpcf7_tg_pane_textarea' );
|
||||
}
|
||||
|
||||
function wpcf7_tg_pane_textarea( &$contact_form ) {
|
||||
?>
|
||||
<div id="wpcf7-tg-pane-textarea" class="hidden">
|
||||
<form action="">
|
||||
<table>
|
||||
<tr><td><input type="checkbox" name="required" /> <?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" /> <?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">⬇</span> <input type="text" class="mail-tag" readonly="readonly" onfocus="this.select()" /></div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
114
src/wp-content/plugins/contact-form-7/readme.txt
Normal file
114
src/wp-content/plugins/contact-form-7/readme.txt
Normal file
@ -0,0 +1,114 @@
|
||||
=== Contact Form 7 ===
|
||||
Contributors: takayukister
|
||||
Donate link: http://contactform7.com/donate/
|
||||
Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual
|
||||
Requires at least: 3.2
|
||||
Tested up to: 3.2.1
|
||||
Stable tag: 2.4.6
|
||||
|
||||
Just another contact form plugin. Simple but flexible.
|
||||
|
||||
== Description ==
|
||||
|
||||
Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on.
|
||||
|
||||
= Plugin's Official Site =
|
||||
|
||||
Contact Form 7 ([http://contactform7.com](http://contactform7.com/))
|
||||
|
||||
* [Docs](http://contactform7.com/docs/) - [FAQ](http://contactform7.com/faq/) - [Support](http://contactform7.com/support/)
|
||||
|
||||
= Contact Form 7 Needs Your Support =
|
||||
|
||||
It is hard to continue development and support for this plugin without contributions from users like you. If you enjoy using Contact Form 7 and find it useful, please consider [__making a donation__](http://contactform7.com/donate/). Your donation will help encourage and support the plugin's continued development and better user support.
|
||||
|
||||
= Translators =
|
||||
|
||||
* Afrikaans (af) - [Schalk Burger](http://www.schalkburger.za.net/)
|
||||
* Albanian (sq) - [Olgi Zenullari](http://www.olgizenullari.com/)
|
||||
* Arabic (ar) - [Tarek Chaaban](http://www.chaaban.info/), Muhammed Lardi, [Yaser Mohammed](http://www.englize.com/)
|
||||
* Armenian (hy_AM) - [Emmanuelle Traduction](http://www.translatonline.com/)
|
||||
* Bangla (bn_BD) - [SM Mehdi Akram](http://www.shamokaldarpon.com/)
|
||||
* Bosnian (bs) - [Vedran](http://www.seorabbit.com/)
|
||||
* Brazilian Portuguese (pt_BR) - [Leonardo Pinheiro](http://www.eletrikabarbarella.com.br/), [Henrique Vianna](http://henriquevianna.com/), [Caciano Gabriel Batista](http://www.gn10.com.br/), [Gervásio Antônio](http://twitter.com/gervasioantonio)
|
||||
* Bulgarian (bg_BG) - [Iliyan Darganov](http://www.darganov.com/)
|
||||
* Catalan (ca) - [Jordi Sancho](http://www.qasolutions.net/blog), Robert Buj
|
||||
* Chinese, Simplified (zh_CN) - [Soz](http://www.webtoolol.com/), [Keefe Dunn](http://dengkefu.com/)
|
||||
* Chinese, Traditional (zh_TW) - [James Wu](http://jameswublog.com)
|
||||
* Croatian (hr) - [tolingo Translation Services](http://www.tolingo.com)
|
||||
* Czech (cs_CZ) - Korry, [Radovan Fiser](http://algymsa.cz/), [Tomas Vesely](http://www.mcmotylek.cz/)
|
||||
* Danish (da_DK) - [Jens Griebel](http://www.kompas-it.dk/), [Georg S. Adamsen](http://wordpress.blogos.dk/)
|
||||
* Dutch (nl_NL) - [Chris Devriese](http://www.100it.be/), [Martin Hein](http://www.split-a-pixel.nl/), [Rene](http://wpwebshop.com/)
|
||||
* Estonian (et) - [Peeter Rahuvarm](http://www.kraabus.ee), Egon Elbre
|
||||
* Finnish (fi) - [Miika Turunen](http://www.webwork.fi/), [Mediajalostamo](http://www.mediajalostamo.fi/)
|
||||
* French (fr_FR) - [Jillij](http://www.jillij.com/), [Oncle Tom](http://case.oncle-tom.net/), [Maître Mô](http://maitremo.fr/)
|
||||
* Galician (gl_ES) - [Arume Desenvolvementos Informáticos](http://www.arumeinformatica.es/)
|
||||
* Georgian (ka_GE) - [Nodar Rocko Davituri](http://davituri.com/)
|
||||
* German (de_DE) - [Marcel Spitau](http://blog.spitau.de), [Ivan Graf](http://blog.bildergallery.com/)
|
||||
* Greek (el) - [Nick Mouratidis](http://www.kepik.gr/), [Pr. friedlich](http://friedlich.wordpress.com/)
|
||||
* Hebrew (he_IL) - [Yaron Ofer](http://www.gadgetguru.co.il/)
|
||||
* Hindi (hi_IN) - [Tarun Joshi](http://www.readers-cafe.net/), [Ashish](http://outshinesolutions.com/)
|
||||
* Hungarian (hu_HU) - [Andras Hirschler](http://hia.itblog.hu/), [János Csárdi-Braunstein](http://blogocska.org/), [Farkas Győző](http://www.sakraft.hu/)
|
||||
* Indonesian (Bahasa Indonesia; id_ID) - [Hendry Lee](http://blogbuildingu.com/), [Belajar Seo Indonesia](http://dhany.web.id/panduan-seo)
|
||||
* Italian (it_IT) - [Bruno](http://www.brunosalzano.com), [Gianni Diurno](http://gidibao.net/)
|
||||
* Japanese (ja) - [Takayuki Miyoshi](http://ideasilo.wordpress.com)
|
||||
* Korean (ko_KR) - Seong Eun Lee, [Jong-In Kim](http://incommunity.codex.kr/wordpress/)
|
||||
* Latvian (lv) - [Sandis Veinbergs](http://www.kleofass.lv/)
|
||||
* Lithuanian (lt_LT) - [Ernestas Kardzys](http://www.ernestas.info/)
|
||||
* Macedonian (mk_MK) - [Darko](http://www.findermind.com/)
|
||||
* Malay (ms_MY) - [Zairul Azmil](http://www.zairul.com/)
|
||||
* Malayalam (ml_IN) - [RAHUL.S.A](http://www.infution.co.cc/)
|
||||
* Norwegian (nb_NO) - Kjetil M. Bergem, [aanvik.net](http://www.aanvik.net), [Peter Holme](http://holme.se/nettsteder/)
|
||||
* Persian (Farsi; fa_IR) - [Mohammad Musavi](http://www.musavis.com/)
|
||||
* Polish (pl_PL) - [Zbigniew Czernik](http://zibik.jogger.pl/), [Daniel Fruzynski](http://www.poradnik-webmastera.com), [RafalDesign](http://www.rafaldesign.pl/)
|
||||
* Portuguese (pt_PT) - [Hugo Baeta](http://hugobaeta.com)
|
||||
* Russian (ru_RU) - Dmitry Volotovich, [Denis Voituk](http://artprima.cz/)
|
||||
* Romanian (ro_RO) - [Stas Sushkov](http://stas.nerd.ro/), [Anunturi Jibo](http://www.jibo.ro/)
|
||||
* Serbian (sr_RS) - [Vedran](http://www.seorabbit.com/), [Aleksandar Urošević](http://blog.urosevic.net/)
|
||||
* Sinhala (si_LK) - [Nitin Aggarwal](http://offshoreally.com/)
|
||||
* Slovak (sk) - [Patrik Bóna](http://www.mrhead.sk/)
|
||||
* Slovene (sl_SI) - [Mihael Simonič](http://smihael.bplaced.net)
|
||||
* Spanish (es_ES) - [Jordi Sancho](http://www.qasolutions.net/blog), [Vladimir Prieto](http://vladimir.prie.to/), [Federico Mikaelian](http://www.fedemika.com.ar/), [Matias Baldanza](http://matiasbaldanza.com/), [Carlos Agnese](http://albumdecarlitos.com.ar/)
|
||||
* Swedish (sv_SE) - [Fredrik Jonsson](http://www.fredda-o-ac.se/), [the Swedish community](http://wp-support.se/)
|
||||
* Tamil (ta) - [Nitin Aggarwal](http://offshoreally.com/)
|
||||
* Thai (th) - [kazama](http://blog.wordthai.com/)
|
||||
* Turkish (tr_TR) - [Roman Neumuller](http://katpatuka.wordpress.com), [Hasan Yılmaz](http://hedefturkce.com/), [Emin Buğra Saral](http://www.rahmetli.info/)
|
||||
* Ukrainian (uk) - [Andrey Kovba](http://myserver.com.ua/), [Ukrainian WordPress localization team](http://wordpress.co.ua/plugins/contact-form-7.html)
|
||||
* Vietnamese (vi) - Thanh Hải, Hà, [Khang Minh](http://betterwp.net/)
|
||||
|
||||
If you have created your own language pack, or have an update of an existing one, you can send [gettext PO and MO files](http://codex.wordpress.org/Translating_WordPress) to [me](http://ideasilo.wordpress.com/about/) so that I can bundle it into Contact Form 7. You can download the latest [POT file](http://plugins.svn.wordpress.org/contact-form-7/trunk/languages/wpcf7.pot), and [PO files in each language](http://plugins.svn.wordpress.org/contact-form-7/branches/languages/).
|
||||
|
||||
== Installation ==
|
||||
|
||||
1. Upload the entire `contact-form-7` folder to the `/wp-content/plugins/` directory.
|
||||
1. Activate the plugin through the 'Plugins' menu in WordPress.
|
||||
|
||||
You will find 'Contact' menu in your WordPress admin panel.
|
||||
|
||||
For basic usage, you can also have a look at the [plugin homepage](http://contactform7.com/).
|
||||
|
||||
== Frequently Asked Questions ==
|
||||
|
||||
Do you have questions or issues with Contact Form 7? Use these support channels appropriately.
|
||||
|
||||
1. [Docs](http://contactform7.com/docs/)
|
||||
1. [FAQ](http://contactform7.com/faq/)
|
||||
1. [Support Forum](http://wordpress.org/tags/contact-form-7?forum_id=10)
|
||||
1. [WordPress HelpCenter](http://wphelpcenter.com/)
|
||||
|
||||
[Support](http://contactform7.com/support/)
|
||||
|
||||
== Screenshots ==
|
||||
|
||||
1. screenshot-1.png
|
||||
|
||||
== Changelog ==
|
||||
|
||||
= 3.0 =
|
||||
|
||||
* Contact Form 7 3.0 utilizes Custom Post Types feature to save contact forms. It does not create its own table (contact_form_7) anymore.
|
||||
* New shortcode format has been introduced. New format is like this: [contact-form-7 id="1234" title="Contact form 1"]. Note that new one starts with contact-form-7 instead of contact-form.
|
||||
* Contact Form 7 3.0 works with WordPress version 3.2 or higher. This also means that you need PHP version 5.2.4 or higher and MySQL version 5.0 or higher (these are minimum requirements for WordPress 3.2).
|
||||
* Translations for Japanese, German, Georgian, Italian and Spanish have been updated.
|
||||
* Admin panel has been enhanced. Now it uses meta boxes.
|
||||
* Bundled jquery.form.js has been updated to 2.84.
|
||||
BIN
src/wp-content/plugins/contact-form-7/screenshot-1.png
Normal file
BIN
src/wp-content/plugins/contact-form-7/screenshot-1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
198
src/wp-content/plugins/contact-form-7/scripts.js
Normal file
198
src/wp-content/plugins/contact-form-7/scripts.js
Normal file
@ -0,0 +1,198 @@
|
||||
(function($) {
|
||||
|
||||
$(function() {
|
||||
try {
|
||||
if (typeof _wpcf7 == 'undefined' || _wpcf7 === null)
|
||||
_wpcf7 = {};
|
||||
|
||||
_wpcf7 = $.extend({ cached: 0 }, _wpcf7);
|
||||
|
||||
$('div.wpcf7 > form').ajaxForm({
|
||||
beforeSubmit: function(formData, jqForm, options) {
|
||||
jqForm.wpcf7ClearResponseOutput();
|
||||
jqForm.find('img.ajax-loader').css({ visibility: 'visible' });
|
||||
return true;
|
||||
},
|
||||
beforeSerialize: function(jqForm, options) {
|
||||
jqForm.find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
|
||||
$(n).val('');
|
||||
});
|
||||
return true;
|
||||
},
|
||||
data: { '_wpcf7_is_ajax_call': 1 },
|
||||
dataType: 'json',
|
||||
success: function(data) {
|
||||
var ro = $(data.into).find('div.wpcf7-response-output');
|
||||
$(data.into).wpcf7ClearResponseOutput();
|
||||
|
||||
if (data.invalids) {
|
||||
$.each(data.invalids, function(i, n) {
|
||||
$(data.into).find(n.into).wpcf7NotValidTip(n.message);
|
||||
});
|
||||
ro.addClass('wpcf7-validation-errors');
|
||||
}
|
||||
|
||||
if (data.captcha)
|
||||
$(data.into).wpcf7RefillCaptcha(data.captcha);
|
||||
|
||||
if (data.quiz)
|
||||
$(data.into).wpcf7RefillQuiz(data.quiz);
|
||||
|
||||
if (1 == data.spam)
|
||||
ro.addClass('wpcf7-spam-blocked');
|
||||
|
||||
if (1 == data.mailSent) {
|
||||
$(data.into).find('form').resetForm().clearForm();
|
||||
ro.addClass('wpcf7-mail-sent-ok');
|
||||
|
||||
if (data.onSentOk)
|
||||
$.each(data.onSentOk, function(i, n) { eval(n) });
|
||||
} else {
|
||||
ro.addClass('wpcf7-mail-sent-ng');
|
||||
}
|
||||
|
||||
if (data.onSubmit)
|
||||
$.each(data.onSubmit, function(i, n) { eval(n) });
|
||||
|
||||
$(data.into).find('.wpcf7-use-title-as-watermark.watermark').each(function(i, n) {
|
||||
$(n).val($(n).attr('title'));
|
||||
});
|
||||
|
||||
ro.append(data.message).slideDown('fast');
|
||||
}
|
||||
});
|
||||
|
||||
$('div.wpcf7 > form').each(function(i, n) {
|
||||
if (_wpcf7.cached)
|
||||
$(n).wpcf7OnloadRefill();
|
||||
|
||||
$(n).wpcf7ToggleSubmit();
|
||||
|
||||
$(n).find('.wpcf7-acceptance').click(function() {
|
||||
$(n).wpcf7ToggleSubmit();
|
||||
});
|
||||
|
||||
$(n).find('.wpcf7-exclusive-checkbox').each(function(i, n) {
|
||||
$(n).find('input:checkbox').click(function() {
|
||||
$(n).find('input:checkbox').not(this).removeAttr('checked');
|
||||
});
|
||||
});
|
||||
|
||||
$(n).find('.wpcf7-use-title-as-watermark').each(function(i, n) {
|
||||
var input = $(n);
|
||||
input.val(input.attr('title'));
|
||||
input.addClass('watermark');
|
||||
|
||||
input.focus(function() {
|
||||
if ($(this).hasClass('watermark'))
|
||||
$(this).val('').removeClass('watermark');
|
||||
});
|
||||
|
||||
input.blur(function() {
|
||||
if ('' == $(this).val())
|
||||
$(this).val($(this).attr('title')).addClass('watermark');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
|
||||
$.fn.wpcf7ToggleSubmit = function() {
|
||||
return this.each(function() {
|
||||
var form = $(this);
|
||||
if (this.tagName.toLowerCase() != 'form')
|
||||
form = $(this).find('form').first();
|
||||
|
||||
if (form.hasClass('wpcf7-acceptance-as-validation'))
|
||||
return;
|
||||
|
||||
var submit = form.find('input:submit');
|
||||
if (! submit.length) return;
|
||||
|
||||
var acceptances = form.find('input:checkbox.wpcf7-acceptance');
|
||||
if (! acceptances.length) return;
|
||||
|
||||
submit.removeAttr('disabled');
|
||||
acceptances.each(function(i, n) {
|
||||
n = $(n);
|
||||
if (n.hasClass('wpcf7-invert') && n.is(':checked')
|
||||
|| ! n.hasClass('wpcf7-invert') && ! n.is(':checked'))
|
||||
submit.attr('disabled', 'disabled');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.wpcf7NotValidTip = function(message) {
|
||||
return this.each(function() {
|
||||
var into = $(this);
|
||||
into.append('<span class="wpcf7-not-valid-tip">' + message + '</span>');
|
||||
$('span.wpcf7-not-valid-tip').mouseover(function() {
|
||||
$(this).fadeOut('fast');
|
||||
});
|
||||
into.find(':input').mouseover(function() {
|
||||
into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
|
||||
});
|
||||
into.find(':input').focus(function() {
|
||||
into.find('.wpcf7-not-valid-tip').not(':hidden').fadeOut('fast');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.wpcf7OnloadRefill = function() {
|
||||
return this.each(function() {
|
||||
var url = $(this).attr('action');
|
||||
if (0 < url.indexOf('#'))
|
||||
url = url.substr(0, url.indexOf('#'));
|
||||
|
||||
var id = $(this).find('input[name="_wpcf7"]').val();
|
||||
var unitTag = $(this).find('input[name="_wpcf7_unit_tag"]').val();
|
||||
|
||||
$.getJSON(url,
|
||||
{ _wpcf7_is_ajax_call: 1, _wpcf7: id },
|
||||
function(data) {
|
||||
if (data && data.captcha)
|
||||
$('#' + unitTag).wpcf7RefillCaptcha(data.captcha);
|
||||
|
||||
if (data && data.quiz)
|
||||
$('#' + unitTag).wpcf7RefillQuiz(data.quiz);
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.wpcf7RefillCaptcha = function(captcha) {
|
||||
return this.each(function() {
|
||||
var form = $(this);
|
||||
|
||||
$.each(captcha, function(i, n) {
|
||||
form.find(':input[name="' + i + '"]').clearFields();
|
||||
form.find('img.wpcf7-captcha-' + i).attr('src', n);
|
||||
var match = /([0-9]+)\.(png|gif|jpeg)$/.exec(n);
|
||||
form.find('input:hidden[name="_wpcf7_captcha_challenge_' + i + '"]').attr('value', match[1]);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.wpcf7RefillQuiz = function(quiz) {
|
||||
return this.each(function() {
|
||||
var form = $(this);
|
||||
|
||||
$.each(quiz, function(i, n) {
|
||||
form.find(':input[name="' + i + '"]').clearFields();
|
||||
form.find(':input[name="' + i + '"]').siblings('span.wpcf7-quiz-label').text(n[0]);
|
||||
form.find('input:hidden[name="_wpcf7_quiz_answer_' + i + '"]').attr('value', n[1]);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.wpcf7ClearResponseOutput = function() {
|
||||
return this.each(function() {
|
||||
$(this).find('div.wpcf7-response-output').hide().empty().removeClass('wpcf7-mail-sent-ok wpcf7-mail-sent-ng wpcf7-validation-errors wpcf7-spam-blocked');
|
||||
$(this).find('span.wpcf7-not-valid-tip').remove();
|
||||
$(this).find('img.ajax-loader').css({ visibility: 'hidden' });
|
||||
});
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
196
src/wp-content/plugins/contact-form-7/settings.php
Normal file
196
src/wp-content/plugins/contact-form-7/settings.php
Normal file
@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
function wpcf7_plugin_path( $path = '' ) {
|
||||
return path_join( WPCF7_PLUGIN_DIR, trim( $path, '/' ) );
|
||||
}
|
||||
|
||||
function wpcf7_plugin_url( $path = '' ) {
|
||||
return plugins_url( $path, WPCF7_PLUGIN_BASENAME );
|
||||
}
|
||||
|
||||
function wpcf7_admin_url( $query = array() ) {
|
||||
global $plugin_page;
|
||||
|
||||
if ( ! isset( $query['page'] ) )
|
||||
$query['page'] = $plugin_page;
|
||||
|
||||
$path = 'admin.php';
|
||||
|
||||
if ( $query = build_query( $query ) )
|
||||
$path .= '?' . $query;
|
||||
|
||||
$url = admin_url( $path );
|
||||
|
||||
return esc_url_raw( $url );
|
||||
}
|
||||
|
||||
function wpcf7() {
|
||||
global $wpdb, $wpcf7;
|
||||
|
||||
if ( is_object( $wpcf7 ) )
|
||||
return;
|
||||
|
||||
$wpcf7 = (object) array(
|
||||
'processing_within' => '',
|
||||
'widget_count' => 0,
|
||||
'unit_count' => 0,
|
||||
'global_unit_count' => 0 );
|
||||
}
|
||||
|
||||
wpcf7();
|
||||
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/functions.php';
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php';
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php';
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php';
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/classes.php';
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/taggenerator.php';
|
||||
|
||||
if ( is_admin() )
|
||||
require_once WPCF7_PLUGIN_DIR . '/admin/admin.php';
|
||||
else
|
||||
require_once WPCF7_PLUGIN_DIR . '/includes/controller.php';
|
||||
|
||||
add_action( 'plugins_loaded', 'wpcf7_set_request_uri', 9 );
|
||||
|
||||
function wpcf7_set_request_uri() {
|
||||
global $wpcf7_request_uri;
|
||||
|
||||
$wpcf7_request_uri = add_query_arg( array() );
|
||||
}
|
||||
|
||||
function wpcf7_get_request_uri() {
|
||||
global $wpcf7_request_uri;
|
||||
|
||||
return (string) $wpcf7_request_uri;
|
||||
}
|
||||
|
||||
/* Loading modules */
|
||||
|
||||
add_action( 'plugins_loaded', 'wpcf7_load_modules', 1 );
|
||||
|
||||
function wpcf7_load_modules() {
|
||||
$dir = WPCF7_PLUGIN_MODULES_DIR;
|
||||
|
||||
if ( ! ( is_dir( $dir ) && $dh = opendir( $dir ) ) )
|
||||
return false;
|
||||
|
||||
while ( ( $module = readdir( $dh ) ) !== false ) {
|
||||
if ( substr( $module, -4 ) == '.php' )
|
||||
include_once $dir . '/' . $module;
|
||||
}
|
||||
}
|
||||
|
||||
/* L10N */
|
||||
|
||||
add_action( 'init', 'wpcf7_load_plugin_textdomain' );
|
||||
|
||||
function wpcf7_load_plugin_textdomain() {
|
||||
load_plugin_textdomain( 'wpcf7', false, 'contact-form-7/languages' );
|
||||
}
|
||||
|
||||
/* Custom Post Type: Contact Form */
|
||||
|
||||
add_action( 'init', 'wpcf7_register_post_types' );
|
||||
|
||||
function wpcf7_register_post_types() {
|
||||
$args = array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Contact Forms', 'wpcf7' ),
|
||||
'singular_name' => __( 'Contact Form', 'wpcf7' ) )
|
||||
);
|
||||
|
||||
register_post_type( 'wpcf7_contact_form', $args );
|
||||
}
|
||||
|
||||
/* Upgrading */
|
||||
|
||||
add_action( 'init', 'wpcf7_upgrade' );
|
||||
|
||||
function wpcf7_upgrade() {
|
||||
$opt = get_option( 'wpcf7' );
|
||||
|
||||
if ( ! is_array( $opt ) )
|
||||
$opt = array();
|
||||
|
||||
$old_ver = isset( $opt['version'] ) ? (string) $opt['version'] : '0';
|
||||
$new_ver = WPCF7_VERSION;
|
||||
|
||||
if ( $old_ver == $new_ver )
|
||||
return;
|
||||
|
||||
do_action( 'wpcf7_upgrade', $new_ver, $old_ver );
|
||||
|
||||
$opt['version'] = $new_ver;
|
||||
|
||||
update_option( 'wpcf7', $opt );
|
||||
|
||||
if ( is_admin() && isset( $_GET['page'] ) && 'wpcf7' == $_GET['page'] ) {
|
||||
wp_redirect( wpcf7_admin_url( array( 'page' => 'wpcf7' ) ) );
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'wpcf7_upgrade', 'wpcf7_convert_to_cpt', 10, 2 );
|
||||
|
||||
function wpcf7_convert_to_cpt( $new_ver, $old_ver ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( ! version_compare( $old_ver, '3.0-dev', '<' ) )
|
||||
return;
|
||||
|
||||
$table_name = $wpdb->prefix . "contact_form_7";
|
||||
|
||||
if ( ! $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) )
|
||||
return;
|
||||
|
||||
$old_rows = $wpdb->get_results( "SELECT * FROM $table_name" );
|
||||
|
||||
foreach ( $old_rows as $row ) {
|
||||
$q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'"
|
||||
. $wpdb->prepare( " AND meta_value = %d", $row->cf7_unit_id );
|
||||
|
||||
if ( $wpdb->get_var( $q ) )
|
||||
continue;
|
||||
|
||||
$postarr = array(
|
||||
'post_type' => 'wpcf7_contact_form',
|
||||
'post_status' => 'publish',
|
||||
'post_title' => maybe_unserialize( $row->title ) );
|
||||
|
||||
$post_id = wp_insert_post( $postarr );
|
||||
|
||||
if ( $post_id ) {
|
||||
update_post_meta( $post_id, '_old_cf7_unit_id', $row->cf7_unit_id );
|
||||
update_post_meta( $post_id, 'form', maybe_unserialize( $row->form ) );
|
||||
update_post_meta( $post_id, 'mail', maybe_unserialize( $row->mail ) );
|
||||
update_post_meta( $post_id, 'mail_2', maybe_unserialize( $row->mail_2 ) );
|
||||
update_post_meta( $post_id, 'messages', maybe_unserialize( $row->messages ) );
|
||||
update_post_meta( $post_id, 'additional_settings',
|
||||
maybe_unserialize( $row->additional_settings ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Install and default settings */
|
||||
|
||||
add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install' );
|
||||
|
||||
function wpcf7_install() {
|
||||
if ( $opt = get_option( 'wpcf7' ) )
|
||||
return;
|
||||
|
||||
wpcf7_load_plugin_textdomain();
|
||||
wpcf7_register_post_types();
|
||||
wpcf7_upgrade();
|
||||
|
||||
if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) )
|
||||
return;
|
||||
|
||||
$contact_form = wpcf7_get_contact_form_default_pack(
|
||||
array( 'title' => sprintf( __( 'Contact form %d', 'wpcf7' ), 1 ) ) );
|
||||
|
||||
$contact_form->save();
|
||||
}
|
||||
|
||||
?>
|
||||
12
src/wp-content/plugins/contact-form-7/styles-rtl.css
Normal file
12
src/wp-content/plugins/contact-form-7/styles-rtl.css
Normal 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;
|
||||
}
|
||||
65
src/wp-content/plugins/contact-form-7/styles.css
Normal file
65
src/wp-content/plugins/contact-form-7/styles.css
Normal 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;
|
||||
}
|
||||
26
src/wp-content/plugins/contact-form-7/uninstall.php
Normal file
26
src/wp-content/plugins/contact-form-7/uninstall.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) )
|
||||
exit();
|
||||
|
||||
function wpcf7_delete_plugin() {
|
||||
global $wpdb;
|
||||
|
||||
delete_option( 'wpcf7' );
|
||||
|
||||
$posts = get_posts( array(
|
||||
'numberposts' => -1,
|
||||
'post_type' => 'wpcf7_contact_form',
|
||||
'post_status' => 'any' ) );
|
||||
|
||||
foreach ( $posts as $post )
|
||||
wp_delete_post( $post->ID, true );
|
||||
|
||||
$table_name = $wpdb->prefix . "contact_form_7";
|
||||
|
||||
$wpdb->query( "DROP TABLE IF EXISTS $table_name" );
|
||||
}
|
||||
|
||||
wpcf7_delete_plugin();
|
||||
|
||||
?>
|
||||
71
src/wp-content/plugins/contact-form-7/wp-contact-form-7.php
Normal file
71
src/wp-content/plugins/contact-form-7/wp-contact-form-7.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/*
|
||||
Plugin Name: Contact Form 7
|
||||
Plugin URI: http://contactform7.com/
|
||||
Description: Just another contact form plugin. Simple but flexible.
|
||||
Author: Takayuki Miyoshi
|
||||
Author URI: http://ideasilo.wordpress.com/
|
||||
Text Domain: wpcf7
|
||||
Domain Path: /languages/
|
||||
Version: 3.0
|
||||
*/
|
||||
|
||||
/* Copyright 2007-2011 Takayuki Miyoshi (email: takayukister at gmail.com)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
define( 'WPCF7_VERSION', '3.0' );
|
||||
|
||||
if ( ! defined( 'WPCF7_PLUGIN_BASENAME' ) )
|
||||
define( 'WPCF7_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
|
||||
|
||||
if ( ! defined( 'WPCF7_PLUGIN_NAME' ) )
|
||||
define( 'WPCF7_PLUGIN_NAME', trim( dirname( WPCF7_PLUGIN_BASENAME ), '/' ) );
|
||||
|
||||
if ( ! defined( 'WPCF7_PLUGIN_DIR' ) )
|
||||
define( 'WPCF7_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . WPCF7_PLUGIN_NAME );
|
||||
|
||||
if ( ! defined( 'WPCF7_PLUGIN_URL' ) )
|
||||
define( 'WPCF7_PLUGIN_URL', WP_PLUGIN_URL . '/' . WPCF7_PLUGIN_NAME );
|
||||
|
||||
if ( ! defined( 'WPCF7_PLUGIN_MODULES_DIR' ) )
|
||||
define( 'WPCF7_PLUGIN_MODULES_DIR', WPCF7_PLUGIN_DIR . '/modules' );
|
||||
|
||||
if ( ! defined( 'WPCF7_LOAD_JS' ) )
|
||||
define( 'WPCF7_LOAD_JS', true );
|
||||
|
||||
if ( ! defined( 'WPCF7_LOAD_CSS' ) )
|
||||
define( 'WPCF7_LOAD_CSS', true );
|
||||
|
||||
if ( ! defined( 'WPCF7_AUTOP' ) )
|
||||
define( 'WPCF7_AUTOP', true );
|
||||
|
||||
if ( ! defined( 'WPCF7_USE_PIPE' ) )
|
||||
define( 'WPCF7_USE_PIPE', true );
|
||||
|
||||
/* If you or your client hate to see about donation, set this value false. */
|
||||
if ( ! defined( 'WPCF7_SHOW_DONATION_LINK' ) )
|
||||
define( 'WPCF7_SHOW_DONATION_LINK', true );
|
||||
|
||||
if ( ! defined( 'WPCF7_ADMIN_READ_CAPABILITY' ) )
|
||||
define( 'WPCF7_ADMIN_READ_CAPABILITY', 'edit_posts' );
|
||||
|
||||
if ( ! defined( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY' ) )
|
||||
define( 'WPCF7_ADMIN_READ_WRITE_CAPABILITY', 'publish_pages' );
|
||||
|
||||
require_once WPCF7_PLUGIN_DIR . '/settings.php';
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user