add_cpt_support(); $this->init_components(); /** * Elementor init. * * Fires on Elementor init, after Elementor has finished loading but * before any headers are sent. * * @since 1.0.0 */ do_action( 'elementor/init' ); } /** * Init components. * * Initialize Elementor components. Register actions, run setting manager, * initialize all the components that run elementor, and if in admin page * initialize admin components. * * @since 1.0.0 * @access private */ private function init_components() { Compatibility::register_actions(); SettingsManager::run(); $this->db = new DB(); $this->controls_manager = new Controls_Manager(); $this->schemes_manager = new Schemes_Manager(); $this->elements_manager = new Elements_Manager(); $this->widgets_manager = new Widgets_Manager(); $this->skins_manager = new Skins_Manager(); $this->posts_css_manager = new Posts_CSS_Manager(); $this->settings = new Settings(); $this->editor = new Editor(); $this->preview = new Preview(); $this->frontend = new Frontend(); $this->debug = new Debug(); $this->templates_manager = new TemplateLibrary\Manager(); $this->maintenance_mode = new Maintenance_Mode(); $this->modules_manager = new Modules_Manager(); Api::init(); Tracker::init(); if ( is_admin() ) { $this->revisions_manager = new Revisions_Manager(); $this->heartbeat = new Heartbeat(); $this->wordpress_widgets_manager = new WordPress_Widgets_Manager(); $this->system_info = new System_Info\Main(); $this->admin = new Admin(); $this->tools = new Tools(); $this->beta_testers = new Beta_Testers(); if ( Utils::is_ajax() ) { new Images_Manager(); } } } /** * Add custom post type support. * * Register Elementor support for all the supported post types defined by * the user in the admin screen and saved as `elementor_cpt_support` option * in WordPress ``$wpdb->options` table. * * If no custom post type selected, usually in new installs, this method * will return the two default post types: `page` and `post`. * * @since 1.0.0 * @access private */ private function add_cpt_support() { $cpt_support = get_option( 'elementor_cpt_support', [ 'page', 'post' ] ); foreach ( $cpt_support as $cpt_slug ) { add_post_type_support( $cpt_slug, 'elementor' ); } } /** * Register autoloader. * * Elementor autoloader loads all the classes needed to run the plugin. * * @since 1.6.0 * @access private */ private function register_autoloader() { require ELEMENTOR_PATH . '/includes/autoloader.php'; Autoloader::run(); } /** * Plugin constructor. * * Initializing Elementor plugin. * * @since 1.0.0 * @access private */ private function __construct() { $this->register_autoloader(); add_action( 'init', [ $this, 'init' ], 0 ); } } if ( ! defined( 'ELEMENTOR_TESTS' ) ) { // In tests we run the instance manually. Plugin::instance(); }