PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.2
Elementor Website Builder – more than just a page builder v3.19.2
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
← All changes | core/common/modules/connect/admin.php +9 -55 4.2.23.19.2 View file →
@@ -4,10 +4,8 @@
4 4 use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
5 5 use Elementor\Plugin;
6 6 use Elementor\Settings;
7 7 use Elementor\Utils;
8 -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
9 -use Elementor\Core\Common\Modules\Connect\AdminMenuItems\Editor_One_Connect_Menu;
10 8
11 9 if ( ! defined( 'ABSPATH' ) ) {
12 10 exit; // Exit if accessed directly.
13 11 }
@@ -17,53 +15,21 @@
17 15 const PAGE_ID = 'elementor-connect';
18 16
19 17 public static $url = '';
20 18
21 - private function get_valid_redirect_to_from_request() {
22 - // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only reading a URL parameter.
23 - $raw = Utils::get_super_global_value( $_GET, 'redirect_to' );
24 -
25 - if ( ! $raw ) {
26 - return '';
27 - }
28 -
29 - $raw = esc_url_raw( $raw );
30 -
31 - $validated = wp_validate_redirect( $raw, '' );
32 - if ( ! $validated ) {
33 - return '';
34 - }
35 -
36 - $admin_host = wp_parse_url( admin_url(), PHP_URL_HOST );
37 - $dest_host = wp_parse_url( $validated, PHP_URL_HOST );
38 - if ( $dest_host && $admin_host && ! hash_equals( $admin_host, $dest_host ) ) {
39 - return '';
40 - }
41 -
42 - return $validated;
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() );
43 25 }
44 26
45 - public function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) {
46 - $menu_data_provider->register_menu( new Editor_One_Connect_Menu() );
47 - }
48 -
49 27 /**
50 28 * @since 2.3.0
51 29 * @access public
52 30 */
53 31 public function on_load_page() {
54 - if ( ! $this->user_has_enough_permissions() ) {
55 - wp_die( 'You do not have sufficient permissions to access this page.', 'You do not have sufficient permissions to access this page.', [
56 - 'back_link' => true,
57 - ] );
58 - }
59 -
60 - // Allow a per-request default landing URL when provided via a safe `redirect_to` parameter.
61 - $maybe_redirect_to = $this->get_valid_redirect_to_from_request();
62 - if ( $maybe_redirect_to ) {
63 - self::$url = $maybe_redirect_to;
64 - }
65 -
66 32 if ( isset( $_GET['action'], $_GET['app'] ) ) {
67 33 $manager = Plugin::$instance->common->get_component( 'connect' );
68 34
69 35 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
@@ -92,20 +58,8 @@
92 58 }
93 59 }
94 60 }
95 61
96 - private function user_has_enough_permissions() {
97 - if ( current_user_can( 'manage_options' ) ) {
98 - return true;
99 - }
100 -
101 - if ( 'library' === Utils::get_super_global_value( $_GET, 'app' ) ) {
102 - return current_user_can( 'edit_posts' );
103 - }
104 -
105 - return false;
106 - }
107 -
108 62 /**
109 63 * @since 2.3.0
110 64 * @access public
111 65 */
@@ -111,13 +65,13 @@
111 65 */
112 66 public function __construct() {
113 67 self::$url = admin_url( 'admin.php?page=' . self::PAGE_ID );
114 68
115 - add_action( 'elementor/editor-one/menu/register', [ $this, 'register_editor_one_menu' ] );
69 + add_action( 'elementor/admin/menu/register', [ $this, 'register_admin_menu' ] );
116 70
117 - add_action( 'elementor/editor-one/menu/after_register_hidden_submenus', function ( array $hooks ) {
71 + add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) {
118 72 if ( ! empty( $hooks[ static::PAGE_ID ] ) ) {
119 73 add_action( 'load-' . $hooks[ static::PAGE_ID ], [ $this, 'on_load_page' ] );
120 74 }
121 - } );
75 + }, 10, 2 );
122 76 }
123 77 }