2022-04-02 10:26:41 +02:00
< ? php
/**
* Jetpack Network Settings view template .
*
2025-02-28 08:42:11 +01:00
* @ html - template Jetpack :: load_view
2022-04-02 10:26:41 +02:00
* @ package automattic / jetpack
*/
2019-11-15 23:26:29 +01:00
2025-02-28 08:42:11 +01:00
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable -- HTML template, let Phan handle it.
2023-04-26 17:39:43 +02:00
use Automattic\Jetpack\IP\Utils as IP_Utils ;
2025-12-12 13:13:07 +01:00
if ( ! defined ( 'ABSPATH' ) ) {
exit ( 0 );
}
2022-04-02 10:26:41 +02:00
if ( isset ( $_GET [ 'updated' ] ) && 'true' === $_GET [ 'updated' ] ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended
?>
2019-11-15 23:26:29 +01:00
< div class = " updated " >< p >< ? php esc_html_e ( 'Jetpack Network Settings Updated!' , 'jetpack' ); ?> </p></div>
< ? php endif ; ?>
2022-04-02 10:26:41 +02:00
< ? php
if ( isset ( $_GET [ 'error' ] ) && 'jetpack_protect_whitelist' === $_GET [ 'error' ] ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended
?>
2019-11-15 23:26:29 +01:00
< div class = " error " >< p >< ? php esc_html_e ( 'One of your IP addresses was not valid.' , 'jetpack' ); ?> </p></div>
< ? php endif ; ?>
< div class = " wrap " >
2022-04-02 10:26:41 +02:00
< h2 >< ? php esc_html_e ( 'Network Settings' , 'jetpack' ); ?> </h2>
2019-11-15 23:26:29 +01:00
< form action = " edit.php?action=jetpack-network-settings " method = " POST " >
2022-04-02 10:26:41 +02:00
< h3 >< ? php echo esc_html_x ( 'Global' , 'Affects all sites in a Multisite network.' , 'jetpack' ); ?> </h3>
< p >< ? php esc_html_e ( 'These settings affect all sites on the network.' , 'jetpack' ); ?> </p>
2019-11-15 23:26:29 +01:00
< ? php wp_nonce_field ( 'jetpack-network-settings' ); ?>
< table class = " form-table " >
< tr valign = " top " >
2022-04-02 10:26:41 +02:00
< th scope = " row " >< label for = " sub-site-override " >< ? php esc_html_e ( 'Sub-site override' , 'jetpack' ); ?> </label></th>
2019-11-15 23:26:29 +01:00
< td >
2025-02-28 08:42:11 +01:00
< input type = " checkbox " name = " sub-site-connection-override " id = " sub-site-override " value = " 1 " < ? php checked ( $data [ 'options' ][ 'sub-site-connection-override' ] ); ?> />
2022-04-02 10:26:41 +02:00
< label for = " sub-site-override " >< ? php esc_html_e ( 'Allow individual site administrators to manage their own connections (connect and disconnect) to WordPress.com' , 'jetpack' ); ?> </label>
2019-11-15 23:26:29 +01:00
</ td >
</ tr >
< tr valign = " top " >
2023-04-26 17:39:43 +02:00
< th scope = " row " >< label for = " sub-site-override " >< ? php esc_html_e ( 'Protect IP allow list' , 'jetpack' ); ?> </label></th>
2019-11-15 23:26:29 +01:00
< td >
2022-04-02 10:26:41 +02:00
< p >< strong >
< ? php
2023-04-26 17:39:43 +02:00
$current_ip = IP_Utils :: get_ip ();
if ( ! empty ( $current_ip ) ) {
2022-04-02 10:26:41 +02:00
printf (
/* Translators: placeholder is an IP address. */
esc_html__ ( 'Your current IP: %1$s' , 'jetpack' ),
2023-04-26 17:39:43 +02:00
esc_html ( $current_ip )
2022-04-02 10:26:41 +02:00
);
}
?>
</ strong ></ p >
< ? php
2023-04-26 17:39:43 +02:00
echo '<textarea name="global-allow-list" style="width: 100%;" rows="8">' ; // echo to avoid tabs displayed in textarea. See https://github.com/Automattic/jetpack/pull/21151/files#r713922521.
2022-04-02 10:26:41 +02:00
2025-02-28 08:42:11 +01:00
foreach ( $data [ 'jetpack_protect_whitelist' ][ 'global' ] as $ip ) {
2022-04-02 10:26:41 +02:00
echo esc_html ( $ip ) . " \n " ;
}
?>
</ textarea > < br />
2023-04-26 17:39:43 +02:00
< label for = " global-allow-list " >
2022-04-02 10:26:41 +02:00
< ? php esc_html_e ( 'IPv4 and IPv6 are acceptable. Enter multiple IPs on separate lines.' , 'jetpack' ); ?>
< br />
< ? php esc_html_e ( 'To specify a range, enter the low value and high value separated by a dash. Example: 12.12.12.1-12.12.12.100' , 'jetpack' ); ?>
</ label >
2019-11-15 23:26:29 +01:00
</ td >
</ tr >
</ table >
< ? php submit_button (); ?>
</ form >
</ div >