[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/includes/ -> class-wp-privacy-policy-content.php (source)

   1  <?php
   2  /**
   3   * WP_Privacy_Policy_Content class.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   * @since 4.9.6
   8   */
   9  
  10  final class WP_Privacy_Policy_Content {
  11  
  12      private static $policy_content = array();
  13  
  14      /**
  15       * Constructor
  16       *
  17       * @since 4.9.6
  18       */
  19  	private function __construct() {}
  20  
  21      /**
  22       * Add content to the postbox shown when editing the privacy policy.
  23       *
  24       * 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       * and will be shown in the Suggested Privacy Policy Content postbox.
  27       *
  28       * Intended for use from `wp_add_privacy_policy_content()`.
  29       *
  30       * @since 4.9.6
  31       *
  32       * @param string $plugin_name The name of the plugin or theme that is suggesting content for the site's privacy policy.
  33       * @param string $policy_text The suggested content for inclusion in the policy.
  34       */
  35  	public static function add( $plugin_name, $policy_text ) {
  36          if ( empty( $plugin_name ) || empty( $policy_text ) ) {
  37              return;
  38          }
  39  
  40          $data = array(
  41              'plugin_name' => $plugin_name,
  42              'policy_text' => $policy_text,
  43          );
  44  
  45          if ( ! in_array( $data, self::$policy_content, true ) ) {
  46              self::$policy_content[] = $data;
  47          }
  48      }
  49  
  50      /**
  51       * Quick check if any privacy info has changed.
  52       *
  53       * @since 4.9.6
  54       */
  55  	public static function text_change_check() {
  56  
  57          $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
  58  
  59          // The site doesn't have a privacy policy.
  60          if ( empty( $policy_page_id ) ) {
  61              return false;
  62          }
  63  
  64          if ( ! current_user_can( 'edit_post', $policy_page_id ) ) {
  65              return false;
  66          }
  67  
  68          $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
  69  
  70          // Updates are not relevant if the user has not reviewed any suggestions yet.
  71          if ( empty( $old ) ) {
  72              return false;
  73          }
  74  
  75          $cached = get_option( '_wp_suggested_policy_text_has_changed' );
  76  
  77          /*
  78           * When this function is called before `admin_init`, `self::$policy_content`
  79           * has not been populated yet, so use the cached result from the last
  80           * execution instead.
  81           */
  82          if ( ! did_action( 'admin_init' ) ) {
  83              return 'changed' === $cached;
  84          }
  85  
  86          $new = self::$policy_content;
  87  
  88          // Remove the extra values added to the meta.
  89          foreach ( $old as $key => $data ) {
  90              if ( ! empty( $data['removed'] ) ) {
  91                  unset( $old[ $key ] );
  92                  continue;
  93              }
  94  
  95              $old[ $key ] = array(
  96                  'plugin_name' => $data['plugin_name'],
  97                  'policy_text' => $data['policy_text'],
  98              );
  99          }
 100  
 101          // Normalize the order of texts, to facilitate comparison.
 102          sort( $old );
 103          sort( $new );
 104  
 105          // The == operator (equal, not identical) was used intentionally.
 106          // See http://php.net/manual/en/language.operators.array.php
 107          if ( $new != $old ) {
 108              // A plugin was activated or deactivated, or some policy text has changed.
 109              // Show a notice on the relevant screens to inform the admin.
 110              add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'policy_text_changed_notice' ) );
 111              $state = 'changed';
 112          } else {
 113              $state = 'not-changed';
 114          }
 115  
 116          // Cache the result for use before `admin_init` (see above).
 117          if ( $cached !== $state ) {
 118              update_option( '_wp_suggested_policy_text_has_changed', $state );
 119          }
 120  
 121          return 'changed' === $state;
 122      }
 123  
 124      /**
 125       * Output a warning when some privacy info has changed.
 126       *
 127       * @since 4.9.6
 128       */
 129  	public static function policy_text_changed_notice() {
 130          global $post;
 131  
 132          $screen = get_current_screen()->id;
 133  
 134          if ( 'privacy' !== $screen ) {
 135              return;
 136          }
 137  
 138          ?>
 139          <div class="policy-text-updated notice notice-warning is-dismissible">
 140              <p>
 141              <?php
 142                  printf(
 143                      /* translators: %s: Privacy Policy Guide URL. */
 144                      __( 'The suggested privacy policy text has changed. Please <a href="%s">review the guide</a> and update your privacy policy.' ),
 145                      esc_url( admin_url( 'privacy-policy-guide.php' ) )
 146                  );
 147              ?>
 148              </p>
 149          </div>
 150          <?php
 151      }
 152  
 153      /**
 154       * Update the cached policy info when the policy page is updated.
 155       *
 156       * @since 4.9.6
 157       * @access private
 158       */
 159  	public static function _policy_page_updated( $post_id ) {
 160          $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
 161  
 162          if ( ! $policy_page_id || $policy_page_id !== (int) $post_id ) {
 163              return;
 164          }
 165  
 166          // Remove updated|removed status.
 167          $old          = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
 168          $done         = array();
 169          $update_cache = false;
 170  
 171          foreach ( $old as $old_key => $old_data ) {
 172              if ( ! empty( $old_data['removed'] ) ) {
 173                  // Remove the old policy text.
 174                  $update_cache = true;
 175                  continue;
 176              }
 177  
 178              if ( ! empty( $old_data['updated'] ) ) {
 179                  // 'updated' is now 'added'.
 180                  $done[]       = array(
 181                      'plugin_name' => $old_data['plugin_name'],
 182                      'policy_text' => $old_data['policy_text'],
 183                      'added'       => $old_data['updated'],
 184                  );
 185                  $update_cache = true;
 186              } else {
 187                  $done[] = $old_data;
 188              }
 189          }
 190  
 191          if ( $update_cache ) {
 192              delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
 193              // Update the cache.
 194              foreach ( $done as $data ) {
 195                  add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
 196              }
 197          }
 198      }
 199  
 200      /**
 201       * Check for updated, added or removed privacy policy information from plugins.
 202       *
 203       * Caches the current info in post_meta of the policy page.
 204       *
 205       * @since 4.9.6
 206       *
 207       * @return array The privacy policy text/information added by core and plugins.
 208       */
 209  	public static function get_suggested_policy_text() {
 210          $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
 211          $checked        = array();
 212          $time           = time();
 213          $update_cache   = false;
 214          $new            = self::$policy_content;
 215          $old            = array();
 216  
 217          if ( $policy_page_id ) {
 218              $old = (array) get_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
 219          }
 220  
 221          // Check for no-changes and updates.
 222          foreach ( $new as $new_key => $new_data ) {
 223              foreach ( $old as $old_key => $old_data ) {
 224                  $found = false;
 225  
 226                  if ( $new_data['policy_text'] === $old_data['policy_text'] ) {
 227                      // Use the new plugin name in case it was changed, translated, etc.
 228                      if ( $old_data['plugin_name'] !== $new_data['plugin_name'] ) {
 229                          $old_data['plugin_name'] = $new_data['plugin_name'];
 230                          $update_cache            = true;
 231                      }
 232  
 233                      // A plugin was re-activated.
 234                      if ( ! empty( $old_data['removed'] ) ) {
 235                          unset( $old_data['removed'] );
 236                          $old_data['added'] = $time;
 237                          $update_cache      = true;
 238                      }
 239  
 240                      $checked[] = $old_data;
 241                      $found     = true;
 242                  } elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) {
 243                      // The info for the policy was updated.
 244                      $checked[]    = array(
 245                          'plugin_name' => $new_data['plugin_name'],
 246                          'policy_text' => $new_data['policy_text'],
 247                          'updated'     => $time,
 248                      );
 249                      $found        = true;
 250                      $update_cache = true;
 251                  }
 252  
 253                  if ( $found ) {
 254                      unset( $new[ $new_key ], $old[ $old_key ] );
 255                      continue 2;
 256                  }
 257              }
 258          }
 259  
 260          if ( ! empty( $new ) ) {
 261              // A plugin was activated.
 262              foreach ( $new as $new_data ) {
 263                  if ( ! empty( $new_data['plugin_name'] ) && ! empty( $new_data['policy_text'] ) ) {
 264                      $new_data['added'] = $time;
 265                      $checked[]         = $new_data;
 266                  }
 267              }
 268              $update_cache = true;
 269          }
 270  
 271          if ( ! empty( $old ) ) {
 272              // A plugin was deactivated.
 273              foreach ( $old as $old_data ) {
 274                  if ( ! empty( $old_data['plugin_name'] ) && ! empty( $old_data['policy_text'] ) ) {
 275                      $data = array(
 276                          'plugin_name' => $old_data['plugin_name'],
 277                          'policy_text' => $old_data['policy_text'],
 278                          'removed'     => $time,
 279                      );
 280  
 281                      $checked[] = $data;
 282                  }
 283              }
 284              $update_cache = true;
 285          }
 286  
 287          if ( $update_cache && $policy_page_id ) {
 288              delete_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content' );
 289              // Update the cache.
 290              foreach ( $checked as $data ) {
 291                  add_post_meta( $policy_page_id, '_wp_suggested_privacy_policy_content', $data );
 292              }
 293          }
 294  
 295          return $checked;
 296      }
 297  
 298      /**
 299       * Add a notice with a link to the guide when editing the privacy policy page.
 300       *
 301       * @since 4.9.6
 302       * @since 5.0.0 The `$post` parameter was made optional.
 303       *
 304       * @param WP_Post|null $post The currently edited post. Default null.
 305       */
 306  	public static function notice( $post = null ) {
 307          if ( is_null( $post ) ) {
 308              global $post;
 309          } else {
 310              $post = get_post( $post );
 311          }
 312  
 313          if ( ! ( $post instanceof WP_Post ) ) {
 314              return;
 315          }
 316  
 317          if ( ! current_user_can( 'manage_privacy_options' ) ) {
 318              return;
 319          }
 320  
 321          $current_screen = get_current_screen();
 322          $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
 323  
 324          if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) {
 325              return;
 326          }
 327  
 328          $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.' );
 329          $url     = esc_url( admin_url( 'privacy-policy-guide.php' ) );
 330          $label   = __( 'View Privacy Policy Guide.' );
 331  
 332          if ( get_current_screen()->is_block_editor() ) {
 333              wp_enqueue_script( 'wp-notices' );
 334              $action = array(
 335                  'url'   => $url,
 336                  'label' => $label,
 337              );
 338              wp_add_inline_script(
 339                  'wp-notices',
 340                  sprintf(
 341                      'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
 342                      $message,
 343                      wp_json_encode( $action )
 344                  ),
 345                  'after'
 346              );
 347          } else {
 348              ?>
 349              <div class="notice notice-warning inline wp-pp-notice">
 350                  <p>
 351                  <?php
 352                  echo $message;
 353                  printf(
 354                      ' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
 355                      $url,
 356                      $label,
 357                      /* translators: Accessibility text. */
 358                      __( '(opens in a new tab)' )
 359                  );
 360                  ?>
 361                  </p>
 362              </div>
 363              <?php
 364          }
 365      }
 366  
 367      /**
 368       * Output the privacy policy guide together with content from the theme and plugins.
 369       *
 370       * @since 4.9.6
 371       */
 372  	public static function privacy_policy_guide() {
 373  
 374          $content_array = self::get_suggested_policy_text();
 375  
 376          $content       = '';
 377          $toc           = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' );
 378          $date_format   = __( 'F j, Y' );
 379          $copy          = __( 'Copy this section to clipboard' );
 380          $return_to_top = '<a href="#" class="return-to-top">' . __( '&uarr; Return to Top' ) . '</a>';
 381  
 382          foreach ( $content_array as $section ) {
 383              $class   = '';
 384              $meta    = '';
 385              $removed = '';
 386  
 387              if ( ! empty( $section['removed'] ) ) {
 388                  $class = ' text-removed';
 389                  $date  = date_i18n( $date_format, $section['removed'] );
 390                  /* translators: %s: Date of plugin deactivation. */
 391                  $meta = sprintf( __( 'Removed %s.' ), $date );
 392  
 393                  /* translators: %s: Date of plugin deactivation. */
 394                  $removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
 395                  $removed = '<div class="error inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
 396              } elseif ( ! empty( $section['updated'] ) ) {
 397                  $class = ' text-updated';
 398                  $date  = date_i18n( $date_format, $section['updated'] );
 399                  /* translators: %s: Date of privacy policy text update. */
 400                  $meta = sprintf( __( 'Updated %s.' ), $date );
 401              }
 402  
 403              if ( $meta ) {
 404                  $meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
 405              }
 406  
 407              $plugin_name = esc_html( $section['plugin_name'] );
 408              $toc_id      = 'wp-privacy-policy-guide-' . sanitize_title( $plugin_name );
 409              $toc[]       = sprintf( '<li><a href="#%1$s">%2$s</a>' . $meta . '</li>', $toc_id, $plugin_name );
 410  
 411              $content .= '<div class="privacy-text-section' . $class . '">';
 412              $content .= '<a id="' . $toc_id . '">&nbsp;</a>';
 413              /* translators: %s: Plugin name. */
 414              $content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>';
 415              $content .= $removed;
 416  
 417              $content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';
 418              $content .= $return_to_top;
 419  
 420              if ( empty( $section['removed'] ) ) {
 421                  $content         .= '<div class="privacy-text-actions">';
 422                      $content     .= '<button type="button" class="privacy-text-copy button">';
 423                          $content .= $copy;
 424                          $content .= '<span class="screen-reader-text">';
 425                          /* translators: %s: Plugin name. */
 426                          $content .= sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
 427                          $content .= '</span>';
 428                      $content     .= '</button>';
 429                  $content         .= '</div>';
 430              }
 431  
 432              $content .= "</div>\n"; // End of .privacy-text-section.
 433          }
 434  
 435          if ( count( $toc ) > 2 ) {
 436              ?>
 437              <div  class="privacy-text-box-toc">
 438                  <p><?php _e( 'Table of Contents' ); ?></p>
 439                  <ol>
 440                      <?php echo implode( "\n", $toc ); ?>
 441                  </ol>
 442              </div>
 443              <?php
 444          }
 445  
 446          ?>
 447          <div class="privacy-text-box">
 448              <div class="privacy-text-box-head">
 449                  <a id="wp-privacy-policy-guide-introduction">&nbsp;</a>
 450                  <h2><?php _e( 'Introduction' ); ?></h2>
 451                  <p><?php _e( 'Hello,' ); ?></p>
 452                  <p><?php _e( 'This text template will help you to create your web site&#8217;s privacy policy.' ); ?></p>
 453                  <p><?php _e( 'We have suggested the sections you will need. Under each section heading you will find a short summary of what information you should provide, which will help you to get started. Some sections include suggested policy content, others will have to be completed with information from your theme and plugins.' ); ?></p>
 454                  <p><?php _e( 'Please edit your privacy policy content, making sure to delete the summaries, and adding any information from your theme and plugins. Once you publish your policy page, remember to add it to your navigation menu.' ); ?></p>
 455                  <p><?php _e( 'It is your responsibility to write a comprehensive privacy policy, to make sure it reflects all national and international legal requirements on privacy, and to keep your policy current and accurate.' ); ?></p>
 456              </div>
 457  
 458              <div class="privacy-text-box-body">
 459                  <?php echo $content; ?>
 460              </div>
 461          </div>
 462          <?php
 463      }
 464  
 465      /**
 466       * Return the default suggested privacy policy content.
 467       *
 468       * @since 4.9.6
 469       * @since 5.0.0 Added the `$blocks` parameter.
 470       *
 471       * @param bool $description Whether to include the descriptions under the section headings. Default false.
 472       * @param bool $blocks      Whether to format the content for the block editor. Default true.
 473       * @return string The default policy content.
 474       */
 475  	public static function get_default_content( $description = false, $blocks = true ) {
 476          $suggested_text = $description ? '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>' : '';
 477          $content        = '';
 478          $strings        = array();
 479  
 480          // Start of the suggested privacy policy text.
 481          if ( $description ) {
 482              $strings[] = '<div class="wp-suggested-text">';
 483          }
 484  
 485          /* translators: Default privacy policy heading. */
 486          $strings[] = '<h2>' . __( 'Who we are' ) . '</h2>';
 487  
 488          if ( $description ) {
 489              /* translators: Privacy policy tutorial. */
 490              $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>';
 491              /* translators: Privacy policy tutorial. */
 492              $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>';
 493          }
 494  
 495          /* translators: Default privacy policy text. %s: Site URL. */
 496          $strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>';
 497  
 498          /* translators: Default privacy policy heading. */
 499          $strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>';
 500  
 501          if ( $description ) {
 502              /* translators: Privacy policy tutorial. */
 503              $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>';
 504              /* translators: Privacy policy tutorial. */
 505              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>';
 506              /* translators: Privacy policy tutorial. */
 507              $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>';
 508              /* translators: Privacy policy tutorial. */
 509              $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>';
 510              /* translators: Privacy policy tutorial. */
 511              $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>';
 512          }
 513  
 514          /* translators: Default privacy policy heading. */
 515          $strings[] = '<h3>' . __( 'Comments' ) . '</h3>';
 516  
 517          if ( $description ) {
 518              /* translators: Privacy policy tutorial. */
 519              $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>';
 520          }
 521  
 522          /* translators: Default privacy policy text. */
 523          $strings[] = '<p>' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor&#8217;s IP address and browser user agent string to help spam detection.' ) . '</p>';
 524          /* translators: Default privacy policy text. */
 525          $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>';
 526  
 527          /* translators: Default privacy policy heading. */
 528          $strings[] = '<h3>' . __( 'Media' ) . '</h3>';
 529  
 530          if ( $description ) {
 531              /* translators: Privacy policy tutorial. */
 532              $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>';
 533          }
 534  
 535          /* translators: Default privacy policy text. */
 536          $strings[] = '<p>' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>';
 537  
 538          /* translators: Default privacy policy heading. */
 539          $strings[] = '<h3>' . __( 'Contact forms' ) . '</h3>';
 540  
 541          if ( $description ) {
 542              /* translators: Privacy policy tutorial. */
 543              $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>';
 544          }
 545  
 546          /* translators: Default privacy policy heading. */
 547          $strings[] = '<h3>' . __( 'Cookies' ) . '</h3>';
 548  
 549          if ( $description ) {
 550              /* translators: Privacy policy tutorial. */
 551              $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>';
 552          }
 553  
 554          /* translators: Default privacy policy text. */
 555          $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>';
 556          /* translators: Default privacy policy text. */
 557          $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>';
 558          /* translators: Default privacy policy text. */
 559          $strings[] = '<p>' . __( 'When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select &quot;Remember Me&quot;, your login will persist for two weeks. If you log out of your account, the login cookies will be removed.' ) . '</p>';
 560          /* translators: Default privacy policy text. */
 561          $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>';
 562  
 563          /* translators: Default privacy policy heading. */
 564          $strings[] = '<h3>' . __( 'Embedded content from other websites' ) . '</h3>';
 565          /* translators: Default privacy policy text. */
 566          $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>';
 567          /* translators: Default privacy policy text. */
 568          $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>';
 569  
 570          /* translators: Default privacy policy heading. */
 571          $strings[] = '<h3>' . __( 'Analytics' ) . '</h3>';
 572  
 573          if ( $description ) {
 574              /* translators: Privacy policy tutorial. */
 575              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what analytics package you use, how users can opt out of analytics tracking, and a link to your analytics provider&#8217;s privacy policy, if any.' ) . '</p>';
 576              /* translators: Privacy policy tutorial. */
 577              $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>';
 578          }
 579  
 580          /* translators: Default privacy policy heading. */
 581          $strings[] = '<h2>' . __( 'Who we share your data with' ) . '</h2>';
 582  
 583          if ( $description ) {
 584              /* translators: Privacy policy tutorial. */
 585              $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>';
 586              /* translators: Privacy policy tutorial. */
 587              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not share any personal data with anyone.' ) . '</p>';
 588          }
 589  
 590          /* translators: Default privacy policy heading. */
 591          $strings[] = '<h2>' . __( 'How long we retain your data' ) . '</h2>';
 592  
 593          if ( $description ) {
 594              /* translators: Privacy policy tutorial. */
 595              $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>';
 596          }
 597  
 598          /* translators: Default privacy policy text. */
 599          $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>';
 600          /* translators: Default privacy policy text. */
 601          $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>';
 602  
 603          /* translators: Default privacy policy heading. */
 604          $strings[] = '<h2>' . __( 'What rights you have over your data' ) . '</h2>';
 605  
 606          if ( $description ) {
 607              /* translators: Privacy policy tutorial. */
 608              $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>';
 609          }
 610  
 611          /* translators: Default privacy policy text. */
 612          $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>';
 613  
 614          /* translators: Default privacy policy heading. */
 615          $strings[] = '<h2>' . __( 'Where we send your data' ) . '</h2>';
 616  
 617          if ( $description ) {
 618              /* translators: Privacy policy tutorial. */
 619              $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>';
 620              /* translators: Privacy policy tutorial. */
 621              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'European data protection law requires data about European residents which is transferred outside the European Union to be safeguarded to the same standards as if the data was in Europe. So in addition to listing where data goes, you should describe how you ensure that these standards are met either by yourself or by your third party providers, whether that is through an agreement such as Privacy Shield, model clauses in your contracts, or binding corporate rules.' ) . '</p>';
 622          }
 623  
 624          /* translators: Default privacy policy text. */
 625          $strings[] = '<p>' . $suggested_text . __( 'Visitor comments may be checked through an automated spam detection service.' ) . '</p>';
 626  
 627          /* translators: Default privacy policy heading. */
 628          $strings[] = '<h2>' . __( 'Your contact information' ) . '</h2>';
 629  
 630          if ( $description ) {
 631              /* translators: Privacy policy tutorial. */
 632              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should provide a contact method for privacy-specific concerns. If you are required to have a Data Protection Officer, list their name and full contact details here as well.' ) . '</p>';
 633          }
 634  
 635          /* translators: Default privacy policy heading. */
 636          $strings[] = '<h2>' . __( 'Additional information' ) . '</h2>';
 637  
 638          if ( $description ) {
 639              /* translators: Privacy policy tutorial. */
 640              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you use your site for commercial purposes and you engage in more complex collection or processing of personal data, you should note the following information in your privacy policy in addition to the information we have already discussed.' ) . '</p>';
 641          }
 642  
 643          /* translators: Default privacy policy heading. */
 644          $strings[] = '<h3>' . __( 'How we protect your data' ) . '</h3>';
 645  
 646          if ( $description ) {
 647              /* translators: Privacy policy tutorial. */
 648              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what measures you have taken to protect your users&#8217; data. This could include technical measures such as encryption; security measures such as two factor authentication; and measures such as staff training in data protection. If you have carried out a Privacy Impact Assessment, you can mention it here too.' ) . '</p>';
 649          }
 650  
 651          /* translators: Default privacy policy heading. */
 652          $strings[] = '<h3>' . __( 'What data breach procedures we have in place' ) . '</h3>';
 653  
 654          if ( $description ) {
 655              /* translators: Privacy policy tutorial. */
 656              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should explain what procedures you have in place to deal with data breaches, either potential or real, such as internal reporting systems, contact mechanisms, or bug bounties.' ) . '</p>';
 657          }
 658  
 659          /* translators: Default privacy policy heading. */
 660          $strings[] = '<h3>' . __( 'What third parties we receive data from' ) . '</h3>';
 661  
 662          if ( $description ) {
 663              /* translators: Privacy policy tutorial. */
 664              $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>';
 665          }
 666  
 667          /* translators: Default privacy policy heading. */
 668          $strings[] = '<h3>' . __( 'What automated decision making and/or profiling we do with user data' ) . '</h3>';
 669  
 670          if ( $description ) {
 671              /* translators: Privacy policy tutorial. */
 672              $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>';
 673          }
 674  
 675          /* translators: Default privacy policy heading. */
 676          $strings[] = '<h3>' . __( 'Industry regulatory disclosure requirements' ) . '</h3>';
 677  
 678          if ( $description ) {
 679              /* translators: Privacy policy tutorial. */
 680              $strings[] = '<p class="privacy-policy-tutorial">' . __( 'If you are a member of a regulated industry, or if you are subject to additional privacy laws, you may be required to disclose that information here.' ) . '</p>';
 681              $strings[] = '</div>';
 682          }
 683  
 684          if ( $blocks ) {
 685              foreach ( $strings as $key => $string ) {
 686                  if ( 0 === strpos( $string, '<p>' ) ) {
 687                      $strings[ $key ] = '<!-- wp:paragraph -->' . $string . '<!-- /wp:paragraph -->';
 688                  }
 689  
 690                  if ( 0 === strpos( $string, '<h2>' ) ) {
 691                      $strings[ $key ] = '<!-- wp:heading -->' . $string . '<!-- /wp:heading -->';
 692                  }
 693  
 694                  if ( 0 === strpos( $string, '<h3>' ) ) {
 695                      $strings[ $key ] = '<!-- wp:heading {"level":3} -->' . $string . '<!-- /wp:heading -->';
 696                  }
 697              }
 698          }
 699  
 700          $content = implode( '', $strings );
 701          // End of the suggested privacy policy text.
 702  
 703          /**
 704           * Filters the default content suggested for inclusion in a privacy policy.
 705           *
 706           * @since 4.9.6
 707           * @since 5.0.0 Added the `$strings`, `$description`, and `$blocks` parameters.
 708           *
 709           * @param string   $content     The default policy content.
 710           * @param string[] $strings     An array of privacy policy content strings.
 711           * @param bool     $description Whether policy descriptions should be included.
 712           * @param bool     $blocks      Whether the content should be formatted for the block editor.
 713           */
 714          return apply_filters( 'wp_get_default_privacy_policy_content', $content, $strings, $description, $blocks );
 715      }
 716  
 717      /**
 718       * Add the suggested privacy policy text to the policy postbox.
 719       *
 720       * @since 4.9.6
 721       */
 722  	public static function add_suggested_content() {
 723          $content = self::get_default_content( true, false );
 724          wp_add_privacy_policy_content( __( 'WordPress' ), $content );
 725      }
 726  }


Generated: Wed Feb 26 01:00:04 2020 Cross-referenced by PHPXref 0.7.1