PluginProbe
Faust.js / 1.0.2
Faust.js v1.0.2
1.8.12 1.8.11 1.4.1 1.8.0 1.8.8 1.8.9 trunk 0.7.0 0.7.1 0.7.10 0.7.11 0.7.3 0.7.4 0.7.5 0.7.6 0.7.7 0.7.8 0.7.9 0.8.0 0.8.1 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 All 40 releases
← All changes | includes/settings/callbacks.php +9 -73 trunk1.0.2 View file →
@@ -6,13 +6,8 @@
6 6 */
7 7
8 8 namespace WPE\FaustWP\Settings;
9 9
10 -use function WPE\FaustWP\Telemetry\get_telemetry_client_id;
11 -use function WPE\FaustWP\Utilities\{
12 - plugin_version,
13 -};
14 -
15 10 if ( ! defined( 'ABSPATH' ) ) {
16 11 exit;
17 12 }
18 13
@@ -43,9 +38,9 @@
43 38 <?php
44 39 printf(
45 40 /* translators: Link text */
46 41 esc_html__( 'See the %1$s Getting Started Documentation%2$s for more details.', 'faustwp' ),
47 - '<a href="https://faustjs.org/docs/how-to/basic-setup" target="_blank" rel="noopener noreferrer">',
42 + '<a href="https://faustjs.org/docs/getting-started" target="_blank" rel="noopener noreferrer">',
48 43 '</a>'
49 44 );
50 45 ?>
51 46 </p>
@@ -159,16 +154,8 @@
159 154 )
160 155 );
161 156
162 157 add_settings_field(
163 - 'remove_additional_menu_locations',
164 - __( 'Remove Additional Nav Menu Locations', 'faustwp' ),
165 - __NAMESPACE__ . '\\display_remove_additional_menu_locations_field',
166 - 'faustwp-settings',
167 - 'settings_section'
168 - );
169 -
170 - add_settings_field(
171 158 'enable_disable',
172 159 __( 'Features', 'faustwp' ),
173 160 __NAMESPACE__ . '\\display_enable_disable_fields',
174 161 'faustwp-settings',
@@ -194,14 +181,8 @@
194 181 function sanitize_faustwp_settings( $settings, $option ) {
195 182 $errors = null;
196 183 $protocols = array( 'http', 'https' );
197 184 foreach ( $settings as $name => $value ) {
198 - // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Nonce verified elsewhere.
199 - if ( ! isset( $settings['enable_telemetry'] ) && ! empty( $_POST['option_page'] ) && 'faustwp_settings' === $_POST['option_page'] ) {
200 - $reminder_time = new \DateTime( '+90 days', new \DateTimeZone( 'UTC' ) );
201 - $settings['telemetry_reminder'] = $reminder_time->getTimestamp();
202 - }
203 -
204 185 switch ( $name ) {
205 186 case 'frontend_uri':
206 187 if ( '' === $value || preg_match( '#http(s?)://(.+)#i', $value ) ) {
207 188 $settings[ $name ] = esc_url_raw( $value, $protocols );
@@ -221,9 +202,8 @@
221 202 case 'menu_locations':
222 203 $settings[ $name ] = sanitize_text_field( $value );
223 204 break;
224 205
225 - case 'remove_additional_menu_locations':
226 206 case 'enable_redirects':
227 207 case 'enable_rewrites':
228 208 case 'disable_theme':
229 209 case 'enable_image_source':
@@ -233,33 +213,11 @@
233 213 unset( $settings[ $name ] );
234 214 }
235 215 break;
236 216
237 - case 'enable_telemetry':
238 - if ( $value ) {
239 - $settings[ $name ] = sanitize_text_field( $value );
240 - } else {
241 - unset( $settings[ $name ] );
242 - }
243 - break;
244 - case 'telemetry_reminder':
245 - if ( $value ) {
246 - $settings[ $name ] = (int) $value;
247 - } else {
248 - unset( $settings[ $name ] );
249 - }
250 - break;
251 -
252 - case 'telemetry_client_id':
253 - if ( $value ) {
254 - $settings[ $name ] = sanitize_text_field( $value );
255 - }
256 - break;
257 -
258 217 default:
259 218 // Remove any settings we don't expect.
260 219 unset( $settings[ $name ] );
261 - break;
262 220 }
263 221 }
264 222
265 223 if ( null !== $errors && is_array( $errors ) ) {
@@ -338,25 +296,8 @@
338 296
339 297 /**
340 298 * Callback for WordPress add_settings_field() method parameter.
341 299 *
342 - * Display the "Remove Additional Menu Locations" checkbox field.
343 - *
344 - * @return void
345 - */
346 -function display_remove_additional_menu_locations_field() {
347 - $removed = faustwp_get_setting( 'remove_additional_menu_locations', false );
348 - ?>
349 - <label for="remove_additional_menu_locations">
350 - <input type="checkbox" id="remove_additional_menu_locations" name="faustwp_settings[remove_additional_menu_locations]" value="1" <?php checked( $removed ); ?> /><?php esc_html_e( 'Remove all Nav Menu locations that are not registered on this screen.', 'faustwp' ); ?>
351 - <p class="description"><?php esc_html_e( 'By checking this, the only Nav Menu locations will be the ones registered on this page. Leaving this un-checked will combine the menu locations on this page with menu locations registered by other plugins or themes. This has an impact on the nav menu manager in the WordPress admin and API access to menus.', 'faustwp' ); ?></p>
352 - </label>
353 - <?php
354 -}
355 -
356 -/**
357 - * Callback for WordPress add_settings_field() method parameter.
358 - *
359 300 * Display the "API Key" text field.
360 301 *
361 302 * Added hidden field to preserve value during settings save.
362 303 *
@@ -394,10 +335,10 @@
394 335 <p class="description">
395 336 <?php
396 337 printf(
397 338 /* translators: %s: Documentation URL. */
398 - wp_kses_post( __( 'This key is used to enable <a href="%s" target="_blank" rel="noopener noreferrer">headless post previews</a> and make authenticated GraphQL requests for schema generation.', 'faustwp' ) ),
399 - 'https://faustjs.org/docs/how-to/post-previews'
339 + wp_kses_post( __( 'This key is used to enable <a href="%s" target="_blank" rel="noopener noreferrer">headless post previews</a>.', 'faustwp' ) ),
340 + 'https://faustjs.org/docs/next/guides/post-page-previews'
400 341 );
401 342 ?>
402 343 </p>
403 344 <?php
@@ -432,9 +373,9 @@
432 373 $disable_theme = is_themes_disabled();
433 374 $enable_rewrites = is_rewrites_enabled();
434 375 $enable_redirects = is_redirects_enabled();
435 376 $enable_image_source = is_image_source_replacement_enabled();
436 - $enable_telemetry = is_telemetry_enabled();
377 +
437 378 ?>
438 379 <fieldset>
439 380 <legend style="margin-bottom:5px;padding:0;">
440 381 <p class="description">
@@ -441,9 +382,9 @@
441 382 <?php
442 383 printf(
443 384 /* translators: %s: Documentation URL. */
444 385 wp_kses_post( __( 'Learn more about <a href="%s" target="_blank" rel="noopener noreferrer">features</a>.', 'faustwp' ) ),
445 - 'https://faustjs.org/docs/how-to/basic-setup'
386 + 'https://faustjs.org/docs/faustwp/settings'
446 387 );
447 388 ?>
448 389 </p>
449 390 </legend>
@@ -468,15 +409,8 @@
468 409 <label for="enable_image_source">
469 410 <input type="checkbox" id="enable_image_source" name="faustwp_settings[enable_image_source]" value="1" <?php checked( $enable_image_source ); ?> />
470 411 <?php esc_html_e( 'Use the WordPress domain for media URLs in post content', 'faustwp' ); ?>
471 412 </label>
472 - <br />
473 -
474 - <label for="enable_telemetry">
475 - <input type="checkbox" id="enable_telemetry" name="faustwp_settings[enable_telemetry]" value="1" <?php checked( $enable_telemetry ); ?> />
476 - <?php esc_html_e( 'Enable anonymous telemetry', 'faustwp' ); ?>
477 - </label>
478 - <input type="hidden" id="telemetry_client_id" name="faustwp_settings[telemetry_client_id]" value="<?php echo esc_attr( get_telemetry_client_id() ); ?>" />
479 413 </fieldset>
480 414 <?php
481 415 }
482 416
@@ -498,13 +432,15 @@
498 432 *
499 433 * Callback for admin_enqueue_scripts.
500 434 */
501 435 function add_settings_assets() {
436 + $plugin = get_plugin_data( FAUSTWP_FILE );
437 +
502 438 wp_enqueue_style(
503 439 'faustwp-settings',
504 440 FAUSTWP_URL . 'includes/settings/assets/style.css',
505 441 array(),
506 - plugin_version()
442 + $plugin['Version']
507 443 );
508 444
509 445 if ( ! function_exists( 'graphql' ) ) {
510 446 wp_enqueue_script(
@@ -510,9 +446,9 @@
510 446 wp_enqueue_script(
511 447 'faustwp-wpgraphql-install',
512 448 FAUSTWP_URL . 'includes/settings/assets/js/wpgraphql-install.js',
513 449 array( 'wp-a11y', 'wp-api-fetch' ),
514 - plugin_version(),
450 + $plugin['Version'],
515 451 true
516 452 );
517 453
518 454 $faustwp = array(