Edit File by line
/home/barbar84/public_h.../wp-admin
File: options-privacy.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Privacy Settings Screen.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
* @subpackage Administration
[5] Fix | Delete
*/
[6] Fix | Delete
[7] Fix | Delete
/** WordPress Administration Bootstrap */
[8] Fix | Delete
require_once __DIR__ . '/admin.php';
[9] Fix | Delete
[10] Fix | Delete
if ( ! current_user_can( 'manage_privacy_options' ) ) {
[11] Fix | Delete
wp_die( __( 'Sorry, you are not allowed to manage privacy options on this site.' ) );
[12] Fix | Delete
}
[13] Fix | Delete
[14] Fix | Delete
if ( isset( $_GET['tab'] ) && 'policyguide' === $_GET['tab'] ) {
[15] Fix | Delete
require_once( dirname( __FILE__ ) . '/privacy-policy-guide.php' );
[16] Fix | Delete
return;
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
add_filter(
[20] Fix | Delete
'admin_body_class',
[21] Fix | Delete
function( $body_class ) {
[22] Fix | Delete
$body_class .= ' privacy-settings ';
[23] Fix | Delete
[24] Fix | Delete
return $body_class;
[25] Fix | Delete
}
[26] Fix | Delete
);
[27] Fix | Delete
[28] Fix | Delete
$action = isset( $_POST['action'] ) ? $_POST['action'] : '';
[29] Fix | Delete
[30] Fix | Delete
if ( ! empty( $action ) ) {
[31] Fix | Delete
check_admin_referer( $action );
[32] Fix | Delete
[33] Fix | Delete
if ( 'set-privacy-page' === $action ) {
[34] Fix | Delete
$privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? (int) $_POST['page_for_privacy_policy'] : 0;
[35] Fix | Delete
update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
[36] Fix | Delete
[37] Fix | Delete
$privacy_page_updated_message = __( 'Privacy Policy page updated successfully.' );
[38] Fix | Delete
[39] Fix | Delete
if ( $privacy_policy_page_id ) {
[40] Fix | Delete
/*
[41] Fix | Delete
* Don't always link to the menu customizer:
[42] Fix | Delete
*
[43] Fix | Delete
* - Unpublished pages can't be selected by default.
[44] Fix | Delete
* - `WP_Customize_Nav_Menus::__construct()` checks the user's capabilities.
[45] Fix | Delete
* - Themes might not "officially" support menus.
[46] Fix | Delete
*/
[47] Fix | Delete
if (
[48] Fix | Delete
'publish' === get_post_status( $privacy_policy_page_id )
[49] Fix | Delete
&& current_user_can( 'edit_theme_options' )
[50] Fix | Delete
&& current_theme_supports( 'menus' )
[51] Fix | Delete
) {
[52] Fix | Delete
$privacy_page_updated_message = sprintf(
[53] Fix | Delete
/* translators: %s: URL to Customizer -> Menus. */
[54] Fix | Delete
__( 'Privacy Policy page setting updated successfully. Remember to <a href="%s">update your menus</a>!' ),
[55] Fix | Delete
esc_url( add_query_arg( 'autofocus[panel]', 'nav_menus', admin_url( 'customize.php' ) ) )
[56] Fix | Delete
);
[57] Fix | Delete
}
[58] Fix | Delete
}
[59] Fix | Delete
[60] Fix | Delete
add_settings_error( 'page_for_privacy_policy', 'page_for_privacy_policy', $privacy_page_updated_message, 'success' );
[61] Fix | Delete
} elseif ( 'create-privacy-page' === $action ) {
[62] Fix | Delete
[63] Fix | Delete
if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
[64] Fix | Delete
require_once ABSPATH . 'wp-admin/includes/class-wp-privacy-policy-content.php';
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
$privacy_policy_page_content = WP_Privacy_Policy_Content::get_default_content();
[68] Fix | Delete
$privacy_policy_page_id = wp_insert_post(
[69] Fix | Delete
array(
[70] Fix | Delete
'post_title' => __( 'Privacy Policy' ),
[71] Fix | Delete
'post_status' => 'draft',
[72] Fix | Delete
'post_type' => 'page',
[73] Fix | Delete
'post_content' => $privacy_policy_page_content,
[74] Fix | Delete
),
[75] Fix | Delete
true
[76] Fix | Delete
);
[77] Fix | Delete
[78] Fix | Delete
if ( is_wp_error( $privacy_policy_page_id ) ) {
[79] Fix | Delete
add_settings_error(
[80] Fix | Delete
'page_for_privacy_policy',
[81] Fix | Delete
'page_for_privacy_policy',
[82] Fix | Delete
__( 'Unable to create a Privacy Policy page.' ),
[83] Fix | Delete
'error'
[84] Fix | Delete
);
[85] Fix | Delete
} else {
[86] Fix | Delete
update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
[87] Fix | Delete
[88] Fix | Delete
wp_redirect( admin_url( 'post.php?post=' . $privacy_policy_page_id . '&action=edit' ) );
[89] Fix | Delete
exit;
[90] Fix | Delete
}
[91] Fix | Delete
}
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
// If a Privacy Policy page ID is available, make sure the page actually exists. If not, display an error.
[95] Fix | Delete
$privacy_policy_page_exists = false;
[96] Fix | Delete
$privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
[97] Fix | Delete
[98] Fix | Delete
if ( ! empty( $privacy_policy_page_id ) ) {
[99] Fix | Delete
[100] Fix | Delete
$privacy_policy_page = get_post( $privacy_policy_page_id );
[101] Fix | Delete
[102] Fix | Delete
if ( ! $privacy_policy_page instanceof WP_Post ) {
[103] Fix | Delete
add_settings_error(
[104] Fix | Delete
'page_for_privacy_policy',
[105] Fix | Delete
'page_for_privacy_policy',
[106] Fix | Delete
__( 'The currently selected Privacy Policy page does not exist. Please create or select a new page.' ),
[107] Fix | Delete
'error'
[108] Fix | Delete
);
[109] Fix | Delete
} else {
[110] Fix | Delete
if ( 'trash' === $privacy_policy_page->post_status ) {
[111] Fix | Delete
add_settings_error(
[112] Fix | Delete
'page_for_privacy_policy',
[113] Fix | Delete
'page_for_privacy_policy',
[114] Fix | Delete
sprintf(
[115] Fix | Delete
/* translators: %s: URL to Pages Trash. */
[116] Fix | Delete
__( 'The currently selected Privacy Policy page is in the Trash. Please create or select a new Privacy Policy page or <a href="%s">restore the current page</a>.' ),
[117] Fix | Delete
'edit.php?post_status=trash&post_type=page'
[118] Fix | Delete
),
[119] Fix | Delete
'error'
[120] Fix | Delete
);
[121] Fix | Delete
} else {
[122] Fix | Delete
$privacy_policy_page_exists = true;
[123] Fix | Delete
}
[124] Fix | Delete
}
[125] Fix | Delete
}
[126] Fix | Delete
[127] Fix | Delete
$parent_file = 'options-general.php';
[128] Fix | Delete
[129] Fix | Delete
wp_enqueue_script( 'privacy-tools' );
[130] Fix | Delete
[131] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-header.php';
[132] Fix | Delete
[133] Fix | Delete
?>
[134] Fix | Delete
<div class="privacy-settings-header">
[135] Fix | Delete
<div class="privacy-settings-title-section">
[136] Fix | Delete
<h1>
[137] Fix | Delete
<?php _e( 'Privacy' ); ?>
[138] Fix | Delete
</h1>
[139] Fix | Delete
</div>
[140] Fix | Delete
[141] Fix | Delete
<nav class="privacy-settings-tabs-wrapper hide-if-no-js" aria-label="<?php esc_attr_e( 'Secondary menu' ); ?>">
[142] Fix | Delete
<a href="<?php echo esc_url( admin_url( 'options-privacy.php' ) ); ?>" class="privacy-settings-tab active" aria-current="true">
[143] Fix | Delete
<?php
[144] Fix | Delete
/* translators: Tab heading for Site Health Status page. */
[145] Fix | Delete
_ex( 'Settings', 'Privacy Settings' );
[146] Fix | Delete
?>
[147] Fix | Delete
</a>
[148] Fix | Delete
[149] Fix | Delete
<a href="<?php echo esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ); ?>" class="privacy-settings-tab">
[150] Fix | Delete
<?php
[151] Fix | Delete
/* translators: Tab heading for Site Health Status page. */
[152] Fix | Delete
_ex( 'Policy Guide', 'Privacy Settings' );
[153] Fix | Delete
?>
[154] Fix | Delete
</a>
[155] Fix | Delete
</nav>
[156] Fix | Delete
</div>
[157] Fix | Delete
[158] Fix | Delete
<hr class="wp-header-end">
[159] Fix | Delete
[160] Fix | Delete
<div class="notice notice-error hide-if-js">
[161] Fix | Delete
<p><?php _e( 'The Privacy Settings require JavaScript.' ); ?></p>
[162] Fix | Delete
</div>
[163] Fix | Delete
[164] Fix | Delete
<div class="privacy-settings-body hide-if-no-js">
[165] Fix | Delete
<h2><?php _e( 'Privacy Settings' ); ?></h2>
[166] Fix | Delete
<p>
[167] Fix | Delete
<?php _e( 'As a website owner, you may need to follow national or international privacy laws. For example, you may need to create and display a Privacy Policy.' ); ?>
[168] Fix | Delete
<?php _e( 'If you already have a Privacy Policy page, please select it below. If not, please create one.' ); ?>
[169] Fix | Delete
</p>
[170] Fix | Delete
<p>
[171] Fix | Delete
<?php _e( 'The new page will include help and suggestions for your Privacy Policy.' ); ?>
[172] Fix | Delete
<?php _e( 'However, it is your responsibility to use those resources correctly, to provide the information that your Privacy Policy requires, and to keep that information current and accurate.' ); ?>
[173] Fix | Delete
</p>
[174] Fix | Delete
<p>
[175] Fix | Delete
<?php _e( 'After your Privacy Policy page is set, we suggest that you edit it.' ); ?>
[176] Fix | Delete
<?php _e( 'We would also suggest reviewing your Privacy Policy from time to time, especially after installing or updating any themes or plugins. There may be changes or new suggested information for you to consider adding to your policy.' ); ?>
[177] Fix | Delete
</p>
[178] Fix | Delete
<p>
[179] Fix | Delete
<?php
[180] Fix | Delete
if ( $privacy_policy_page_exists ) {
[181] Fix | Delete
$edit_href = add_query_arg(
[182] Fix | Delete
array(
[183] Fix | Delete
'post' => $privacy_policy_page_id,
[184] Fix | Delete
'action' => 'edit',
[185] Fix | Delete
),
[186] Fix | Delete
admin_url( 'post.php' )
[187] Fix | Delete
);
[188] Fix | Delete
$view_href = get_permalink( $privacy_policy_page_id );
[189] Fix | Delete
?>
[190] Fix | Delete
<strong>
[191] Fix | Delete
<?php
[192] Fix | Delete
if ( 'publish' === get_post_status( $privacy_policy_page_id ) ) {
[193] Fix | Delete
printf(
[194] Fix | Delete
/* translators: 1: URL to edit Privacy Policy page, 2: URL to view Privacy Policy page. */
[195] Fix | Delete
__( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your Privacy Policy page content.' ),
[196] Fix | Delete
esc_url( $edit_href ),
[197] Fix | Delete
esc_url( $view_href )
[198] Fix | Delete
);
[199] Fix | Delete
} else {
[200] Fix | Delete
printf(
[201] Fix | Delete
/* translators: 1: URL to edit Privacy Policy page, 2: URL to preview Privacy Policy page. */
[202] Fix | Delete
__( '<a href="%1$s">Edit</a> or <a href="%2$s">preview</a> your Privacy Policy page content.' ),
[203] Fix | Delete
esc_url( $edit_href ),
[204] Fix | Delete
esc_url( $view_href )
[205] Fix | Delete
);
[206] Fix | Delete
}
[207] Fix | Delete
?>
[208] Fix | Delete
</strong>
[209] Fix | Delete
<?php
[210] Fix | Delete
}
[211] Fix | Delete
printf(
[212] Fix | Delete
/* translators: 1: Privacy Policy guide URL, 2: Additional link attributes, 3: Accessibility text. */
[213] Fix | Delete
__( 'Need help putting together your new Privacy Policy page? <a href="%1$s" %2$s>Check out our Privacy Policy guide%3$s</a> for recommendations on what content to include, along with policies suggested by your plugins and theme.' ),
[214] Fix | Delete
esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) ),
[215] Fix | Delete
'',
[216] Fix | Delete
''
[217] Fix | Delete
);
[218] Fix | Delete
?>
[219] Fix | Delete
</p>
[220] Fix | Delete
<hr>
[221] Fix | Delete
<?php
[222] Fix | Delete
$has_pages = (bool) get_posts(
[223] Fix | Delete
array(
[224] Fix | Delete
'post_type' => 'page',
[225] Fix | Delete
'posts_per_page' => 1,
[226] Fix | Delete
'post_status' => array(
[227] Fix | Delete
'publish',
[228] Fix | Delete
'draft',
[229] Fix | Delete
),
[230] Fix | Delete
)
[231] Fix | Delete
);
[232] Fix | Delete
?>
[233] Fix | Delete
<table class="form-table tools-privacy-policy-page" role="presentation">
[234] Fix | Delete
<tr>
[235] Fix | Delete
<th scope="row">
[236] Fix | Delete
<label for="create-page">
[237] Fix | Delete
<?php
[238] Fix | Delete
if ( $has_pages ) {
[239] Fix | Delete
_e( 'Create a new Privacy Policy Page' );
[240] Fix | Delete
} else {
[241] Fix | Delete
_e( 'There are no pages.' );
[242] Fix | Delete
}
[243] Fix | Delete
?>
[244] Fix | Delete
</label>
[245] Fix | Delete
</th>
[246] Fix | Delete
<td>
[247] Fix | Delete
<form class="wp-create-privacy-page" method="post" action="">
[248] Fix | Delete
<input type="hidden" name="action" value="create-privacy-page" />
[249] Fix | Delete
<?php
[250] Fix | Delete
wp_nonce_field( 'create-privacy-page' );
[251] Fix | Delete
submit_button( __( 'Create' ), 'secondary', 'submit', false, array( 'id' => 'create-page' ) );
[252] Fix | Delete
?>
[253] Fix | Delete
</form>
[254] Fix | Delete
</td>
[255] Fix | Delete
</tr>
[256] Fix | Delete
<?php if ( $has_pages ) : ?>
[257] Fix | Delete
<tr>
[258] Fix | Delete
<th scope="row">
[259] Fix | Delete
<label for="page_for_privacy_policy">
[260] Fix | Delete
<?php
[261] Fix | Delete
if ( $privacy_policy_page_exists ) {
[262] Fix | Delete
_e( 'Change your Privacy Policy page' );
[263] Fix | Delete
} else {
[264] Fix | Delete
_e( 'Select a Privacy Policy page' );
[265] Fix | Delete
}
[266] Fix | Delete
?>
[267] Fix | Delete
</label>
[268] Fix | Delete
</th>
[269] Fix | Delete
<td>
[270] Fix | Delete
<form method="post" action="">
[271] Fix | Delete
<input type="hidden" name="action" value="set-privacy-page" />
[272] Fix | Delete
<?php
[273] Fix | Delete
wp_dropdown_pages(
[274] Fix | Delete
array(
[275] Fix | Delete
'name' => 'page_for_privacy_policy',
[276] Fix | Delete
'show_option_none' => __( '&mdash; Select &mdash;' ),
[277] Fix | Delete
'option_none_value' => '0',
[278] Fix | Delete
'selected' => $privacy_policy_page_id,
[279] Fix | Delete
'post_status' => array( 'draft', 'publish' ),
[280] Fix | Delete
)
[281] Fix | Delete
);
[282] Fix | Delete
[283] Fix | Delete
wp_nonce_field( 'set-privacy-page' );
[284] Fix | Delete
[285] Fix | Delete
submit_button( __( 'Use This Page' ), 'primary', 'submit', false, array( 'id' => 'set-page' ) );
[286] Fix | Delete
?>
[287] Fix | Delete
</form>
[288] Fix | Delete
</td>
[289] Fix | Delete
</tr>
[290] Fix | Delete
<?php endif; ?>
[291] Fix | Delete
</table>
[292] Fix | Delete
</div>
[293] Fix | Delete
<?php
[294] Fix | Delete
[295] Fix | Delete
require_once ABSPATH . 'wp-admin/admin-footer.php';
[296] Fix | Delete
[297] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function