PluginProbe
Elementor Website Builder – more than just a page builder / 3.4.0
Elementor Website Builder – more than just a page builder v3.4.0
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 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / admin-top-bar / module.php

module.php in Elementor Website Builder – more than just a page builder 3.4.0, at modules/admin-top-bar/module.php

110 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Elementor\Modules\AdminTopBar;
4
5 use Elementor\Core\Base\App as BaseApp;
6 use Elementor\Core\Experiments\Manager;
7 use Elementor\Plugin;
8 use Elementor\Utils;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly.
12 }
13
14 class Module extends BaseApp {
15
16 /**
17 * @return bool
18 */
19 public static function is_active() {
20 return is_admin();
21 }
22
23 public static function get_experimental_data() {
24 return [
25 'name' => 'admin-top-bar',
26 'title' => esc_html__( 'Admin Top Bar', 'elementor' ),
27 'description' => esc_html__( 'Adds a top bar to elementors pages in admin area.', 'elementor' ),
28 'release_status' => Manager::RELEASE_STATUS_BETA,
29 'new_site' => [
30 'default_active' => true,
31 ],
32 ];
33 }
34
35 /**
36 * @return string
37 */
38 public function get_name() {
39 return 'admin-top-bar';
40 }
41
42 private function render_admin_top_bar() {
43 ?>
44 <div id="e-admin-top-bar-root">
45 </div>
46 <?php
47 }
48 protected function get_init_settings() {
49 return [
50 'is_administrator' => current_user_can( 'manage_options' ),
51 ];
52 }
53
54 /**
55 * Enqueue admin scripts
56 */
57 private function enqueue_scripts() {
58 wp_enqueue_style( 'elementor-admin-top-bar-fonts', 'https://fonts.googleapis.com/css2?family=Roboto&display=swap', [], ELEMENTOR_VERSION );
59
60 wp_enqueue_style( 'elementor-admin-top-bar', $this->get_css_assets_url( 'admin-top-bar', null, 'default', true ), [], ELEMENTOR_VERSION );
61
62 wp_enqueue_script( 'elementor-admin-top-bar', $this->get_js_assets_url( 'admin-top-bar' ), [
63 'elementor-common',
64 'react',
65 'react-dom',
66 ], ELEMENTOR_VERSION, true );
67
68 $min_suffix = Utils::is_script_debug() ? '' : '.min';
69
70 wp_enqueue_script( 'tipsy', ELEMENTOR_ASSETS_URL . 'lib/tipsy/tipsy' . $min_suffix . '.js', [
71 'jquery',
72 ], '1.0.0', true );
73
74 $this->print_config();
75 }
76
77 /**
78 * Register dashboard widgets.
79 *
80 * Adds a new Elementor widgets to WordPress dashboard.
81 *
82 * Fired by `wp_dashboard_setup` action.
83 *
84 * @since 1.9.0
85 * @access public
86 */
87 public function register_dashboard_widgets() {
88 wp_add_dashboard_widget( 'e-dashboard-widget-admin-top-bar', __( 'Elementor Top Bar', 'elementor' ), function () {} );
89 }
90
91 /**
92 * Module constructor.
93 */
94 public function __construct() {
95 parent::__construct();
96
97 add_action( 'in_admin_header', function () {
98 $this->render_admin_top_bar();
99 } );
100
101 add_action( 'admin_enqueue_scripts', function () {
102 $this->enqueue_scripts();
103 } );
104
105 add_action( 'wp_dashboard_setup', function () {
106 $this->register_dashboard_widgets();
107 } );
108 }
109 }
110