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 / popup-builder / class-popup-builder-init.php

class-popup-builder-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/popup-builder/class-popup-builder-init.php

66 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Master Addons Popup Builder Initialization
4 *
5 * @package MasterAddons
6 * @subpackage PopupBuilder
7 */
8
9 namespace MasterAddons\Inc\Admin\PopupBuilder;
10
11 if (!defined('ABSPATH')) {
12 exit;
13 }
14
15 class Popup_Builder_Init {
16
17 private static $instance = null;
18
19 public static function get_instance() {
20 if (is_null(self::$instance)) {
21 self::$instance = new self();
22 }
23 return self::$instance;
24 }
25
26 private function __construct() {
27 add_action('init', [$this, 'initialize'], 1);
28 add_action('admin_init', [$this, 'admin_redirects']);
29 }
30
31 public function initialize() {
32 Popup_CPT::get_instance();
33 Popup_Admin::get_instance();
34 Popup_Shortcode::get_instance();
35 Elementor_Integration::get_instance();
36 Popup_Frontend::get_instance();
37 }
38
39 public function admin_redirects() {
40 // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only checks of WordPress-set admin query vars for redirect flow; no form data is processed.
41 global $pagenow;
42 $target_post_type = 'jltma_popup';
43 $redirect_url = admin_url('edit.php?post_type=jltma_popup');
44
45 if ('post.php' === $pagenow && isset($_GET['post'])) {
46 if (isset($_GET['action']) && in_array($_GET['action'], ['elementor', 'trash', 'delete', 'restore', 'untrash'], true)) {
47 return;
48 }
49 $post_id = absint($_GET['post']);
50 if ($post_id && $target_post_type === get_post_type($post_id)) {
51 wp_safe_redirect($redirect_url);
52 exit;
53 }
54 }
55
56 if ('post-new.php' === $pagenow && isset($_GET['post_type'])) {
57 $current_post_type = sanitize_key($_GET['post_type']);
58 if ($target_post_type === $current_post_type) {
59 wp_safe_redirect($redirect_url);
60 exit;
61 }
62 }
63 // phpcs:enable WordPress.Security.NonceVerification.Recommended
64 }
65 }
66