class-evf-builder-fields.php
2 years ago
class-evf-builder-page.php
2 years ago
class-evf-builder-settings.php
2 years ago
class-evf-builder-settings.php
897 lines
| 1 | <?php |
| 2 | /** |
| 3 | * EverestForms Builder Settings |
| 4 | * |
| 5 | * @package EverestForms\Admin |
| 6 | * @since 1.2.0 |
| 7 | */ |
| 8 | |
| 9 | defined( 'ABSPATH' ) || exit; |
| 10 | |
| 11 | if ( class_exists( 'EVF_Builder_Settings', false ) ) { |
| 12 | return new EVF_Builder_Settings(); |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * EVF_Builder_Settings class. |
| 17 | */ |
| 18 | class EVF_Builder_Settings extends EVF_Builder_Page { |
| 19 | |
| 20 | /** |
| 21 | * Constructor. |
| 22 | */ |
| 23 | public function __construct() { |
| 24 | $this->id = 'settings'; |
| 25 | $this->label = esc_html__( 'Settings', 'everest-forms' ); |
| 26 | $this->sidebar = true; |
| 27 | |
| 28 | add_action( 'everest_forms_settings_connections_email', array( $this, 'output_connections_list' ) ); |
| 29 | |
| 30 | add_filter( 'everest_forms_builder_settings_section', array( $this, 'add_custom_css_js_section' ), 11, 2 ); |
| 31 | add_action( 'everest_forms_settings_panel_content', array( $this, 'add_custom_css_js_settings' ), 111, 1 ); |
| 32 | |
| 33 | parent::__construct(); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * Outputs the builder sidebar. |
| 38 | */ |
| 39 | public function output_sidebar() { |
| 40 | $sections = apply_filters( |
| 41 | 'everest_forms_builder_settings_section', |
| 42 | array( |
| 43 | 'general' => esc_html__( 'General', 'everest-forms' ), |
| 44 | 'email' => esc_html__( 'Email', 'everest-forms' ), |
| 45 | 'confirmation' => esc_html__( 'Confirmations', 'everest-forms' ), |
| 46 | 'security' => esc_html__( 'Anti-Spam and Security', 'everest-forms' ), |
| 47 | ), |
| 48 | $this->form_data |
| 49 | ); |
| 50 | |
| 51 | if ( ! empty( $sections ) ) { |
| 52 | foreach ( $sections as $slug => $section ) { |
| 53 | $this->add_sidebar_tab( $section, $slug ); |
| 54 | do_action( 'everest_forms_settings_connections_' . $slug, $section ); |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Get form data |
| 61 | * |
| 62 | * @return array form data. |
| 63 | */ |
| 64 | private function form_data() { |
| 65 | $form_data = array(); |
| 66 | |
| 67 | if ( ! empty( $_GET['form_id'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification |
| 68 | $form_data = evf()->form->get( absint( $_GET['form_id'] ), array( 'content_only' => true ) ); // phpcs:ignore WordPress.Security.NonceVerification |
| 69 | } |
| 70 | |
| 71 | return $form_data; |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Outputs the connection lists on sidebar. |
| 76 | */ |
| 77 | public function output_connections_list() { |
| 78 | $form_data = $this->form_data(); |
| 79 | $email = isset( $form_data['settings']['email'] ) ? $form_data['settings']['email'] : array(); |
| 80 | |
| 81 | if ( empty( $email ) ) { |
| 82 | $email['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) ); |
| 83 | } |
| 84 | |
| 85 | ?> |
| 86 | <div class="everest-forms-active-email"> |
| 87 | <button class="everest-forms-btn everest-forms-btn-primary everest-forms-email-add" data-form_id="<?php echo isset( $_GET['form_id'] ) ? absint( sanitize_text_field( wp_unslash( $_GET['form_id'] ) ) ) : 0; // phpcs:ignore WordPress.Security.NonceVerification ?>" data-source="email" data-type="<?php echo esc_attr( 'connection' ); ?>"> |
| 88 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> |
| 89 | <path d="M12 21.95c-.6 0-1-.4-1-1v-8H3.1c-.6 0-1-.4-1-1s.4-1 1-1H11v-7.9c0-.6.4-1 1-1s1 .4 1 1v7.9h7.9c.6 0 1 .4 1 1s-.4 1-1 1H13v8c0 .6-.4 1-1 1Z"/> |
| 90 | </svg> |
| 91 | <?php printf( esc_html__( 'Add New Email', 'everest-forms' ) ); ?> |
| 92 | </button> |
| 93 | <ul class="everest-forms-active-email-connections-list"> |
| 94 | <?php if ( ! empty( $email ) ) { ?> |
| 95 | <h4><?php echo esc_html__( 'Email Notifications', 'everest-forms' ); ?> </h4> |
| 96 | <?php |
| 97 | } |
| 98 | if ( ! empty( $email ) ) { |
| 99 | foreach ( $email as $connection_id => $connection_data ) { |
| 100 | if ( preg_match( '/connection_/', $connection_id ) ) { |
| 101 | $connection_name = ! empty( $connection_data['connection_name'] ) ? $connection_data['connection_name'] : ''; |
| 102 | if ( 'connection_1' !== $connection_id ) { |
| 103 | $remove_class = 'everest-forms-email-remove'; |
| 104 | $duplicate_class = 'everest-forms-duplicate-email'; |
| 105 | $preview_class = 'everest-forms-email-preview'; |
| 106 | } else { |
| 107 | $remove_class = 'everest-forms-email-default-remove'; |
| 108 | $duplicate_class = 'everest-forms-email-default-duplicate'; |
| 109 | $preview_class = 'everest-forms-email-preview'; |
| 110 | } |
| 111 | if ( isset( $email['enable_email_notification'] ) && '0' === $email['enable_email_notification'] ) { |
| 112 | $email_status = isset( $email['enable_email_notification'] ) ? $email['enable_email_notification'] : '1'; |
| 113 | } else { |
| 114 | $email_status = isset( $email[ $connection_id ]['enable_email_notification'] ) ? $email[ $connection_id ]['enable_email_notification'] : '1'; |
| 115 | } |
| 116 | ?> |
| 117 | <li class="connection-list" data-connection-id="<?php echo esc_attr( $connection_id ); ?>"> |
| 118 | <a class="user-nickname" href="#"><?php echo esc_html( $connection_name ); ?></a> |
| 119 | <div class="evf-email-side-section"> |
| 120 | <div class="evf-toggle-section"> |
| 121 | <span class="everest-forms-toggle-form"> |
| 122 | <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat"> |
| 123 | <input type="checkbox" class="evf-email-toggle" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="1" data-connection-id="<?php echo esc_attr( $connection_id ); ?>" <?php echo checked( '1', $email_status, false ); ?> > |
| 124 | <span class="slider round"></span> |
| 125 | </span> |
| 126 | </div> |
| 127 | <span class="evf-vertical-divider"></span> |
| 128 | <a href="#"> |
| 129 | <span class="<?php echo esc_attr( $remove_class ); ?>"> |
| 130 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> |
| 131 | <path fill-rule="evenodd" d="M9.293 3.293A1 1 0 0 1 10 3h4a1 1 0 0 1 1 1v1H9V4a1 1 0 0 1 .293-.707ZM7 5V4a3 3 0 0 1 3-3h4a3 3 0 0 1 3 3v1h4a1 1 0 1 1 0 2h-1v13a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V7H3a1 1 0 1 1 0-2h4Zm1 2h10v13a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V7h2Zm2 3a1 1 0 0 1 1 1v6a1 1 0 1 1-2 0v-6a1 1 0 0 1 1-1Zm5 7v-6a1 1 0 1 0-2 0v6a1 1 0 1 0 2 0Z" clip-rule="evenodd"/> |
| 132 | </svg> |
| 133 | </a> |
| 134 | <span class="evf-vertical-divider"></span> |
| 135 | <?php |
| 136 | $preview_url = esc_url( |
| 137 | add_query_arg( |
| 138 | array( |
| 139 | 'evf_email_preview' => $connection_id, |
| 140 | 'form_id' => isset( $_GET['form_id'] ) ? absint( $_GET['form_id'] ) : 0, |
| 141 | ), |
| 142 | home_url() |
| 143 | ) |
| 144 | ); |
| 145 | ?> |
| 146 | <a class="<?php echo esc_attr( $preview_class ); ?>" target="__blank" data-connection-id="<?php echo esc_attr( $connection_id ); ?>" href="<?php echo esc_url( $preview_url ); ?>"> |
| 147 | <span class="<?php echo esc_attr( $preview_class ); ?>"> |
| 148 | <svg xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/1999/svg" |
| 149 | viewBox="0 0 442.04 442.04" xml:space="preserve"><g id="SVGRepo_bgCarrier" stroke-width="0"></g> |
| 150 | <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g> |
| 151 | <g id="SVGRepo_iconCarrier"> <g> <g> |
| 152 | <path d="M221.02,341.304c-49.708,0-103.206-19.44-154.71-56.22C27.808,257.59,4.044,230.351,3.051,229.203 c-4.068-4.697-4.068-11.669,0-16.367c0.993-1.146,24.756-28.387,63.259-55.881c51.505-36.777,105.003-56.219,154.71-56.219 c49.708,0,103.207,19.441,154.71,56.219c38.502,27.494,62.266,54.734,63.259,55.881c4.068,4.697,4.068,11.669,0,16.367 c-0.993,1.146-24.756,28.387-63.259,55.881C324.227,321.863,270.729,341.304,221.02,341.304z M29.638,221.021 c9.61,9.799,27.747,27.03,51.694,44.071c32.83,23.361,83.714,51.212,139.688,51.212s106.859-27.851,139.688-51.212 c23.944-17.038,42.082-34.271,51.694-44.071c-9.609-9.799-27.747-27.03-51.694-44.071 c-32.829-23.362-83.714-51.212-139.688-51.212s-106.858,27.85-139.688,51.212C57.388,193.988,39.25,211.219,29.638,221.021z"></path> </g> <g> <path d="M221.02,298.521c-42.734,0-77.5-34.767-77.5-77.5c0-42.733,34.766-77.5,77.5-77.5c18.794,0,36.924,6.814,51.048,19.188 c5.193,4.549,5.715,12.446,1.166,17.639c-4.549,5.193-12.447,5.714-17.639,1.166c-9.564-8.379-21.844-12.993-34.576-12.993 c-28.949,0-52.5,23.552-52.5,52.5s23.551,52.5,52.5,52.5c28.95,0,52.5-23.552,52.5-52.5c0-6.903,5.597-12.5,12.5-12.5 s12.5,5.597,12.5,12.5C298.521,263.754,263.754,298.521,221.02,298.521z"></path> </g> <g> <path d="M221.02,246.021c-13.785,0-25-11.215-25-25s11.215-25,25-25c13.786,0,25,11.215,25,25S234.806,246.021,221.02,246.021z"></path> |
| 153 | </g> </g> </g></svg> |
| 154 | <a href="#" class="everest-forms-email-duplicate"> |
| 155 | <span class="<?php echo esc_attr( $duplicate_class ); ?>"> |
| 156 | <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 25"> |
| 157 | <path fill-rule="evenodd" d="M3.033 3.533c.257-.257.605-.4.968-.4h9A1.368 1.368 0 0 1 14.369 4.5v1a.632.632 0 0 0 1.263 0v-1a2.632 2.632 0 0 0-2.631-2.632H4A2.632 2.632 0 0 0 1.368 4.5v9A2.631 2.631 0 0 0 4 16.131h1a.632.632 0 0 0 0-1.263H4A1.368 1.368 0 0 1 2.631 13.5v-9c0-.363.144-.711.401-.968Zm6.598 7.968A1.37 1.37 0 0 1 11 10.132h9c.756 0 1.368.613 1.368 1.369v9c0 .755-.612 1.368-1.368 1.368h-9A1.368 1.368 0 0 1 9.63 20.5v-9ZM11 8.869A2.632 2.632 0 0 0 8.368 11.5v9A2.632 2.632 0 0 0 11 23.131h9a2.632 2.632 0 0 0 2.63-2.631v-9A2.632 2.632 0 0 0 20 8.87h-9Z" clip-rule="evenodd"></path> |
| 158 | </svg> |
| 159 | </a> |
| 160 | </div> |
| 161 | </li> |
| 162 | <?php |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | ?> |
| 167 | </ul> |
| 168 | </div> |
| 169 | <?php |
| 170 | } |
| 171 | |
| 172 | /** |
| 173 | * Outputs the builder content. |
| 174 | */ |
| 175 | public function output_content() { |
| 176 | $settings = isset( $this->form_data['settings'] ) ? $this->form_data['settings'] : array(); |
| 177 | |
| 178 | // --------------------------------------------------------------------// |
| 179 | // General |
| 180 | // --------------------------------------------------------------------// |
| 181 | echo '<div class="evf-content-section evf-content-general-settings">'; |
| 182 | echo '<div class="evf-content-section-title">'; |
| 183 | esc_html_e( 'General', 'everest-forms' ); |
| 184 | echo '</div>'; |
| 185 | everest_forms_panel_field( |
| 186 | 'text', |
| 187 | 'settings', |
| 188 | 'form_title', |
| 189 | $this->form_data, |
| 190 | esc_html__( 'Form Name', 'everest-forms' ), |
| 191 | array( |
| 192 | 'default' => isset( $this->form->post_title ) ? $this->form->post_title : '', |
| 193 | 'tooltip' => esc_html__( 'Give a name to this form', 'everest-forms' ), |
| 194 | ) |
| 195 | ); |
| 196 | everest_forms_panel_field( |
| 197 | 'textarea', |
| 198 | 'settings', |
| 199 | 'form_description', |
| 200 | $this->form_data, |
| 201 | esc_html__( 'Form description', 'everest-forms' ), |
| 202 | array( |
| 203 | 'input_class' => 'short', |
| 204 | 'default' => isset( $this->form->form_description ) ? $this->form->form_description : '', |
| 205 | 'tooltip' => sprintf( esc_html__( 'Give the description to this form', 'everest-forms' ) ), |
| 206 | ) |
| 207 | ); |
| 208 | everest_forms_panel_field( |
| 209 | 'textarea', |
| 210 | 'settings', |
| 211 | 'form_disable_message', |
| 212 | $this->form_data, |
| 213 | esc_html__( 'Form disabled message', 'everest-forms' ), |
| 214 | array( |
| 215 | 'input_class' => 'short', |
| 216 | 'default' => isset( $this->form->form_disable_message ) ? $this->form->form_disable_message : __( 'This form is disabled.', 'everest-forms' ), |
| 217 | 'tooltip' => sprintf( esc_html__( 'Message that shows up if the form is disabled.', 'everest-forms' ) ), |
| 218 | ) |
| 219 | ); |
| 220 | |
| 221 | everest_forms_panel_field( |
| 222 | 'select', |
| 223 | 'settings', |
| 224 | 'layout_class', |
| 225 | $this->form_data, |
| 226 | esc_html__( 'Layout Design', 'everest-forms' ), |
| 227 | array( |
| 228 | 'default' => '0', |
| 229 | 'tooltip' => esc_html__( 'Choose design template for the Form', 'everest-forms' ), |
| 230 | 'options' => array( |
| 231 | 'default' => esc_html__( 'Default', 'everest-forms' ), |
| 232 | 'layout-two' => esc_html__( 'Classic Layout', 'everest-forms' ), |
| 233 | ), |
| 234 | ) |
| 235 | ); |
| 236 | everest_forms_panel_field( |
| 237 | 'text', |
| 238 | 'settings', |
| 239 | 'form_class', |
| 240 | $this->form_data, |
| 241 | esc_html__( 'Form Class', 'everest-forms' ), |
| 242 | array( |
| 243 | 'default' => isset( $this->form->form_class ) ? $this->form->form_class : '', |
| 244 | /* translators: %1$s - general settings docs url */ |
| 245 | 'tooltip' => sprintf( esc_html__( 'Enter CSS class names for the form wrapper. Multiple class names should be separated with spaces. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#7-toc-title' ) ), |
| 246 | ) |
| 247 | ); |
| 248 | |
| 249 | do_action( 'everest_forms_field_required_indicators', $this->form_data, $settings ); |
| 250 | |
| 251 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submit Button', 'everest-forms' ) . '</h4>'; |
| 252 | everest_forms_panel_field( |
| 253 | 'text', |
| 254 | 'settings', |
| 255 | 'submit_button_text', |
| 256 | $this->form_data, |
| 257 | esc_html__( 'Submit button text', 'everest-forms' ), |
| 258 | array( |
| 259 | 'default' => isset( $settings['submit_button_text'] ) ? $settings['submit_button_text'] : __( 'Submit', 'everest-forms' ), |
| 260 | 'tooltip' => esc_html__( 'Enter desired text for submit button.', 'everest-forms' ), |
| 261 | ) |
| 262 | ); |
| 263 | everest_forms_panel_field( |
| 264 | 'text', |
| 265 | 'settings', |
| 266 | 'submit_button_processing_text', |
| 267 | $this->form_data, |
| 268 | __( 'Submit button processing text', 'everest-forms' ), |
| 269 | array( |
| 270 | 'default' => isset( $settings['submit_button_processing_text'] ) ? $settings['submit_button_processing_text'] : __( 'Processing…', 'everest-forms' ), |
| 271 | 'tooltip' => esc_html__( 'Enter the submit button text that you would like the button to display while the form submission is processing.', 'everest-forms' ), |
| 272 | ) |
| 273 | ); |
| 274 | everest_forms_panel_field( |
| 275 | 'text', |
| 276 | 'settings', |
| 277 | 'submit_button_class', |
| 278 | $this->form_data, |
| 279 | esc_html__( 'Submit button class', 'everest-forms' ), |
| 280 | array( |
| 281 | 'default' => isset( $settings['submit_button_class'] ) ? $settings['submit_button_class'] : '', |
| 282 | 'tooltip' => esc_html__( 'Enter CSS class names for submit button. Multiple class names should be separated with spaces.', 'everest-forms' ), |
| 283 | ) |
| 284 | ); |
| 285 | do_action( 'everest_forms_inline_submit_settings', $this, 'submit', 'connection_1' ); |
| 286 | echo '</div>'; |
| 287 | do_action( 'everest_forms_inline_integrations_settings', $this->form_data, $settings ); |
| 288 | everest_forms_panel_field( |
| 289 | 'toggle', |
| 290 | 'settings', |
| 291 | 'ajax_form_submission', |
| 292 | $this->form_data, |
| 293 | esc_html__( 'Enable Ajax Form Submission', 'everest-forms' ), |
| 294 | array( |
| 295 | 'default' => isset( $settings['ajax_form_submission'] ) ? $settings['ajax_form_submission'] : 0, |
| 296 | 'tooltip' => esc_html__( 'Enables form submission without reloading the page.', 'everest-forms' ), |
| 297 | ) |
| 298 | ); |
| 299 | everest_forms_panel_field( |
| 300 | 'toggle', |
| 301 | 'settings', |
| 302 | 'disabled_entries', |
| 303 | $this->form_data, |
| 304 | esc_html__( 'Disable storing entry information', 'everest-forms' ), |
| 305 | array( |
| 306 | 'default' => isset( $settings['disabled_entries'] ) ? $settings['disabled_entries'] : 0, |
| 307 | /* translators: %1$s - general settings docs url */ |
| 308 | 'tooltip' => sprintf( esc_html__( 'Disable storing form entries. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#13-toc-title' ) ), |
| 309 | ) |
| 310 | ); |
| 311 | |
| 312 | do_action( 'everest_forms_inline_general_settings', $this ); |
| 313 | |
| 314 | echo '</div>'; |
| 315 | |
| 316 | // --------------------------------------------------------------------// |
| 317 | |
| 318 | // --------------------------------------------------------------------// |
| 319 | $form_name = isset( $settings['form_title'] ) ? ' - ' . $settings['form_title'] : ''; |
| 320 | if ( ! isset( $settings['email']['connection_1'] ) ) { |
| 321 | $settings['email']['connection_1'] = array( 'connection_name' => __( 'Admin Notification', 'everest-forms' ) ); |
| 322 | $settings['email']['connection_1']['evf_to_email'] = isset( $settings['email']['evf_to_email'] ) ? $settings['email']['evf_to_email'] : '{admin_email}'; |
| 323 | $settings['email']['connection_1']['evf_from_name'] = isset( $settings['email']['evf_from_name'] ) ? $settings['email']['evf_from_name'] : get_bloginfo( 'name', 'display' ); |
| 324 | $settings['email']['connection_1']['evf_from_email'] = isset( $settings['email']['evf_from_email'] ) ? $settings['email']['evf_from_email'] : '{admin_email}'; |
| 325 | $settings['email']['connection_1']['evf_reply_to'] = isset( $settings['email']['evf_reply_to'] ) ? $settings['email']['evf_reply_to'] : ''; |
| 326 | /* translators: %s: Form Name */ |
| 327 | $settings['email']['connection_1']['evf_email_subject'] = isset( $settings['email']['evf_email_subject'] ) ? $settings['email']['evf_email_subject'] : sprintf( esc_html__( 'New Form Entry %s', 'everest-forms' ), $form_name ); |
| 328 | $settings['email']['connection_1']['evf_email_message'] = isset( $settings['email']['evf_email_message'] ) ? $settings['email']['evf_email_message'] : '{all_fields}'; |
| 329 | |
| 330 | $email_settings = array( 'attach_pdf_to_admin_email', 'show_header_in_attachment_pdf_file', 'conditional_logic_status', 'conditional_option', 'conditionals' ); |
| 331 | foreach ( $email_settings as $email_setting ) { |
| 332 | $settings['email']['connection_1'][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : ''; |
| 333 | } |
| 334 | |
| 335 | // Backward compatibility. |
| 336 | $unique_connection_id = sprintf( 'connection_%s', uniqid() ); |
| 337 | if ( isset( $settings['email']['evf_send_confirmation_email'] ) && '1' === $settings['email']['evf_send_confirmation_email'] ) { |
| 338 | $settings['email'][ $unique_connection_id ] = array( 'connection_name' => esc_html__( 'User Notification', 'everest-forms' ) ); |
| 339 | |
| 340 | foreach ( $email_settings as $email_setting ) { |
| 341 | $settings['email'][ $unique_connection_id ][ $email_setting ] = isset( $settings['email'][ $email_setting ] ) ? $settings['email'][ $email_setting ] : ''; |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | echo "<div class = 'evf-email-settings-wrapper'>"; |
| 347 | |
| 348 | foreach ( $settings['email'] as $connection_id => $connection ) : |
| 349 | if ( preg_match( '/connection_/', $connection_id ) ) { |
| 350 | // Backward Compatibility. |
| 351 | if ( isset( $settings['email']['enable_email_notification'] ) && '0' === $settings['email']['enable_email_notification'] ) { |
| 352 | $email_status = isset( $settings['email']['enable_email_notification'] ) ? $settings['email']['enable_email_notification'] : '1'; |
| 353 | } else { |
| 354 | $email_status = isset( $settings['email'][ $connection_id ]['enable_email_notification'] ) ? $settings['email'][ $connection_id ]['enable_email_notification'] : '1'; |
| 355 | } |
| 356 | $hidden_class = '1' !== $email_status ? 'everest-forms-hidden' : ''; |
| 357 | $hidden_enable_setting_class = '1' === $email_status ? 'everest-forms-hidden' : ''; |
| 358 | $toggler_hide_class = isset( $toggler_hide_class ) ? 'style=display:none;' : ''; |
| 359 | echo '<div class="evf-content-section evf-content-email-settings" ' . esc_attr( $toggler_hide_class ) . '>'; |
| 360 | echo '<div class="evf-content-section-title" ' . esc_attr( $toggler_hide_class ) . '>'; |
| 361 | echo '<div class="evf-title">' . esc_html__( 'Email', 'everest-forms' ) . '</div>'; |
| 362 | ?> |
| 363 | <div class="evf-enable-email-toggle <?php echo esc_attr( $hidden_enable_setting_class ); ?>"><img src="<?php echo esc_url( plugin_dir_url( EVF_PLUGIN_FILE ) . 'assets/images/enable-email-toggle.png' ); ?>" alt="<?php esc_attr_e( 'Click me to enable email settings', 'everest-forms' ); ?>"></div> |
| 364 | <div class="evf-toggle-section"> |
| 365 | <label class="evf-toggle-switch"> |
| 366 | <input type="hidden" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="0" class="widefat"> |
| 367 | <input type="checkbox" name="settings[email][<?php echo esc_attr( $connection_id ); ?>][enable_email_notification]" value="1" data-connection-id="<?php echo esc_attr( $connection_id ); ?>" <?php echo checked( '1', $email_status, false ); ?> > |
| 368 | <span class="evf-toggle-switch-wrap"></span> |
| 369 | <span class="evf-toggle-switch-control"></span> |
| 370 | </label> |
| 371 | </div></div> |
| 372 | <?php |
| 373 | |
| 374 | echo '<div class="evf-content-email-settings-inner ' . esc_attr( $hidden_class ) . '" data-connection_id=' . esc_attr( $connection_id ) . '>'; |
| 375 | |
| 376 | everest_forms_panel_field( |
| 377 | 'text', |
| 378 | 'email', |
| 379 | 'connection_name', |
| 380 | $this->form_data, |
| 381 | '', |
| 382 | array( |
| 383 | 'default' => isset( $settings['email'][ $connection_id ]['connection_name'] ) ? $settings['email'][ $connection_id ]['connection_name'] : __( 'Admin Notification', 'everest-forms' ), |
| 384 | 'class' => 'everest-forms-email-name', |
| 385 | 'parent' => 'settings', |
| 386 | 'subsection' => $connection_id, |
| 387 | ) |
| 388 | ); |
| 389 | |
| 390 | everest_forms_panel_field( |
| 391 | 'text', |
| 392 | 'email', |
| 393 | 'evf_to_email', |
| 394 | $this->form_data, |
| 395 | esc_html__( 'To Address', 'everest-forms' ), |
| 396 | array( |
| 397 | 'default' => isset( $settings['email'][ $connection_id ]['evf_to_email'] ) ? $settings['email'][ $connection_id ]['evf_to_email'] : '{admin_email}', |
| 398 | /* translators: %1$s - general settings docs url */ |
| 399 | 'tooltip' => sprintf( esc_html__( 'Enter the recipient\'s email address (comma separated) to receive form entry notifications. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#1-toc-title' ) ), |
| 400 | 'smarttags' => array( |
| 401 | 'type' => 'fields', |
| 402 | 'form_fields' => 'email', |
| 403 | ), |
| 404 | 'parent' => 'settings', |
| 405 | 'subsection' => $connection_id, |
| 406 | ) |
| 407 | ); |
| 408 | if ( 'yes' === get_option( 'everest_forms_enable_email_copies' ) ) { |
| 409 | everest_forms_panel_field( |
| 410 | 'text', |
| 411 | 'email', |
| 412 | 'evf_carboncopy', |
| 413 | $this->form_data, |
| 414 | esc_html__( 'Cc Address', 'everest-forms' ), |
| 415 | array( |
| 416 | 'default' => isset( $settings['email'][ $connection_id ]['evf_carboncopy'] ) ? $settings['email'][ $connection_id ]['evf_carboncopy'] : '', |
| 417 | 'tooltip' => esc_html__( 'Enter Cc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ), |
| 418 | 'smarttags' => array( |
| 419 | 'type' => 'fields', |
| 420 | 'form_fields' => 'email', |
| 421 | ), |
| 422 | 'parent' => 'settings', |
| 423 | 'subsection' => $connection_id, |
| 424 | ) |
| 425 | ); |
| 426 | everest_forms_panel_field( |
| 427 | 'text', |
| 428 | 'email', |
| 429 | 'evf_blindcarboncopy', |
| 430 | $this->form_data, |
| 431 | esc_html__( 'Bcc Address', 'everest-forms' ), |
| 432 | array( |
| 433 | 'default' => isset( $settings['email'][ $connection_id ]['evf_blindcarboncopy'] ) ? $settings['email'][ $connection_id ]['evf_blindcarboncopy'] : '', |
| 434 | 'tooltip' => esc_html__( 'Enter Bcc recipient\'s email address (comma separated) to receive form entry notifications.', 'everest-forms' ), |
| 435 | 'smarttags' => array( |
| 436 | 'type' => 'fields', |
| 437 | 'form_fields' => 'email', |
| 438 | ), |
| 439 | 'parent' => 'settings', |
| 440 | 'subsection' => $connection_id, |
| 441 | ) |
| 442 | ); |
| 443 | } |
| 444 | everest_forms_panel_field( |
| 445 | 'text', |
| 446 | 'email', |
| 447 | 'evf_from_name', |
| 448 | $this->form_data, |
| 449 | esc_html__( 'From Name', 'everest-forms' ), |
| 450 | array( |
| 451 | 'default' => isset( $settings['email'][ $connection_id ]['evf_from_name'] ) ? $settings['email'][ $connection_id ]['evf_from_name'] : get_bloginfo( 'name', 'display' ), |
| 452 | /* translators: %1$s - general settings docs url */ |
| 453 | 'tooltip' => sprintf( esc_html__( 'Enter the From Name to be displayed in Email. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#2-toc-title' ) ), |
| 454 | 'smarttags' => array( |
| 455 | 'type' => 'all', |
| 456 | 'form_fields' => 'all', |
| 457 | ), |
| 458 | 'parent' => 'settings', |
| 459 | 'subsection' => $connection_id, |
| 460 | ) |
| 461 | ); |
| 462 | everest_forms_panel_field( |
| 463 | 'text', |
| 464 | 'email', |
| 465 | 'evf_from_email', |
| 466 | $this->form_data, |
| 467 | esc_html__( 'From Address', 'everest-forms' ), |
| 468 | array( |
| 469 | 'default' => isset( $settings['email'][ $connection_id ]['evf_from_email'] ) ? $settings['email'][ $connection_id ]['evf_from_email'] : '{admin_email}', |
| 470 | /* translators: %1$s - general settings docs url */ |
| 471 | 'tooltip' => sprintf( esc_html__( 'Enter the Email address from which you want to send Email. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#3-toc-title' ) ), |
| 472 | 'smarttags' => array( |
| 473 | 'type' => 'fields', |
| 474 | 'form_fields' => 'email', |
| 475 | ), |
| 476 | 'parent' => 'settings', |
| 477 | 'subsection' => $connection_id, |
| 478 | ) |
| 479 | ); |
| 480 | everest_forms_panel_field( |
| 481 | 'text', |
| 482 | 'email', |
| 483 | 'evf_reply_to', |
| 484 | $this->form_data, |
| 485 | esc_html__( 'Reply To', 'everest-forms' ), |
| 486 | array( |
| 487 | 'default' => isset( $settings['email'][ $connection_id ]['evf_reply_to'] ) ? $settings['email'][ $connection_id ]['evf_reply_to'] : '', |
| 488 | /* translators: %1$s - general settings docs url */ |
| 489 | 'tooltip' => sprintf( esc_html__( 'Enter the reply to email address where you want the email to be received when this email is replied. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#4-toc-title' ) ), |
| 490 | 'smarttags' => array( |
| 491 | 'type' => 'fields', |
| 492 | 'form_fields' => 'email', |
| 493 | ), |
| 494 | 'parent' => 'settings', |
| 495 | 'subsection' => $connection_id, |
| 496 | ) |
| 497 | ); |
| 498 | everest_forms_panel_field( |
| 499 | 'text', |
| 500 | 'email', |
| 501 | 'evf_email_subject', |
| 502 | $this->form_data, |
| 503 | esc_html__( 'Email Subject', 'everest-forms' ), |
| 504 | array( |
| 505 | /* translators: %s: Form Name */ |
| 506 | 'default' => isset( $settings['email'][ $connection_id ]['evf_email_subject'] ) ? $settings['email'][ $connection_id ]['evf_email_subject'] : sprintf( esc_html__( 'New Form Entry %s', 'everest-forms' ), $form_name ), |
| 507 | /* translators: %1$s - General Settings docs url */ |
| 508 | 'tooltip' => sprintf( esc_html__( 'Enter the subject of the email. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#5-toc-title' ) ), |
| 509 | 'smarttags' => array( |
| 510 | 'type' => 'all', |
| 511 | 'form_fields' => 'all', |
| 512 | ), |
| 513 | 'parent' => 'settings', |
| 514 | 'subsection' => $connection_id, |
| 515 | ) |
| 516 | ); |
| 517 | // --------------------------------------------------------------------// |
| 518 | // Everest Forms AI Setting Section Start |
| 519 | // --------------------------------------------------------------------// |
| 520 | $everest_forms_ai_api_key = get_option( 'everest_forms_ai_api_key' ); |
| 521 | if ( ! empty( $everest_forms_ai_api_key ) ) { |
| 522 | everest_forms_panel_field( |
| 523 | 'toggle', |
| 524 | 'email', |
| 525 | 'enable_ai_email_prompt', |
| 526 | $this->form_data, |
| 527 | esc_html__( 'Enable Email Prompt', 'everest-forms' ), |
| 528 | array( |
| 529 | 'default' => ! empty( $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ) ? $settings['email'][ $connection_id ]['enable_ai_email_prompt'] : '0', |
| 530 | 'class' => 'everest-forms-enable-email-prompt', |
| 531 | /* translators: %1$s - email message prompt doc url*/ |
| 532 | 'tooltip' => sprintf( esc_html__( 'Check this option to enable the email message prompt. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/ai/#6-toc-title' ) ), |
| 533 | 'parent' => 'settings', |
| 534 | 'subsection' => $connection_id, |
| 535 | ) |
| 536 | ); |
| 537 | everest_forms_panel_field( |
| 538 | 'textarea', |
| 539 | 'email', |
| 540 | 'evf_email_message_prompt', |
| 541 | $this->form_data, |
| 542 | esc_html__( 'Email Message Prompt', 'everest-forms' ), |
| 543 | array( |
| 544 | 'default' => isset( $settings['email'][ $connection_id ]['evf_email_message_prompt'] ) ? $settings['email'][ $connection_id ]['evf_email_message_prompt'] : '', |
| 545 | 'class' => isset( $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ) && '1' === $settings['email'][ $connection_id ]['enable_ai_email_prompt'] ? 'evf-email-message-prompt' : 'evf-email-message-prompt everest-forms-hidden', |
| 546 | /* translators: %1$s - general settings docs url */ |
| 547 | 'tooltip' => sprintf( esc_html__( 'Enter the email message prompt. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/ai/#6-toc-title' ) ), |
| 548 | 'smarttags' => array( |
| 549 | 'type' => 'all', |
| 550 | 'form_fields' => 'all', |
| 551 | ), |
| 552 | 'parent' => 'settings', |
| 553 | 'subsection' => $connection_id, |
| 554 | ) |
| 555 | ); |
| 556 | } |
| 557 | // --------------------------------------------------------------------// |
| 558 | // Everest Forms AI Setting Section End |
| 559 | // --------------------------------------------------------------------// |
| 560 | everest_forms_panel_field( |
| 561 | 'tinymce', |
| 562 | 'email', |
| 563 | 'evf_email_message', |
| 564 | $this->form_data, |
| 565 | esc_html__( 'Email Message', 'everest-forms' ), |
| 566 | array( |
| 567 | 'default' => isset( $settings['email'][ $connection_id ]['evf_email_message'] ) ? evf_string_translation( $this->form_data['id'], 'evf_email_message', $settings['email'][ $connection_id ]['evf_email_message'] ) : __( '{all_fields}', 'everest-forms' ), |
| 568 | /* translators: %1$s - general settings docs url */ |
| 569 | 'tooltip' => sprintf( esc_html__( 'Enter the message of the email. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/email-settings/#6-toc-title' ) ), |
| 570 | 'smarttags' => array( |
| 571 | 'type' => 'all', |
| 572 | 'form_fields' => 'all', |
| 573 | ), |
| 574 | 'parent' => 'settings', |
| 575 | 'subsection' => $connection_id, |
| 576 | /* translators: %s - all fields smart tag. */ |
| 577 | 'after' => empty( $everest_forms_ai_api_key ) ? '<p class="desc">' . sprintf( esc_html__( 'To display all form fields, use the %s Smart Tag.', 'everest-forms' ), '<code>{all_fields}</code>' ) . '</p>' : '<p class="desc">' . sprintf( esc_html__( 'To display all form fields, use the %1$s Smart Tag. Use %2$s Smart Tag for AI-generated emails', 'everest-forms' ), '<code>{all_fields}</code>', '<code>{ai_email_response}</code>' ) . '</p>', |
| 578 | ) |
| 579 | ); |
| 580 | |
| 581 | do_action( 'everest_forms_inline_email_settings', $this, $connection_id ); |
| 582 | |
| 583 | echo '</div></div>'; |
| 584 | } |
| 585 | |
| 586 | endforeach; |
| 587 | |
| 588 | echo '</div>'; |
| 589 | |
| 590 | // --------------------------------------------------------------------// |
| 591 | // Preview Confirmation |
| 592 | // --------------------------------------------------------------------// |
| 593 | echo '<div class="evf-content-section evf-content-confirmation-settings">'; |
| 594 | echo '<div class="evf-content-section-title">'; |
| 595 | esc_html_e( 'Confirmations', 'everest-forms' ); |
| 596 | echo '</div>'; |
| 597 | |
| 598 | everest_forms_panel_field( |
| 599 | 'textarea', |
| 600 | 'settings', |
| 601 | 'successful_form_submission_message', |
| 602 | $this->form_data, |
| 603 | esc_html__( 'Successful form submission message', 'everest-forms' ), |
| 604 | array( |
| 605 | 'input_class' => 'short', |
| 606 | 'default' => isset( $this->form->successful_form_submission_message ) ? $this->form->successful_form_submission_message : __( 'Thanks for contacting us! We will be in touch with you shortly', 'everest-forms' ), |
| 607 | /* translators: %1$s - general settings docs url */ |
| 608 | 'tooltip' => sprintf( esc_html__( 'Success message that shows up after submitting form. <a href="%1$s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#4-toc-title' ) ), |
| 609 | ) |
| 610 | ); |
| 611 | everest_forms_panel_field( |
| 612 | 'toggle', |
| 613 | 'settings', |
| 614 | 'submission_message_scroll', |
| 615 | $this->form_data, |
| 616 | __( 'Automatically scroll to the submission message', 'everest-forms' ), |
| 617 | array( |
| 618 | 'default' => '1', |
| 619 | ) |
| 620 | ); |
| 621 | |
| 622 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Submission Redirection', 'everest-forms' ) . '</h4>'; |
| 623 | |
| 624 | everest_forms_panel_field( |
| 625 | 'select', |
| 626 | 'settings', |
| 627 | 'redirect_to', |
| 628 | $this->form_data, |
| 629 | esc_html__( 'Redirect To', 'everest-forms' ), |
| 630 | array( |
| 631 | 'default' => 'same', |
| 632 | /* translators: %1$s - general settings docs url */ |
| 633 | 'tooltip' => sprintf( esc_html__( 'Choose where to redirect after form submission. <a href="%s" target="_blank">Learn More</a>', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/docs/general-settings/#5-toc-title' ) ), |
| 634 | 'options' => array( |
| 635 | 'same' => esc_html__( 'Same Page', 'everest-forms' ), |
| 636 | 'custom_page' => esc_html__( 'Custom Page', 'everest-forms' ), |
| 637 | 'external_url' => esc_html__( 'External URL', 'everest-forms' ), |
| 638 | ), |
| 639 | ) |
| 640 | ); |
| 641 | |
| 642 | everest_forms_panel_field( |
| 643 | 'select', |
| 644 | 'settings', |
| 645 | 'custom_page', |
| 646 | $this->form_data, |
| 647 | esc_html__( 'Custom Page', 'everest-forms' ), |
| 648 | array( |
| 649 | 'default' => '0', |
| 650 | 'options' => $this->get_all_pages(), |
| 651 | ) |
| 652 | ); |
| 653 | |
| 654 | everest_forms_panel_field( |
| 655 | 'text', |
| 656 | 'settings', |
| 657 | 'external_url', |
| 658 | $this->form_data, |
| 659 | esc_html__( 'External URL', 'everest-forms' ), |
| 660 | array( |
| 661 | 'default' => isset( $this->form->external_url ) ? $this->form->external_url : '', |
| 662 | ) |
| 663 | ); |
| 664 | |
| 665 | everest_forms_panel_field( |
| 666 | 'toggle', |
| 667 | 'settings', |
| 668 | 'enable_redirect_query_string', |
| 669 | $this->form_data, |
| 670 | esc_html__( ' Append Query String', 'everest-forms' ), |
| 671 | array( |
| 672 | 'default' => '0', |
| 673 | ) |
| 674 | ); |
| 675 | |
| 676 | everest_forms_panel_field( |
| 677 | 'text', |
| 678 | 'settings', |
| 679 | 'query_string', |
| 680 | $this->form_data, |
| 681 | esc_html__( 'Query String', 'everest-forms' ), |
| 682 | array( |
| 683 | 'default' => isset( $settings['query_string'] ) ? $settings['query_string'] : '', |
| 684 | 'class' => isset( $settings['enable_redirect_query_string'] ) && '1' === $settings['enable_redirect_query_string'] ? '' : 'everest-forms-hidden', |
| 685 | 'smarttags' => array( |
| 686 | 'type' => 'all', |
| 687 | 'form_fields' => 'all', |
| 688 | ), |
| 689 | 'after' => '<p class="desc">' . sprintf( esc_html__( 'Example: firstname= {field_id="name_ys0GeZISRs-1"}&email={field_id="email_LbH5NxasXM-2"}', 'everest-forms' ) ) . '</p>', |
| 690 | ) |
| 691 | ); |
| 692 | |
| 693 | do_action( 'everest_forms_submission_redirection_settings', $this, 'submission_redirection' ); |
| 694 | echo '</div>'; |
| 695 | |
| 696 | everest_forms_panel_field( |
| 697 | 'toggle', |
| 698 | 'settings', |
| 699 | 'preview_confirmation', |
| 700 | $this->form_data, |
| 701 | esc_html__( 'Show entry preview after form submission', 'everest-forms' ), |
| 702 | array( |
| 703 | 'tooltip' => esc_html__( 'Show entry preview after form submission', 'everest-forms' ), |
| 704 | ) |
| 705 | ); |
| 706 | |
| 707 | everest_forms_panel_field( |
| 708 | 'select', |
| 709 | 'settings', |
| 710 | 'preview_confirmation_select', |
| 711 | $this->form_data, |
| 712 | esc_html__( 'Preview type', 'everest-forms' ), |
| 713 | array( |
| 714 | 'default' => 'basic', |
| 715 | 'tooltip' => esc_html__( 'Choose preview style type.', 'everest-forms' ), |
| 716 | 'options' => array( |
| 717 | 'basic' => esc_html__( 'Basic', 'everest-forms' ), |
| 718 | 'table' => esc_html__( 'Table', 'everest-forms' ), |
| 719 | 'compact' => esc_html__( 'Compact', 'everest-forms' ), |
| 720 | ), |
| 721 | ) |
| 722 | ); |
| 723 | echo '</div>'; |
| 724 | |
| 725 | // --------------------------------------------------------------------// |
| 726 | // Spam Protection and Security |
| 727 | // --------------------------------------------------------------------// |
| 728 | echo '<div class="evf-content-section evf-content-security-settings">'; |
| 729 | echo '<div class="evf-content-section-title">'; |
| 730 | esc_html_e( 'Anti-Spam and Security', 'everest-forms' ); |
| 731 | echo '</div>'; |
| 732 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Honeypot', 'everest-forms' ) . '</h4>'; |
| 733 | everest_forms_panel_field( |
| 734 | 'toggle', |
| 735 | 'settings', |
| 736 | 'honeypot', |
| 737 | $this->form_data, |
| 738 | esc_html__( 'Enable anti-spam honeypot', 'everest-forms' ), |
| 739 | array( |
| 740 | 'default' => '1', |
| 741 | ) |
| 742 | ); |
| 743 | do_action( 'everest_forms_inline_honeypot_settings', $this, 'honeypot', 'connection_1' ); |
| 744 | echo '</div>'; |
| 745 | /** |
| 746 | * Akismet anit-spam protection. |
| 747 | * |
| 748 | * @since 2.0.4 |
| 749 | */ |
| 750 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Akismet', 'everest-forms' ) . '</h4>'; |
| 751 | everest_forms_panel_field( |
| 752 | 'toggle', |
| 753 | 'settings', |
| 754 | 'akismet', |
| 755 | $this->form_data, |
| 756 | esc_html__( 'Enable Akismet anti-spam protection', 'everest-forms' ), |
| 757 | array( |
| 758 | 'default' => '0', |
| 759 | ) |
| 760 | ); |
| 761 | |
| 762 | /** |
| 763 | * Warning message if the installtion, activation and configuration are not proper. |
| 764 | */ |
| 765 | if ( ! file_exists( WP_PLUGIN_DIR . '/akismet/akismet.php' ) ) { |
| 766 | printf( '<div class="evf-akismet"><span class="evf-akismet-warning"><span class="evf-akismet-warning-label">%s </span>%s <a href="%s" target="_blank">%s</a>%s</span> <a href="%s" target="_blank">%s</a></div>', esc_html__( 'Warning:- ', 'everest-forms' ), esc_html__( ' This feature is inactive because Akismet plugin ', 'everest-forms' ), esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'has not been installed.', 'everest-forms' ), esc_html__( ' For more', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/' ), esc_html( 'information', 'everest-forms' ) ); |
| 767 | } elseif ( ! is_plugin_active( 'akismet/akismet.php' ) ) { |
| 768 | printf( '<div class="evf-akismet"><span class="evf-akismet-warning"><span class="evf-akismet-warning-label">%s </span>%s <a href="%s" target="_blank">%s</a>%s</span> <a href="%s" target="_blank">%s</a></div>', esc_html__( 'Warning:- ', 'everest-forms' ), esc_html__( ' This feature is inactive because Akismet plugin ', 'everest-forms' ), esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'has not been activated.', 'everest-forms' ), esc_html__( ' For more', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/' ), esc_html( 'information', 'everest-forms' ) ); |
| 769 | } elseif ( ! evf_is_akismet_configured() ) { |
| 770 | printf( '<div class="evf-akismet"><span class="evf-akismet-warning"><span class="evf-akismet-warning-label">%s </span>%s <a href="%s" target="_blank">%s</a>%s</span> <a href="%s" target="_blank">%s</a></div>', esc_html__( 'Warning:- ', 'everest-forms' ), esc_html__( ' This feature is inactive because Akismet plugin ', 'everest-forms' ), esc_url( admin_url( 'plugins.php' ) ), esc_html__( 'has not been properly configured.', 'everest-forms' ), esc_html__( ' For more', 'everest-forms' ), esc_url( 'https://docs.everestforms.net/' ), esc_html( 'information', 'everest-forms' ) ); |
| 771 | } |
| 772 | echo '<div class="everest-forms-border-container everest-forms-akismet-protection-type">'; |
| 773 | everest_forms_panel_field( |
| 774 | 'select', |
| 775 | 'settings', |
| 776 | 'akismet_protection_type', |
| 777 | $this->form_data, |
| 778 | esc_html__( 'Protection type', 'everest-forms' ), |
| 779 | array( |
| 780 | 'default' => 'validation_failed', |
| 781 | 'tooltip' => esc_html__( "Please select the protection type. Choosing 'Mark as Spam' allows the submission but marks the entry as spam, while selecting 'Make the form submission as failed' will prevent the form submission.", 'everest-forms' ), |
| 782 | 'options' => array( |
| 783 | 'validation_failed' => esc_html__( 'Make the form submission as failed', 'everest-forms' ), |
| 784 | 'mark_as_spam' => esc_html__( 'Mark as Spam', 'everest-forms' ), |
| 785 | ), |
| 786 | ) |
| 787 | ); |
| 788 | do_action( 'everest_forms_inline_akismet_settings', $this, 'akismet', 'connection_1' ); |
| 789 | |
| 790 | do_action( 'everest_forms_inline_akismet_protection_type_settings', $this, 'akismet_protection_type', 'connection_1' ); |
| 791 | echo '</div>'; |
| 792 | echo '</div>'; |
| 793 | do_action( 'everest_forms_inline_security_settings', $this ); |
| 794 | echo '</div>'; |
| 795 | |
| 796 | do_action( 'everest_forms_settings_panel_content', $this ); |
| 797 | } |
| 798 | |
| 799 | /** |
| 800 | * Add Custom CSS and JS menu item to the builder settings list. |
| 801 | * |
| 802 | * @param [array] $arr Setting Menu items list. |
| 803 | * @param [array] $form_data Form Data. |
| 804 | * @return array |
| 805 | */ |
| 806 | public function add_custom_css_js_section( $arr, $form_data ) { |
| 807 | |
| 808 | $arr['custom-css-js'] = esc_html__( 'Custom CSS and JS', 'everest-forms' ); |
| 809 | if ( ! defined( 'EFP_PLUGIN_FILE' ) ) { |
| 810 | $pro_addons = array( |
| 811 | 'webhook' => esc_html__( 'WebHook', 'everest-forms' ), |
| 812 | 'form_restriction' => esc_html__( 'Form Restriction', 'everest-forms' ), |
| 813 | 'multi_part' => esc_html__( 'Multi Part', 'everest-forms' ), |
| 814 | 'pdf_submission' => esc_html__( 'PDF Submission', 'everest-forms' ), |
| 815 | 'post_submission' => esc_html__( 'Post Submission', 'everest-forms' ), |
| 816 | 'save_and_continue' => esc_html__( 'Save and Continue', 'everest-forms' ), |
| 817 | 'survey_polls_quiz' => esc_html__( 'Survey,Polls,Quiz', 'everest-forms' ), |
| 818 | 'user_registration' => esc_html__( 'User Registration', 'everest-forms' ), |
| 819 | 'conversation_forms' => esc_html__( 'Conversation Forms', 'everest-forms' ), |
| 820 | 'sms_notifications' => esc_html__( 'SMS Notifications', 'everest-forms' ), |
| 821 | ); |
| 822 | $arr = array_merge( $arr, $pro_addons ); |
| 823 | } |
| 824 | return $arr; |
| 825 | } |
| 826 | |
| 827 | /** |
| 828 | * Add Custom Css and Js settings section. |
| 829 | * |
| 830 | * @param [array] $form_data Form Data. |
| 831 | * @return void |
| 832 | */ |
| 833 | public function add_custom_css_js_settings( $form_data ) { |
| 834 | // --------------------------------------------------------------------// |
| 835 | // Custom CSS and JS |
| 836 | // --------------------------------------------------------------------// |
| 837 | echo '<div class="evf-content-section evf-content-custom-css-js-settings">'; |
| 838 | echo '<div class="evf-content-section-title">'; |
| 839 | esc_html_e( 'Custom CSS and JS', 'everest-forms' ); |
| 840 | echo '</div>'; |
| 841 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Custom CSS', 'everest-forms' ) . '</h4>'; |
| 842 | everest_forms_panel_field( |
| 843 | 'toggle', |
| 844 | 'settings', |
| 845 | 'evf-enable-custom-css', |
| 846 | $this->form_data, |
| 847 | esc_html__( 'Enable Custom CSS', 'everest-forms' ), |
| 848 | array( |
| 849 | 'default' => '0', |
| 850 | ) |
| 851 | ); |
| 852 | everest_forms_panel_field( |
| 853 | 'textarea', |
| 854 | 'settings', |
| 855 | 'evf-custom-css', |
| 856 | $this->form_data, |
| 857 | esc_html__( 'Custom CSS', 'everest-forms' ) |
| 858 | ); |
| 859 | echo '</div>'; |
| 860 | echo '<div class="everest-forms-border-container"><h4 class="everest-forms-border-container-title">' . esc_html__( 'Custom JS', 'everest-forms' ) . '</h4>'; |
| 861 | everest_forms_panel_field( |
| 862 | 'toggle', |
| 863 | 'settings', |
| 864 | 'evf-enable-custom-js', |
| 865 | $this->form_data, |
| 866 | esc_html__( 'Enable Custom JS', 'everest-forms' ), |
| 867 | array( |
| 868 | 'default' => '0', |
| 869 | ) |
| 870 | ); |
| 871 | everest_forms_panel_field( |
| 872 | 'textarea', |
| 873 | 'settings', |
| 874 | 'evf-custom-js', |
| 875 | $this->form_data, |
| 876 | esc_html__( 'Custom JS', 'everest-forms' ) |
| 877 | ); |
| 878 | echo '</div>'; |
| 879 | |
| 880 | echo '</div>'; |
| 881 | } |
| 882 | |
| 883 | /** |
| 884 | * Get all pages. |
| 885 | */ |
| 886 | public function get_all_pages() { |
| 887 | $pages = array(); |
| 888 | foreach ( get_pages() as $page ) { |
| 889 | $pages[ $page->ID ] = $page->post_title; |
| 890 | } |
| 891 | |
| 892 | return $pages; |
| 893 | } |
| 894 | } |
| 895 | |
| 896 | return new EVF_Builder_Settings(); |
| 897 |