_instance_check(); $this->_register_cpt_and_taxonomies(); } /** * Dies if an instance already exists. */ protected function _instance_check() { if ( self::$_instance ) { et_error( 'Multiple instances are not allowed!' ); wp_die(); } } /** * Registers the Theme Builder Library's custom post type and its taxonomies. */ protected function _register_cpt_and_taxonomies() { $files = [ ET_CODE_SNIPPETS_DIR . 'post/type/CodeSnippet.php', ET_CODE_SNIPPETS_DIR . 'post/taxonomy/CodeSnippetType.php', ]; if ( ! $files ) { return; } foreach ( $files as $file ) { require_once $file; } $this->code_snippets = ET_Builder_Post_Type_Code_Snippet::instance(); $this->code_snippets_categories = ET_Builder_Post_Taxonomy_LayoutCategory::instance(); $this->code_snippets_tags = ET_Builder_Post_Taxonomy_LayoutTag::instance(); $this->code_snippets_type = ET_Builder_Post_Taxonomy_CodeSnippetType::instance(); // We manually call register_all() now to ensure the CPT and taxonomies are registered // at exactly the same point during the request that they were in prior releases. ET_Builder_Post_Type_TBItem::register_all( 'builder' ); } /** * Returns the ET_Builder_TBItem_Library instance. * * @return ET_Builder_TBItem_Library */ public static function instance() { if ( ! self::$_instance ) { self::$_instance = new self(); } return self::$_instance; } } ET_Builder_Code_Snippets_Library::instance();