Edit File by line
/home/barbar84/www/wp-admin/includes
File: misc.php
$icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors;
[1000] Fix | Delete
} elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
[1001] Fix | Delete
$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
[1002] Fix | Delete
} else {
[1003] Fix | Delete
// Fall back to the default set of icon colors if the default scheme is missing.
[1004] Fix | Delete
$icon_colors = array(
[1005] Fix | Delete
'base' => '#a7aaad',
[1006] Fix | Delete
'focus' => '#72aee6',
[1007] Fix | Delete
'current' => '#fff',
[1008] Fix | Delete
);
[1009] Fix | Delete
}
[1010] Fix | Delete
[1011] Fix | Delete
echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
[1012] Fix | Delete
}
[1013] Fix | Delete
[1014] Fix | Delete
/**
[1015] Fix | Delete
* Displays the viewport meta in the admin.
[1016] Fix | Delete
*
[1017] Fix | Delete
* @since 5.5.0
[1018] Fix | Delete
*/
[1019] Fix | Delete
function wp_admin_viewport_meta() {
[1020] Fix | Delete
/**
[1021] Fix | Delete
* Filters the viewport meta in the admin.
[1022] Fix | Delete
*
[1023] Fix | Delete
* @since 5.5.0
[1024] Fix | Delete
*
[1025] Fix | Delete
* @param string $viewport_meta The viewport meta.
[1026] Fix | Delete
*/
[1027] Fix | Delete
$viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' );
[1028] Fix | Delete
[1029] Fix | Delete
if ( empty( $viewport_meta ) ) {
[1030] Fix | Delete
return;
[1031] Fix | Delete
}
[1032] Fix | Delete
[1033] Fix | Delete
echo '<meta name="viewport" content="' . esc_attr( $viewport_meta ) . '">';
[1034] Fix | Delete
}
[1035] Fix | Delete
[1036] Fix | Delete
/**
[1037] Fix | Delete
* Adds viewport meta for mobile in Customizer.
[1038] Fix | Delete
*
[1039] Fix | Delete
* Hooked to the {@see 'admin_viewport_meta'} filter.
[1040] Fix | Delete
*
[1041] Fix | Delete
* @since 5.5.0
[1042] Fix | Delete
*
[1043] Fix | Delete
* @param string $viewport_meta The viewport meta.
[1044] Fix | Delete
* @return string Filtered viewport meta.
[1045] Fix | Delete
*/
[1046] Fix | Delete
function _customizer_mobile_viewport_meta( $viewport_meta ) {
[1047] Fix | Delete
return trim( $viewport_meta, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2';
[1048] Fix | Delete
}
[1049] Fix | Delete
[1050] Fix | Delete
/**
[1051] Fix | Delete
* Check lock status for posts displayed on the Posts screen
[1052] Fix | Delete
*
[1053] Fix | Delete
* @since 3.6.0
[1054] Fix | Delete
*
[1055] Fix | Delete
* @param array $response The Heartbeat response.
[1056] Fix | Delete
* @param array $data The $_POST data sent.
[1057] Fix | Delete
* @param string $screen_id The screen ID.
[1058] Fix | Delete
* @return array The Heartbeat response.
[1059] Fix | Delete
*/
[1060] Fix | Delete
function wp_check_locked_posts( $response, $data, $screen_id ) {
[1061] Fix | Delete
$checked = array();
[1062] Fix | Delete
[1063] Fix | Delete
if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
[1064] Fix | Delete
foreach ( $data['wp-check-locked-posts'] as $key ) {
[1065] Fix | Delete
$post_id = absint( substr( $key, 5 ) );
[1066] Fix | Delete
if ( ! $post_id ) {
[1067] Fix | Delete
continue;
[1068] Fix | Delete
}
[1069] Fix | Delete
[1070] Fix | Delete
$user_id = wp_check_post_lock( $post_id );
[1071] Fix | Delete
if ( $user_id ) {
[1072] Fix | Delete
$user = get_userdata( $user_id );
[1073] Fix | Delete
if ( $user && current_user_can( 'edit_post', $post_id ) ) {
[1074] Fix | Delete
$send = array(
[1075] Fix | Delete
/* translators: %s: User's display name. */
[1076] Fix | Delete
'text' => sprintf( __( '%s is currently editing' ), $user->display_name ),
[1077] Fix | Delete
);
[1078] Fix | Delete
[1079] Fix | Delete
if ( get_option( 'show_avatars' ) ) {
[1080] Fix | Delete
$send['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 18 ) );
[1081] Fix | Delete
$send['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 36 ) );
[1082] Fix | Delete
}
[1083] Fix | Delete
[1084] Fix | Delete
$checked[ $key ] = $send;
[1085] Fix | Delete
}
[1086] Fix | Delete
}
[1087] Fix | Delete
}
[1088] Fix | Delete
}
[1089] Fix | Delete
[1090] Fix | Delete
if ( ! empty( $checked ) ) {
[1091] Fix | Delete
$response['wp-check-locked-posts'] = $checked;
[1092] Fix | Delete
}
[1093] Fix | Delete
[1094] Fix | Delete
return $response;
[1095] Fix | Delete
}
[1096] Fix | Delete
[1097] Fix | Delete
/**
[1098] Fix | Delete
* Check lock status on the New/Edit Post screen and refresh the lock
[1099] Fix | Delete
*
[1100] Fix | Delete
* @since 3.6.0
[1101] Fix | Delete
*
[1102] Fix | Delete
* @param array $response The Heartbeat response.
[1103] Fix | Delete
* @param array $data The $_POST data sent.
[1104] Fix | Delete
* @param string $screen_id The screen ID.
[1105] Fix | Delete
* @return array The Heartbeat response.
[1106] Fix | Delete
*/
[1107] Fix | Delete
function wp_refresh_post_lock( $response, $data, $screen_id ) {
[1108] Fix | Delete
if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
[1109] Fix | Delete
$received = $data['wp-refresh-post-lock'];
[1110] Fix | Delete
$send = array();
[1111] Fix | Delete
[1112] Fix | Delete
$post_id = absint( $received['post_id'] );
[1113] Fix | Delete
if ( ! $post_id ) {
[1114] Fix | Delete
return $response;
[1115] Fix | Delete
}
[1116] Fix | Delete
[1117] Fix | Delete
if ( ! current_user_can( 'edit_post', $post_id ) ) {
[1118] Fix | Delete
return $response;
[1119] Fix | Delete
}
[1120] Fix | Delete
[1121] Fix | Delete
$user_id = wp_check_post_lock( $post_id );
[1122] Fix | Delete
$user = get_userdata( $user_id );
[1123] Fix | Delete
if ( $user ) {
[1124] Fix | Delete
$error = array(
[1125] Fix | Delete
/* translators: %s: User's display name. */
[1126] Fix | Delete
'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
[1127] Fix | Delete
);
[1128] Fix | Delete
[1129] Fix | Delete
if ( get_option( 'show_avatars' ) ) {
[1130] Fix | Delete
$error['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 64 ) );
[1131] Fix | Delete
$error['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 128 ) );
[1132] Fix | Delete
}
[1133] Fix | Delete
[1134] Fix | Delete
$send['lock_error'] = $error;
[1135] Fix | Delete
} else {
[1136] Fix | Delete
$new_lock = wp_set_post_lock( $post_id );
[1137] Fix | Delete
if ( $new_lock ) {
[1138] Fix | Delete
$send['new_lock'] = implode( ':', $new_lock );
[1139] Fix | Delete
}
[1140] Fix | Delete
}
[1141] Fix | Delete
[1142] Fix | Delete
$response['wp-refresh-post-lock'] = $send;
[1143] Fix | Delete
}
[1144] Fix | Delete
[1145] Fix | Delete
return $response;
[1146] Fix | Delete
}
[1147] Fix | Delete
[1148] Fix | Delete
/**
[1149] Fix | Delete
* Check nonce expiration on the New/Edit Post screen and refresh if needed
[1150] Fix | Delete
*
[1151] Fix | Delete
* @since 3.6.0
[1152] Fix | Delete
*
[1153] Fix | Delete
* @param array $response The Heartbeat response.
[1154] Fix | Delete
* @param array $data The $_POST data sent.
[1155] Fix | Delete
* @param string $screen_id The screen ID.
[1156] Fix | Delete
* @return array The Heartbeat response.
[1157] Fix | Delete
*/
[1158] Fix | Delete
function wp_refresh_post_nonces( $response, $data, $screen_id ) {
[1159] Fix | Delete
if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
[1160] Fix | Delete
$received = $data['wp-refresh-post-nonces'];
[1161] Fix | Delete
$response['wp-refresh-post-nonces'] = array( 'check' => 1 );
[1162] Fix | Delete
[1163] Fix | Delete
$post_id = absint( $received['post_id'] );
[1164] Fix | Delete
if ( ! $post_id ) {
[1165] Fix | Delete
return $response;
[1166] Fix | Delete
}
[1167] Fix | Delete
[1168] Fix | Delete
if ( ! current_user_can( 'edit_post', $post_id ) ) {
[1169] Fix | Delete
return $response;
[1170] Fix | Delete
}
[1171] Fix | Delete
[1172] Fix | Delete
$response['wp-refresh-post-nonces'] = array(
[1173] Fix | Delete
'replace' => array(
[1174] Fix | Delete
'getpermalinknonce' => wp_create_nonce( 'getpermalink' ),
[1175] Fix | Delete
'samplepermalinknonce' => wp_create_nonce( 'samplepermalink' ),
[1176] Fix | Delete
'closedpostboxesnonce' => wp_create_nonce( 'closedpostboxes' ),
[1177] Fix | Delete
'_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ),
[1178] Fix | Delete
'_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ),
[1179] Fix | Delete
),
[1180] Fix | Delete
);
[1181] Fix | Delete
}
[1182] Fix | Delete
[1183] Fix | Delete
return $response;
[1184] Fix | Delete
}
[1185] Fix | Delete
[1186] Fix | Delete
/**
[1187] Fix | Delete
* Add the latest Heartbeat and REST-API nonce to the Heartbeat response.
[1188] Fix | Delete
*
[1189] Fix | Delete
* @since 5.0.0
[1190] Fix | Delete
*
[1191] Fix | Delete
* @param array $response The Heartbeat response.
[1192] Fix | Delete
* @return array The Heartbeat response.
[1193] Fix | Delete
*/
[1194] Fix | Delete
function wp_refresh_heartbeat_nonces( $response ) {
[1195] Fix | Delete
// Refresh the Rest API nonce.
[1196] Fix | Delete
$response['rest_nonce'] = wp_create_nonce( 'wp_rest' );
[1197] Fix | Delete
[1198] Fix | Delete
// Refresh the Heartbeat nonce.
[1199] Fix | Delete
$response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' );
[1200] Fix | Delete
return $response;
[1201] Fix | Delete
}
[1202] Fix | Delete
[1203] Fix | Delete
/**
[1204] Fix | Delete
* Disable suspension of Heartbeat on the Add/Edit Post screens.
[1205] Fix | Delete
*
[1206] Fix | Delete
* @since 3.8.0
[1207] Fix | Delete
*
[1208] Fix | Delete
* @global string $pagenow
[1209] Fix | Delete
*
[1210] Fix | Delete
* @param array $settings An array of Heartbeat settings.
[1211] Fix | Delete
* @return array Filtered Heartbeat settings.
[1212] Fix | Delete
*/
[1213] Fix | Delete
function wp_heartbeat_set_suspension( $settings ) {
[1214] Fix | Delete
global $pagenow;
[1215] Fix | Delete
[1216] Fix | Delete
if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
[1217] Fix | Delete
$settings['suspension'] = 'disable';
[1218] Fix | Delete
}
[1219] Fix | Delete
[1220] Fix | Delete
return $settings;
[1221] Fix | Delete
}
[1222] Fix | Delete
[1223] Fix | Delete
/**
[1224] Fix | Delete
* Autosave with heartbeat
[1225] Fix | Delete
*
[1226] Fix | Delete
* @since 3.9.0
[1227] Fix | Delete
*
[1228] Fix | Delete
* @param array $response The Heartbeat response.
[1229] Fix | Delete
* @param array $data The $_POST data sent.
[1230] Fix | Delete
* @return array The Heartbeat response.
[1231] Fix | Delete
*/
[1232] Fix | Delete
function heartbeat_autosave( $response, $data ) {
[1233] Fix | Delete
if ( ! empty( $data['wp_autosave'] ) ) {
[1234] Fix | Delete
$saved = wp_autosave( $data['wp_autosave'] );
[1235] Fix | Delete
[1236] Fix | Delete
if ( is_wp_error( $saved ) ) {
[1237] Fix | Delete
$response['wp_autosave'] = array(
[1238] Fix | Delete
'success' => false,
[1239] Fix | Delete
'message' => $saved->get_error_message(),
[1240] Fix | Delete
);
[1241] Fix | Delete
} elseif ( empty( $saved ) ) {
[1242] Fix | Delete
$response['wp_autosave'] = array(
[1243] Fix | Delete
'success' => false,
[1244] Fix | Delete
'message' => __( 'Error while saving.' ),
[1245] Fix | Delete
);
[1246] Fix | Delete
} else {
[1247] Fix | Delete
/* translators: Draft saved date format, see https://www.php.net/manual/datetime.format.php */
[1248] Fix | Delete
$draft_saved_date_format = __( 'g:i:s a' );
[1249] Fix | Delete
$response['wp_autosave'] = array(
[1250] Fix | Delete
'success' => true,
[1251] Fix | Delete
/* translators: %s: Date and time. */
[1252] Fix | Delete
'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ),
[1253] Fix | Delete
);
[1254] Fix | Delete
}
[1255] Fix | Delete
}
[1256] Fix | Delete
[1257] Fix | Delete
return $response;
[1258] Fix | Delete
}
[1259] Fix | Delete
[1260] Fix | Delete
/**
[1261] Fix | Delete
* Remove single-use URL parameters and create canonical link based on new URL.
[1262] Fix | Delete
*
[1263] Fix | Delete
* Remove specific query string parameters from a URL, create the canonical link,
[1264] Fix | Delete
* put it in the admin header, and change the current URL to match.
[1265] Fix | Delete
*
[1266] Fix | Delete
* @since 4.2.0
[1267] Fix | Delete
*/
[1268] Fix | Delete
function wp_admin_canonical_url() {
[1269] Fix | Delete
$removable_query_args = wp_removable_query_args();
[1270] Fix | Delete
[1271] Fix | Delete
if ( empty( $removable_query_args ) ) {
[1272] Fix | Delete
return;
[1273] Fix | Delete
}
[1274] Fix | Delete
[1275] Fix | Delete
// Ensure we're using an absolute URL.
[1276] Fix | Delete
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
[1277] Fix | Delete
$filtered_url = remove_query_arg( $removable_query_args, $current_url );
[1278] Fix | Delete
?>
[1279] Fix | Delete
<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
[1280] Fix | Delete
<script>
[1281] Fix | Delete
if ( window.history.replaceState ) {
[1282] Fix | Delete
window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash );
[1283] Fix | Delete
}
[1284] Fix | Delete
</script>
[1285] Fix | Delete
<?php
[1286] Fix | Delete
}
[1287] Fix | Delete
[1288] Fix | Delete
/**
[1289] Fix | Delete
* Send a referrer policy header so referrers are not sent externally from administration screens.
[1290] Fix | Delete
*
[1291] Fix | Delete
* @since 4.9.0
[1292] Fix | Delete
*/
[1293] Fix | Delete
function wp_admin_headers() {
[1294] Fix | Delete
$policy = 'strict-origin-when-cross-origin';
[1295] Fix | Delete
[1296] Fix | Delete
/**
[1297] Fix | Delete
* Filters the admin referrer policy header value.
[1298] Fix | Delete
*
[1299] Fix | Delete
* @since 4.9.0
[1300] Fix | Delete
* @since 4.9.5 The default value was changed to 'strict-origin-when-cross-origin'.
[1301] Fix | Delete
*
[1302] Fix | Delete
* @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
[1303] Fix | Delete
*
[1304] Fix | Delete
* @param string $policy The admin referrer policy header value. Default 'strict-origin-when-cross-origin'.
[1305] Fix | Delete
*/
[1306] Fix | Delete
$policy = apply_filters( 'admin_referrer_policy', $policy );
[1307] Fix | Delete
[1308] Fix | Delete
header( sprintf( 'Referrer-Policy: %s', $policy ) );
[1309] Fix | Delete
}
[1310] Fix | Delete
[1311] Fix | Delete
/**
[1312] Fix | Delete
* Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.
[1313] Fix | Delete
*
[1314] Fix | Delete
* Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache,
[1315] Fix | Delete
* so the post title and editor content are the last saved versions. Ideally this script should run first in the head.
[1316] Fix | Delete
*
[1317] Fix | Delete
* @since 4.6.0
[1318] Fix | Delete
*/
[1319] Fix | Delete
function wp_page_reload_on_back_button_js() {
[1320] Fix | Delete
?>
[1321] Fix | Delete
<script>
[1322] Fix | Delete
if ( typeof performance !== 'undefined' && performance.navigation && performance.navigation.type === 2 ) {
[1323] Fix | Delete
document.location.reload( true );
[1324] Fix | Delete
}
[1325] Fix | Delete
</script>
[1326] Fix | Delete
<?php
[1327] Fix | Delete
}
[1328] Fix | Delete
[1329] Fix | Delete
/**
[1330] Fix | Delete
* Send a confirmation request email when a change of site admin email address is attempted.
[1331] Fix | Delete
*
[1332] Fix | Delete
* The new site admin address will not become active until confirmed.
[1333] Fix | Delete
*
[1334] Fix | Delete
* @since 3.0.0
[1335] Fix | Delete
* @since 4.9.0 This function was moved from wp-admin/includes/ms.php so it's no longer Multisite specific.
[1336] Fix | Delete
*
[1337] Fix | Delete
* @param string $old_value The old site admin email address.
[1338] Fix | Delete
* @param string $value The proposed new site admin email address.
[1339] Fix | Delete
*/
[1340] Fix | Delete
function update_option_new_admin_email( $old_value, $value ) {
[1341] Fix | Delete
if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
[1342] Fix | Delete
return;
[1343] Fix | Delete
}
[1344] Fix | Delete
[1345] Fix | Delete
$hash = md5( $value . time() . wp_rand() );
[1346] Fix | Delete
$new_admin_email = array(
[1347] Fix | Delete
'hash' => $hash,
[1348] Fix | Delete
'newemail' => $value,
[1349] Fix | Delete
);
[1350] Fix | Delete
update_option( 'adminhash', $new_admin_email );
[1351] Fix | Delete
[1352] Fix | Delete
$switched_locale = switch_to_locale( get_user_locale() );
[1353] Fix | Delete
[1354] Fix | Delete
/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
[1355] Fix | Delete
$email_text = __(
[1356] Fix | Delete
'Howdy ###USERNAME###,
[1357] Fix | Delete
[1358] Fix | Delete
You recently requested to have the administration email address on
[1359] Fix | Delete
your site changed.
[1360] Fix | Delete
[1361] Fix | Delete
If this is correct, please click on the following link to change it:
[1362] Fix | Delete
###ADMIN_URL###
[1363] Fix | Delete
[1364] Fix | Delete
You can safely ignore and delete this email if you do not want to
[1365] Fix | Delete
take this action.
[1366] Fix | Delete
[1367] Fix | Delete
This email has been sent to ###EMAIL###
[1368] Fix | Delete
[1369] Fix | Delete
Regards,
[1370] Fix | Delete
All at ###SITENAME###
[1371] Fix | Delete
###SITEURL###'
[1372] Fix | Delete
);
[1373] Fix | Delete
[1374] Fix | Delete
/**
[1375] Fix | Delete
* Filters the text of the email sent when a change of site admin email address is attempted.
[1376] Fix | Delete
*
[1377] Fix | Delete
* The following strings have a special meaning and will get replaced dynamically:
[1378] Fix | Delete
* ###USERNAME### The current user's username.
[1379] Fix | Delete
* ###ADMIN_URL### The link to click on to confirm the email change.
[1380] Fix | Delete
* ###EMAIL### The proposed new site admin email address.
[1381] Fix | Delete
* ###SITENAME### The name of the site.
[1382] Fix | Delete
* ###SITEURL### The URL to the site.
[1383] Fix | Delete
*
[1384] Fix | Delete
* @since MU (3.0.0)
[1385] Fix | Delete
* @since 4.9.0 This filter is no longer Multisite specific.
[1386] Fix | Delete
*
[1387] Fix | Delete
* @param string $email_text Text in the email.
[1388] Fix | Delete
* @param array $new_admin_email {
[1389] Fix | Delete
* Data relating to the new site admin email address.
[1390] Fix | Delete
*
[1391] Fix | Delete
* @type string $hash The secure hash used in the confirmation link URL.
[1392] Fix | Delete
* @type string $newemail The proposed new site admin email address.
[1393] Fix | Delete
* }
[1394] Fix | Delete
*/
[1395] Fix | Delete
$content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
[1396] Fix | Delete
[1397] Fix | Delete
$current_user = wp_get_current_user();
[1398] Fix | Delete
$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
[1399] Fix | Delete
$content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content );
[1400] Fix | Delete
$content = str_replace( '###EMAIL###', $value, $content );
[1401] Fix | Delete
$content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content );
[1402] Fix | Delete
$content = str_replace( '###SITEURL###', home_url(), $content );
[1403] Fix | Delete
[1404] Fix | Delete
wp_mail(
[1405] Fix | Delete
$value,
[1406] Fix | Delete
sprintf(
[1407] Fix | Delete
/* translators: New admin email address notification email subject. %s: Site title. */
[1408] Fix | Delete
__( '[%s] New Admin Email Address' ),
[1409] Fix | Delete
wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES )
[1410] Fix | Delete
),
[1411] Fix | Delete
$content
[1412] Fix | Delete
);
[1413] Fix | Delete
[1414] Fix | Delete
if ( $switched_locale ) {
[1415] Fix | Delete
restore_previous_locale();
[1416] Fix | Delete
}
[1417] Fix | Delete
}
[1418] Fix | Delete
[1419] Fix | Delete
/**
[1420] Fix | Delete
* Appends '(Draft)' to draft page titles in the privacy page dropdown
[1421] Fix | Delete
* so that unpublished content is obvious.
[1422] Fix | Delete
*
[1423] Fix | Delete
* @since 4.9.8
[1424] Fix | Delete
* @access private
[1425] Fix | Delete
*
[1426] Fix | Delete
* @param string $title Page title.
[1427] Fix | Delete
* @param WP_Post $page Page data object.
[1428] Fix | Delete
* @return string Page title.
[1429] Fix | Delete
*/
[1430] Fix | Delete
function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
[1431] Fix | Delete
if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
[1432] Fix | Delete
/* translators: %s: Page title. */
[1433] Fix | Delete
$title = sprintf( __( '%s (Draft)' ), $title );
[1434] Fix | Delete
}
[1435] Fix | Delete
[1436] Fix | Delete
return $title;
[1437] Fix | Delete
}
[1438] Fix | Delete
[1439] Fix | Delete
/**
[1440] Fix | Delete
* Checks if the user needs to update PHP.
[1441] Fix | Delete
*
[1442] Fix | Delete
* @since 5.1.0
[1443] Fix | Delete
* @since 5.1.1 Added the {@see 'wp_is_php_version_acceptable'} filter.
[1444] Fix | Delete
*
[1445] Fix | Delete
* @return array|false Array of PHP version data. False on failure.
[1446] Fix | Delete
*/
[1447] Fix | Delete
function wp_check_php_version() {
[1448] Fix | Delete
$version = phpversion();
[1449] Fix | Delete
$key = md5( $version );
[1450] Fix | Delete
[1451] Fix | Delete
$response = get_site_transient( 'php_check_' . $key );
[1452] Fix | Delete
if ( false === $response ) {
[1453] Fix | Delete
$url = 'http://api.wordpress.org/core/serve-happy/1.0/';
[1454] Fix | Delete
if ( wp_http_supports( array( 'ssl' ) ) ) {
[1455] Fix | Delete
$url = set_url_scheme( $url, 'https' );
[1456] Fix | Delete
}
[1457] Fix | Delete
[1458] Fix | Delete
$url = add_query_arg( 'php_version', $version, $url );
[1459] Fix | Delete
[1460] Fix | Delete
$response = wp_remote_get( $url );
[1461] Fix | Delete
[1462] Fix | Delete
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
[1463] Fix | Delete
return false;
[1464] Fix | Delete
}
[1465] Fix | Delete
[1466] Fix | Delete
/**
[1467] Fix | Delete
* Response should be an array with:
[1468] Fix | Delete
* 'recommended_version' - string - The PHP version recommended by WordPress.
[1469] Fix | Delete
* 'is_supported' - boolean - Whether the PHP version is actively supported.
[1470] Fix | Delete
* 'is_secure' - boolean - Whether the PHP version receives security updates.
[1471] Fix | Delete
* 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress.
[1472] Fix | Delete
*/
[1473] Fix | Delete
$response = json_decode( wp_remote_retrieve_body( $response ), true );
[1474] Fix | Delete
[1475] Fix | Delete
if ( ! is_array( $response ) ) {
[1476] Fix | Delete
return false;
[1477] Fix | Delete
}
[1478] Fix | Delete
[1479] Fix | Delete
set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
[1480] Fix | Delete
}
[1481] Fix | Delete
[1482] Fix | Delete
if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) {
[1483] Fix | Delete
/**
[1484] Fix | Delete
* Filters whether the active PHP version is considered acceptable by WordPress.
[1485] Fix | Delete
*
[1486] Fix | Delete
* Returning false will trigger a PHP version warning to show up in the admin dashboard to administrators.
[1487] Fix | Delete
*
[1488] Fix | Delete
* This filter is only run if the wordpress.org Serve Happy API considers the PHP version acceptable, ensuring
[1489] Fix | Delete
* that this filter can only make this check stricter, but not loosen it.
[1490] Fix | Delete
*
[1491] Fix | Delete
* @since 5.1.1
[1492] Fix | Delete
*
[1493] Fix | Delete
* @param bool $is_acceptable Whether the PHP version is considered acceptable. Default true.
[1494] Fix | Delete
* @param string $version PHP version checked.
[1495] Fix | Delete
*/
[1496] Fix | Delete
$response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
[1497] Fix | Delete
}
[1498] Fix | Delete
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function