<?php
/**
 * DIKE LICENSING - WP INTEGRATION CODE
 *
 * @author    Luca Montanari (https://www.dikelicensing.com)
 * @copyright Copyright (c) 2025
 * @license   Commercial
 * @version   3.2.2
 */

if(!defined('ABSPATH')){exit;}$GLOBALS[md5(__DIR__).'dike_v']='3.2.2';add_action('init',function(){if(isset($GLOBALS['dike_registr'])&&version_compare($GLOBALS[md5(__DIR__).'dike_v'],$GLOBALS['dike_registr'],'<=')){return false;}$GLOBALS['dike_registr']=$GLOBALS[md5(__DIR__).'dike_v'];},2);add_action('init',function(){if(isset($GLOBALS['lc_wp_dash_ajax_registr'])){$GLOBALS['lc_wp_dash_ajax_registr']=-1;}$GLOBALS['lcwpd_baseurl']=false;remove_action('admin_enqueue_scripts','lcwpd_scripts');remove_action('activated_plugin','lcwpd_pre_redirect_on_activation');remove_action('admin_init','lcwpd_redirect_on_activation');if($GLOBALS['dike_registr']!=$GLOBALS[md5(__DIR__).'dike_v']||isset($GLOBALS['dike_init'])){return false;}$GLOBALS['dike_init']=$GLOBALS[md5(__DIR__).'dike_v'];include_once(__DIR__.'/licenses.php');include_once(__DIR__.'/updater.php');include_once(__DIR__.'/ajax.php');include_once(__DIR__.'/func_n_hooks.php');add_action('wp_head','dike_licenses::plc_js',2);add_action('admin_head','dike_licenses::plc_js',2);add_action('admin_head','dike_licenses::admin_js_lic_db',3);add_action('wp_head','dike_licenses::plc_sc',9999999);$content_url=untrailingslashit(content_url());$cu_arr=explode('/',$content_url);$arr=explode('/'.end($cu_arr),str_replace('\\','/',__DIR__));$baseurl=$content_url.end($arr);$GLOBALS['dike_baseurl']=untrailingslashit($baseurl);},3);add_action('admin_menu',function(){if(isset($GLOBALS['dike_menu_registr'])&&version_compare($GLOBALS[md5(__DIR__).'dike_v'],$GLOBALS['dike_menu_registr'],'<=')){return false;}$GLOBALS['dike_menu_registr']=$GLOBALS[md5(__DIR__).'dike_v'];},1);add_action('admin_menu',function(){if(isset($GLOBALS['lc_wp_dash_registr'])){$GLOBALS['lc_wp_dash_registr']=-1;}if($GLOBALS['dike_menu_registr']!=$GLOBALS[md5(__DIR__).'dike_v']||isset($GLOBALS['dike_menu_init'])){return false;}if(!isset($GLOBALS['dike_authors'])||empty($GLOBALS['dike_authors'])){return false;}dike_menu();$GLOBALS['dike_menu_init']=true;},2);add_action('admin_init',function(){if(isset($GLOBALS['dike_updater_init'])){return false;}if(!isset($GLOBALS['dike_authors'])||empty($GLOBALS['dike_authors'])){return false;}dike_licenses::init_updater();$GLOBALS['dike_updater_init']=true;},2);add_action('admin_notices',function(){if((isset($GLOBALS['dike_menu_registr'])&&version_compare($GLOBALS[md5(__DIR__).'dike_v'],$GLOBALS['dike_menu_registr'],'<'))||!isset($GLOBALS['dike_authors'])||empty($GLOBALS['dike_authors'])||isset($GLOBALS['dike_admin_notice_processed'])){return false;}global $dike_authors;foreach((array)$dike_authors as $author_slug=>$config){$is_author_dashboard=(isset($_GET['page'])&&$_GET['page']=='dike_wpd'&&isset($_GET['author'])&&$_GET['author']==$author_slug)?true:false;dike_dashboard_message($author_slug,$is_author_dashboard);$dike_lic=new dike_licenses($author_slug);add_action('admin_notices',array($dike_lic,'expired_lic_admin_notice'));add_action('admin_notices',array($dike_lic,'inactive_prod_admin_notice'));}$GLOBALS['dike_admin_notice_processed']=true;},2);