components['post_type'] = new Post_Type(); $this->components['post_type']->init(); if ( is_admin() ) { $this->components['notices'] = new Admin\Notices(); $this->components['notices']->init(); } if ( ! self::is_elementor_ready() ) { return; } $this->components['conditions'] = new Conditions(); $this->components['renderer'] = new Renderer(); $this->components['locations'] = new Locations(); $this->components['loader'] = new Template_Loader(); $this->components['popups'] = new Popups(); $this->components['stats'] = new Popup_Stats(); $this->components['rest'] = new Rest_Api(); $this->components['shortcode'] = new Shortcode(); $this->components['cache'] = new Cache(); $this->components['compat'] = new Compatibility(); $this->components['import'] = new Import_Export(); $this->components['elementor'] = new Elementor\Module(); $this->components['assets'] = new Assets(); $this->components['block'] = new Block(); $this->components['context_menu'] = new Admin_Bar(); foreach ( $this->components as $name => $component ) { if ( 'post_type' !== $name && 'notices' !== $name && method_exists( $component, 'init' ) ) { $component->init(); } } if ( is_admin() ) { $this->components['admin'] = new Admin\Admin(); $this->components['admin']->init(); $this->components['templates_list'] = new Admin\Templates_List(); $this->components['templates_list']->init(); } /** * Fires after Buildify has loaded all components. * * @param Plugin $plugin Plugin instance. */ do_action( 'buildify_loaded', $this ); } /** * Returns a component. * * @param string $name Component name. * @return object|null */ public function get( $name ) { return isset( $this->components[ $name ] ) ? $this->components[ $name ] : null; } /** * Whether a supported Elementor version is active. * * @return bool */ public static function is_elementor_ready() { return did_action( 'elementor/loaded' ) && defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, BUILDIFY_MIN_ELEMENTOR, '>=' ); } /** * Whether WooCommerce is active. * * @return bool */ public static function is_woocommerce_active() { return class_exists( 'WooCommerce' ) && function_exists( 'wc_get_product' ); } /** * Whether Elementor Pro is active. * * @return bool */ public static function is_elementor_pro_active() { return defined( 'ELEMENTOR_PRO_VERSION' ); } /** * Prevents cloning. */ private function __clone() {} /** * Private constructor. */ private function __construct() {} }