Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 41 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
||
| 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 | <h2><?php esc_html_e( 'Network Settings', 'jetpack' ); ?></h2> |
| 30 | <form action="edit.php?action=jetpack-network-settings" method="POST"> |
| 31 | <h3><?php echo esc_html_x( 'Global', 'Affects all sites in a Multisite network.', 'jetpack' ); ?></h3> |
| 32 | <p><?php esc_html_e( 'These settings affect all sites on the network.', 'jetpack' ); ?></p> |
| 33 | <?php wp_nonce_field( 'jetpack-network-settings' ); ?> |
| 34 | <table class="form-table"> |
| 35 | <tr valign="top"> |
| 36 | <th scope="row"><label for="sub-site-override"><?php esc_html_e( 'Sub-site override', 'jetpack' ); ?></label></th> |
| 37 | <td> |
| 38 | <input type="checkbox" name="sub-site-connection-override" id="sub-site-override" value="1" <?php checked( $data['options']['sub-site-connection-override'] ); ?> /> |
| 39 | <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> |
| 40 | </td> |
| 41 | </tr> |
| 42 | |
| 43 | <tr valign="top"> |
| 44 | <th scope="row"><label for="sub-site-override"><?php esc_html_e( 'Protect IP allow list', 'jetpack' ); ?></label></th> |
| 45 | <td> |
| 46 | <p><strong> |
| 47 | <?php |
| 48 | $current_ip = IP_Utils::get_ip(); |
| 49 | if ( ! empty( $current_ip ) ) { |
| 50 | printf( |
| 51 | /* Translators: placeholder is an IP address. */ |
| 52 | esc_html__( 'Your current IP: %1$s', 'jetpack' ), |
| 53 | esc_html( $current_ip ) |
| 54 | ); |
| 55 | } |
| 56 | ?> |
| 57 | </strong></p> |
| 58 | <?php |
| 59 | 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. |
| 60 | |
| 61 | foreach ( $data['jetpack_protect_whitelist']['global'] as $ip ) { |
| 62 | echo esc_html( $ip ) . "\n"; |
| 63 | } |
| 64 | ?> |
| 65 | </textarea> <br /> |
| 66 | <label for="global-allow-list"> |
| 67 | <?php esc_html_e( 'IPv4 and IPv6 are acceptable. Enter multiple IPs on separate lines.', 'jetpack' ); ?> |
| 68 | <br /> |
| 69 | <?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' ); ?> |
| 70 | </label> |
| 71 | </td> |
| 72 | </tr> |
| 73 | </table> |
| 74 | <?php submit_button(); ?> |
| 75 | |
| 76 | </form> |
| 77 | </div> |