W3cubDocs

/WordPress

WP_Privacy_Policy_Content::privacy_policy_guide()

Output the privacy policy guide together with content from the theme and plugins.

Source

File: wp-admin/includes/class-wp-privacy-policy-content.php

public static function privacy_policy_guide() {

		$content_array = self::get_suggested_policy_text();
		$content       = '';
		$toc           = array( '<li><a href="#wp-privacy-policy-guide-introduction">' . __( 'Introduction' ) . '</a></li>' );
		$date_format   = __( 'F j, Y' );

		foreach ( $content_array as $section ) {
			$class   = '';
			$meta    = '';
			$removed = '';

			if ( ! empty( $section['removed'] ) ) {
				$class = 'text-removed';
				$date  = date_i18n( $date_format, $section['removed'] );
				/* translators: %s: Date of plugin deactivation. */
				$meta = sprintf( __( 'Removed %s.' ), $date );

				/* translators: %s: Date of plugin deactivation. */
				$removed = __( 'You deactivated this plugin on %s and may no longer need this policy.' );
				$removed = '<div class="notice notice-info inline"><p>' . sprintf( $removed, $date ) . '</p></div>';
			} elseif ( ! empty( $section['updated'] ) ) {
				$class = 'text-updated';
				$date  = date_i18n( $date_format, $section['updated'] );
				/* translators: %s: Date of privacy policy text update. */
				$meta = sprintf( __( 'Updated %s.' ), $date );
			}

			if ( $meta ) {
				$meta = '<br><span class="privacy-text-meta">' . $meta . '</span>';
			}

			$plugin_name = esc_html( $section['plugin_name'] );
			$toc_id      = 'wp-privacy-policy-guide-' . sanitize_title( $plugin_name );
			$toc[]       = sprintf( '<li><a href="#%1$s">%2$s</a>' . $meta . '</li>', $toc_id, $plugin_name );

			$content .= '<div class="privacy-text-section ' . $class . '">';
			$content .= '<a id="' . $toc_id . '">&nbsp;</a>';
			/* translators: %s: Plugin name. */
			$content .= '<h2>' . sprintf( __( 'Source: %s' ), $plugin_name ) . '</h2>';
			$content .= $removed;

			$content .= '<div class="policy-text">' . $section['policy_text'] . '</div>';

			if ( empty( $section['removed'] ) ) {
				$content .= '<div class="privacy-text-actions">';
				$content .= '<button type="button" class="privacy-text-copy button">';
				$content .= __( 'Copy this section to clipboard' );
				$content .= '</button>';
				$content .= '<span class="success" aria-hidden="true">' . __( 'Copied!' ) . '</span>';
				$content .= '</div>';
			}

			$content .= '<a href="#wpbody" class="return-to-top"><span aria-hidden="true">&uarr; </span> ' . __( 'Return to top' ) . '</a>';

			$content .= '</div>'; // End of .privacy-text-section.
		}

		if ( count( $toc ) > 2 ) {
			?>
			<div class="privacy-text-box-toc">
				<p><?php _e( 'Table of Contents' ); ?></p>
				<ol>
					<?php echo implode( $toc ); ?>
				</ol>
			</div>
			<?php
		}

		?>
		<div class="privacy-text-box">
			<div class="privacy-text-box-head">
				<a id="wp-privacy-policy-guide-introduction">&nbsp;</a>
				<h2><?php _e( 'Introduction' ); ?></h2>
				<p><?php _e( 'Hello,' ); ?></p>
				<p><?php _e( 'This text template will help you to create your web site&#8217;s privacy policy.' ); ?></p>
				<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>
				<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>
				<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>
			</div>

			<div class="privacy-text-box-body">
				<?php echo $content; ?>
			</div>
		</div>
		<?php
	}

Changelog

Version Description
4.9.6 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/privacy_policy_guide