| 1 |
<?php |
| 2 |
/** |
| 3 |
* Jetpack Network Settings view template. |
| 4 |
* |
| 5 |
* @package automattic/jetpack |
| 6 |
*/ |
| 7 |
|
| 8 |
use Automattic\Jetpack\IP\Utils as IP_Utils; |
| 9 |
|
| 10 |
if ( isset( $_GET['updated'] ) && 'true' === $_GET['updated'] ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 11 |
?> |
| 12 |
<div class="updated"><p><?php esc_html_e( 'Jetpack Network Settings Updated!', 'jetpack' ); ?></p></div> |
| 13 |
<?php endif; ?> |
| 14 |
|
| 15 |
<?php |
| 16 |
if ( isset( $_GET['error'] ) && 'jetpack_protect_whitelist' === $_GET['error'] ) : // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 17 |
?> |
| 18 |
<div class="error"><p><?php esc_html_e( 'One of your IP addresses was not valid.', 'jetpack' ); ?></p></div> |
| 19 |
<?php endif; ?> |
| 20 |
|
| 21 |
<div class="wrap"> |
| 22 |
<h2><?php esc_html_e( 'Network Settings', 'jetpack' ); ?></h2> |
| 23 |
<form action="edit.php?action=jetpack-network-settings" method="POST"> |
| 24 |
<h3><?php echo esc_html_x( 'Global', 'Affects all sites in a Multisite network.', 'jetpack' ); ?></h3> |
| 25 |
<p><?php esc_html_e( 'These settings affect all sites on the network.', 'jetpack' ); ?></p> |
| 26 |
<?php wp_nonce_field( 'jetpack-network-settings' ); ?> |
| 27 |
<table class="form-table"> |
| 28 |
<tr valign="top"> |
| 29 |
<th scope="row"><label for="sub-site-override"><?php esc_html_e( 'Sub-site override', 'jetpack' ); ?></label></th> |
| 30 |
<td> |
| 31 |
<input type="checkbox" name="sub-site-connection-override" id="sub-site-override" value="1" <?php checked( $data['options']['sub-site-connection-override'] ); // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable ?> /> |
| 32 |
<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> |
| 33 |
</td> |
| 34 |
</tr> |
| 35 |
|
| 36 |
<tr valign="top"> |
| 37 |
<th scope="row"><label for="sub-site-override"><?php esc_html_e( 'Protect IP allow list', 'jetpack' ); ?></label></th> |
| 38 |
<td> |
| 39 |
<p><strong> |
| 40 |
<?php |
| 41 |
$current_ip = IP_Utils::get_ip(); |
| 42 |
if ( ! empty( $current_ip ) ) { |
| 43 |
printf( |
| 44 |
/* Translators: placeholder is an IP address. */ |
| 45 |
esc_html__( 'Your current IP: %1$s', 'jetpack' ), |
| 46 |
esc_html( $current_ip ) |
| 47 |
); |
| 48 |
} |
| 49 |
?> |
| 50 |
</strong></p> |
| 51 |
<?php |
| 52 |
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. |
| 53 |
|
| 54 |
foreach ( $data['jetpack_protect_whitelist']['global'] as $ip ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
| 55 |
echo esc_html( $ip ) . "\n"; |
| 56 |
} |
| 57 |
?> |
| 58 |
</textarea> <br /> |
| 59 |
<label for="global-allow-list"> |
| 60 |
<?php esc_html_e( 'IPv4 and IPv6 are acceptable. Enter multiple IPs on separate lines.', 'jetpack' ); ?> |
| 61 |
<br /> |
| 62 |
<?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' ); ?> |
| 63 |
</label> |
| 64 |
</td> |
| 65 |
</tr> |
| 66 |
</table> |
| 67 |
<?php submit_button(); ?> |
| 68 |
|
| 69 |
</form> |
| 70 |
</div> |
| 71 |
|