<?php if(!defined('ABSPATH')){exit;}class dike_ajax_class{public function __construct(){add_action('wp_ajax_dike_get_remote_changelog',array($this,'dike_get_remote_changelog'));add_action('wp_ajax_dike_validate_domain_token',array($this,'dike_validate_domain_token'));add_action('wp_ajax_dike_dismiss_notice',array($this,'dike_dismiss_notice'));}public static function ajax_json_die($status,$message='',$params=array()){$structure=array_merge(array('status'=>$status,'message'=>$message,),$params);wp_die(json_encode($structure));}public function dike_validate_domain_token(){global $dike_authors;if(!isset($_POST['dike_nonce'])||!wp_verify_nonce($_POST['dike_nonce'],'dike_nonce')){self::ajax_json_die('error','Cheating?');}if(!isset($_POST['author'])||!isset($dike_authors[$_POST['author']])){self::ajax_json_die('error','Author missing');}if(!isset($_POST['data'])||empty($_POST['data'])){self::ajax_json_die('error','Data missing');}$lic_class=new dike_licenses($_POST['author']);$response=$lic_class->validate_domain_token(stripslashes($_POST['data']));if($response===true){self::ajax_json_die('success','Token successfully validated!');}else{self::ajax_json_die('error',$response);}}public function dike_dismiss_notice(){global $dike_authors;if(!isset($_POST['dike_nonce'])||!wp_verify_nonce($_POST['dike_nonce'],'dike_nonce')){self::ajax_json_die('error','Cheating?');}if(!isset($_POST['notice_id'])||empty($_POST['notice_id'])||strlen($_POST['notice_id'])!=32){self::ajax_json_die('error','Notice ID missing');}if(!isset($_POST['trans_time'])||!is_numeric($_POST['trans_time'])){self::ajax_json_die('error','Notice transient time missing');}$transient_name='dike_notice_'.$_POST['notice_id'].'_dismissed';set_transient($transient_name,1,(int)$_POST['trans_time']);self::ajax_json_die('success');}}new dike_ajax_class();