<?php if(!defined('ABSPATH')){exit;}global $dike_authors,$dike_products;$GLOBALS['is_dike_dashboard']=true;$author=sanitize_title(esc_html($_GET['author']));$GLOBALS['dike_dashboad_author']=$author;if(!isset($dike_authors[$author])){wp_die('Author not found');}$author_data=$dike_authors[$author];$GLOBALS['dike_products'][$author]=apply_filters('dike_'.$author.'_products',$GLOBALS['dike_products'][$author]);$baseurl=$GLOBALS['dike_baseurl'];$dashboard_url=admin_url('index.php?page=dike_wpd&author='.$author);$lic_class=new dike_licenses($author);$force_check=(isset($_GET['refresh_licenses']))?true:false;$licenses=$lic_class->get_licenses($force_check); ?><div class="dike_wrap wrap"data-author="<?php echo esc_attr($author) ?>"><h1 class="wp-heading-inline"id="dike_main_head"><img alt="<?php echo esc_attr($author) ?>"class="dike_<?php echo esc_attr($author) ?>_dashboard"src="<?php echo esc_attr($author_data['logo_url']) ?>"> <span>Dashboard</span></h1><small id="dike_last_check_date"><?php echo wp_kses_post($lic_class->get_next_lic_check_countdown()); ?></small><div id="dike_pre_list"><?php echo wp_kses_post($author_data['pre_products_txt']) ?></div><?php $owned_products=dike_licenses::owned_products($author);$missing_prods=dike_licenses::missing_products($author);$has_active_theme=false;foreach($owned_products as $prod_path=>$pdata){if(!dike_licenses::prod_is_theme($prod_path)){continue;}$has_active_theme=true;echo '
        <h3>Active theme</h3>
        <ul class="dike_prod_list dike_owned_prods">';dike_output_enabled_prod_block($prod_path,$pdata,$licenses);echo '        
        </ul>';unset($owned_products[$prod_path]);}if(count($owned_products)){$top_margin_code=($has_active_theme)?'<br/><br/>':'';$maybe_s=(count($owned_products)>1)?'s':'';echo wp_kses_post($top_margin_code).'    
        <h3>Enabled plugin'.esc_html($maybe_s).'</h3>
        <ul class="dike_prod_list dike_owned_prods">';foreach($owned_products as $prod_path=>$pdata){dike_output_enabled_prod_block($prod_path,$pdata,$licenses);}echo '
        </ul>';}if(!empty($missing_prods)){echo '
        <br/><br/><br/><hr/><br/><br/>';$missing_plugins=array();$missing_themes=array();foreach($missing_prods as $prod_path=>$pdata){(dike_licenses::prod_is_theme($prod_path))?$missing_themes[$prod_path]=$pdata:$missing_plugins[$prod_path]=$pdata;}if(!empty($missing_plugins)){$maybe_s=(count($missing_plugins)>1)?'s':'';echo '
            <h3>Plugin'.esc_html($maybe_s).' not enabled yet</h3>
            <ul class="dike_prod_list dike_missing_prods">';foreach($missing_plugins as $prod_path=>$pdata){dike_output_missing_prod_block($author,$pdata);}echo '
            </ul>';}if(!empty($missing_themes)){$top_margin_code=(!empty($missing_plugins))?'<br/><br/>':'';$maybe_s=(count($missing_themes)>1)?'s':'';echo wp_kses_post($top_margin_code).'
            <h3>Other theme'.esc_html($maybe_s).' by '.esc_html($author_data['author_name']).'</h3>
            <ul class="dike_prod_list dike_missing_prods">';foreach($missing_themes as $prod_path=>$pdata){dike_output_missing_prod_block($author,$pdata);}echo '
            </ul>';}} ?></div><?php $prod_welcome_code='';if(isset($_GET['prod_welcome'])){foreach($dike_products[$author]as $prod_path=>$pdata){if($_GET['prod_welcome']==$pdata['slug']){$pwc_pdata=$pdata;}}$prod_welcome_code="\n    <div class='dike_prod_welcome_wrap'>\n        <img src='".esc_attr($pwc_pdata['logo_url'])."' />\n        \n        <h3>Thanks for choosing ".$pwc_pdata['name']."!</h3>\n        \n        <button class='button-secondary' onclick='window.lcwpm_close()'>\n            <span class='dashicons dashicons-thumbs-up'></span>\n            Let's start!\n        </button>\n    </div>";$prod_welcome_code=apply_filters('dike_'.$author.'_prod_welcome_code',$prod_welcome_code,$pwc_pdata,esc_html($_GET['prod_welcome']));}$failed_prod_lic_check_code='';if(isset($_GET['failed_lic_check'])){$pname=false;$shop_link=false;foreach($dike_products[$author]as $prod_path=>$pdata){if($_GET['failed_lic_check']==$pdata['slug']){$pname=$pdata['name'];$shop_link=$pdata['buy_prod_link'];break;}}if($pname){$failed_prod_lic_check_code='
        Please insert a valid license for <strong>'.$pname.'</strong> to unlock it!<br/>
        <a href="'.$shop_link.'" target="_blank" class="dike_failed_lic_check_link">Need a new license?</a>';}} ?><script type="text/javascript">(function() { 
    "use strict";

    const nonce             = `<?php echo esc_js(wp_create_nonce('dike_nonce')) ?>`,
          admin_url         = `<?php echo esc_js(admin_url()) ?>`,
          refused_licenses  = JSON.parse(`<?php echo wp_json_encode(((array)get_site_option('dike_refused_licenses', array()))) ?>`),
          dashboard_url     = `<?php echo esc_url_raw($dashboard_url) ?>`,
          author            = `<?php echo esc_js($author) ?>`,
          menu_label            = `<?php echo esc_js($author_data['menu_label']) ?>`,
          how_to_get_token_txt  = `<?php echo wp_kses_post($author_data['how_to_get_token_txt']) ?>`,
          GET_data          = JSON.parse(`<?php echo wp_json_encode($_GET) ?>`),
          dike_v            = `<?php echo esc_js($GLOBALS['dike_registr']) ?>`,
          failed_prod_lic_check_code = `<?php echo wp_kses_post($failed_prod_lic_check_code) ?>`;
    
        for(const e in refused_licenses){const o=refused_licenses[e].tok;let t=refused_licenses[e].reason;switch(t){case"token_not_found":t="token not found in the database";break;case"domain_not_matching":t="domain not matching";break;case"token_expired":t="expired token";break;case"envato_lic_not_found":case"lic_not_found":t="shop license not found"}if(t.trim()&&(t="("+t+")"),!document.querySelector('.dike_prod[data-prod-slug="'+e+'"] .dike_insert_token_form fieldset'))break;document.querySelector('.dike_prod[data-prod-slug="'+e+'"] .dike_insert_token_form fieldset').insertAdjacentHTML("afterend",`<div class="dike_refused_license">\n                <span>\n                    <em>${o}</em>\n                    <strong>Token refused <small>${t}</small></strong>\n                </span>\n                <input type="button" value="Use new token" class="button-secondary" />\n            </div>`)}document.querySelectorAll(".dike_refused_license input").forEach((function(e){e.addEventListener("click",(e=>{e.target.parentNode.remove()}))}));const reset_dike_url=()=>{window.history.replaceState(null,null,dashboard_url)};-1!==window.location.href.indexOf("&refresh_licenses")&&reset_dike_url(),document.querySelectorAll(".dike_prod form").forEach((function(e){e.addEventListener("submit",(function(e){return e.preventDefault(),!1}))})),document.querySelectorAll('input[name="dike_prod_token"]').forEach((function(e){e.onkeyup=o=>{if(13===o.keyCode||13===o.which)return o.preventDefault(),e.parentNode.querySelector('input[name="dike_prod_activation_btn"]').click(),!1}})),document.querySelectorAll('input[name="dike_prod_activation_btn"]').forEach((function(e){e.addEventListener("click",(function(e){const o=e.target,t=recursive_parent(o,".dike_prod"),n=t.getAttribute("data-prod-slug"),d=t.querySelector("fieldset"),r=t.querySelector('input[name="dike_prod_token"]').value.trim(),i=t.querySelector('input[name="dike_purch_code"]').value.trim(),c=t.querySelector('input[name="dike_username"]').value.trim();if(!r||o.classList.contains("dike_blinking_btn"))return!1;if(32!=r.length)return lc_wp_popup_message("error","Validation token must be 32 characters long"),!1;if(i||c){if(36!=i.length)return lc_wp_popup_message("error","Purchase code must be 36 characters long"),!1;if(!c)return lc_wp_popup_message("error","Username required for offline token"),!1}d.disabled=!0,o.classList.add("dike_blinking_btn");const a=encrypt_string(JSON.stringify({prod_slug:n,domain:window.location.hostname.replace("www.","").replace("WWW.",""),token:r,purch_code:i,username:c,unicum:Math.random()}));fetch(ajaxurl,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/x-www-form-urlencoded","Cache-Control":"no-cache"},body:new URLSearchParams({action:"dike_validate_domain_token",author:author,data:a,dike_nonce:nonce})}).then((e=>e.json())).then((function(e){"error"==e.status?lc_wp_popup_message("error",e.message):(lc_wp_popup_message("success",e.message),setTimeout((()=>{window.location.href=admin_url+"index.php?page=dike_wpd&author="+encodeURIComponent(author)}),1150)),d.disabled=!1,o.classList.remove("dike_blinking_btn")})).catch((function(e){console.error(e),lc_wp_popup_message("error","Error performing the operation. Please try again"),d.disabled=!1,o.classList.remove("dike_blinking_btn")}))}))})),document.querySelectorAll(".dike_offline_valid").forEach((function(e){e.addEventListener("click",(function(e){const o=recursive_parent(e.target,".dike_prod");o.classList.add("dike_purch_code_f_shown"),o.querySelector('input[name="dike_purch_code"]').classList.remove("dike_displaynone"),o.querySelector('input[name="dike_username"]').classList.remove("dike_displaynone"),e.target.remove()}))})),document.querySelectorAll('input[name="dike_change_token_btn"]').forEach((function(e){e.addEventListener("click",(function(e){const o=recursive_parent(e.target,".dike_prod");o.querySelector(".dike_inserted_token_form").remove(),o.querySelector(".dike_insert_token_form").classList.remove("dike_displaynone"),o.querySelector(".dike_offline_valid").style.marginBottom="21px"}))}));const encrypt_string=function(e){let o="";for(let t=0;t<e.length;t++){let n=88^e.charCodeAt(t);o+=String.fromCharCode(n)}return o},modal_closing_code='<span class="dashicons dashicons-no-alt dike_close_modal"></span>';let changelog_modal_intval=null;document.addEventListener("DOMContentLoaded",(function(e){if(document.querySelectorAll(".dike_changelog_trigger").forEach((function(e){e.addEventListener("click",(function(e){const o=recursive_parent(e.target,".dike_prod").getAttribute("data-prod-slug"),t=recursive_parent(e.target,".dike_prod").getAttribute("data-prod-changelog"),n=void 0!==GET_data.prod_updated?GET_data.prod_cl:"",d=document.querySelector('.dike_prod[data-prod-slug="'+o+'"] h4').innerText.trim(),r="<img src='"+document.querySelector('.dike_prod[data-prod-slug="'+o+'"] span img').getAttribute("src")+"' class='dike_changelog_img' />";let i='<div class="dike_cl_popup_head">';i+=n==o?`\n                    ${r}\n                    <div>\n                        <h3 class="dike_changelog_title">${d} successfully updated!</h3>\n                        <h4 class="dike_changelog_title">In the following changelog you can see what changed:</h4>\n                    </div>`:r+'<h3 class="dike_changelog_title">'+d+" changelog</h3>",i+="</div>";let c=`\n                <div class="dike_modal_contents">\n                    ${i}\n                    <h2 class="dike_modal_loader">\n                        <img src="${admin_url}images/spinner-2x.gif" alt="loading" />    \n                    </h2>\n                    <iframe src="${t}" onload="window.dike_hide_modal_loader()"></iframe>\n                </div>`;lc_wp_popup_message("modal",c+modal_closing_code),document.body.style.overflow="hidden",document.querySelector(".lcwpm_modal").classList.add("dike_changelog_wrap"),document.querySelector(".dike_close_modal").addEventListener("click",(function(e){close_lc_popup_modal()})),changelog_modal_intval=setInterval((()=>{if(document.querySelector(".dike_cl_popup_head")){const e=document.querySelector(".dike_cl_popup_head").offsetHeight;document.querySelector(".dike_changelog_wrap iframe").style.height="calc(100% - "+e+"px)"}}),100)}))})),window.dike_hide_modal_loader=()=>{document.querySelector(".dike_modal_loader").remove()},void 0!==GET_data.prod_cl){const e=document.querySelector('.dike_prod[data-prod-slug="'+GET_data.prod_cl+'"] .dike_changelog_trigger');e&&(e.click(),reset_dike_url())}})),document.querySelectorAll(".dike_how_get_token").forEach((function(e){e.addEventListener("click",(function(e){const o=how_to_get_token_txt;lc_wp_popup_message("modal",o+modal_closing_code),document.body.style.overflow="hidden",document.querySelector(".dike_close_modal").addEventListener("click",(function(e){close_lc_popup_modal()}))}))})),failed_prod_lic_check_code&&document.addEventListener("DOMContentLoaded",(function(e){lc_wp_popup_message("error",failed_prod_lic_check_code),reset_dike_url()})),document.querySelectorAll(".dike_lic_hub_lb").forEach((function(e){e.addEventListener("click",(function(e){e.preventDefault();const o=encodeURIComponent("Dht2pVqNcSoxdL/x7/ssq5JnFuFfCp6soX30CTsgwI5fNctopHx08o4zQH0G7xIPyVk6+C3kXuX2BSQp1VuUS+3xxXZ9LLd+MyrjXyqhAZUeCyALzOjVaxC24NarTVaXtg==");let t=`\n            <div class="dike_modal_contents">\n                <iframe src="https://${author}.dikelicensing.com?iframed=${o}" onload="window.dike_hide_modal_loader()" class="dike_lic_hub_iframe"></iframe>\n            </div>`;lc_wp_popup_message("modal",t+modal_closing_code),document.body.style.overflow="hidden",document.querySelector(".lcwpm_modal").classList.add("dike_lic_hub_iframe_wrap"),document.querySelector(".dike_close_modal").addEventListener("click",(function(e){close_lc_popup_modal()}))}))})),document.onkeydown=function(e){let o=!1;o="key"in(e=e||window.event)?"Escape"===e.key||"Esc"===e.key:27===e.keyCode,o&&document.querySelector(".lcwpm_modal")&&close_lc_popup_modal()};const close_lc_popup_modal=()=>{window.lcwpm_close(),document.body.style.overflow="auto",changelog_modal_intval&&clearInterval(changelog_modal_intval)};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".dike_tooltip").forEach((function(e){e.addEventListener("click",(function(){e.classList.toggle("dike_tooltip_shown")})),e.addEventListener("mouseenter",(function(){e.classList.add("dike_tooltip_shown")})),e.addEventListener("mouseleave",(function(){e.classList.remove("dike_tooltip_shown")}))})),window.addEventListener("resize",(function(){document.querySelectorAll(".dike_tooltip_shown").forEach((function(e){e.classList.remove("dike_tooltip_shown")}))}))}));const wpm_sel_trick=document.querySelector('.wp-submenu a[href="index.php?page=dike_wpd&author='+GET_data.author+'"]');wpm_sel_trick&&(wpm_sel_trick.classList.add("current"),wpm_sel_trick.parentNode.classList.add("current"));const recursive_parent=(e,o)=>{let t=e;for(;null!=t.parentNode&&!t.matches(o);)t=t.parentNode;return t};document.addEventListener("DOMContentLoaded",(()=>{const e=document.getElementById("footer-upgrade");e&&(e.innerText=menu_label+" v"+dike_v)}));
    
})();</script>