1 | <?php |
||
18 | class Terms_Of_Service { |
||
19 | /** |
||
20 | * Jetpack option name where the terms of service state is stored. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | const OPTION_NAME = 'tos_agreed'; |
||
25 | |||
26 | /** |
||
27 | * Allow the site to agree to the terms of service. |
||
28 | */ |
||
29 | public function agree() { |
||
38 | |||
39 | /** |
||
40 | * Allow the site to reject to the terms of service. |
||
41 | */ |
||
42 | public function reject() { |
||
51 | |||
52 | /** |
||
53 | * Returns whether the master user has agreed to the terms of service. |
||
54 | * |
||
55 | * The following conditions have to be met in order to agree to the terms of service. |
||
56 | * 1. The master user has gone though the connect flow. |
||
57 | * 2. The site is not in dev mode. |
||
58 | * 3. The master user of the site is still connected. |
||
59 | * |
||
60 | * @return bool |
||
61 | */ |
||
62 | public function has_agreed() { |
||
69 | |||
70 | /** |
||
71 | * Abstracted for testing purposes. |
||
72 | * Tells us if the site is in dev mode. |
||
73 | * |
||
74 | * @return bool |
||
75 | */ |
||
76 | protected function is_offline_mode() { |
||
77 | return ( new Status() )->is_offline_mode(); |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Tells us if the site is connected. |
||
82 | * Abstracted for testing purposes. |
||
83 | * |
||
84 | * @return bool |
||
85 | */ |
||
86 | protected function is_active() { |
||
89 | |||
90 | /** |
||
91 | * Gets just the Jetpack Option that contains the terms of service state. |
||
92 | * Abstracted for testing purposes. |
||
93 | * |
||
94 | * @return bool |
||
95 | */ |
||
96 | protected function get_raw_has_agreed() { |
||
99 | |||
100 | /** |
||
101 | * Sets the correct Jetpack Option to mark the that the site has agreed to the terms of service. |
||
102 | * Abstracted for testing purposes. |
||
103 | */ |
||
104 | protected function set_agree() { |
||
107 | |||
108 | /** |
||
109 | * Sets the correct Jetpack Option to mark that the site has rejected the terms of service. |
||
110 | * Abstracted for testing purposes. |
||
111 | */ |
||
112 | protected function set_reject() { |
||
115 | |||
116 | } |
||
117 |