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