wp/wp-admin/includes/misc.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
   623 
   623 
   624 /**
   624 /**
   625  * @since 2.8.0
   625  * @since 2.8.0
   626  *
   626  *
   627  * @param string $content
   627  * @param string $content
   628  * @return array
   628  * @return string[] Array of function names.
   629  */
   629  */
   630 function wp_doc_link_parse( $content ) {
   630 function wp_doc_link_parse( $content ) {
   631 	if ( ! is_string( $content ) || empty( $content ) ) {
   631 	if ( ! is_string( $content ) || empty( $content ) ) {
   632 		return array();
   632 		return array();
   633 	}
   633 	}
  1414 	</script>
  1414 	</script>
  1415 	<?php
  1415 	<?php
  1416 }
  1416 }
  1417 
  1417 
  1418 /**
  1418 /**
  1419  * Sends a referrer policy header so referrers are not sent externally from administration screens.
       
  1420  *
       
  1421  * @since 4.9.0
       
  1422  */
       
  1423 function wp_admin_headers() {
       
  1424 	$policy = 'strict-origin-when-cross-origin';
       
  1425 
       
  1426 	/**
       
  1427 	 * Filters the admin referrer policy header value.
       
  1428 	 *
       
  1429 	 * @since 4.9.0
       
  1430 	 * @since 4.9.5 The default value was changed to 'strict-origin-when-cross-origin'.
       
  1431 	 *
       
  1432 	 * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
       
  1433 	 *
       
  1434 	 * @param string $policy The admin referrer policy header value. Default 'strict-origin-when-cross-origin'.
       
  1435 	 */
       
  1436 	$policy = apply_filters( 'admin_referrer_policy', $policy );
       
  1437 
       
  1438 	header( sprintf( 'Referrer-Policy: %s', $policy ) );
       
  1439 }
       
  1440 
       
  1441 /**
       
  1442  * Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.
  1419  * Outputs JS that reloads the page if the user navigated to it with the Back or Forward button.
  1443  *
  1420  *
  1444  * Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache,
  1421  * Used on the Edit Post and Add New Post screens. Needed to ensure the page is not loaded from browser cache,
  1445  * so the post title and editor content are the last saved versions. Ideally this script should run first in the head.
  1422  * so the post title and editor content are the last saved versions. Ideally this script should run first in the head.
  1446  *
  1423  *
  1475 	$hash            = md5( $value . time() . wp_rand() );
  1452 	$hash            = md5( $value . time() . wp_rand() );
  1476 	$new_admin_email = array(
  1453 	$new_admin_email = array(
  1477 		'hash'     => $hash,
  1454 		'hash'     => $hash,
  1478 		'newemail' => $value,
  1455 		'newemail' => $value,
  1479 	);
  1456 	);
  1480 	update_option( 'adminhash', $new_admin_email );
  1457 	update_option( 'adminhash', $new_admin_email, false );
  1481 
  1458 
  1482 	$switched_locale = switch_to_user_locale( get_current_user_id() );
  1459 	$switched_locale = switch_to_user_locale( get_current_user_id() );
  1483 
  1460 
  1484 	/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
  1461 	/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
  1485 	$email_text = __(
  1462 	$email_text = __(
  1486 		'Howdy ###USERNAME###,
  1463 		'Howdy,
  1487 
  1464 
  1488 Someone with administrator capabilities recently requested to have the
  1465 A site administrator (###USERNAME###) recently requested to have the
  1489 administration email address changed on this site:
  1466 administration email address changed on this site:
  1490 ###SITEURL###
  1467 ###SITEURL###
  1491 
  1468 
  1492 To confirm this change, please click on the following link:
  1469 To confirm this change, please click on the following link:
  1493 ###ADMIN_URL###
  1470 ###ADMIN_URL###