Code Modernization: Bring consistency to preparing some fields on Network Settings screen:
* `illegal_names` * `limited_email_domains` * `banned_email_domains` If any of these options have a falsey value, treat it as an empty string. This addresses a PHP 8.1+ deprecation notice when passing a `null` value to `str_replace()`. Additionally, avoid unnecessary type casting for better performance. Props hellofromTonya, jrf, SergeyBiryukov. See #51423. Built from https://develop.svn.wordpress.org/trunk@50772 git-svn-id: http://core.svn.wordpress.org/trunk@50381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
02894474ba
commit
253e1e0413
|
@ -242,7 +242,16 @@ if ( isset( $_GET['updated'] ) ) {
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ); ?></label></th>
|
<th scope="row"><label for="illegal_names"><?php _e( 'Banned Names' ); ?></label></th>
|
||||||
<td>
|
<td>
|
||||||
<input name="illegal_names" type="text" id="illegal_names" aria-describedby="illegal-names-desc" class="large-text" value="<?php echo esc_attr( implode( ' ', (array) get_site_option( 'illegal_names' ) ) ); ?>" size="45" />
|
<?php
|
||||||
|
$illegal_names = get_site_option( 'illegal_names' );
|
||||||
|
|
||||||
|
if ( empty( $illegal_names ) ) {
|
||||||
|
$illegal_names = '';
|
||||||
|
} elseif ( is_array( $illegal_names ) ) {
|
||||||
|
$illegal_names = implode( ' ', $illegal_names );
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<input name="illegal_names" type="text" id="illegal_names" aria-describedby="illegal-names-desc" class="large-text" value="<?php echo esc_attr( $illegal_names ); ?>" size="45" />
|
||||||
<p class="description" id="illegal-names-desc">
|
<p class="description" id="illegal-names-desc">
|
||||||
<?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ); ?>
|
<?php _e( 'Users are not allowed to register these sites. Separate names by spaces.' ); ?>
|
||||||
</p>
|
</p>
|
||||||
|
@ -254,10 +263,16 @@ if ( isset( $_GET['updated'] ) ) {
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$limited_email_domains = get_site_option( 'limited_email_domains' );
|
$limited_email_domains = get_site_option( 'limited_email_domains' );
|
||||||
|
|
||||||
|
if ( empty( $limited_email_domains ) ) {
|
||||||
|
$limited_email_domains = '';
|
||||||
|
} else {
|
||||||
|
// Convert from an input field. Back-compat for WPMU < 1.0.
|
||||||
$limited_email_domains = str_replace( ' ', "\n", $limited_email_domains );
|
$limited_email_domains = str_replace( ' ', "\n", $limited_email_domains );
|
||||||
|
|
||||||
if ( $limited_email_domains ) {
|
if ( is_array( $limited_email_domains ) ) {
|
||||||
$limited_email_domains = implode( "\n", (array) $limited_email_domains );
|
$limited_email_domains = implode( "\n", $limited_email_domains );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5">
|
<textarea name="limited_email_domains" id="limited_email_domains" aria-describedby="limited-email-domains-desc" cols="45" rows="5">
|
||||||
|
@ -274,8 +289,10 @@ if ( isset( $_GET['updated'] ) ) {
|
||||||
<?php
|
<?php
|
||||||
$banned_email_domains = get_site_option( 'banned_email_domains' );
|
$banned_email_domains = get_site_option( 'banned_email_domains' );
|
||||||
|
|
||||||
if ( $banned_email_domains ) {
|
if ( empty( $banned_email_domains ) ) {
|
||||||
$banned_email_domains = implode( "\n", (array) $banned_email_domains );
|
$banned_email_domains = '';
|
||||||
|
} elseif ( is_array( $banned_email_domains ) ) {
|
||||||
|
$banned_email_domains = implode( "\n", $banned_email_domains );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<textarea name="banned_email_domains" id="banned_email_domains" aria-describedby="banned-email-domains-desc" cols="45" rows="5">
|
<textarea name="banned_email_domains" id="banned_email_domains" aria-describedby="banned-email-domains-desc" cols="45" rows="5">
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.8-alpha-50771';
|
$wp_version = '5.8-alpha-50772';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue