wp/wp-admin/includes/class-wp-privacy-policy-content.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
child 22 8c2e4d02f4ef
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  * @since 4.9.6
     7  * @since 4.9.6
     8  */
     8  */
     9 
     9 
       
    10 #[AllowDynamicProperties]
    10 final class WP_Privacy_Policy_Content {
    11 final class WP_Privacy_Policy_Content {
    11 
    12 
    12 	private static $policy_content = array();
    13 	private static $policy_content = array();
    13 
    14 
    14 	/**
    15 	/**
    17 	 * @since 4.9.6
    18 	 * @since 4.9.6
    18 	 */
    19 	 */
    19 	private function __construct() {}
    20 	private function __construct() {}
    20 
    21 
    21 	/**
    22 	/**
    22 	 * Add content to the postbox shown when editing the privacy policy.
    23 	 * Adds content to the postbox shown when editing the privacy policy.
    23 	 *
    24 	 *
    24 	 * Plugins and themes should suggest text for inclusion in the site's privacy policy.
    25 	 * Plugins and themes should suggest text for inclusion in the site's privacy policy.
    25 	 * The suggested text should contain information about any functionality that affects user privacy,
    26 	 * The suggested text should contain information about any functionality that affects user privacy,
    26 	 * and will be shown in the Suggested Privacy Policy Content postbox.
    27 	 * and will be shown in the Suggested Privacy Policy Content postbox.
    27 	 *
    28 	 *
    46 			self::$policy_content[] = $data;
    47 			self::$policy_content[] = $data;
    47 		}
    48 		}
    48 	}
    49 	}
    49 
    50 
    50 	/**
    51 	/**
    51 	 * Quick check if any privacy info has changed.
    52 	 * Performs a quick check to determine whether any privacy info has changed.
    52 	 *
    53 	 *
    53 	 * @since 4.9.6
    54 	 * @since 4.9.6
    54 	 */
    55 	 */
    55 	public static function text_change_check() {
    56 	public static function text_change_check() {
    56 
    57 
   100 
   101 
   101 		// Normalize the order of texts, to facilitate comparison.
   102 		// Normalize the order of texts, to facilitate comparison.
   102 		sort( $old );
   103 		sort( $old );
   103 		sort( $new );
   104 		sort( $new );
   104 
   105 
   105 		// The == operator (equal, not identical) was used intentionally.
   106 		/*
   106 		// See http://php.net/manual/en/language.operators.array.php
   107 		 * The == operator (equal, not identical) was used intentionally.
       
   108 		 * See https://www.php.net/manual/en/language.operators.array.php
       
   109 		 */
   107 		if ( $new != $old ) {
   110 		if ( $new != $old ) {
   108 			// A plugin was activated or deactivated, or some policy text has changed.
   111 			/*
   109 			// Show a notice on the relevant screens to inform the admin.
   112 			 * A plugin was activated or deactivated, or some policy text has changed.
       
   113 			 * Show a notice on the relevant screens to inform the admin.
       
   114 			 */
   110 			add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
   115 			add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
   111 			$state = 'changed';
   116 			$state = 'changed';
   112 		} else {
   117 		} else {
   113 			$state = 'not-changed';
   118 			$state = 'not-changed';
   114 		}
   119 		}
   120 
   125 
   121 		return 'changed' === $state;
   126 		return 'changed' === $state;
   122 	}
   127 	}
   123 
   128 
   124 	/**
   129 	/**
   125 	 * Output a warning when some privacy info has changed.
   130 	 * Outputs a warning when some privacy info has changed.
   126 	 *
   131 	 *
   127 	 * @since 4.9.6
   132 	 * @since 4.9.6
   128 	 *
       
   129 	 * @global WP_Post $post Global post object.
       
   130 	 */
   133 	 */
   131 	public static function policy_text_changed_notice() {
   134 	public static function policy_text_changed_notice() {
   132 		global $post;
       
   133 
       
   134 		$screen = get_current_screen()->id;
   135 		$screen = get_current_screen()->id;
   135 
   136 
   136 		if ( 'privacy' !== $screen ) {
   137 		if ( 'privacy' !== $screen ) {
   137 			return;
   138 			return;
   138 		}
   139 		}
   139 
   140 
   140 		?>
   141 		$privacy_message = sprintf(
   141 		<div class="policy-text-updated notice notice-warning is-dismissible">
   142 			/* translators: %s: Privacy Policy Guide URL. */
   142 			<p>
   143 			__( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
   143 			<?php
   144 			esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) )
   144 				printf(
   145 		);
   145 					/* translators: %s: Privacy Policy Guide URL. */
   146 
   146 					__( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
   147 		wp_admin_notice(
   147 					esc_url( admin_url( 'privacy-policy-guide.php?tab=policyguide' ) )
   148 			$privacy_message,
   148 				);
   149 			array(
   149 			?>
   150 				'type'               => 'warning',
   150 			</p>
   151 				'additional_classes' => array( 'policy-text-updated' ),
   151 		</div>
   152 				'dismissible'        => true,
   152 		<?php
   153 			)
   153 	}
   154 		);
   154 
   155 	}
   155 	/**
   156 
   156 	 * Update the cached policy info when the policy page is updated.
   157 	/**
       
   158 	 * Updates the cached policy info when the policy page is updated.
   157 	 *
   159 	 *
   158 	 * @since 4.9.6
   160 	 * @since 4.9.6
   159 	 * @access private
   161 	 * @access private
   160 	 *
   162 	 *
   161 	 * @param int $post_id The ID of the updated post.
   163 	 * @param int $post_id The ID of the updated post.
   200 			}
   202 			}
   201 		}
   203 		}
   202 	}
   204 	}
   203 
   205 
   204 	/**
   206 	/**
   205 	 * Check for updated, added or removed privacy policy information from plugins.
   207 	 * Checks for updated, added or removed privacy policy information from plugins.
   206 	 *
   208 	 *
   207 	 * Caches the current info in post_meta of the policy page.
   209 	 * Caches the current info in post_meta of the policy page.
   208 	 *
   210 	 *
   209 	 * @since 4.9.6
   211 	 * @since 4.9.6
   210 	 *
   212 	 *
   298 
   300 
   299 		return $checked;
   301 		return $checked;
   300 	}
   302 	}
   301 
   303 
   302 	/**
   304 	/**
   303 	 * Add a notice with a link to the guide when editing the privacy policy page.
   305 	 * Adds a notice with a link to the guide when editing the privacy policy page.
   304 	 *
   306 	 *
   305 	 * @since 4.9.6
   307 	 * @since 4.9.6
   306 	 * @since 5.0.0 The `$post` parameter was made optional.
   308 	 * @since 5.0.0 The `$post` parameter was made optional.
   307 	 *
   309 	 *
   308 	 * @global WP_Post $post Global post object.
   310 	 * @global WP_Post $post Global post object.
   349 					wp_json_encode( $action )
   351 					wp_json_encode( $action )
   350 				),
   352 				),
   351 				'after'
   353 				'after'
   352 			);
   354 			);
   353 		} else {
   355 		} else {
   354 			?>
   356 			$message .= sprintf(
   355 			<div class="notice notice-warning inline wp-pp-notice">
   357 				' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
   356 				<p>
   358 				$url,
   357 				<?php
   359 				$label,
   358 				echo $message;
   360 				/* translators: Hidden accessibility text. */
   359 				printf(
   361 				__( '(opens in a new tab)' )
   360 					' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
   362 			);
   361 					$url,
   363 			wp_admin_notice(
   362 					$label,
   364 				$message,
   363 					/* translators: Accessibility text. */
   365 				array(
   364 					__( '(opens in a new tab)' )
   366 					'type'               => 'warning',
   365 				);
   367 					'additional_classes' => array( 'inline', 'wp-pp-notice' ),
   366 				?>
   368 				)
   367 				</p>
   369 			);
   368 			</div>
   370 		}
   369 			<?php
   371 	}
   370 		}
   372 
   371 	}
   373 	/**
   372 
   374 	 * Outputs the privacy policy guide together with content from the theme and plugins.
   373 	/**
       
   374 	 * Output the privacy policy guide together with content from the theme and plugins.
       
   375 	 *
   375 	 *
   376 	 * @since 4.9.6
   376 	 * @since 4.9.6
   377 	 */
   377 	 */
   378 	public static function privacy_policy_guide() {
   378 	public static function privacy_policy_guide() {
   379 
   379 
   391 				$date        = date_i18n( $date_format, $section['removed'] );
   391 				$date        = date_i18n( $date_format, $section['removed'] );
   392 				/* translators: %s: Date of plugin deactivation. */
   392 				/* translators: %s: Date of plugin deactivation. */
   393 				$badge_title = sprintf( __( 'Removed %s.' ), $date );
   393 				$badge_title = sprintf( __( 'Removed %s.' ), $date );
   394 
   394 
   395 				/* translators: %s: Date of plugin deactivation. */
   395 				/* translators: %s: Date of plugin deactivation. */
   396 				$removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
   396 				$removed = sprintf( __( 'You deactivated this plugin on %s and may no longer need this policy.' ), $date );
   397 				$removed = '<div class="notice notice-info inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
   397 				$removed = wp_get_admin_notice(
       
   398 					$removed,
       
   399 					array(
       
   400 						'type'               => 'info',
       
   401 						'additional_classes' => array( 'inline' ),
       
   402 					)
       
   403 				);
   398 			} elseif ( ! empty( $section['updated'] ) ) {
   404 			} elseif ( ! empty( $section['updated'] ) ) {
   399 				$badge_class = ' blue';
   405 				$badge_class = ' blue';
   400 				$date        = date_i18n( $date_format, $section['updated'] );
   406 				$date        = date_i18n( $date_format, $section['updated'] );
   401 				/* translators: %s: Date of privacy policy text update. */
   407 				/* translators: %s: Date of privacy policy text update. */
   402 				$badge_title = sprintf( __( 'Updated %s.' ), $date );
   408 				$badge_title = sprintf( __( 'Updated %s.' ), $date );
   425 					<span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
   431 					<span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
   426 					<button type="button" class="privacy-text-copy button">
   432 					<button type="button" class="privacy-text-copy button">
   427 						<span aria-hidden="true"><?php _e( 'Copy suggested policy text to clipboard' ); ?></span>
   433 						<span aria-hidden="true"><?php _e( 'Copy suggested policy text to clipboard' ); ?></span>
   428 						<span class="screen-reader-text">
   434 						<span class="screen-reader-text">
   429 							<?php
   435 							<?php
   430 							/* translators: %s: Plugin name. */
   436 							/* translators: Hidden accessibility text. %s: Plugin name. */
   431 							printf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
   437 							printf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
   432 							?>
   438 							?>
   433 						</span>
   439 						</span>
   434 					</button>
   440 					</button>
   435 				</div>
   441 				</div>
   438 			<?php
   444 			<?php
   439 		}
   445 		}
   440 	}
   446 	}
   441 
   447 
   442 	/**
   448 	/**
   443 	 * Return the default suggested privacy policy content.
   449 	 * Returns the default suggested privacy policy content.
   444 	 *
   450 	 *
   445 	 * @since 4.9.6
   451 	 * @since 4.9.6
   446 	 * @since 5.0.0 Added the `$blocks` parameter.
   452 	 * @since 5.0.0 Added the `$blocks` parameter.
   447 	 *
   453 	 *
   448 	 * @param bool $description Whether to include the descriptions under the section headings. Default false.
   454 	 * @param bool $description Whether to include the descriptions under the section headings. Default false.
   458 		if ( $description ) {
   464 		if ( $description ) {
   459 			$strings[] = '<div class="wp-suggested-text">';
   465 			$strings[] = '<div class="wp-suggested-text">';
   460 		}
   466 		}
   461 
   467 
   462 		/* translators: Default privacy policy heading. */
   468 		/* translators: Default privacy policy heading. */
   463 		$strings[] = '<h2>' . __( 'Who we are' ) . '</h2>';
   469 		$strings[] = '<h2 class="wp-block-heading">' . __( 'Who we are' ) . '</h2>';
   464 
   470 
   465 		if ( $description ) {
   471 		if ( $description ) {
   466 			/* translators: Privacy policy tutorial. */
   472 			/* translators: Privacy policy tutorial. */
   467 			$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>';
   473 			$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>';
   468 			/* translators: Privacy policy tutorial. */
   474 			/* translators: Privacy policy tutorial. */
   486 			/* translators: Privacy policy tutorial. */
   492 			/* translators: Privacy policy tutorial. */
   487 			$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>';
   493 			$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>';
   488 		}
   494 		}
   489 
   495 
   490 		/* translators: Default privacy policy heading. */
   496 		/* translators: Default privacy policy heading. */
   491 		$strings[] = '<h2>' . __( 'Comments' ) . '</h2>';
   497 		$strings[] = '<h2 class="wp-block-heading">' . __( 'Comments' ) . '</h2>';
   492 
   498 
   493 		if ( $description ) {
   499 		if ( $description ) {
   494 			/* translators: Privacy policy tutorial. */
   500 			/* translators: Privacy policy tutorial. */
   495 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '</p>';
   501 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '</p>';
   496 		} else {
   502 		} else {
   499 			/* translators: Default privacy policy text. */
   505 			/* translators: Default privacy policy text. */
   500 			$strings[] = '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>';
   506 			$strings[] = '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>';
   501 		}
   507 		}
   502 
   508 
   503 		/* translators: Default privacy policy heading. */
   509 		/* translators: Default privacy policy heading. */
   504 		$strings[] = '<h2>' . __( 'Media' ) . '</h2>';
   510 		$strings[] = '<h2 class="wp-block-heading">' . __( 'Media' ) . '</h2>';
   505 
   511 
   506 		if ( $description ) {
   512 		if ( $description ) {
   507 			/* translators: Privacy policy tutorial. */
   513 			/* translators: Privacy policy tutorial. */
   508 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>';
   514 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>';
   509 		} else {
   515 		} else {
   517 			/* translators: Privacy policy tutorial. */
   523 			/* translators: Privacy policy tutorial. */
   518 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '</p>';
   524 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '</p>';
   519 		}
   525 		}
   520 
   526 
   521 		/* translators: Default privacy policy heading. */
   527 		/* translators: Default privacy policy heading. */
   522 		$strings[] = '<h2>' . __( 'Cookies' ) . '</h2>';
   528 		$strings[] = '<h2 class="wp-block-heading">' . __( 'Cookies' ) . '</h2>';
   523 
   529 
   524 		if ( $description ) {
   530 		if ( $description ) {
   525 			/* translators: Privacy policy tutorial. */
   531 			/* translators: Privacy policy tutorial. */
   526 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list the cookies your web site uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '</p>';
   532 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list the cookies your website uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '</p>';
   527 		} else {
   533 		} else {
   528 			/* translators: Default privacy policy text. */
   534 			/* translators: Default privacy policy text. */
   529 			$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>';
   535 			$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>';
   530 			/* translators: Default privacy policy text. */
   536 			/* translators: Default privacy policy text. */
   531 			$strings[] = '<p>' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';
   537 			$strings[] = '<p>' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';
   535 			$strings[] = '<p>' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '</p>';
   541 			$strings[] = '<p>' . __( 'If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.' ) . '</p>';
   536 		}
   542 		}
   537 
   543 
   538 		if ( ! $description ) {
   544 		if ( ! $description ) {
   539 			/* translators: Default privacy policy heading. */
   545 			/* translators: Default privacy policy heading. */
   540 			$strings[] = '<h2>' . __( 'Embedded content from other websites' ) . '</h2>';
   546 			$strings[] = '<h2 class="wp-block-heading">' . __( 'Embedded content from other websites' ) . '</h2>';
   541 			/* translators: Default privacy policy text. */
   547 			/* translators: Default privacy policy text. */
   542 			$strings[] = '<p>' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '</p>';
   548 			$strings[] = '<p>' . $suggested_text . __( 'Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.' ) . '</p>';
   543 			/* translators: Default privacy policy text. */
   549 			/* translators: Default privacy policy text. */
   544 			$strings[] = '<p>' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '</p>';
   550 			$strings[] = '<p>' . __( 'These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.' ) . '</p>';
   545 		}
   551 		}
   552 			/* translators: Privacy policy tutorial. */
   558 			/* translators: Privacy policy tutorial. */
   553 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any analytics data. However, many web hosting accounts collect some anonymous analytics data. You may also have installed a WordPress plugin that provides analytics services. In that case, add information from that plugin here.' ) . '</p>';
   559 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any analytics data. However, many web hosting accounts collect some anonymous analytics data. You may also have installed a WordPress plugin that provides analytics services. In that case, add information from that plugin here.' ) . '</p>';
   554 		}
   560 		}
   555 
   561 
   556 		/* translators: Default privacy policy heading. */
   562 		/* translators: Default privacy policy heading. */
   557 		$strings[] = '<h2>' . __( 'Who we share your data with' ) . '</h2>';
   563 		$strings[] = '<h2 class="wp-block-heading">' . __( 'Who we share your data with' ) . '</h2>';
   558 
   564 
   559 		if ( $description ) {
   565 		if ( $description ) {
   560 			/* translators: Privacy policy tutorial. */
   566 			/* translators: Privacy policy tutorial. */
   561 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '</p>';
   567 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should name and list all third party providers with whom you share site data, including partners, cloud-based services, payment processors, and third party service providers, and note what data you share with them and why. Link to their own privacy policies if possible.' ) . '</p>';
   562 			/* translators: Privacy policy tutorial. */
   568 			/* translators: Privacy policy tutorial. */
   565 			/* translators: Default privacy policy text. */
   571 			/* translators: Default privacy policy text. */
   566 			$strings[] = '<p>' . $suggested_text . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '</p>';
   572 			$strings[] = '<p>' . $suggested_text . __( 'If you request a password reset, your IP address will be included in the reset email.' ) . '</p>';
   567 		}
   573 		}
   568 
   574 
   569 		/* translators: Default privacy policy heading. */
   575 		/* translators: Default privacy policy heading. */
   570 		$strings[] = '<h2>' . __( 'How long we retain your data' ) . '</h2>';
   576 		$strings[] = '<h2 class="wp-block-heading">' . __( 'How long we retain your data' ) . '</h2>';
   571 
   577 
   572 		if ( $description ) {
   578 		if ( $description ) {
   573 			/* translators: Privacy policy tutorial. */
   579 			/* translators: Privacy policy tutorial. */
   574 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain how long you retain personal data collected or processed by the web site. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>';
   580 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain how long you retain personal data collected or processed by the website. While it is your responsibility to come up with the schedule of how long you keep each dataset for and why you keep it, that information does need to be listed here. For example, you may want to say that you keep contact form entries for six months, analytics records for a year, and customer purchase records for ten years.' ) . '</p>';
   575 		} else {
   581 		} else {
   576 			/* translators: Default privacy policy text. */
   582 			/* translators: Default privacy policy text. */
   577 			$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>';
   583 			$strings[] = '<p>' . $suggested_text . __( 'If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.' ) . '</p>';
   578 			/* translators: Default privacy policy text. */
   584 			/* translators: Default privacy policy text. */
   579 			$strings[] = '<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>';
   585 			$strings[] = '<p>' . __( 'For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.' ) . '</p>';
   580 		}
   586 		}
   581 
   587 
   582 		/* translators: Default privacy policy heading. */
   588 		/* translators: Default privacy policy heading. */
   583 		$strings[] = '<h2>' . __( 'What rights you have over your data' ) . '</h2>';
   589 		$strings[] = '<h2 class="wp-block-heading">' . __( 'What rights you have over your data' ) . '</h2>';
   584 
   590 
   585 		if ( $description ) {
   591 		if ( $description ) {
   586 			/* translators: Privacy policy tutorial. */
   592 			/* translators: Privacy policy tutorial. */
   587 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>';
   593 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what rights your users have over their data and how they can invoke those rights.' ) . '</p>';
   588 		} else {
   594 		} else {
   589 			/* translators: Default privacy policy text. */
   595 			/* translators: Default privacy policy text. */
   590 			$strings[] = '<p>' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
   596 			$strings[] = '<p>' . $suggested_text . __( 'If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.' ) . '</p>';
   591 		}
   597 		}
   592 
   598 
   593 		/* translators: Default privacy policy heading. */
   599 		/* translators: Default privacy policy heading. */
   594 		$strings[] = '<h2>' . __( 'Where your data is sent' ) . '</h2>';
   600 		$strings[] = '<h2 class="wp-block-heading">' . __( 'Where your data is sent' ) . '</h2>';
   595 
   601 
   596 		if ( $description ) {
   602 		if ( $description ) {
   597 			/* translators: Privacy policy tutorial. */
   603 			/* translators: Privacy policy tutorial. */
   598 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>';
   604 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should list all transfers of your site data outside the European Union and describe the means by which that data is safeguarded to European data protection standards. This could include your web hosting, cloud storage, or other third party services.' ) . '</p>';
   599 			/* translators: Privacy policy tutorial. */
   605 			/* translators: Privacy policy tutorial. */
   633 
   639 
   634 		if ( $description ) {
   640 		if ( $description ) {
   635 			/* translators: Default privacy policy heading. */
   641 			/* translators: Default privacy policy heading. */
   636 			$strings[] = '<h2>' . __( 'What third parties we receive data from' ) . '</h2>';
   642 			$strings[] = '<h2>' . __( 'What third parties we receive data from' ) . '</h2>';
   637 			/* translators: Privacy policy tutorial. */
   643 			/* translators: Privacy policy tutorial. */
   638 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>';
   644 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your website receives data about users from third parties, including advertisers, this information must be included within the section of your privacy policy dealing with third party data.' ) . '</p>';
   639 		}
   645 		}
   640 
   646 
   641 		if ( $description ) {
   647 		if ( $description ) {
   642 			/* translators: Default privacy policy heading. */
   648 			/* translators: Default privacy policy heading. */
   643 			$strings[] = '<h2>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h2>';
   649 			$strings[] = '<h2>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h2>';
   644 			/* translators: Privacy policy tutorial. */
   650 			/* translators: Privacy policy tutorial. */
   645 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your web site provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>';
   651 			$strings[] = '<p class="privacy-policy-tutorial">' . __( 'If your website provides a service which includes automated decision making - for example, allowing customers to apply for credit, or aggregating their data into an advertising profile - you must note that this is taking place, and include information about how that information is used, what decisions are made with that aggregated data, and what rights users have over decisions made without human intervention.' ) . '</p>';
   646 		}
   652 		}
   647 
   653 
   648 		if ( $description ) {
   654 		if ( $description ) {
   649 			/* translators: Default privacy policy heading. */
   655 			/* translators: Default privacy policy heading. */
   650 			$strings[] = '<h2>' . __( 'Industry regulatory disclosure requirements' ) . '</h2>';
   656 			$strings[] = '<h2>' . __( 'Industry regulatory disclosure requirements' ) . '</h2>';
   653 			$strings[] = '</div>';
   659 			$strings[] = '</div>';
   654 		}
   660 		}
   655 
   661 
   656 		if ( $blocks ) {
   662 		if ( $blocks ) {
   657 			foreach ( $strings as $key => $string ) {
   663 			foreach ( $strings as $key => $string ) {
   658 				if ( 0 === strpos( $string, '<p>' ) ) {
   664 				if ( str_starts_with( $string, '<p>' ) ) {
   659 					$strings[ $key ] = '<!-- wp:paragraph -->' . $string . '<!-- /wp:paragraph -->';
   665 					$strings[ $key ] = "<!-- wp:paragraph -->\n" . $string . "\n<!-- /wp:paragraph -->\n";
   660 				}
   666 				}
   661 
   667 
   662 				if ( 0 === strpos( $string, '<h2>' ) ) {
   668 				if ( str_starts_with( $string, '<h2 ' ) ) {
   663 					$strings[ $key ] = '<!-- wp:heading -->' . $string . '<!-- /wp:heading -->';
   669 					$strings[ $key ] = "<!-- wp:heading -->\n" . $string . "\n<!-- /wp:heading -->\n";
   664 				}
   670 				}
   665 			}
   671 			}
   666 		}
   672 		}
   667 
   673 
   668 		$content = implode( '', $strings );
   674 		$content = implode( '', $strings );
   687 			'wp_add_privacy_policy_content()'
   693 			'wp_add_privacy_policy_content()'
   688 		);
   694 		);
   689 	}
   695 	}
   690 
   696 
   691 	/**
   697 	/**
   692 	 * Add the suggested privacy policy text to the policy postbox.
   698 	 * Adds the suggested privacy policy text to the policy postbox.
   693 	 *
   699 	 *
   694 	 * @since 4.9.6
   700 	 * @since 4.9.6
   695 	 */
   701 	 */
   696 	public static function add_suggested_content() {
   702 	public static function add_suggested_content() {
   697 		$content = self::get_default_content( false, false );
   703 		$content = self::get_default_content( false, false );