<?php
/*
Plugin Name: Pedro Demo Import
Plugin URI: 
Description:  import demo content, widgets, and customizer settings for the Pedro theme with just one click.
Version: 1.1.0
Author: hmrisad
Author URI: 
License: GPL3
License URI: http://www.gnu.org/licenses/gpl.html
Text Domain: pedro-demo-import
*/


if ( ! defined( 'ABSPATH' ) ) {
    exit;
}

/**
 * The main plugin class
 */
final class Pedro {

    /**
     * Plugin version
     *
     * @var string
     */
    const version = '1.1.0';

    /**
     * Class construcotr
     */
    private function __construct() {
        $this->define_constants();

        register_activation_hook( __FILE__, [ $this, 'activate' ] );

        add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
    }

    /**
     * Initializes a singleton instance
     *
     * @return \Pedro
     */
    public static function init() {
        static $instance = false;

        if ( ! $instance ) {
            $instance = new self();
        }

        return $instance;
    }

    /**
     * Define the required plugin constants
     *
     * @return void
     */
    public function define_constants() {
        define( 'PDI_VERSION', self::version );
        define( 'PDI_FILE', __FILE__ );
        define( 'PDI_PATH', __DIR__ );
        define( 'PDI_URL', plugins_url( '', PDI_FILE ) );
    }

   /**
     * Initialize the plugin
     *
     * @return void
     */
    public function init_plugin() {
        require_once PDI_PATH . '/tgm/class-tgm-plugin-activation.php';
        require_once PDI_PATH . '/tgm/pedro-activation.php';
        require_once PDI_PATH . '/inc/pedro-function.php';
    }

    /**
     * Do stuff upon plugin activation
     *
     * @return void
     */
    public function activate() {
        $installed = get_option( 'pdi_installed' );

        if ( ! $installed ) {
            update_option( 'pdi_installed', time() );
        }

        update_option( 'pdi_version', PDI_VERSION );
    }
}

Pedro::init();