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 -34 4.1.4 → 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 */
@@ -228,24 +227,8 @@
228 227 return $notices[ $notice_id ]['is_viewed'] ?? false;
229 228 }
230 229
231 230 /**
232 - * Checks whether the current user is allowed to upload JSON files.
233 - *
234 - * Note: The 'json-upload' capability is managed by the Role Manager as a part of its blacklist restrictions.
235 - * In this context, we are negating the user's permission check to use it as a whitelist, allowing uploads.
236 - *
237 - * @return bool Whether the current user can upload JSON files.
238 - */
239 - public static function is_current_user_can_upload_json() {
240 - return current_user_can( 'manage_options' ) || ! Plugin::instance()->role_manager->user_can( 'json-upload' );
241 - }
242 -
243 - public static function is_current_user_can_use_custom_html() {
244 - return current_user_can( 'manage_options' ) || ! Plugin::instance()->role_manager->user_can( 'custom-html' );
245 - }
246 -
247 - /**
248 231 * Set admin notice as viewed.
249 232 *
250 233 * Flag the admin notice as viewed by the current user, using an authenticated ajax request.
251 234 *
@@ -262,10 +245,8 @@
262 245 if ( ! $notice_id ) {
263 246 wp_die();
264 247 }
265 248
266 - check_admin_referer( 'elementor_set_admin_notice_viewed' );
267 -
268 249 self::set_user_notice( $notice_id );
269 250
270 251 if ( ! wp_doing_ajax() ) {
271 252 wp_safe_redirect( admin_url() );
@@ -275,11 +256,11 @@
275 256 wp_die();
276 257 }
277 258
278 259 /**
279 - * @param string $notice_id
280 - * @param bool $is_viewed
281 - * @param array $meta
260 + * @param $notice_id
261 + * @param $is_viewed
262 + * @param $meta
282 263 *
283 264 * @return void
284 265 */
285 266 public static function set_user_notice( $notice_id, $is_viewed = true, $meta = null ) {
@@ -310,13 +291,13 @@
310 291 update_user_meta( get_current_user_id(), self::INTRODUCTION_KEY, $user_introduction_meta );
311 292 }
312 293
313 294 /**
314 - * @throws \Exception If the user cannot install plugins.
295 + * @throws \Exception
315 296 */
316 297 public static function register_as_beta_tester( array $data ) {
317 298 if ( ! current_user_can( 'install_plugins' ) ) {
318 - 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' ) );
319 300 }
320 301
321 302 update_user_meta( get_current_user_id(), self::BETA_TESTER_META_KEY, true );
322 303 $response = wp_safe_remote_post(
@@ -362,20 +343,20 @@
362 343 return $user_introduction_meta;
363 344 }
364 345
365 346 /**
366 - * Get a user option with a fallback value.
347 + * Get a user option with default value as fallback.
367 348 *
368 - * @param string $option Option key.
369 - * @param int $user_id User ID.
370 - * @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.
371 352 *
372 353 * @return mixed
373 354 */
374 - 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 ) {
375 356 $value = get_user_option( $option, $user_id );
376 357
377 - return ( false === $value ) ? $fallback : $value;
358 + return ( false === $value ) ? $default : $value;
378 359 }
379 360
380 361 /**
381 362 * Get dismissed editor notices.
@@ -407,11 +388,9 @@
407 388 */
408 389 public static function set_dismissed_editor_notices( array $data ) {
409 390 $editor_notices = self::get_dismissed_editor_notices();
410 391
411 - if ( ! in_array( $data['dismissId'], $editor_notices, true ) ) {
412 - $editor_notices[] = $data['dismissId'];
392 + $editor_notices[] = $data['dismissId'];
413 393
414 - update_user_meta( get_current_user_id(), self::DISMISSED_EDITOR_NOTICES_KEY, $editor_notices );
415 - }
394 + update_user_meta( get_current_user_id(), self::DISMISSED_EDITOR_NOTICES_KEY, $editor_notices );
416 395 }
417 396 }