PluginProbe
DecaLog / 4.4.0
DecaLog v4.4.0
3.0.2 3.1.0 3.10.0 3.2.0 3.3.0 3.4.0 3.4.1 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 3.7.1 3.8.0 3.9.0 3.9.1 4.0.0 4.1.0 4.2.0 4.3.0 4.3.1 4.4.0 4.5.0 All 75 releases
decalog / perfopsone / functions.php

functions.php in DecaLog 4.4.0, at perfopsone/functions.php

34 lines 869 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Global functions for Perfops One features.
4 *
5 * @package @package PerfOpsOne
6 * @author Pierre Lannoy <https://pierre.lannoy.fr/>.
7 * @since 2.0.0
8 */
9
10 global $wp_version;
11
12 use Decalog\System\Plugin;
13
14 if ( ! function_exists( 'poo_switch_autoupdate_callback' ) ) {
15 /**
16 * Ajax callback for autoupdate switching.
17 *
18 * @since 2.0.0
19 */
20 function poo_switch_autoupdate_callback() {
21 check_ajax_referer( 'poo-auto-update', 'nonce' );
22 $plugin = new Plugin( filter_input( INPUT_POST, 'plugin' ) );
23 if ( ! current_user_can( 'update_plugins' ) || ! wp_is_auto_update_enabled_for_type( 'plugin' ) || ( is_multisite() && ! is_network_admin() ) ) {
24 wp_die( 403 );
25 }
26 if ( $plugin->switch_auto_update() ) {
27 wp_die( 200 );
28 } else {
29 wp_die( 500 );
30 }
31 }
32 add_action( 'wp_ajax_poo_switch_autoupdate', 'poo_switch_autoupdate_callback' );
33 }
34