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.2 4.3.1 4.3.0 4.3.0-beta3 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 All 455 releases
← All changes | core/role-manager/role-manager.php +35 -70 4.3.0-beta3 → 3.19.2 View file →
@@ -1,9 +1,8 @@
1 1 <?php
2 2 namespace Elementor\Core\RoleManager;
3 3
4 -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
5 -use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
4 +use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 5 use Elementor\Plugin;
7 6 use Elementor\Settings;
8 7 use Elementor\Settings_Page;
9 8
@@ -28,9 +27,9 @@
28 27 public function get_role_manager_options() {
29 28 return get_option( 'elementor_' . self::ROLE_MANAGER_OPTION_NAME, [] );
30 29 }
31 30
32 - public function get_role_manager_advanced_options() {
31 + private function get_role_manager_advanced_options() {
33 32 return get_option( 'elementor_' . self::ROLE_MANAGER_ADVANCED, [] );
34 33 }
35 34
36 35 public function get_user_advanced_options() {
@@ -51,8 +50,16 @@
51 50 }
52 51
53 52 /**
54 53 * @since 2.0.0
54 + * @access public
55 + */
56 + public function register_admin_menu( Admin_Menu_Manager $admin_menu ) {
57 + $admin_menu->register( static::PAGE_ID, new Role_Manager_Menu_Item( $this ) );
58 + }
59 +
60 + /**
61 + * @since 2.0.0
55 62 * @access protected
56 63 */
57 64 protected function create_tabs() {
58 65 $validation_class = 'Elementor\Settings_Validations';
@@ -101,25 +108,23 @@
101 108 ?>
102 109 <div class="wrap">
103 110 <h1 class="wp-heading-inline"><?php echo esc_html( $this->get_page_title() ); ?></h1>
104 111
105 - <div>
106 - <div id="elementor-role-manager">
107 - <h3><?php echo esc_html__( 'Manage What Your Users Can Edit In Elementor', 'elementor' ); ?></h3>
108 - <form id="elementor-settings-form" method="post" action="options.php">
109 - <?php
110 - settings_fields( static::PAGE_ID );
111 - echo '<div class="elementor-settings-form-page elementor-active">';
112 - foreach ( get_editable_roles() as $role_slug => $role_data ) {
113 - if ( 'administrator' === $role_slug ) {
114 - continue;
115 - }
116 - $this->display_role_controls( $role_slug, $role_data );
112 + <div id="elementor-role-manager">
113 + <h3><?php echo esc_html__( 'Manage What Your Users Can Edit In Elementor', 'elementor' ); ?></h3>
114 + <form id="elementor-settings-form" method="post" action="options.php">
115 + <?php
116 + settings_fields( static::PAGE_ID );
117 + echo '<div class="elementor-settings-form-page elementor-active">';
118 + foreach ( get_editable_roles() as $role_slug => $role_data ) {
119 + if ( 'administrator' === $role_slug ) {
120 + continue;
117 121 }
118 - submit_button( __( 'Save Changes', 'elementor' ), 'primary', 'submit', true, [ 'data-id' => 'elementor-role-manager-button-save-changes' ] );
119 - ?>
120 - </form>
121 - </div>
122 + $this->display_role_controls( $role_slug, $role_data );
123 + }
124 + submit_button();
125 + ?>
126 + </form>
122 127 </div>
123 128 </div><!-- /.wrap -->
124 129 <?php
125 130 }
@@ -136,16 +141,14 @@
136 141 if ( false === $excluded_options ) {
137 142 $excluded_options = $this->get_role_manager_options();
138 143 }
139 144
140 - $row_classes = 'elementor-role-row ' . esc_attr( $role_slug ) . ' e-editor-one';
141 -
142 145 ?>
143 - <div class="<?php echo esc_attr( $row_classes ); ?>">
146 + <div class="elementor-role-row <?php echo esc_attr( $role_slug ); ?>">
144 147 <div class="elementor-role-label">
145 148 <span class="elementor-role-name"><?php echo esc_html( translate_user_role( $role_data['name'] ) ); ?></span>
146 149 <span data-excluded-label="<?php esc_attr_e( 'Role Excluded', 'elementor' ); ?>" class="elementor-role-excluded-indicator"></span>
147 - <span class="elementor-role-toggle" data-id="<?php echo esc_attr( $role_slug ); ?>-toggle"><span class="dashicons dashicons-arrow-down"></span></span>
150 + <span class="elementor-role-toggle"><span class="dashicons dashicons-arrow-down"></span></span>
148 151 </div>
149 152 <div class="elementor-role-controls hidden">
150 153 <div class="elementor-role-control">
151 154 <label>
@@ -152,9 +155,9 @@
152 155 <input type="checkbox" name="elementor_exclude_user_roles[]" value="<?php echo esc_attr( $role_slug ); ?>"<?php checked( in_array( $role_slug, $excluded_options, true ), true ); ?>>
153 156 <?php echo esc_html__( 'No access to editor', 'elementor' ); ?>
154 157 </label>
155 158 </div>
156 - <div class="elementor-role-controls-advanced">
159 + <div>
157 160 <?php
158 161 /**
159 162 * Role restrictions controls.
160 163 *
@@ -186,9 +189,9 @@
186 189 $checked = isset( $advanced_options[ $role_slug ] ) ? $advanced_options[ $role_slug ] : [];
187 190 ?>
188 191 <div class="elementor-role-control">
189 192 <label for="<?php echo esc_attr( $id ); ?>">
190 - <input type="checkbox" name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $value ); ?>" <?php checked( in_array( $value, $checked, true ), true ); ?>>
193 + <input type="checkbox" name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $value ); ?>" <?php checked( in_array( $value, $checked ), true ); ?>>
191 194 <?php echo esc_html__( 'Enable the option to upload JSON files', 'elementor' ); ?>
192 195 </label>
193 196 <p class="elementor-role-control-warning"><strong><?php echo esc_html__( 'Heads up', 'elementor' ); ?>:</strong> <?php echo esc_html__( 'Giving broad access to upload JSON files can pose a security risk to your website because such files may contain malicious scripts, etc.', 'elementor' ); ?></p>
194 197 </div>
@@ -193,54 +196,21 @@
193 196 <p class="elementor-role-control-warning"><strong><?php echo esc_html__( 'Heads up', 'elementor' ); ?>:</strong> <?php echo esc_html__( 'Giving broad access to upload JSON files can pose a security risk to your website because such files may contain malicious scripts, etc.', 'elementor' ); ?></p>
194 197 </div>
195 198 <?php
196 199 }
197 -
198 - public function add_custom_html_enable_control( $role_slug ) {
199 - $value = 'custom-html';
200 - $id = self::ROLE_MANAGER_ADVANCED . '_' . $role_slug . '_' . $value;
201 - $name = 'elementor_' . self::ROLE_MANAGER_ADVANCED . '[' . $role_slug . '][]';
202 -
203 - $advanced_options = $this->get_user_advanced_options();
204 - $checked = isset( $advanced_options[ $role_slug ] ) ? $advanced_options[ $role_slug ] : [];
205 - ?>
206 - <div class="elementor-role-control">
207 - <label for="<?php echo esc_attr( $id ); ?>">
208 - <input type="checkbox" name="<?php echo esc_attr( $name ); ?>" id="<?php echo esc_attr( $id ); ?>" value="<?php echo esc_attr( $value ); ?>" <?php checked( in_array( $value, $checked, true ), true ); ?>>
209 - <?php echo esc_html__( 'Enable the option to use the HTML widget', 'elementor' ); ?>
210 - </label>
211 - <p class="elementor-role-control-warning"><strong><?php echo esc_html__( 'Heads up', 'elementor' ); ?>:</strong> <?php echo esc_html__( 'Giving broad access to edit the HTML widget can pose a security risk to your website because it enables users to run malicious scripts, etc.', 'elementor' ); ?></p>
212 - </div>
213 - <?php
214 - }
215 -
216 200 /**
217 201 * @since 2.0.0
218 202 * @access public
219 203 */
220 204 public function get_go_pro_link_html() {
221 - $promotion = $this->get_go_pro_link_content();
222 -
223 205 ?>
224 206 <div class="elementor-role-go-pro">
225 - <div class="elementor-role-go-pro__desc"><?php echo esc_html( $promotion['description'] ); ?></div>
226 - <div class="elementor-role-go-pro__link"><a class="elementor-button go-pro" target="_blank" href="<?php echo esc_url( $promotion['upgrade_url'] ); ?>"><?php echo esc_html( $promotion['upgrade_text'] ); ?></a></div>
207 + <div class="elementor-role-go-pro__desc"><?php echo esc_html__( 'Want to give access only to content?', 'elementor' ); ?></div>
208 + <div class="elementor-role-go-pro__link"><a class="elementor-button go-pro" target="_blank" href="https://go.elementor.com/go-pro-role-manager/"><?php echo esc_html__( 'Upgrade', 'elementor' ); ?></a></div>
227 209 </div>
228 210 <?php
229 211 }
230 212
231 - public function get_go_pro_link_content() {
232 - $upgrade_url = 'https://go.elementor.com/go-pro-role-manager/';
233 -
234 - $promotion = [
235 - 'description' => esc_html__( 'Want to give access only to content?', 'elementor' ),
236 - 'upgrade_url' => esc_url( $upgrade_url ),
237 - 'upgrade_text' => esc_html__( 'Upgrade', 'elementor' ),
238 - ];
239 -
240 - return Filtered_Promotions_Manager::get_filtered_promotion_data( $promotion, 'elementor/role/custom_promotion', 'upgrade_url' );
241 - }
242 -
243 213 /**
244 214 * @since 2.0.0
245 215 * @access public
246 216 */
@@ -302,12 +272,8 @@
302 272
303 273 return true;
304 274 }
305 275
306 - private function register_editor_one_menu( Menu_Data_Provider $menu_data_provider ) {
307 - $menu_data_provider->register_menu( new Editor_One_Role_Manager_Menu() );
308 - }
309 -
310 276 /**
311 277 * @since 2.0.0
312 278 * @access public
313 279 */
@@ -313,15 +279,14 @@
313 279 */
314 280 public function __construct() {
315 281 parent::__construct();
316 282
317 - add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
318 - $this->register_editor_one_menu( $menu_data_provider );
319 - } );
283 + if ( ! Plugin::$instance->experiments->is_feature_active( 'admin_menu_rearrangement' ) ) {
284 + add_action( 'elementor/admin/menu/register', function ( Admin_Menu_Manager $admin_menu ) {
285 + $this->register_admin_menu( $admin_menu );
286 + }, Settings::ADMIN_MENU_PRIORITY + 10 );
287 + }
320 288
321 289 add_action( 'elementor/role/restrictions/controls', [ $this, 'add_json_enable_control' ] );
322 - add_action( 'elementor/role/restrictions/controls', [ $this, 'add_custom_html_enable_control' ] );
323 290 add_action( 'elementor/role/restrictions/controls', [ $this, 'get_go_pro_link_html' ] );
324 -
325 - add_filter( 'elementor/editor/user/restrictions', [ $this, 'get_role_manager_advanced_options' ] );
326 291 }
327 292 }