PluginProbe
Friends / 4.3.2
Friends v4.3.2
4.3.2 4.3.1 4.3.0 4.2.2 4.2.1 4.2.0 4.1.0 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.0 2.9.1 All 88 releases
friends / templates / admin / edit-rules.php

edit-rules.php in Friends 4.3.2, at templates/admin/edit-rules.php

59 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This template contains the rules editor.
4 *
5 * @version 1.0
6 * @package Friends
7 */
8
9 ?><form method="post" id="edit-rules">
10 <?php wp_nonce_field( 'edit-friend-rules-' . sanitize_user( $args['friend']->user_login ) ); ?>
11 <input type="hidden" name="friend" value="<?php echo esc_attr( $args['friend']->user_login ); ?>" />
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 <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 <table>
15 <tbody>
16 <?php foreach ( $args['rules'] as $rule ) : ?>
17 <tr>
18 <th>
19 <select name="rules[field][]">
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 </select>
25 </th>
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 <td>
28 <select name="rules[action][]" class="rule-action">
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 </select>
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_textarea( isset( $rule['replace'] ) ? $rule['replace'] : '' ); ?>" class="regular-text" placeholder="<?php esc_attr_e( 'Enter the text to replace it with', 'friends' ); ?>" /></td>
36 <?php if ( empty( $rule['regex'] ) ) : ?>
37 <td><span class="description">(<?php esc_html_e( 'Unsubmitted rule', 'friends' ); ?>)</span></td>
38 <?php endif; ?>
39 </tr>
40 <?php endforeach; ?>
41 <tr>
42 <th><label for="field"><?php esc_html_e( 'In any other case', 'friends' ); ?></label></th>
43 <td colspan="3">
44 <select name="catch_all">
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 </select>
49 </td>
50 </tr>
51 </tbody>
52 </table>
53 <p class="submit">
54 <input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>">
55 </p>
56 </form>
57
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>
59