is_shown_recently() ) { return false; } if ( $this->is_notification_dismissed() ) { return false; } if ( ! $this->is_editor_installed() ) { return false; } if ( ! $this->is_editor_activated() ) { return false; } return ! $this->editor_has_wp_one_package(); } /** * Check if current page is an Elementor page * * @return bool */ private function is_elementor_page(): bool { $current_screen = get_current_screen(); if ( ! $current_screen ) { return false; } $screen_id = $current_screen->id ?? ''; $post_type = $current_screen->post_type ?? ''; $is_elementor_screen = strpos( $screen_id, 'elementor' ) !== false || strpos( $screen_id, 'e-floating-buttons' ) !== false; $is_elementor_post_type = strpos( $post_type, 'elementor' ) !== false || strpos( $post_type, 'e-floating-buttons' ) !== false; return $is_elementor_screen || $is_elementor_post_type; } /** * Maybe enqueue editor update notification assets * * @return void */ public function enqueue_scripts() { if ( ! $this->is_elementor_page() ) { return; } if ( ! $this->should_show_notification() ) { return; } $asset_file = ELEMENTOR_ONE_ASSETS_PATH . 'editor.asset.php'; $asset = file_exists( $asset_file ) ? include $asset_file : [ 'dependencies' => [ 'wp-element', 'wp-i18n', 'wp-data', 'wp-core-data' ], 'version' => '1.0.0', ]; wp_enqueue_script( 'elementor-one-editor-update-notification', ELEMENTOR_ONE_ASSETS_URL . 'editor.js', $asset['dependencies'], $asset['version'], true ); wp_localize_script( 'elementor-one-editor-update-notification', 'elementorOneEditorUpdateNotification', [ 'pluginsUrl' => admin_url( 'plugins.php' ), ] ); $this->mark_as_shown(); } }