'display:none;' ] : [] ); // Build standard field markup and return. $output = "
' . esc_html__( 'You\'re using WPForms Lite - no license needed. Enjoy!', 'wpforms-lite' ) . ' 🙂
'; $output .= '' . sprintf( wp_kses( /* translators: %s - WPForms.com upgrade URL. */ __( 'To unlock more features consider upgrading to PRO.', 'wpforms-lite' ), [ 'a' => [ 'href' => [], 'class' => [], 'target' => [], 'rel' => [], ], 'strong' => [], ] ), esc_url( wpforms_admin_upgrade_link( 'settings-license', 'Upgrade to WPForms Pro text Link' ) ) ) . '
'; $output .= '' . wp_kses( __( 'As a valued WPForms Lite user you receive 50% off, automatically applied at checkout!', 'wpforms-lite' ), [ 'strong' => [], ] ) . '
'; $output .= '' . esc_html__( 'Already purchased? Simply enter your license key below to enable WPForms PRO!', 'wpforms-lite' ) . '
'; $output .= ''; $output .= ''; $output .= ''; $output .= '
'; /** * Filter license settings HTML output. * * @since 1.7.9 * * @param string $output HTML markup to be rendered in place of license settings. */ return apply_filters( 'wpforms_settings_license_output', $output ); } /** * Settings text input field callback. * * @since 1.3.9 * * @param array $args Settings arguments. * * @return string */ function wpforms_settings_text_callback( $args ) { if ( ! in_array( $args['type'], [ 'text', 'password' ], true ) ) { $args['type'] = 'text'; } $default = isset( $args['default'] ) ? esc_html( $args['default'] ) : ''; $value = wpforms_setting( $args['id'], $default ); $id = wpforms_sanitize_key( $args['id'] ); $output = ''; if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Settings password input field callback. * * @since 1.8.4 * * @param array $args Setting field arguments. * * @return string */ function wpforms_settings_password_callback( $args ) { return wpforms_settings_text_callback( $args ); } /** * Settings number input field callback. * * @since 1.5.3 * * @param array $args Setting field arguments. * * @return string */ function wpforms_settings_number_callback( $args ) { $default = isset( $args['default'] ) ? esc_html( $args['default'] ) : ''; $id = 'wpforms-setting-' . wpforms_sanitize_key( $args['id'] ); $attr = [ 'value' => wpforms_setting( $args['id'], $default ), 'name' => wpforms_sanitize_key( $args['id'] ), ]; $data = ! empty( $args['data'] ) ? $args['data'] : []; if ( ! empty( $args['attr'] ) ) { $attr = array_merge( $attr, $args['attr'] ); } $output = sprintf( '', wpforms_html_attributes( $id, [], $data, $attr ) ); if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Settings select field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_select_callback( $args ) { $default = isset( $args['default'] ) ? esc_html( $args['default'] ) : ''; $value = wpforms_setting( $args['id'], $default ); $id = wpforms_sanitize_key( $args['id'] ); $select_name = $id; $class = ! empty( $args['choicesjs'] ) ? 'choicesjs-select' : ''; $choices = ! empty( $args['choicesjs'] ) ? true : false; $data = isset( $args['data'] ) ? (array) $args['data'] : []; $attr = isset( $args['attr'] ) ? (array) $args['attr'] : []; if ( $choices && ! empty( $args['search'] ) ) { $data['search'] = 'true'; } if ( ! empty( $args['placeholder'] ) ) { $data['placeholder'] = $args['placeholder']; } $size_attr = ''; if ( $choices && ! empty( $args['multiple'] ) ) { $attr[] = 'multiple'; $select_name = $id . '[]'; $size_attr = ' size="1"'; } foreach ( $data as $name => $val ) { $data[ $name ] = 'data-' . sanitize_html_class( $name ) . '="' . esc_attr( $val ) . '"'; } $data = implode( ' ', $data ); $attr = implode( ' ', array_map( 'sanitize_html_class', $attr ) ); $output = $choices ? '' : ''; $output .= ''; $output .= $choices ? '' : ''; if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Settings checkbox field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_checkbox_callback( $args ) { $value = wpforms_setting( $args['id'] ); $id = wpforms_sanitize_key( $args['id'] ); $checked = ! empty( $value ) ? checked( 1, $value, false ) : ''; $disabled = ! empty( $args['disabled'] ) ? ' disabled' : ''; $output = ''; if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } if ( ! empty( $args['disabled_desc'] ) ) { $output .= '' . wp_kses_post( $args['disabled_desc'] ) . '
'; } return $output; } /** * Settings radio field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_radio_callback( $args ) { $default = isset( $args['default'] ) ? esc_html( $args['default'] ) : ''; $value = wpforms_setting( $args['id'], $default ); $id = wpforms_sanitize_key( $args['id'] ); $output = ''; $x = 1; foreach ( $args['options'] as $option => $name ) { $checked = checked( $value, $option, false ); $output .= ''; $output .= ''; $output .= ''; $output .= ''; $x ++; } if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Email template endpoint field callback. * * @since 1.8.5 * * @param array $args Field arguments. * * @return string */ function wpforms_settings_email_template_callback( $args ) { $id = wpforms_sanitize_key( $args['id'] ); $is_pro = wpforms()->is_pro(); $output = ''; $x = 1; $education_args = [ 'name' => esc_html__( 'Email Templates', 'wpforms-lite' ), 'plural' => '1', 'action' => 'upgrade', ]; foreach ( $args['options'] as $option => $attrs ) { $checked = checked( $args['value'], $option, false ); $has_education = ! $is_pro && isset( $attrs['is_pro'] ) && $attrs['is_pro']; $class = [ 'wpforms-settings-field-radio-wrapper', 'wpforms-card-image' ]; $datas = []; // Add class and data attributes for education modal, if needed. if ( $has_education ) { $class[] = 'education-modal'; // This class is used for JS. $datas = $education_args; // This data is used for JS. } $output .= ''; $output .= ''; $output .= ''; $output .= ''; ++$x; } if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Settings toggle field callback. * * @since 1.7.4 * * @param array $args Arguments. * * @return string */ function wpforms_settings_toggle_callback( $args ) { $value = wpforms_setting( $args['id'] ); $id = wpforms_sanitize_key( $args['id'] ); $class = ! empty( $args['control-class'] ) ? $args['control-class'] : ''; $class .= ! empty( $args['is-important'] ) ? ' wpforms-important' : ''; $input_attr = ! empty( $args['input-attr'] ) ? $args['input-attr'] : ''; $default_args = [ 'control-class' => $class, ]; $args = wp_parse_args( $args, $default_args ); $output = wpforms_panel_field_toggle_control( $args, 'wpforms-setting-' . $id, $id, ! empty( $args['label'] ) ? $args['label'] : '', $value, $input_attr ); $desc_on = ! empty( $args['desc'] ) ? $args['desc'] : ''; $desc_on = ! empty( $args['desc-on'] ) ? $args['desc-on'] : $desc_on; $desc_off = ! empty( $args['desc-off'] ) ? $args['desc-off'] : ''; $output .= sprintf( '%2$s
', empty( $value ) && ! empty( $desc_off ) ? ' wpforms-hidden' : '', wp_kses_post( $desc_on ) ); if ( ! empty( $desc_off ) ) { $output .= sprintf( '%2$s
', empty( $value ) ? '' : ' wpforms-hidden', wp_kses_post( $desc_off ) ); } return $output; } /** * Settings image upload field callback. * * @since 1.3.9 * * @param array $args Arguments. * * @return string */ function wpforms_settings_image_callback( $args ) { $default = isset( $args['default'] ) ? esc_html( $args['default'] ) : ''; $value = wpforms_setting( $args['id'], $default ); $id = wpforms_sanitize_key( $args['id'] ); $output = ''; if ( ! empty( $value ) ) { $output .= ''; } $output .= ''; // Show the remove button if specified. if ( isset( $args['show_remove'] ) && $args['show_remove'] ) { $output .= ''; } $output .= ''; if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Settings color picker field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_color_callback( $args ) { $default = isset( $args['default'] ) ? esc_html( $args['default'] ) : ''; $value = wpforms_setting( $args['id'], $default ); $id = wpforms_sanitize_key( $args['id'] ); $data = isset( $args['data'] ) ? (array) $args['data'] : []; foreach ( $data as $name => $val ) { $data[ $name ] = 'data-' . sanitize_html_class( $name ) . '="' . esc_attr( $val ) . '"'; } $data = implode( ' ', $data ); $output = ''; if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Color scheme endpoint fieldset callback. * This function will output a fieldset with color picker inputs. * * @since 1.8.5 * * @param array $args Field arguments. * * @return string */ function wpforms_settings_color_scheme_callback( $args ) { $id = wpforms_sanitize_key( $args['id'] ); $value = wpforms_setting( $args['id'], [] ); $output = ''; foreach ( $args['colors'] as $color => $attrs ) { $data = isset( $attrs['data'] ) ? (array) $attrs['data'] : []; $default_value = isset( $data['fallback-color'] ) ? wpforms_sanitize_hex_color( $data['fallback-color'] ) : ''; $field_id = "{$id}-{$color}"; $field_value = isset( $value[ $color ] ) ? wpforms_sanitize_hex_color( $value[ $color ] ) : $default_value; $input_attributes = wpforms_html_attributes( "wpforms-setting-{$field_id}", [ 'wpforms-color-picker' ], $data, [ 'type' => 'text', 'name' => "{$id}[{$color}]", 'value' => esc_attr( $field_value ), ] ); $output .= ""; $output .= ''; } if ( ! empty( $args['desc'] ) ) { $output .= '' . wp_kses_post( $args['desc'] ) . '
'; } return $output; } /** * Settings providers field callback - this is for the Integrations tab. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_providers_callback( $args ) { $active = wpforms_get_providers_available(); $providers = wpforms_get_providers_options(); $output = '' . wp_kses_post( $args['desc'] ) . '
'; } } return $output; } /** * Settings field columns callback. * * @since 1.5.8 * * @param array $args Arguments passed by the setting. * * @return string */ function wpforms_settings_columns_callback( $args ) { if ( empty( $args['columns'] ) || ! is_array( $args['columns'] ) ) { return ''; } $output = '