RegisterPrivate('load_variations','LoadVariations'); $this->RegisterPrivate('send_test_email','SendTestEmail'); $this->RegisterPrivate('activate_license','ActivateLicense'); $this->RegisterPrivate('deactivate_license','DeactivateLicense'); } public function ActivateLicense(){ $licenseKey=$this->GetRequired('LicenseKey'); $expirationDate=$this->GetRequired('ExpirationDate'); $url=$this->GetRequired('URL'); (new Activator())->SaveLicense($this->Loader,$licenseKey,$expirationDate,$url); $this->SendSuccessMessage(''); } public function DeactivateLicense(){ Activator::DeleteLicense($this->Loader); $this->SendSuccessMessage(''); } public function LoadVariations(){ $productId=$this->GetRequired('ProductId'); $productNonce=$this->GetRequired('ProductNonce'); if(!\wp_verify_nonce($productNonce,$productId.'_product_designer')) $this->SendErrorMessage(__('Invalid request','additional-product-fields-for-woocommerce')); $this->SendSuccessMessage((new ProductRepository())->GetVariations($productId)); } public function SendTestEmail(){ $model=$this->GetRequired('Model'); $email=$this->GetRequired('Email'); $formBuilder=new FormBuilder($this->Loader,$model,new FakeEntry($model),new FakePrice()); $formBuilder->Initialize(); $emailManager=new TestEmailManager(); $emailManager->Initialize($formBuilder,$email); if($emailManager->Send()) { $this->SendSuccessMessage(__('Email sent successfully','additional-product-fields-for-woocommerce')); }else{ $error=__('An error occurred while trying to send the email.','additional-product-fields-for-woocommerce'); if($emailManager->Error!='') { $error.=__(' Additional detail:','additional-product-fields-for-woocommerce').$emailManager->Error; } $this->SendErrorMessage($error); } } }