<?php
/**
 * Pawfect Customizer Notify
 *
 * @package Pawfect
 */

// Exit if accessed directly.
if (!defined('ABSPATH')) {
    exit;
}

/**
 * Pawfect Customizer Notify Class
 */
if (!class_exists('Pawfect_Customizer_Notify')) {

    class Pawfect_Customizer_Notify {

        /**
         * Constructor
         */
        public function __construct() {
            if (apply_filters('pawfect_is_pro_active', false)) {
                return;
            }
            add_action('customize_register', array($this, 'pawfect_customizer_notify_register'));
            add_action('customize_controls_enqueue_scripts', array($this, 'pawfect_customizer_notify_scripts'));
            add_action('customize_controls_print_styles', array($this, 'pawfect_customizer_notify_styles'));
        }

        /**
         * Register the customizer notify section
         */
        public function pawfect_customizer_notify_register($wp_customize) {
            
            // Include the notify section class
            require_once get_template_directory() . '/inc/customizer/customizer-notice/class-pawfect-customizer-notify-section.php';

            // Register the section type
            $wp_customize->register_section_type('Pawfect_Customizer_Notify_Section');

            // Add the notify section
            $wp_customize->add_section(
                new Pawfect_Customizer_Notify_Section(
                    $wp_customize,
                    'pawfect-customizer-notify-section',
                    array(
                        'title'      => esc_html__('Pawfect Pro', 'pawfect'),
                        'pro_text'   => esc_html__('Upgrade to Pro', 'pawfect'),
                        'pro_url'    => 'https://wpmatcha.com/wordpress-themes/pawfect/',
                        'demo_text'  => esc_html__('Pro Demo', 'pawfect'),
                        'demo_url'   => 'https://pawfect.wpmatcha.com/',
                        'priority'   => 1,
                    )
                )
            );
        }

        /**
         * Enqueue customizer notify scripts
         */
        public function pawfect_customizer_notify_scripts() {
            wp_enqueue_script(
                'pawfect-customizer-notify',
                get_template_directory_uri() . '/inc/customizer/customizer-notice/customizer-notify.js',
                array('jquery', 'customize-controls'),
                PAWFECT_THEME_VERSION,
                true
            );
        }

        /**
         * Print customizer notify styles
         */
        public function pawfect_customizer_notify_styles() {
            ?>
            <style type="text/css" id="pawfect-customizer-notify-styles-v2">
                <?php include get_template_directory() . '/inc/customizer/customizer-notice/customizer-notify.css'; ?>
            </style>
            <?php
        }
    }

    // Initialize the class
    new Pawfect_Customizer_Notify();
}
?>
