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

71 lines 1.7 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 $admin_menu->register( static::PAGE_ID, new Connect_Menu_Item() );
24 }
25
26 /**
27 * @since 2.3.0
28 * @access public
29 */
30 public function on_load_page() {
31 if ( isset( $_GET['action'], $_GET['app'] ) ) {
32 $manager = Plugin::$instance->common->get_component( 'connect' );
33 $app_slug = $_GET['app'];
34 $app = $manager->get_app( $app_slug );
35 $nonce_action = $_GET['app'] . $_GET['action'];
36
37 if ( ! $app ) {
38 wp_die( 'Unknown app: ' . esc_attr( $app_slug ) );
39 }
40
41 if ( empty( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], $nonce_action ) ) {
42 wp_die( 'Invalid Nonce', 'Invalid Nonce', [
43 'back_link' => true,
44 ] );
45 }
46
47 $method = 'action_' . $_GET['action'];
48
49 if ( method_exists( $app, $method ) ) {
50 call_user_func( [ $app, $method ] );
51 }
52 }
53 }
54
55 /**
56 * @since 2.3.0
57 * @access public
58 */
59 public function __construct() {
60 self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID );
61
62 add_action( 'elementor/admin/menu/register', [ $this, 'register_admin_menu' ] );
63
64 add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) {
65 if ( ! empty( $hooks[ static::PAGE_ID ] ) ) {
66 add_action( 'load-' . $hooks[ static::PAGE_ID ], [ $this, 'on_load_page' ] );
67 }
68 }, 10, 2 );
69 }
70 }
71