1 | <?php |
||
24 | class PrivacyPolicyManager |
||
25 | { |
||
26 | |||
27 | public function __construct() |
||
31 | |||
32 | |||
33 | /** |
||
34 | * For all the registered `PrivacyPolicyInterface`s, add their privacy policy content |
||
35 | * |
||
36 | * @param WP_Screen $screen |
||
37 | * @throws InvalidClassException |
||
38 | * @throws InvalidDataTypeException |
||
39 | * @throws InvalidEntityException |
||
40 | * @throws InvalidFilePathException |
||
41 | * @throws InvalidIdentifierException |
||
42 | * @throws InvalidInterfaceException |
||
43 | */ |
||
44 | public function addPrivacyPolicy(WP_Screen $screen) |
||
45 | { |
||
46 | if ($screen instanceof WP_Screen |
||
|
|||
47 | && $screen->id === 'tools' |
||
48 | && isset($_GET['wp-privacy-policy-guide'])) { |
||
49 | // load all the privacy policy stuff |
||
50 | // add post policy text |
||
51 | foreach ($this->loadPrivacyPolicyCollection() as $privacy_policy) { |
||
52 | wp_add_privacy_policy_content($privacy_policy->getName(), $privacy_policy->getContent()); |
||
53 | } |
||
54 | } |
||
55 | } |
||
56 | |||
57 | |||
58 | /** |
||
59 | * @return CollectionInterface|PrivacyPolicyInterface[] |
||
60 | * @throws InvalidIdentifierException |
||
61 | * @throws InvalidInterfaceException |
||
62 | * @throws InvalidFilePathException |
||
63 | * @throws InvalidEntityException |
||
64 | * @throws InvalidDataTypeException |
||
65 | * @throws InvalidClassException |
||
66 | */ |
||
67 | protected function loadPrivacyPolicyCollection() |
||
91 | } |
||
92 | // End of file PrivacyPolicyManager.php |
||
94 |