PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.8
Elementor Website Builder – more than just a page builder v3.0.8
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 | modules/admin-bar/module.php +8 -47 4.2.0-dev23.0.8 View file →
@@ -53,29 +53,16 @@
53 53 if ( empty( $this->documents ) ) {
54 54 return;
55 55 }
56 56
57 - // Should load 'elementor-admin-bar' before 'admin-bar'
58 - wp_dequeue_script( 'admin-bar' );
59 -
60 57 wp_enqueue_script(
61 58 'elementor-admin-bar',
62 - $this->get_js_assets_url( 'elementor-admin-bar' ),
63 - [ 'elementor-frontend-modules' ],
59 + $this->get_js_assets_url( 'admin-bar' ),
60 + [ 'elementor-common' ],
64 61 ELEMENTOR_VERSION,
65 62 true
66 63 );
67 64
68 - // This is a core script of WordPress, it is not required to pass the 'ver' argument.
69 - // We should add dependencies to make sure that 'elementor-admin-bar' is loaded before 'admin-bar'.
70 - wp_enqueue_script(
71 - 'admin-bar',
72 - null,
73 - [ 'elementor-admin-bar' ],
74 - false, // phpcs:ignore WordPress.WP.EnqueuedResourceParameters
75 - true
76 - );
77 -
78 65 $this->print_config( 'elementor-admin-bar' );
79 66 }
80 67
81 68 /**
@@ -90,19 +77,15 @@
90 77 $settings['elementor_edit_page'] = $this->get_edit_button_config();
91 78 }
92 79
93 80 /**
94 - * Admin bar settings in the frontend.
81 + * Register admin_bar config to parse later in the frontend and add to the admin bar with JS
95 82 *
96 - * Register admin_bar config to parse later in the frontend and add to the admin bar with JS.
83 + * @param array $settings the admin_bar config
97 84 *
98 85 * @since 3.0.0
99 - *
100 - * @param array $settings the admin_bar config
101 86 */
102 - $settings = apply_filters( 'elementor/frontend/admin_bar/settings', $settings );
103 -
104 - return $settings;
87 + return apply_filters( 'elementor/frontend/admin_bar/settings', $settings );
105 88 }
106 89
107 90 /**
108 91 * Creates the config for 'Edit with elementor' menu item.
@@ -120,9 +103,9 @@
120 103 }
121 104
122 105 return [
123 106 'id' => 'elementor_edit_page',
124 - 'title' => esc_html__( 'Edit with Elementor', 'elementor' ),
107 + 'title' => __( 'Edit with Elementor', 'elementor' ),
125 108 'href' => $href,
126 109 'children' => array_map( function ( $document ) {
127 110 return [
128 111 'id' => "elementor_edit_doc_{$document->get_main_id()}",
@@ -133,34 +116,12 @@
133 116 }, $this->documents ),
134 117 ];
135 118 }
136 119
137 - public function add_clear_cache_in_admin_bar( $admin_bar_config ): array {
138 - if ( current_user_can( 'manage_options' ) ) {
139 - $clear_cache_url = add_query_arg(
140 - [
141 - '_wpnonce' => wp_create_nonce( 'elementor_site_clear_cache' ),
142 - ],
143 - admin_url( 'admin-post.php?action=elementor_site_clear_cache' ),
144 - );
145 -
146 - $admin_bar_config['elementor_edit_page']['children'][] = [
147 - 'id' => 'elementor_site_clear_cache',
148 - 'title' => esc_html__( 'Clear Files & Data', 'elementor' ),
149 - 'sub_title' => esc_html__( 'Site', 'elementor' ),
150 - 'href' => $clear_cache_url,
151 - ];
152 - }
153 -
154 - return $admin_bar_config;
155 - }
156 -
157 120 /**
158 121 * Module constructor.
159 122 */
160 123 public function __construct() {
161 - add_action( 'elementor/frontend/before_get_builder_content', [ $this, 'add_document_to_admin_bar' ], 10, 2 );
162 - add_action( 'wp_footer', [ $this, 'enqueue_scripts' ], 11 /* after third party scripts */ );
163 -
164 - add_filter( 'elementor/frontend/admin_bar/settings', [ $this, 'add_clear_cache_in_admin_bar' ], 500 );
124 + add_action( 'elementor/frontend/get_builder_content', [ $this, 'add_document_to_admin_bar' ], 10, 2 );
125 + add_action( 'wp_footer', [ $this, 'enqueue_scripts' ] );
165 126 }
166 127 }