'; if ( ! empty( $args['name'] ) && empty( $args['no_label'] ) ) { $output .= ''; $output .= ''; $output .= ''; } $output .= ''; $output .= $field; if ( ! empty( $args['desc_after'] ) ) { $output .= '
' . $args['desc_after'] . '
'; } $output .= '
'; $output .= ''; return $output; } /** * Missing Callback. * * If a function is missing for settings callbacks alert the user. * * @since 1.3.9 * * @param array $args Arguments passed by the setting. * * @return string */ function wpforms_settings_missing_callback( $args ) { return sprintf( /* translators: %s - ID of a setting. */ esc_html__( 'The callback function used for the %s setting is missing.', 'wpforms-lite' ), '' . wpforms_sanitize_key( $args['id'] ) . '' ); } /** * Settings content field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_content_callback( $args ) { return ! empty( $args['content'] ) ? $args['content'] : ''; } /** * Settings license field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_license_callback( $args ) { // Lite users don't need to worry about license keys. if ( ! wpforms()->pro || ! class_exists( 'WPForms_License', false ) ) { $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' ), array( 'a' => array( 'href' => array(), 'class' => array(), 'target' => array(), 'rel' => array(), ), 'strong' => array(), ) ), esc_url( wpforms_admin_upgrade_link( 'settings-license' ) ) ) . '

'; $output .= '

' . wp_kses( __( 'As a valued WPForms Lite user you receive 50% off, automatically applied at checkout!', 'wpforms-lite' ), array( 'strong' => array(), 'br' => array(), ) ) . '

'; $output .= '

' . esc_html__( 'Already purchased? Simply enter your license key below to connect with WPForms PRO!', 'wpforms-lite' ) . '

'; $output .= '

'; $output .= ''; $output .= ''; $output .= '

'; return $output; } $license = (array) get_option( 'wpforms_license', [] ); $key = ! empty( $license['key'] ) ? $license['key'] : ''; $type = ! empty( $license['type'] ) ? $license['type'] : ''; $is_valid_key = ! empty( $key ) && ( isset( $license['is_expired'] ) && $license['is_expired'] === false ) && ( isset( $license['is_disabled'] ) && $license['is_disabled'] === false ) && ( isset( $license['is_invalid'] ) && $license['is_invalid'] === false ); $output = ''; $output .= ''; $output .= ''; $output .= ''; // Offer option to deactivate the key. $class = empty( $key ) ? 'wpforms-hide' : ''; $output .= ''; // If we have previously looked up the license type, display it. $class = empty( $type ) ? 'wpforms-hide' : ''; $output .= '

' . sprintf( /* translators: $s - license type. */ esc_html__( 'Your license key level is %s.', 'wpforms-lite' ), '' . esc_html( ucwords( $type ) ) . '' ) . '

'; $output .= '

' . sprintf( /* translators: %s - Refresh link. */ esc_html__( 'If your license has been upgraded or is incorrect, then please %1$sforce a refresh%2$s.', 'wpforms-lite' ), '', '' ) . '

'; return $output; } /** * Settings text input field callback. * * @since 1.3.9 * * @param array $args * * @return string */ function wpforms_settings_text_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( $args['desc'] ) ) { $output .= '

' . wp_kses_post( $args['desc'] ) . '

'; } return $output; } /** * 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 = array( 'value' => wpforms_setting( $args['id'], $default ), 'name' => wpforms_sanitize_key( $args['id'] ), ); $data = ! empty( $args['data'] ) ? $args['data'] : array(); if ( ! empty( $args['attr'] ) ) { $attr = array_merge( $attr, $args['attr'] ); } $output = sprintf( '', wpforms_html_attributes( $id, array(), $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'] : array(); $attr = isset( $args['attr'] ) ? (array) $args['attr'] : array(); if ( $choices && ! empty( $args['search'] ) ) { $data['search'] = 'true'; } if ( ! empty( $args['placeholder'] ) ) { $data['placeholder'] = $args['placeholder']; } if ( $choices && ! empty( $args['multiple'] ) ) { $attr[] = 'multiple'; $select_name = $id . '[]'; } 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 ) : ''; $output = ''; if ( ! empty( $args['desc'] ) ) { $output .= '

' . wp_kses_post( $args['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 .= ''; $x ++; } if ( ! empty( $args['desc'] ) ) { $output .= '

' . wp_kses_post( $args['desc'] ) . '

'; } return $output; } /** * Settings image upload field callback. * * @since 1.3.9 * * @param array $args * * @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 .= ''; $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'] ); $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 = '
'; ob_start(); do_action( 'wpforms_settings_providers', $active, $providers ); $output .= ob_get_clean(); $output .= '
'; 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 = '
'; foreach ( $args['columns'] as $column ) { // Define default callback for this field type. $callback = ! empty( $column['type'] ) ? 'wpforms_settings_' . $column['type'] . '_callback' : ''; // Allow custom callback to be provided via arg. if ( ! empty( $column['callback'] ) ) { $callback = $column['callback']; } $output .= '
'; if ( ! empty( $column['name'] ) ) { $output .= ''; } if ( function_exists( $callback ) ) { $output .= call_user_func( $callback, $column ); } $output .= '
'; } $output .= '
'; return $output; }