PluginProbe
Elementor Website Builder – more than just a page builder / 3.19.0-beta5
Elementor Website Builder – more than just a page builder v3.19.0-beta5
4.3.4 4.3.3 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 All 457 releases
← All changes | includes/user.php +13 -38 4.3.0-beta2 → 3.19.0-beta5 View file →
@@ -72,9 +72,8 @@
72 72 add_action( 'elementor/ajax/register_actions', [ __CLASS__, 'register_ajax_actions' ] );
73 73 }
74 74
75 75 /**
76 - * @param Ajax $ajax
77 76 * @since 2.1.0
78 77 * @access public
79 78 * @static
80 79 */
@@ -126,12 +125,8 @@
126 125 if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
127 126 return false;
128 127 }
129 128
130 - if ( function_exists( 'wc_get_page_id' ) && intval( wc_get_page_id( 'shop' ) ) === $post->ID ) {
131 - return false;
132 - }
133 -
134 129 return true;
135 130 }
136 131
137 132 /**
@@ -232,24 +227,8 @@
232 227 return $notices[ $notice_id ]['is_viewed'] ?? false;
233 228 }
234 229
235 230 /**
236 - * Checks whether the current user is allowed to upload JSON files.
237 - *
238 - * Note: The 'json-upload' capability is managed by the Role Manager as a part of its blacklist restrictions.
239 - * In this context, we are negating the user's permission check to use it as a whitelist, allowing uploads.
240 - *
241 - * @return bool Whether the current user can upload JSON files.
242 - */
243 - public static function is_current_user_can_upload_json() {
244 - return current_user_can( 'manage_options' ) || ! Plugin::instance()->role_manager->user_can( 'json-upload' );
245 - }
246 -
247 - public static function is_current_user_can_use_custom_html() {
248 - return current_user_can( 'manage_options' ) || ! Plugin::instance()->role_manager->user_can( 'custom-html' );
249 - }
250 -
251 - /**
252 231 * Set admin notice as viewed.
253 232 *
254 233 * Flag the admin notice as viewed by the current user, using an authenticated ajax request.
255 234 *
@@ -266,10 +245,8 @@
266 245 if ( ! $notice_id ) {
267 246 wp_die();
268 247 }
269 248
270 - check_admin_referer( 'elementor_set_admin_notice_viewed' );
271 -
272 249 self::set_user_notice( $notice_id );
273 250
274 251 if ( ! wp_doing_ajax() ) {
275 252 wp_safe_redirect( admin_url() );
@@ -279,11 +256,11 @@
279 256 wp_die();
280 257 }
281 258
282 259 /**
283 - * @param string $notice_id
284 - * @param bool $is_viewed
285 - * @param array $meta
260 + * @param $notice_id
261 + * @param $is_viewed
262 + * @param $meta
286 263 *
287 264 * @return void
288 265 */
289 266 public static function set_user_notice( $notice_id, $is_viewed = true, $meta = null ) {
@@ -314,13 +291,13 @@
314 291 update_user_meta( get_current_user_id(), self::INTRODUCTION_KEY, $user_introduction_meta );
315 292 }
316 293
317 294 /**
318 - * @throws \Exception If the user cannot install plugins.
295 + * @throws \Exception
319 296 */
320 297 public static function register_as_beta_tester( array $data ) {
321 298 if ( ! current_user_can( 'install_plugins' ) ) {
322 - throw new \Exception( 'You do not have permission to install plugins.' );
299 + throw new \Exception( __( 'You do not have permissions to install plugins on this site.', 'elementor' ) );
323 300 }
324 301
325 302 update_user_meta( get_current_user_id(), self::BETA_TESTER_META_KEY, true );
326 303 $response = wp_safe_remote_post(
@@ -366,20 +343,20 @@
366 343 return $user_introduction_meta;
367 344 }
368 345
369 346 /**
370 - * Get a user option with a fallback value.
347 + * Get a user option with default value as fallback.
371 348 *
372 - * @param string $option Option key.
373 - * @param int $user_id User ID.
374 - * @param mixed $fallback Default fallback value.
349 + * @param string $option - Option key.
350 + * @param int $user_id - User ID
351 + * @param mixed $default - Default fallback value.
375 352 *
376 353 * @return mixed
377 354 */
378 - public static function get_user_option_with_default( $option, $user_id, $fallback ) {
355 + public static function get_user_option_with_default( $option, $user_id, $default ) {
379 356 $value = get_user_option( $option, $user_id );
380 357
381 - return ( false === $value ) ? $fallback : $value;
358 + return ( false === $value ) ? $default : $value;
382 359 }
383 360
384 361 /**
385 362 * Get dismissed editor notices.
@@ -411,11 +388,9 @@
411 388 */
412 389 public static function set_dismissed_editor_notices( array $data ) {
413 390 $editor_notices = self::get_dismissed_editor_notices();
414 391
415 - if ( ! in_array( $data['dismissId'], $editor_notices, true ) ) {
416 - $editor_notices[] = $data['dismissId'];
392 + $editor_notices[] = $data['dismissId'];
417 393
418 - update_user_meta( get_current_user_id(), self::DISMISSED_EDITOR_NOTICES_KEY, $editor_notices );
419 - }
394 + update_user_meta( get_current_user_id(), self::DISMISSED_EDITOR_NOTICES_KEY, $editor_notices );
420 395 }
421 396 }