[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: Fields.php
<?php namespace WPForms\Lite\Admin\Education\Builder; use WPForms\Admin\Education; use WPForms\Helpers\Form; /** * Builder/Fields Education for Lite. * * @since 1.6.6 */ class Fields extends Education\Builder\Fields { /** * Hooks. * * @since 1.6.6 */ public function hooks() { add_filter( 'wpforms_builder_fields_buttons', [ $this, 'add_fields' ], 500 ); add_filter( 'wpforms_builder_field_button_attributes', [ $this, 'fields_attributes' ], 100, 2 ); add_action( 'wpforms_field_options_after_advanced-options', [ $this, 'field_conditional_logic' ] ); add_action( 'wpforms_builder_panel_fields_panel_content_title_after', [ $this, 'form_preview_notice' ] ); } /** * Add fields. * * @since 1.6.6 * * @param array|mixed $fields Form fields. * * @return array */ public function add_fields( $fields ) { $fields = (array) $fields; foreach ( $fields as $group => $group_data ) { $edu_fields = $this->fields->get_by_group( $group ); $edu_fields = $this->fields->set_values( $edu_fields, 'class', 'education-modal', 'empty' ); foreach ( $edu_fields as $edu_field ) { // Skip if in the current group already exist field of this type. if ( ! empty( wp_list_filter( $group_data, [ 'type' => $edu_field['type'] ] ) ) ) { continue; } $addon = ! empty( $edu_field['addon'] ) ? $this->addons->get_addon( $edu_field['addon'] ) : []; if ( ! empty( $addon ) ) { $edu_field['license'] = $addon['license_level'] ?? ''; } $fields[ $group ]['fields'][] = $edu_field; } } return $fields; } /** * Display a conditional logic settings section for fields inside the form builder. * * @since 1.6.6 * * @param array $field Field data. */ public function field_conditional_logic( array $field ): void { // Certain fields don't support conditional logic. if ( in_array( $field['type'], [ 'pagebreak', 'divider', 'hidden' ], true ) ) { return; } ?> <div class="wpforms-field-option-group wpforms-field-option-group-conditionals"> <a href="#" class="wpforms-field-option-group-toggle education-modal" data-name="<?php esc_attr_e( 'Smart Conditional Logic', 'wpforms-lite' ); ?>" data-utm-content="Smart Conditional Logic"> <?php esc_html_e( 'Smart Logic', 'wpforms-lite' ); ?> </a> </div> <?php } /** * Adjust attributes on field buttons. * * @since 1.6.6 * * @param array|mixed $atts Button attributes. * @param array $field Button properties. * * @return array Attributes array. */ public function fields_attributes( $atts, $field ) { $atts = (array) $atts; $atts['data']['utm-content'] = ! empty( $field['name_en'] ) ? $field['name_en'] : ''; if ( ! empty( $field['class'] ) && $field['class'] === 'education-modal' ) { $atts['class'][] = 'wpforms-not-available'; } if ( empty( $field['addon'] ) ) { return $atts; } $addon = $this->addons->get_addon( $field['addon'] ); if ( empty( $addon ) ) { return $atts; } if ( ! empty( $addon['video'] ) ) { $atts['data']['video'] = $addon['video']; } if ( ! empty( $field['license'] ) ) { $atts['data']['license'] = $field['license']; } return $atts; } /** * The form preview Pro fields notice. * * @since 1.9.4 * * @param array $form_data Form data. * * @noinspection HtmlUnknownTarget */ public function form_preview_notice( array $form_data ): void { $dismissed = get_user_meta( get_current_user_id(), 'wpforms_dismissed', true ); $pro_fields = Form::get_form_pro_fields( $form_data ); $is_quiz_enabled = ! empty( $form_data['settings']['quiz']['enabled'] ); // Check whether the notice is dismissed OR the form doesn't contain Pro fields. if ( ! empty( $dismissed['edu-pro-fields-form-preview-notice'] ) || ( empty( $pro_fields ) && ! $is_quiz_enabled ) ) { return; } if ( $is_quiz_enabled ) { $this->print_quiz_notice(); return; } $content = sprintf( wp_kses( /* translators: %s - WPForms.com announcement page URL. */ __( 'They will not be present in the published form. <a href="%1$s" target="_blank" rel="noopener noreferrer">Upgrade now</a> to unlock these features.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), wpforms_admin_upgrade_link( 'Builder - Settings', 'AI Form - Pro Fields in Lite notice' ) ); $this->print_form_preview_notice( [ 'class' => 'wpforms-alert-warning', 'title' => esc_html__( 'Your Form Contains Pro Fields', 'wpforms-lite' ), 'content' => $content, 'dismiss_section' => 'pro-fields-form-preview-notice', ] ); } /** * Print the Quiz addon notice. * * @since 1.9.9 * * @noinspection HtmlUnknownTarget */ private function print_quiz_notice(): void { $content = sprintf( wp_kses( /* translators: %s - Upgrade license page URL. */ __( 'Quiz functionality will not be present in the published form. <a href="%1$s" target="_blank" rel="noopener noreferrer">Upgrade now</a> to unlock the Quiz Addon.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'target' => [], 'rel' => [], ], ] ), wpforms_admin_upgrade_link( 'Builder - Settings', 'AI Form - Quiz addon in Lite notice' ) ); $this->print_form_preview_notice( [ 'class' => 'wpforms-alert-warning', 'title' => esc_html__( 'Your Form Uses the Quiz Addon', 'wpforms-lite' ), 'content' => $content, 'dismiss_section' => 'quiz-form-preview-notice', ] ); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: webm021.cluster127.gra.hosting.ovh.net
Server IP: 10.127.20.21
PHP Version: 8.4.22
Server Software: Apache
System: Linux webm021.cluster127.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
HDD Total: 14.32 GB
HDD Free: 8.45 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
Exists
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: vcomplcotr
User ID (UID): 38697
Group ID (GID): 100
Script Owner UID: 38697
Current Dir Owner: 38697