git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_Web/trunk@14 7e4b4a24-fdbc-5948-a674-f6f81f2ee942
This commit is contained in:
David Arranz 2011-12-14 17:45:24 +00:00
parent e379e26cba
commit ee3fc7938d
21 changed files with 223 additions and 0 deletions

View File

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

View File

@ -0,0 +1,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;
}
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB