Skip to content

Commit

Permalink
Privacy: fixes for the privacy policy guide and suggested content:
Browse files Browse the repository at this point in the history
- Separate the guide text form the suggested policy text.
- Add table of content for easier navigation.
- Move the content to tools.php (prevents the settings menu of being open).
- Add a link to the guide from the Privacy settings screen.

Props melchoyce, azaozz.
See #43980.
Built from https://develop.svn.wordpress.org/trunk@43203


git-svn-id: http://core.svn.wordpress.org/trunk@43032 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
azaozz committed May 9, 2018
1 parent ae3e918 commit 35d5911
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 145 deletions.
26 changes: 9 additions & 17 deletions wp-admin/css/edit-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ span.wp-media-buttons-icon:before {
}

/* Suggested text for privacy policy */
.wp-suggested-policy-content {
.wp-privacy-policy-guide {
max-width: 1000px;
}

Expand All @@ -671,8 +671,8 @@ span.wp-media-buttons-icon:before {
margin-right: 2em;
}

.wp-suggested-policy-content h3 {
font-size: 1em;
.wp-privacy-policy-guide h3 {
font-size: 1.2em;
margin: 1em 0 0.5em;
}

Expand All @@ -685,24 +685,15 @@ span.wp-media-buttons-icon:before {
border-top: 1px solid #e3e3e3;
}

.privacy-text-section.text-updated {
padding: 1px 15px;
border-right: 4px solid #46b450;
background-color: #ecf7ed;
}

.privacy-text-box-head,
.privacy-text-section.text-removed {
padding: 1px 12px 1px 14px;
border-right: 4px solid #dc3232;
background-color: #fbeaea;
padding-bottom: 12px;
}

.privacy-text-meta {
font-size: 11px;
.text-removed .policy-text {
font-style: italic;
color: #6C7781;
color: #666;
font-weight: 600;
margin-top: -12px;
}

.privacy-text-actions {
Expand All @@ -711,7 +702,7 @@ span.wp-media-buttons-icon:before {
padding-bottom: 6px;
}

.wp-suggested-policy-content .policy-text h2 {
.wp-privacy-policy-guide .policy-text h2 {
margin: 1.2em 0 1em;
padding: 0;
}
Expand Down Expand Up @@ -1674,6 +1665,7 @@ table.links-table {
.privacy-text-box-toc {
float: none;
width: auto;
height: 100%;
}

.privacy-text-section a.return-to-top {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/edit-rtl.min.css

Large diffs are not rendered by default.

26 changes: 9 additions & 17 deletions wp-admin/css/edit.css
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ span.wp-media-buttons-icon:before {
}

/* Suggested text for privacy policy */
.wp-suggested-policy-content {
.wp-privacy-policy-guide {
max-width: 1000px;
}

Expand All @@ -671,8 +671,8 @@ span.wp-media-buttons-icon:before {
margin-left: 2em;
}

.wp-suggested-policy-content h3 {
font-size: 1em;
.wp-privacy-policy-guide h3 {
font-size: 1.2em;
margin: 1em 0 0.5em;
}

Expand All @@ -685,24 +685,15 @@ span.wp-media-buttons-icon:before {
border-top: 1px solid #e3e3e3;
}

.privacy-text-section.text-updated {
padding: 1px 15px;
border-left: 4px solid #46b450;
background-color: #ecf7ed;
}

.privacy-text-box-head,
.privacy-text-section.text-removed {
padding: 1px 14px 1px 12px;
border-left: 4px solid #dc3232;
background-color: #fbeaea;
padding-bottom: 12px;
}

.privacy-text-meta {
font-size: 11px;
.text-removed .policy-text {
font-style: italic;
color: #6C7781;
color: #666;
font-weight: 600;
margin-top: -12px;
}

.privacy-text-actions {
Expand All @@ -711,7 +702,7 @@ span.wp-media-buttons-icon:before {
padding-bottom: 6px;
}

.wp-suggested-policy-content .policy-text h2 {
.wp-privacy-policy-guide .policy-text h2 {
margin: 1.2em 0 1em;
padding: 0;
}
Expand Down Expand Up @@ -1674,6 +1665,7 @@ table.links-table {
.privacy-text-box-toc {
float: none;
width: auto;
height: 100%;
}

.privacy-text-section a.return-to-top {
Expand Down
2 changes: 1 addition & 1 deletion wp-admin/css/edit.min.css

Large diffs are not rendered by default.

144 changes: 92 additions & 52 deletions wp-admin/includes/misc.php

Large diffs are not rendered by default.

46 changes: 19 additions & 27 deletions wp-admin/privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@
wp_die( __( 'Sorry, you are not allowed to manage privacy on this site.' ) );
}

if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
}

// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );

$action = isset( $_POST['action'] ) ? $_POST['action'] : '';

if ( ! empty( $action ) ) {
Expand All @@ -41,6 +34,10 @@
);
} elseif ( 'create-privacy-page' === $action ) {

if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
require_once( ABSPATH . 'wp-admin/includes/misc.php' );
}

$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
$privacy_policy_page_id = wp_insert_post(
array(
Expand Down Expand Up @@ -105,20 +102,6 @@

?>
<div class="wrap">
<?php

if ( isset( $_GET['wp-suggested-policy-content'] ) ) {

?>
<h1><?php _e( 'Privacy Policy Guide' ); ?></h1>
<div class="wp-suggested-policy-content">
<?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
</div>
<?php

} else {

?>
<h1><?php _e( 'Privacy Settings' ); ?></h1>
<h2><?php _e( 'Privacy Policy page' ); ?></h2>
<p>
Expand All @@ -134,6 +117,7 @@
<?php _e( 'We would also suggest reviewing your privacy policy from time to time, especially after an update. There may be changes or new suggested information for you to consider adding to your policy.' ); ?>
</p>
<?php

if ( $privacy_policy_page_exists ) {
$edit_href = add_query_arg(
array(
Expand All @@ -144,17 +128,26 @@
);

$view_href = get_permalink( $privacy_policy_page_id );

?>
<p class="tools-privacy-edit"><strong>
<?php

/* translators: 1: URL to edit page, 2: URL to view page */
printf( __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy page content.' ), $edit_href, $view_href );

?>
</strong></p>
<p>
<?php

printf(
/* translators: 1: URL to edit page, 2: URL to view page */
__( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy page content.' ),
$edit_href,
$view_href
__( 'Need help putting together your new Privacy Policy page? %s for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
'<a href="' . admin_url( 'tools.php?wp-privacy-policy-guide' ) . '">' . __( 'Check out our guide' ) . '</a>'
);

?>
</strong></p>
</p>
<?php
}
?>
Expand Down Expand Up @@ -209,6 +202,5 @@
</table>
</div>
<?php
} // End if/else isset( $_GET['wp-suggested-policy-content'] ).

include( ABSPATH . 'wp-admin/admin-footer.php' );
80 changes: 51 additions & 29 deletions wp-admin/tools.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,45 +9,67 @@
/** WordPress Administration Bootstrap */
require_once( dirname( __FILE__ ) . '/admin.php' );

$title = __('Tools');
$is_privacy_guide = ( isset( $_GET['wp-privacy-policy-guide'] ) && current_user_can( 'manage_privacy_options' ) );

get_current_screen()->add_help_tab( array(
'id' => 'converter',
'title' => __('Categories and Tags Converter'),
'content' => '<p>' . __('Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
'<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
) );
if ( $is_privacy_guide ) {
$title = __( 'Privacy Policy Guide' );

get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
);
// "Borrow" xfn.js for now so we don't have to create new files.
wp_enqueue_script( 'xfn' );

} else {

$title = __('Tools');

get_current_screen()->add_help_tab( array(
'id' => 'converter',
'title' => __('Categories and Tags Converter'),
'content' => '<p>' . __('Categories have hierarchy, meaning that you can nest sub-categories. Tags do not have hierarchy and cannot be nested. Sometimes people start out using one on their posts, then later realize that the other would work better for their content.' ) . '</p>' .
'<p>' . __( 'The Categories and Tags Converter link on this screen will take you to the Import screen, where that Converter is one of the plugins you can install. Once that plugin is installed, the Activate Plugin &amp; Run Importer link will take you to a screen where you can choose to convert tags into categories or vice versa.' ) . '</p>',
) );

get_current_screen()->set_help_sidebar(
'<p><strong>' . __('For more information:') . '</strong></p>' .
'<p>' . __('<a href="https://codex.wordpress.org/Tools_Screen">Documentation on Tools</a>') . '</p>' .
'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
);
}

require_once( ABSPATH . 'wp-admin/admin-header.php' );

?>
<div class="wrap">
<h1><?php echo esc_html( $title ); ?></h1>
<?php
if ( current_user_can( 'import' ) ) :
$cats = get_taxonomy('category');
$tags = get_taxonomy('post_tag');
if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
<div class="card">
<h2 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h2>
<p><?php printf( __('If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.'), 'import.php' ); ?></p>
</div>
<?php
endif;
endif;

/**
* Fires at the end of the Tools Administration screen.
*
* @since 2.8.0
*/
do_action( 'tool_box' );
if ( $is_privacy_guide ) {
?>
<div class="wp-privacy-policy-guide">
<?php WP_Privacy_Policy_Content::privacy_policy_guide(); ?>
</div>
<?php

} else {

if ( current_user_can( 'import' ) ) :
$cats = get_taxonomy('category');
$tags = get_taxonomy('post_tag');
if ( current_user_can($cats->cap->manage_terms) || current_user_can($tags->cap->manage_terms) ) : ?>
<div class="card">
<h2 class="title"><?php _e( 'Categories and Tags Converter' ) ?></h2>
<p><?php printf( __('If you want to convert your categories to tags (or vice versa), use the <a href="%s">Categories and Tags Converter</a> available from the Import screen.'), 'import.php' ); ?></p>
</div>
<?php
endif;
endif;

/**
* Fires at the end of the Tools Administration screen.
*
* @since 2.8.0
*/
do_action( 'tool_box' );
}
?>
</div>
<?php
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-43201';
$wp_version = '5.0-alpha-43203';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 35d5911

Please sign in to comment.