PluginProbe
Portfolio Block – show off your work with stunning layouts / trunk
Portfolio Block – show off your work with stunning layouts vtrunk
2.1.5 2.1.3 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1
portfolio-block / includes / rootPlugin / Ajax.php

Ajax.php in Portfolio Block – show off your work with stunning layouts trunk, at includes/rootPlugin/Ajax.php

34 lines 744 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace PFB;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit;
6 }
7
8 class Ajax {
9
10 function __construct() {
11 add_action('wp_ajax_pfb_get_blocks', [ $this, 'pfb_get_blocks' ]);
12
13 }
14 public function pfb_get_blocks(){
15 $nonce = sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ) ) ?? null;
16
17 if( !wp_verify_nonce( $nonce, 'pfb_admin_nonce' )){
18 wp_send_json_error( 'Invalid Request' );
19 }
20
21 $data = json_decode( stripslashes( $_POST['data'] ), true );
22 $db_data = get_option( 'pfb_disabled_blocks', [] );
23
24 if( !isset( $data ) && $db_data ){
25 wp_send_json_success( $db_data );
26 }
27
28 update_option( 'pfb_disabled_blocks', $data );
29 wp_send_json_success( $data );
30
31 }
32
33 }
34