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 / frontend / select-feeds.php

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

285 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 Admin Send Friend Request form.
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 // translators: %s is a URL.
32 echo wp_kses(
33 // translators: %1$s is a URL, %2$s is an admin link.
34 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'] ) . '"' ),
35 array(
36 'strong' => array(),
37 'a' => array( 'href' => array() ),
38 )
39 );
40 ?>
41 </p>
42
43 <table class="form-table">
44 <tbody>
45 <tr>
46 <th scope="row"><label for="display_name"><?php esc_html_e( 'Display Name', 'friends' ); ?></label></th>
47 <td>
48 <?php if ( ! empty( $args['friends_multisite_display_name'] ) ) : ?>
49 <?php echo esc_html( $args['friends_multisite_display_name'] ); ?>
50 <input type="hidden" id="display_name" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" />
51 <p class="description">
52 <?php esc_html_e( 'This user already exists on your WordPress network. Their display name cannot be changed here.', 'friends' ); ?>
53 </p>
54 <?php else : ?>
55 <input type="text" id="display_name" name="display_name" value="<?php echo esc_attr( $args['friend_display_name'] ); ?>" required placeholder="" class="regular-text" />
56 <?php endif; ?>
57 </td>
58 </tr>
59 <tr>
60 <th scope="row"><label for="user_login"><?php esc_html_e( 'Username', 'friends' ); ?></label></th>
61 <td>
62 <?php if ( ! empty( $args['friends_multisite_user_login'] ) ) : ?>
63 <?php echo esc_html( $args['friends_multisite_user_login'] ); ?>
64 <input type="hidden" id="user_login" name="user_login" value="<?php echo esc_attr( $args['friends_multisite_user_login'] ); ?>" />
65 <p class="description">
66 <?php esc_html_e( 'This user already exists on your WordPress network. Their username cannot be changed here.', 'friends' ); ?>
67 </p>
68 <?php else : ?>
69 <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" />
70 <?php endif; ?>
71 </td>
72 </tr>
73 <tr>
74 <th scope="row"><?php esc_html_e( 'Follow', 'friends' ); ?></th>
75 <td>
76 <?php if ( ! empty( $args['feeds_notice'] ) ) : ?>
77 <strong><?php echo wp_kses( $args['feeds_notice'], array( 'a' => array( 'href' => array() ) ) ); ?></strong>
78 <?php endif; ?>
79 <ul>
80 <?php foreach ( $args['feeds'] as $feed_url => $details ) : ?>
81 <?php
82 ++$c;
83 $classes = '';
84 if ( $c > 0 && ! $details['autoselect'] ) {
85 ++$hidden_feed_count;
86 $classes .= 'rel-alternate hidden';
87 }
88 ?>
89 <li class="<?php echo esc_attr( $classes ); ?>">
90 <?php foreach ( $details as $key => $value ) : ?>
91 <?php
92 if ( 'post-format' === $key ) {
93 continue;
94 }
95 ?>
96 <input type="hidden" name="feeds[<?php echo esc_attr( $c ); ?>][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $value ); ?>" />
97 <?php endforeach; ?>
98 <label><input type="checkbox" name="subscribe[]" value="<?php echo esc_attr( $feed_url ); ?>" <?php echo ( isset( $details['autoselect'] ) && $details['autoselect'] ) ? ' checked' : ''; ?> />
99 <?php
100 if ( ! isset( $details['post-format'] ) ) {
101 $details['post-format'] = 'standard';
102 }
103 $select = '<select name="feeds[' . esc_attr( $c ) . '][post-format]">';
104 foreach ( $args['post_formats'] as $format => $_title ) {
105 $select .= '<option value="' . esc_attr( $format ) . '"' . selected( $details['post-format'], $format, false ) . '>' . esc_html( $_title ) . '</option>';
106 }
107 $select .= '</select>';
108
109 echo wp_kses(
110 sprintf(
111 // 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.
112 __( 'Subscribe %1$s (<a href=%2$s>preview</a>) as %3$s', 'friends' ),
113 '<a href="' . esc_attr( $feed_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $details['title'] ) . '</a>',
114 '"' . esc_url(
115 wp_nonce_url(
116 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' ) ) ) ),
117 'preview-feed'
118 )
119 ) . '" target="_blank"',
120 '</label>' . $select
121 ),
122 array(
123 'select' => array(
124 'name' => array(),
125 ),
126 'label' => array(),
127 'option' => array(
128 'value' => array(),
129 'selected' => array(),
130 ),
131 'a' => array(
132 'href' => array(),
133 'rel' => array(),
134 'target' => array(),
135 ),
136 )
137 );
138 ?>
139 <p class="description details">
140 <?php
141 // translators: %s is the type of a feed, for example Atom or RSS.
142 echo esc_html( sprintf( __( 'Type: %s', 'friends' ), $details['type'] ) );
143 echo ' | ';
144
145 $select = '<select name="feeds[' . esc_attr( $c ) . '][parser]">';
146 foreach ( $args['registered_parsers'] as $slug => $parser_name ) {
147 $select .= '<option value="' . esc_attr( $slug ) . '"' . selected( $details['parser'], $slug, false ) . '>' . esc_html( wp_strip_all_tags( $parser_name ) ) . '</option>';
148 }
149 if ( ! isset( $args['registered_parsers'][ $details['parser'] ] ) ) {
150 // translators: %s is the name of a deleted parser.
151 $select .= '<option value="' . esc_attr( $details['parser'] ) . '" selected="selected">' . esc_html( sprintf( __( '%s (deleted)', 'friends' ), $details['parser'] ) ) . '</option>';
152 }
153 $select .= '</select>';
154
155 echo wp_kses(
156 // translators: %s is the name of a parser, e.g. simplepie.
157 sprintf( __( 'Parser: %s', 'friends' ), $select ),
158 array(
159 'select' => array(
160 'name' => array(),
161 ),
162 'label' => array(),
163 'option' => array(
164 'value' => array(),
165 'selected' => array(),
166 ),
167 )
168 );
169 echo ' | ';
170 // translators: %s is relation to the URL, e.g. self or alternate.
171 echo esc_html( sprintf( __( 'rel: %s', 'friends' ), $details['rel'] ) );
172 if ( isset( $details['additional-info'] ) ) {
173 echo '<br>' . wp_kses(
174 $details['additional-info'],
175 array(
176 'b' => true,
177 'tt' => true,
178 'a' => array( 'href' => array() ),
179 )
180 );
181 }
182 ?>
183 </p>
184 </li>
185 <?php endforeach; ?>
186 </ul>
187 <p>
188 <a href="" id="show-alternate-feeds">
189 <?php
190 // translators: %d is the number of feeds.
191 echo esc_html( sprintf( _n( '%d more feed is available', '%d more feeds are available', $hidden_feed_count, 'friends' ), $hidden_feed_count ) );
192 ?>
193 </a>
194 | <a href="" id="show-details"><?php esc_html_e( 'Display feed metadata', 'friends' ); ?></a>
195 </p>
196 <?php if ( ! empty( $unsupported_feeds ) ) : ?>
197 <p>
198 <small>
199 <a href="" id="show-unsupported-feeds">
200 <?php
201 // translators: %d is the number of feeds.
202 echo esc_html( sprintf( _n( 'Show %d unsupported feed', 'Show %d unsupported feeds', count( $unsupported_feeds ), 'friends' ), count( $unsupported_feeds ) ) );
203 ?>
204 </a>
205 </small>
206 </p>
207 <div id="unsupported-feeds" class="hidden">
208 <p class="description details">
209 <?php
210 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' ) );
211 ?>
212 </p>
213 <ul>
214 <?php foreach ( $unsupported_feeds as $feed_url => $details ) : ?>
215 <?php ++$c; ?>
216 <li>
217 <?php foreach ( $details as $key => $value ) : ?>
218 <input type="hidden" name="feeds[<?php echo esc_attr( $c ); ?>][<?php echo esc_attr( $key ); ?>]" value="<?php echo esc_attr( $value ); ?>" />
219 <?php endforeach; ?>
220 <?php
221 echo wp_kses(
222 sprintf(
223 // translators: %s is a link to a feed with its name as text.
224 __( 'Unsupported: %s', 'friends' ),
225 '<a href="' . esc_attr( $feed_url ) . '" target="_blank" rel="noopener noreferrer">' . esc_html( $details['title'] ) . '</a> <small>' . esc_html( $feed_url ) . '</small>'
226 ),
227 array(
228 'a' => array(
229 'href' => array(),
230 'rel' => array(),
231 'target' => array(),
232 ),
233 'small' => array(),
234 )
235 );
236 ?>
237 <p class="description details hidden">
238 <?php
239 // translators: %s is the type of a feed, for example Atom or RSS.
240 echo esc_html( sprintf( __( 'Type: %s', 'friends' ), $details['type'] ) );
241 echo ' | ';
242 // translators: %s is relation to the URL, e.g. self or alternate.
243 echo esc_html( sprintf( __( 'rel: %s', 'friends' ), $details['rel'] ) );
244 ?>
245 </p>
246 </li>
247 <?php endforeach; ?>
248 </ul>
249 </div>
250 <?php endif; ?>
251 </td>
252 </tr>
253 <tr class="another-feed hidden">
254 <th scope="row"></th>
255 <td>
256 <input type="url" name="add_feed[]" value="" placeholder="Add another feed URL" />
257 <input type="submit" class="button" name="step2" value="<?php echo esc_attr_x( 'Check & add feed', 'button', 'friends' ); ?>" />
258 <p class="description">
259 <?php
260 echo wp_kses(
261 // translators: %s is a list of parser names.
262 sprintf( __( 'The following parsers are available: %s', 'friends' ), implode( ', ', $args['registered_parsers'] ) ),
263 array(
264 'a' => array(
265 'href' => array(),
266 'rel' => array(),
267 'target' => array(),
268 ),
269 )
270 );
271 ?>
272 </p>
273 </td>
274 </tr>
275 <tr>
276 <th></th>
277 <td>
278 <input type="submit" class="button button-primary" name="step3" value="<?php echo esc_attr_x( 'Add Friend ยป', 'button', 'friends' ); ?>" />
279 </td>
280 </tr>
281 </tbody>
282 </table>
283
284 </form>
285