diff --git a/src/wp-admin/includes/privacy-tools.php b/src/wp-admin/includes/privacy-tools.php
index efe46cce32..9eb095b844 100644
a
|
b
|
function _wp_personal_data_cleanup_requests() { |
234 | 234 | * @return string The HTML for this group and its items. |
235 | 235 | */ |
236 | 236 | function wp_privacy_generate_personal_data_export_group_html( $group_data ) { |
237 | | $group_html = '<h2>'; |
| 237 | $group_html = '<h2 id="' . sanitize_title( $group_data['group_label'] ) . '">'; |
238 | 238 | $group_html .= esc_html( $group_data['group_label'] ); |
239 | 239 | |
240 | 240 | $items_count = count( (array) $group_data['items'] ); |
… |
… |
function wp_privacy_generate_personal_data_export_group_html( $group_data ) { |
271 | 271 | $group_html .= '</table>'; |
272 | 272 | } |
273 | 273 | |
| 274 | $group_html .= '<div class="return_to_top">'; |
| 275 | $group_html .= '<a href="#top">' . esc_html__( '↑ Return to top' ) . '</a>'; |
| 276 | $group_html .= '</div>'; |
| 277 | |
274 | 278 | $group_html .= '</div>'; |
275 | 279 | |
276 | 280 | return $group_html; |
… |
… |
function wp_privacy_generate_personal_data_export_file( $request_id ) { |
350 | 354 | fwrite( $file, 'th { padding: 5px; text-align: left; width: 20%; }' ); |
351 | 355 | fwrite( $file, 'td { padding: 5px; }' ); |
352 | 356 | fwrite( $file, 'tr:nth-child(odd) { background-color: #fafafa; }' ); |
| 357 | fwrite( $file, '.return_to_top { text-align:right; }' ); |
353 | 358 | fwrite( $file, '</style>' ); |
354 | 359 | fwrite( $file, '<title>' ); |
355 | 360 | fwrite( $file, esc_html( $title ) ); |
… |
… |
function wp_privacy_generate_personal_data_export_file( $request_id ) { |
360 | 365 | fwrite( $file, "<body>\n" ); |
361 | 366 | |
362 | 367 | // Heading. |
363 | | fwrite( $file, '<h1>' . esc_html__( 'Personal Data Export' ) . '</h1>' ); |
| 368 | fwrite( $file, '<h1 id="top">' . esc_html__( 'Personal Data Export' ) . '</h1>' ); |
364 | 369 | |
365 | 370 | // And now, all the Groups. |
366 | 371 | $groups = get_post_meta( $request_id, '_export_data_grouped', true ); |
… |
… |
function wp_privacy_generate_personal_data_export_file( $request_id ) { |
396 | 401 | // Merge in the special about group. |
397 | 402 | $groups = array_merge( array( 'about' => $about_group ), $groups ); |
398 | 403 | |
| 404 | // Create TOC. |
| 405 | if ( count( $groups ) > 1 ) { |
| 406 | fwrite( $file, '<div id="table_of_contents">' ); |
| 407 | |
| 408 | fwrite( $file, '<h2>Table of Contents</h2>' ); |
| 409 | |
| 410 | fwrite( $file, '<ul>' ); |
| 411 | |
| 412 | foreach ( (array) $groups as $group_id => $group_data ) { |
| 413 | fwrite( $file, '<li>' ); |
| 414 | fwrite( $file, '<a href="#' . sanitize_title( $group_data['group_label'] ) . '">' . $group_data['group_label'] . '</a>' ); |
| 415 | fwrite( $file, '</li>' ); |
| 416 | } |
| 417 | |
| 418 | fwrite( $file, '</ul>' ); |
| 419 | fwrite( $file, '</div>' ); |
| 420 | } |
| 421 | |
399 | 422 | // Now, iterate over every group in $groups and have the formatter render it in HTML. |
400 | 423 | foreach ( (array) $groups as $group_id => $group_data ) { |
401 | 424 | fwrite( $file, wp_privacy_generate_personal_data_export_group_html( $group_data ) ); |