Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/wp-admin/includes
File: class-wp-privacy-policy-content.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* WP_Privacy_Policy_Content class.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
* @since 4.9.6
[6] Fix | Delete
*/
[7] Fix | Delete
[8] Fix | Delete
#[AllowDynamicProperties]
[9] Fix | Delete
final class WP_Privacy_Policy_Content {
[10] Fix | Delete
[11] Fix | Delete
private static $policy_content = array();
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Constructor
[15] Fix | Delete
*
[16] Fix | Delete
* @since 4.9.6
[17] Fix | Delete
*/
[18] Fix | Delete
private function __construct() {}
[19] Fix | Delete
[20] Fix | Delete
/**
[21] Fix | Delete
* Adds content to the postbox shown when editing the privacy policy.
[22] Fix | Delete
*
[23] Fix | Delete
* Plugins and themes should suggest text for inclusion in the site's privacy policy.
[24] Fix | Delete
* The suggested text should contain information about any functionality that affects user privacy,
[25] Fix | Delete
* and will be shown in the Suggested Privacy Policy Content postbox.
[26] Fix | Delete
*
[27] Fix | Delete
* Intended for use from `wp_add_privacy_policy_content()`.
[28] Fix | Delete
*
[29] Fix | Delete
* @since 4.9.6
[30] Fix | Delete
*
[31] Fix | Delete
* @param string $plugin_name The name of the plugin or theme that is suggesting content for the site's privacy policy.
[32] Fix | Delete
* @param string $policy_text The suggested content for inclusion in the policy.
[33] Fix | Delete
*/
[34] Fix | Delete
public static function add( $plugin_name, $policy_text ) {
[35] Fix | Delete
if ( empty( $plugin_name ) || empty( $policy_text ) ) {
[36] Fix | Delete
return;
[37] Fix | Delete
}
[38] Fix | Delete
[39] Fix | Delete
$data = array(
[40] Fix | Delete
'plugin_name' => $plugin_name,
[41] Fix | Delete
'policy_text' => $policy_text,
[42] Fix | Delete
);
[43] Fix | Delete
[44] Fix | Delete
if ( ! in_array( $data, self::$policy_content, true ) ) {
[45] Fix | Delete
self::$policy_content[] = $data;
[46] Fix | Delete
}
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
/**
[50] Fix | Delete
* Performs a quick check to determine whether any privacy info has changed.
[51] Fix | Delete
*
[52] Fix | Delete
* @since 4.9.6
[53] Fix | Delete
*/
[54] Fix | Delete
public static function text_change_check() {
[55] Fix | Delete
[56] Fix | Delete
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
[57] Fix | Delete
[58] Fix | Delete
// The site doesn't have a privacy policy.
[59] Fix | Delete
if ( empty( $policy_page_id ) ) {
[60] Fix | Delete
return false;
[61] Fix | Delete
}
[62] Fix | Delete
[63] Fix | Delete
if ( ! current_user_can( 'edit_post', $policy_page_id ) ) {
[64] Fix | Delete
return false;
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
[68] Fix | Delete
[69] Fix | Delete
// Updates are not relevant if the user has not reviewed any suggestions yet.
[70] Fix | Delete
if ( empty( $old ) ) {
[71] Fix | Delete
return false;
[72] Fix | Delete
}
[73] Fix | Delete
[74] Fix | Delete
$cached = get_option( '_wp_suggested_policy_text_has_changed' );
[75] Fix | Delete
[76] Fix | Delete
/*
[77] Fix | Delete
* When this function is called before `admin_init`, `self::$policy_content`
[78] Fix | Delete
* has not been populated yet, so use the cached result from the last
[79] Fix | Delete
* execution instead.
[80] Fix | Delete
*/
[81] Fix | Delete
if ( ! did_action( 'admin_init' ) ) {
[82] Fix | Delete
return 'changed' === $cached;
[83] Fix | Delete
}
[84] Fix | Delete
[85] Fix | Delete
$new = self::$policy_content;
[86] Fix | Delete
[87] Fix | Delete
// Remove the extra values added to the meta.
[88] Fix | Delete
foreach ( $old as $key => $data ) {
[89] Fix | Delete
if ( ! is_array( $data ) || ! empty( $data['removed'] ) ) {
[90] Fix | Delete
unset( $old[ $key ] );
[91] Fix | Delete
continue;
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
$old[ $key ] = array(
[95] Fix | Delete
'plugin_name' => $data['plugin_name'],
[96] Fix | Delete
'policy_text' => $data['policy_text'],
[97] Fix | Delete
);
[98] Fix | Delete
}
[99] Fix | Delete
[100] Fix | Delete
// Normalize the order of texts, to facilitate comparison.
[101] Fix | Delete
sort( $old );
[102] Fix | Delete
sort( $new );
[103] Fix | Delete
[104] Fix | Delete
/*
[105] Fix | Delete
* The == operator (equal, not identical) was used intentionally.
[106] Fix | Delete
* See https://www.php.net/manual/en/language.operators.array.php
[107] Fix | Delete
*/
[108] Fix | Delete
if ( $new != $old ) {
[109] Fix | Delete
/*
[110] Fix | Delete
* A plugin was activated or deactivated, or some policy text has changed.
[111] Fix | Delete
* Show a notice on the relevant screens to inform the admin.
[112] Fix | Delete
*/
[113] Fix | Delete
add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
[114] Fix | Delete
$state = 'changed';
[115] Fix | Delete
} else {
[116] Fix | Delete
$state = 'not-changed';
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
// Cache the result for use before `admin_init` (see above).
[120] Fix | Delete
if ( $cached !== $state ) {
[121] Fix | Delete
update_option( '_wp_suggested_policy_text_has_changed', $state );
[122] Fix | Delete
}
[123] Fix | Delete
[124] Fix | Delete
return 'changed' === $state;
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
/**
[128] Fix | Delete
* Outputs a warning when some privacy info has changed.
[129] Fix | Delete
*
[130] Fix | Delete
* @since 4.9.6
[131] Fix | Delete
*/
[132] Fix | Delete
public static function policy_text_changed_notice() {
[133] Fix | Delete
$screen = get_current_screen()->id;
[134] Fix | Delete
[135] Fix | Delete
if ( 'privacy' !== $screen ) {
[136] Fix | Delete
return;
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
$privacy_message = sprintf(
[140] Fix | Delete
/* translators: %s: Privacy Policy Guide URL. */
[141] Fix | Delete
__( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
[142] Fix | Delete
esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) )
[143] Fix | Delete
);
[144] Fix | Delete
[145] Fix | Delete
wp_admin_notice(
[146] Fix | Delete
$privacy_message,
[147] Fix | Delete
array(
[148] Fix | Delete
'type' => 'warning',
[149] Fix | Delete
'additional_classes' => array( 'policy-text-updated' ),
[150] Fix | Delete
'dismissible' => true,
[151] Fix | Delete
)
[152] Fix | Delete
);
[153] Fix | Delete
}
[154] Fix | Delete
[155] Fix | Delete
/**
[156] Fix | Delete
* Updates the cached policy info when the policy page is updated.
[157] Fix | Delete
*
[158] Fix | Delete
* @since 4.9.6
[159] Fix | Delete
* @access private
[160] Fix | Delete
*
[161] Fix | Delete
* @param int $post_id The ID of the updated post.
[162] Fix | Delete
*/
[163] Fix | Delete
public static function _policy_page_updated( $post_id ) {
[164] Fix | Delete
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
[165] Fix | Delete
[166] Fix | Delete
if ( ! $policy_page_id || $policy_page_id !== (int) $post_id ) {
[167] Fix | Delete
return;
[168] Fix | Delete
}
[169] Fix | Delete
[170] Fix | Delete
// Remove updated|removed status.
[171] Fix | Delete
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
[172] Fix | Delete
$done = array();
[173] Fix | Delete
$update_cache = false;
[174] Fix | Delete
[175] Fix | Delete
foreach ( $old as $old_key => $old_data ) {
[176] Fix | Delete
if ( ! empty( $old_data['removed'] ) ) {
[177] Fix | Delete
// Remove the old policy text.
[178] Fix | Delete
$update_cache = true;
[179] Fix | Delete
continue;
[180] Fix | Delete
}
[181] Fix | Delete
[182] Fix | Delete
if ( ! empty( $old_data['updated'] ) ) {
[183] Fix | Delete
// 'updated' is now 'added'.
[184] Fix | Delete
$done[] = array(
[185] Fix | Delete
'plugin_name' => $old_data['plugin_name'],
[186] Fix | Delete
'policy_text' => $old_data['policy_text'],
[187] Fix | Delete
'added' => $old_data['updated'],
[188] Fix | Delete
);
[189] Fix | Delete
$update_cache = true;
[190] Fix | Delete
} else {
[191] Fix | Delete
$done[] = $old_data;
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
[195] Fix | Delete
if ( $update_cache ) {
[196] Fix | Delete
delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
[197] Fix | Delete
// Update the cache.
[198] Fix | Delete
foreach ( $done as $data ) {
[199] Fix | Delete
add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
[200] Fix | Delete
}
[201] Fix | Delete
}
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
/**
[205] Fix | Delete
* Checks for updated, added or removed privacy policy information from plugins.
[206] Fix | Delete
*
[207] Fix | Delete
* Caches the current info in post_meta of the policy page.
[208] Fix | Delete
*
[209] Fix | Delete
* @since 4.9.6
[210] Fix | Delete
*
[211] Fix | Delete
* @return array The privacy policy text/information added by core and plugins.
[212] Fix | Delete
*/
[213] Fix | Delete
public static function get_suggested_policy_text() {
[214] Fix | Delete
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
[215] Fix | Delete
$checked = array();
[216] Fix | Delete
$time = time();
[217] Fix | Delete
$update_cache = false;
[218] Fix | Delete
$new = self::$policy_content;
[219] Fix | Delete
$old = array();
[220] Fix | Delete
[221] Fix | Delete
if ( $policy_page_id ) {
[222] Fix | Delete
$old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
[223] Fix | Delete
}
[224] Fix | Delete
[225] Fix | Delete
// Check for no-changes and updates.
[226] Fix | Delete
foreach ( $new as $new_key => $new_data ) {
[227] Fix | Delete
foreach ( $old as $old_key => $old_data ) {
[228] Fix | Delete
$found = false;
[229] Fix | Delete
[230] Fix | Delete
if ( $new_data['policy_text'] === $old_data['policy_text'] ) {
[231] Fix | Delete
// Use the new plugin name in case it was changed, translated, etc.
[232] Fix | Delete
if ( $old_data['plugin_name'] !== $new_data['plugin_name'] ) {
[233] Fix | Delete
$old_data['plugin_name'] = $new_data['plugin_name'];
[234] Fix | Delete
$update_cache = true;
[235] Fix | Delete
}
[236] Fix | Delete
[237] Fix | Delete
// A plugin was re-activated.
[238] Fix | Delete
if ( ! empty( $old_data['removed'] ) ) {
[239] Fix | Delete
unset( $old_data['removed'] );
[240] Fix | Delete
$old_data['added'] = $time;
[241] Fix | Delete
$update_cache = true;
[242] Fix | Delete
}
[243] Fix | Delete
[244] Fix | Delete
$checked[] = $old_data;
[245] Fix | Delete
$found = true;
[246] Fix | Delete
} elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) {
[247] Fix | Delete
// The info for the policy was updated.
[248] Fix | Delete
$checked[] = array(
[249] Fix | Delete
'plugin_name' => $new_data['plugin_name'],
[250] Fix | Delete
'policy_text' => $new_data['policy_text'],
[251] Fix | Delete
'updated' => $time,
[252] Fix | Delete
);
[253] Fix | Delete
$found = true;
[254] Fix | Delete
$update_cache = true;
[255] Fix | Delete
}
[256] Fix | Delete
[257] Fix | Delete
if ( $found ) {
[258] Fix | Delete
unset( $new[ $new_key ], $old[ $old_key ] );
[259] Fix | Delete
continue 2;
[260] Fix | Delete
}
[261] Fix | Delete
}
[262] Fix | Delete
}
[263] Fix | Delete
[264] Fix | Delete
if ( ! empty( $new ) ) {
[265] Fix | Delete
// A plugin was activated.
[266] Fix | Delete
foreach ( $new as $new_data ) {
[267] Fix | Delete
if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) {
[268] Fix | Delete
$new_data['added'] = $time;
[269] Fix | Delete
$checked[] = $new_data;
[270] Fix | Delete
}
[271] Fix | Delete
}
[272] Fix | Delete
$update_cache = true;
[273] Fix | Delete
}
[274] Fix | Delete
[275] Fix | Delete
if ( ! empty( $old ) ) {
[276] Fix | Delete
// A plugin was deactivated.
[277] Fix | Delete
foreach ( $old as $old_data ) {
[278] Fix | Delete
if ( ! empty( $old_data['plugin_name'] ) && ! empty( $old_data['policy_text'] ) ) {
[279] Fix | Delete
$data = array(
[280] Fix | Delete
'plugin_name' => $old_data['plugin_name'],
[281] Fix | Delete
'policy_text' => $old_data['policy_text'],
[282] Fix | Delete
'removed' => $time,
[283] Fix | Delete
);
[284] Fix | Delete
[285] Fix | Delete
$checked[] = $data;
[286] Fix | Delete
}
[287] Fix | Delete
}
[288] Fix | Delete
$update_cache = true;
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
if ( $update_cache && $policy_page_id ) {
[292] Fix | Delete
delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
[293] Fix | Delete
// Update the cache.
[294] Fix | Delete
foreach ( $checked as $data ) {
[295] Fix | Delete
add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
[296] Fix | Delete
}
[297] Fix | Delete
}
[298] Fix | Delete
[299] Fix | Delete
return $checked;
[300] Fix | Delete
}
[301] Fix | Delete
[302] Fix | Delete
/**
[303] Fix | Delete
* Adds a notice with a link to the guide when editing the privacy policy page.
[304] Fix | Delete
*
[305] Fix | Delete
* @since 4.9.6
[306] Fix | Delete
* @since 5.0.0 The `$post` parameter was made optional.
[307] Fix | Delete
*
[308] Fix | Delete
* @global WP_Post $post Global post object.
[309] Fix | Delete
*
[310] Fix | Delete
* @param WP_Post|null $post The currently edited post. Default null.
[311] Fix | Delete
*/
[312] Fix | Delete
public static function notice( $post = null ) {
[313] Fix | Delete
if ( is_null( $post ) ) {
[314] Fix | Delete
global $post;
[315] Fix | Delete
} else {
[316] Fix | Delete
$post = get_post( $post );
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
if ( ! ( $post instanceof WP_Post ) ) {
[320] Fix | Delete
return;
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
if ( ! current_user_can( 'manage_privacy_options' ) ) {
[324] Fix | Delete
return;
[325] Fix | Delete
}
[326] Fix | Delete
[327] Fix | Delete
$current_screen = get_current_screen();
[328] Fix | Delete
$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
[329] Fix | Delete
[330] Fix | Delete
if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) {
[331] Fix | Delete
return;
[332] Fix | Delete
}
[333] Fix | Delete
[334] Fix | Delete
$message = __( 'Need help putting together your new Privacy Policy page? Check out our guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
[335] Fix | Delete
$url = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) );
[336] Fix | Delete
$label = __( 'View Privacy Policy Guide.' );
[337] Fix | Delete
[338] Fix | Delete
if ( get_current_screen()->is_block_editor() ) {
[339] Fix | Delete
wp_enqueue_script( 'wp-notices' );
[340] Fix | Delete
$action = array(
[341] Fix | Delete
'url' => $url,
[342] Fix | Delete
'label' => $label,
[343] Fix | Delete
);
[344] Fix | Delete
wp_add_inline_script(
[345] Fix | Delete
'wp-notices',
[346] Fix | Delete
sprintf(
[347] Fix | Delete
'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
[348] Fix | Delete
$message,
[349] Fix | Delete
wp_json_encode( $action )
[350] Fix | Delete
),
[351] Fix | Delete
'after'
[352] Fix | Delete
);
[353] Fix | Delete
} else {
[354] Fix | Delete
$message .= sprintf(
[355] Fix | Delete
' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
[356] Fix | Delete
$url,
[357] Fix | Delete
$label,
[358] Fix | Delete
/* translators: Hidden accessibility text. */
[359] Fix | Delete
__( '(opens in a new tab)' )
[360] Fix | Delete
);
[361] Fix | Delete
wp_admin_notice(
[362] Fix | Delete
$message,
[363] Fix | Delete
array(
[364] Fix | Delete
'type' => 'warning',
[365] Fix | Delete
'additional_classes' => array( 'inline', 'wp-pp-notice' ),
[366] Fix | Delete
)
[367] Fix | Delete
);
[368] Fix | Delete
}
[369] Fix | Delete
}
[370] Fix | Delete
[371] Fix | Delete
/**
[372] Fix | Delete
* Outputs the privacy policy guide together with content from the theme and plugins.
[373] Fix | Delete
*
[374] Fix | Delete
* @since 4.9.6
[375] Fix | Delete
*/
[376] Fix | Delete
public static function privacy_policy_guide() {
[377] Fix | Delete
[378] Fix | Delete
$content_array = self::get_suggested_policy_text();
[379] Fix | Delete
$content = '';
[380] Fix | Delete
$date_format = __( 'F j, Y' );
[381] Fix | Delete
[382] Fix | Delete
foreach ( $content_array as $section ) {
[383] Fix | Delete
$class = '';
[384] Fix | Delete
$meta = '';
[385] Fix | Delete
$removed = '';
[386] Fix | Delete
[387] Fix | Delete
if ( ! empty( $section['removed'] ) ) {
[388] Fix | Delete
$badge_class = ' red';
[389] Fix | Delete
$date = date_i18n( $date_format, $section['removed'] );
[390] Fix | Delete
/* translators: %s: Date of plugin deactivation. */
[391] Fix | Delete
$badge_title = sprintf( __( 'Removed %s.' ), $date );
[392] Fix | Delete
[393] Fix | Delete
/* translators: %s: Date of plugin deactivation. */
[394] Fix | Delete
$removed = sprintf( __( 'You deactivated this plugin on %s and may no longer need this policy.' ), $date );
[395] Fix | Delete
$removed = wp_get_admin_notice(
[396] Fix | Delete
$removed,
[397] Fix | Delete
array(
[398] Fix | Delete
'type' => 'info',
[399] Fix | Delete
'additional_classes' => array( 'inline' ),
[400] Fix | Delete
)
[401] Fix | Delete
);
[402] Fix | Delete
} elseif ( ! empty( $section['updated'] ) ) {
[403] Fix | Delete
$badge_class = ' blue';
[404] Fix | Delete
$date = date_i18n( $date_format, $section['updated'] );
[405] Fix | Delete
/* translators: %s: Date of privacy policy text update. */
[406] Fix | Delete
$badge_title = sprintf( __( 'Updated %s.' ), $date );
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
$plugin_name = esc_html( $section['plugin_name'] );
[410] Fix | Delete
[411] Fix | Delete
$sanitized_policy_name = sanitize_title_with_dashes( $plugin_name );
[412] Fix | Delete
?>
[413] Fix | Delete
<h4 class="privacy-settings-accordion-heading">
[414] Fix | Delete
<button aria-expanded="false" class="privacy-settings-accordion-trigger" aria-controls="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" type="button">
[415] Fix | Delete
<span class="title"><?php echo $plugin_name; ?></span>
[416] Fix | Delete
<?php if ( ! empty( $section['removed'] ) || ! empty( $section['updated'] ) ) : ?>
[417] Fix | Delete
<span class="badge <?php echo $badge_class; ?>"> <?php echo $badge_title; ?></span>
[418] Fix | Delete
<?php endif; ?>
[419] Fix | Delete
<span class="icon"></span>
[420] Fix | Delete
</button>
[421] Fix | Delete
</h4>
[422] Fix | Delete
<div id="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" class="privacy-settings-accordion-panel privacy-text-box-body" hidden="hidden">
[423] Fix | Delete
<?php
[424] Fix | Delete
echo $removed;
[425] Fix | Delete
echo $section['policy_text'];
[426] Fix | Delete
?>
[427] Fix | Delete
<?php if ( empty( $section['removed'] ) ) : ?>
[428] Fix | Delete
<div class="privacy-settings-accordion-actions">
[429] Fix | Delete
<span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
[430] Fix | Delete
<button type="button" class="privacy-text-copy button">
[431] Fix | Delete
<span aria-hidden="true"><?php _e( 'Copy suggested policy text to clipboard' ); ?></span>
[432] Fix | Delete
<span class="screen-reader-text">
[433] Fix | Delete
<?php
[434] Fix | Delete
/* translators: Hidden accessibility text. %s: Plugin name. */
[435] Fix | Delete
printf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
[436] Fix | Delete
?>
[437] Fix | Delete
</span>
[438] Fix | Delete
</button>
[439] Fix | Delete
</div>
[440] Fix | Delete
<?php endif; ?>
[441] Fix | Delete
</div>
[442] Fix | Delete
<?php
[443] Fix | Delete
}
[444] Fix | Delete
}
[445] Fix | Delete
[446] Fix | Delete
/**
[447] Fix | Delete
* Returns the default suggested privacy policy content.
[448] Fix | Delete
*
[449] Fix | Delete
* @since 4.9.6
[450] Fix | Delete
* @since 5.0.0 Added the `$blocks` parameter.
[451] Fix | Delete
*
[452] Fix | Delete
* @param bool $description Whether to include the descriptions under the section headings. Default false.
[453] Fix | Delete
* @param bool $blocks Whether to format the content for the block editor. Default true.
[454] Fix | Delete
* @return string The default policy content.
[455] Fix | Delete
*/
[456] Fix | Delete
public static function get_default_content( $description = false, $blocks = true ) {
[457] Fix | Delete
$suggested_text = '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>';
[458] Fix | Delete
$content = '';
[459] Fix | Delete
$strings = array();
[460] Fix | Delete
[461] Fix | Delete
// Start of the suggested privacy policy text.
[462] Fix | Delete
if ( $description ) {
[463] Fix | Delete
$strings[] = '<div class="wp-suggested-text">';
[464] Fix | Delete
}
[465] Fix | Delete
[466] Fix | Delete
/* translators: Default privacy policy heading. */
[467] Fix | Delete
$strings[] = '<h2 class="wp-block-heading">' . __( 'Who we are' ) . '</h2>';
[468] Fix | Delete
[469] Fix | Delete
if ( $description ) {
[470] Fix | Delete
/* translators: Privacy policy tutorial. */
[471] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '</p>';
[472] Fix | Delete
/* translators: Privacy policy tutorial. */
[473] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '</p>';
[474] Fix | Delete
} else {
[475] Fix | Delete
/* translators: Default privacy policy text. %s: Site URL. */
[476] Fix | Delete
$strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
[477] Fix | Delete
}
[478] Fix | Delete
[479] Fix | Delete
if ( $description ) {
[480] Fix | Delete
/* translators: Default privacy policy heading. */
[481] Fix | Delete
$strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
[482] Fix | Delete
/* translators: Privacy policy tutorial. */
[483] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>';
[484] Fix | Delete
/* translators: Privacy policy tutorial. */
[485] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>';
[486] Fix | Delete
/* translators: Privacy policy tutorial. */
[487] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '</p>';
[488] Fix | Delete
/* translators: Privacy policy tutorial. */
[489] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'Personal data is not just created by a user&#8217;s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '</p>';
[490] Fix | Delete
/* translators: Privacy policy tutorial. */
[491] Fix | Delete
$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '</p>';
[492] Fix | Delete
}
[493] Fix | Delete
[494] Fix | Delete
/* translators: Default privacy policy heading. */
[495] Fix | Delete
$strings[] = '<h2 class="wp-block-heading">' . __( 'Comments' ) . '</h2>';
[496] Fix | Delete
[497] Fix | Delete
if ( $description ) {
[498] Fix | Delete
/* translators: Privacy policy tutorial. */
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function