PluginProbe
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder / 2.8.0
aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder v2.8.0
2.12.0 2.11.1 2.11.0 2.10.0 2.9.0 2.7.4 2.7.5 2.7.6 2.7.7 2.8.0 2.8.1 2.9.1 trunk 1.0 1.0-beta1 1.0-beta2 1.0-beta3 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 All 78 releases
ablocks / includes / ajax.php

ajax.php in aBlocks – Gutenberg Blocks, User Dashboard Builder, Popup Builder, Form Builder & Animation Builder 2.8.0, at includes/ajax.php

66 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace ABlocks;
4
5 use WP_Query;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 use ABlocks\Ajax\Settings;
12 use ABlocks\Ajax\Dashboard;
13 use ABlocks\Ajax\DemoImport;
14 use ABlocks\Ajax\DynamicContent;
15 use ABlocks\Ajax\FormBuilder;
16 use ABlocks\Ajax\Entry;
17 use ABlocks\Ajax\StripePaymentAjax;
18 use ABlocks\Ajax\EmailTemplate;
19 use ABlocks\Helper;
20
21 class Ajax {
22
23 public static function init() {
24 $self = new self();
25 $self->dispatch_hooks();
26 add_action( 'wp_ajax_ablocks/get_academy_terms', array( $self, 'get_academy_terms' ) );
27 add_action( 'wp_ajax_ablocks/get_storeengine_terms', array( $self, 'get_storeengine_terms' ) );
28 }
29 public function dispatch_hooks() {
30 ( new Dashboard() )->dispatch_actions();
31 ( new Settings() )->dispatch_actions();
32 ( new DynamicContent() )->dispatch_actions();
33 ( new FormBuilder() )->dispatch_actions();
34 ( new Entry() )->dispatch_actions();
35 ( new StripePaymentAjax() )->dispatch_actions();
36 ( new DemoImport() )->dispatch_actions();
37 ( new EmailTemplate() )->dispatch_actions();
38 }
39 public function get_academy_terms() {
40 check_ajax_referer( 'ablocks_nonce', 'security' );
41
42 if ( ! current_user_can( 'edit_posts' ) ) {
43 die();
44 }
45
46 $cats = Helper::get_terms_list( 'academy_courses_category' );
47 $tags = Helper::get_terms_list( 'academy_courses_tag' );
48
49 wp_send_json_success(array(
50 'categories' => $cats,
51 'tags' => $tags,
52 ), 200);
53 }
54
55 public function get_storeengine_terms() {
56 check_ajax_referer( 'ablocks_nonce', 'security' );
57 $cats = Helper::get_terms_list( 'storeengine_product_category' );
58 $tags = Helper::get_terms_list( 'storeengine_product_tag' );
59
60 wp_send_json_success(array(
61 'categories' => $cats,
62 'tags' => $tags,
63 ), 200);
64 }
65 }
66