array( 'href' => true, 'target' => true, 'title' => true, ), 'br' => array(), 'em' => array(), 'strong' => array(), 'code' => array(), ); /** * Prints all settings blocks. * * @param array{ * string: array{ * title: string, * premium_link?: string, * reset_button?: bool * } * } $tabs */ function print_settings_blocks( SettingsData $settings, array $tabs, string $context = 'settings-page' ): void { $settings = $settings->get_all(); foreach ( $settings as $key => $setting ) { if ( 'settings-page' === $context && empty( $setting->option ) ) { continue; } // remove default empty select option, its for the sc dialog only if ( 'settings-page' === $context && ! empty( $setting->options ) ) { $setting->remove_empty_select_option(); } if ( 'hidden' === $setting->ui ) { continue; } option_block( $key, $setting, $tabs ); } } /** * @param array{ * string: array{ * title: string, * premium_link?: string, * reset_button?: bool * } * } $tabs */ function option_block( string $key, SettingValidator $setting, array $tabs ): void { $input_id = 'ngt-option--' . $key; $tab = str_replace( '_', '-', $setting->tab ); ?>
" data-wp-bind--hidden="!state.isActiveTab" to_array() ); // phpcs:ignore ?> >
ui_element ) { label( $input_id, $setting, $tabs ); $textarea_html = sprintf( '', esc_textarea( (string) $setting->default ) ); echo first_tag_attr( $textarea_html, array( 'class' => 'large-text textarea--auto-expand', 'id' => $input_id, 'rows' => 2, 'data-wp-on--input' => 'actions.textareaChange', 'data-wp-bind--value' => 'state.options.' . esc_attr( $key ), 'placeholder' => $setting->placeholder ?? '', 'data-wp-bind--disabled' => 'state.isSaving', ) ); } elseif ( 'select' === $setting->ui_element ) { label( $input_id, $setting, $tabs ); ?> ui_element_type ) { echo first_tag_attr( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped '', array( 'type' => 'checkbox', 'id' => $input_id, 'data-wp-on--change' => 'actions.checkboxChange', 'data-wp-bind--checked' => "state.options.$key", 'placeholder' => $setting->placeholder, 'class' => 'form-check-input', 'data-wp-bind--disabled' => 'state.isSaving', ) ); label( $input_id, $setting, $tabs ); } else { label( $input_id, $setting, $tabs ); echo first_tag_attr( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped '', array( 'type' => $setting->ui_element_type, 'id' => $input_id, 'data-wp-on--keyup' => 'actions.inputChange', 'data-wp-on--change' => 'actions.inputChange', // 'data-arve-url' => ( 'url' === $key ), // TODO: remove // 'data-wp-context' => ( 'url' === $key ) ? 'url' : false, 'data-wp-bind--value' => "state.options.$key", 'placeholder' => $setting->placeholder, 'class' => ( 'license_key' === $setting->ui ) ? 'large-text text-large--ngt-key' : 'large-text', 'maxlength' => ( 'license_key' === $setting->ui ) ? 32 : false, 'data-wp-bind--readonly' => 'state.isSaving', 'readonly' => ( 'license_key' === $setting->ui && get_defined_key( $key ) ) ? 'readonly' : false, ) ); if ( 'license_key' === $setting->ui ) { license_key_ui( $key ); } if ( 'image_upload' === $setting->ui ) : wp_enqueue_media(); ?>
description ) ) : ?>

description, DESCRIPTION_ALLOWED_HTML, array( 'https' ) ); ?>


">
tab ]['premium_link'] ?? false; ?>