8 |
8 |
9 /** WordPress Administration Bootstrap */ |
9 /** WordPress Administration Bootstrap */ |
10 require_once __DIR__ . '/admin.php'; |
10 require_once __DIR__ . '/admin.php'; |
11 |
11 |
12 if ( ! current_user_can( 'manage_privacy_options' ) ) { |
12 if ( ! current_user_can( 'manage_privacy_options' ) ) { |
13 wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) ); |
13 wp_die( __( 'Sorry, you are not allowed to manage privacy options on this site.' ) ); |
14 } |
14 } |
|
15 |
|
16 if ( isset( $_GET['tab'] ) && 'policyguide' === $_GET['tab'] ) { |
|
17 require_once dirname( __FILE__ ) . '/privacy-policy-guide.php'; |
|
18 return; |
|
19 } |
|
20 |
|
21 add_filter( |
|
22 'admin_body_class', |
|
23 function( $body_class ) { |
|
24 $body_class .= ' privacy-settings '; |
|
25 |
|
26 return $body_class; |
|
27 } |
|
28 ); |
15 |
29 |
16 $action = isset( $_POST['action'] ) ? $_POST['action'] : ''; |
30 $action = isset( $_POST['action'] ) ? $_POST['action'] : ''; |
17 |
31 |
18 if ( ! empty( $action ) ) { |
32 if ( ! empty( $action ) ) { |
19 check_admin_referer( $action ); |
33 check_admin_referer( $action ); |
110 $privacy_policy_page_exists = true; |
124 $privacy_policy_page_exists = true; |
111 } |
125 } |
112 } |
126 } |
113 } |
127 } |
114 |
128 |
115 $title = __( 'Privacy Settings' ); |
|
116 $parent_file = 'options-general.php'; |
129 $parent_file = 'options-general.php'; |
117 |
130 |
|
131 wp_enqueue_script( 'privacy-tools' ); |
|
132 |
118 require_once ABSPATH . 'wp-admin/admin-header.php'; |
133 require_once ABSPATH . 'wp-admin/admin-header.php'; |
119 |
134 |
120 ?> |
135 ?> |
121 <div class="wrap"> |
136 <div class="privacy-settings-header"> |
122 <h1><?php echo $title; ?></h1> |
137 <div class="privacy-settings-title-section"> |
123 <h2><?php _e( 'Privacy Policy Page' ); ?></h2> |
138 <h1> |
|
139 <?php _e( 'Privacy' ); ?> |
|
140 </h1> |
|
141 </div> |
|
142 |
|
143 <nav class="privacy-settings-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>"> |
|
144 <a href="<?php echo esc_url( admin_url( 'options-privacy.php' ) ); ?>" class="privacy-settings-tab active" aria-current="true"> |
|
145 <?php |
|
146 /* translators: Tab heading for Site Health Status page. */ |
|
147 _ex( 'Settings', 'Privacy Settings' ); |
|
148 ?> |
|
149 </a> |
|
150 |
|
151 <a href="<?php echo esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ); ?>" class="privacy-settings-tab"> |
|
152 <?php |
|
153 /* translators: Tab heading for Site Health Status page. */ |
|
154 _ex( 'Policy Guide', 'Privacy Settings' ); |
|
155 ?> |
|
156 </a> |
|
157 </nav> |
|
158 </div> |
|
159 |
|
160 <hr class="wp-header-end"> |
|
161 |
|
162 <div class="notice notice-error hide-if-js"> |
|
163 <p><?php _e( 'The Privacy Settings require JavaScript.' ); ?></p> |
|
164 </div> |
|
165 |
|
166 <div class="privacy-settings-body hide-if-no-js"> |
|
167 <h2><?php _e( 'Privacy Settings' ); ?></h2> |
124 <p> |
168 <p> |
125 <?php _e( 'As a website owner, you may need to follow national or international privacy laws. For example, you may need to create and display a Privacy Policy.' ); ?> |
169 <?php _e( 'As a website owner, you may need to follow national or international privacy laws. For example, you may need to create and display a Privacy Policy.' ); ?> |
126 <?php _e( 'If you already have a Privacy Policy page, please select it below. If not, please create one.' ); ?> |
170 <?php _e( 'If you already have a Privacy Policy page, please select it below. If not, please create one.' ); ?> |
127 </p> |
171 </p> |
128 <p> |
172 <p> |
131 </p> |
175 </p> |
132 <p> |
176 <p> |
133 <?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?> |
177 <?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?> |
134 <?php _e( 'We would also suggest reviewing your Privacy Policy from time to time, especially after installing or updating any themes or plugins. There may be changes or new suggested information for you to consider adding to your policy.' ); ?> |
178 <?php _e( 'We would also suggest reviewing your Privacy Policy from time to time, especially after installing or updating any themes or plugins. There may be changes or new suggested information for you to consider adding to your policy.' ); ?> |
135 </p> |
179 </p> |
136 <?php |
180 <p> |
137 |
181 <?php |
138 if ( $privacy_policy_page_exists ) { |
182 if ( $privacy_policy_page_exists ) { |
139 $edit_href = add_query_arg( |
183 $edit_href = add_query_arg( |
140 array( |
184 array( |
141 'post' => $privacy_policy_page_id, |
185 'post' => $privacy_policy_page_id, |
142 'action' => 'edit', |
186 'action' => 'edit', |
143 ), |
187 ), |
144 admin_url( 'post.php' ) |
188 admin_url( 'post.php' ) |
145 ); |
189 ); |
146 |
190 $view_href = get_permalink( $privacy_policy_page_id ); |
147 $view_href = get_permalink( $privacy_policy_page_id ); |
191 ?> |
148 ?> |
192 <strong> |
149 <p class="tools-privacy-edit"><strong> |
193 <?php |
|
194 if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) { |
|
195 printf( |
|
196 /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */ |
|
197 __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ), |
|
198 esc_url( $edit_href ), |
|
199 esc_url( $view_href ) |
|
200 ); |
|
201 } else { |
|
202 printf( |
|
203 /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */ |
|
204 __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ), |
|
205 esc_url( $edit_href ), |
|
206 esc_url( $view_href ) |
|
207 ); |
|
208 } |
|
209 ?> |
|
210 </strong> |
150 <?php |
211 <?php |
151 if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) { |
212 } |
152 printf( |
|
153 /* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */ |
|
154 __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ), |
|
155 esc_url( $edit_href ), |
|
156 esc_url( $view_href ) |
|
157 ); |
|
158 } else { |
|
159 printf( |
|
160 /* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */ |
|
161 __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ), |
|
162 esc_url( $edit_href ), |
|
163 esc_url( $view_href ) |
|
164 ); |
|
165 } |
|
166 ?> |
|
167 </strong></p> |
|
168 <?php |
|
169 } |
|
170 ?> |
|
171 <p> |
|
172 <?php |
|
173 printf( |
213 printf( |
174 /* translators: 1: Privacy Policy guide URL, 2: Additional link attributes, 3: Accessibility text. */ |
214 /* translators: 1: Privacy Policy guide URL, 2: Additional link attributes, 3: Accessibility text. */ |
175 __( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ), |
215 __( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our Privacy Policy guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ), |
176 esc_url( admin_url( 'privacy-policy-guide.php' ) ), |
216 esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ), |
177 '', |
217 '', |
178 '' |
218 '' |
179 ); |
219 ); |
180 ?> |
220 ?> |
181 </p> |
221 </p> |
182 |
|
183 <hr> |
222 <hr> |
|
223 <?php |
|
224 $has_pages = (bool) get_posts( |
|
225 array( |
|
226 'post_type' => 'page', |
|
227 'posts_per_page' => 1, |
|
228 'post_status' => array( |
|
229 'publish', |
|
230 'draft', |
|
231 ), |
|
232 ) |
|
233 ); |
|
234 ?> |
184 <table class="form-table tools-privacy-policy-page" role="presentation"> |
235 <table class="form-table tools-privacy-policy-page" role="presentation"> |
|
236 <tr> |
|
237 <th scope="row"> |
|
238 <label for="create-page"> |
|
239 <?php |
|
240 if ( $has_pages ) { |
|
241 _e( 'Create a new Privacy Policy Page' ); |
|
242 } else { |
|
243 _e( 'There are no pages.' ); |
|
244 } |
|
245 ?> |
|
246 </label> |
|
247 </th> |
|
248 <td> |
|
249 <form class="wp-create-privacy-page" method="post" action=""> |
|
250 <input type="hidden" name="action" value="create-privacy-page" /> |
|
251 <?php |
|
252 wp_nonce_field( 'create-privacy-page' ); |
|
253 submit_button( __( 'Create' ), 'secondary', 'submit', false, array( 'id' => 'create-page' ) ); |
|
254 ?> |
|
255 </form> |
|
256 </td> |
|
257 </tr> |
|
258 <?php if ( $has_pages ) : ?> |
185 <tr> |
259 <tr> |
186 <th scope="row"> |
260 <th scope="row"> |
187 <label for="page_for_privacy_policy"> |
261 <label for="page_for_privacy_policy"> |
188 <?php |
262 <?php |
189 if ( $privacy_policy_page_exists ) { |
263 if ( $privacy_policy_page_exists ) { |
193 } |
267 } |
194 ?> |
268 ?> |
195 </label> |
269 </label> |
196 </th> |
270 </th> |
197 <td> |
271 <td> |
198 <?php |
272 <form method="post" action=""> |
199 $has_pages = (bool) get_posts( |
273 <input type="hidden" name="action" value="set-privacy-page" /> |
200 array( |
|
201 'post_type' => 'page', |
|
202 'posts_per_page' => 1, |
|
203 'post_status' => array( |
|
204 'publish', |
|
205 'draft', |
|
206 ), |
|
207 ) |
|
208 ); |
|
209 |
|
210 if ( $has_pages ) : |
|
211 ?> |
|
212 <form method="post" action=""> |
|
213 <input type="hidden" name="action" value="set-privacy-page" /> |
|
214 <?php |
|
215 wp_dropdown_pages( |
|
216 array( |
|
217 'name' => 'page_for_privacy_policy', |
|
218 'show_option_none' => __( '— Select —' ), |
|
219 'option_none_value' => '0', |
|
220 'selected' => $privacy_policy_page_id, |
|
221 'post_status' => array( 'draft', 'publish' ), |
|
222 ) |
|
223 ); |
|
224 |
|
225 wp_nonce_field( 'set-privacy-page' ); |
|
226 |
|
227 submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) ); |
|
228 ?> |
|
229 </form> |
|
230 <?php endif; ?> |
|
231 |
|
232 <form class="wp-create-privacy-page" method="post" action=""> |
|
233 <input type="hidden" name="action" value="create-privacy-page" /> |
|
234 <span> |
|
235 <?php |
|
236 if ( $has_pages ) { |
|
237 _e( 'Or:' ); |
|
238 } else { |
|
239 _e( 'There are no pages.' ); |
|
240 } |
|
241 ?> |
|
242 </span> |
|
243 <?php |
274 <?php |
244 wp_nonce_field( 'create-privacy-page' ); |
275 wp_dropdown_pages( |
245 |
276 array( |
246 submit_button( __( 'Create New Page' ), 'primary', 'submit', false, array( 'id' => 'create-page' ) ); |
277 'name' => 'page_for_privacy_policy', |
|
278 'show_option_none' => __( '— Select —' ), |
|
279 'option_none_value' => '0', |
|
280 'selected' => $privacy_policy_page_id, |
|
281 'post_status' => array( 'draft', 'publish' ), |
|
282 ) |
|
283 ); |
|
284 |
|
285 wp_nonce_field( 'set-privacy-page' ); |
|
286 |
|
287 submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) ); |
247 ?> |
288 ?> |
248 </form> |
289 </form> |
249 </td> |
290 </td> |
250 </tr> |
291 </tr> |
|
292 <?php endif; ?> |
251 </table> |
293 </table> |
252 </div> |
294 </div> |
253 <?php |
295 <?php |
254 |
296 |
255 require_once ABSPATH . 'wp-admin/admin-footer.php'; |
297 require_once ABSPATH . 'wp-admin/admin-footer.php'; |