| @@ -1,11 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Modules\AdminTopBar; |
| 3 | 3 | |
| 4 | -use Elementor\Core\Admin\Admin; | |
| 5 | -use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager; | |
| 6 | 4 | use Elementor\Plugin; |
| 7 | 5 | use Elementor\Core\Base\App as BaseApp; |
| 6 | +use Elementor\Core\Experiments\Manager; | |
| 8 | 7 | use Elementor\Utils; |
| 9 | 8 | |
| 10 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | 10 | exit; // Exit if accessed directly. |
| @@ -39,9 +38,9 @@ | ||
| 39 | 38 | */ |
| 40 | 39 | private function enqueue_scripts() { |
| 41 | 40 | wp_enqueue_style( 'elementor-admin-top-bar-fonts', 'https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap', [], ELEMENTOR_VERSION ); |
| 42 | 41 | |
| 43 | - wp_enqueue_style( 'elementor-admin-top-bar', $this->get_css_assets_url( 'admin-top-bar' ), [], ELEMENTOR_VERSION ); | |
| 42 | + wp_enqueue_style( 'elementor-admin-top-bar', $this->get_css_assets_url( 'admin-top-bar', null, 'default', true ), [], ELEMENTOR_VERSION ); | |
| 44 | 43 | |
| 45 | 44 | /** |
| 46 | 45 | * Before admin top bar enqueue scripts. |
| 47 | 46 | * |
| @@ -74,19 +73,9 @@ | ||
| 74 | 73 | $settings['is_administrator'] = current_user_can( 'manage_options' ); |
| 75 | 74 | |
| 76 | 75 | // TODO: Find a better way to add apps page url to the admin top bar. |
| 77 | 76 | $settings['apps_url'] = admin_url( 'admin.php?page=elementor-apps' ); |
| 78 | - $settings['promotion'] = [ | |
| 79 | - 'text' => __( 'Upgrade Now', 'elementor' ), | |
| 80 | - 'url' => 'https://go.elementor.com/wp-dash-admin-top-bar-upgrade/', | |
| 81 | - ]; | |
| 82 | 77 | |
| 83 | - $settings['promotion'] = Filtered_Promotions_Manager::get_filtered_promotion_data( | |
| 84 | - $settings['promotion'], | |
| 85 | - 'elementor/admin_top_bar/go_pro_promotion', | |
| 86 | - 'url' | |
| 87 | - ); | |
| 88 | - | |
| 89 | 78 | $current_screen = get_current_screen(); |
| 90 | 79 | |
| 91 | 80 | /** @var \Elementor\Core\Common\Modules\Connect\Apps\Library $library */ |
| 92 | 81 | $library = Plugin::$instance->common->get_component( 'connect' )->get_app( 'library' ); |
| @@ -110,11 +99,18 @@ | ||
| 110 | 99 | |
| 111 | 100 | private function is_top_bar_active() { |
| 112 | 101 | $current_screen = get_current_screen(); |
| 113 | 102 | |
| 103 | + if ( ! $current_screen ) { | |
| 104 | + return false; | |
| 105 | + } | |
| 106 | + | |
| 107 | + $is_elementor_page = strpos( $current_screen->id ?? '', 'elementor' ) !== false; | |
| 108 | + $is_elementor_post_type_page = strpos( $current_screen->post_type ?? '', 'elementor' ) !== false; | |
| 109 | + | |
| 114 | 110 | return apply_filters( |
| 115 | 111 | 'elementor/admin-top-bar/is-active', |
| 116 | - Admin::is_elementor_admin_page( $current_screen ), | |
| 112 | + $is_elementor_page || $is_elementor_post_type_page, | |
| 117 | 113 | $current_screen |
| 118 | 114 | ); |
| 119 | 115 | } |
| 120 | 116 | |