_x( 'Contact form', 'widget contact form', LANGUAGE_ZONE ) ); /* Create the widget. */ parent::__construct( 'dt-contact-widget', DT_WIDGET_PREFIX . _x( 'Contact', 'widget contact form', LANGUAGE_ZONE ), $widget_ops ); } /* Display the widget */ function widget( $args, $instance ) { static $widget_counter = 1; extract( $args ); /* Our variables from the widget settings. */ $title = apply_filters( 'widget_title', $instance['title'] ); $en_captcha = isset( $instance['enable_captcha'] ) ? $instance['enable_captcha'] : true; $captcha_id = 'widget_' . $widget_counter++; echo $before_widget ; // start echo $before_title . $title . $after_title; if( isset($instance['text']) && $instance['text'] ) echo force_balance_tags('
' . $instance['text'] . '
'); ?> '', 'title' => '', 'enable_captcha' => true ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>
/>
' . "\r\n"; $headers .= 'Reply-To: ' . esc_html( $email ) . "\r\n"; $msg_mail = _x( 'Name: ', 'feedback mail', LANGUAGE_ZONE ) . esc_html( $name ) . "\n"; $msg_mail .= _x( 'Email: ', 'feedback mail', LANGUAGE_ZONE ) . esc_html( $email ) . "\n"; if ( ! empty( $phone ) ) { $msg_mail .= _x( 'Telephone: ', 'feedback mail', LANGUAGE_ZONE ) . esc_html( $phone ) . "\n"; } if ( ! empty( $website ) ) { $msg_mail .= _x( 'Website: ', 'feedback mail', LANGUAGE_ZONE ) . esc_html( $website ) . "\n"; } $msg_mail .= _x( 'Message: ', 'feedback mail', LANGUAGE_ZONE ) . esc_html( $msg ) . "\n"; $send = wp_mail( $em, '[Feedback from: ' . esc_attr( get_option( 'blogname' ) ) . ']', $msg_mail, $headers ); if ( $send ) { $errors = _x( 'Feedback has been sent to the administrator', 'feedback msg', LANGUAGE_ZONE ); } else { $errors = _x( 'The message has not been sent', 'feedback msg', LANGUAGE_ZONE ); } $nonce = wp_create_nonce( 'dt_contact_' . $place ); } elseif( $honey_msg ) { $errors = _x( 'Sorry, we suspect that you are bot', 'feedback', LANGUAGE_ZONE ); } $captcha = ''; if ( Dt_Captcha::$global_enable ) { $c_form = new Dt_Captcha( array( 'whoami' => $place, 'rewrite' => false ) ); $captcha = $c_form->get_captcha(); } //wp_nonce_field('dt_contact_'.$place,'dt_contact_form_nonce', false, false); $response = json_encode( array( 'success' => $send , 'errors' => $errors, 'captcha' => $captcha, 'nonce' => $nonce ) ); // response output header( "Content-Type: application/json" ); echo $response; // IMPORTANT: don't forget to "exit" exit; } add_action( 'wp_ajax_nopriv_dt_check_current_date', 'dt_check_current_date' ); add_action( 'wp_ajax_dt_check_current_date', 'dt_check_current_date' );