| 1 |
<?php |
| 2 |
|
| 3 |
namespace Codelight\GDPR\Components\PrivacyPolicy; |
| 4 |
|
| 5 |
class PolicyGenerator |
| 6 |
{ |
| 7 |
public function generate() |
| 8 |
{ |
| 9 |
return gdpr('view')->render( |
| 10 |
'policy/policy', |
| 11 |
$this->getData() |
| 12 |
); |
| 13 |
} |
| 14 |
|
| 15 |
public function getData() |
| 16 |
{ |
| 17 |
global $gdpr; |
| 18 |
$location = $gdpr->Options->get('company_location'); |
| 19 |
$date = date(get_option('date_format')); |
| 20 |
|
| 21 |
return [ |
| 22 |
'companyName' => $gdpr->Options->get('company_name'), |
| 23 |
'companyLocation' => $location, |
| 24 |
'contactEmail' => $gdpr->Options->get('contact_email') ? |
| 25 |
$gdpr->Options->get('contact_email') : |
| 26 |
get_option('admin_email'), |
| 27 |
|
| 28 |
'hasRepresentative' => gdpr('helpers')->countryNeedsRepresentative($location), |
| 29 |
'representativeContactName' => $gdpr->Options->get('representative_contact_name'), |
| 30 |
'representativeContactEmail' => $gdpr->Options->get('representative_contact_email'), |
| 31 |
'representativeContactPhone' => $gdpr->Options->get('representative_contact_phone'), |
| 32 |
|
| 33 |
'dpaWebsite' => $gdpr->Options->get('dpa_website'), |
| 34 |
'dpaEmail' => $gdpr->Options->get('dpa_email'), |
| 35 |
'dpaPhone' => $gdpr->Options->get('dpa_phone'), |
| 36 |
|
| 37 |
'hasDpo' => $gdpr->Options->get('has_dpo'), |
| 38 |
'dpoName' => $gdpr->Options->get('dpo_name'), |
| 39 |
'dpoEmail' => $gdpr->Options->get('dpo_email'), |
| 40 |
|
| 41 |
'hasTerms' => $gdpr->Options->get('terms_page'), |
| 42 |
|
| 43 |
'date' => $date, |
| 44 |
]; |
| 45 |
} |
| 46 |
} |