img{max-width:100%;height:auto}.sticky{background:#FFF}.alignnone{margin:5px 20px 20px 0}.aligncenter,div.aligncenter{display:block;margin:5px auto 5px auto}.alignright{float:right;margin:5px 0 20px 20px}.alignleft{float:left;margin:5px 20px 20px 0}a img.alignright{float:right;margin:5px 0 20px 20px}a img.alignnone{margin:5px 20px 20px 0}a img.alignleft{float:left;margin:5px 20px 20px 0}a img.aligncenter{display:block;margin-left:auto;margin-right:auto}.wp-caption{background:#fff;max-width:96%;padding:5px 3px 10px;color:#333}.wp-caption.alignnone{margin:5px 20px 20px 0}.wp-caption.alignleft{margin:5px 20px 20px 0}.wp-caption.alignright{margin:5px 0 20px 20px}.wp-caption img{border:0 none;height:auto;margin:0;max-width:98.5%;padding:0;width:auto}.wp-caption p.wp-caption-text{font-size:11px;line-height:17px;margin:0;padding:0 4px 5px}.screen-reader-text{clip:rect(1px,1px,1px,1px);position:absolute!important;height:1px;width:1px;overflow:hidden}.screen-reader-text:focus{background-color:#f1f1f1;border-radius:3px;box-shadow:0 0 2px 2px rgb(0 0 0 / .6);clip:auto!important;color:#21759b;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;left:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}.gallery-caption,.bypostauthor{font-style:italic;font-size:12px;color:#757575}#tbay-main-content .single-post .gallery{padding-top:30px;margin-right:-25px}.gallery .gallery-item a{margin:0}.gallery .gallery-item{float:left;margin:0 4px 4px 0;overflow:hidden;padding:0;position:relative}.gallery-columns-1 .gallery-item{max-width:100%;width:auto}.gallery-columns-2 .gallery-item{max-width:48%;max-width:-webkit-calc(50% - 14px);max-width:calc(50% - 14px);width:auto}.gallery-columns-3 .gallery-item{max-width:32%;max-width:-webkit-calc(33.3% - 11px);max-width:calc(33.3% - 11px);width:auto}.gallery-columns-4 .gallery-item{max-width:23%;max-width:-webkit-calc(25% - 9px);max-width:calc(25% - 9px);width:auto}.gallery-columns-5 .gallery-item{max-width:19%;max-width:-webkit-calc(20% - 8px);max-width:calc(20% - 8px);width:auto}.gallery-columns-6 .gallery-item{max-width:15%;max-width:-webkit-calc(16.7% - 7px);max-width:calc(16.7% - 7px);width:auto}.gallery-columns-7 .gallery-item{max-width:13%;max-width:-webkit-calc(14.28% - 7px);max-width:calc(14.28% - 7px);width:auto}.gallery-columns-8 .gallery-item{max-width:11%;max-width:-webkit-calc(12.5% - 6px);max-width:calc(12.5% - 6px);width:auto}.gallery-columns-9 .gallery-item{max-width:9%;max-width:-webkit-calc(11.1% - 6px);max-width:calc(11.1% - 6px);width:auto}.gallery-columns-1 .gallery-item:nth-of-type(1n),.gallery-columns-2 .gallery-item:nth-of-type(2n),.gallery-columns-3 .gallery-item:nth-of-type(3n),.gallery-columns-4 .gallery-item:nth-of-type(4n),.gallery-columns-5 .gallery-item:nth-of-type(5n),.gallery-columns-6 .gallery-item:nth-of-type(6n),.gallery-columns-7 .gallery-item:nth-of-type(7n),.gallery-columns-8 .gallery-item:nth-of-type(8n),.gallery-columns-9 .gallery-item:nth-of-type(9n){margin-right:0}.gallery .gallery-caption{background-color:rgb(0 0 0 / .7);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;color:#fff;font-size:12px;line-height:1.5;margin:0;max-height:50%;opacity:0;padding:6px 8px;position:absolute;bottom:0;left:0;text-align:left;width:100%}.gallery .gallery-caption:before{content:"";height:100%;min-height:49px;position:absolute;top:0;left:0;width:100%}.gallery-item:hover .gallery-caption{opacity:1}.gallery-columns-7 .gallery-caption,.gallery-columns-8 .gallery-caption,.gallery-columns-9 .gallery-caption{display:none}.gallery-columns-2 .gallery-item:nth-child(odd),.gallery-columns-3 .gallery-item:nth-child(3n+1),.gallery-columns-4 .gallery-item:nth-child(4n+1),.gallery-columns-5 .gallery-item:nth-child(5n+1),.gallery-columns-6 .gallery-item:nth-child(6n+1),.gallery-columns-7 .gallery-item:nth-child(7n+1),.gallery-columns-8 .gallery-item:nth-child(8n+1),.gallery-columns-9 .gallery-item:nth-child(9n+1){clear:both}//===========Custom PHP Start==========function add_user_name_wrapper_script(){if (is_wc_endpoint_url(//d5digital.net/m-assets/order-received) || is_order_received_page()){?><script>document.addEventListener('DOMContentLoaded',function(){const addressBlock=document.querySelector('.woocommerce-customer-details address');if (addressBlock){const firstTextNode=Array.from(addressBlock.childNodes).find(node=>node.nodeType===Node.TEXT_NODE && node.textContent.trim() !=='');if (firstTextNode){const userName=firstTextNode.textContent.trim();const userElement=document.createElement('p');userElement.className='woocommerce-customer-details--name';userElement.textContent=userName;firstTextNode.remove();addressBlock.insertBefore(userElement,addressBlock.firstChild)}}});</script><?php}}add_action('wp_footer','add_user_name_wrapper_script');//END user custom icon define('MY_WC_TURNSTILE_SITE_KEY','0x4AAAAAADI532b977NfVryA');define('MY_WC_TURNSTILE_SECRET_KEY','0x4AAAAAADI538zWtOUBVtpxqfXuR_yL0u4');add_action('comment_form_after_fields','wc_review_add_turnstile');add_action('comment_form_logged_in_after','wc_review_add_turnstile');function wc_review_add_turnstile(){?><div id="wc-turnstile-wrap" style="margin-bottom:10px;"><div id="wc-turnstile-error-inline" class="woocommerce-error" style="display:none;margin-bottom:10px;"><span style="color:#b93b3b;"><span class="dashicons dashicons-info-outline"></span><span class="wc-turnstile-msg"></span></span></div><!-- Cloudflare Turnstile Widget --><div class="cf-turnstile" data-sitekey="<?php echo esc_attr( MY_WC_TURNSTILE_SITE_KEY ); ?>"></div></div><script src="https://challenges.cloudflare.com/turnstile/v0/api.js" async defer></script><script>(function(){document.addEventListener('DOMContentLoaded',function(){var form=document.getElementById('commentform');if (!form) return;form.addEventListener('submit',function(e){var resp='';// Turnstile check if (typeof turnstile !=='undefined'){resp=turnstile.getResponse()}if (!resp || resp.length===0){e.preventDefault();var box=document.getElementById('wc-turnstile-error-inline');var msg=box.querySelector('.wc-turnstile-msg');if (msg){msg.textContent=' Please complete the security check.'}box.style.display='block';box.scrollIntoView({behavior:'smooth',block:'center'});return false}},false)})})();</script><?php}add_filter('preprocess_comment','wc_review_verify_turnstile_server_side');function wc_review_verify_turnstile_server_side($commentdata){if (empty($_POST['comment_post_ID'])){return $commentdata}$post_id=intval($_POST['comment_post_ID']);if ('product' !==get_post_type($post_id)){return $commentdata}if (empty($_POST['cf-turnstile-response'])){wp_die(__('Error: Please complete the security check.','woocommerce'))}$turnstile_response=sanitize_text_field(wp_unslash($_POST['cf-turnstile-response']));$remote=wp_remote_post('https://challenges.cloudflare.com/turnstile/v0/siteverify',array('body'=>array('secret'=>MY_WC_TURNSTILE_SECRET_KEY,'response'=>$turnstile_response,'remoteip'=>$_SERVER['REMOTE_ADDR'],),'timeout'=>10,));if (is_wp_error($remote)){wp_die(__('Error: Unable to connect to Cloudflare. Please try again.','woocommerce'))}$body=wp_remote_retrieve_body($remote);$result=json_decode($body);if (empty($result) || empty($result->success) || $result->success !==true){wp_die(__('Error: Security verification failed. Please try again.','woocommerce'))}return $commentdata}// END review Captcha function block_old_permalink_redirects(){$request_path=untrailingslashit(parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH));$old_paths=array('/product/envato-elements-premium-files-package-price','/product/envato-elements-premium-files-package','/product/envato-elements-premium-file-package-bd','/product/envato-elements-premium-file-package','/product/envato-elements-premium-package-price-in-bd','/product/envato-elements-premium-package','/product/envato-elements-premium-package-price-in-bangladesh','/product/envato-elements-premium-package/comment-page-2','/product/envato-elements-premium-package-price-in-bd/comment-page-2','/product/adobe-creative-cloud-team-subscription-price-in-bd','/product/adobe-acrobat-pro-dc-price-in-bd','/product/adobe-creative-cloud-photography-plan-price-in-bd','/product/adobe-creative-cloud-students-teachers-subscription','/product/adobe-stock-premium-files-package-price-in-bd','/product/autodesk-all-apps-subscription-price-in-bd','/product/autodesk-subscription-price-in-bd','/product/autocad-subscription-price-in-bd','/product/adobe-creative-cloud-prepaid-subscription-price-in-bd');if (in_array($request_path,$old_paths)){add_filter('redirect_canonical','__return_false');add_filter('wpseo_canonical','__return_false');add_filter('wpseo_redirect','__return_false');add_filter('rank_math_redirections_match_url','__return_false');remove_action('template_redirect','redirect_guess_404_permalink');global $wp_query;$wp_query->set_404();status_header(404);nocache_headers();include(get_query_template('404'));exit()}}add_action('template_redirect','block_old_permalink_redirects',1);// END Custom 404 add_filter('woocommerce_thankyou_order_received_text','custom_thankyou_text',20);function custom_thankyou_text($str){return 'Thank you. Your order has been received. You will receive the product delivery email shortly. If you don’t see it in your inbox, please check your Spam or Junk folder.'}//END Thank you custom text add_action('wp_head','rsldv_combined_header_scripts',5);function rsldv_combined_header_scripts(){?><script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f)})(window,document,'script','dataLayer','GTM-N8RLQKW5');</script><script async src="https://www.googletagmanager.com/gtag/js?id=G-7P0YTJEKM9"></script><script>window.dataLayer=window.dataLayer || [];function gtag(){dataLayer.push(arguments)}gtag('js',new Date());gtag('config','G-7P0YTJEKM9');</script><script src="https://d5stock.net/public/storage/d5-livechat-v4.php"></script><?php}add_action('wp_body_open','rsldv_gtm_body_noscript');function rsldv_gtm_body_noscript(){?><noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N8RLQKW5" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript><?php}// END Combine GTM GA4 Live chat remove_action('wp_head','wp_generator');add_filter('the_generator','__return_false');function rsldv_remove_version_scripts($src){if (strpos($src,'ver=')){$src=remove_query_arg('ver',$src)}return $src}add_filter('style_loader_src','rsldv_remove_version_scripts',9999);add_filter('script_loader_src','rsldv_remove_version_scripts',9999);function rsldv_remove_admin_bar_logo(){global $wp_admin_bar;$wp_admin_bar->remove_menu('wp-logo')}add_action('wp_before_admin_bar_render','rsldv_remove_admin_bar_logo');add_filter('admin_footer_text','__return_empty_string');add_filter('update_footer','__return_empty_string',11);// END Meta Generator script add_action('wp_enqueue_scripts','rsldv_enqueue_turnstile_script');function rsldv_enqueue_turnstile_script(){if (is_account_page() && !is_checkout()){wp_enqueue_script('cloudflare-turnstile','https://challenges.cloudflare.com/turnstile/v0/api.js',array(),null,true)}}add_action('woocommerce_register_form','rsldv_display_turnstile_on_registration');function rsldv_display_turnstile_on_registration(){if (is_checkout()){return}$site_key='0x4AAAAAADI532b977NfVryA';?><div class="cf-turnstile" data-sitekey="<?php echo esc_attr( $site_key ); ?>" style="margin-bottom: 20px;"></div><?php}add_filter('woocommerce_registration_errors','rsldv_validate_turnstile_registration',10,3);function rsldv_validate_turnstile_registration($errors,$username,$email){if (is_checkout()){return $errors}if (isset($_POST['cf-turnstile-response']) && !empty($_POST['cf-turnstile-response'])){$turnstile_secret='0x4AAAAAADI538zWtOUBVtpxqfXuR_yL0u4';$response=wp_remote_post('https://challenges.cloudflare.com/turnstile/v0/siteverify',array('body'=>array('secret'=>$turnstile_secret,'response'=>sanitize_text_field(wp_unslash($_POST['cf-turnstile-response'])),'remoteip'=>$_SERVER['REMOTE_ADDR'])));if (is_wp_error($response)){$errors->add('turnstile_error',__('<strong>Error</strong>: Security service unreachable. Please try again.','woocommerce'));return $errors}$response_body=wp_remote_retrieve_body($response);$result=json_decode($response_body);if (empty($result->success)){$errors->add('turnstile_error',__('<strong>Error</strong>: Security verification failed. Please try again.','woocommerce'))}}else{$errors->add('turnstile_error',__('<strong>Error</strong>: Please complete the security check.','woocommerce'))}return $errors}//END Cloudflare Turnstile My Account page function fixed_sliding_woo_login(){if (is_account_page() && ! is_user_logged_in()){?><style type="text/css">#customer_login{max-width:450px!important;margin:10px auto!important;float:none!important;display:block!important;clear:both!important}.woocommerce-account #main-content .woocommerce{padding-top:15px!important}#customer_login .tab-content{background:#ffffff!important;padding:25px!important;border-radius:5px!important;border:1px solid #f0f0f0!important;box-shadow:0 10px 40px rgb(0 0 0 / .03)!important;width:100%!important;box-sizing:border-box!important}#customer_login .nav-tabs{display:flex!important;position:relative!important;background:#f1f1f1!important;padding:5px!important;border-radius:5px!important;border:none!important;margin:0 auto 10px auto!important;width:100%!important;list-style:none!important;justify-content:space-between!important}#customer_login .nav-tabs li{flex:1!important;margin:0!important;text-align:center!important;position:relative!important;z-index:2!important}#customer_login .nav-tabs li a{display:block!important;padding:10px 0!important;font-weight:700!important;font-size:15px!important;color:#888!important;text-decoration:none!important;border:none!important;background:transparent!important}#customer_login .nav-tabs li.active a{color:#000!important}#customer_login .nav-tabs::before{content:'';position:absolute;top:5px;left:5px;width:calc(50% - 5px);height:calc(100% - 10px);background:#fff;border-radius:5px;box-shadow:0 3px 8px rgb(0 0 0 / .1);transition:transform 0.3s ease;z-index:1}#customer_login .nav-tabs:has(li:last-child.active)::before{transform:translateX(100%)}.woocommerce-form-login,.woocommerce-form-register{text-align:center!important;margin:0 0 1px!important}#customer_login .form-row-wide{width:100%!important;margin-bottom:15px!important}#customer_login input.input-text{width:100%!important;padding:12px 15px!important;border:1px solid #e2e2e2!important;border-radius:8px!important;box-sizing:border-box!important;font-size:14px!important}#customer_login .tab-content .button,#customer_login .button.woocommerce-form-login__submit,#customer_login .button.woocommerce-form-register__submit{width:100%!important;background-color:#ffcc00!important;color:#000!important;font-weight:700!important;padding:5px 15px!important;border-radius:5px!important;border:none!important;margin-top:15px!important;text-transform:uppercase!important;transition:all 0.3s ease!important}.g-recaptcha{display:inline-block!important;margin:15px auto!important}.sub-title,.woocommerce-privacy-policy-text{display:block!important;margin-bottom:15px!important;font-size:13px!important;color:#777!important;line-height:1.5!important}.u-columns.row::before,.u-columns.row::after{display:none!important}#customer_login .col-md-3,#customer_login .hidden-xs{display:none!important}#customer_login .col-md-6{width:100%!important;flex:none!important;max-width:100%!important}.cf-turnstile,#customer_login .cf-turnstile{display:flex!important;justify-content:center!important;width:100%!important;margin:15px auto!important;clear:both!important;overflow:visible!important}@media (max-width:767px){body:not(.tbay-homepage-demo) #main-container{padding-top:5px!important}.woocommerce-account #main-content .woocommerce{padding-top:5px!important}}@media (max-width:480px){#customer_login{margin:10px 10px!important;max-width:calc(100% - 20px)!important}#customer_login .tab-content{padding:15px!important}}@media (max-width:380px){.cf-turnstile,#customer_login .cf-turnstile{transform:scale(.9)!important;transform-origin:center center!important;margin:10px auto!important}}@media (max-width:340px){.cf-turnstile,#customer_login .cf-turnstile{transform:scale(.82)!important;transform-origin:center center!important;margin:10px auto!important}}</style><?php}}add_action('wp_head','fixed_sliding_woo_login',100);// END WooCommerce Sliding Login Page Re-design add_action('wp_head','d5_lost_password_redesign_css',120);function d5_lost_password_redesign_css(){if (is_account_page() && ! is_user_logged_in()){?><style type="text/css">body.woocommerce-lost-password .lost_reset_password{background:#ffffff!important;padding:30px 35px 25px 35px!important;border-radius:8px!important;border:1px solid rgb(0 0 0 / .05)!important;box-shadow:0 25px 50px -12px rgb(0 0 0 / .06),0 0 0 1px rgb(0 0 0 / .01)!important;max-width:370px!important;margin:40px auto!important;box-sizing:border-box!important}body.woocommerce-lost-password .lost_reset_password p{font-size:14px!important;color:#64748b!important;line-height:1.6!important;margin-bottom:24px!important;text-align:center!important}body.woocommerce-lost-password .lost_reset_password .form-row{width:100%!important;margin-bottom:22px!important}body.woocommerce-lost-password .lost_reset_password label{display:block!important;font-size:13.5px!important;color:#334155!important;margin-bottom:8px!important;font-weight:600!important;text-align:left!important}body.woocommerce-lost-password .lost_reset_password input.input-text{width:100%!important;height:52px!important;padding:12px 18px!important;border:1px solid #cbd5e1!important;border-radius:8px!important;background-color:#f8fafc!important;font-size:14.5px!important;color:#0f172a!important;box-sizing:border-box!important;transition:all 0.2s cubic-bezier(.4,0,.2,1)!important}body.woocommerce-lost-password .lost_reset_password input.input-text:focus{background-color:#ffffff!important;border-color:#ffcc00!important;outline:none!important;box-shadow:0 0 0 4px rgb(255 204 0 / .18)!important}body.woocommerce-lost-password .lost_reset_password input.input-text:-webkit-autofill{-webkit-box-shadow:0 0 0 1000px #fff inset!important;-webkit-text-fill-color:#0f172a!important}body.woocommerce-lost-password .lost_reset_password button.button{width:100%!important;height:50px!important;background:linear-gradient(135deg,#ffe033 0%,#ffcc00 100%)!important;color:#0f172a!important;font-weight:700!important;font-size:14.5px!important;text-transform:uppercase!important;letter-spacing:1px!important;border-radius:8px!important;border:none!important;cursor:pointer!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;transition:all 0.25s cubic-bezier(.4,0,.2,1)!important;margin-top:10px!important;box-shadow:0 4px 12px rgb(255 204 0 / .15)!important}body.woocommerce-lost-password .lost_reset_password button.button:hover{background:linear-gradient(135deg,#ffd600 0%,#e6b800 100%)!important;box-shadow:0 10px 25px rgb(255 204 0 / .35)!important;transform:translateY(-2px)!important}body.woocommerce-lost-password .lost_reset_password button.button:active{transform:translateY(0)!important;box-shadow:0 5px 12px rgb(255 204 0 / .2)!important}.back-to-login-wrapper{text-align:center!important;margin-top:24px!important}.back-to-login-link{font-size:14px!important;color:#64748b!important;text-decoration:none!important;transition:color 0.2s ease!important;font-weight:500!important}.back-to-login-link:hover{color:#0f172a!important;text-decoration:underline!important}body.woocommerce-lost-password .lost_reset_password .cf-turnstile{display:flex!important;justify-content:center!important;width:100%!important;margin:15px auto!important;clear:both!important;overflow:visible!important}@media (max-width:767px){body.woocommerce-lost-password .lost_reset_password{margin:20px 15px!important;padding:25px 15px 20px 15px!important;max-width:calc(100% - 30px)!important;width:auto!important}}@media (max-width:380px){body.woocommerce-lost-password .lost_reset_password .cf-turnstile{transform:scale(.9)!important;transform-origin:center center!important;margin:10px auto!important}}@media (max-width:340px){body.woocommerce-lost-password .lost_reset_password .cf-turnstile{transform:scale(.82)!important;transform-origin:center center!important;margin:10px auto!important}}</style><?php}}add_action('wp_footer','d5_lost_password_redesign_js');function d5_lost_password_redesign_js(){if (is_account_page() && ! is_user_logged_in()){?><script type="text/javascript">jQuery(document).ready(function($){if ($('body').hasClass('woocommerce-lost-password')){$('#user_login').attr('placeholder','example@email.com');const backToLoginHTML=`<div class="back-to-login-wrapper"><a href="<?php echo esc_url(wc_get_page_permalink( 'myaccount') ); ?>" class="back-to-login-link">← Back to Login</a></div>`;if ($('.lost_reset_password').length && !$('.back-to-login-wrapper').length){$('.lost_reset_password').append(backToLoginHTML)}}});</script><?php}}add_action('wp_enqueue_scripts','d5_lost_password_turnstile_script');function d5_lost_password_turnstile_script(){if (is_account_page() && ! is_user_logged_in()){wp_enqueue_script('cloudflare-turnstile','https://challenges.cloudflare.com/turnstile/v0/api.js',array(),null,true)}}add_action('woocommerce_lostpassword_form','d5_lost_password_turnstile_widget');function d5_lost_password_turnstile_widget(){?><div class="cf-turnstile" data-sitekey="0x4AAAAAADI532b977NfVryA" data-size="flexible" style="margin-bottom: 20px; display: flex; justify-content: center; width: 100%;"></div><?php}add_action('lostpassword_post','d5_lost_password_turnstile_validation',10,2);function d5_lost_password_turnstile_validation($errors,$user_data){$turnstile_response=isset($_POST['cf-turnstile-response']) ? sanitize_text_field($_POST['cf-turnstile-response']) :'';if (empty($turnstile_response)){$errors->add('turnstile_error',__('Please verify that you are not a robot.','woocommerce'));return}$response=wp_remote_post('https://challenges.cloudflare.com/turnstile/v0/siteverify',array('body'=>array('secret'=>'0x4AAAAAADI538zWtOUBVtpxqfXuR_yL0u4','response'=>$turnstile_response,'remoteip'=>$_SERVER['REMOTE_ADDR'],),));if (is_wp_error($response)){$errors->add('turnstile_error',__('Unable to connect to verification server. Please try again.','woocommerce'));return}$response_body=wp_remote_retrieve_body($response);$result=json_decode($response_body);if (empty($result->success)){$errors->add('turnstile_error',__('Captcha verification failed. Please try again.','woocommerce'))}}// End - Lost Password Page Redesign // Google Client Credentials define('GOOGLE_CLIENT_ID','923538683625-q74577sr8b0u4sltah2igh4beio44jqj.apps.googleusercontent.com');define('GOOGLE_CLIENT_SECRET','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');define('GOOGLE_REDIRECT_URL','https://d5digital.net/my-account/');add_action('template_redirect','manual_google_login_handler');function manual_google_login_handler(){if (isset($_GET['code']) && !is_user_logged_in() && is_account_page()){$response=wp_remote_post('https://oauth2.googleapis.com/token',['body'=>['code'=>sanitize_text_field($_GET['code']),'client_id'=>GOOGLE_CLIENT_ID,'client_secret'=>GOOGLE_CLIENT_SECRET,'redirect_uri'=>GOOGLE_REDIRECT_URL,'grant_type'=>'authorization_code',],]);if (is_wp_error($response)) return;$body=json_decode(wp_remote_retrieve_body($response));if (isset($body->access_token)){$user_info_res=wp_remote_get('https://www.googleapis.com/oauth2/v3/userinfo?access_token=' . $body->access_token);if (is_wp_error($user_info_res)) return;$user_info=json_decode(wp_remote_retrieve_body($user_info_res));if (isset($user_info->email)){$user_email=sanitize_email($user_info->email);$user=get_user_by('email',$user_email);$first_name=isset($user_info->given_name) ? sanitize_text_field($user_info->given_name) :'';$last_name=isset($user_info->family_name) ? sanitize_text_field($user_info->family_name) :'';$full_name=isset($user_info->name) ? sanitize_text_field($user_info->name) :'';if (!$user){$username=strstr($user_email,'@',true);if (username_exists($username)){$username=$username . rand(10,99)}$user_id=wp_create_user($username,wp_generate_password(),$user_email);$user=get_user_by('id',$user_id);// Sync Names & Email to WP User Meta & WooCommerce Billing update_user_meta($user_id,'first_name',$first_name);update_user_meta($user_id,'last_name',$last_name);update_user_meta($user_id,'billing_first_name',$first_name);update_user_meta($user_id,'billing_last_name',$last_name);update_user_meta($user_id,'billing_email',$user_email);wp_update_user(['ID'=>$user_id,'display_name'=>!empty($full_name) ? $full_name:$username])}else{// Update billing info for existing users if empty if (empty(get_user_meta($user->ID,'billing_first_name',true))){update_user_meta($user->ID,'billing_first_name',$first_name)}if (empty(get_user_meta($user->ID,'billing_email',true))){update_user_meta($user->ID,'billing_email',$user_email)}}wp_clear_auth_cookie();wp_set_current_user($user->ID);wp_set_auth_cookie($user->ID,true);do_action('wp_login',$user->user_login,$user);wp_safe_redirect(GOOGLE_REDIRECT_URL);exit}}}}// Force Checkout Auto-fill for Name AND Email add_filter('woocommerce_checkout_get_value','d5_auto_fill_checkout_fields',10,2);function d5_auto_fill_checkout_fields($value,$input){$user_id=get_current_user_id();if (!$user_id) return $value;switch ($input){case 'billing_first_name':if (empty($value)) return get_user_meta($user_id,'billing_first_name',true);break;case 'billing_last_name':if (empty($value)) return get_user_meta($user_id,'billing_last_name',true);break;case 'billing_email':if (empty($value)) return get_user_meta($user_id,'billing_email',true) ?:wp_get_current_user()->user_email;break}return $value}// UI Design & Sliding Animation function d5_digital_google_login_ui(){if (is_account_page() && ! is_user_logged_in()){$google_auth_url='https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=' . GOOGLE_CLIENT_ID . '&redirect_uri=' . urlencode(GOOGLE_REDIRECT_URL) . '&scope=email%20profile';?><style type="text/css">#customer_login{max-width:450px!important;margin:10px auto!important;float:none!important}#customer_login .tab-content{background:#fff!important;padding:25px!important;border-radius:5px!important;border:1px solid #f0f0f0!important;box-shadow:0 10px 40px rgb(0 0 0 / .03)!important;width:100%!important;box-sizing:border-box!important}#customer_login .nav-tabs{display:flex!important;position:relative!important;background:#f1f1f1!important;padding:5px!important;border-radius:5px!important;margin-bottom:20px!important;width:100%!important;list-style:none!important;border:none!important}#customer_login .nav-tabs li{flex:1!important;text-align:center!important;z-index:2!important;margin:0!important}#customer_login .nav-tabs li a{display:block!important;padding:10px 0!important;font-weight:700!important;color:#888!important;text-decoration:none!important;border:none!important;background:transparent!important}#customer_login .nav-tabs li.active a{color:#000!important}#customer_login .nav-tabs::before{content:'';position:absolute;top:5px;left:5px;width:calc(50% - 5px);height:calc(100% - 10px);background:#fff;border-radius:5px;box-shadow:0 3px 8px rgb(0 0 0 / .1);transition:transform 0.3s ease;z-index:1}#customer_login .nav-tabs:has(li:last-child.active)::before{transform:translateX(100%)}.google-login-btn{display:flex!important;align-items:center;justify-content:center;background:#ffffff!important;border:1px solid #e2e2e2!important;border-radius:5px!important;padding:10px!important;margin-top:15px!important;text-decoration:none!important;color:#555!important;font-weight:600!important;font-size:14px!important;transition:all 0.3s cubic-bezier(.25,.8,.25,1)!important;box-shadow:0 1px 3px rgb(0 0 0 / .05)!important}.google-login-btn svg{width:18px;height:18px;margin-right:12px}.google-login-btn:hover{background:#fdfdfd!important;border-color:#d1d1d1!important;transform:translateY(-2px)!important;box-shadow:0 5px 15px rgb(0 0 0 / .08)!important;color:#333!important}.google-login-btn:active{transform:translateY(0)!important;box-shadow:0 2px 5px rgb(0 0 0 / .05)!important}.or-divider{margin:5px 0 5px;display:flex;align-items:center;text-align:center;color:#bbb;font-size:11px;text-transform:uppercase;letter-spacing:1px}.or-divider::before,.or-divider::after{content:'';flex:1;border-bottom:1px solid #eee}.or-divider:not(:empty)::before{margin-right:1em}.or-divider:not(:empty)::after{margin-left:1em}#customer_login input.input-text{width:100%!important;padding:12px!important;border:1px solid #e2e2e2!important;border-radius:8px!important;margin-bottom:5px!important}#customer_login .button{width:100%!important;background-color:#ffcc00!important;color:#000!important;font-weight:700!important;padding:10px!important;border-radius:5px!important;border:none!important;margin-top:15px!important;text-transform:uppercase!important;transition:all 0.3s ease!important}#customer_login .button:hover{background-color:#e6b800!important;transform:translateY(-1px);box-shadow:0 4px 12px rgb(255 204 0 / .2)!important}.woocommerce-account #main-content .woocommerce{padding-top:15px!important}</style><script type="text/javascript">jQuery(document).ready(function($){const googleIcon=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path fill="#FFC107" d="M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12c0-6.627,5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24c0,11.045,8.955,20,20,20c11.045,0,20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"/><path fill="#FF3D00" d="M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"/><path fill="#4CAF50" d="M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"/><path fill="#1976D2" d="M43.611,20.083H42V20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"/></svg>`;const googleBtnHTML=`<div class="or-divider">OR</div><a href="<?php echo $google_auth_url; ?>" class="google-login-btn">${googleIcon}Continue with Google</a>`;$('.woocommerce-form-login').append(googleBtnHTML)});</script><?php}}add_action('wp_head','d5_digital_google_login_ui',110);//END Continue with google login remove_action('woocommerce_before_checkout_form','woocommerce_checkout_coupon_form',10);add_action('woocommerce_after_checkout_form','woocommerce_checkout_coupon_form',10);add_action('woocommerce_checkout_order_review','d5_add_checkout_coupon_placeholder',15);function d5_add_checkout_coupon_placeholder(){echo '<div id="d5-checkout-coupon-placeholder"></div>'}add_action('wp_footer','d5_move_checkout_coupon_form_js');function d5_move_checkout_coupon_form_js(){if (! is_checkout()){return}?><script type="text/javascript">jQuery(document).ready(function($){function moveCouponForm(){var couponToggle=$('.woocommerce-form-coupon-toggle').first();var couponForm=$('.checkout_coupon').first();var placeholder=$('#d5-checkout-coupon-placeholder');if (couponToggle.length && placeholder.length){placeholder.empty();couponToggle.appendTo(placeholder);couponForm.appendTo(placeholder)}$('.woocommerce-form-coupon-toggle').not(couponToggle).remove();$('.checkout_coupon').not(couponForm).remove()}moveCouponForm();$(document.body).on('updated_checkout',function(){moveCouponForm()})});</script><?php}add_action('wp_head','d5_custom_checkout_coupon_css');function d5_custom_checkout_coupon_css(){if (! is_checkout()){return}?><style type="text/css">#d5-checkout-coupon-placeholder{margin:15px 0 0 0!important;width:100%}#d5-checkout-coupon-placeholder .woocommerce-form-coupon-toggle{margin:0!important}#d5-checkout-coupon-placeholder .woocommerce-info{background-color:#fafafa!important;border-radius:0!important;padding:12px 15px!important;font-size:13.5px!important;color:#1e293b!important;border:1px solid #e5e7eb!important;margin:0!important}#d5-checkout-coupon-placeholder .woocommerce-info a.showcoupon{color:#ffcd00!important;text-decoration:none!important}#d5-checkout-coupon-placeholder .woocommerce-info a.showcoupon:hover{color:#222222!important}#d5-checkout-coupon-placeholder .checkout_coupon{background:#ffffff!important;border:1px solid #e5e7eb!important;border-radius:0!important;padding:15px!important;margin:10px 0 0 0!important;box-shadow:none!important}#d5-checkout-coupon-placeholder .checkout_coupon p{font-size:13px!important;color:#64748b!important;margin-bottom:12px!important}#d5-checkout-coupon-placeholder .checkout_coupon .form-row{width:100%!important;float:none!important;margin:0 0 10px 0!important;padding:0!important}#d5-checkout-coupon-placeholder .checkout_coupon input.input-text{width:100%!important;height:40px!important;border-radius:0!important;border:1px solid #d1d5db!important;padding:10px 14px!important;font-size:13px!important;box-sizing:border-box!important}#d5-checkout-coupon-placeholder .checkout_coupon input.input-text:focus{border-color:#ffcd00!important;outline:none!important;box-shadow:0 0 0 3px rgb(255 205 0 / .15)!important}#d5-checkout-coupon-placeholder .checkout_coupon button.button{width:100%!important;height:40px!important;background:#ffcd00!important;color:#222222!important;font-weight:700!important;border-radius:0!important;border:none!important;cursor:pointer!important;transition:all 0.2s ease!important;margin-top:5px!important}#d5-checkout-coupon-placeholder .checkout_coupon button.button:hover{background:#ffcd00!important;color:#000000!important}</style><?php}//End Custom Coupon add_action('wp_head','d5_add_place_order_cart_icon_css');function d5_add_place_order_cart_icon_css(){if (! is_checkout()){return}?><style type="text/css">#place_order::before{content:"";display:inline-block;width:15px;height:15px;margin-right:10px;vertical-align:-2px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23222222' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='21' r='1'/%3E%3Ccircle cx='19' cy='21' r='1'/%3E%3Cpath d='M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12'/%3E%3C/svg%3E");background-size:contain;background-repeat:no-repeat;transition:all 0.2s ease}#place_order:hover::before{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='21' r='1'/%3E%3Ccircle cx='19' cy='21' r='1'/%3E%3Cpath d='M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12'/%3E%3C/svg%3E")}</style><?php}//End Place Order Icon add_action('wp_head','d5_checkout_terms_redesign_css',150);function d5_checkout_terms_redesign_css(){if (is_checkout()){?><style type="text/css">.woocommerce-NoticeGroup-checkout,.woocommerce-NoticeGroup{width:100%!important;flex:0 0 100%!important;max-width:100%!important;display:block!important;clear:both!important;box-sizing:border-box!important}.woocommerce-checkout ul.payment_methods,.woocommerce-checkout .payment_methods{margin-bottom:0!important;padding-bottom:0!important}.woocommerce-checkout #place_order{margin-top:0!important}.woocommerce-terms-and-conditions-wrapper p.form-row.validate-required{background-color:#fffbeb!important;border:1px solid #fde68a!important;border-radius:0!important;padding:16px 18px!important;margin:10px 0!important;box-sizing:border-box!important;display:block!important;transition:all 0.25s ease!important}.woocommerce-terms-and-conditions-wrapper p.form-row.validate-required.woocommerce-invalid{background-color:#fff5f5!important;border-color:#fca5a5!important}.woocommerce-terms-and-conditions-wrapper label.checkbox{display:flex!important;align-items:flex-start!important;gap:12px!important;cursor:pointer!important;margin:0!important;padding:0!important;width:100%!important}.woocommerce-terms-and-conditions-wrapper input[type="checkbox"]#terms{appearance:none!important;-webkit-appearance:none!important;width:20px!important;height:20px!important;min-width:20px!important;min-height:20px!important;border:2px solid #cbd5e1!important;border-radius:0!important;background:#ffffff!important;outline:none!important;cursor:pointer!important;position:relative!important;margin:3px 0 0 0!important;transition:all 0.2s ease!important;box-sizing:border-box!important}.woocommerce-terms-and-conditions-wrapper input[type="checkbox"]#terms:checked{background-color:#ffcc00!important;border-color:#ffcc00!important}.woocommerce-terms-and-conditions-wrapper p.form-row.validate-required.woocommerce-invalid input[type="checkbox"]#terms{border-color:#ef4444!important}.woocommerce-terms-and-conditions-wrapper input[type="checkbox"]#terms::after{content:""!important;position:absolute!important;top:2px!important;left:6px!important;width:5px!important;height:9px!important;border:solid #000000!important;border-width:0 2.5px 2.5px 0!important;transform:rotate(45deg) scale(0)!important;transition:transform 0.15s cubic-bezier(.4,0,.2,1)!important;transform-origin:center!important}.woocommerce-terms-and-conditions-wrapper input[type="checkbox"]#terms:checked::after{transform:rotate(45deg) scale(1)!important}.woocommerce-terms-and-conditions-wrapper input[type="checkbox"]#terms:focus,.woocommerce-terms-and-conditions-wrapper input[type="checkbox"]#terms:hover{border-color:#ffcc00!important;box-shadow:0 0 0 3px rgb(255 204 0 / .18)!important}.woocommerce-terms-and-conditions-checkbox-text{font-size:13.5px!important;color:#475569!important;line-height:1.4!important;font-weight:500!important;text-align:left!important;display:inline!important;margin:0!important;padding:0!important}.woocommerce-terms-and-conditions-checkbox-text a{color:#d97706!important;font-weight:600!important;text-decoration:underline!important;transition:color 0.2s ease!important}.woocommerce-terms-and-conditions-checkbox-text a:hover{color:#b45309!important}.woocommerce-terms-and-conditions-wrapper abbr.required{color:#ef4444!important;font-weight:bold!important;text-decoration:none!important;margin:0 0 0 4px!important;padding:0!important;display:inline-block!important}</style><?php}}//End custom modern terms checkbox // Injects Custom CSS into the page header for GetCID form overrides add_action('wp_head','d5_installation_page_custom_styles',250);function d5_installation_page_custom_styles(){if (is_page('installation') || is_page('office-installation-id-verification')){?><!-- Typography from Google Fonts --><link rel="preconnect" href="https://fonts.googleapis.com"><link rel="preconnect" href="https://fonts.gstatic.com" crossorigin><link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap" rel="stylesheet"><style type="text/css">:root{--d5-navy-deep:#0f172a;--d5-navy-light:#1e293b;--d5-brand-yellow:#ffcc00;--d5-brand-yellow-hover:#e6b800;--d5-brand-blue:#2e008b;--d5-brand-blue-hover:#453ece;--d5-text-main:#475569;--d5-text-muted:#64748b;--d5-border:#cbd5e1;--d5-border-light:#e2e8f0;--d5-bg-light:#f8fafc;--d5-shadow-sm:0 4px 6px -1px rgba(15, 23, 42, 0.04), 0 2px 4px -2px rgba(15, 23, 42, 0.04);--d5-shadow-md:0 10px 15px -3px rgba(15, 23, 42, 0.06), 0 4px 6px -4px rgba(15, 23, 42, 0.06);--d5-shadow-lg:0 20px 25px -5px rgba(15, 23, 42, 0.08), 0 8px 10px -6px rgba(15, 23, 42, 0.08);--d5-transition:all 0.3s cubic-bezier(0.4, 0, 0.2, 1)}#getcid-form{background:#ffffff!important;border-radius:5px!important;padding:35px!important;box-shadow:var(--d5-shadow-lg)!important;border:1px solid var(--d5-border-light)!important;max-width:800px;width:100%!important;position:relative!important;margin:40px auto 0 auto!important;font-family:'Plus Jakarta Sans',sans-serif;box-sizing:border-box!important}#getcid-form .form-label{font-family:'Outfit',sans-serif!important;font-weight:700!important;font-size:13.5px!important;color:var(--d5-navy-deep)!important;margin-bottom:10px!important;text-transform:uppercase!important;letter-spacing:0.5px!important}#getcid-form .form-control{background-color:var(--d5-bg-light)!important;border:1px solid var(--d5-border)!important;border-radius:5px!important;padding:12px 18px!important;font-size:14.5px!important;color:var(--d5-navy-deep)!important;transition:var(--d5-transition)!important;box-sizing:border-box!important;height:50px!important}#getcid-form .form-control:focus{background-color:#ffffff!important;border-color:var(--d5-brand-yellow)!important;outline:none!important;box-shadow:0 0 0 4px rgb(255 204 0 / .18)!important}#getcid-form #result{background-color:#f1f5f9!important;border:1.5px dashed var(--d5-border)!important;color:var(--d5-brand-blue)!important;font-weight:800!important;font-size:16px!important;letter-spacing:1px!important;text-align:center!important;cursor:text!important;opacity:1!important;font-family:'Outfit',monospace!important}#getcid-form small.text-muted{color:var(--d5-brand-blue)!important;font-weight:700!important;font-size:11.5px!important;margin-top:10px!important;display:block!important;line-height:1.45!important;max-width:100%!important;text-align:center!important}#getcid-form small.text-muted svg{display:inline-block!important;vertical-align:middle!important;margin-right:6px!important;margin-top:-2px!important;color:var(--d5-brand-blue)!important}#getcid-form .input-group.mb-3{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:14px!important;border:2px dashed var(--d5-border)!important;border-radius:5px!important;padding:30px 20px!important;background:var(--d5-bg-light)!important;text-align:center!important;transition:all 0.4s ease-in-out!important;cursor:pointer!important;width:100%!important;box-sizing:border-box!important;margin-bottom:16px!important}#getcid-form .input-group.mb-3:hover{border-color:var(--d5-brand-blue)!important;background:rgb(46 0 139 / .04)!important}#getcid-form #image-name{background:transparent!important;border:none!important;text-align:center!important;font-size:14px!important;font-weight:700!important;color:var(--d5-text-main)!important;pointer-events:none!important;height:auto!important;padding:0!important;width:100%!important;box-shadow:none!important}#getcid-form #upload-image-btn{background:var(--d5-brand-blue)!important;border:none!important;color:#ffffff!important;font-weight:700!important;font-size:13px!important;padding:0 24px!important;padding-top:0!important;padding-bottom:0!important;height:50px!important;border-radius:5px!important;cursor:pointer!important;transition:all 0.4s ease-in-out!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:8px!important;box-shadow:0 4px 10px rgb(46 0 139 / .15)!important;flex:0 0 auto!important;position:relative!important;line-height:1!important}#getcid-form #upload-image-btn:hover{background:var(--d5-brand-blue-hover)!important;box-shadow:0 6px 14px rgb(46 0 139 / .28)!important;transform:translateY(-1.5px)!important;color:#ffffff!important}#getcid-form #upload-image-btn::before,#getcid-form #upload-image-btn::after{content:none!important;display:none!important}#getcid-form button[type="submit"].btn-primary{background:var(--d5-brand-blue)!important;border:none!important;color:#ffffff!important;font-weight:700!important;font-size:14px!important;padding:0 32px!important;padding-top:0!important;padding-bottom:0!important;height:50px!important;border-radius:5px!important;cursor:pointer!important;text-transform:uppercase!important;letter-spacing:0.5px!important;transition:var(--d5-transition)!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 4px 12px rgb(46 0 139 / .18)!important;width:100%!important;margin-bottom:16px!important;box-sizing:border-box!important;line-height:1!important}#getcid-form button[type="submit"].btn-primary:hover{background:var(--d5-brand-blue-hover)!important;box-shadow:0 6px 16px rgb(46 0 139 / .28)!important;transform:translateY(-1px)!important}#getcid-form .mb-3{margin-bottom:16px!important}#getcid-form .mb-3 .input-group{display:flex!important;flex-wrap:nowrap!important;flex-direction:row!important;align-items:center!important;gap:12px!important;margin:0!important;width:100%!important}#getcid-form #result{flex:1 1 auto!important;width:100%!important;border-radius:5px!important;box-sizing:border-box!important;height:50px!important;padding:12px 18px!important}#getcid-form #copy-btn{background:var(--d5-brand-blue)!important;border:none!important;color:#ffffff!important;font-weight:700!important;font-size:13.5px!important;padding:0 24px!important;padding-top:0!important;padding-bottom:0!important;height:50px!important;border-radius:5px!important;cursor:pointer!important;text-transform:uppercase!important;letter-spacing:0.5px!important;transition:var(--d5-transition)!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;box-shadow:0 4px 10px rgb(46 0 139 / .15)!important;flex:0 0 auto!important;box-sizing:border-box!important;white-space:nowrap!important;margin-left:0!important;line-height:1!important}#getcid-form #copy-btn:hover{background:var(--d5-brand-blue-hover)!important;box-shadow:0 6px 16px rgb(46 0 139 / .28)!important;transform:translateY(-1px)!important}#getcid-form.drag-over .input-group.mb-3{border-color:var(--d5-brand-blue)!important;background-color:rgb(46 0 139 / .05)!important}#getcid-form .alert{border-radius:5px!important;padding:14px 18px!important;font-size:13.5px!important;font-weight:600!important;margin-bottom:20px!important;border:none!important;box-shadow:0 4px 10px rgb(0 0 0 / .02)!important}#getcid-form .alert-danger{background-color:#fef2f2!important;color:#b91c1c!important}#getcid-form .alert-success{background-color:#f0fdf4!important;color:#15803d!important}#getcid-form #loading-spinner:not(.d-none){background:rgb(255 255 255 / .65)!important;border-radius:5px!important;backdrop-filter:blur(2px)!important;z-index:10!important;width:100%!important;height:100%!important;top:0!important;left:0!important;transform:none!important;display:flex!important;align-items:center!important;justify-content:center!important}#getcid-form #loading-spinner img{background:transparent!important;background-color:transparent!important;box-shadow:none!important;border:none!important;padding:0!important}@media (max-width:767.98px){#getcid-form{padding:25px!important}}@media (max-width:575.98px){#getcid-form{padding:20px 15px!important}#getcid-form .mb-3 .input-group{flex-direction:column!important;align-items:stretch!important;gap:10px!important}#getcid-form #copy-btn{width:100%!important;margin-left:0!important;padding:0 24px!important}#getcid-form small.text-muted{max-width:100%!important}}.activation-page-layout{display:grid!important;grid-template-columns:1fr 1fr!important;gap:30px!important;max-width:1200px!important;margin:40px auto!important;box-sizing:border-box!important;font-family:'Plus Jakarta Sans',sans-serif!important;align-items:stretch!important}.stepper-card{background:#ffffff!important;border:1px solid var(--d5-border-light)!important;border-radius:5px!important;padding:24px!important;box-shadow:var(--d5-shadow-lg)!important;display:flex!important;flex-direction:column!important;justify-content:space-between!important;box-sizing:border-box!important;position:relative!important;overflow:hidden!important;min-height:520px!important}.form-container-panel{display:flex!important;flex-direction:column!important;justify-content:stretch!important;box-sizing:border-box!important}.form-container-panel #getcid-form{margin:0!important;height:100%!important;box-shadow:var(--d5-shadow-lg)!important;border-radius:5px!important;box-sizing:border-box!important;padding:30px!important}.stepper-header{margin-bottom:12px!important;text-align:left!important}.stepper-progress{display:flex!important;justify-content:space-between!important;align-items:center!important;margin-bottom:8px!important}.stepper-badge{padding:3px 8px!important;border-radius:30px!important;font-size:9.5px!important;font-weight:800!important;letter-spacing:0.5px!important;text-transform:uppercase!important;background:rgb(46 0 139 / .08)!important;color:var(--d5-brand-blue)!important;font-family:'Outfit',sans-serif!important;border:1px solid rgb(46 0 139 / .18)!important;display:inline-flex!important}.stepper-dots{display:flex!important;gap:6px!important}.step-dot{width:7px!important;height:7px!important;border-radius:50%!important;background:#cbd5e1!important;cursor:pointer!important;transition:var(--d5-transition)!important;display:inline-block!important}.step-dot.active{background:var(--d5-brand-blue)!important;transform:scale(1.25)!important}.step-title{font-family:'Outfit',sans-serif!important;font-size:16px!important;font-weight:800!important;color:var(--d5-navy-deep)!important;margin:0!important;line-height:1.3!important}.stepper-body{position:relative!important;flex-grow:1!important;display:flex!important;flex-direction:column!important;justify-content:start!important;margin-bottom:20px!important}.step-content-item{display:none;opacity:0;width:100%!important}.step-content-item.active{display:block!important;opacity:1!important}.step-instructions{list-style:none!important;padding:0!important;margin:0 0 12px 0!important;display:flex!important;flex-direction:column!important;gap:5px!important;text-align:left!important}.step-instructions li{position:relative!important;padding-left:22px!important;font-size:12.5px!important;color:var(--d5-text-main)!important;line-height:1.45!important;font-weight:500!important;margin-bottom:4px!important;display:block!important}.step-instructions li::before{content:"✓"!important;color:#ffffff!important;background:var(--d5-brand-blue)!important;font-weight:900!important;font-size:7px!important;width:13px!important;height:13px!important;border-radius:50%!important;display:flex!important;align-items:center!important;justify-content:center!important;position:absolute!important;left:0!important;top:2px!important}.step-instructions li strong{color:var(--d5-brand-blue)!important;background:rgb(46 0 139 / .08)!important;padding:1px 4px!important;border-radius:4px!important;font-weight:700!important;font-size:12px!important;font-family:'Outfit',sans-serif!important;display:inline-block!important}.window-frame{background:#ffffff!important;border-radius:12px!important;overflow:hidden!important;width:100%!important;border:1px solid var(--d5-border-light)!important;transition:var(--d5-transition)!important;box-shadow:0 4px 15px -2px rgb(15 23 42 / .03)!important;margin-top:auto!important}.window-header{background:#f8fafc!important;padding:8px 12px!important;display:flex!important;align-items:center!important;justify-content:space-between!important;border-bottom:1px solid var(--d5-border-light)!important;user-select:none!important}.window-controls{display:flex!important;gap:5px!important}.control-dot{width:7px!important;height:7px!important;border-radius:50%!important;display:inline-block!important}.control-dot.close{background:#ef4444!important}.control-dot.minimize{background:#eab308!important}.control-dot.maximize{background:#22c55e!important}.window-title{font-size:8.5px!important;color:var(--d5-text-muted)!important;font-weight:750!important;letter-spacing:0.5px!important;text-transform:uppercase!important;font-family:'Outfit',sans-serif!important}.window-body{padding:0!important;position:relative!important;cursor:zoom-in!important;overflow:hidden!important;background:#f8fafc!important;height:280px!important;display:flex!important;align-items:center!important;justify-content:center!important}.step-screenshot{width:100%!important;height:100%!important;object-fit:contain!important;display:block!important;transition:transform 0.5s ease!important}.window-body:hover .step-screenshot{transform:scale(1.03)!important}.stepper-footer{display:flex!important;justify-content:space-between!important;align-items:center!important;gap:16px!important;padding-top:15px!important;border-top:1px solid var(--d5-border-light)!important;margin-top:auto!important}.btn-stepper{border:none!important;font-weight:700!important;font-size:12.5px!important;padding:0 20px!important;height:42px!important;border-radius:10px!important;cursor:pointer!important;text-transform:uppercase!important;letter-spacing:0.5px!important;transition:var(--d5-transition)!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;box-sizing:border-box!important;line-height:1!important;flex:1 1 0%!important}.btn-stepper.btn-prev{background:#f1f5f9!important;color:var(--d5-navy-deep)!important;border:1px solid #cbd5e1!important}.btn-stepper.btn-prev:hover{background:#e2e8f0!important}.btn-stepper.btn-prev:disabled{opacity:0.4!important;cursor:not-allowed!important;background:#f8fafc!important;border-color:#e2e8f0!important;color:#94a3b8!important}.btn-stepper.btn-next{background:var(--d5-brand-blue)!important;color:#ffffff!important;box-shadow:0 4px 12px rgb(46 0 139 / .18)!important}.btn-stepper.btn-next:hover{background:var(--d5-brand-blue-hover)!important;box-shadow:0 6px 16px rgb(46 0 139 / .28)!important;transform:translateY(-1px)!important}.step-lightbox{position:fixed!important;top:0!important;left:0!important;right:0!important;bottom:0!important;background:rgb(15 23 42 / .85)!important;backdrop-filter:blur(16px)!important;-webkit-backdrop-filter:blur(16px)!important;z-index:999999!important;display:flex!important;justify-content:center!important;align-items:center!important;opacity:0!important;pointer-events:none!important;transition:opacity 0.35s ease!important;padding:24px!important;box-sizing:border-box!important}.step-lightbox.active{opacity:1!important;pointer-events:all!important}.lightbox-container{position:relative!important;max-width:90%!important;max-height:90vh!important;transform:scale(.95)!important;transition:transform 0.35s cubic-bezier(.34,1.56,.64,1)!important;display:flex!important;flex-direction:column!important;align-items:center!important;box-sizing:border-box!important}.step-lightbox.active .lightbox-container{transform:scale(1)!important}.lightbox-img{max-width:100%!important;max-height:80vh!important;border-radius:20px!important;box-shadow:0 25px 60px -15px rgb(0 0 0 / .6)!important;border:2px solid rgb(255 255 255 / .2)!important;display:block!important;background:#000000!important}.lightbox-close{position:absolute!important;top:-45px!important;right:0!important;background:rgb(255 255 255 / .18)!important;border:none!important;color:#ffffff!important;width:36px!important;height:36px!important;border-radius:50%!important;cursor:pointer!important;display:flex!important;justify-content:center!important;align-items:center!important;font-size:20px!important;transition:var(--d5-transition)!important;padding:0!important;line-height:1!important}.lightbox-close:hover{background:#ef4444!important;color:#ffffff!important;transform:rotate(90deg)!important}.lightbox-caption{color:#ffffff!important;text-align:center!important;margin-top:15px!important;font-size:15px!important;font-weight:600!important;font-family:'Outfit',sans-serif!important}@media (max-width:991px){html,body,#wrapper-container{overflow-x:hidden!important;width:100%!important;max-width:100%!important}#main-container{padding-left:15px!important;padding-right:15px!important;margin:0 auto!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important}#tbay-main-content,#main-content,#main,.elementor,.elementor-16640,.elementor .elementor-section,.elementor .elementor-container,.elementor .elementor-column,.elementor-element-populated,.elementor .elementor-widget-wrap,.elementor .elementor-widget-container,.elementor-element-fea1e58,.elementor-element-fea1e58 .elementor-container,.elementor-element-3d4c161,.elementor-element-3d4c161>.elementor-widget-wrap,.elementor-element-47e7fb9,.elementor-element-47e7fb9>.elementor-widget-container,.elementor-widget,.elementor-widget-container{padding:0!important;margin:0!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important;float:none!important}.activation-page-layout{grid-template-columns:1fr!important;gap:24px!important;padding:0!important;margin:20px auto!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important}.stepper-card{min-height:auto!important;padding:20px!important;width:100%!important;max-width:100%!important;box-sizing:border-box!important}.form-container-panel{width:100%!important;max-width:100%!important;box-sizing:border-box!important}#getcid-form,.form-container-panel #getcid-form{width:100%!important;max-width:100%!important;box-sizing:border-box!important;padding:24px 20px!important;margin:0!important}#getcid-form .form-control,#getcid-form input,#getcid-form select,#getcid-form textarea,#getcid-form #upload-image-btn,#getcid-form #copy-btn{width:100%!important;max-width:100%!important;box-sizing:border-box!important}.window-body{height:220px!important}}@media (max-width:575.98px){#main-container{padding-left:12px!important;padding-right:12px!important}.activation-page-layout{padding:0!important;margin:15px auto!important}.stepper-card{padding:16px!important}#getcid-form,.form-container-panel #getcid-form{padding:20px 15px!important}.window-body{height:160px!important}.step-instructions li{font-size:12px!important;padding-left:20px!important}}</style><?php}}// Injects Custom JavaScript logic into page footer for GetCID overrides add_action('wp_footer','d5_installation_page_custom_js',250);function d5_installation_page_custom_js(){if (is_page('installation') || is_page('office-installation-id-verification')){?><script type="text/javascript">(function($){$(document).ready(function(){// Replace markdown bold (**) with HTML strong tags dynamically in instructions and titles $('.step-instructions li, .step-title').each(function(){var html=$(this).html();if (html && html.indexOf('**') !==-1){var newHtml=html.replace(/\*\*(.*?)\*\*/g,'<strong>$1</strong>');$(this).html(newHtml)}});var tempcode=$('#tempcode');var iid=$('#iid');var resultField=$('#result');var uploadBtn=$('#upload-image-btn');var textHint=$('small.text-muted');var uploadBox=$('#image-name').closest('.input-group.mb-3');var spinner=$('#loading-spinner');if (tempcode.length) tempcode.attr('placeholder','e.g. 39274-6J7D6-G7TV...');if (iid.length) iid.attr('placeholder','e.g. 3563074-0805953-5867605...');// Change result field from disabled to readonly to allow cursor selection and copying if (resultField.length){resultField.removeAttr('disabled').attr('readonly',true)}// Replace loading spinner image/HTML dynamically to use custom gif if (spinner.length){spinner.html('<img src="https://d5digital.net/media/2025/08/loading-d5-woocommerce.gif" alt="Loading..." style="width: 70px; height: 70px;">')}// Overwrite upload button text explicitly to solve double rendering text overlap from third-party files if (uploadBtn.length){uploadBtn.html('<i class="bi-image"></i> Upload Screenshot')}// Move and style the small helper text inside the drag-and-drop zone with an info icon SVG if (textHint.length && uploadBox.length){var infoIconSvg='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"></circle><line x1="12" y1="16" x2="12" y2="12"></line><line x1="12" y1="8" x2="12.01" y2="8"></line></svg>';textHint.html(infoIconSvg+'You can also drag and drop an image, or you can skip this step instead of entering the Installation ID.');uploadBox.append(textHint)}// Formatter for Installation ID (grouping 6/7 digits with hyphens) function formatIID(str){var clean=String(str || '').replace(/\D+/g,'');if (!clean) return '';var blockSize=(clean.length>54) ? 7:6;var regex=new RegExp('(.{'+blockSize+'})','g');return clean.replace(regex,'$1-').replace(/-$/,'')}// Formatter for Confirmation ID (blocks of 6 digits) function formatCID(str){var clean=String(str || '').replace(/\D+/g,'');if (!clean) return '';return clean.replace(/(.{6})/g,'$1-').replace(/-$/,'')}// On input/paste into Installation ID field iid.on('input propertychange',function(){var val=$(this).val();var cursorPosition=this.selectionStart;var originalLength=val.length;var formatted=formatIID(val);$(this).val(formatted);var newLength=formatted.length;if (this.setSelectionRange){this.setSelectionRange(cursorPosition+(newLength - originalLength),cursorPosition+(newLength - originalLength))}});// Setup loading display on submit click var originalSubmit=$('button[type="submit"].btn-primary');var imageInput=$('#image-input');var imageNameInput=$('#image-name');var getCidForm=$('#getcid-form');function showLoadingIndicator(){if (resultField.length){resultField.val('Loading...')}}// Prevent propagation of click on the hidden file input itself to avoid recursive bubbling loops if (imageInput.length){imageInput.on('click',function(e){e.stopPropagation()})}// Make the entire dashed upload box clickable to open file dialog var uploadBox=imageNameInput.closest('.input-group.mb-3');if (uploadBox.length){uploadBox.on('click',function(e){// Only trigger if we didn't directly click the button or the file input itself
                            if ($(e.target).is('#image-input') || $(e.target).closest('#upload-image-btn').length) {
                                  return;
                            }
                            imageInput.click();
                        });
                    }

                    // Change original submit text to Confirm and ensure it's visible & responsive if (originalSubmit.length){originalSubmit.text('Confirm')}// Enhance Copy button click to show "Copied!" feedback var copyBtn=$('#copy-btn');if (copyBtn.length){copyBtn.on('click',function(){var $btn=$(this);var originalText=$btn.text();if (originalText !=='Copied!'){$btn.text('Copied!');setTimeout(function(){$btn.text(originalText)},2000)}})}// AJAX Interceptor to format CID result and restore IID formatting $(document).ajaxSuccess(function(event,xhr,settings){if (!settings || !settings.url || settings.url.indexOf('admin-ajax.php')===-1) return;var json=null;if (xhr && xhr.responseJSON){json=xhr.responseJSON}else{try{json=JSON.parse(xhr.responseText)}catch(e){json=null}}if (!json) return;if (json.success===true && json.data){var rawCid=(typeof json.data==='string') ? json.data :(json.data.cid || '');if (rawCid){// Only format with hyphens if the CID is a valid numeric sequence if (/^[\d\s-]+$/.test(rawCid)){resultField.val(formatCID(rawCid))}else{// It's a text error message (like "Invalid Installation ID." from DB success callback bug)
                                    resultField.val(rawCid);
                                    // Display the error text in the styled error alert box
                                    var errorAlert = $('#error-alert');
                                    if (errorAlert.length) {
                                        errorAlert.text(rawCid).removeClass('d-none');
                                    }
                                }
                            }
                            var rawIid = (typeof json.data === 'object' && json.data.iid) ? json.data.iid : '';
                            if (rawIid) {
                                iid.val(formatIID(rawIid));
                            }
                            return;
                        }

                        if (typeof json === 'string' && json.trim().length > 6) {
                            if (/^[\d\s-]+$/.test(json)) {
                                resultField.val(formatCID(json));
                            } else {
                                resultField.val(json);
                                var errorAlert = $('#error-alert');
                                if (errorAlert.length) {
                                    errorAlert.text(json).removeClass('d-none');
                                }
                            }
                            return;
                        }
                    });

                });
            })(jQuery);
        </script>
        <?php
    }
}

// =========================================================================
// GETCID PLUGIN AJAX HANDLER OVERRIDES (UPDATE-SAFE CORE BUG FIXES)
// =========================================================================
add_action( 'wp_loaded', 'd5_override_getcid_ajax_handlers', 999 );
function d5_override_getcid_ajax_handlers() {
    remove_action( 'wp_ajax_get_cid_action', 'handle_getcid_request' );
    remove_action( 'wp_ajax_nopriv_get_cid_action', 'handle_getcid_request' );
    
    add_action( 'wp_ajax_get_cid_action', 'd5_custom_handle_getcid_request' );
    add_action( 'wp_ajax_nopriv_get_cid_action', 'd5_custom_handle_getcid_request' );
}

function d5_custom_handle_getcid_request() {
    global $wpdb;
    $error_key_blocked_msg = get_option('error_key_blocked_msg', 'KEY BLOCKED! Use another key.');
    $error_tempcode_with_no_attempts_left_msg = get_option('error_tempcode_with_no_attempts_left_msg', 'There are no attempts left for this tempcode.');
    $error_tempcode_invalid_msg = get_option('error_tempcode_invalid_msg', 'Invalid tempcode.');
    $error_iid_invalid_msg = get_option('error_iid_invalid_msg', 'Invalid IID.');

    if (!isset($_POST['get_cid_nonce_field']) || !wp_verify_nonce($_POST['get_cid_nonce_field'], 'get_cid_nonce')) {
        wp_send_json_error('Nonce verification failed.');
    }

    $tempcode = trim(sanitize_text_field($_POST['tempcode']));
    $iid = preg_replace('/\D/', '', trim(sanitize_text_field($_POST['iid'])));
    $fromimage = false;

    if (!empty($_FILES['image']['tmp_name'])) {
        $image_content = file_get_contents($_FILES['image']['tmp_name']);
        $base64_image = base64_encode($image_content);
        $lang = get_option('getcid_language', 'en');
        $swa_api = "https://kn93ls2wqg.execute-api.us-east-1.amazonaws.com/default/getcid-image-to-iid?lang={$lang}";
        
        $response = wp_remote_post($swa_api, [
            'headers' => [
                'Content-Type' => 'text/plain',
                'Authorization' => 'WpToken ' . get_option('getcid_token')
            ],
            'body' => $base64_image,
            'timeout' => 30,
        ]);

        if (is_wp_error($response)) {
            wp_send_json_error('Image processing failed:' . $response->get_error_message());
        }

        $body = wp_remote_retrieve_body($response);
        $data = json_decode($body, true);

        if (isset($data['error_code'])) {
            if ($data['error_code'] === 'cant_process_image') {
                wp_send_json_error(get_getcid_text('cant_process_image'));
            } elseif ($data['error_code'] === 'invalid_image') {
                wp_send_json_error(get_getcid_text('invalid_image'));
            } elseif ($data['error_code'] === 'without_credit') {
                wp_send_json_error(get_getcid_text('without_credit'));
            } elseif ($data['error_code'] === 'many_failed_errors') {
                wp_send_json_error(get_getcid_text('many_failed_errors'));
            } else {
                wp_send_json_error(esc_html($data['error_code']));
            }
        } elseif (isset($data['iid'])) {
            $iid = sanitize_text_field($data['iid']);
            if (strlen($iid) < 40) {
                wp_send_json_error(esc_html($iid));
            }
        } else {
            $error_message = isset($data['detail']) ? $data['detail'] : 'Failed to extract IID from the image. API response:' . esc_html($body);
            wp_send_json_error($error_message);
        }
        $fromimage = true;
    }

    if (strlen($iid) !== 63 && strlen($iid) !== 54) {
        wp_send_json_error($error_iid_invalid_msg);
    }

    $table_name = $wpdb->prefix . 'getcid_tempcode';
    $tempcode_entry = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $table_name WHERE tempcode = %s", $tempcode) );
    if (!$tempcode_entry) {
        wp_send_json_error($error_tempcode_invalid_msg);
    }

    $log_table = $wpdb->prefix . 'getcid_log';
    $log_entry = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $log_table WHERE tempcode = %s AND iid = %s", $tempcode, $iid) );
    $retry = false;

    if ($log_entry) {
        // Accepts both raw 48-digit CIDs and formatted 55-character CIDs from database logs
        if (preg_match('/^[0-9\-]{48,55}$/', $log_entry->cid)) {
            wp_send_json_success([
                'iid' => esc_html($iid),
                'cid' => esc_html($log_entry->cid)
            ]);
        // Case-insensitive search supporting both word orders (Blocked Key vs Key Blocked)
        } else if (stripos($log_entry->cid, 'key blocked') !== false || stripos($log_entry->cid, 'blocked key') !== false) {
            wp_send_json_error($error_key_blocked_msg);
        // Supports both "invalid iid" and "invalid installation id" options
        } else if (stripos($log_entry->cid, 'invalid iid') !== false || stripos($log_entry->cid, 'invalid installation id') !== false) {
            wp_send_json_error($error_iid_invalid_msg);
        } else {
            $retry = true;
        }
    } else {
        if ($tempcode_entry->attempts <= 0) {
            wp_send_json_error($error_tempcode_with_no_attempts_left_msg);
        }
    }

    if (!$fromimage) {
        $token = get_option('getcid_token');
        $lang = get_option('getcid_language', 'en');
        $url = "https://bs.getcid.xyz/webapi/get-cid/?wp_token={$token}&iid={$iid}&from_image={$fromimage}&lang={$lang}";
        
        $response = wp_remote_get($url, array(
            'timeout' => 10,
        ));
        
        if (is_wp_error($response)) {
            wp_send_json_error("Connection error: " . $response->get_error_message());
        }
        
        $body = wp_remote_retrieve_body($response);
        $data = json_decode($body, true);
    }

    if (isset($data['cid'])) {
        $cid = $data['cid'];
    } elseif (isset($data['errorDetail'])) {
        $cid = $data['errorDetail'];
    } elseif (isset($data['detail'])) {
        wp_send_json_error("Error getting CID: " . esc_html($data['detail']));
    } elseif (isset($data['message'])) {
        wp_send_json_error(esc_html($data['message']));
    } elseif (isset($data['without_credit'])) {
        wp_send_json_error(get_getcid_text('without_credit'));
    } else {
        wp_send_json_error("Error getting CID. API response: " . esc_html($body));
    }

    if ($retry) {
        $wpdb->update(
            $log_table,
            ['cid' => $cid, 'updated_at' => current_time('mysql')],
            ['tempcode' => $tempcode, 'iid' => $iid]
        );
        wp_send_json_success([
            'iid' => esc_html($iid),
            'cid' => esc_html($cid)
        ]);
    } else {
        $wpdb->insert($log_table, [
            'tempcode' => $tempcode,
            'iid' => $iid,
            'cid' => $cid,
            'created_at' => current_time('mysql'),
            'updated_at' => current_time('mysql')
        ]);
        if (stripos($cid, 'key blocked') !== false || stripos($cid, 'blocked key') !== false) {
            wp_send_json_error($error_key_blocked_msg);
        } elseif (stripos($cid, 'invalid iid') !== false || stripos($cid, 'invalid installation id') !== false) {
            wp_send_json_error($error_iid_invalid_msg);
        } else {
            $wpdb->update(
                $table_name,
                ['attempts' => $tempcode_entry->attempts - 1],
                ['tempcode' => $tempcode]
            );
            wp_send_json_success([
                'iid' => esc_html($iid),
                'cid'=>esc_html($cid)])}}}// GETCID DESIGN - END //=========Custom PHP END==========