<?php
/**
 * Keyideas Ring Filter & Search
 *
 * @package       KeyideasRingFilterAndSearch
 * @author        Keyideas Infotech Pvt. Ltd.
 * @version       1.2.5
 *
 * @wordpress-plugin
 * Plugin Name:   Keyideas Ring Filter & Search 
 * Description:   Keyideas Ring Filter & Search Plugin
 * Version:       1.2.5
 * Author:        Keyideas Infotech Pvt. Ltd.
 * Author URI:    https://www.keyideasinfotech.com/
 * Text Domain:   keyideas-jewelry-ring-filter-search
 * Requires Plugins: woocommerce
 * License: GPL-3.0-or-later
 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
 */

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

define('KRFSAPP_PLUGIN_DIR', plugins_url('', __FILE__));

// KDM Lite base directory
define('KRFSAPP_BASE_DIR', plugin_dir_path(__FILE__));
// Define Translation Domain
define('KRFSAPP_ALL_CATEGORIES', array('Engagement Rings', 'Wedding Men Rings','Wedding Women Rings','Wedding Rings'));
// Include the functions.php file
define('KRFSAPP_ALL_CATEGORIES_MAP', array(
    'Engagement Rings' => 'engagement-rings',
    'Wedding Men Rings' => 'wedding-men-rings',
    'Wedding Women Rings' => 'wedding-women-rings',
    'Wedding Rings' => 'wedding-rings'
));

define("KRFSAPP_THEME", "theme-zero");

define("KRFSAPP_VERSION", "1.2.5");

define('KRFSAPP_ENDPOINT_URL', 'https://engagement-rings-app-36n8t.kinsta.app/api');

// WordPress.org review URL for this plugin
if ( ! defined('KRFS_REVIEW_URL') ) {
    define('KRFS_REVIEW_URL', 'https://wordpress.org/support/plugin/keyideas-jewelry-ring-filter-search/reviews/?filter=5#new-post');
}

require_once('functions.php');

// Include the ajax-handler.php file
require_once('ajax-handler.php');

// Create dashboard menu item
function krfsapp_menu()
{
    add_menu_page(
        'Keyideas Ring Filter & Search Dashboard',
        'Keyideas Ring Filter & Search',
        'manage_options',
        'keyideas-ring-filter-and-search',
        'krfsapp_dashboard_page',
        plugins_url('assets/krfs-icon.svg', __FILE__),
        4
    );
}
add_action('admin_menu', 'krfsapp_menu');

// KRFS Home File
define('KRFSAPP_HOME_FILE', __FILE__);

define('KRFSAPP_SUPPORT_REQUEST_MAIL','sales@keyideasinfotech.com');
define('KRFSAPP_SUPPORT_REQUEST_BCC_MAIL','shopify.keyideas@gmail.com');

define('KRFSAPP_VERSION_CONTROL', array(
    'style-krfs_min_css' => KRFSAPP_VERSION,
    'admin_panel_js' => KRFSAPP_VERSION,
    'admin_activation_form.js' => KRFSAPP_VERSION,
    'admin_tab_language_js' => KRFSAPP_VERSION,
    'common_js' => KRFSAPP_VERSION,
    'ring_listing_krfs_js' => KRFSAPP_VERSION
));

// Clear WooCommerce cache
delete_transient('wc_attribute_taxonomies');

// Dashboard page content
function krfsapp_dashboard_page()
{

    $is_plugin_active = krfsapp_getMeta('_is_plugin_active') == 'true';
    // Enqueue Styles
    wp_enqueue_style('krfs-custom-style', KRFSAPP_PLUGIN_DIR . '/src/'.KRFSAPP_THEME.'/assets/style-krfs.min.css', array(), KRFSAPP_VERSION_CONTROL['style-krfs_min_css'], 'all');

    wp_enqueue_style('bootstrap-css', KRFSAPP_PLUGIN_DIR . '/assets/libs/bootstrap.min.css', array(), 
    '5.3.3', 'all');

    // Enqueue Scripts
    wp_enqueue_script('bootstrap-js', KRFSAPP_PLUGIN_DIR . '/assets/libs/bootstrap.min.js', array('jquery'), '5.3.1', true);
    wp_enqueue_script('krfs-custom-script-admin', KRFSAPP_PLUGIN_DIR . '/admin/scripts/admin.js', array('jquery', 'bootstrap-js'), KRFSAPP_VERSION_CONTROL['admin_panel_js'], true);
    wp_enqueue_script('krfs-custom-script-activation-form', KRFSAPP_PLUGIN_DIR . '/admin/scripts/admin-activation-form.js', array('bootstrap-js', 'jquery', 'krfs-custom-script-admin'), KRFSAPP_VERSION_CONTROL['admin_activation_form.js'], true);
    wp_enqueue_script('krfs-custom-script-language', KRFSAPP_PLUGIN_DIR . '/admin/scripts/admin-tab-language.js', array('bootstrap-js', 'jquery', 'krfs-custom-script-admin'), KRFSAPP_VERSION_CONTROL['admin_tab_language_js'], true);
    
    // Admin UI and Libs
    require_once('ColorsHelper.php');
    include_once('admin/index.php');
}

// Include the hooks file
include_once('krfs_hooks.php');
