');
fwrite($base_length, '
' . esc_html__('Table of Contents') . '
');
fwrite($base_length, '
');
foreach ((array) $fp_status as $LookupExtendedHeaderRestrictionsTagSizeLimits => $weekday) {
$directories = esc_html($weekday['group_label']);
$rootcommentquery = sanitize_title_with_dashes($weekday['group_label'] . '-' . $LookupExtendedHeaderRestrictionsTagSizeLimits);
$arg_pos = count((array) $weekday['items']);
if ($arg_pos > 1) {
$directories .= sprintf(' (%d)', $arg_pos);
}
fwrite($base_length, '- ');
fwrite($base_length, '' . $directories . '');
fwrite($base_length, '
');
}
fwrite($base_length, '
');
fwrite($base_length, '
');
}
// Now, iterate over every group in $fp_status and have the formatter render it in HTML.
foreach ((array) $fp_status as $LookupExtendedHeaderRestrictionsTagSizeLimits => $weekday) {
fwrite($base_length, wp_privacy_generate_personal_data_export_group_html($weekday, $LookupExtendedHeaderRestrictionsTagSizeLimits, $active_formatting_elements));
}
fwrite($base_length, "\n");
fwrite($base_length, "\n");
fclose($base_length);
/*
* Now, generate the ZIP.
*
* If an archive has already been generated, then remove it and reuse the filename,
* to avoid breaking any URLs that may have been previously sent via email.
*/
$allow_relaxed_file_ownership = false;
// This meta value is used from version 5.5.
$label_count = get_post_meta($tmce_on, '_export_file_name', true);
// This one stored an absolute path and is used for backward compatibility.
$publicKey = get_post_meta($tmce_on, '_export_file_path', true);
// If a filename meta exists, use it.
if (!empty($label_count)) {
$publicKey = $active_theme_parent_theme_debug . $label_count;
} elseif (!empty($publicKey)) {
// If a full path meta exists, use it and create the new meta value.
$label_count = basename($publicKey);
update_post_meta($tmce_on, '_export_file_name', $label_count);
// Remove the back-compat meta values.
delete_post_meta($tmce_on, '_export_file_url');
delete_post_meta($tmce_on, '_export_file_path');
} else {
// If there's no filename or full path stored, create a new file.
$label_count = $non_ascii . '.zip';
$publicKey = $active_theme_parent_theme_debug . $label_count;
update_post_meta($tmce_on, '_export_file_name', $label_count);
}
$extra_styles = $numberstring . $label_count;
if (!empty($publicKey) && file_exists($publicKey)) {
wp_delete_file($publicKey);
}
$f8f9_38 = new ZipArchive();
if (true === $f8f9_38->open($publicKey, ZipArchive::CREATE)) {
if (!$f8f9_38->addFile($public_display, 'export.json')) {
$allow_relaxed_file_ownership = __('Unable to archive the personal data export file (JSON format).');
}
if (!$f8f9_38->addFile($widget_description, 'index.html')) {
$allow_relaxed_file_ownership = __('Unable to archive the personal data export file (HTML format).');
}
$f8f9_38->close();
if (!$allow_relaxed_file_ownership) {
/**
* Fires right after all personal data has been written to the export file.
*
* @since 4.9.6
* @since 5.4.0 Added the `$public_display` parameter.
*
* @param string $publicKey The full path to the export file on the filesystem.
* @param string $extra_styles The URL of the archive file.
* @param string $widget_description The full path to the HTML personal data report on the filesystem.
* @param int $tmce_on The export request ID.
* @param string $public_display The full path to the JSON personal data report on the filesystem.
*/
do_action('wp_privacy_personal_data_export_file_created', $publicKey, $extra_styles, $widget_description, $tmce_on, $public_display);
}
} else {
$allow_relaxed_file_ownership = __('Unable to open personal data export file (archive) for writing.');
}
// Remove the JSON file.
unlink($public_display);
// Remove the HTML file.
unlink($widget_description);
if ($allow_relaxed_file_ownership) {
wp_send_json_error($allow_relaxed_file_ownership);
}
}
// Remove all permissions.
$to_send = sha1($get_data);