<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
/**
 * The file that defines the core plugin class
 *
 * A class definition that includes attributes and functions used across both the
 * public-facing side of the site and the admin area.
 *
 * @link       https://profiles.wordpress.org/gohelkunjan
 * @since      1.0.0
 *
 * @package    KG_Digital_Catalog_For_WooCommerce
 * @subpackage KG_Digital_Catalog_For_WooCommerce/includes
 */
/**
 * The core plugin class.
 *
 * This is used to define internationalization, admin-specific hooks, and
 * public-facing site hooks.
 *
 * Also maintains the unique identifier of this plugin as well as the current
 * version of the plugin.
 *
 * @since      1.0.0
 * @package    KG_Digital_Catalog_For_WooCommerce
 * @subpackage KG_Digital_Catalog_For_WooCommerce/includes
 * @author     gohelkunjan 
 */
class KGDC_Main {
	/**
	 * The kgdc_loader that's responsible for maintaining and registering all hooks that power
	 * the plugin.
	 *
	 * @since    1.0.0
	 * @access   protected
	 * @var      KGDC_Loader    $kgdc_loader    Maintains and registers all hooks for the plugin.
	 */
	protected $kgdc_loader;
	/**
	 * The unique identifier of this plugin.
	 *
	 * @since    1.0.0
	 * @access   protected
	 * @var      string    $plugin_name    The string used to uniquely identify this plugin.
	 */
	protected $kgdc_plugin_name;

	/**
	 * The current version of the plugin.
	 *
	 * @since    1.0.0
	 * @access   protected
	 * @var      string    $version    The current version of the plugin.
	 */
	protected $kgdc_version;

	/**
	 * Define the core functionality of the plugin.
	 *
	 * Set the plugin name and the plugin version that can be used throughout the plugin.
	 * Load the dependencies, define the locale, and set the hooks for the admin area and
	 * the public-facing side of the site.
	 *
	 * @since    1.0.0
	 */
	public function __construct() {
		if ( defined( 'KGDC_VERSION' ) ) {
			$this->kgdc_version = KGDC_VERSION;
		} else {
			$this->kgdc_version = '1.0.0';
		}
		$this->kgdc_plugin_name = 'kg-digital-catalog-for-woocommerce';

		$this->kgdc_load_dependencies();
		$this->kgdc_set_locale();
		$this->kgdc_define_admin_hooks();
	}
	/**
	 * Load the required dependencies for this plugin.
	 *
	 * Include the following files that make up the plugin:
	 *
	 * - KGDC_Loader. Orchestrates the hooks of the plugin.
	 * - KG_Digital_Catalog_For_WooCommerce_i18n. Defines internationalization functionality.
	 * - KGDC_Admin. Defines all hooks for the admin area.
	 * - KG_Digital_Catalog_For_WooCommerce_Public. Defines all hooks for the public side of the site.
	 *
	 * Create an instance of the kgdc_loader which will be used to register the hooks
	 * with WordPress.
	 *
	 * @since    1.0.0
	 * @access   private
	 */
	private function kgdc_load_dependencies() {
		/**
		 * The class responsible for orchestrating the actions and filters of the
		 * core plugin.
		 */
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-kg-digital-catalog-for-woocommerce-loader.php';

		/**
		 * The class responsible for defining internationalization functionality
		 * of the plugin.
		 */
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-kg-digital-catalog-for-woocommerce-i18n.php';

		/**
		 * The class responsible for defining all actions that occur in the admin area.
		 */
		require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-kg-digital-catalog-for-woocommerce-admin.php';
		
		$this->kgdc_loader = new KGDC_Loader();
	}
	/**
	 * Define the locale for this plugin for internationalization.
	 *
	 * Uses the KG_Digital_Catalog_For_WooCommerce_i18n class in order to set the domain and to register the hook
	 * with WordPress.
	 *
	 * @since    1.0.0
	 * @access   private
	 */
	private function kgdc_set_locale() {

		$plugin_i18n = new KGDC_i18n();

		$this->kgdc_loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
	}
	/**
	 * Register all of the hooks related to the admin area functionality
	 * of the plugin.
	 *
	 * @since    1.0.0
	 * @access   private
	 */
	private function kgdc_define_admin_hooks() {
		$kgdc_plugin_admin = new KGDC_Admin( $this->kgdc_get_plugin_name(), $this->kgdc_get_version() );

		$this->kgdc_loader->add_action( 'admin_enqueue_scripts', $kgdc_plugin_admin, 'kgdc_enqueue_styles' );
		$this->kgdc_loader->add_action( 'admin_enqueue_scripts', $kgdc_plugin_admin, 'kgdc_enqueue_scripts' );
		$this->kgdc_loader->add_action( 'admin_init', $kgdc_plugin_admin,'kgdc_pdf_catalog_register_settings' );
        $this->kgdc_loader->add_action( 'admin_menu', $kgdc_plugin_admin,'kgdc_pdf_catelog_options_page');    	
	}
	/**
	 * Run the kgdc_loader to execute all of the hooks with WordPress.
	 *
	 * @since    1.0.0
	 */
	public function run() {
		$this->kgdc_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 kgdc_get_plugin_name() {
		return $this->kgdc_plugin_name;
	}
	/**
	 * The reference to the class that orchestrates the hooks with the plugin.
	 *
	 * @since     1.0.0
	 * @return    KGDC_Loader    Orchestrates the hooks of the plugin.
	 */
	public function kgdc_get_loader() {
		return $this->kgdc_loader;
	}
	/**
	 * Retrieve the version number of the plugin.
	 *
	 * @since     1.0.0
	 * @return    string    The version number of the plugin.
	 */
	public function kgdc_get_version() {
		return $this->kgdc_version;
	}
}
