<?php

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

//=====[ set path ]=====//
$path = amJL_define_path();

//=====[ setting page ]=====//
$settings = glob($path['settings'].'*');
foreach ($settings as $setting){
    require_once($setting);
}

//=====[ enable additional contents ]=====//
add_action('admin_init', 'amJL_check_and_install_pro_content');
if (!function_exists('amJL_check_and_install_pro_content')) {
    function amJL_check_and_install_pro_content() {
        $license_key = get_option('amJL_plugin');
        $path = amJL_define_path();

        if (!empty($license_key)) {
            $result = amJL_is_license_valid($license_key);

            if ($result && $result->valid) {
                if (!file_exists( $path['contents'] . 'auto-making-json-ld-pro.php')) {
                    amJL_download_and_install_pro_features($result->package_url);
                }
            }
        }
    }
}

//=====[ include files ]=====//
$functions = glob($path['include'].'*');
foreach ($functions as $function){
    require_once($function);
}


// Pro contents
if (file_exists($path['autoMakingJSONLD'].'contents/auto-making-json-ld-pro.php')){
    require_once($path['autoMakingJSONLD'].'contents/auto-making-json-ld-pro.php');
}
