version = THREED_VERSION; } else { $this->version = '1.0.0'; } $this->plugin_name = 'threedvieweronline-iframe'; $this->load_dependencies(); $this->define_admin_hooks(); $this->define_public_hooks(); } /** * Load the required dependencies for this plugin. * * Include the following files that make up the plugin: * * - Threedvieweronline_Iframe_Loader. Orchestrates the hooks of the plugin. * - Threedvieweronline_Iframe_Admin. Defines all hooks for the admin area. * - Threedvieweronline_Iframe_Public. Defines all hooks for the public side of the site. * * Create an instance of the loader which will be used to register the hooks * with WordPress. * * @since 1.0.0 * @access private */ private function load_dependencies() { /** * The class responsible for orchestrating the actions and filters of the * core plugin. */ require_once THREED_PLUGIN_DIR . '/includes/class-threedvieweronline-iframe-loader.php'; /** * The class responsible for defining all actions that occur in the admin area. */ require_once THREED_PLUGIN_DIR . '/admin/class-threedvieweronline-iframe-admin.php'; /** * The class responsible for defining all actions that occur in the public-facing * side of the site. */ require_once THREED_PLUGIN_DIR . '/public/class-threedvieweronline-iframe-public.php'; $this->loader = new Threedvieweronline_Iframe_Loader(); // WooCommerce is optional; standalone blocks and shortcodes also work without it. } /** * Register all of the hooks related to the admin area functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_admin_hooks() { $plugin_admin = new Threedvieweronline_Iframe_Admin( $this->get_plugin_name(), $this->get_version(), $this->get_loader() ); // Add common script to admin. $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'admin_enqueue_scripts' ); // Plugin links. $this->loader->add_filter( 'plugin_action_links_' . THREED_PLUGIN_BASENAME, $plugin_admin, 'plugin_settings_link' ); $this->loader->add_filter( 'plugin_row_meta', $plugin_admin, 'plugin_row_meta', 10, 2 ); // menu. $this->loader->add_action( 'admin_menu', $plugin_admin, 'admin_menu' ); // block. $this->loader->add_action( 'init', $plugin_admin, 'register_blocks' ); // add product meta boxes. $this->loader->add_action( 'add_meta_boxes', $plugin_admin, 'threed_product_register_meta_boxes' ); $this->loader->add_action( 'save_post_product', $plugin_admin, 'threed_product_meta_box_save' ); // Tinymce Button. $this->loader->add_action( 'admin_head', $plugin_admin, 'threed_add_my_custom_tinymce_button' ); } /** * Register all of the hooks related to the public-facing functionality * of the plugin. * * @since 1.0.0 * @access private */ private function define_public_hooks() { $plugin_public = new Threedvieweronline_Iframe_Public( $this->get_plugin_name(), $this->get_version() ); $this->loader->add_action( 'init', $plugin_public, 'threedvieweronline_init_callback' ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' ); $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' ); $this->loader->add_filter( 'woocommerce_product_tabs', $plugin_public, 'threed_woo_new_product_tab', 100, 1 ); $this->loader->add_action( 'woocommerce_single_product_summary', $plugin_public, 'woocommerce_single_product_summary_callback', 6 ); $this->loader->add_action( 'woocommerce_before_add_to_cart_form', $plugin_public, 'woocommerce_before_add_to_cart_form_callback', 5 ); $this->loader->add_action( 'woocommerce_after_add_to_cart_form', $plugin_public, 'woocommerce_after_add_to_cart_form_callback', 5 ); } /** * Run the loader to execute all of the hooks with WordPress. * * @since 1.0.0 */ public function run() { $this->loader->run(); } /** * The name of the plugin used to uniquely identify it within the context of * WordPress and to define internationalization functionality. * * @since 1.0.0 * @return string The name of the plugin. */ public function get_plugin_name() { return $this->plugin_name; } /** * The reference to the class that orchestrates the hooks with the plugin. * * @since 1.0.0 * @return Scratch_Coupon_Card_Loader Orchestrates the hooks of the plugin. */ public function get_loader() { return $this->loader; } /** * Retrieve the version number of the plugin. * * @since 1.0.0 * @return string The version number of the plugin. */ public function get_version() { return $this->version; } }