wp/wp-admin/privacy.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    37 				&& current_user_can( 'edit_theme_options' )
    37 				&& current_user_can( 'edit_theme_options' )
    38 				&& current_theme_supports( 'menus' )
    38 				&& current_theme_supports( 'menus' )
    39 			) {
    39 			) {
    40 				$privacy_page_updated_message = sprintf(
    40 				$privacy_page_updated_message = sprintf(
    41 					/* translators: %s: URL to Customizer -> Menus */
    41 					/* translators: %s: URL to Customizer -> Menus */
    42 					__( 'Privacy Policy page updated successfully. Remember to <a href="%s">update your menus</a>!' ),
    42 					__( 'Privacy Policy page setting updated successfully. Remember to <a href="%s">update your menus</a>!' ),
    43 					esc_url( add_query_arg( 'autofocus[panel]', 'nav_menus', admin_url( 'customize.php' ) ) )
    43 					esc_url( add_query_arg( 'autofocus[panel]', 'nav_menus', admin_url( 'customize.php' ) ) )
    44 				);
    44 				);
    45 			}
    45 			}
    46 		}
    46 		}
    47 
    47 
    56 		if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
    56 		if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
    57 			require_once( ABSPATH . 'wp-admin/includes/misc.php' );
    57 			require_once( ABSPATH . 'wp-admin/includes/misc.php' );
    58 		}
    58 		}
    59 
    59 
    60 		$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
    60 		$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
    61 		$privacy_policy_page_id = wp_insert_post(
    61 		$privacy_policy_page_id      = wp_insert_post(
    62 			array(
    62 			array(
    63 				'post_title'   => __( 'Privacy Policy' ),
    63 				'post_title'   => __( 'Privacy Policy' ),
    64 				'post_status'  => 'draft',
    64 				'post_status'  => 'draft',
    65 				'post_type'    => 'page',
    65 				'post_type'    => 'page',
    66 				'post_content' => $privacy_policy_page_content,
    66 				'post_content' => $privacy_policy_page_content,
   154 		?>
   154 		?>
   155 		<p class="tools-privacy-edit"><strong>
   155 		<p class="tools-privacy-edit"><strong>
   156 			<?php
   156 			<?php
   157 
   157 
   158 			if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
   158 			if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
   159 				/* translators: 1: URL to edit page, 2: URL to view page */
   159 				printf(
   160 				printf( __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ), $edit_href, $view_href );
   160 					/* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page */
       
   161 					__( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ),
       
   162 					esc_url( $edit_href ),
       
   163 					esc_url( $view_href )
       
   164 				);
   161 			} else {
   165 			} else {
   162 				/* translators: 1: URL to edit page, 2: URL to preview page */
   166 				printf(
   163 				printf( __( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ), $edit_href, $view_href );
   167 					/* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page */
       
   168 					__( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ),
       
   169 					esc_url( $edit_href ),
       
   170 					esc_url( $view_href )
       
   171 				);
   164 			}
   172 			}
   165 
   173 
   166 			?>
   174 			?>
   167 		</strong></p>
   175 		</strong></p>
   168 		<p>
       
   169 			<?php
       
   170 
       
   171 			/* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: accessibility text */
       
   172 			printf(
       
   173 				__( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
       
   174 				admin_url( 'tools.php?wp-privacy-policy-guide' ),
       
   175 				'',
       
   176 				''
       
   177 			);
       
   178 
       
   179 			?>
       
   180 		</p>
       
   181 		<?php
   176 		<?php
   182 	}
   177 	}
   183 	?>
   178 	?>
       
   179 	<p>
       
   180 		<?php
       
   181 
       
   182 		printf(
       
   183 			/* translators: 1: Privacy Policy guide URL, 2: additional link attributes, 3: accessibility text */
       
   184 			__( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
       
   185 			esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) ),
       
   186 			'',
       
   187 			''
       
   188 		);
       
   189 
       
   190 		?>
       
   191 	</p>
       
   192 
   184 	<hr>
   193 	<hr>
   185 	<table class="form-table tools-privacy-policy-page">
   194 	<table class="form-table tools-privacy-policy-page" role="presentation">
   186 		<tr>
   195 		<tr>
   187 			<th scope="row">
   196 			<th scope="row"><label for="page_for_privacy_policy">
   188 				<?php
   197 				<?php
   189 				if ( $privacy_policy_page_exists ) {
   198 				if ( $privacy_policy_page_exists ) {
   190 					_e( 'Change your Privacy Policy page' );
   199 					_e( 'Change your Privacy Policy page' );
   191 				} else {
   200 				} else {
   192 					_e( 'Select a Privacy Policy page' );
   201 					_e( 'Select a Privacy Policy page' );
   193 				}
   202 				}
   194 				?>
   203 				?>
   195 			</th>
   204 			</label></th>
   196 			<td>
   205 			<td>
   197 				<?php
   206 				<?php
   198 				$has_pages = (bool) get_posts( array(
   207 				$has_pages = (bool) get_posts(
   199 					'post_type' => 'page',
   208 					array(
   200 					'posts_per_page' => 1,
   209 						'post_type'      => 'page',
   201 					'post_status' => array(
   210 						'posts_per_page' => 1,
   202 						'publish',
   211 						'post_status'    => array(
   203 						'draft',
   212 							'publish',
   204 					),
   213 							'draft',
   205 				) );
   214 						),
   206 
   215 					)
   207 				if ( $has_pages ) : ?>
   216 				);
       
   217 
       
   218 				if ( $has_pages ) :
       
   219 					?>
   208 					<form method="post" action="">
   220 					<form method="post" action="">
   209 						<label for="page_for_privacy_policy">
       
   210 							<?php _e( 'Select an existing page:' ); ?>
       
   211 						</label>
       
   212 						<input type="hidden" name="action" value="set-privacy-page" />
   221 						<input type="hidden" name="action" value="set-privacy-page" />
   213 						<?php
   222 						<?php
   214 						wp_dropdown_pages(
   223 						wp_dropdown_pages(
   215 							array(
   224 							array(
   216 								'name'              => 'page_for_privacy_policy',
   225 								'name'              => 'page_for_privacy_policy',