Removed Genericons. Added dnxcf-font which is a subset of fontawesome.
[danixland-contact-form.git] / include / dnxcf_options-display.php
1 <?php
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' );
9
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' );
18
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>
21 <?php
22 }
23
24 function dnxcf_settings_email_address_section_text() {
25 ?>
26 <p><?php esc_html_e( 'This is the email address where you will receive all email from the contact form.', 'dnxcf' ); ?></p>
27 <?php
28 }
29
30 function dnxcf_settings_subject_section_text() {
31 ?>
32 <p><?php esc_html_e( 'These are the options that you are giving as a dropdown list to your users.', 'dnxcf' ); ?></p>
33 <?php
34 }
35
36 function dnxcf_settings_mailfrom_section_text() {
37 ?>
38 <p>
39 <?php esc_html_e( 'Here you can set the sender email address for the contact form.', 'dnxcf' ); ?><br />
40 <?php
41 global $dnxcf_options;
42 $dnxcf_options = get_option( 'dnxcf_options' );
43 // translators: %1$s = from name inside email; $2$s = from email address
44 echo sprintf(
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']
48 );
49 ?>
50 <br />
51 <?php esc_html_e( 'so just make sure you whitelist this address in your mail client to avoid losing important messages.', 'dnxcf' ); ?>
52 </p>
53 <?php
54 }
55
56 function dnxcf_settings_privacy_section_text() {
57 ?>
58 <p><?php esc_html_e( 'Enter here the content of your privacy policy relative to the contact form.', 'dnxcf' ); ?></p>
59 <?php
60 }
61
62 // Content type for email sent via this form
63 function dnxcf_setting_content_type_display() {
64 $dnxcf_options = get_option( 'dnxcf_options' );
65 // 1 = text/plain
66 // 2 = text/html
67 ?>
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>
71 <?php
72 }
73
74 // Receiving email name
75 function dnxcf_setting_email_name_display() {
76 $dnxcf_options = get_option( 'dnxcf_options' );
77 ?>
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>
80 <?php
81 }
82
83 // Receiving email address
84 function dnxcf_setting_email_address_display() {
85 $dnxcf_options = get_option( 'dnxcf_options' );
86 ?>
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>
89 <?php
90 }
91
92 // Custom subject options
93 function dnxcf_setting_subject_display() {
94 $dnxcf_options = get_option( 'dnxcf_options' );
95 ?>
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>
98 <?php
99 }
100
101 // Sender email address
102 function dnxcf_setting_mailfrom_mail_display() {
103 $dnxcf_options = get_option( 'dnxcf_options' );
104 ?>
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>
107 <?php
108 }
109
110 // Sender name
111 function dnxcf_setting_mailfrom_name_display() {
112 $dnxcf_options = get_option( 'dnxcf_options' );
113 ?>
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>
116 <?php
117 }
118
119 // Privacy Policy
120 function dnxcf_setting_privacy_display() {
121 $dnxcf_options = get_option( 'dnxcf_options' );
122 ?>
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>
125 <?php
126 }