|
43 | 43 |
|
44 | 44 | <?php
|
45 | 45 | global $current_user;
|
46 |
| - $editable_whitelist = jetpack_protect_format_whitelist( $this->whitelist ); |
47 |
| - $current_user_global_whitelist = wp_list_filter( $this->whitelist, array( 'user_id' => $current_user->ID, 'global'=> true) ); |
48 |
| - $other_user_whtielist = wp_list_filter( $this->whitelist, array( 'user_id' => $current_user->ID ), 'NOT' ); |
| 46 | + $whitelist = jetpack_protect_format_whitelist( $this->whitelist ); |
49 | 47 | ?>
|
50 | 48 |
|
51 |
| - <?php if ( ! empty( $current_user_global_whitelist ) || ! empty( $other_user_whtielist ) ) : // maybe show user's non-editable whitelists ?> |
| 49 | + <?php if ( ! empty( $whitelist['global'] ) || ! empty( $whitelist['other_user'] ) ) : // maybe show user's non-editable whitelists ?> |
52 | 50 |
|
53 | 51 | <table id="non-editable-whitelist" class="whitelist-table" cellpadding="0" cellspacing="0">
|
54 | 52 | <tr>
|
|
63 | 61 | </td>
|
64 | 62 | </tr>
|
65 | 63 | <tbody>
|
66 |
| - <?php if ( ! empty( $current_user_global_whitelist ) ) : // show global whitelist ( only editable via wordpress.com ) ?> |
| 64 | + <?php if ( ! empty( $whitelist['global'] ) ) : // show global whitelist ( only editable via wordpress.com ) ?> |
67 | 65 | <tr>
|
68 | 66 | <th class="heading">
|
69 | 67 | <?php _e( 'IP addresses on your global whitelist', 'jetpack'); ?>
|
70 | 68 | </th>
|
71 | 69 | </tr>
|
72 | 70 |
|
73 |
| - <?php foreach( $current_user_global_whitelist as $item ) : ?> |
| 71 | + <?php foreach( $whitelist['global'] as $item ) : ?> |
74 | 72 | <tr>
|
75 | 73 | <td>
|
76 |
| - <?php if( $item->range ) : ?> |
77 |
| - <?php echo $item->range_low; ?> – <?php echo $item->range_high; ?> |
78 |
| - <?php else: ?> |
79 |
| - <?php echo $item->ip_address; ?> |
80 |
| - <?php endif; ?> |
| 74 | + <?php echo $item; ?> |
81 | 75 | </td>
|
82 | 76 | </tr>
|
83 | 77 | <?php endforeach; ?>
|
84 | 78 | <?php endif; // end global whitelist ?>
|
85 | 79 |
|
86 |
| - <?php if( ! empty( $other_user_whtielist ) ) : ?> |
| 80 | + <?php if( ! empty( $whitelist['other_user'] ) ) : ?> |
87 | 81 | <tr>
|
88 | 82 | <th class="heading">
|
89 | 83 | <?php _e( 'IP addresses added by other users', 'jetpack' ); ?>
|
90 | 84 | </th>
|
91 | 85 | </tr>
|
92 |
| - <?php foreach( $other_user_whtielist as $item ) : ?> |
| 86 | + <?php foreach( $whitelist['other_user'] as $item ) : ?> |
93 | 87 | <tr>
|
94 | 88 | <td>
|
95 |
| - <?php if( $item->range ) : ?> |
96 |
| - <?php echo $item->range_low; ?> – <?php echo $item->range_high; ?> |
97 |
| - <?php else: ?> |
98 |
| - <?php echo $item->ip_address; ?> |
99 |
| - <?php endif; ?> |
| 89 | + <?php echo $item; ?> |
100 | 90 | </td>
|
101 | 91 | </tr>
|
102 | 92 | <?php endforeach; ?>
|
|
123 | 113 | </p>
|
124 | 114 | <?php wp_nonce_field( 'jetpack-protect' ); ?>
|
125 | 115 | <input type='hidden' name='action' value='jetpack_protect_save_whitelist' />
|
126 |
| - <textarea name="whitelist"><?php esc_attr_e($editable_whitelist['local'], 'jetpack'); ?></textarea> |
| 116 | + <textarea name="whitelist"><?php echo implode( PHP_EOL, $whitelist['local'] ); ?></textarea> |
127 | 117 | <p>
|
128 | 118 | <em><?php _e('IPv4 and IPv6 are acceptable. <br />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' ); ?></em>
|
129 | 119 | </p>
|
|
0 commit comments