s_message; } public static function get_show_default_success_message() { $self = self::get_instance(); return $self->show_default_success_message; } public static function set_show_default_error_message( $show_default_error_message ) { $self = self::get_instance(); $old_show_default_error_message = $self->show_default_error_message; $self->show_default_error_message = $show_default_error_message; return $old_show_default_error_message; } public static function get_show_default_error_message() { $self = self::get_instance(); return $self->show_default_error_message; } public static function prevent_modal_close() { $self = self::get_instance(); $self->close_modal = false; } public static function reload_module( $module ) { $self = self::get_instance(); $self->add_js_function_call( 'reloadModule', $module ); } public static function reload_all_modules() { self::get_instance()->add_js_function_call( 'reloadAllModules' ); } public static function refresh_page() { self::get_instance()->add_js_function_call( 'refreshPage' ); } public static function regenerate_wp_config() { $self = self::get_instance(); $self->regenerate_wp_config = true; self::reload_module( 'wp-config-rules' ); } public static function regenerate_server_config() { $self = self::get_instance(); $self->regenerate_server_config = true; self::reload_module( 'server-config-rules' ); } public static function force_logout() { $self = self::get_instance(); if ( $self->force_logout ) { return; } $self->force_logout = true; self::redirect( add_query_arg( 'loggedout', 'true', ITSEC_Lib::get_login_url() ) ); } public static function redirect( $redirect ) { $self = self::get_instance(); $self->redirect = $redirect; } public static function maybe_regenerate_wp_config() { $self = self::get_instance(); if ( $self->regenerate_wp_config ) { ITSEC_Files::regenerate_wp_config(); $self->regenerate_wp_config = false; } } public static function maybe_regenerate_server_config() { $self = self::get_instance(); if ( $self->regenerate_server_config ) { ITSEC_Files::regenerate_server_config(); $self->regenerate_server_config = false; } } public static function maybe_do_force_logout() { $self = self::get_instance(); if ( $self->force_logout ) { @wp_clear_auth_cookie(); $self->force_logout = false; } } public static function maybe_do_redirect() { $self = self::get_instance(); if ( $self->redirect ) { wp_safe_redirect( $self->redirect ); exit(); } } public static function maybe_flag_new_notifications_available() { $nc = ITSEC_Core::get_notification_center(); $current = array_keys( $nc->get_notifications() ); $nc->clear_notifications_cache(); $new = array_keys( $nc->get_notifications() ); $added = array_diff( $new, $current ); if ( $added ) { self::flag_new_notifications_available(); } } public static function flag_new_notifications_available() { static $run_count = 0; if ( $run_count ++ > 0 ) { return; } self::reload_module( 'notification-center' ); self::get_instance()->has_new_notifications = true; self::get_instance()->add_info( sprintf( esc_html__( 'New notifications available in the %1$sNotification Center%2$s.', 'better-wp-security' ), '', '' ) ); } public static function get_raw_data() { $self = self::get_instance(); self::maybe_regenerate_wp_config(); self::maybe_regenerate_server_config(); self::maybe_do_force_logout(); if ( is_wp_error( $self->response ) ) { $self->add_error( $self->response ); $self->set_response( null ); } $data = array( 'source' => 'ITSEC_Response', 'success' => $self->success, 'response' => $self->response, 'errors' => self::get_error_strings( $self->errors ), 'warnings' => self::get_error_strings( $self->warnings ), 'messages' => $self->messages, 'infos' => $self->infos, 'functionCalls' => self::parse_js_function_calls_for_module_reloads(), 'storeDispatches' => $self->store_dispatches, 'redirect' => $self->redirect, 'closeModal' => $self->close_modal, 'newNotifications' => $self->has_new_notifications, ); return $data; } public static function send_json() { $data = self::get_raw_data(); wp_send_json( $data ); } public static function get_instance() { if ( ! self::$instance ) { self::$instance = new self; } return self::$instance; } public function reset_to_defaults() { $this->response = null; $this->errors = array(); $this->warnings = array(); $this->messages = array(); $this->infos = array(); $this->success = true; $this->js_function_calls = array(); $this->store_dispatches = array(); $this->show_default_success_message = true; $this->show_default_error_message = true; $this->force_logout = false; $this->redirect = false; $this->close_modal = true; $this->regenerate_wp_config = false; $this->regenerate_server_config = false; } public static function get_error_strings( $error ) { if ( is_string( $error ) ) { return array( $error ); } elseif ( is_a( $error, 'WP_Error' ) ) { /* translators: 1: error message, 2: error code */ $format = __( '%1$s (%2$s)', 'better-wp-security' ); $errors = array(); foreach ( $error->get_error_codes() as $code ) { $message = implode( ' ', (array) $error->get_error_messages( $code ) ); $errors[] = sprintf( $format, $message, $code ) . ' '; } return $errors; } elseif ( is_array( $error ) ) { $errors = array(); foreach ( $error as $error_item ) { $new_errors = self::get_error_strings( $error_item ); $errors = array_merge( $errors, $new_errors ); } return $errors; } /* translators: 1: variable type */ return array( sprintf( __( 'Unknown error type received: %1$s.', 'better-wp-security' ), gettype( $error ) ) ); } public static function as_wp_error(): WP_Error { return self::get_wp_error( self::get_errors() ); } private static function get_wp_error( $errors ): WP_Error { if ( is_wp_error( $errors ) ) { return $errors; } $wp_error = new \WP_Error(); foreach ( $errors as $error ) { if ( is_string( $error ) ) { $wp_error->add( 'unknown-error', $error ); } elseif ( is_wp_error( $error ) ) { $wp_error->merge_from( $error ); } elseif ( is_array( $error ) ) { $wp_error->merge_from( self::get_wp_error( $errors ) ); } } return $wp_error; } private static function parse_js_function_calls_for_module_reloads() { $has_reload_all = false; $function_calls = self::get_instance()->js_function_calls; foreach ( $function_calls as $function_call ) { if ( $function_call[0] === 'reloadAllModules' ) { $has_reload_all = true; break; } } if ( ! $has_reload_all ) { return $function_calls; } foreach ( $function_calls as $i => $function_call ) { if ( $function_call[0] === 'reloadModule' ) { unset( $function_calls[ $i ] ); } } return array_values( $function_calls ); } public function shutdown() { self::maybe_regenerate_wp_config(); self::maybe_regenerate_server_config(); self::maybe_do_force_logout(); } } e plugin. add_filter( 'autoptimize_filter_noptimize', function( $retval ) { if ( Plugin::$instance->editor->is_edit_mode() ) { $retval = true; } return $retval; } ); // Add the description (content) tab for a new product, so it can be edited with Elementor. add_filter( 'woocommerce_product_tabs', function( $tabs ) { if ( ! isset( $tabs['description'] ) && Plugin::$instance->preview->is_preview_mode() ) { $post = get_post(); if ( empty( $post->post_content ) ) { $tabs['description'] = [ 'title' => esc_html__( 'Description', 'elementor' ), 'priority' => 10, 'callback' => 'woocommerce_product_description_tab', ]; } } return $tabs; } ); // Fix WC session not defined in editor. if ( class_exists( 'woocommerce' ) ) { add_action( 'elementor/editor/before_enqueue_scripts', function() { remove_action( 'woocommerce_shortcode_before_product_cat_loop', 'wc_print_notices' ); remove_action( 'woocommerce_before_shop_loop', 'wc_print_notices' ); remove_action( 'woocommerce_before_single_product', 'wc_print_notices' ); } ); add_filter( 'elementor/maintenance_mode/is_login_page', function( $value ) { // Support Woocommerce Account Page. if ( is_account_page() && ! is_user_logged_in() ) { $value = true; } return $value; } ); } // Fix Jetpack Contact Form in Editor Mode. if ( class_exists( 'Grunion_Editor_View' ) ) { add_action( 'elementor/editor/before_enqueue_scripts', function() { remove_action( 'media_buttons', 'grunion_media_button', 999 ); remove_action( 'admin_enqueue_scripts', 'grunion_enable_spam_recheck' ); remove_action( 'admin_notices', [ 'Grunion_Editor_View', 'handle_editor_view_js' ] ); remove_action( 'admin_head', [ 'Grunion_Editor_View', 'admin_head' ] ); } ); } // Fix Popup Maker in Editor Mode. if ( class_exists( 'PUM_Admin_Shortcode_UI' ) ) { add_action( 'elementor/editor/before_enqueue_scripts', function() { $pum_admin_instance = \PUM_Admin_Shortcode_UI::instance(); remove_action( 'print_media_templates', [ $pum_admin_instance, 'print_media_templates' ] ); remove_action( 'admin_print_footer_scripts', [ $pum_admin_instance, 'admin_print_footer_scripts' ], 100 ); remove_action( 'wp_ajax_pum_do_shortcode', [ $pum_admin_instance, 'wp_ajax_pum_do_shortcode' ] ); remove_action( 'admin_enqueue_scripts', [ $pum_admin_instance, 'admin_enqueue_scripts' ] ); remove_filter( 'pum_admin_var', [ $pum_admin_instance, 'pum_admin_var' ] ); } ); } // Fix Preview URL for https://github.com/wpmudev/domain-mapping plugin if ( class_exists( 'domain_map' ) ) { add_filter( 'elementor/document/urls/preview', function( $preview_url ) { if ( wp_parse_url( $preview_url, PHP_URL_HOST ) !== Utils::get_super_global_value( $_SERVER, 'HTTP_HOST' ) ) { $preview_url = \domain_map::utils()->unswap_url( $preview_url ); $preview_url = add_query_arg( [ 'dm' => \Domainmap_Module_Mapping::BYPASS, ], $preview_url ); } return $preview_url; } ); } // Gutenberg if ( function_exists( 'gutenberg_init' ) ) { add_action( 'admin_print_scripts-edit.php', [ __CLASS__, 'add_new_button_to_gutenberg' ], 11 ); } } public static function filter_library_post_type( $post_types ) { unset( $post_types[ Source_Local::CPT ] ); return $post_types; } /** * Polylang compatibility. * * Fix Polylang compatibility with Elementor. * * @since 2.0.0 * @access private * @static */ private static function polylang_compatibility() { // Copy elementor data while polylang creates a translation copy add_filter( 'pll_copy_post_metas', [ __CLASS__, 'save_polylang_meta' ], 10, 4 ); } /** * Save polylang meta. * * Copy elementor data while polylang creates a translation copy. * * Fired by `pll_copy_post_metas` filter. * * @since 1.6.0 * @access public * @static * * @param array $keys List of custom fields names. * @param bool $sync True if it is synchronization, false if it is a copy. * @param int $from ID of the post from which we copy information. * @param int $to ID of the post to which we paste information. * * @return array List of custom fields names. */ public static function save_polylang_meta( $keys, $sync, $from, $to ) { // Copy only for a new post. if ( ! $sync ) { Plugin::$instance->db->copy_elementor_meta( $from, $to ); } return $keys; } private static function yoast_duplicate_post() { add_filter( 'duplicate_post_excludelist_filter', function( $meta_excludelist ) { $exclude_list = [ Document::TYPE_META_KEY, '_elementor_page_assets', '_elementor_controls_usage', '_elementor_css', '_elementor_screenshot', ]; return array_merge( $meta_excludelist, $exclude_list ); } ); add_action( 'duplicate_post_post_copy', function( $new_post_id, $post ) { $original_template_type = get_post_meta( $post->ID, Document::TYPE_META_KEY, true ); if ( ! empty( $original_template_type ) ) { update_post_meta( $new_post_id, Document::TYPE_META_KEY, $original_template_type ); } }, 10, 2 ); } /** * Process post meta before WP importer. * * Normalize Elementor post meta on import, We need the `wp_slash` in order * to avoid the unslashing during the `add_post_meta`. * * Fired by `wp_import_post_meta` filter. * * @since 1.0.0 * @access public * @static * * @param array $post_meta Post meta. * * @return array Updated post meta. */ public static function on_wp_import_post_meta( $post_meta ) { $is_wp_importer_before_0_7 = self::is_wp_importer_before_0_7(); if ( $is_wp_importer_before_0_7 ) { foreach ( $post_meta as &$meta ) { if ( '_elementor_data' === $meta['key'] ) { $meta['value'] = wp_slash( $meta['value'] ); break; } } } return $post_meta; } /** * Is WP Importer Before 0.7 * * Checks if WP Importer is installed, and whether its version is older than 0.7. * * @return bool */ public static function is_wp_importer_before_0_7() { $wp_importer = get_plugins( '/wordpress-importer' ); if ( ! empty( $wp_importer ) ) { $wp_importer_version = $wp_importer['wordpress-importer.php']['Version']; if ( version_compare( $wp_importer_version, '0.7', '<' ) ) { return true; } } return false; } /** * Process post meta before WXR importer. * * Normalize Elementor post meta on import with the new WP_importer, We need * the `wp_slash` in order to avoid the unslashing during the `add_post_meta`. * * Fired by `wxr_importer.pre_process.post_meta` filter. * * @since 1.0.0 * @access public * @static * * @param array $post_meta Post meta. * * @return array Updated post meta. */ public static function on_wxr_importer_pre_process_post_meta( $post_meta ) { $is_wp_importer_before_0_7 = self::is_wp_importer_before_0_7(); if ( $is_wp_importer_before_0_7 ) { if ( '_elementor_data' === $post_meta['key'] ) { $post_meta['value'] = wp_slash( $post_meta['value'] ); } } return $post_meta; } }
Fatal error: Uncaught Error: Class "Elementor\Compatibility" not found in /htdocs/wp-content/plugins/elementor/includes/plugin.php:875 Stack trace: #0 /htdocs/wp-content/plugins/elementor/includes/plugin.php(630): Elementor\Plugin->__construct() #1 /htdocs/wp-content/plugins/elementor/includes/plugin.php(888): Elementor\Plugin::instance() #2 /htdocs/wp-content/plugins/elementor/elementor.php(58): require('/htdocs/wp-cont...') #3 /htdocs/wp-settings.php(526): include_once('/htdocs/wp-cont...') #4 /htdocs/wp-config.php(108): require_once('/htdocs/wp-sett...') #5 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #6 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #7 /htdocs/index.php(17): require('/htdocs/wp-blog...') #8 {main} thrown in /htdocs/wp-content/plugins/elementor/includes/plugin.php on line 875