post_type_object( $post_type ); if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) { return false; } return true; } /** * Get user notices. * * Retrieve the list of notices for the current user. * * @since 2.0.0 * @access public * @static * * @return array A list of user notices. */ public static function get_user_notices() { $notices = get_user_meta( get_current_user_id(), self::ADMIN_NOTICES_KEY, true ); return is_array( $notices ) ? $notices : []; } /** * Is admin notice viewed. * * Whether the admin notice was viewed by the current user. * * @since 1.0.0 * @access public * @static * * @param int $notice_id The notice ID. * * @return bool Whether the admin notice was viewed by the user. */ public static function is_user_notice_viewed( $notice_id ) { $notices = self::get_user_notices(); if ( empty( $notices[ $notice_id ] ) ) { return false; } // BC: Handles old structure ( `[ 'notice_id' => 'true' ]` ). if ( 'true' === $notices[ $notice_id ] ) { return true; } return $notices[ $notice_id ]['is_viewed'] ?? false; } /** * Checks whether the current user is allowed to upload JSON files. * * Note: The 'json-upload' capability is managed by the Role Manager as a part of its blacklist restrictions. * In this context, we are negating the user's permission check to use it as a whitelist, allowing uploads. * * @return bool Whether the current user can upload JSON files. */ public static function is_current_user_can_upload_json() { return current_user_can( 'manage_options' ) || ! Plugin::instance()->role_manager->user_can( 'json-upload' ); } public static function is_current_user_can_use_custom_html() { return current_user_can( 'manage_options' ) || ! Plugin::instance()->role_manager->user_can( 'custom-html' ); } /** * Set admin notice as viewed. * * Flag the admin notice as viewed by the current user, using an authenticated ajax request. * * Fired by `wp_ajax_elementor_set_admin_notice_viewed` action. * * @since 1.0.0 * @access public * @static */ public static function ajax_set_admin_notice_viewed() { // phpcs:ignore WordPress.Security.NonceVerification.NoNonceVerification $notice_id = Utils::get_super_global_value( $_REQUEST, 'notice_id' ); if ( ! $notice_id ) { wp_die(); } self::set_user_notice( $notice_id ); if ( ! wp_doing_ajax() ) { wp_safe_redirect( admin_url() ); die; } wp_die(); } /** * @param $notice_id * @param $is_viewed * @param $meta * * @return void */ public static function set_user_notice( $notice_id, $is_viewed = true, $meta = null ) { $notices = self::get_user_notices(); if ( ! is_array( $meta ) ) { $meta = $notices[ $notice_id ]['meta'] ?? []; } $notices[ $notice_id ] = [ 'is_viewed' => $is_viewed, 'meta' => $meta, ]; update_user_meta( get_current_user_id(), self::ADMIN_NOTICES_KEY, $notices ); } /** * @since 2.1.0 * @access public * @static */ public static function set_introduction_viewed( array $data ) { $user_introduction_meta = self::get_introduction_meta(); $user_introduction_meta[ $data['introductionKey'] ] = true; update_user_meta( get_current_user_id(), self::INTRODUCTION_KEY, $user_introduction_meta ); } /** * @throws \Exception */ public static function register_as_beta_tester( array $data ) { if ( ! current_user_can( 'install_plugins' ) ) { throw new \Exception( __( 'You do not have permission to install plugins.', 'elementor' ) ); } update_user_meta( get_current_user_id(), self::BETA_TESTER_META_KEY, true ); $response = wp_safe_remote_post( self::BETA_TESTER_API_URL, [ 'timeout' => 25, 'body' => [ 'api_version' => ELEMENTOR_VERSION, 'site_lang' => get_bloginfo( 'language' ), 'beta_tester_email' => $data['betaTesterEmail'], ], ] ); $response_code = (int) wp_remote_retrieve_response_code( $response ); if ( 200 === $response_code ) { self::set_introduction_viewed( [ 'introductionKey' => Beta_Testers::BETA_TESTER_SIGNUP, ] ); } } /** * @param string $key * * @return array|mixed|string * @since 2.1.0 * @access public * @static */ public static function get_introduction_meta( $key = '' ) { $user_introduction_meta = get_user_meta( get_current_user_id(), self::INTRODUCTION_KEY, true ); if ( ! $user_introduction_meta ) { $user_introduction_meta = []; } if ( $key ) { return empty( $user_introduction_meta[ $key ] ) ? '' : $user_introduction_meta[ $key ]; } return $user_introduction_meta; } /** * Get a user option with default value as fallback. * * @param string $option - Option key. * @param int $user_id - User ID * @param mixed $default - Default fallback value. * * @return mixed */ public static function get_user_option_with_default( $option, $user_id, $default ) { $value = get_user_option( $option, $user_id ); return ( false === $value ) ? $default : $value; } /** * Get dismissed editor notices. * * Retrieve the list of dismissed editor notices for the current user. * * @since 3.19.0 * @access public * @static * * @return array A list of dismissed editor notices. */ public static function get_dismissed_editor_notices() { $notices = get_user_meta( get_current_user_id(), self::DISMISSED_EDITOR_NOTICES_KEY, true ); return is_array( $notices ) ? $notices : []; } /** * Set dismissed editor notices for the current user. * * @since 3.19.0 * @access public * @static * * @param array $data Editor notices. * * @return void */ public static function set_dismissed_editor_notices( array $data ) { $editor_notices = self::get_dismissed_editor_notices(); if ( ! in_array( $data['dismissId'], $editor_notices, true ) ) { $editor_notices[] = $data['dismissId']; update_user_meta( get_current_user_id(), self::DISMISSED_EDITOR_NOTICES_KEY, $editor_notices ); } } }
Fatal error: Uncaught Error: Class "Elementor\User" not found in /htdocs/wp-content/plugins/elementor/modules/ai/preferences.php:42 Stack trace: #0 /htdocs/wp-content/plugins/elementor/modules/ai/module.php(45): Elementor\Modules\Ai\Preferences::is_ai_enabled(0) #1 /htdocs/wp-content/plugins/elementor/core/base/module.php(85): Elementor\Modules\Ai\Module->__construct() #2 /htdocs/wp-content/plugins/elementor/core/modules-manager.php(64): Elementor\Core\Base\Module::instance() #3 /htdocs/wp-content/plugins/elementor/includes/plugin.php(757): Elementor\Core\Modules_Manager->__construct() #4 /htdocs/wp-content/plugins/elementor/includes/plugin.php(674): Elementor\Plugin->init_components() #5 /htdocs/wp-includes/class-wp-hook.php(324): Elementor\Plugin->init('') #6 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #7 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #8 /htdocs/wp-settings.php(695): do_action('init') #9 /htdocs/wp-config.php(98): require_once('/htdocs/wp-sett...') #10 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #11 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #12 /htdocs/index.php(17): require('/htdocs/wp-blog...') #13 {main} thrown in /htdocs/wp-content/plugins/elementor/modules/ai/preferences.php on line 42