true ) ); } if ( null === $box_style_enabled_filter ) { register_setting( 'simpletoc_settings', 'simpletoc_box_style_enabled' ); } // Add settings sections and fields. add_settings_section( 'simpletoc_wrapper_section', esc_html__( 'Global settings', 'simpletoc' ), __NAMESPACE__ . '\simpletoc_wrapper_section_callback', 'simpletoc' ); add_settings_field( 'simpletoc_accordion_enabled', esc_html__( 'Force accordion menu', 'simpletoc' ), __NAMESPACE__ . '\simpletoc_accordion_enabled_callback', 'simpletoc', 'simpletoc_wrapper_section' ); add_settings_field( 'simpletoc_smooth_enabled', esc_html__( 'Force smooth scrolling', 'simpletoc' ), __NAMESPACE__ . '\simpletoc_smooth_enabled_callback', 'simpletoc', 'simpletoc_wrapper_section' ); add_settings_field( 'simpletoc_absolute_urls_enabled', esc_html__( 'Force absolute urls', 'simpletoc' ), __NAMESPACE__ . '\simpletoc_absolute_urls_enabled_callback', 'simpletoc', 'simpletoc_wrapper_section' ); // Add the autoupdate settings field. add_settings_field( 'simpletoc_autoupdate_enabled', esc_html__( 'Force no auto refresh', 'simpletoc' ), __NAMESPACE__ . '\simpletoc_autoupdate_enabled_callback', 'simpletoc', 'simpletoc_wrapper_section' ); add_settings_field( 'simpletoc_box_style_enabled', esc_html__( 'Force box style', 'simpletoc' ), __NAMESPACE__ . '\simpletoc_box_style_enabled_callback', 'simpletoc', 'simpletoc_wrapper_section' ); } add_action( 'admin_init', __NAMESPACE__ . '\simpletoc_register_settings' ); /** * SimpleTOC wrapper section callback. */ function simpletoc_wrapper_section_callback() { $donatelink = '' . esc_html__( 'Donate here!', 'simpletoc' ) . ''; echo '

' . esc_html__( 'Enforce these settings globally, ignoring any block-level configurations.', 'simpletoc' ) . '

' . esc_html__( 'Think about making a donation if you use any of these features.', 'simpletoc' ) . ' ' . $donatelink . '

'; } /** * SimpleTOC accordion enabled callback. */ function simpletoc_accordion_enabled_callback() { $accordion_enabled = get_option( 'simpletoc_accordion_enabled', false ); echo ''; echo ''; } /** * SimpleTOC smooth enabled callback. */ function simpletoc_smooth_enabled_callback() { $smooth_enabled = get_option( 'simpletoc_smooth_enabled', false ); echo ''; echo ''; } /** * SimpleTOC absolute urls enabled callback. */ function simpletoc_absolute_urls_enabled_callback() { $absolute_urls_enabled = get_option( 'simpletoc_absolute_urls_enabled', false ); echo ''; echo ''; } /** * SimpleTOC autoupdate enabled callback. */ function simpletoc_autoupdate_enabled_callback() { $autoupdate_enabled = get_option( 'simpletoc_autoupdate_enabled', false ); echo ''; echo ''; } /** * SimpleTOC box style enabled callback. */ function simpletoc_box_style_enabled_callback() { $box_style_enabled = get_option( 'simpletoc_box_style_enabled', false ); if ( has_filter( 'simpletoc_box_style_enabled' ) ) { echo ''; echo ''; } else { echo ''; echo ''; } }