PluginProbe
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits / 3.1.2
Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits v3.1.2
3.2.2 3.2.3 3.2.1 3.2.0 3.1.9 3.1.8 3.1.7 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.9 trunk 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.3 1.1.4 1.1.5 All 174 releases
master-addons / inc / admin / widget-builder / rest-api-init.php

rest-api-init.php in Master Addons for Elementor – Elementor Addons, Widgets, Mega Menu Builder, Popup Builder, Widget Builder & Template Kits 3.1.2, at inc/admin/widget-builder/rest-api-init.php

37 lines 856 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Initialize REST API Controller
4 *
5 * @package MasterAddons
6 * @subpackage WidgetBuilder
7 */
8
9 namespace MasterAddons\Inc\Admin\WidgetBuilder;
10
11 if (!defined('ABSPATH')) {
12 exit;
13 }
14
15 /**
16 * Register REST API routes
17 */
18 \add_action('rest_api_init', function() {
19 $controller = new REST_Controller();
20 $controller->register_routes();
21 });
22
23 /**
24 * Flush rewrite rules on plugin activation or when routes change
25 * This ensures REST API endpoints are properly registered
26 */
27 \add_action('admin_init', function() {
28 // Check if we need to flush rewrite rules
29 $version_option = 'jltma_rest_api_version';
30 $current_version = '1.0.1'; // Increment this when REST routes change
31
32 if (get_option($version_option) !== $current_version) {
33 flush_rewrite_rules();
34 update_option($version_option, $current_version);
35 }
36 });
37