PluginProbe
Friends / 4.3.1
Friends v4.3.1
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 / select-feeds.php

select-feeds.php in Friends 4.3.1, at templates/admin/select-feeds.php

284 lines 11.0 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 feed selection form for following someone.
4 *
5 * @package Friends
6 */
7
8 $c = -1;
9 $hidden_feed_count = 0;
10 $unsupported_feeds = array();
11
12 foreach ( $args['feeds'] as $feed_url => $details ) {
13 if ( ! isset( $details['parser'] ) || 'unsupported' === $details['parser'] ) {
14 $unsupported_feeds[ $feed_url ] = $details;
15 unset( $args['feeds'][ $feed_url ] );
16 continue;
17 }
18 if ( ! isset( $details['url'] ) ) {
19 $args['feeds'][ $feed_url ]['url'] = $feed_url;
20 }
21 if ( ! isset( $details['autoselect'] ) ) {
22 $args['feeds'][ $feed_url ]['autoselect'] = false;
23 }
24 }
25
26 ?><div class="wrap"><form method="post">
27 <?php wp_nonce_field( 'add-friend' ); ?>
28 <input type="hidden" name="friend_url" value="<?php echo esc_url( $args['friend_url'] ); ?>" />
29 <p>
30 <?php
31 echo wp_kses(
32 // translators: %1$s is a URL, %2$s is an admin link.
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'] ) . '"' ),
34 array(
35 'strong' => array(),
36 'a' => array( 'href' => array() ),
37 )
38 );
39 ?>
40 </p>
41
42 <table class="form-table">
43 <tbody>
44 <tr>
45 <th scope="row"><label for="display_name"><?php esc_html_e( 'Display Name', 'friends' ); ?></label></th>
46 <td>
47 <?php if ( ! empty( $args['friends_multisite_display_name'] ) ) : ?>
48 <?php echo esc_html( $args['friends_multisite_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>
53 <?php else : ?>
54 <input type="text" id="display_name" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" required placeholder="" class="regular-text" />
55 <?php endif; ?>
56 </td>
57 </tr>
58 <tr>
59 <th scope="row"><label for="user_login"><?php esc_html_e( 'Username', 'friends' ); ?></label></th>
60 <td>
61 <?php if ( ! empty( $args['friends_multisite_user_login'] ) ) : ?>
62 <?php echo esc_html( $args['friends_multisite_user_login'] ); ?>
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>
67 <?php else : ?>
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" />
69 <?php endif; ?>
70 </td>
71 </tr>
72 <tr>
73 <th scope="row"><?php esc_html_e( 'Follow', 'friends' ); ?></th>
74 <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; ?>
78 <ul>
79 <?php foreach ( $args['feeds'] as $feed_url => $details ) : ?>
80 <?php
81 ++$c;
82 $classes = '';
83 if ( $c > 0 && ! $details['autoselect'] ) {
84 ++$hidden_feed_count;
85 $classes .= 'rel-alternate hidden';
86 }
87 ?>
88 <li class="<?php echo esc_attr( $classes ); ?>">
89 <?php foreach ( $details as $key => $value ) : ?>
90 <?php
91 if ( 'post-format' === $key ) {
92 continue;
93 }
94 ?>
95 <input type="hidden" name="feeds[<?php echo esc_attr( $c ); ?>][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $value ); ?>" />
96 <?php endforeach; ?>
97 <label><input type="checkbox" name="subscribe[]" value="<?php echo esc_attr( $feed_url ); ?>" <?php echo ( isset( $details['autoselect'] ) && $details['autoselect'] ) ? ' checked' : ''; ?> />
98 <?php
99 if ( ! isset( $details['post-format'] ) ) {
100 $details['post-format'] = 'standard';
101 }
102 $select = '<select name="feeds[' . esc_attr( $c ) . '][post-format]">';
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>';
105 }
106 $select .= '</select>';
107
108 echo wp_kses(
109 sprintf(
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.
111 __( 'Subscribe %1$s (<a href=%2$s>preview</a>) as %3$s', 'friends' ),
112 '<a href="' . esc_attr( $feed_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $details['title'] ) . '</a>',
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"',
119 '</label>' . $select
120 ),
121 array(
122 'select' => array(
123 'name' => array(),
124 ),
125 'label' => array(),
126 'option' => array(
127 'value' => array(),
128 'selected' => array(),
129 ),
130 'a' => array(
131 'href' => array(),
132 'rel' => array(),
133 'target' => array(),
134 ),
135 )
136 );
137 ?>
138 <p class="description details">
139 <?php
140 // translators: %s is the type of a feed, for example Atom or RSS.
141 echo esc_html( sprintf( __( 'Type: %s', 'friends' ), $details['type'] ) );
142 echo ' | ';
143
144 $select = '<select name="feeds[' . esc_attr( $c ) . '][parser]">';
145 foreach ( $args['registered_parsers'] as $slug => $parser_name ) {
146 $select .= '<option value="' . esc_attr( $slug ) . '"' . selected( $details['parser'], $slug, false ) . '>' . esc_html( wp_strip_all_tags( $parser_name ) ) . '</option>';
147 }
148 if ( ! isset( $args['registered_parsers'][ $details['parser'] ] ) ) {
149 // translators: %s is the name of a deleted parser.
150 $select .= '<option value="' . esc_attr( $details['parser'] ) . '" selected="selected">' . esc_html( sprintf( __( '%s (deleted)', 'friends' ), $details['parser'] ) ) . '</option>';
151 }
152 $select .= '</select>';
153
154 echo wp_kses(
155 // translators: %s is the name of a parser, e.g. simplepie.
156 sprintf( __( 'Parser: %s', 'friends' ), $select ),
157 array(
158 'select' => array(
159 'name' => array(),
160 ),
161 'label' => array(),
162 'option' => array(
163 'value' => array(),
164 'selected' => array(),
165 ),
166 )
167 );
168 echo ' | ';
169 // translators: %s is relation to the URL, e.g. self or alternate.
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 }
181 ?>
182 </p>
183 </li>
184 <?php endforeach; ?>
185 </ul>
186 <p>
187 <a href="" id="show-alternate-feeds">
188 <?php
189 // translators: %d is the number of feeds.
190 echo esc_html( sprintf( _n( '%d more feed is available', '%d more feeds are available', $hidden_feed_count, 'friends' ), $hidden_feed_count ) );
191 ?>
192 </a>
193 | <a href="" id="show-details"><?php esc_html_e( 'Display feed metadata', 'friends' ); ?></a>
194 </p>
195 <?php if ( ! empty( $unsupported_feeds ) ) : ?>
196 <p>
197 <small>
198 <a href="" id="show-unsupported-feeds">
199 <?php
200 // translators: %d is the number of feeds.
201 echo esc_html( sprintf( _n( 'Show %d unsupported feed', 'Show %d unsupported feeds', count( $unsupported_feeds ), 'friends' ), count( $unsupported_feeds ) ) );
202 ?>
203 </a>
204 </small>
205 </p>
206 <div id="unsupported-feeds" class="hidden">
207 <p class="description details">
208 <?php
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' ) );
210 ?>
211 </p>
212 <ul>
213 <?php foreach ( $unsupported_feeds as $feed_url => $details ) : ?>
214 <?php ++$c; ?>
215 <li>
216 <?php foreach ( $details as $key => $value ) : ?>
217 <input type="hidden" name="feeds[<?php echo esc_attr( $c ); ?>][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $value ); ?>" />
218 <?php endforeach; ?>
219 <?php
220 echo wp_kses(
221 sprintf(
222 // translators: %s is a link to a feed with its name as text.
223 __( 'Unsupported: %s', 'friends' ),
224 '<a href="' . esc_attr( $feed_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $details['title'] ) . '</a> <small>' . esc_html( $feed_url ) . '</small>'
225 ),
226 array(
227 'a' => array(
228 'href' => array(),
229 'rel' => array(),
230 'target' => array(),
231 ),
232 'small' => array(),
233 )
234 );
235 ?>
236 <p class="description details hidden">
237 <?php
238 // translators: %s is the type of a feed, for example Atom or RSS.
239 echo esc_html( sprintf( __( 'Type: %s', 'friends' ), $details['type'] ) );
240 echo ' | ';
241 // translators: %s is relation to the URL, e.g. self or alternate.
242 echo esc_html( sprintf( __( 'rel: %s', 'friends' ), $details['rel'] ) );
243 ?>
244 </p>
245 </li>
246 <?php endforeach; ?>
247 </ul>
248 </div>
249 <?php endif; ?>
250 </td>
251 </tr>
252 <tr class="another-feed hidden">
253 <th scope="row"></th>
254 <td>
255 <input type="url" name="add_feed[]" value="" placeholder="Add another feed URL" />
256 <input type="submit" class="button" name="step2" value="<?php echo esc_attr_x( 'Check & add feed', 'button', 'friends' ); ?>" />
257 <p class="description">
258 <?php
259 echo wp_kses(
260 // translators: %s is a list of parser names.
261 sprintf( __( 'The following parsers are available: %s', 'friends' ), implode( ', ', $args['registered_parsers'] ) ),
262 array(
263 'a' => array(
264 'href' => array(),
265 'rel' => array(),
266 'target' => array(),
267 ),
268 )
269 );
270 ?>
271 </p>
272 </td>
273 </tr>
274 <tr>
275 <th></th>
276 <td>
277 <input type="submit" class="button button-primary" name="step3" value="<?php echo esc_attr_x( 'Follow ยป', 'button', 'friends' ); ?>" />
278 </td>
279 </tr>
280 </tbody>
281 </table>
282
283 </form>
284