PluginProbe
Friends / 2.8.4
Friends v2.8.4
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 / settings.php

settings.php in Friends 2.8.4, at templates/admin/settings.php

495 lines 19.3 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 Friends Settings.
4 *
5 * @package Friends
6 */
7
8 $comment_registration_class = '';
9 if ( ! $args['comment_registration'] ) {
10 $comment_registration_class = 'hidden';
11 }
12
13 $codeword_class = '';
14 if ( 'friends' === $args['codeword'] || ! $args['require_codeword'] ) {
15 $codeword_class = 'hidden';
16 }
17
18 do_action( 'friends_settings_before_form' );
19
20 ?>
21 <form method="post">
22 <?php wp_nonce_field( 'friends-settings' ); ?>
23 <table class="form-table">
24 <tbody>
25 <?php if ( current_user_can( 'manage_options' ) ) : ?>
26 <tr>
27 <th scope="row"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Comments' ); ?></th>
28 <td>
29 <fieldset>
30 <label for="comment_registration">
31 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked( '1', $args['comment_registration'] ); ?> />
32 <span><?php esc_html_e( 'Only people in your network can comment.', 'friends' ); ?></span>
33 </label>
34 </fieldset>
35 <div id="comment_registration_options" class="<?php echo esc_attr( $comment_registration_class ); ?>">
36 <fieldset>
37 <label for="comment_registration_message">
38 <p><?php esc_html_e( 'Display this message for logged-out users:', 'friends' ); ?></p>
39 </label>
40 <p>
41 <textarea name="comment_registration_message" id="comment_registration_message" class="regular-text" rows="3" cols="80" placeholder="<?php echo esc_attr( $args['comment_registration_default'] ); ?>"><?php echo esc_html( $args['comment_registration_message'] ); ?></textarea>
42 </p>
43 <p class="description">
44 <?php
45 echo wp_kses(
46 sprintf(
47 // translators: %1$s is the translation for "my network", %2$s is the URL for your public profile page.
48 __( 'We\'ll link "%1$s" to <a href=%2$s>your public profile page</a>.', 'friends' ),
49 $args['my_network'],
50 $args['public_profile_link']
51 ),
52 array(
53 'a' => array(
54 'href' => array(),
55 ),
56 )
57 );
58 ?>
59 </p>
60 </fieldset>
61 </div>
62 </td>
63 </tr>
64 <?php
65 endif;
66 if ( $args['potential_main_users']->get_total() > 1 ) :
67 ?>
68 <tr>
69 <th scope="row"><?php esc_html_e( 'Main Friend User', 'friends' ); ?></th>
70 <td>
71 <?php if ( current_user_can( 'manage_options' ) ) { ?>
72 <select name="main_user_id">
73 <?php foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) : ?>
74 <option value="<?php echo esc_attr( $potential_main_user->ID ); ?>" <?php selected( $args['main_user_id'], $potential_main_user->ID ); ?>><?php echo esc_html( $potential_main_user->display_name ); ?></option>
75
76 <?php endforeach; ?>
77 </select>
78 <p class="description"><span><?php esc_html_e( 'Since there are multiple users on this site, we need to know which one should be considered the main one.', 'friends' ); ?></span> <span><?php esc_html_e( 'They can edit friends-related settings.', 'friends' ); ?></span> <span><?php esc_html_e( 'Whenever a friends-related action needs to be associated with a user, this one will be chosen.', 'friends' ); ?></span></p>
79 <?php
80 } else {
81 $c = 0;
82 foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) {
83 $c += 1;
84 if ( $potential_main_user->ID === $args['main_user_id'] ) {
85 ?>
86 <span id="main_user_id"><?php echo esc_html( $potential_main_user->display_name ); ?></span>
87 <?php
88 }
89 }
90 ?>
91 <span> (
92 <?php
93 echo esc_html(
94 sprintf(
95 // translators: %s is a number of users.
96 _n( '%s potential user', '%s potential users', $c, 'friends' ),
97 $c
98 )
99 );
100 ?>
101 ) </span>
102 <p class="description"><?php esc_html_e( 'An administrator can change this.', 'friends' ); ?></p>
103 <?php
104 }
105 ?>
106 </td>
107 </tr>
108 <?php
109 endif;
110 ?>
111 <tr>
112 <th scope="row"><?php esc_html_e( 'Friend Requests', 'friends' ); ?></th>
113 <td>
114 <fieldset>
115 <label for="require_codeword">
116 <input name="require_codeword" type="checkbox" id="require_codeword" value="1" <?php checked( '', $codeword_class ); ?>>
117 <span><?php esc_html_e( 'Require a code word to send you friend request', 'friends' ); ?></span>
118 </label>
119 </fieldset>
120 <div id="codeword_options" class="<?php echo esc_attr( $codeword_class ); ?>">
121 <fieldset>
122 <label for="codeword">
123 <span><?php esc_html_e( 'This code word must be provided to send you a friend request:', 'friends' ); ?></span>
124 <input name="codeword" type="text" id="codeword" placeholder="friends" value="<?php echo esc_attr( $args['codeword'] ); ?>" />
125 </label>
126 <p class="description">
127 <?php esc_html_e( "You'll need to communicate the code word to potential friends through another medium.", 'friends' ); ?>
128 </p>
129 </fieldset>
130 <fieldset>
131 <label for="wrong_codeword_message">
132 <p><?php esc_html_e( 'Error message for a wrong code word:', 'friends' ); ?></p>
133 </label>
134 <p>
135 <textarea name="wrong_codeword_message" id="wrong_codeword_message" class="regular-text" rows="3" cols="80" placeholder="<?php echo esc_attr( __( 'Return this message to the friend requestor if a wrong code word was provided.', 'friends' ) ); ?>"><?php echo esc_html( $args['wrong_codeword_message'] ); ?></textarea>
136 </p>
137 </fieldset>
138 </div>
139 </td>
140 </tr>
141 <tr>
142 <th scope="row">
143 <?php
144 esc_html_e( 'E-Mail Notifications', 'friends' );
145 ?>
146 </th>
147 <td>
148 <fieldset>
149 <label for="friend_request_notification">
150 <input name="friend_request_notification" type="checkbox" id="friend_request_notification" value="1" <?php checked( '1', ! $args['no_friend_request_notification'] ); ?>>
151 <span><?php esc_html_e( 'Friend Requests', 'friends' ); ?></span>
152 </label>
153 <br />
154 <label for="new_post_notification">
155 <input name="new_post_notification" type="checkbox" id="new_post_notification" value="1" <?php checked( '1', ! $args['no_new_post_notification'] ); ?>>
156 <span><?php esc_html_e( 'New Posts', 'friends' ); ?></span>
157 </label>
158 </fieldset>
159 <p class="description"><?php esc_html_e( 'You can also change this setting for each friend separately.', 'friends' ); ?></p>
160 </td>
161 </tr>
162 <tr>
163 <th scope="row">
164 <?php
165 esc_html_e( 'Keyword Notifications', 'friends' );
166 ?>
167 </th>
168 <td>
169 <fieldset>
170
171 <ol id="keyword-notifications">
172 <li id="keyword-template" style="display: none">
173 <input type="checkbox" name="notification_keywords_enabled[0]" value="1" checked />
174 <input type="text" name="notification_keywords[0]" value="" placeholder="<?php esc_html_e( 'Keyword (regex allowed)', 'friends' ); ?>">
175 </li>
176 <?php foreach ( $args['notification_keywords'] as $i => $entry ) : ?>
177 <li>
178 <input type="checkbox" name="notification_keywords_enabled[<?php echo esc_attr( $i + 1 ); ?>]" value="1" <?php checked( $entry['enabled'] ); ?> />
179 <input type="text" name="notification_keywords[<?php echo esc_attr( $i + 1 ); ?>]" value="<?php echo esc_attr( $entry['keyword'] ); ?>" placeholder="<?php esc_html_e( 'Keyword (regex allowed)', 'friends' ); ?>">
180 </li>
181 <?php endforeach; ?>
182 </ol>
183 <a href="" id="admin-add-keyword"><?php esc_html_e( 'Add a notification keyword', 'friends' ); ?></a>
184 </fieldset>
185 <p class="description"><?php esc_html_e( 'Empty keywords will be deleted after saving. You can temporarily disable them with the checkbox.', 'friends' ); ?></p>
186 </td>
187 </tr>
188 <tr>
189 <th scope="row"><?php esc_html_e( 'Roles', 'friends' ); ?></th>
190 <td>
191 <select name="default_role">
192 <?php
193 foreach ( $args['friend_roles'] as $role => $title ) :
194 ?>
195 <option value="<?php echo esc_attr( $role ); ?>" <?php selected( $args['default_role'], $role ); ?>><?php echo esc_html( $title ); ?></option>
196
197 <?php endforeach; ?>
198 </select>
199 <p class="description">
200 <span><?php esc_html_e( 'When accepting a friend request, first assign this role.', 'friends' ); ?></span>
201 <span><?php esc_html_e( 'An Acquaintance has friend status but cannot read private posts.', 'friends' ); ?></span>
202 </p>
203 </td>
204 </tr>
205 <tr>
206 <th><?php esc_html_e( 'Retention', 'friends' ); ?></th>
207 <td>
208 <fieldset>
209 <div>
210 <input type="checkbox" name="friends_enable_retention_days" id="friends_enable_retention_days" value="1" <?php checked( '1', $args['retention_days_enabled'] ); ?> />
211 <span id="friends_enable_retention_days_line" class="<?php echo esc_attr( $args['retention_days_enabled'] ? '' : 'disabled' ); ?>">
212 <?php
213 echo '<span>';
214 echo wp_kses(
215 sprintf(
216 // translators: %s is an input field that allows specifying a number.
217 __( 'Only keep posts for %s days.', 'friends' ),
218 '<input type="number" min="1" id="friends_retention_days" name="friends_retention_days" value="' . esc_attr( $args['retention_days'] ) . '"' . ( $args['retention_days_enabled'] ? '' : ' disabled="disabled"' ) . ' size="3">'
219 ),
220 array(
221 'input' => array(
222 'type' => array(),
223 'min' => array(),
224 'id' => array(),
225 'name' => array(),
226 'value' => array(),
227 'size' => array(),
228 'disabled' => array(),
229 ),
230 )
231 );
232 echo '</span> <span>';
233 echo esc_html(
234 sprintf(
235 // translators: %s is a date.
236 __( 'Earliest post: %s', 'friends' ),
237 /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ date_i18n( __( 'F j, Y' ), $args['earliest_post_date'] )
238 )
239 );
240 echo '</span>';
241 ?>
242 </span>
243 </div>
244 <div>
245 <input type="checkbox" name="friends_enable_retention_number" id="friends_enable_retention_number" value="1" <?php checked( '1', $args['retention_number_enabled'] ); ?> />
246 <span id="friends_enable_retention_number_line" class="<?php echo esc_attr( $args['retention_number_enabled'] ? '' : 'disabled' ); ?>">
247 <?php
248 echo '<span>';
249 echo wp_kses(
250 sprintf(
251 // translators: %s is an input field that allows specifying a number.
252 __( 'Only keep the last %s posts.', 'friends' ),
253 '<input type="number" min="1" id="friends_retention_number" name="friends_retention_number" value="' . esc_attr( $args['retention_number'] ) . '"' . ( $args['retention_number_enabled'] ? '' : ' disabled="disabled"' ) . ' size="3">'
254 ),
255 array(
256 'input' => array(
257 'type' => array(),
258 'min' => array(),
259 'id' => array(),
260 'name' => array(),
261 'value' => array(),
262 'size' => array(),
263 'disabled' => array(),
264 ),
265 )
266 );
267 echo '</span> <span>';
268 echo esc_html(
269 sprintf(
270 // translators: %s is a date.
271 __( 'Current number of posts: %s', 'friends' ),
272 number_format_i18n( $args['post_count'] )
273 )
274 );
275 echo '</span>';
276 ?>
277 </span>
278 </div>
279 </fieldset>
280 <p class="description">
281 <?php
282 echo esc_html(
283 sprintf(
284 // translators: %s is a size in bytes or kilo bytes (kB).
285 __( 'Currently the posts use %s of disk space.', 'friends' ),
286 size_format( $args['total_size'], 1 )
287 )
288 );
289 ?>
290 </p>
291 <p class="description">
292 <span><?php esc_html_e( 'If you need to limit the amount of space, choose one of the options above (they can be combined).', 'friends' ); ?></span>
293 <span>
294 <?php
295 esc_html_e( 'The next auto-delete will kick in when refreshing the feeds.', 'friends' );
296 ?>
297 </span>
298 </p>
299 <p class="description">
300 <?php
301 esc_html_e( 'You can also specify this for individual friends.', 'friends' );
302 ?>
303 </p>
304 </td>
305 </tr>
306 <?php if ( current_user_can( 'manage_options' ) ) : ?>
307 <tr>
308 <th scope="row"><?php esc_html_e( 'Post Formats', 'friends' ); ?></th>
309 <td>
310 <fieldset>
311 <label for="limit_homepage_post_format">
312 <?php
313 $select = '<select name="limit_homepage_post_format" id="limit_homepage_post_format">';
314 $select .= '<option value="0"' . selected( $args['limit_homepage_post_format'], false, false ) . '>' . esc_html( _x( 'All', 'All post-formats', 'friends' ) ) . '</option>';
315 foreach ( $args['post_format_strings'] as $format => $title ) {
316 // translators: %s is a post format title.
317 $select .= '<option value="' . esc_attr( $format ) . '"' . selected( $args['limit_homepage_post_format'], $format, false ) . '>' . esc_html( sprintf( _x( '%s only', 'post-format only', 'friends' ), $title ) ) . '</option>';
318 }
319 $select .= '</select>';
320
321 echo wp_kses(
322 sprintf(
323 // translators: %s is a Select dropdown of post formats, e.g. "All" or "Standard only" (see "post-format only").
324 __( 'On your homepage, show %s posts.', 'friends' ),
325 $select
326 ),
327 array(
328 'select' => array(
329 'name' => array(),
330 ),
331 'label' => array(),
332 'option' => array(
333 'value' => array(),
334 'selected' => array(),
335 ),
336 'a' => array(
337 'href' => array(),
338 'rel' => array(),
339 'target' => array(),
340 ),
341 )
342 );
343 ?>
344 </label>
345 <br/>
346
347 <label for="force_enable_post_formats">
348 <input name="force_enable_post_formats" type="checkbox" id="force_enable_post_formats" value="1" <?php checked( '1', $args['force_enable_post_formats'] ); ?>>
349 <span><?php esc_html_e( 'Always enable Post Formats, regardless of the theme support.', 'friends' ); ?></span>
350 <p class="description">
351 <?php
352 echo wp_kses(
353 __( 'With <a href="https://wordpress.org/support/article/post-formats/#supported-formats">Post Formats</a> you can categorize your content in a more detailed way. Examples for post formats are "photo" or "link."', 'friends' ),
354 array(
355 'a' => array(
356 'href' => array(),
357 'rel' => array(),
358 'target' => array(),
359 ),
360 )
361 );
362 ?>
363 </p>
364 </label><br/>
365
366 <label for="expose_post_format_feeds">
367 <?php if ( current_theme_supports( 'post-format-feeds' ) ) : ?>
368 <span><?php esc_html_e( 'Your theme already supports exposing Post Formats as alternate feeds on your homepage.', 'friends' ); ?></span>
369 <?php else : ?>
370 <input name="expose_post_format_feeds" type="checkbox" id="expose_post_format_feeds" value="1" <?php checked( '1', $args['expose_post_format_feeds'] ); ?>>
371 <span>
372 <?php
373 // translators: %s is a HTML snippet.
374 echo wp_kses( sprintf( __( 'Expose Post Formats as alternate feeds on your homepage (as %s).', 'friends' ), '<code>&lt;link rel="alternate"/ &gt;</code>' ), array( 'code' => array() ) );
375 ?>
376 </span>
377 <?php endif; ?>
378 </fieldset>
379 </td>
380 </tr>
381 <?php endif; ?>
382 <tr>
383 <th scope="row"><?php esc_html_e( 'Reactions', 'friends' ); ?></th>
384 <td>
385 <fieldset>
386 <span><?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?></span>
387
388 <ol id="available-emojis">
389 <?php
390 foreach ( Friends\Reactions::get_available_emojis() as $id => $data ) {
391 Friends\Friends::template_loader()->get_template_part(
392 'admin/add-reaction-li',
393 null,
394 array(
395 'id' => $id,
396 'emoji' => $data->char,
397 )
398 );
399 }
400 ?>
401 </ol>
402 <a href="" id="admin-add-emoji"><?php esc_html_e( 'Add an emoji', 'friends' ); ?></a>
403 <?php Friends\Friends::template_loader()->get_template_part( 'admin/reactions-picker' ); ?>
404 </fieldset>
405 </td>
406 </tr>
407 <tr>
408 <th scope="row" rowspan="2"><?php esc_html_e( 'Frontend', 'friends' ); ?></th>
409 <td>
410 <fieldset>
411 <label for="frontend-default-view">
412 <span><?php esc_html_e( 'Default view:', 'friends' ); ?></span>
413 <select name="frontend_default_view" id="frontend-default-view">
414 <option value="expanded"<?php selected( $args['frontend_default_view'], 'expanded' ); ?>><?php esc_html_e( 'Expanded', 'friends' ); ?></option>
415 <option value="collapsed"<?php selected( $args['frontend_default_view'], 'collapsed' ); ?>><?php esc_html_e( 'Collapsed', 'friends' ); ?></option>
416 </select>
417 </label>
418 </fieldset>
419 </td>
420 </tr>
421 <?php if ( ! function_exists( 'classicpress_version' ) ) : ?>
422 <tr>
423 <td>
424 <fieldset>
425 <label for="blocks_everywhere">
426 <input name="blocks_everywhere" type="checkbox" id="blocks_everywhere" value="1" <?php checked( '1', $args['blocks_everywhere'] ); ?> disabled="disabled" />
427 <span><?php esc_html_e( 'Unfortunately, Gutenberg on the frontend is currently unavailable.', 'friends' ); ?></span>
428 </label>
429 </fieldset>
430 </td>
431 </tr>
432 <?php endif; ?>
433 <tr>
434 <th scope="row" rowspan="2"><?php esc_html_e( 'Feed Reader', 'friends' ); ?></th>
435 <td>
436 <span>
437 <?php
438 // translators: %s is a URL.
439 echo wp_kses( sprintf( __( 'Download the <a href=%s>Private OPML file (contains private urls!)</a> and import it to your feed reader.', 'friends' ), esc_url( home_url( '/friends/opml/?auth=' . $args['private_rss_key'] ) ) ), array( 'a' => array( 'href' => array() ) ) );
440 ?>
441 </span>
442 <span>
443 <?php
444 // translators: %s is a URL.
445 echo wp_kses( sprintf( __( 'Alternative: <a href=%s>Public OPML file (only public urls)</a>.', 'friends' ), esc_url( home_url( '/friends/opml/?public' ) ) ), array( 'a' => array( 'href' => array() ) ) );
446 ?>
447 </span>
448 <p class="description">
449 <?php
450 echo __( 'If your feed reader supports it, you can also subscribe to this URL as the OPML file gets updated as you add or remove friends.', 'friends' );
451 ?>
452 </p>
453 </td>
454 </tr>
455 <tr>
456 <td>
457 <span>
458 <?php
459 // translators: %s is a URL.
460 echo wp_kses( sprintf( __( 'You can also subscribe to a <a href=%s>compiled RSS feed of friend posts</a>.', 'friends' ), esc_url( home_url( '/friends/feed/?auth=' . $args['private_rss_key'] ) ) ), array( 'a' => array( 'href' => array() ) ) );
461 ?>
462 </span>
463 <p class="description">
464 <?php
465 echo __( 'Please be careful what you do with these feeds as they might contain private posts of your friends.', 'friends' );
466 ?>
467 </p>
468
469 </td>
470 </tr>
471 </tbody>
472 </table>
473 <?php do_action( 'friends_settings_form_bottom' ); ?>
474 <p class="submit">
475 <input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>">
476 </p>
477 <?php if ( ! current_user_can( 'manage_options' ) ) : ?>
478 <p class="description">
479 <?php esc_html_e( 'Administrators have access to these additional settings:', 'friends' ); ?>
480 <ul class="ul-disc">
481 <?php
482 foreach ( array(
483 __( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
484 __( 'Post Formats', 'friends' ),
485 ) as $setting ) :
486 ?>
487 <li><?php echo esc_html( $setting ); ?></li>
488 <?php endforeach; ?>
489 </ul>
490 </p>
491 <?php endif; ?>
492 </form>
493 <?php
494 do_action( 'friends_settings_after_form' );
495