X-Git-Url: https://git.danix.xyz/?p=danixland-contact-form.git;a=blobdiff_plain;f=danixland-contact-form.php;h=e5348d308722a3c5dee0c0e54193352802f54390;hp=7d5c8bd7380ec127274057154c4d33aec06cff9b;hb=HEAD;hpb=8c3e9b00bbeb0a3493d5b0e9b6cc4c68d413a4b0 diff --git a/danixland-contact-form.php b/danixland-contact-form.php index 7d5c8bd..e5348d3 100644 --- a/danixland-contact-form.php +++ b/danixland-contact-form.php @@ -1,11 +1,11 @@ -
-
-

$sitename

-
-

$sitemsg

-

$visitus

-
- -DNX6655788EOT; - ?> - - - - - $dnxcf_options['dnxcf_recv_name'], - 'site' => get_bloginfo( 'name' ), - 'time' => $dnxcf_ltd, - 'host' => $dnxcf_hst, - 'ua' => $dnxcf_ua, - ); - $dnxcf_message = dnxcf_email_content( $dnxcf_email_data, $dnxcf_posted ); - } else { // content_type is set to text/plain - $dnxcf_message = sprintf( - __( "Hello \"%1\$s\",\nyou are being contacted by %2\$s on %3\$s.\n%4\$s has provided the following informations:\n\tEmail:\t\t%5\$s\n\tWebsite:\t%6\$s\n\tMessage:\n\n%7\$s", 'dnxcf' ), - $dnxcf_options['dnxcf_recv_name'], - $dnxcf_posted['dnxcf_name'], - get_bloginfo( 'name' ), - $dnxcf_posted['dnxcf_name'], - $dnxcf_posted['dnxcf_email'], - $dnxcf_posted['dnxcf_website'], - $dnxcf_posted['dnxcf_message'] - ); - $dnxcf_message .= "\n\n##-----------#-----------#-----------##\n\n"; - $dnxcf_message .= sprintf( - __( "We have also collected the following informations:\n\tBrowser:\t%1\$s\n\tTime:\t\t%2\$s\n\tIP Address:\t%3\$s\n", 'dnxcf' ), - $dnxcf_ua, - $dnxcf_ltd, - $dnxcf_hst - ); - } // end check for mail_content_type - $dnxcf_mailed = wp_mail( $dnxcf_to, $dnxcf_subject, $dnxcf_message, $dnxcf_headers ); - if ( $dnxcf_mailed ) { - ?> -

-

-

-
-
-
-
-
-
-
-
-
-

-

-

-

-
-
-
-
-
-

- -

administrator.', 'dnxcf' ), get_bloginfo( 'admin_email' ) ); ?>

- + $dnxcf_posted = array(); + // let's gather some data about the user submitting the form + $dnxcf_ltd = trim( strip_tags( stripslashes( current_time( 'mysql' ) ) ) ); + $dnxcf_hst = trim( strip_tags( stripslashes( getenv( 'REMOTE_ADDR' ) ) ) ); + $dnxcf_ua = trim( strip_tags( stripslashes( $_SERVER['HTTP_USER_AGENT'] ) ) ); + // our posted options, arranged in one nice array + $dnxcf_posted['dnxcf_name'] = sanitize_text_field( $_POST['dnxcf_name'] ); + $dnxcf_posted['dnxcf_email'] = sanitize_email( $_POST['dnxcf_email'] ); + $dnxcf_posted['dnxcf_website'] = esc_url( $_POST['dnxcf_website'] ); + $dnxcf_posted['dnxcf_subject'] = sanitize_text_field( $_POST['dnxcf_subject'] ); + $dnxcf_posted['dnxcf_message'] = wp_kses( $_POST['dnxcf_message'], $valid_html ); + // let's begin with our email data, like receiver email, subject ecc. + $dnxcf_to = $dnxcf_options['dnxcf_recv_email']; + $dnxcf_headers = 'Reply-To: ' . $dnxcf_posted['dnxcf_email']; + $dnxcf_subject = __( 'Contact from "', 'dnxcf' ) . get_bloginfo( 'name' ) . '" - ' . $dnxcf_posted['dnxcf_subject']; - $dnxcf_options['dnxcf_recv_name'], + 'site' => get_bloginfo( 'name' ), + 'time' => $dnxcf_ltd, + 'host' => $dnxcf_hst, + 'ua' => $dnxcf_ua, + ); + $dnxcf_message = dnxcf_email_content( $dnxcf_email_data, $dnxcf_posted ); + } else { // content_type is set to text/plain + $dnxcf_message = sprintf( + __( "Hello \"%1\$s\",\nyou are being contacted by %2\$s on %3\$s.\n%4\$s has provided the following informations:\n\tEmail:\t\t%5\$s\n\tWebsite:\t%6\$s\n\tMessage:\n\n%7\$s", 'dnxcf' ), + $dnxcf_options['dnxcf_recv_name'], + $dnxcf_posted['dnxcf_name'], + get_bloginfo( 'name' ), + $dnxcf_posted['dnxcf_name'], + $dnxcf_posted['dnxcf_email'], + $dnxcf_posted['dnxcf_website'], + $dnxcf_posted['dnxcf_message'] + ); + $dnxcf_message .= "\n\n##-----------#-----------#-----------##\n\n"; + $dnxcf_message .= sprintf( + __( "We have also collected the following informations:\n\tBrowser:\t%1\$s\n\tTime:\t\t%2\$s\n\tIP Address:\t%3\$s\n", 'dnxcf' ), + $dnxcf_ua, + $dnxcf_ltd, + $dnxcf_hst + ); + } // end check for mail_content_type + + $dnxcf_mailed = wp_mail( $dnxcf_to, $dnxcf_subject, $dnxcf_message, $dnxcf_headers ); + + if ( $dnxcf_mailed ) { + ?> +

+

+

+
+
+
+
+
+
+
+
+
+

+

+

+

+
+
+
+
+
+

+ +

administrator.', 'dnxcf' ), get_bloginfo( 'admin_email' ) ); ?>

+ +

+ @@ -243,41 +198,39 @@ function dnxcf_display_form() { $dnxcf_options = get_option( 'dnxcf_options' ); ?> -
- -

-
- + +

*

-
+
-
+

-
+
-
+

-

- +

+

-

- +

-

- +

+

-
-
+

+ + +

+ +

-

- +

+

-

- +

+

-
-
+ +
-
-
+ +