2 defined( 'ABSPATH' ) ||
die( 'No script kiddies please!' );
3 // usage: $id, $title, $callback, $page
4 add_settings_section( 'dnxcf_mailfrom_options', __( 'Sender email address', 'dnxcf' ), 'dnxcf_settings_mailfrom_section_text', 'dnxcf_options_sections' );
5 add_settings_section( 'dnxcf_email_address', __( 'Recipient email address', 'dnxcf' ), 'dnxcf_settings_email_address_section_text', 'dnxcf_options_sections' );
6 add_settings_section( 'dnxcf_content_type', __( 'Content type', 'dnxcf' ), 'dnxcf_settings_content_type_section_text', 'dnxcf_options_sections' );
7 add_settings_section( 'dnxcf_subject_options', __( 'Subject', 'dnxcf' ), 'dnxcf_settings_subject_section_text', 'dnxcf_options_sections' );
8 add_settings_section( 'dnxcf_privacy_policy', __( 'Privacy policy', 'dnxcf' ), 'dnxcf_settings_privacy_section_text', 'dnxcf_options_sections' );
10 // usage: $id, $title, $callback, $page, $section, $args
11 add_settings_field( 'dnxcf_setting_content_type_display', __( 'content type?', 'dnxcf' ), 'dnxcf_setting_content_type_display', 'dnxcf_options_sections', 'dnxcf_content_type' );
12 add_settings_field( 'dnxcf_setting_email_name_display', __( 'name?', 'dnxcf' ), 'dnxcf_setting_email_name_display', 'dnxcf_options_sections', 'dnxcf_email_address' );
13 add_settings_field( 'dnxcf_setting_email_address_display', __( 'email address?', 'dnxcf' ), 'dnxcf_setting_email_address_display', 'dnxcf_options_sections', 'dnxcf_email_address' );
14 add_settings_field( 'dnxcf_setting_subject_display', __( 'subject options?', 'dnxcf' ), 'dnxcf_setting_subject_display', 'dnxcf_options_sections', 'dnxcf_subject_options' );
15 add_settings_field( 'dnxcf_setting_mailfrom_name_display', __( 'name?', 'dnxcf' ), 'dnxcf_setting_mailfrom_name_display', 'dnxcf_options_sections', 'dnxcf_mailfrom_options' );
16 add_settings_field( 'dnxcf_setting_mailfrom_mail_display', __( 'email address?', 'dnxcf' ), 'dnxcf_setting_mailfrom_mail_display', 'dnxcf_options_sections', 'dnxcf_mailfrom_options' );
17 add_settings_field( 'dnxcf_setting_privacy_display', __( 'policy text?', 'dnxcf' ), 'dnxcf_setting_privacy_display', 'dnxcf_options_sections', 'dnxcf_privacy_policy' );
19 function dnxcf_settings_content_type_section_text() { ?
>
20 <p
><?php
esc_html_e( 'Here you can change the content type of your emails, either html or plain text.', 'dnxcf' ); ?
></p
>
24 function dnxcf_settings_email_address_section_text() {
26 <p
><?php
esc_html_e( 'This is the email address where you will receive all email from the contact form.', 'dnxcf' ); ?
></p
>
30 function dnxcf_settings_subject_section_text() {
32 <p
><?php
esc_html_e( 'These are the options that you are giving as a dropdown list to your users.', 'dnxcf' ); ?
></p
>
36 function dnxcf_settings_mailfrom_section_text() {
39 <?php
esc_html_e( 'Here you can set the sender email address for the contact form.', 'dnxcf' ); ?
><br
/>
41 global $dnxcf_options;
42 $dnxcf_options = get_option( 'dnxcf_options' );
43 // translators: %1$s = from name inside email; $2$s = from email address
45 __( 'The emails you will receive will be from: <code>%1$s < %2$s ></code>', 'dnxcf' ),
46 $dnxcf_options['dnxcf_from_name'],
47 $dnxcf_options['dnxcf_from_email']
51 <?php
esc_html_e( 'so just make sure you whitelist this address in your mail client to avoid losing important messages.', 'dnxcf' ); ?
>
56 function dnxcf_settings_privacy_section_text() {
58 <p
><?php
esc_html_e( 'Enter here the content of your privacy policy relative to the contact form.', 'dnxcf' ); ?
></p
>
62 // Content type for email sent via this form
63 function dnxcf_setting_content_type_display() {
64 $dnxcf_options = get_option( 'dnxcf_options' );
68 <input type
="radio" name
="dnxcf_options[dnxcf_content_type]" <?php
checked( $dnxcf_options['dnxcf_content_type'], '1' ); ?
> value
='1' /> <?php
esc_html_e( 'text/plain', 'dnxcf' ); ?
><br
/>
69 <input type
="radio" name
="dnxcf_options[dnxcf_content_type]" <?php
checked( $dnxcf_options['dnxcf_content_type'], '2' ); ?
> value
='2' /> <?php
esc_html_e( 'text/html', 'dnxcf' ); ?
><br
/>
70 <span
class="description"><?php
esc_html_e( 'Send plain (text) or rich (html) messages.', 'dnxcf' ); ?
></span
>
74 // Receiving email name
75 function dnxcf_setting_email_name_display() {
76 $dnxcf_options = get_option( 'dnxcf_options' );
78 <input type
="text" name
="dnxcf_options[dnxcf_recv_name]" value
="<?php echo $dnxcf_options['dnxcf_recv_name']; ?>" /><br
/>
79 <span
class="description"><?php
esc_html_e( 'This is how you will be called in every email you will receive from this contact form.', 'dnxcf' ); ?
></span
>
83 // Receiving email address
84 function dnxcf_setting_email_address_display() {
85 $dnxcf_options = get_option( 'dnxcf_options' );
87 <input type
="email" name
="dnxcf_options[dnxcf_recv_email]" value
="<?php echo $dnxcf_options['dnxcf_recv_email']; ?>" /><br
/>
88 <span
class="description"><?php
esc_html_e( 'If you leave this field empty the admin email address will be used.', 'dnxcf' ); ?
></span
>
92 // Custom subject options
93 function dnxcf_setting_subject_display() {
94 $dnxcf_options = get_option( 'dnxcf_options' );
96 <textarea name
="dnxcf_options[dnxcf_subject]" rows
="10" cols
="80" /><?php
echo implode( "\n", $dnxcf_options['dnxcf_subject'] ); ?
></textarea
><br
/>
97 <span
class="description"><?php
esc_html_e( 'Insert one option per line. If you leave this area empty the default options will be used.', 'dnxcf' ); ?
></span
>
101 // Sender email address
102 function dnxcf_setting_mailfrom_mail_display() {
103 $dnxcf_options = get_option( 'dnxcf_options' );
105 <input type
="email" name
="dnxcf_options[dnxcf_from_email]" value
="<?php echo $dnxcf_options['dnxcf_from_email']; ?>" /><br
/>
106 <span
class="description"><?php
esc_html_e( 'This is the email address from which you will receive communications.', 'dnxcf' ); ?
></span
>
111 function dnxcf_setting_mailfrom_name_display() {
112 $dnxcf_options = get_option( 'dnxcf_options' );
114 <input type
="text" name
="dnxcf_options[dnxcf_from_name]" value
="<?php echo $dnxcf_options['dnxcf_from_name']; ?>" /><br
/>
115 <span
class="description"><?php
esc_html_e( 'This is the name associated to the above email address.', 'dnxcf' ); ?
></span
>
120 function dnxcf_setting_privacy_display() {
121 $dnxcf_options = get_option( 'dnxcf_options' );
123 <textarea name
="dnxcf_options[dnxcf_privacy]" rows
="10" cols
="80" /><?php
echo wptexturize( $dnxcf_options['dnxcf_privacy'] ); ?
></textarea
><br
/>
124 <span
class="description"><?php
esc_html_e( 'The text of the privacy policy, Leave empty to disable the policy area in the form.', 'dnxcf' ); ?
></span
>