De-obfuscate PHP malware/viruses and tampering code on Wordpress to original readable code.
*Please note that not all obfuscation codes can be decoded.<?php class dike_licenses{public static function prod_is_theme($path){return(strpos($path,base64_decode('Lw=='))!==false)?false:true;}public static function owned_products($author){$owned=array();if(!isset($GLOBALS[base64_decode('ZGlrZV9wcm9kdWN0cw==')][$author])){return $owned;}foreach($GLOBALS[base64_decode('ZGlrZV9wcm9kdWN0cw==')][$author]as $path=>$pdata){if((!self::prod_is_theme($path)&&is_plugin_active($path))||(self::prod_is_theme($path)&&get_template()==$path)){$owned[$path]=$pdata;}}return $owned;}public static function missing_products($author){$owned=self::owned_products($author);$missing=array();foreach($GLOBALS[base64_decode('ZGlrZV9wcm9kdWN0cw==')][$author]as $path=>$data){if(isset($owned[$path])){continue;}$missing[$path]=$data;}$missing=(array)apply_filters(base64_decode('ZGlrZV8=').$author.base64_decode('X21pc3NpbmdfcHJvZHVjdHM='),$missing,$owned);return $missing;}public static function supports_lc_dashboard($path,$author){global $wp_filesystem;if(strpos($path,base64_decode('cHZ0Y29udGVudF9idW5kbGUv'))!==false&&strpos($path,base64_decode('L3ByaXZhdGVfY29udGVudC5waHA='))===false){$target_path=base64_decode('cHZ0Y29udGVudF9idW5kbGUvcGx1Z2lucy9wcml2YXRlLWNvbnRlbnQvcHJpdmF0ZV9jb250ZW50LnBocA==');return self::supports_lc_dashboard($target_path,$author);}elseif(strpos($path,base64_decode('cHJpdmF0ZS1jb250ZW50LQ=='))!==false){$target_path=base64_decode('cHJpdmF0ZS1jb250ZW50L3ByaXZhdGVfY29udGVudC5waHA=');return self::supports_lc_dashboard($target_path,$author);}elseif(strpos($path,base64_decode('bWVkaWEtZ3JpZC1idW5kbGUv'))!==false&&strpos($path,base64_decode('L21lZGlhLWdyaWQucGhw'))===false){$target_path=base64_decode('bWVkaWEtZ3JpZC1idW5kbGUvcGx1Z2lucy9tZWRpYS1ncmlkL21lZGlhLWdyaWQucGhw');return self::supports_lc_dashboard($target_path,$author);}elseif(strpos($path,base64_decode('bWVkaWEtZ3JpZC0='))!==false&&strpos($path,base64_decode('bWVkaWEtZ3JpZC1idW5kbGUv'))===false){$target_path=base64_decode('bWVkaWEtZ3JpZC9tZWRpYS1ncmlkLnBocA==');return self::supports_lc_dashboard($target_path,$author);}WP_Filesystem();$arr=explode(base64_decode('Lw=='),$path);unset($arr[(count($arr)-1)]);$target_old=WP_PLUGIN_DIR.base64_decode('Lw==').implode(base64_decode('Lw=='),$arr).base64_decode('L2NsYXNzZXMvbGNfd3BfYXV0b191cGRhdGVy');$target_dike=WP_PLUGIN_DIR.base64_decode('Lw==').implode(base64_decode('Lw=='),$arr).base64_decode('L0RJS0U=');return($wp_filesystem->exists($target_old)&&!$wp_filesystem->exists($target_dike))?false:true;}public static function ignore_www($str){return trim(str_replace(array(base64_decode('d3d3Lg=='),base64_decode('V1dXLg==')),'',$str));}public static function human_remaining_time($time,$short=false){$secs=$time-gmdate(base64_decode('VQ=='));$units=array(base64_decode('bW9udGg=')=>30*24*3600,base64_decode('d2Vlaw==')=>7*24*3600,base64_decode('ZGF5')=>24*3600,base64_decode('aG91cg==')=>3600,base64_decode('bWludXRl')=>60);$singular_names=array(base64_decode('bW9udGg=')=>_(base64_decode('bW9udGg=')),base64_decode('d2Vlaw==')=>_(base64_decode('d2Vlaw==')),base64_decode('ZGF5')=>_(base64_decode('ZGF5')),base64_decode('aG91cg==')=>_(base64_decode('aG91cg==')),base64_decode('bWludXRl')=>_(base64_decode('bWludXRl')));$plural_names=array(base64_decode('bW9udGg=')=>_(base64_decode('bW9udGhz')),base64_decode('d2Vlaw==')=>_(base64_decode('d2Vla3M=')),base64_decode('ZGF5')=>_(base64_decode('ZGF5cw==')),base64_decode('aG91cg==')=>_(base64_decode('aG91cnM=')),base64_decode('bWludXRl')=>_(base64_decode('bWludXRlcw==')));$human='';$second_cycle=false;foreach($units as $unit=>$divisor){$result=$secs/$divisor;if($result>=1){if($short&&$second_cycle){break;}$int_val=floor($result);$txt=($int_val>1)?$plural_names[$unit]:$singular_names[$unit];$and=($second_cycle)?base64_decode('IA==')._(base64_decode('YW5k')).base64_decode('IA=='):'';$human.=$and.floor($result).base64_decode('IA==').$txt;if(is_float($result)&&!$second_cycle){$secs=$secs-($divisor*$int_val);$second_cycle=true;}else{break;}}}return $human;}public static function human_support_remaining_time($time){$secs=$time-gmdate(base64_decode('VQ=='));$pre=base64_decode('PHNwYW4gY2xhc3M9ImRhc2hpY29ucyBkYXNoaWNvbnMtc29zIj48L3NwYW4+IA==');if($secs<120){return base64_decode('PHNwYW4gY2xhc3M9ImRpa2VfZXhwaXJlZF9zdXBwb3J0Ij4=').$pre.base64_decode('RXhwaXJlZCBzdXBwb3J0IGVudGl0bGVtZW50PC9zcGFuPg==');}$human=self::human_remaining_time($time,true);return $pre.base64_decode('U3VwcG9ydCBlbnRpdGxlbWVudCBlbmRzIGluIA==').$human;}public static function human_lic_expir_remaining_time($time){$secs=$time-gmdate(base64_decode('VQ=='));if($secs<120){return base64_decode('PHNwYW4gY2xhc3M9ImRpa2VfZXhwaXJlZF9zdXBwb3J0Ij5leHBpcmVkIHRva2VuPC9zcGFuPg==');}$human=self::human_remaining_time($time,true);return $human.base64_decode('IGxlZnQ=');}public static function init_updater(){global $dike_authors;foreach(array_keys($dike_authors)as $author){$updater_prods_data=(array)apply_filters(base64_decode('ZGlrZV8=').$author.base64_decode('X3VwZGF0ZXI='),array());if($author==base64_decode('bGN3ZWI=')){$updater_prods_data=apply_filters(base64_decode('bGN3cGJfdXBkYXRlcl9kYXRh'),$updater_prods_data);}foreach(self::owned_products($author)as $prod_path=>$pdata){$true_slug=str_replace($author.base64_decode('LQ=='),'',$pdata[base64_decode('c2x1Zw==')]);if($author==base64_decode('bGN3ZWI=')&&!self::supports_lc_dashboard($prod_path,$author)){continue;}if(!isset($updater_prods_data[$true_slug])){$callback=false;$no_files_del=false;}else{$upd_data=$updater_prods_data[$true_slug];$callback=(isset($upd_data[base64_decode('Y2FsbGJhY2s=')]))?(string)$upd_data[base64_decode('Y2FsbGJhY2s=')]:false;$no_files_del=(isset($upd_data[base64_decode('bm9fZmlsZXNfZGVs')])&&$upd_data[base64_decode('bm9fZmlsZXNfZGVs')]===true)?true:false;}if(apply_filters(base64_decode('ZGlrZV9za2lwXw==').$author.base64_decode('X3VwZGF0ZXI='),false,$pdata[base64_decode('c2x1Zw==')],$pdata)){continue;}$prod_type=(self::prod_is_theme($prod_path))?base64_decode('dGhlbWU='):base64_decode('cGx1Z2lu');$prod_path=($prod_type==base64_decode('dGhlbWU='))?get_template_directory():WP_PLUGIN_DIR.base64_decode('Lw==').$prod_path;$updater=new dike_product_updater($author,$dike_authors[$author],$pdata[base64_decode('aWQ=')],$prod_type,$prod_path,$callback,$no_files_del);$updater->dike_prod_data=$pdata;}}}public static function decrypt_js_crypted($encoded){$decoded='';for($i=0;$i<strlen($encoded);$i++){$b=ord($encoded[$i]);$a=$b^88;$decoded.=chr($a);}return json_decode($decoded,true);}public static function plc($author,$slug,$js_redirect=false){global $dike_products;$GLOBALS[base64_decode('ZGlrZV9pc19jaGVja2luZ19saWM=')]=true;$slug_exists=false;$pid=0;if(!isset($dike_products[$author])){return true;}foreach($dike_products[$author]as $pdata){if($pdata[base64_decode('c2x1Zw==')]==$author.base64_decode('LQ==').$slug){$slug_exists=true;$pid=(int)$pdata[base64_decode('aWQ=')];break;}}if(!$slug_exists){return true;}$class=new dike_licenses($author);$db=$class->get_db();$licenses=(array)$db[base64_decode('bGlj')];$to_return=(isset($licenses[$pid]))?true:false;$to_return=apply_filters(base64_decode('ZGlrZV8=').$author.base64_decode('X3BsYw=='),$to_return,$slug,$js_redirect,$author);if(!$to_return&&$js_redirect&&function_exists(base64_decode('Y3VycmVudF91c2VyX2Nhbg=='))&¤t_user_can(base64_decode('aW5zdGFsbF9wbHVnaW5z'))){if(!is_admin()||(is_admin()&&strpos($_SERVER[base64_decode('UkVRVUVTVF9VUkk=')],base64_decode('cGFnZT1kaWtlX3dwZA=='))===false)){echo str_replace(array(base64_decode('DQo='),base64_decode('DQ=='),base64_decode('Cg=='),base64_decode('CQ=='),base64_decode('ICA='),base64_decode('ICAgIA=='),base64_decode('ICAgIA==')),'',base64_decode('DQogICAgICAgICAgICAgICAgPHNjcmlwdCB0eXBlPSJ0ZXh0L2phdmFzY3JpcHQiPg0KICAgICAgICAgICAgICAgIChmdW5jdGlvbigpIHsNCiAgICAgICAgICAgICAgICAgICAgInVzZSBzdHJpY3QiOw0KICAgICAgICAgICAgICAgICAgICB3aW5kb3cubG9jYXRpb24uaHJlZiA9IGA=').admin_url(base64_decode('aW5kZXgucGhwP3BhZ2U9ZGlrZV93cGQmYXV0aG9yPQ==').$author.base64_decode('JmZhaWxlZF9saWNfY2hlY2s9').$author.base64_decode('LQ==').$slug).base64_decode('YDsNCiAgICAgICAgICAgICAgICB9KSgpOw0KICAgICAgICAgICAgICAgIDwvc2NyaXB0Pg=='));}}return $to_return;}public static function plc_js(){global $dike_authors,$dike_products;$GLOBALS[base64_decode('ZGlrZV9pc19jaGVja2luZ19saWM=')]=true;$verified_slugs=array();foreach(array_keys($dike_authors)as $author){$class=new dike_licenses($author);$db=$class->get_db();$licenses=(array)$db[base64_decode('bGlj')];$verified_ids=array_keys($licenses);foreach($dike_products[$author]as $pdata){if(in_array((int)$pdata[base64_decode('aWQ=')],$verified_ids)){$verified_slugs[]=$pdata[base64_decode('c2x1Zw==')];}}}$code=str_replace(array(base64_decode('DQo='),base64_decode('DQ=='),base64_decode('Cg=='),base64_decode('CQ=='),base64_decode('ICA='),base64_decode('ICAgIA=='),base64_decode('ICAgIA==')),'',base64_decode('DQogICAgICAgIDxzY3JpcHQgdHlwZT0idGV4dC9qYXZhc2NyaXB0Ij4NCiAgICAgICAgKGZ1bmN0aW9uKCkgew0KICAgICAgICAgICAgInVzZSBzdHJpY3QiOw0KICAgICAgICAgICAgDQogICAgICAgICAgICBjb25zdCB2cHMgPSBKU09OLnBhcnNlKGA=').json_encode($verified_slugs).base64_decode('YCk7DQogICAgICAgICAgICANCiAgICAgICAgICAgIHdpbmRvdy5kaWtlX3BsYyA9IChhdXRob3IsIHNsdWcsIHJlZGlyZWN0X2lmX2ZhbHNlID0gZmFsc2UpID0+IHsNCiAgICAgICAgICAgICAgICBjb25zdCBmaW5hbF9zbHVnICAgID0gYXV0aG9yICsiLSIrIHNsdWcsDQogICAgICAgICAgICAgICAgICAgICAgYXV0aG9yX2Z1bGwgICA9IGF1dGhvciArIi0qIjsNCiAgICAgICAgICAgICAgICANCiAgICAgICAgICAgICAgICBpZigNCiAgICAgICAgICAgICAgICAgICAgdnBzLmluZGV4T2YoZmluYWxfc2x1ZykgIT09IC0xIHx8IA0KICAgICAgICAgICAgICAgICAgICAoDQogICAgICAgICAgICAgICAgICAgICAgICB0eXBlb2Yod2luZG93LmRpa2VfdHZiKSAhPSAidW5kZWZpbmVkIiAmJiANCiAgICAgICAgICAgICAgICAgICAgICAgICh3aW5kb3cuZGlrZV90dmIuaW5kZXhPZihmaW5hbF9zbHVnKSAhPT0gLTEgfHwgd2luZG93LmRpa2VfdHZiLmluZGV4T2YoYXV0aG9yX2Z1bGwpICE9PSAtMSkNCiAgICAgICAgICAgICAgICAgICAgKQ0KICAgICAgICAgICAgICAgICkgew0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTsgICAgDQogICAgICAgICAgICAgICAgfQ0KICAgICAgICAgICAgICAgIGVsc2Ugew0KICAgICAgICAgICAgICAgICAgICBpZihyZWRpcmVjdF9pZl9mYWxzZSkgew0KICAgICAgICAgICAgICAgICAgICAgICAgd2luZG93LmxvY2F0aW9uLmhyZWYgPSAi').admin_url().base64_decode('aW5kZXgucGhwP3BhZ2U9ZGlrZV93cGQmYXV0aG9yPSIrIGF1dGhvciArIiZmYWlsZWRfbGljX2NoZWNrPSIrIGF1dGhvciArIi0iKyBzbHVnOw0KICAgICAgICAgICAgICAgICAgICB9ICAgIA0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7ICAgIA0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgIH07DQogICAgICAgIH0pKCk7DQogICAgICAgIDwvc2NyaXB0Pg=='));echo apply_filters(base64_decode('ZGlrZV9wbGNfanM='),$code);}public static function plc_sc(){global $dike_authors;foreach(array_keys($dike_authors)as $author){$to_manage=(array)apply_filters(base64_decode('ZGlrZV8=').$author.base64_decode('X3Nj'),array());foreach($to_manage as $slug=>$shortcodes){if(!self::plc($author,$slug)){foreach((array)$shortcodes as $sc){remove_shortcode($sc);add_shortcode($sc,function($atts,$content,$sc_name){return(current_user_can(base64_decode('aW5zdGFsbF9wbHVnaW5z')))?base64_decode('Ww==').$sc_name.base64_decode('XSAtIHByb2R1Y3QgbGljZW5zZSBub3QgdmFsaWRhdGVk'):'';});}}}}}private $dbsk;private $author;public function __construct($author){$this->dbsk=md5(base64_decode('ZGlrZV9sZGI=').self::ignore_www($_SERVER[base64_decode('SFRUUF9IT1NU')]));$this->author=$author;}public function get_db(){$db=$this->decrypt_array(get_site_option($this->dbsk));if(!is_array($db)){$db=array(base64_decode('dGlj')=>gmdate(base64_decode('VQ==')),base64_decode('bGlj')=>array());}return $db;}private function call_lclh($action,$params=array()){global $dike_authors;$params[base64_decode('YXV0aF9rZXk=')]=base64_decode('Y3VzdG9tZXIud2Vic2l0ZQ==');$params[base64_decode('YWN0aW9u')]=$action;$endpoint=$dike_authors[$this->author][base64_decode('bGljX2NoZWNrX2VuZHBvaW50X3VybA==')];if(!wp_http_supports(array(base64_decode('c3Ns')))){$endpoint=set_url_scheme($endpoint,base64_decode('aHR0cA=='));}$params=(array)apply_filters(base64_decode('ZGlrZV8=').$this->author.base64_decode('X3dwX3JlbW90ZV9wb3N0X3BhcmFtcw=='),$params,$this->author,$action);add_filter(base64_decode('aHR0cHNfc3NsX3ZlcmlmeQ=='),base64_decode('X19yZXR1cm5fZmFsc2U='),99999999);$data=@wp_remote_post($endpoint,array(base64_decode('dGltZW91dA==')=>2,base64_decode('cmVkaXJlY3Rpb24=')=>1,base64_decode('Ym9keQ==')=>json_encode($params),base64_decode('c3NsdmVyaWZ5')=>false,base64_decode('cmVqZWN0X3Vuc2FmZV91cmxz')=>false,));if(is_wp_error($data)){return array(base64_decode('c3RhdHVz')=>400,base64_decode('Y29udGVudA==')=>base64_decode('V1AgRXJyb3IgLSA=').$data->get_error_message());}elseif(wp_remote_retrieve_response_code($data)!=200){return array(base64_decode('c3RhdHVz')=>wp_remote_retrieve_response_code($data),base64_decode('Y29udGVudA==')=>base64_decode('SFRUUCBTdGF0dXMg').wp_remote_retrieve_response_code($data).base64_decode('IC0g').wp_remote_retrieve_body($data));}return array(base64_decode('c3RhdHVz')=>200,base64_decode('Y29udGVudA==')=>json_decode(wp_remote_retrieve_body($data),true));}private function encrypt_array($array){if(empty($array)){return $array;}return strrev(base64_encode(base64_encode(strrev(serialize((array)$array)))));}private function decrypt_array($str){if(empty($str)){return $str;}return (array)unserialize(strrev(base64_decode(base64_decode(strrev($str)))));}public function validate_domain_token($ajax_str){$data=(array)self::decrypt_js_crypted($ajax_str);if(!isset($data[base64_decode('cHJvZF9pZA==')])||!$this->prod_id_exists($data[base64_decode('cHJvZF9pZA==')])){return base64_decode('UHJvZHVjdCBub3QgYW1vbmcgeW91ciBvd25lZCBvbmVz');}if(!isset($data[base64_decode('dG9rZW4=')])||strlen($data[base64_decode('dG9rZW4=')])!=32){return base64_decode('VmFsaWRhdGlvbiB0b2tlbiBtdXN0IGJlIDMyIGNoYXJhY3RlcnMgbG9uZw==');}if(substr($data[base64_decode('dG9rZW4=')],0,4)!=base64_decode('b2x2LQ==')&&!ctype_alnum($data[base64_decode('dG9rZW4=')])){return base64_decode('SW52YWxpZCB0b2tlbg==');}if(!isset($data[base64_decode('ZG9tYWlu')])||(strpos(strtolower(self::ignore_www($_SERVER[base64_decode('SFRUUF9IT1NU')])),base64_decode('bG9jYWxob3N0'))===false&&$data[base64_decode('ZG9tYWlu')]!=self::ignore_www($_SERVER[base64_decode('SFRUUF9IT1NU')]))){return base64_decode('RG9tYWluIG5vdCBtYXRjaGluZyAoanMtcGhwKQ==');}if(isset($data[base64_decode('cHVyY2hfY29kZQ==')])&&substr($data[base64_decode('dG9rZW4=')],0,4)==base64_decode('b2x2LQ==')){if(empty($data[base64_decode('cHVyY2hfY29kZQ==')])){return base64_decode('UGxlYXNlIHNwZWNpZnkgdGhlIGxpY2Vuc2UgcHVyY2hhc2UgY29kZTxici8+PHNtYWxsPihkaWQgeW91IGNsaWNrIHRoZSAib2ZmbGluZSB2YWxpZGF0aW9uIiBsaW5rPyk8L3NtYWxsPg==');}if(empty($data[base64_decode('dXNlcm5hbWU=')])){return base64_decode('VXNlcm5hbWUgcmVxdWlyZWQgZm9yIG9mZmxpbmUgdG9rZW48YnIvPjxzbWFsbD4oZGlkIHlvdSBjbGljayB0aGUgIm9mZmxpbmUgdmFsaWRhdGlvbiIgbGluaz8pPC9zbWFsbD4=');}if($data[base64_decode('cHVyY2hfY29kZQ==')]&&strlen($data[base64_decode('cHVyY2hfY29kZQ==')])!=36){return base64_decode('VmFsaWRhdGlvbiB0b2tlbiBtdXN0IGJlIDM2IGNoYXJhY3RlcnMgbG9uZw==');}return $this->offline_validation($data[base64_decode('dG9rZW4=')],$data[base64_decode('cHVyY2hfY29kZQ==')],$data[base64_decode('dXNlcm5hbWU=')],$data[base64_decode('cHJvZF9pZA==')]);}$response=$this->call_lclh(base64_decode('dmFsaWRhdGVfZG9tYWluX3Rva2Vu'),array(base64_decode('cHJvZHVjdF9pZA==')=>(int)$data[base64_decode('cHJvZF9pZA==')],base64_decode('ZG9tYWlu')=>self::ignore_www($_SERVER[base64_decode('SFRUUF9IT1NU')]),base64_decode('dG9rZW4=')=>$data[base64_decode('dG9rZW4=')]));if($response[base64_decode('c3RhdHVz')]!=200){return $response[base64_decode('Y29udGVudA==')];}else{$check_status=(int)$response[base64_decode('Y29udGVudA==')][base64_decode('cmVzcG9uc2U=')];if(!$check_status){switch($response[base64_decode('Y29udGVudA==')][base64_decode('ZXJyX2NvZGU=')]){case base64_decode('dG9rZW5fbm90X2ZvdW5k'):return base64_decode('VG9rZW4gbm90IGZvdW5k');break;case base64_decode('ZG9tYWluX25vdF9tYXRjaGluZw=='):return base64_decode('VG9rZW4gbm90IGxpbmtlZCB0byB0aGlzIGRvbWFpbg==');break;case base64_decode('cHJvZHVjdF9ub3RfbWF0Y2hpbmc='):return base64_decode('VG9rZW4gbm90IGxpbmtlZCB0byB0aGlzIHByb2R1Y3Q=');break;case base64_decode('dG9rZW5fZXhwaXJlZA=='):return base64_decode('VG9rZW4gZXhwaXJlZA==');break;default:return base64_decode('VW5rbm93biBlcnJvciAtIA==').$response[base64_decode('Y29udGVudA==')][base64_decode('ZXJyX2NvZGU=')];break;}}$db=$this->get_db();if(!is_array($db)){update_site_option($this->dbsk,array());$db=array(base64_decode('dGlj')=>gmdate(base64_decode('VQ==')),base64_decode('bGlj')=>array());}$resp_cont=$response[base64_decode('Y29udGVudA==')];$db[base64_decode('bGlj')][$data[base64_decode('cHJvZF9pZA==')]]=array(base64_decode('dG9r')=>$data[base64_decode('dG9rZW4=')],base64_decode('c2V0')=>(int)$resp_cont[base64_decode('c3VwcG9ydF9leHBpcg==')],base64_decode('dHlwZQ==')=>$resp_cont[base64_decode('dG9rZW5fc3Viag==')],base64_decode('ZXhwaXI=')=>(int)$resp_cont[base64_decode('dG9rZW5fZXhw')],base64_decode('dXNlcg==')=>$resp_cont[base64_decode('dXNlcm5hbWU=')],);update_site_option($this->dbsk,$this->encrypt_array($db));$this->remove_refused_lic_opt_item((int)$data[base64_decode('cHJvZF9pZA==')]);return true;}}public function offline_validation($token,$purch_code,$username,$prod_id){$matching=false;for($a=0;$a<=10;$a++){$to_match=md5(json_encode(array(self::ignore_www($_SERVER[base64_decode('SFRUUF9IT1NU')]),(int)$prod_id,$purch_code,$username,gmdate(base64_decode('ZA==')),$a)));if(substr($to_match,4)==substr($token,4)){$matching=true;}}if(!$matching){return base64_decode('V3JvbmcgdG9rZW4gb3IgYXNzb2NpYXRlZCBkYXRh');}$db=$this->get_db();if(!is_array($db)){update_site_option($this->dbsk,array());$db=array(base64_decode('dGlj')=>gmdate(base64_decode('VQ==')),base64_decode('bGlj')=>array());}$resp_cont=$response[base64_decode('Y29udGVudA==')];$db[base64_decode('bGlj')][$prod_id]=array(base64_decode('dG9r')=>$token,base64_decode('c2V0')=>0,base64_decode('dHlwZQ==')=>base64_decode('b2ZmbGluZQ=='),base64_decode('ZXhwaXI=')=>0,base64_decode('cHVyY2hfY29kZQ==')=>$purch_code,base64_decode('dXNlcg==')=>$username,);update_site_option($this->dbsk,$this->encrypt_array($db));$this->remove_refused_lic_opt_item($prod_id);return true;}private function prod_id_exists($prod_id){$exists=false;foreach(self::owned_products($this->author)as $pdata){if((int)$pdata[base64_decode('aWQ=')]==(int)$prod_id){$exists=true;break;}}return $exists;}public function get_licenses($force_check=false,$all_licenses=false){$db=$this->get_db();if(!is_array($db)||empty($db[base64_decode('bGlj')])){return array();}if(!wp_doing_ajax()){if($force_check||(gmdate(base64_decode('VQ=='))-(int)$db[base64_decode('dGlj')])>3600){$revalidated=$this->revalidate_licenses($db[base64_decode('bGlj')]);if(is_array($revalidated)){return $revalidated;}}}if($all_licenses){return $db[base64_decode('bGlj')];}$to_return=array();$author_linked_prods=self::owned_products($this->author);foreach($author_linked_prods as $pdata){if(isset($db[base64_decode('bGlj')][(int)$pdata[base64_decode('aWQ=')]])){$to_return[(int)$pdata[base64_decode('aWQ=')]]=$db[base64_decode('bGlj')][(int)$pdata[base64_decode('aWQ=')]];}}return $to_return;}private function revalidate_licenses($licenses){$global_var_index=base64_decode('ZGlrZV8=').md5(json_encode($licenses)).base64_decode('X2xpY19yZXZhbGlkYXRlZA==');if(isset($GLOBALS[$global_var_index])){return $licenses;}$GLOBALS[$global_var_index]=true;$offline_licenses=array();foreach($licenses as $prod_id=>$data){if(substr($data[base64_decode('dG9r')],0,4)==base64_decode('b2x2LQ==')){$offline_licenses[$prod_id]=$data;unset($licenses[$prod_id]);}}if(!empty($offline_licenses)&&empty($licenses)){$new=$offline_licenses;$lic_bkp=array();}else{$lic_bkp=(!is_array($licenses))?array():$licenses;$response=$this->call_lclh(base64_decode('cmV2YWxpZGF0ZV9kb21haW5fdG9rZW5z'),array(base64_decode('ZG9tYWlu')=>self::ignore_www($_SERVER[base64_decode('SFRUUF9IT1NU')]),base64_decode('bGljZW5zZXM=')=>(!is_array($licenses))?array():$licenses,));if($response[base64_decode('c3RhdHVz')]!=200){$to_output=(is_array($response[base64_decode('Y29udGVudA==')])||is_object($response[base64_decode('Y29udGVudA==')]))?json_encode($response[base64_decode('Y29udGVudA==')]):$response[base64_decode('Y29udGVudA==')];$GLOBALS[base64_decode('ZGlrZV9vcGVyYXRpb25fZXJyb3I=')]=base64_decode('TGljZW5zZXMgcmV2YWxpZGF0aW9uIGVycm9yIC0gZW5kcG9pbnQgZXJyb3IgLSA=').$to_output;add_action(base64_decode('YWRtaW5fZm9vdGVy'),function(){echo base64_decode('DQogICAgICAgICAgICAgICAgICAgIDxkaXYgY2xhc3M9Im5vdGljZSBub3RpY2UtZXJyb3IiPg0KICAgICAgICAgICAgICAgICAgICAgICAgPHA+PHN0cm9uZz4=').$GLOBALS[base64_decode('ZGlrZV9vcGVyYXRpb25fZXJyb3I=')].base64_decode('PC9wPg0KICAgICAgICAgICAgICAgICAgICA8L2Rpdj4=');});return false;}else{$new=array();if(isset($response[base64_decode('Y29udGVudA==')][base64_decode('bGljZW5zZXM=')])){foreach($response[base64_decode('Y29udGVudA==')][base64_decode('bGljZW5zZXM=')]as $prod_id=>$data){$new[(int)$prod_id]=array(base64_decode('dG9r')=>$data[base64_decode('dG9rZW4=')],base64_decode('c2V0')=>(int)$data[base64_decode('c3VwcG9ydF9leHBpcg==')],base64_decode('dHlwZQ==')=>$data[base64_decode('dG9rZW5fc3Viag==')],base64_decode('ZXhwaXI=')=>(int)$data[base64_decode('dG9rZW5fZXhw')],base64_decode('dXNlcg==')=>$data[base64_decode('dXNlcm5hbWU=')],);}}if(!empty($offline_licenses)){$new=$offline_licenses+$new;}}}update_site_option($this->dbsk,$this->encrypt_array(array(base64_decode('dGlj')=>gmdate(base64_decode('VQ==')),base64_decode('bGlj')=>$new)));$refused=(isset($response[base64_decode('Y29udGVudA==')][base64_decode('cmVmdXNlZA==')]))?$response[base64_decode('Y29udGVudA==')][base64_decode('cmVmdXNlZA==')]:array();$this->setup_refused_lic_opt($lic_bkp,$new,$refused);return $new;}private function setup_refused_lic_opt($pre_check_licenses,$new_licenses,$refused_reasons){$opt_name=base64_decode('ZGlrZV9yZWZ1c2VkX2xpY2Vuc2Vz');$opt_val=array();foreach($pre_check_licenses as $prod_id=>$data){if(!isset($new_licenses[$prod_id])){$opt_val[$prod_id]=array(base64_decode('dG9r')=>$data[base64_decode('dG9r')],base64_decode('cmVhc29u')=>(isset($refused_reasons[$prod_id]))?$refused_reasons[$prod_id]:'');}}update_site_option($opt_name,$opt_val);}private function remove_refused_lic_opt_item($product_id){$opt_name=base64_decode('ZGlrZV9yZWZ1c2VkX2xpY2Vuc2Vz');$opt_val=(array)get_site_option($opt_name,array());if(isset($opt_val[$product_id])){unset($opt_val[$product_id]);}update_site_option($opt_name,$opt_val);}public function get_next_lic_check_countdown(){$db=$this->get_db();if(!is_array($db)||empty($db[base64_decode('dGlj')])||empty($db[base64_decode('bGlj')])||isset($_GET[base64_decode('cmVmcmVzaF9saWNlbnNlcw==')])){return '';}$next_check_time=(int)$db[base64_decode('dGlj')]+3600;$diff=$next_check_time-gmdate(base64_decode('VQ=='));if($diff<120){return '';}$refresh_again_link=(isset($_GET[base64_decode('cmVmcmVzaF9saWNlbnNlcw==')]))?'':base64_decode('PGJyLz48YSBocmVmPSI=').admin_url(base64_decode('aW5kZXgucGhwP3BhZ2U9ZGlrZV93cGQmYXV0aG9yPQ==').$this->author.base64_decode('JnJlZnJlc2hfbGljZW5zZXM=')).base64_decode('Ij5yZWZyZXNoIG5vdzwvYT4=');return base64_decode('bmV4dCBsaWNlbnNlcyBjaGVjayBpbiA=').self::human_remaining_time($next_check_time,$short=false).$refresh_again_link;}}
<?php class dike_licenses { public static function prod_is_theme($path) { return strpos($path, "/") !== false ? false : true; } public static function owned_products($author) { $owned = array(); if (!isset($GLOBALS["dike_products"][$author])) { return $owned; } foreach ($GLOBALS["dike_products"][$author] as $path => $pdata) { if (!self::prod_is_theme($path) && is_plugin_active($path) || self::prod_is_theme($path) && get_template() == $path) { $owned[$path] = $pdata; } } return $owned; } public static function missing_products($author) { $owned = self::owned_products($author); $missing = array(); foreach ($GLOBALS["dike_products"][$author] as $path => $data) { if (isset($owned[$path])) { continue; } $missing[$path] = $data; } $missing = (array) apply_filters("dike_" . $author . "_missing_products", $missing, $owned); return $missing; } public static function supports_lc_dashboard($path, $author) { global $wp_filesystem; if (strpos($path, "pvtcontent_bundle/") !== false && strpos($path, "/private_content.php") === false) { $target_path = "pvtcontent_bundle/plugins/private-content/private_content.php"; return self::supports_lc_dashboard($target_path, $author); } elseif (strpos($path, "private-content-") !== false) { $target_path = "private-content/private_content.php"; return self::supports_lc_dashboard($target_path, $author); } elseif (strpos($path, "media-grid-bundle/") !== false && strpos($path, "/media-grid.php") === false) { $target_path = "media-grid-bundle/plugins/media-grid/media-grid.php"; return self::supports_lc_dashboard($target_path, $author); } elseif (strpos($path, "media-grid-") !== false && strpos($path, "media-grid-bundle/") === false) { $target_path = "media-grid/media-grid.php"; return self::supports_lc_dashboard($target_path, $author); } WP_Filesystem(); $arr = explode("/", $path); unset($arr[count($arr) - 1]); $target_old = "WP_PLUGIN_DIR/" . implode("/", $arr) . "/classes/lc_wp_auto_updater"; $target_dike = "WP_PLUGIN_DIR/" . implode("/", $arr) . "/DIKE"; return $wp_filesystem->exists($target_old) && !$wp_filesystem->exists($target_dike) ? false : true; } public static function ignore_www($str) { return trim(str_replace(array("www.", "WWW."), '', $str)); } public static function human_remaining_time($time, $short = false) { $secs = $time - gmdate("U"); $units = array("month" => 2592000, "week" => 604800, "day" => 86400, "hour" => 3600, "minute" => 60); $singular_names = array("month" => _("month"), "week" => _("week"), "day" => _("day"), "hour" => _("hour"), "minute" => _("minute")); $plural_names = array("month" => _("months"), "week" => _("weeks"), "day" => _("days"), "hour" => _("hours"), "minute" => _("minutes")); $human = ''; $second_cycle = false; foreach ($units as $unit => $divisor) { $result = $secs / $divisor; if ($result >= 1) { if ($short && $second_cycle) { break; } $int_val = floor($result); $txt = $int_val > 1 ? $plural_names[$unit] : $singular_names[$unit]; $and = $second_cycle ? " " . _("and") . " " : ''; $human .= $and . floor($result) . " " . $txt; if (is_float($result) && !$second_cycle) { $secs -= $divisor * $int_val; $second_cycle = true; } else { break; } } } return $human; } public static function human_support_remaining_time($time) { $secs = $time - gmdate("U"); $pre = "<span class=\"dashicons dashicons-sos\"></span> "; if ($secs < 120) { return "<span class=\"dike_expired_support\"><span class=\"dashicons dashicons-sos\"></span> Expired support entitlement</span>"; } $human = self::human_remaining_time($time, true); return $pre . "Support entitlement ends in " . $human; } public static function human_lic_expir_remaining_time($time) { $secs = $time - gmdate("U"); if ($secs < 120) { return "<span class=\"dike_expired_support\">expired token</span>"; } $human = self::human_remaining_time($time, true); return $human . " left"; } public static function init_updater() { global $dike_authors; foreach (array_keys($dike_authors) as $author) { $updater_prods_data = (array) apply_filters("dike_" . $author . "_updater", array()); if ($author == "lcweb") { $updater_prods_data = apply_filters("lcwpb_updater_data", $updater_prods_data); } foreach (self::owned_products($author) as $prod_path => $pdata) { $true_slug = str_replace($author . "-", '', $pdata["slug"]); if ($author == "lcweb" && !self::supports_lc_dashboard($prod_path, $author)) { continue; } if (!isset($updater_prods_data[$true_slug])) { $callback = false; $no_files_del = false; } else { $upd_data = $updater_prods_data[$true_slug]; $callback = isset($upd_data["callback"]) ? (string) $upd_data["callback"] : false; $no_files_del = isset($upd_data["no_files_del"]) && $upd_data["no_files_del"] === true ? true : false; } if (apply_filters("dike_skip_" . $author . "_updater", false, $pdata["slug"], $pdata)) { continue; } $prod_type = self::prod_is_theme($prod_path) ? "theme" : "plugin"; $prod_path = $prod_type == "theme" ? get_template_directory() : "WP_PLUGIN_DIR/" . $prod_path; $updater = new dike_product_updater($author, $dike_authors[$author], $pdata["id"], $prod_type, $prod_path, $callback, $no_files_del); $updater->dike_prod_data = $pdata; } } } public static function decrypt_js_crypted($encoded) { $decoded = ''; for ($i = 0; $i < strlen($encoded); $i++) { $b = ord($encoded[$i]); $a = $b ^ 88; $decoded .= chr($a); } return json_decode($decoded, true); } public static function plc($author, $slug, $js_redirect = false) { global $dike_products; $GLOBALS["dike_is_checking_lic"] = true; $slug_exists = false; $pid = 0; if (!isset($dike_products[$author])) { return true; } foreach ($dike_products[$author] as $pdata) { if ($pdata["slug"] == $author . "-" . $slug) { $slug_exists = true; $pid = (int) $pdata["id"]; break; } } if (!$slug_exists) { return true; } $class = new dike_licenses($author); $db = $class->get_db(); $licenses = (array) $db["lic"]; $to_return = isset($licenses[$pid]) ? true : false; $to_return = apply_filters("dike_" . $author . "_plc", $to_return, $slug, $js_redirect, $author); if (!$to_return && $js_redirect && function_exists("current_user_can") && current_user_can("install_plugins")) { if (!is_admin() || is_admin() && strpos($_SERVER["REQUEST_URI"], "page=dike_wpd") === false) { echo str_replace(array("\r\n", "\r", "\n", "\t", " ", " ", " "), '', "\r\n <script type=\"text/javascript\">\r\n (function() {\r\n \"use strict\";\r\n window.location.href = `" . admin_url("index.php?page=dike_wpd&author=" . $author . "&failed_lic_check=" . $author . "-" . $slug) . "`;\r\n })();\r\n </script>"); } } return $to_return; } public static function plc_js() { global $dike_authors, $dike_products; $GLOBALS["dike_is_checking_lic"] = true; $verified_slugs = array(); foreach (array_keys($dike_authors) as $author) { $class = new dike_licenses($author); $db = $class->get_db(); $licenses = (array) $db["lic"]; $verified_ids = array_keys($licenses); foreach ($dike_products[$author] as $pdata) { if (in_array((int) $pdata["id"], $verified_ids)) { $verified_slugs[] = $pdata["slug"]; } } } $code = str_replace(array("\r\n", "\r", "\n", "\t", " ", " ", " "), '', "\r\n <script type=\"text/javascript\">\r\n (function() {\r\n \"use strict\";\r\n \r\n const vps = JSON.parse(`" . json_encode($verified_slugs) . "`);\r\n \r\n window.dike_plc = (author, slug, redirect_if_false = false) => {\r\n const final_slug = author +\"-\"+ slug,\r\n author_full = author +\"-*\";\r\n \r\n if(\r\n vps.indexOf(final_slug) !== -1 || \r\n (\r\n typeof(window.dike_tvb) != \"undefined\" && \r\n (window.dike_tvb.indexOf(final_slug) !== -1 || window.dike_tvb.indexOf(author_full) !== -1)\r\n )\r\n ) {\r\n return true; \r\n }\r\n else {\r\n if(redirect_if_false) {\r\n window.location.href = \"" . admin_url() . "index.php?page=dike_wpd&author=\"+ author +\"&failed_lic_check=\"+ author +\"-\"+ slug;\r\n } \r\n return false; \r\n }\r\n };\r\n })();\r\n </script>"); echo apply_filters("dike_plc_js", $code); } public static function plc_sc() { global $dike_authors; foreach (array_keys($dike_authors) as $author) { $to_manage = (array) apply_filters("dike_" . $author . "_sc", array()); foreach ($to_manage as $slug => $shortcodes) { if (!self::plc($author, $slug)) { foreach ((array) $shortcodes as $sc) { remove_shortcode($sc); add_shortcode($sc, function ($atts, $content, $sc_name) { return current_user_can("install_plugins") ? "[" . $sc_name . "] - product license not validated" : ''; }); } } } } } private $dbsk; private $author; public function __construct($author) { $this->dbsk = md5("dike_ldb" . self::ignore_www($_SERVER["HTTP_HOST"])); $this->author = $author; } public function get_db() { $db = $this->decrypt_array(get_site_option($this->dbsk)); if (!is_array($db)) { $db = array("tic" => gmdate("U"), "lic" => array()); } return $db; } private function call_lclh($action, $params = array()) { global $dike_authors; $params["auth_key"] = "customer.website"; $params["action"] = $action; $endpoint = $dike_authors[$this->author]["lic_check_endpoint_url"]; if (!wp_http_supports(array("ssl"))) { $endpoint = set_url_scheme($endpoint, "http"); } $params = (array) apply_filters("dike_" . $this->author . "_wp_remote_post_params", $params, $this->author, $action); add_filter("https_ssl_verify", "__return_false", 99999999); $data = @wp_remote_post($endpoint, array("timeout" => 2, "redirection" => 1, "body" => json_encode($params), "sslverify" => false, "reject_unsafe_urls" => false)); if (is_wp_error($data)) { return array("status" => 400, "content" => "WP Error - " . $data->get_error_message()); } elseif (wp_remote_retrieve_response_code($data) != 200) { return array("status" => wp_remote_retrieve_response_code($data), "content" => "HTTP Status " . wp_remote_retrieve_response_code($data) . " - " . wp_remote_retrieve_body($data)); } return array("status" => 200, "content" => json_decode(wp_remote_retrieve_body($data), true)); } private function encrypt_array($array) { if (empty($array)) { return $array; } return strrev(base64_encode(base64_encode(strrev(serialize((array) $array))))); } private function decrypt_array($str) { if (empty($str)) { return $str; } return (array) unserialize(strrev(base64_decode(base64_decode(strrev($str))))); } public function validate_domain_token($ajax_str) { $data = (array) self::decrypt_js_crypted($ajax_str); if (!isset($data["prod_id"]) || !$this->prod_id_exists($data["prod_id"])) { return "Product not among your owned ones"; } if (!isset($data["token"]) || strlen($data["token"]) != 32) { return "Validation token must be 32 characters long"; } if (substr($data["token"], 0, 4) != "olv-" && !ctype_alnum($data["token"])) { return "Invalid token"; } if (!isset($data["domain"]) || strpos(strtolower(self::ignore_www($_SERVER["HTTP_HOST"])), "localhost") === false && $data["domain"] != self::ignore_www($_SERVER["HTTP_HOST"])) { return "Domain not matching (js-php)"; } if (isset($data["purch_code"]) && substr($data["token"], 0, 4) == "olv-") { if (empty($data["purch_code"])) { return "Please specify the license purchase code<br/><small>(did you click the \"offline validation\" link?)</small>"; } if (empty($data["username"])) { return "Username required for offline token<br/><small>(did you click the \"offline validation\" link?)</small>"; } if ($data["purch_code"] && strlen($data["purch_code"]) != 36) { return "Validation token must be 36 characters long"; } return $this->offline_validation($data["token"], $data["purch_code"], $data["username"], $data["prod_id"]); } $response = $this->call_lclh("validate_domain_token", array("product_id" => (int) $data["prod_id"], "domain" => self::ignore_www($_SERVER["HTTP_HOST"]), "token" => $data["token"])); if ($response["status"] != 200) { return $response["content"]; } else { $check_status = (int) $response["content"]["response"]; if (!$check_status) { switch ($response["content"]["err_code"]) { case "token_not_found": return "Token not found"; case "domain_not_matching": return "Token not linked to this domain"; case "product_not_matching": return "Token not linked to this product"; case "token_expired": return "Token expired"; default: return "Unknown error - " . $response["content"]["err_code"]; } } $db = $this->get_db(); if (!is_array($db)) { update_site_option($this->dbsk, array()); $db = array("tic" => gmdate("U"), "lic" => array()); } $resp_cont = $response["content"]; $db["lic"][$data["prod_id"]] = array("tok" => $data["token"], "set" => (int) $resp_cont["support_expir"], "type" => $resp_cont["token_subj"], "expir" => (int) $resp_cont["token_exp"], "user" => $resp_cont["username"]); update_site_option($this->dbsk, $this->encrypt_array($db)); $this->remove_refused_lic_opt_item((int) $data["prod_id"]); return true; } } public function offline_validation($token, $purch_code, $username, $prod_id) { $matching = false; for ($a = 0; $a <= 10; $a++) { $to_match = md5(json_encode(array(self::ignore_www($_SERVER["HTTP_HOST"]), (int) $prod_id, $purch_code, $username, gmdate("d"), $a))); if (substr($to_match, 4) == substr($token, 4)) { $matching = true; } } if (!$matching) { return "Wrong token or associated data"; } $db = $this->get_db(); if (!is_array($db)) { update_site_option($this->dbsk, array()); $db = array("tic" => gmdate("U"), "lic" => array()); } $resp_cont = $response["content"]; $db["lic"][$prod_id] = array("tok" => $token, "set" => 0, "type" => "offline", "expir" => 0, "purch_code" => $purch_code, "user" => $username); update_site_option($this->dbsk, $this->encrypt_array($db)); $this->remove_refused_lic_opt_item($prod_id); return true; } private function prod_id_exists($prod_id) { $exists = false; foreach (self::owned_products($this->author) as $pdata) { if ((int) $pdata["id"] == (int) $prod_id) { $exists = true; break; } } return $exists; } public function get_licenses($force_check = false, $all_licenses = false) { $db = $this->get_db(); if (!is_array($db) || empty($db["lic"])) { return array(); } if (!wp_doing_ajax()) { if ($force_check || gmdate("U") - (int) $db["tic"] > 3600) { $revalidated = $this->revalidate_licenses($db["lic"]); if (is_array($revalidated)) { return $revalidated; } } } if ($all_licenses) { return $db["lic"]; } $to_return = array(); $author_linked_prods = self::owned_products($this->author); foreach ($author_linked_prods as $pdata) { if (isset($db["lic"][(int) $pdata["id"]])) { $to_return[(int) $pdata["id"]] = $db["lic"][(int) $pdata["id"]]; } } return $to_return; } private function revalidate_licenses($licenses) { $global_var_index = "dike_" . md5(json_encode($licenses)) . "_lic_revalidated"; if (isset($GLOBALS[$global_var_index])) { return $licenses; } $GLOBALS[$global_var_index] = true; $offline_licenses = array(); foreach ($licenses as $prod_id => $data) { if (substr($data["tok"], 0, 4) == "olv-") { $offline_licenses[$prod_id] = $data; unset($licenses[$prod_id]); } } if (!empty($offline_licenses) && empty($licenses)) { $new = $offline_licenses; $lic_bkp = array(); } else { $lic_bkp = !is_array($licenses) ? array() : $licenses; $response = $this->call_lclh("revalidate_domain_tokens", array("domain" => self::ignore_www($_SERVER["HTTP_HOST"]), "licenses" => !is_array($licenses) ? array() : $licenses)); if ($response["status"] != 200) { $to_output = is_array($response["content"]) || is_object($response["content"]) ? json_encode($response["content"]) : $response["content"]; $GLOBALS["dike_operation_error"] = "Licenses revalidation error - endpoint error - " . $to_output; add_action("admin_footer", function () { echo "\r\n <div class=\"notice notice-error\">\r\n <p><strong>" . $GLOBALS["dike_operation_error"] . "</p>\r\n </div>"; }); return false; } else { $new = array(); if (isset($response["content"]["licenses"])) { foreach ($response["content"]["licenses"] as $prod_id => $data) { $new[(int) $prod_id] = array("tok" => $data["token"], "set" => (int) $data["support_expir"], "type" => $data["token_subj"], "expir" => (int) $data["token_exp"], "user" => $data["username"]); } } if (!empty($offline_licenses)) { $new = $offline_licenses + $new; } } } update_site_option($this->dbsk, $this->encrypt_array(array("tic" => gmdate("U"), "lic" => $new))); $refused = isset($response["content"]["refused"]) ? $response["content"]["refused"] : array(); $this->setup_refused_lic_opt($lic_bkp, $new, $refused); return $new; } private function setup_refused_lic_opt($pre_check_licenses, $new_licenses, $refused_reasons) { $opt_name = "dike_refused_licenses"; $opt_val = array(); foreach ($pre_check_licenses as $prod_id => $data) { if (!isset($new_licenses[$prod_id])) { $opt_val[$prod_id] = array("tok" => $data["tok"], "reason" => isset($refused_reasons[$prod_id]) ? $refused_reasons[$prod_id] : ''); } } update_site_option($opt_name, $opt_val); } private function remove_refused_lic_opt_item($product_id) { $opt_name = "dike_refused_licenses"; $opt_val = (array) get_site_option($opt_name, array()); if (isset($opt_val[$product_id])) { unset($opt_val[$product_id]); } update_site_option($opt_name, $opt_val); } public function get_next_lic_check_countdown() { $db = $this->get_db(); if (!is_array($db) || empty($db["tic"]) || empty($db["lic"]) || isset($_GET["refresh_licenses"])) { return ''; } $next_check_time = (int) $db["tic"] + 3600; $diff = $next_check_time - gmdate("U"); if ($diff < 120) { return ''; } $refresh_again_link = isset($_GET["refresh_licenses"]) ? '' : "<br/><a href=\"" . admin_url("index.php?page=dike_wpd&author=" . $this->author . "&refresh_licenses") . "\">refresh now</a>"; return "next licenses check in " . self::human_remaining_time($next_check_time, $short = false) . $refresh_again_link; } }
Malware detection & removal plugin for WordPress
(C)2020 Wordpress Doctor All rights reserved.