PluginProbe
SimpleTOC – Table of Contents Block / 7.3.1
SimpleTOC – Table of Contents Block v7.3.1
7.4.0 7.3.1 7.2.0 7.3.0 7.1.1 7.1.0 7.0.10 7.0.9 7.0.8 7.0.7 7.0.6 7.0.4 7.0.5 5.0.21.1 5.0.22 5.0.23 5.0.24 5.0.25 5.0.25.1 5.0.27 5.0.28 5.0.29 5.0.3 5.0.30 5.0.31 All 161 releases
← All changes | simpletoc-admin-settings.php +0 -41 7.4.07.3.1 View file →
@@ -7,17 +7,8 @@
7 7
8 8 namespace MToensing\SimpleTOC;
9 9
10 10 /**
11 - * Whether scroll highlighting is enforced globally.
12 - *
13 - * @return bool
14 - */
15 -function simpletoc_scroll_spy_enabled() {
16 - return (bool) apply_filters( 'simpletoc_scroll_spy_enabled', (bool) get_option( 'simpletoc_scroll_spy_enabled', false ) );
17 -}
18 -
19 -/**
20 11 * Add SimpleTOC global settings page.
21 12 */
22 13 function simpletoc_add_settings_page() {
23 14 add_options_page(
@@ -82,20 +73,8 @@
82 73 if ( null === $box_style_enabled_filter ) {
83 74 register_setting( 'simpletoc_settings', 'simpletoc_box_style_enabled' );
84 75 }
85 76
86 - if ( null === apply_filters( 'simpletoc_scroll_spy_enabled', null ) ) {
87 - register_setting(
88 - 'simpletoc_settings',
89 - 'simpletoc_scroll_spy_enabled',
90 - array(
91 - 'type' => 'boolean',
92 - 'sanitize_callback' => 'rest_sanitize_boolean',
93 - 'default' => false,
94 - )
95 - );
96 - }
97 -
98 77 // Add settings sections and fields.
99 78 add_settings_section(
100 79 'simpletoc_wrapper_section',
101 80 esc_html__( 'Global settings', 'simpletoc' ),
@@ -136,16 +115,8 @@
136 115 'simpletoc_wrapper_section'
137 116 );
138 117
139 118 add_settings_field(
140 - 'simpletoc_scroll_spy_enabled',
141 - esc_html__( 'Force highlight current section', 'simpletoc' ),
142 - __NAMESPACE__ . '\simpletoc_scroll_spy_enabled_callback',
143 - 'simpletoc',
144 - 'simpletoc_wrapper_section'
145 - );
146 -
147 - add_settings_field(
148 119 'simpletoc_box_style_enabled',
149 120 esc_html__( 'Force box style', 'simpletoc' ),
150 121 __NAMESPACE__ . '\simpletoc_box_style_enabled_callback',
151 122 'simpletoc',
@@ -215,18 +186,6 @@
215 186 echo '<label for="simpletoc_box_style_enabled" class="description">' . esc_html__( 'Setting controlled by "simpletoc_box_style_enabled" filter. Remove filter to adjust setting.', 'simpletoc' ) . '</label>';
216 187 } else {
217 188 echo '<input type="checkbox" name="simpletoc_box_style_enabled" id="simpletoc_box_style_enabled" value="1" ' . checked( 1, $box_style_enabled, false ) . ' />';
218 189 echo '<label for="simpletoc_box_style_enabled" class="description">' . esc_html__( 'Applies the Box style with the default gray background to all SimpleTOC blocks.', 'simpletoc' ) . '</label>';
219 - }
220 -}
221 -
222 -/**
223 - * Scroll highlighting setting.
224 - */
225 -function simpletoc_scroll_spy_enabled_callback() {
226 - $controlled = null !== apply_filters( 'simpletoc_scroll_spy_enabled', null );
227 - echo '<input type="checkbox" name="simpletoc_scroll_spy_enabled" id="simpletoc_scroll_spy_enabled" value="1" ' . checked( true, simpletoc_scroll_spy_enabled(), false ) . disabled( $controlled, true, false ) . ' />';
228 - echo '<label for="simpletoc_scroll_spy_enabled" class="description">' . esc_html__( 'Underlines the current section link in all SimpleTOC blocks in supported browsers. No JavaScript fallback.', 'simpletoc' ) . '</label>';
229 - if ( $controlled ) {
230 - echo '<p class="description">' . esc_html__( 'Setting controlled by the simpletoc_scroll_spy_enabled filter.', 'simpletoc' ) . '</p>';
231 190 }
232 191 }