PluginProbe
Friends / 2.7.4
Friends v2.7.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.7.4, at templates/admin/settings.php

478 lines 18.5 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"><?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' ); ?> <?php esc_html_e( 'They can edit friends-related settings.', 'friends' ); ?> <?php esc_html_e( 'Whenever a friends-related action needs to be associated with a user, this one will be chosen.', 'friends' ); ?></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 <?php esc_html_e( 'Require a code word to send you friend request', 'friends' ); ?>
118 </label>
119 </fieldset>
120 <div id="codeword_options" class="<?php echo esc_attr( $codeword_class ); ?>">
121 <fieldset>
122 <label for="codeword">
123 <?php esc_html_e( 'This code word must be provided to send you a friend request:', 'friends' ); ?> <input name="codeword" type="text" id="codeword" placeholder="friends" value="<?php echo esc_attr( $args['codeword'] ); ?>" />
124 </label>
125 <p class="description">
126 <?php esc_html_e( "You'll need to communicate the code word to potential friends through another medium.", 'friends' ); ?>
127 </p>
128 </fieldset>
129 <fieldset>
130 <label for="wrong_codeword_message">
131 <p><?php esc_html_e( 'Error message for a wrong code word:', 'friends' ); ?></p>
132 </label>
133 <p>
134 <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>
135 </p>
136 </fieldset>
137 </div>
138 </td>
139 </tr>
140 <tr>
141 <th scope="row">
142 <?php
143 esc_html_e( 'E-Mail Notifications', 'friends' );
144 ?>
145 </th>
146 <td>
147 <fieldset>
148 <label for="friend_request_notification">
149 <input name="friend_request_notification" type="checkbox" id="friend_request_notification" value="1" <?php checked( '1', ! $args['no_friend_request_notification'] ); ?>>
150 <?php esc_html_e( 'Friend Requests', 'friends' ); ?>
151 </label>
152 <br />
153 <label for="new_post_notification">
154 <input name="new_post_notification" type="checkbox" id="new_post_notification" value="1" <?php checked( '1', ! $args['no_new_post_notification'] ); ?>>
155 <?php esc_html_e( 'New Posts', 'friends' ); ?>
156 </label>
157 </fieldset>
158 <p class="description"><?php esc_html_e( 'You can also change this setting for each friend separately.', 'friends' ); ?></p>
159 </td>
160 </tr>
161 <tr>
162 <th scope="row">
163 <?php
164 esc_html_e( 'Keyword Notifications', 'friends' );
165 ?>
166 </th>
167 <td>
168 <fieldset>
169
170 <ol id="keyword-notifications">
171 <li id="keyword-template" style="display: none">
172 <input type="checkbox" name="notification_keywords_enabled[0]" value="1" checked />
173 <input type="text" name="notification_keywords[0]" value="" placeholder="<?php esc_html_e( 'Keyword (regex allowed)', 'friends' ); ?>">
174 </li>
175 <?php foreach ( $args['notification_keywords'] as $i => $entry ) : ?>
176 <li>
177 <input type="checkbox" name="notification_keywords_enabled[<?php echo esc_attr( $i + 1 ); ?>]" value="1" <?php checked( $entry['enabled'] ); ?> />
178 <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' ); ?>">
179 </li>
180 <?php endforeach; ?>
181 </ol>
182 <a href="" id="admin-add-keyword"><?php esc_html_e( 'Add a notification keyword', 'friends' ); ?></a>
183 </fieldset>
184 <p class="description"><?php esc_html_e( 'Empty keywords will be deleted after saving. You can temporarily disable them with the checkbox.', 'friends' ); ?></p>
185 </td>
186 </tr>
187 <tr>
188 <th scope="row"><?php esc_html_e( 'Roles', 'friends' ); ?></th>
189 <td>
190 <select name="default_role">
191 <?php
192 foreach ( $args['friend_roles'] as $role => $title ) :
193 ?>
194 <option value="<?php echo esc_attr( $role ); ?>" <?php selected( $args['default_role'], $role ); ?>><?php echo esc_html( $title ); ?></option>
195
196 <?php endforeach; ?>
197 </select>
198 <p class="description">
199 <?php esc_html_e( 'When accepting a friend request, first assign this role.', 'friends' ); ?>
200 <?php
201 esc_html_e( 'An Acquaintance has friend status but cannot read private posts.', 'friends' );
202 ?>
203 </p>
204 </td>
205 </tr>
206 <tr>
207 <th><?php esc_html_e( 'Retention', 'friends' ); ?></th>
208 <td>
209 <fieldset>
210 <div>
211 <input type="checkbox" name="friends_enable_retention_days" id="friends_enable_retention_days" value="1" <?php checked( '1', $args['retention_days_enabled'] ); ?> />
212 <span id="friends_enable_retention_days_line" class="<?php echo esc_attr( $args['retention_days_enabled'] ? '' : 'disabled' ); ?>">
213 <?php
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 '. ';
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 ?>
241 </span>
242 </div>
243 <div>
244 <input type="checkbox" name="friends_enable_retention_number" id="friends_enable_retention_number" value="1" <?php checked( '1', $args['retention_number_enabled'] ); ?> />
245 <span id="friends_enable_retention_number_line" class="<?php echo esc_attr( $args['retention_number_enabled'] ? '' : 'disabled' ); ?>">
246 <?php
247 echo wp_kses(
248 sprintf(
249 // translators: %s is an input field that allows specifying a number.
250 __( 'Only keep the last %s posts', 'friends' ),
251 '<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">'
252 ),
253 array(
254 'input' => array(
255 'type' => array(),
256 'min' => array(),
257 'id' => array(),
258 'name' => array(),
259 'value' => array(),
260 'size' => array(),
261 'disabled' => array(),
262 ),
263 )
264 );
265 echo '. ';
266 echo esc_html(
267 sprintf(
268 // translators: %s is a date.
269 __( 'Current number of posts: %s', 'friends' ),
270 number_format_i18n( $args['post_count'] )
271 )
272 );
273 ?>
274 </span>
275 </div>
276 </fieldset>
277 <p class="description">
278 <?php
279 echo esc_html(
280 sprintf(
281 // translators: %s is a size in bytes or kilo bytes (kB).
282 __( 'Currently the posts use %s of disk space.', 'friends' ),
283 size_format( $args['total_size'], 1 )
284 )
285 );
286 ?>
287 </p>
288 <p class="description">
289 <?php
290 echo ' ';
291 esc_html_e( 'If you need to limit the amount of space, choose one of the options above (they can be combined).', 'friends' );
292 echo ' ';
293 esc_html_e( 'The next auto-delete will kick in when refreshing the feeds.', 'friends' );
294 ?>
295 </p>
296 <p class="description">
297 <?php
298 esc_html_e( 'You can also specify this for individual friends.', 'friends' );
299 ?>
300 </p>
301 </td>
302 </tr>
303 <?php if ( current_user_can( 'manage_options' ) ) : ?>
304 <tr>
305 <th scope="row"><?php esc_html_e( 'Post Formats', 'friends' ); ?></th>
306 <td>
307 <fieldset>
308 <label for="limit_homepage_post_format">
309 <?php
310 $select = '<select name="limit_homepage_post_format" id="limit_homepage_post_format">';
311 $select .= '<option value="0"' . selected( $args['limit_homepage_post_format'], false, false ) . '>' . esc_html( _x( 'All', 'All post-formats', 'friends' ) ) . '</option>';
312 foreach ( $args['post_format_strings'] as $format => $title ) {
313 // translators: %s is a post format title.
314 $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>';
315 }
316 $select .= '</select>';
317
318 echo wp_kses(
319 sprintf(
320 // translators: %s is a Select dropdown of post formats, e.g. "All" or "Standard only" (see "post-format only").
321 __( 'On your homepage, show %s posts.', 'friends' ),
322 $select
323 ),
324 array(
325 'select' => array(
326 'name' => array(),
327 ),
328 'label' => array(),
329 'option' => array(
330 'value' => array(),
331 'selected' => array(),
332 ),
333 'a' => array(
334 'href' => array(),
335 'rel' => array(),
336 'target' => array(),
337 ),
338 )
339 );
340 ?>
341 </label>
342 <br/>
343
344 <label for="force_enable_post_formats">
345 <input name="force_enable_post_formats" type="checkbox" id="force_enable_post_formats" value="1" <?php checked( '1', $args['force_enable_post_formats'] ); ?>>
346 <?php esc_html_e( 'Always enable Post Formats, regardless of the theme support.', 'friends' ); ?>
347 <p class="description">
348 <?php
349 echo wp_kses(
350 __( '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' ),
351 array(
352 'a' => array(
353 'href' => array(),
354 'rel' => array(),
355 'target' => array(),
356 ),
357 )
358 );
359
360
361 ?>
362 </p>
363 </label><br/>
364
365 <label for="expose_post_format_feeds">
366 <?php if ( current_theme_supports( 'post-format-feeds' ) ) : ?>
367 <?php esc_html_e( 'Your theme already supports exposing Post Formats as alternate feeds on your homepage.', 'friends' ); ?>
368 <?php else : ?>
369 <input name="expose_post_format_feeds" type="checkbox" id="expose_post_format_feeds" value="1" <?php checked( '1', $args['expose_post_format_feeds'] ); ?>>
370 <?php
371 // translators: %s is a HTML snippet.
372 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() ) );
373 ?>
374 <?php endif; ?>
375 </fieldset>
376 </td>
377 </tr>
378 <?php endif; ?>
379 <tr>
380 <th scope="row"><?php esc_html_e( 'Reactions', 'friends' ); ?></th>
381 <td>
382 <fieldset>
383 <?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?>
384
385 <ol id="available-emojis">
386 <?php
387 foreach ( Friends\Reactions::get_available_emojis() as $id => $data ) {
388 Friends\Friends::template_loader()->get_template_part(
389 'admin/add-reaction-li',
390 null,
391 array(
392 'id' => $id,
393 'emoji' => $data->char,
394 )
395 );
396 }
397 ?>
398 </ol>
399 <a href="" id="admin-add-emoji"><?php esc_html_e( 'Add an emoji', 'friends' ); ?></a>
400 <?php Friends\Friends::template_loader()->get_template_part( 'admin/reactions-picker' ); ?>
401 </fieldset>
402 </td>
403 </tr>
404 <tr>
405 <th scope="row"><?php esc_html_e( 'Frontend', 'friends' ); ?></th>
406 <td>
407 <fieldset>
408 <label for="frontend-default-view">
409 <span><?php esc_html_e( 'Default view:', 'friends' ); ?></span>
410 <select name="frontend_default_view" id="frontend-default-view">
411 <option value="expanded"<?php selected( $args['frontend_default_view'], 'expanded' ); ?>><?php esc_html_e( 'Expanded', 'friends' ); ?></option>
412 <option value="collapsed"<?php selected( $args['frontend_default_view'], 'collapsed' ); ?>><?php esc_html_e( 'Collapsed', 'friends' ); ?></option>
413 </select>
414 </label>
415 </fieldset>
416 </td>
417 </tr>
418 <tr>
419 <th scope="row" rowspan="2"><?php esc_html_e( 'Feed Reader', 'friends' ); ?></th>
420 <td>
421 <span>
422 <?php
423 // translators: %s is a URL.
424 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() ) ) );
425 ?>
426 </span>
427 <span>
428 <?php
429 // translators: %s is a URL.
430 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() ) ) );
431 ?>
432 </span>
433 <p class="description">
434 <?php
435 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' );
436 ?>
437 </p>
438 </td>
439 </tr>
440 <tr>
441 <td>
442 <?php
443 // translators: %s is a URL.
444 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() ) ) );
445 ?>
446 <p class="description">
447 <?php
448 echo __( 'Please be careful what you do with these feeds as they might contain private posts of your friends.', 'friends' );
449 ?>
450 </p>
451
452 </td>
453 </tr>
454 </tbody>
455 </table>
456 <?php do_action( 'friends_settings_form_bottom' ); ?>
457 <p class="submit">
458 <input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>">
459 </p>
460 <?php if ( ! current_user_can( 'manage_options' ) ) : ?>
461 <p class="description">
462 <?php esc_html_e( 'Administrators have access to these additional settings:', 'friends' ); ?>
463 <ul class="ul-disc">
464 <?php
465 foreach ( array(
466 __( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
467 __( 'Post Formats', 'friends' ),
468 ) as $setting ) :
469 ?>
470 <li><?php echo esc_html( $setting ); ?></li>
471 <?php endforeach; ?>
472 </ul>
473 </p>
474 <?php endif; ?>
475 </form>
476 <?php
477 do_action( 'friends_settings_after_form' );
478