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

110 lines 2.3 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\Plugin;
5 use Elementor\Settings;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 class Admin {
12
13 const PAGE_ID = 'elementor-connect';
14
15 public static $url = '';
16
17 /**
18 * @since 2.3.0
19 * @access public
20 */
21 public function register_admin_menu() {
22 $submenu_page = add_submenu_page(
23 Settings::PAGE_ID,
24 __( 'Connect', 'elementor' ),
25 __( 'Connect', 'elementor' ),
26 'edit_posts',
27 self::PAGE_ID,
28 [ $this, 'render_page' ]
29 );
30
31 add_action( 'load-' . $submenu_page, [ $this, 'on_load_page' ] );
32 }
33
34 /**
35 * @since 2.3.0
36 * @access public
37 */
38 public function hide_menu_item() {
39 remove_submenu_page( Settings::PAGE_ID, self::PAGE_ID );
40 }
41
42 /**
43 * @since 2.3.0
44 * @access public
45 */
46 public function on_load_page() {
47 if ( isset( $_GET['action'], $_GET['app'] ) ) {
48 $manager = Plugin::$instance->common->get_component( 'connect' );
49 $app_slug = $_GET['app'];
50 $app = $manager->get_app( $app_slug );
51 $nonce_action = $_GET['app'] . $_GET['action'];
52
53 if ( ! $app ) {
54 wp_die( 'Unknown app: ' . esc_attr( $app_slug ) );
55 }
56
57 if ( empty( $_GET['nonce'] ) || ! wp_verify_nonce( $_GET['nonce'], $nonce_action ) ) {
58 wp_die( 'Invalid Nonce', 'Invalid Nonce', [
59 'back_link' => true,
60 ] );
61 }
62
63 $method = 'action_' . $_GET['action'];
64
65 if ( method_exists( $app, $method ) ) {
66 call_user_func( [ $app, $method ] );
67 }
68 }
69 }
70
71 /**
72 * @since 2.3.0
73 * @access public
74 */
75 public function render_page() {
76 $apps = Plugin::$instance->common->get_component( 'connect' )->get_apps();
77 ?>
78 <style>
79 .elementor-connect-app-wrapper{
80 margin-bottom: 50px;
81 overflow: hidden;
82 }
83 </style>
84 <div class="wrap">
85 <?php
86
87 /** @var \Elementor\Core\Common\Modules\Connect\Apps\Base_App $app */
88 foreach ( $apps as $app ) {
89 echo '<div class="elementor-connect-app-wrapper">';
90 $app->render_admin_widget();
91 echo '</div>';
92 }
93
94 ?>
95 </div><!-- /.wrap -->
96 <?php
97 }
98
99 /**
100 * @since 2.3.0
101 * @access public
102 */
103 public function __construct() {
104 self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID );
105
106 add_action( 'admin_menu', [ $this, 'register_admin_menu' ], 206 );
107 add_action( 'admin_head', [ $this, 'hide_menu_item' ] );
108 }
109 }
110