PluginProbe
Elementor Website Builder – more than just a page builder / 3.16.0-dev1
Elementor Website Builder – more than just a page builder v3.16.0-dev1
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / core / common / modules / connect / admin.php

admin.php in Elementor Website Builder – more than just a page builder 3.16.0-dev1, at core/common/modules/connect/admin.php

78 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Common\Modules\Connect;
3
4 use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
5 use Elementor\Plugin;
6 use Elementor\Settings;
7 use Elementor\Utils;
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit; // Exit if accessed directly.
11 }
12
13 class Admin {
14
15 const PAGE_ID = 'elementor-connect';
16
17 public static $url = '';
18
19 /**
20 * @since 2.3.0
21 * @access public
22 */
23 public function register_admin_menu( Admin_Menu_Manager $admin_menu ) {
24 $admin_menu->register( static::PAGE_ID, new Connect_Menu_Item() );
25 }
26
27 /**
28 * @since 2.3.0
29 * @access public
30 */
31 public function on_load_page() {
32 if ( isset( $_GET['action'], $_GET['app'] ) ) {
33 $manager = Plugin::$instance->common->get_component( 'connect' );
34
35 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
36 $app_slug = Utils::get_super_global_value( $_GET, 'app' );
37 $app = $manager->get_app( $app_slug );
38
39 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
40 $action = Utils::get_super_global_value( $_GET, 'action' );
41
42 $nonce_action = $app_slug . $action;
43
44 if ( ! $app ) {
45 wp_die( 'Unknown app: ' . esc_attr( $app_slug ) );
46 }
47
48 if ( ! wp_verify_nonce( Utils::get_super_global_value( $_GET, 'nonce' ), $nonce_action ) ) {
49 wp_die( 'Invalid Nonce', 'Invalid Nonce', [
50 'back_link' => true,
51 ] );
52 }
53
54 $method = 'action_' . $action;
55
56 if ( method_exists( $app, $method ) ) {
57 call_user_func( [ $app, $method ] );
58 }
59 }
60 }
61
62 /**
63 * @since 2.3.0
64 * @access public
65 */
66 public function __construct() {
67 self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID );
68
69 add_action( 'elementor/admin/menu/register', [ $this, 'register_admin_menu' ] );
70
71 add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) {
72 if ( ! empty( $hooks[ static::PAGE_ID ] ) ) {
73 add_action( 'load-' . $hooks[ static::PAGE_ID ], [ $this, 'on_load_page' ] );
74 }
75 }, 10, 2 );
76 }
77 }
78