grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026constants(); $this->includes(); $this->init(); } /** * Setup plugin constants. * * @since 1.2.1 */ public function constants() { // Plugin Updater API. if ( ! defined( 'WPFORMS_UPDATER_API' ) ) { define( 'WPFORMS_UPDATER_API', 'https://wpforms.com/' ); } } /** * Include files. * * @since 1.0.0 */ private function includes() { require_once WPFORMS_PLUGIN_DIR . 'pro/includes/class-entry.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/class-entry-fields.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/class-entry-meta.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/class-conditional-logic-fields.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/payments/class-payment.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/payments/functions.php'; if ( is_admin() ) { require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/ajax-actions.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/entries/class-entries-single.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/entries/class-entries-list.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/class-addons.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/class-updater.php'; require_once WPFORMS_PLUGIN_DIR . 'pro/includes/admin/class-license.php'; } } /** * Hook in various places in WordPress and WPForms. * * @since 1.5.9 */ public function init() { add_action( 'plugins_loaded', array( $this, 'load_textdomain' ), 10 ); add_filter( 'plugin_action_links_' . plugin_basename( WPFORMS_PLUGIN_DIR . 'wpforms.php' ), array( $this, 'plugin_action_links' ), 11 ); add_action( 'wpforms_loaded', array( $this, 'objects' ), 1 ); add_action( 'wpforms_loaded', array( $this, 'updater' ), 30 ); add_action( 'wpforms_install', array( $this, 'install' ), 10 ); add_filter( 'wpforms_settings_tabs', array( $this, 'register_settings_tabs' ), 5, 1 ); add_filter( 'wpforms_settings_defaults', array( $this, 'register_settings_fields' ), 5, 1 ); add_action( 'wpforms_settings_init', array( $this, 'reinstall_custom_tables' ) ); add_action( 'wpforms_process_entry_save', array( $this, 'entry_save' ), 10, 4 ); add_action( 'wpforms_form_settings_general', array( $this, 'form_settings_general' ), 10 ); add_filter( 'wpforms_overview_table_columns', array( $this, 'form_table_columns' ), 10, 1 ); add_filter( 'wpforms_overview_table_column_value', array( $this, 'form_table_columns_value' ), 10, 3 ); add_action( 'wpforms_form_settings_notifications', array( $this, 'form_settings_notifications' ), 8, 1 ); add_action( 'wpforms_form_settings_confirmations', array( $this, 'form_settings_confirmations' ) ); add_filter( 'wpforms_builder_strings', array( $this, 'form_builder_strings' ), 10, 2 ); add_filter( 'wpforms_frontend_strings', array( $this, 'frontend_strings' ) ); add_action( 'admin_notices', array( $this, 'conditional_logic_addon_notice' ) ); add_action( 'wpforms_builder_print_footer_scripts', array( $this, 'builder_templates' ) ); add_filter( 'wpforms_email_footer_text', array( $this, 'form_notification_footer' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueues' ) ); add_filter( 'wpforms_helpers_templates_get_theme_template_paths', array( $this, 'add_templates' ) ); } /** * Setup objects. * * @since 1.2.1 */ public function objects() { // Global objects. wpforms()->entry = new WPForms_Entry_Handler(); wpforms()->entry_fields = new WPForms_Entry_Fields_Handler(); wpforms()->entry_meta = new WPForms_Entry_Meta_Handler(); if ( is_admin() ) { wpforms()->license = new WPForms_License(); } } /** * Load plugin updater. * * @since 1.0.0 */ public function updater() { if ( ! is_admin() ) { return; } $key = wpforms()->license->get(); if ( ! $key ) { return; } // Go ahead and initialize the updater. new \WPForms_Updater( array( 'plugin_name' => 'WPForms', 'plugin_slug' => 'wpforms', 'plugin_path' => plugin_basename( WPFORMS_PLUGIN_FILE ), 'plugin_url' => trailingslashit( WPFORMS_PLUGIN_URL ), 'remote_url' => WPFORMS_UPDATER_API, 'version' => WPFORMS_VERSION, 'key' => $key, ) ); // Fire a hook for Addons to register their updater since we know the key is present. do_action( 'wpforms_updater', $key ); } /** * Handle plugin installation upon activation. * * @since 1.2.1 */ public function install() { $wpforms_install = new stdClass(); $wpforms_install->entry = new WPForms_Entry_Handler(); $wpforms_install->entry_fields = new WPForms_Entry_Fields_Handler(); $wpforms_install->entry_meta = new WPForms_Entry_Meta_Handler(); $this->create_custom_tables( $wpforms_install ); // Tasks meta table. wpforms()->get( 'tasks_meta' )->create_table(); $license = get_option( 'wpforms_connect', false ); if ( $license ) { update_option( 'wpforms_license', array( 'key' => $license, ) ); $wpforms_install->license = new WPForms_License(); $wpforms_install->license->validate_key( $license ); delete_option( 'wpforms_connect' ); } } /** * Loads the separate PRO plugin translation file. * * @since 1.5.0 */ public function load_textdomain() { load_plugin_textdomain( 'wpforms', false, dirname( plugin_basename( WPFORMS_PLUGIN_FILE ) ) . '/pro/languages/' ); } /** * Add Pro-specific templates to the list of searchable template paths. * * @since 1.5.6 * * @param array $paths Paths to templates. * * @return array */ public function add_templates( $paths ) { $paths = (array) $paths; $paths[102] = trailingslashit( __DIR__ . '/templates' ); return $paths; } /** * Add custom links to the WPForms plugin row on Plugins page. * * @since 1.5.9 * * @param array $links Plugin row links. * * @return array */ public function plugin_action_links( $links ) { $custom = array(); if ( isset( $links['support'] ) ) { unset( $links['support'] ); } if ( isset( $links['settings'] ) ) { $custom['settings'] = $links['settings']; unset( $links['settings'] ); } $custom['docs'] = sprintf( '%3$s', 'https://wpforms.com/docs/', esc_attr__( 'Go to WPForms.com Docs page', 'wpforms' ), esc_html__( 'Docs', 'wpforms' ) ); $custom['support'] = sprintf( '%3$s', 'https://wpforms.com/account/support/', esc_attr__( 'Go to WPForms.com Support page', 'wpforms' ), esc_html__( 'Support', 'wpforms' ) ); return array_merge( $custom, (array) $links ); } /** * Register Pro settings tabs. * * @since 1.3.9 * * @param array $tabs Admin area tabs list. * * @return array */ public function register_settings_tabs( $tabs ) { // Add Payments tab. $payments = array( 'payments' => array( 'name' => esc_html__( 'Payments', 'wpforms' ), 'form' => true, 'submit' => esc_html__( 'Save Settings', 'wpforms' ), ), ); $tabs = wpforms_array_insert( $tabs, $payments, 'validation' ); return $tabs; } /** * Pro admin scripts and styles. * * @since 1.5.5 */ public function admin_enqueues() { if ( ! wpforms_is_admin_page() ) { return; } $min = wpforms_get_min_suffix(); // Pro admin styles. wp_enqueue_style( 'wpforms-pro-admin', WPFORMS_PLUGIN_URL . "pro/assets/css/admin{$min}.css", array(), WPFORMS_VERSION ); } /** * Register Pro settings fields. * * @since 1.3.9 * * @param array $settings Admin area settings list. * * @return array */ public function register_settings_fields( $settings ) { $currencies = wpforms_get_currencies(); $currency_option = array(); // Format currencies for select element. foreach ( $currencies as $code => $currency ) { $currency_option[ $code ] = sprintf( '%s (%s %s)', $currency['name'], $code, $currency['symbol'] ); } // Validation settings for fields only available in Pro. $settings['validation']['validation-phone'] = array( 'id' => 'validation-phone', 'name' => esc_html__( 'Phone', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'Please enter a valid phone number.', 'wpforms' ), ); $settings['validation']['validation-fileextension'] = array( 'id' => 'validation-fileextension', 'name' => esc_html__( 'File Extension', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'File type is not allowed.', 'wpforms' ), ); $settings['validation']['validation-filesize'] = array( 'id' => 'validation-filesize', 'name' => esc_html__( 'File Size', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'File exceeds max size allowed. File was not uploaded.', 'wpforms' ), ); $settings['validation']['validation-time12h'] = array( 'id' => 'validation-time12h', 'name' => esc_html__( 'Time (12 hour)', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'Please enter time in 12-hour AM/PM format (eg 8:45 AM).', 'wpforms' ), ); $settings['validation']['validation-time24h'] = array( 'id' => 'validation-time24h', 'name' => esc_html__( 'Time (24 hour)', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'Please enter time in 24-hour format (eg 22:45).', 'wpforms' ), ); $settings['validation']['validation-requiredpayment'] = array( 'id' => 'validation-requiredpayment', 'name' => esc_html__( 'Payment Required', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'Payment is required.', 'wpforms' ), ); $settings['validation']['validation-creditcard'] = array( 'id' => 'validation-creditcard', 'name' => esc_html__( 'Credit Card', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'Please enter a valid credit card number.', 'wpforms' ), ); $settings['validation']['validation-post_max_size'] = array( 'id' => 'validation-post_max_size', 'name' => esc_html__( 'File Upload Total Size', 'wpforms' ), 'type' => 'text', 'default' => esc_html__( 'The total size of the selected files {totalSize} Mb exceeds the allowed limit {maxSize} Mb.', 'wpforms' ), ); // Payment settings. $settings['payments']['payments-heading'] = array( 'id' => 'payments-heading', 'content' => '

' . esc_html__( 'Payments', 'wpforms' ) . '

', 'type' => 'content', 'no_label' => true, 'class' => array( 'section-heading', 'no-desc' ), ); $settings['payments']['currency'] = array( 'id' => 'currency', 'name' => esc_html__( 'Currency', 'wpforms' ), 'type' => 'select', 'choicesjs' => true, 'search' => true, 'default' => 'USD', 'options' => $currency_option, ); // Additional GDPR related options. $settings['general'] = wpforms_array_insert( $settings['general'], array( 'gdpr-disable-uuid' => array( 'id' => 'gdpr-disable-uuid', 'name' => esc_html__( 'Disable User Cookies', 'wpforms' ), 'desc' => esc_html__( 'Check this to disable user tracking cookies (UUIDs). This will disable the Related Entries feature and the Form Abandonment/Geolocation addons.', 'wpforms' ), 'type' => 'checkbox', ), 'gdpr-disable-details' => array( 'id' => 'gdpr-disable-details', 'name' => esc_html__( 'Disable User Details', 'wpforms' ), 'desc' => esc_html__( 'Check this to disable storing the IP address and User Agent on all forms. If unchecked this can be managed on a form by form basis inside the form settings.', 'wpforms' ), 'type' => 'checkbox', ), ), 'gdpr' ); return $settings; } /** * Save entry to database. * * @since 1.2.1 * * @param array $fields List of form fields. * @param array $entry User submitted data. * @param int|string $form_id Form ID. * @param array $form_data Prepared form settings. */ public function entry_save( $fields, $entry, $form_id, $form_data = array() ) { // Check if form has entries disabled. if ( isset( $form_data['settings']['disable_entries'] ) ) { return; } // Provide the opportunity to override via a filter. if ( ! apply_filters( 'wpforms_entry_save', true, $fields, $entry, $form_data ) ) { return; } $fields = apply_filters( 'wpforms_entry_save_data', $fields, $entry, $form_data ); $user_id = is_user_logged_in() ? get_current_user_id() : 0; $user_ip = wpforms_get_ip(); $user_agent = ! empty( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 256 ) : ''; $user_uuid = ! empty( $_COOKIE['_wpfuuid'] ) ? $_COOKIE['_wpfuuid'] : ''; $date = date( 'Y-m-d H:i:s' ); // If GDPR enhancements are enabled and user details are disabled // globally or in the form settings, discard the IP and UA. if ( ( wpforms_setting( 'gdpr', false ) && ( wpforms_setting( 'gdpr-disable-details', false ) || ! empty( $form_data['settings']['disable_ip'] ) ) ) || ! apply_filters( 'wpforms_disable_entry_user_ip', '__return_false', $fields, $form_data ) ) { $user_agent = ''; $user_ip = ''; } $entry_args = apply_filters( 'wpforms_entry_save_args', array( 'form_id' => absint( $form_id ), 'user_id' => absint( $user_id ), 'fields' => wp_json_encode( $fields ), 'ip_address' => sanitize_text_field( $user_ip ), 'user_agent' => sanitize_text_field( $user_agent ), 'date' => $date, 'user_uuid' => sanitize_text_field( $user_uuid ), ), $form_data ); // Create entry. $entry_id = wpforms()->entry->add( $entry_args ); // Create fields. if ( $entry_id ) { foreach ( $fields as $field ) { $field = apply_filters( 'wpforms_entry_save_fields', $field, $form_data, $entry_id ); if ( isset( $field['value'] ) && '' !== $field['value'] ) { wpforms()->entry_fields->add( array( 'entry_id' => $entry_id, 'form_id' => absint( $form_id ), 'field_id' => absint( $field['id'] ), 'value' => $field['value'], 'date' => $date, ) ); } } } wpforms()->process->entry_id = $entry_id; } /** * Add additional form settings to the General section. * * @since 1.2.1 * * @param \WPForms_Builder_Panel_Settings $instance Settings management panel instance. */ public function form_settings_general( $instance ) { // Only provide this option if the user has configured payments. if ( isset( $instance->form_data['settings']['disable_entries'] ) || ( empty( $instance->form_data['payments']['paypal_standard']['enable'] ) || empty( $instance->form_data['payments']['stripe']['enable'] ) ) ) { wpforms_panel_field( 'checkbox', 'settings', 'disable_entries', $instance->form_data, esc_html__( 'Disable storing entry information in WordPress', 'wpforms' ) ); } // Only provide this option if GDPR enhancements are enabled and user // details are not disabled globally. if ( wpforms_setting( 'gdpr', false ) && ! wpforms_setting( 'gdpr-disable-details', false ) ) { wpforms_panel_field( 'checkbox', 'settings', 'disable_ip', $instance->form_data, esc_html__( 'Disable storing user details (IP address and user agent)', 'wpforms' ) ); } } /** * Add entry counts column to form table. * * @since 1.2.1 * * @param array $columns List of table columns. * * @return array */ public function form_table_columns( $columns ) { if ( ! wpforms_current_user_can( 'view_entries' ) ) { return $columns; } $columns['entries'] = esc_html__( 'Entries', 'wpforms' ); return $columns; } /** * Add entry counts value to entry count column. * * @since 1.2.1 * * @param string $value * @param object $form * @param string $column_name * * @return string */ public function form_table_columns_value( $value, $form, $column_name ) { if ( 'entries' !== $column_name ) { return $value; } if ( ! wpforms_current_user_can( 'view_entries_form_single', $form->ID ) ) { return '-'; } $count = wpforms()->entry->get_entries( array( 'form_id' => $form->ID, ), true ); $value = sprintf( '%d', add_query_arg( array( 'view' => 'list', 'form_id' => $form->ID, ), admin_url( 'admin.php?page=wpforms-entries' ) ), $count ); return $value; } /** * Form notification settings, supports multiple notifications. * * @since 1.2.3 * * @param object $settings */ public function form_settings_notifications( $settings ) { $cc = wpforms_setting( 'email-carbon-copy', false ); $form_settings = ! empty( $settings->form_data['settings'] ) ? $settings->form_data['settings'] : array(); $notifications = is_array( $form_settings ) && isset( $form_settings['notifications'] ) ? $form_settings['notifications'] : array(); $from_name_after = apply_filters( 'wpforms_builder_notifications_from_name_after', '' ); $from_email_after = apply_filters( 'wpforms_builder_notifications_from_email_after', '' ); // Fetch next ID and handle backwards compatibility. if ( empty( $notifications ) ) { $next_id = 2; /* translators: %s - form name. */ $notifications[1]['subject'] = ! empty( $form_settings['notification_subject'] ) ? $form_settings['notification_subject'] : sprintf( esc_html__( 'New %s Entry', 'wpforms' ), $settings->form->post_title ); $notifications[1]['email'] = ! empty( $form_settings['notification_email'] ) ? $form_settings['notification_email'] : '{admin_email}'; $notifications[1]['sender_name'] = ! empty( $form_settings['notification_fromname'] ) ? $form_settings['notification_fromname'] : get_bloginfo( 'name' ); $notifications[1]['sender_address'] = ! empty( $form_settings['notification_fromaddress'] ) ? $form_settings['notification_fromaddress'] : '{admin_email}'; $notifications[1]['replyto'] = ! empty( $form_settings['notification_replyto'] ) ? $form_settings['notification_replyto'] : ''; } else { $next_id = max( array_keys( $notifications ) ) + 1; } echo '
'; esc_html_e( 'Notifications', 'wpforms' ); echo ''; echo '
'; wpforms_panel_field( 'select', 'settings', 'notification_enable', $settings->form_data, esc_html__( 'Notifications', 'wpforms' ), array( 'default' => '1', 'options' => array( '1' => esc_html__( 'On', 'wpforms' ), '0' => esc_html__( 'Off', 'wpforms' ), ), ) ); foreach ( $notifications as $id => $notification ) { $name = ! empty( $notification['notification_name'] ) ? $notification['notification_name'] : esc_html__( 'Default Notification', 'wpforms' ); $closed_state = ''; $toggle_state = ''; if ( ! empty( $settings->form_data['id'] ) && 'closed' === wpforms_builder_settings_block_get_state( $settings->form_data['id'], $id, 'notification' ) ) { $closed_state = 'style="display:none"'; $toggle_state = ''; } do_action( 'wpforms_form_settings_notifications_single_before', $settings, $id ); ?>
> form_data, esc_html__( 'Send To Email Address', 'wpforms' ), array( 'default' => '{admin_email}', 'tooltip' => esc_html__( 'Enter the email address to receive form entry notifications. For multiple notifications, separate email addresses with a comma.', 'wpforms' ), 'smarttags' => array( 'type' => 'fields', 'fields' => 'email', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-email-' . $id, 'class' => 'email-recipient', ) ); if ( $cc ) : wpforms_panel_field( 'text', 'notifications', 'carboncopy', $settings->form_data, esc_html__( 'CC', 'wpforms' ), array( 'smarttags' => array( 'type' => 'fields', 'fields' => 'email', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-carboncopy-' . $id, ) ); endif; wpforms_panel_field( 'text', 'notifications', 'subject', $settings->form_data, esc_html__( 'Email Subject', 'wpforms' ), array( /* translators: %s - form name. */ 'default' => sprintf( esc_html__( 'New Entry: %s', 'wpforms' ), $settings->form->post_title ), 'smarttags' => array( 'type' => 'all', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-subject-' . $id, ) ); wpforms_panel_field( 'text', 'notifications', 'sender_name', $settings->form_data, esc_html__( 'From Name', 'wpforms' ), array( 'default' => sanitize_text_field( get_option( 'blogname' ) ), 'smarttags' => array( 'type' => 'fields', 'fields' => 'name,text', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-sender_name-' . $id, 'readonly' => ! empty( $from_name_after ), 'after' => ! empty( $from_name_after ) ? '

' . $from_name_after . '

' : '', ) ); wpforms_panel_field( 'text', 'notifications', 'sender_address', $settings->form_data, esc_html__( 'From Email', 'wpforms' ), array( 'default' => '{admin_email}', 'smarttags' => array( 'type' => 'fields', 'fields' => 'email', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-sender_address-' . $id, 'readonly' => ! empty( $from_email_after ), 'after' => ! empty( $from_email_after ) ? '

' . $from_email_after . '

' : '', ) ); wpforms_panel_field( 'text', 'notifications', 'replyto', $settings->form_data, esc_html__( 'Reply-To', 'wpforms' ), array( 'smarttags' => array( 'type' => 'fields', 'fields' => 'email', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-replyto-' . $id, ) ); wpforms_panel_field( 'textarea', 'notifications', 'message', $settings->form_data, esc_html__( 'Message', 'wpforms' ), array( 'rows' => 6, 'default' => '{all_fields}', 'smarttags' => array( 'type' => 'all', ), 'parent' => 'settings', 'subsection' => $id, 'input_id' => 'wpforms-panel-field-notifications-message-' . $id, 'class' => 'email-msg', /* translators: %s - all fields smart tag. */ 'after' => '

' . sprintf( esc_html__( 'To display all form fields, use the %s Smart Tag.', 'wpforms' ), '{all_fields}' ) . '

', ) ); wpforms_conditional_logic()->builder_block( array( 'form' => $settings->form_data, 'type' => 'panel', 'panel' => 'notifications', 'parent' => 'settings', 'subsection' => $id, 'actions' => array( 'go' => esc_html__( 'Send', 'wpforms' ), 'stop' => esc_html__( 'Don\'t send', 'wpforms' ), ), 'action_desc' => esc_html__( 'this notification if', 'wpforms' ), 'reference' => esc_html__( 'Email notifications', 'wpforms' ), ) ); // Hook for addons. do_action( 'wpforms_form_settings_notifications_single_after', $settings, $id ); ?>
form_data['settings'] ) ? $settings->form_data['settings'] : array(); $confirmations = is_array( $form_settings ) && isset( $form_settings['confirmations'] ) ? $form_settings['confirmations'] : array(); // Fetch next ID and handle backwards compatibility. if ( empty( $confirmations ) ) { $next_id = 2; $confirmations[1]['type'] = ! empty( $form_settings['confirmation_type'] ) ? $form_settings['confirmation_type'] : 'message'; $confirmations[1]['message'] = ! empty( $form_settings['confirmation_message'] ) ? $form_settings['confirmation_message'] : esc_html__( 'Thanks for contacting us! We will be in touch with you shortly.', 'wpforms' ); $confirmations[1]['message_scroll'] = ! empty( $form_settings['confirmation_message_scroll'] ) ? $form_settings['confirmation_message_scroll'] : 1; $confirmations[1]['page'] = ! empty( $form_settings['confirmation_page'] ) ? $form_settings['confirmation_page'] : ''; $confirmations[1]['redirect'] = ! empty( $form_settings['confirmation_redirect'] ) ? $form_settings['confirmation_redirect'] : ''; $settings->form_data['settings']['confirmations'] = $confirmations; } else { $next_id = max( array_keys( $confirmations ) ) + 1; } $default_confirmation_key = min( array_keys( $confirmations ) ); echo '
'; esc_html_e( 'Confirmations', 'wpforms' ); echo ''; echo '
'; foreach ( $confirmations as $id => $confirmation ) { $name = ! empty( $confirmation['name'] ) ? $confirmation['name'] : esc_html__( 'Default Confirmation', 'wpforms' ); $closed_state = ''; $toggle_state = ''; $block_classes = 'wpforms-confirmation wpforms-builder-settings-block'; if ( $default_confirmation_key === $id ) { $block_classes .= ' wpforms-confirmation-default'; } if ( ! empty( $settings->form_data['id'] ) && 'closed' === wpforms_builder_settings_block_get_state( $settings->form_data['id'], $id, 'confirmation' ) ) { $closed_state = 'style="display:none"'; $toggle_state = ''; } do_action( 'wpforms_form_settings_confirmations_single_before', $settings, $id ); ?>
> form_data, esc_html__( 'Confirmation Type', 'wpforms' ), array( 'default' => 'message', 'options' => array( 'message' => esc_html__( 'Message', 'wpforms' ), 'page' => esc_html__( 'Show Page', 'wpforms' ), 'redirect' => esc_html__( 'Go to URL (Redirect)', 'wpforms' ), ), 'class' => 'wpforms-panel-field-confirmations-type-wrap', 'input_id' => 'wpforms-panel-field-confirmations-type-' . $id, 'input_class' => 'wpforms-panel-field-confirmations-type', 'parent' => 'settings', 'subsection' => $id, ) ); wpforms_panel_field( 'textarea', 'confirmations', 'message', $settings->form_data, esc_html__( 'Confirmation Message', 'wpforms' ), array( 'default' => esc_html__( 'Thanks for contacting us! We will be in touch with you shortly.', 'wpforms' ), 'tinymce' => array( 'editor_height' => '200', ), 'input_id' => 'wpforms-panel-field-confirmations-message-' . $id, 'input_class' => 'wpforms-panel-field-confirmations-message', 'parent' => 'settings', 'subsection' => $id, ) ); wpforms_panel_field( 'checkbox', 'confirmations', 'message_scroll', $settings->form_data, esc_html__( 'Automatically scroll to the confirmation message', 'wpforms' ), array( 'input_id' => 'wpforms-panel-field-confirmations-message_scroll-' . $id, 'input_class' => 'wpforms-panel-field-confirmations-message_scroll', 'parent' => 'settings', 'subsection' => $id, ) ); $p = array(); $pages = get_pages(); foreach ( $pages as $page ) { $depth = count( $page->ancestors ); $p[ $page->ID ] = str_repeat( '-', $depth ) . ' ' . $page->post_title; } wpforms_panel_field( 'select', 'confirmations', 'page', $settings->form_data, esc_html__( 'Confirmation Page', 'wpforms' ), array( 'options' => $p, 'input_id' => 'wpforms-panel-field-confirmations-page-' . $id, 'input_class' => 'wpforms-panel-field-confirmations-page', 'parent' => 'settings', 'subsection' => $id, ) ); wpforms_panel_field( 'text', 'confirmations', 'redirect', $settings->form_data, esc_html__( 'Confirmation Redirect URL', 'wpforms' ), array( 'input_id' => 'wpforms-panel-field-confirmations-redirect-' . $id, 'input_class' => 'wpforms-panel-field-confirmations-redirect', 'parent' => 'settings', 'subsection' => $id, ) ); wpforms_conditional_logic()->builder_block( array( 'form' => $settings->form_data, 'type' => 'panel', 'panel' => 'confirmations', 'parent' => 'settings', 'subsection' => $id, 'actions' => array( 'go' => esc_html__( 'Use', 'wpforms' ), 'stop' => esc_html__( 'Don\'t use', 'wpforms' ), ), 'action_desc' => esc_html__( 'this confirmation if', 'wpforms' ), 'reference' => esc_html__( 'Form confirmations', 'wpforms' ), ) ); do_action_deprecated( 'wpforms_form_settings_confirmation', array( $settings ), '1.4.8 of WPForms plugin', 'wpforms_form_settings_confirmations_single_after' ); // Hook for addons. do_action( 'wpforms_form_settings_confirmations_single_after', $settings, $id ); ?>

'; printf( wp_kses( /* translators: %s - WPForms.com announcement page URL. */ __( 'Conditional logic functionality is now included in the core WPForms plugin! The WPForms Conditional Logic addon can be removed without affecting your forms. For more details read our announcement.', 'wpforms' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ), 'https://wpforms.com/announcing-wpforms-1-3-8/' ); echo '

'; } } /** * Used to register the templates for setting blocks inside form builder. * * @since 1.4.8 */ public function builder_templates() { $conditional_logic_tooltip = '' . esc_html__( 'How to use Conditional Logic', 'wpforms' ) . ''; ?> your WPForms.com account to renew your license.', 'wpforms' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'rel' => array(), ), ) ), 'https://wpforms.com/account/' ); return $notice . '

' . $text; } /** * Get the list of all custom tables starting with `wpforms_*`. * * @since 1.5.9 * * @return array List of table names. */ public function get_existing_custom_tables() { global $wpdb; $tables = $wpdb->get_results( "SHOW TABLES LIKE '" . $wpdb->prefix . "wpforms_%'", 'ARRAY_N' ); // phpcs:ignore return ! empty( $tables ) ? wp_list_pluck( $tables, 0 ) : array(); } /** * Check if all custom tables exist. * * @since 1.5.9 * * @return bool True if all custom tables exist. False if any is missing. */ public function custom_tables_exist() { global $wpdb; $custom_tables = array( 'wpforms_entries', 'wpforms_entry_fields', 'wpforms_entry_meta', ); $tables = $this->get_existing_custom_tables(); foreach ( $custom_tables as $table ) { if ( ! in_array( $wpdb->prefix . $table, $tables, true ) ) { return false; } } return true; } /** * Create all Pro plugin custom DB tables. * * @since 1.5.9 * * @param stdClass|bool $wpforms_install WPForms install object. */ public function create_custom_tables( $wpforms_install = false ) { if ( empty( $wpforms_install ) ) { $wpforms_install = new stdClass(); $wpforms_install->entry = new WPForms_Entry_Handler(); $wpforms_install->entry_fields = new WPForms_Entry_Fields_Handler(); $wpforms_install->entry_meta = new WPForms_Entry_Meta_Handler(); } // Entry tables. $wpforms_install->entry->create_table(); $wpforms_install->entry_fields->create_table(); $wpforms_install->entry_meta->create_table(); } /** * Re-create plugin custom tables if don't exist. * * @since 1.5.9 * * @param \WPForms_Settings $wpforms_settings WPForms settings object. */ public function reinstall_custom_tables( $wpforms_settings ) { if ( empty( $wpforms_settings->view ) ) { return; } // Check and create custom DB tables. if ( $wpforms_settings->view === 'general' && ! $this->custom_tables_exist() ) { $this->create_custom_tables(); } } } return new WPForms_Pro();