| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | * @package Friends |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | ?><form method="post" id="edit-rules"> |
| 10 | - <?php wp_nonce_field( 'edit-friend-rules-' . $args['friend']->user_login ); ?> | |
| 10 | + <?php wp_nonce_field( 'edit-friend-rules-' . sanitize_user( $args['friend']->user_login ) ); ?> | |
| 11 | 11 | <input type="hidden" name="friend" value="<?php echo esc_attr( $args['friend']->user_login ); ?>" /> |
| 12 | 12 | <p class="description"><?php esc_html_e( 'By specifying rules, you can automatically accept, trash, or transform individual feed items, thus filter incoming posts according to your interest.', 'friends' ); ?></p> |
| 13 | 13 | <p class="description"><?php esc_html_e( 'Save changes to add another rule, leave the rule text empty to delete the rule.', 'friends' ); ?></p> |
| 14 | 14 | <table> |
| @@ -16,24 +16,24 @@ | ||
| 16 | 16 | <?php foreach ( $args['rules'] as $rule ) : ?> |
| 17 | 17 | <tr> |
| 18 | 18 | <th> |
| 19 | 19 | <select name="rules[field][]"> |
| 20 | - <option value="title" <?php selected( 'title', $rule['field'] ); ?>><?php echo esc_html_e( 'If the title contains', 'friends' ); ?></option> | |
| 21 | - <option value="content" <?php selected( 'content', $rule['field'] ); ?>><?php echo esc_html_e( 'If the content contains', 'friends' ); ?></option> | |
| 22 | - <option value="author" <?php selected( 'author', $rule['field'] ); ?>><?php echo esc_html_e( 'If the author contains', 'friends' ); ?></option> | |
| 23 | - <option value="permalink" <?php selected( 'permalink', $rule['field'] ); ?>><?php echo esc_html_e( 'If the URL contains', 'friends' ); ?></option> | |
| 20 | + <option value="title" <?php selected( 'title', $rule['field'] ); ?>><?php esc_html_e( 'If the title contains', 'friends' ); ?></option> | |
| 21 | + <option value="content" <?php selected( 'content', $rule['field'] ); ?>><?php esc_html_e( 'If the content contains', 'friends' ); ?></option> | |
| 22 | + <option value="author" <?php selected( 'author', $rule['field'] ); ?>><?php esc_html_e( 'If the author contains', 'friends' ); ?></option> | |
| 23 | + <option value="permalink" <?php selected( 'permalink', $rule['field'] ); ?>><?php esc_html_e( 'If the URL contains', 'friends' ); ?></option> | |
| 24 | 24 | </select> |
| 25 | 25 | </th> |
| 26 | - <td><input type="text" name="rules[regex][]" value="<?php echo esc_attr( $rule['regex'] ); ?>" class="regular-text" placeholder="<?php esc_attr_e( 'Enter a text or regular expression', 'friends' ); ?>" /></td> | |
| 26 | + <td><input type="text" name="rules[regex][]" value="<?php echo esc_textarea( $rule['regex'] ); ?>" class="regular-text" placeholder="<?php esc_attr_e( 'Enter a text or regular expression', 'friends' ); ?>" /></td> | |
| 27 | 27 | <td> |
| 28 | 28 | <select name="rules[action][]" class="rule-action"> |
| 29 | - <option value="accept" <?php selected( 'accept', $rule['action'] ); ?>><?php echo esc_html_e( 'accept the item', 'friends' ); ?></option> | |
| 30 | - <option value="trash" <?php selected( 'trash', $rule['action'] ); ?>><?php echo esc_html_e( 'trash the item', 'friends' ); ?></option> | |
| 31 | - <option value="delete" <?php selected( 'delete', $rule['action'] ); ?>><?php echo esc_html_e( 'delete the item', 'friends' ); ?></option> | |
| 32 | - <option value="replace" <?php selected( 'replace', $rule['action'] ); ?>><?php echo esc_html_e( 'replace the match with this:', 'friends' ); ?></option> | |
| 29 | + <option value="accept" <?php selected( 'accept', $rule['action'] ); ?>><?php esc_html_e( 'accept the item', 'friends' ); ?></option> | |
| 30 | + <option value="trash" <?php selected( 'trash', $rule['action'] ); ?>><?php esc_html_e( 'trash the item', 'friends' ); ?></option> | |
| 31 | + <option value="delete" <?php selected( 'delete', $rule['action'] ); ?>><?php esc_html_e( 'delete the item', 'friends' ); ?></option> | |
| 32 | + <option value="replace" <?php selected( 'replace', $rule['action'] ); ?>><?php esc_html_e( 'replace the match with this:', 'friends' ); ?></option> | |
| 33 | 33 | </select> |
| 34 | 34 | </td> |
| 35 | - <td style="<?php echo esc_attr( 'replace' !== $rule['action'] ? 'display: none' : '' ); ?>" class="replace-with"><input type="text" name="rules[replace][]" value="<?php echo esc_attr( isset( $rule['replace'] ) ? $rule['replace'] : '' ); ?>" class="regular-text" placeholder="<?php esc_attr_e( 'Enter the text to replace it with', 'friends' ); ?>" /></td> | |
| 35 | + <td style="<?php echo esc_attr( 'replace' !== $rule['action'] ? 'display: none' : '' ); ?>" class="replace-with"><input type="text" name="rules[replace][]" value="<?php echo esc_textarea( isset( $rule['replace'] ) ? $rule['replace'] : '' ); ?>" class="regular-text" placeholder="<?php esc_attr_e( 'Enter the text to replace it with', 'friends' ); ?>" /></td> | |
| 36 | 36 | <?php if ( empty( $rule['regex'] ) ) : ?> |
| 37 | 37 | <td><span class="description">(<?php esc_html_e( 'Unsubmitted rule', 'friends' ); ?>)</span></td> |
| 38 | 38 | <?php endif; ?> |
| 39 | 39 | </tr> |
| @@ -41,11 +41,11 @@ | ||
| 41 | 41 | <tr> |
| 42 | 42 | <th><label for="field"><?php esc_html_e( 'In any other case', 'friends' ); ?></label></th> |
| 43 | 43 | <td colspan="3"> |
| 44 | 44 | <select name="catch_all"> |
| 45 | - <option value="accept" <?php selected( 'accept', $args['catch_all'] ); ?>><?php echo esc_html_e( 'accept the item', 'friends' ); ?></option> | |
| 46 | - <option value="trash" <?php selected( 'trash', $args['catch_all'] ); ?>><?php echo esc_html_e( 'trash the item', 'friends' ); ?></option> | |
| 47 | - <option value="delete" <?php selected( 'delete', $args['catch_all'] ); ?>><?php echo esc_html_e( 'delete the item', 'friends' ); ?></option> | |
| 45 | + <option value="accept" <?php selected( 'accept', $args['catch_all'] ); ?>><?php esc_html_e( 'accept the item', 'friends' ); ?></option> | |
| 46 | + <option value="trash" <?php selected( 'trash', $args['catch_all'] ); ?>><?php esc_html_e( 'trash the item', 'friends' ); ?></option> | |
| 47 | + <option value="delete" <?php selected( 'delete', $args['catch_all'] ); ?>><?php esc_html_e( 'delete the item', 'friends' ); ?></option> | |
| 48 | 48 | </select> |
| 49 | 49 | </td> |
| 50 | 50 | </tr> |
| 51 | 51 | </tbody> |
| @@ -51,9 +51,8 @@ | ||
| 51 | 51 | </tbody> |
| 52 | 52 | </table> |
| 53 | 53 | <p class="submit"> |
| 54 | 54 | <input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>"> |
| 55 | - <a href="<?php echo esc_url( self_admin_url( 'admin.php?page=edit-friend&user=' . $args['friend']->user_login ) ); ?>" style="margin-left: 1em"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Back' ); ?></a> | |
| 56 | 55 | </p> |
| 57 | 56 | </form> |
| 58 | 57 | |
| 59 | -<p class="description"><?php esc_html_e( 'See how the rules apply to these items:', 'friends' ); ?> <button id="refresh-preview-rules" data-friend="<?php echo esc_attr( $args['friend']->user_login ); ?>" data-post="<?php echo $args['post'] ? esc_attr( $args['post']->ID ) : ''; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'preview-rules-' . $args['friend']->user_login ) ); ?>"><?php esc_html_e( 'Refresh', 'friends' ); ?></button></p> | |
| 58 | +<p class="description"><?php esc_html_e( 'See how the rules apply to these items:', 'friends' ); ?> <button id="refresh-preview-rules" data-friend="<?php echo esc_attr( $args['friend']->user_login ); ?>" data-post="<?php echo $args['post'] ? esc_attr( $args['post']->ID ) : ''; ?>" data-nonce="<?php echo esc_attr( wp_create_nonce( 'edit-friend-rules-' . sanitize_user( $args['friend']->user_login ) ) ); ?>"><?php esc_html_e( 'Refresh', 'friends' ); ?></button></p> | |