PluginProbe
Force Refresh / 2.1.4
Force Refresh v2.1.4
3.2.1 3.2.0 3.1.2 3.1.1 3.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.12.0 All 54 releases
force-refresh / includes / actions / admin / inc.save-options.php

inc.save-options.php in Force Refresh 2.1.4, at includes/actions/admin/inc.save-options.php

43 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Our action for saving options from the admin page.
4 *
5 * @package ForceRefresh
6 */
7
8 namespace JordanLeven\Plugins\ForceRefresh;
9
10 /**
11 * Hook used to save admin actions for Force Refresh.
12 */
13 add_action(
14 'admin_init',
15 function () {
16 // If we are saving data from the Force Refresh options.
17 if (
18 isset( $_POST['force-refresh-admin-options-save'] ) &&
19 'true' === $_POST['force-refresh-admin-options-save']
20 ) {
21 check_admin_referer( WP_FORCE_REFRESH_ACTION, 'nonce' );
22 // Get updated options for viewing the refresh button in the WP Admin bar.
23 $show_in_admin_bar = isset( $_POST['show-in-wp-admin-bar'] )
24 ? sanitize_text_field(
25 wp_unslash( $_POST['show-in-wp-admin-bar'] )
26 ) : false;
27 // Update the show in Admin Bar option.
28 update_option( WP_FORCE_REFRESH_OPTION_SHOW_IN_WP_ADMIN_BAR, $show_in_admin_bar );
29 // Get updated options for the refresh interval.
30 $refresh_interval = isset( $_POST['refresh-interval'] )
31 ? sanitize_text_field( wp_unslash( $_POST['refresh-interval'] ) ) : null;
32 // If the new refresh interval option came through all right.
33 if ( $refresh_interval ) {
34 // Update the refresh interval.
35 update_option(
36 WP_FORCE_REFRESH_OPTION_REFRESH_INTERVAL_IN_SECONDS,
37 $refresh_interval
38 );
39 }
40 }
41 }
42 );
43