PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.2
Elementor Website Builder – more than just a page builder v3.30.2
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
← All changes | includes/plugin.php +42 -4 4.2.43.30.2 View file →
@@ -1,8 +1,9 @@
1 1 <?php
2 -
3 2 namespace Elementor;
4 3
4 +use Elementor\Container\Container;
5 +use ElementorDeps\DI\Container as DIContainer;
5 6 use Elementor\Core\Admin\Menu\Admin_Menu_Manager;
6 7 use Elementor\Core\Wp_Api;
7 8 use Elementor\Core\Admin\Admin;
8 9 use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager;
@@ -24,8 +25,12 @@
24 25 use Elementor\Modules\System_Info\Module as System_Info_Module;
25 26 use Elementor\Data\Manager as Data_Manager;
26 27 use Elementor\Data\V2\Manager as Data_Manager_V2;
27 28 use Elementor\Core\Files\Uploads_Manager;
29 +use ElementorDeps\DI\{
30 + DependencyException,
31 + NotFoundException,
32 +};
28 33
29 34 if ( ! defined( 'ABSPATH' ) ) {
30 35 exit;
31 36 }
@@ -38,9 +43,8 @@
38 43 *
39 44 * @since 1.0.0
40 45 */
41 46 class Plugin {
42 -
43 47 const ELEMENTOR_DEFAULT_POST_TYPES = [ 'page', 'post' ];
44 48
45 49 /**
46 50 * Instance.
@@ -545,8 +549,16 @@
545 549 */
546 550 public $assets_loader;
547 551
548 552 /**
553 + * Container instance for managing dependencies.
554 + *
555 + * @since 3.24.0
556 + * @var DIContainer
557 + */
558 + private $container;
559 +
560 + /**
549 561 * Clone.
550 562 *
551 563 * Disable class cloning and throw an error on object clone.
552 564 *
@@ -607,9 +619,34 @@
607 619
608 620 return self::$instance;
609 621 }
610 622
623 + public function initialize_container() {
624 + Container::initialize_instance();
625 +
626 + $this->container = Container::get_instance();
627 + }
628 +
611 629 /**
630 + * Get the Elementor container or resolve a dependency.
631 + *
632 + * @param string|null $dependency The dependency to resolve. If null, returns the container instance.
633 + *
634 + * @return mixed The container instance or the resolved dependency.
635 + *
636 + * @throws \InvalidArgumentException The name parameter must be of type string.
637 + * @throws DependencyException Error while resolving the entry.
638 + * @throws NotFoundException No entry found for the given name.
639 + */
640 + public function elementor_container( $dependency = null ) {
641 + if ( is_null( $dependency ) ) {
642 + return $this->container;
643 + }
644 +
645 + return $this->container->make( $dependency );
646 + }
647 +
648 + /**
612 649 * Init.
613 650 *
614 651 * Initialize Elementor Plugin. Register Elementor support for all the
615 652 * supported post types and initialize Elementor components.
@@ -715,9 +752,8 @@
715 752 $this->admin_menu_manager = new Admin_Menu_Manager();
716 753 $this->admin_menu_manager->register_actions();
717 754
718 755 User::init();
719 - User_Data::init();
720 756 Api::init();
721 757 Tracker::init();
722 758
723 759 $this->upgrade = new Core\Upgrade\Manager();
@@ -833,6 +869,8 @@
833 869 }
834 870
835 871 if ( ! defined( 'ELEMENTOR_TESTS' ) ) {
836 872 // In tests we run the instance manually.
837 - Plugin::instance();
873 + $plugin_instance = Plugin::instance();
874 +
875 + $plugin_instance->initialize_container();
838 876 }