PluginProbe
Elementor Website Builder – more than just a page builder / 3.7.5
Elementor Website Builder – more than just a page builder v3.7.5
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.7.5, at core/common/modules/connect/admin.php

69 lines 1.6 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
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit; // Exit if accessed directly.
10 }
11
12 class Admin {
13
14 const PAGE_ID = 'elementor-connect';
15
16 public static $url = '';
17
18 /**
19 * @since 2.3.0
20 * @access public
21 */
22 public function register_admin_menu( Admin_Menu_Manager $admin_menu ) {
23
24 $admin_menu->register( static::PAGE_ID, new Connect_Menu_Item() );
25
26 // TODO: Find a way to get the hook name from the register.
27 add_action( 'load-elementor_page_' . static::PAGE_ID, [ $this, 'on_load_page' ] );
28 }
29
30 /**
31 * @since 2.3.0
32 * @access public
33 */
34 public function on_load_page() {
35 if ( isset( $_GET['action'], $_GET['app'] ) ) {
36 $manager = Plugin::$instance->common->get_component( 'connect' );
37 $app_slug = $_GET['app'];
38 $app = $manager->get_app( $app_slug );
39 $nonce_action = $_GET['app'] . $_GET['action'];
40
41 if ( ! $app ) {
42 wp_die( 'Unknown app: ' . esc_attr( $app_slug ) );
43 }
44
45 if ( empty( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], $nonce_action ) ) {
46 wp_die( 'Invalid Nonce', 'Invalid Nonce', [
47 'back_link' => true,
48 ] );
49 }
50
51 $method = 'action_' . $_GET['action'];
52
53 if ( method_exists( $app, $method ) ) {
54 call_user_func( [ $app, $method ] );
55 }
56 }
57 }
58
59 /**
60 * @since 2.3.0
61 * @access public
62 */
63 public function __construct() {
64 self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID );
65
66 add_action( 'elementor/admin/menu/register', [ $this, 'register_admin_menu' ] );
67 }
68 }
69