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
← All changes | templates/admin/select-feeds.php +40 -81 2.8.1 → 4.3.2 View file →
@@ -1,7 +1,7 @@
1 1 <?php
2 2 /**
3 - * This template contains the Admin Send Friend Request form.
3 + * This template contains the feed selection form for following someone.
4 4 *
5 5 * @package Friends
6 6 */
7 7
@@ -7,12 +7,8 @@
7 7
8 8 $c = -1;
9 9 $hidden_feed_count = 0;
10 10 $unsupported_feeds = array();
11 -$friends_host = false;
12 -if ( $args['friends_plugin'] ) {
13 - $friends_host = parse_url( $args['friends_plugin'], PHP_URL_HOST );
14 -}
15 11
16 12 foreach ( $args['feeds'] as $feed_url => $details ) {
17 13 if ( ! isset( $details['parser'] ) || 'unsupported' === $details['parser'] ) {
18 14 $unsupported_feeds[ $feed_url ] = $details;
@@ -31,9 +27,8 @@
31 27 <?php wp_nonce_field( 'add-friend' ); ?>
32 28 <input type="hidden" name="friend_url" value="<?php echo esc_url( $args['friend_url'] ); ?>" />
33 29 <p>
34 30 <?php
35 - // translators: %s is a URL.
36 31 echo wp_kses(
37 32 // translators: %1$s is a URL, %2$s is an admin link.
38 33 sprintf( __( 'You\'re looking to add the URL %1$s (<a href=%2$s>edit</a>). The site has been analyzed and you now have the following options:', 'friends' ), '<strong>' . esc_html( $args['friend_url'] ) . '</strong>', '"' . admin_url( 'admin.php?page=add-friend&url=' . $args['friend_url'] ) . '"' ),
39 34 array(
@@ -46,15 +41,18 @@
46 41
47 42 <table class="form-table">
48 43 <tbody>
49 44 <tr>
50 - <th scope="row"><label for="user_login"><?php esc_html_e( 'Display Name', 'friends' ); ?></label></th>
45 + <th scope="row"><label for="display_name"><?php esc_html_e( 'Display Name', 'friends' ); ?></label></th>
51 46 <td>
52 47 <?php if ( ! empty( $args['friends_multisite_display_name'] ) ) : ?>
53 48 <?php echo esc_html( $args['friends_multisite_display_name'] ); ?>
54 - <input type="hidden" id="user_login" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" />
49 + <input type="hidden" id="display_name" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" />
50 + <p class="description">
51 + <?php esc_html_e( 'This user already exists on your WordPress network. Their display name cannot be changed here.', 'friends' ); ?>
52 + </p>
55 53 <?php else : ?>
56 - <input type="text" id="user_login" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" required placeholder="" class="regular-text" />
54 + <input type="text" id="display_name" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" required placeholder="" class="regular-text" />
57 55 <?php endif; ?>
58 56 </td>
59 57 </tr>
60 58 <tr>
@@ -62,79 +60,29 @@
62 60 <td>
63 61 <?php if ( ! empty( $args['friends_multisite_user_login'] ) ) : ?>
64 62 <?php echo esc_html( $args['friends_multisite_user_login'] ); ?>
65 63 <input type="hidden" id="user_login" name="user_login" value="<?php echo esc_attr( $args['friends_multisite_user_login'] ); ?>" />
64 + <p class="description">
65 + <?php esc_html_e( 'This user already exists on your WordPress network. Their username cannot be changed here.', 'friends' ); ?>
66 + </p>
66 67 <?php else : ?>
67 - <input type="text" id="user_login" name="user_login" value="<?php echo esc_attr( $args['friend_user_login'] ); ?>" required placeholder="" class="regular-text" />
68 + <input type="text" id="user_login" name="user_login" value="<?php echo esc_attr( $args['friend_user_login'] ); ?>" data-original="<?php echo esc_attr( $args['friend_user_login'] ); ?>" required placeholder="" class="regular-text" />
68 69 <?php endif; ?>
69 70 </td>
70 71 </tr>
71 - <?php if ( $args['friends_plugin'] ) : ?>
72 72 <tr>
73 - <th scope="row"><label for="friendship"><?php esc_html_e( 'Friendship', 'friends' ); ?></label></th>
74 - <td title="<?php echo esc_attr( $args['friends_plugin'] ); ?>">
75 - <label><input type="checkbox" id="friendship" name="friendship" value="<?php echo esc_attr( $args['friends_plugin'] ); ?>" checked /> <?php esc_html_e( 'Send request for friendship', 'friends' ); ?></label> —
76 - <label><?php esc_html_e( 'Their role will be:', 'friends' ); ?> <select name="role" id="friendship-status">
77 - <?php
78 - foreach ( $args['friend_roles'] as $role => $title ) :
79 - ?>
80 - <option value="<?php echo esc_attr( $role ); ?>"<?php selected( $args['default_role'], $role ); ?>><?php echo esc_html( $title ); ?></option>
81 - <?php endforeach; ?>
82 - </select></label>
83 - <p class="description details hidden"><small>
84 - <?php
85 - // translators: %s is a URL.
86 - echo esc_html( sprintf( __( 'API URL: %s', 'friends' ), $args['friends_plugin'] ) );
87 - ?>
88 - </small>
89 - </p>
90 - <p class="description">
91 - <?php esc_html_e( 'When the other side accepts your friend request, a trusted connection between your sites is established.', 'friends' ); ?>
92 - </p>
93 - <p><small><a href="" id="send-friends-advanced"><?php esc_html_e( 'Add optional information »', 'friends' ); ?></a></small></p>
94 - </td>
95 - </tr>
96 - <tr class="friends-advanced hidden">
97 - <th scope="row"><label for="message"><?php esc_html_e( 'Message (Optional)', 'friends' ); ?></label></th>
73 + <th scope="row"><?php esc_html_e( 'Follow', 'friends' ); ?></th>
98 74 <td>
99 - <input type="text" autofocus id="message" name="message" value="<?php echo esc_attr( $args['message'] ); ?>" placeholder="<?php esc_attr_e( 'Enter a message for your friend', 'friends' ); ?>" class="large-text" maxlength="2000" />
100 - <p class="description" id="message-description">
101 - <?php esc_html_e( 'The short message you supply will be sent along with your friend request.', 'friends' ); ?>
102 - </p>
103 - </td>
104 - </tr>
105 - <tr class="friends-advanced hidden">
106 - <th scope="row"><label for="codeword"><?php esc_html_e( 'Code word (Optional)', 'friends' ); ?></label></th>
107 - <td>
108 - <input type="text" autofocus id="codeword" name="codeword" value="<?php echo esc_attr( $args['codeword'] ); ?>" placeholder="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'None' ); ?>" class="regular-text" />
109 - <p class="description" id="codeword-description">
110 - <?php esc_html_e( 'Your friend might have told you to provide something here.', 'friends' ); ?>
111 - </p>
112 - </td>
113 - </tr>
114 - <?php else : ?>
115 - <tr>
116 - <th scope="row"><label for="friendship"><?php esc_html_e( 'Friendship', 'friends' ); ?></label></th>
117 - <td>
118 - <p class="description">
119 - <?php
120 - // translators: %s is a URL.
121 - echo wp_kses( sprintf( __( 'No friends plugin could be found on %s, therefore only subscription options are available.', 'friends' ), '<strong>' . esc_html( $args['friend_url'] ) . '</strong>' ), array( 'strong' => array() ) );
122 - ?>
123 - </p>
124 - </td>
125 - </tr>
126 - <?php endif; ?>
127 - <tr>
128 - <th scope="row"><?php esc_html_e( 'Subscription', 'friends' ); ?></th>
129 - <td>
75 + <?php if ( ! empty( $args['feeds_notice'] ) ) : ?>
76 + <strong><?php echo wp_kses( $args['feeds_notice'], array( 'a' => array( 'href' => array() ) ) ); ?></strong>
77 + <?php endif; ?>
130 78 <ul>
131 79 <?php foreach ( $args['feeds'] as $feed_url => $details ) : ?>
132 80 <?php
133 - $c += 1;
81 + ++$c;
134 82 $classes = '';
135 83 if ( $c > 0 && ! $details['autoselect'] ) {
136 - $hidden_feed_count += 1;
84 + ++$hidden_feed_count;
137 85 $classes .= 'rel-alternate hidden';
138 86 }
139 87 ?>
140 88 <li class="<?php echo esc_attr( $classes ); ?>">
@@ -151,10 +99,10 @@
151 99 if ( ! isset( $details['post-format'] ) ) {
152 100 $details['post-format'] = 'standard';
153 101 }
154 102 $select = '<select name="feeds[' . esc_attr( $c ) . '][post-format]">';
155 - foreach ( $args['post_formats'] as $format => $title ) {
156 - $select .= '<option value="' . esc_attr( $format ) . '"' . selected( $details['post-format'], $format, false ) . '>' . esc_html( $title ) . '</option>';
103 + foreach ( $args['post_formats'] as $format => $_title ) {
104 + $select .= '<option value="' . esc_attr( $format ) . '"' . selected( $details['post-format'], $format, false ) . '>' . esc_html( $_title ) . '</option>';
157 105 }
158 106 $select .= '</select>';
159 107
160 108 echo wp_kses(
@@ -161,9 +109,14 @@
161 109 sprintf(
162 110 // translators: 1: is a link to a feed with its name as text, 2: url for a preview, 3: a select dropdown with post formats.
163 111 __( 'Subscribe %1$s (<a href=%2$s>preview</a>) as %3$s', 'friends' ),
164 112 '<a href="' . esc_attr( $feed_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $details['title'] ) . '</a>',
165 - '"' . esc_url( wp_nonce_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'admin.php?page=add-friend&parser=' . urlencode( $details['parser'] ) . '&preview=' . urlencode( $feed_url ) ) ), 'preview-feed' ) ) . '" target="_blank"',
113 + '"' . esc_url(
114 + wp_nonce_url(
115 + add_query_arg( '_wp_http_referer', add_query_arg( 'parser', $details['parser'], add_query_arg( 'preview', $feed_url, remove_query_arg( '_wp_http_referer' ), self_admin_url( 'admin.php?page=add-friend' ) ) ) ),
116 + 'preview-feed'
117 + )
118 + ) . '" target="_blank"',
166 119 '</label>' . $select
167 120 ),
168 121 array(
169 122 'select' => array(
@@ -181,9 +134,9 @@
181 134 ),
182 135 )
183 136 );
184 137 ?>
185 - <p class="description details hidden">
138 + <p class="description details">
186 139 <?php
187 140 // translators: %s is the type of a feed, for example Atom or RSS.
188 141 echo esc_html( sprintf( __( 'Type: %s', 'friends' ), $details['type'] ) );
189 142 echo ' | ';
@@ -189,9 +142,9 @@
189 142 echo ' | ';
190 143
191 144 $select = '<select name="feeds[' . esc_attr( $c ) . '][parser]">';
192 145 foreach ( $args['registered_parsers'] as $slug => $parser_name ) {
193 - $select .= '<option value="' . esc_attr( $slug ) . '"' . selected( $details['parser'], $slug, false ) . '>' . esc_html( strip_tags( $parser_name ) ) . '</option>';
146 + $select .= '<option value="' . esc_attr( $slug ) . '"' . selected( $details['parser'], $slug, false ) . '>' . esc_html( wp_strip_all_tags( $parser_name ) ) . '</option>';
194 147 }
195 148 if ( ! isset( $args['registered_parsers'][ $details['parser'] ] ) ) {
196 149 // translators: %s is the name of a deleted parser.
197 150 $select .= '<option value="' . esc_attr( $details['parser'] ) . '" selected="selected">' . esc_html( sprintf( __( '%s (deleted)', 'friends' ), $details['parser'] ) ) . '</option>';
@@ -214,8 +167,18 @@
214 167 );
215 168 echo ' | ';
216 169 // translators: %s is relation to the URL, e.g. self or alternate.
217 170 echo esc_html( sprintf( __( 'rel: %s', 'friends' ), $details['rel'] ) );
171 + if ( isset( $details['additional-info'] ) ) {
172 + echo '<br>' . wp_kses(
173 + $details['additional-info'],
174 + array(
175 + 'b' => true,
176 + 'tt' => true,
177 + 'a' => array( 'href' => array() ),
178 + )
179 + );
180 + }
218 181 ?>
219 182 </p>
220 183 </li>
221 184 <?php endforeach; ?>
@@ -242,18 +205,14 @@
242 205 </p>
243 206 <div id="unsupported-feeds" class="hidden">
244 207 <p class="description details">
245 208 <?php
246 - echo wp_kses(
247 - // translators: %s is a URL to the plugin install page.
248 - sprintf( _n( '<a href=%s>There might be a plugin available</a> to add support for it.', '<a href=%s>There might be a plugin available</a> to add support for them.', count( $unsupported_feeds ), 'friends' ), '"' . self_admin_url( 'admin.php?page=friends-plugins' ) . '"' ),
249 - array( 'a' => array( 'href' => array() ) )
250 - );
209 + echo esc_html( _n( 'There might be a plugin available to add support for it.', 'There might be a plugin available to add support for them.', count( $unsupported_feeds ), 'friends' ) );
251 210 ?>
252 211 </p>
253 212 <ul>
254 213 <?php foreach ( $unsupported_feeds as $feed_url => $details ) : ?>
255 - <?php $c += 1; ?>
214 + <?php ++$c; ?>
256 215 <li>
257 216 <?php foreach ( $details as $key => $value ) : ?>
258 217 <input type="hidden" name="feeds[<?php echo esc_attr( $c ); ?>][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $value ); ?>" />
259 218 <?php endforeach; ?>
@@ -314,9 +273,9 @@
314 273 </tr>
315 274 <tr>
316 275 <th></th>
317 276 <td>
318 - <input type="submit" class="button button-primary" name="step3" value="<?php echo esc_attr_x( 'Add Friend »', 'button', 'friends' ); ?>" />
277 + <input type="submit" class="button button-primary" name="step3" value="<?php echo esc_attr_x( 'Follow »', 'button', 'friends' ); ?>" />
319 278 </td>
320 279 </tr>
321 280 </tbody>
322 281 </table>