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
friends / templates / admin / settings.php

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

386 lines 15.9 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 do_action( 'friends_settings_before_form' );
9
10 ?>
11 <form method="post">
12 <?php wp_nonce_field( 'friends-settings' ); ?>
13 <table class="form-table">
14 <tbody>
15 <?php if ( $args['potential_main_users']->get_total() > 1 ) : ?>
16 <tr>
17 <th scope="row"><?php esc_html_e( 'Main Friend User', 'friends' ); ?></th>
18 <td>
19 <?php if ( current_user_can( 'manage_options' ) ) : ?>
20 <select name="main_user_id" id="main_user_id">
21 <?php foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) : ?>
22 <option value="<?php echo esc_attr( $potential_main_user->ID ); ?>" <?php selected( $args['main_user_id'], $potential_main_user->ID ); ?>>
23 <?php echo esc_html( $potential_main_user->display_name ); ?>
24 </option>
25 <?php endforeach; ?>
26 </select>
27 <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>
28 <?php else : ?>
29 <?php
30 $count = 0;
31 foreach ( $args['potential_main_users']->get_results() as $potential_main_user ) {
32 ++$count;
33 if ( $potential_main_user->ID === $args['main_user_id'] ) {
34 ?>
35 <span id="main_user_id"><?php echo esc_html( $potential_main_user->display_name ); ?></span>
36 <?php
37 }
38 }
39 ?>
40 <span class="description">
41 <?php
42 echo esc_html(
43 sprintf(
44 /* translators: %s is a number of users. */
45 _n( '%s potential user', '%s potential users', $count, 'friends' ),
46 number_format_i18n( $count )
47 )
48 );
49 ?>
50 </span>
51 <p class="description"><?php esc_html_e( 'An administrator can change this.', 'friends' ); ?></p>
52 <?php endif; ?>
53 </td>
54 </tr>
55 <?php endif; ?>
56 <tr>
57 <th><?php esc_html_e( 'Retention', 'friends' ); ?></th>
58 <td>
59 <fieldset>
60 <div>
61 <input type="checkbox" name="friends_enable_retention_days" id="friends_enable_retention_days" value="1" <?php checked( '1', $args['retention_days_enabled'] ); ?> />
62 <span id="friends_enable_retention_days_line" class="<?php echo esc_attr( $args['retention_days_enabled'] ? '' : 'disabled' ); ?>">
63 <?php
64 echo '<span>';
65 echo wp_kses(
66 sprintf(
67 // translators: %s is an input field that allows specifying a number.
68 __( 'Only keep posts for %s days.', 'friends' ),
69 '<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">'
70 ),
71 array(
72 'input' => array(
73 'type' => array(),
74 'min' => array(),
75 'id' => array(),
76 'name' => array(),
77 'value' => array(),
78 'size' => array(),
79 'disabled' => array(),
80 ),
81 )
82 );
83 echo '</span> <span>';
84 echo esc_html(
85 sprintf(
86 // translators: %s is a date.
87 __( 'Earliest post: %s', 'friends' ),
88 /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ date_i18n( __( 'F j, Y' ), $args['earliest_post_date'] )
89 )
90 );
91 echo '</span>';
92 ?>
93 </span>
94 </div>
95 <div>
96 <input type="checkbox" name="friends_enable_retention_number" id="friends_enable_retention_number" value="1" <?php checked( '1', $args['retention_number_enabled'] ); ?> />
97 <span id="friends_enable_retention_number_line" class="<?php echo esc_attr( $args['retention_number_enabled'] ? '' : 'disabled' ); ?>">
98 <?php
99 echo '<span>';
100 echo wp_kses(
101 sprintf(
102 // translators: %s is an input field that allows specifying a number.
103 __( 'Only keep the last %s posts.', 'friends' ),
104 '<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">'
105 ),
106 array(
107 'input' => array(
108 'type' => array(),
109 'min' => array(),
110 'id' => array(),
111 'name' => array(),
112 'value' => array(),
113 'size' => array(),
114 'disabled' => array(),
115 ),
116 )
117 );
118 echo '</span> <span>';
119 echo esc_html(
120 sprintf(
121 // translators: %s is a date.
122 __( 'Current number of posts: %s', 'friends' ),
123 number_format_i18n( $args['post_count'] )
124 )
125 );
126 echo '</span>';
127 ?>
128 </span>
129 </div>
130 <div>
131 <input type="checkbox" name="retention_delete_reacted" id="retention_delete_reacted" value="1" <?php checked( ! $args['retention_delete_reacted'] ); ?> />
132 <label for="retention_delete_reacted"><?php esc_html_e( 'Protect posts from deletion that I have reacted on.', 'friends' ); ?></label>
133 </div>
134 </fieldset>
135 <p class="description">
136 <?php
137 echo esc_html(
138 sprintf(
139 // translators: %s is a size in bytes or kilo bytes (kB).
140 __( 'Currently the posts use %s of disk space.', 'friends' ),
141 size_format( $args['total_size'], 1 )
142 )
143 );
144 ?>
145 </p>
146 <p class="description">
147 <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>
148 <span>
149 <?php
150 esc_html_e( 'The next auto-delete will kick in when refreshing the feeds.', 'friends' );
151 ?>
152 </span>
153 </p>
154 <p class="description">
155 <?php
156 esc_html_e( 'You can also specify this for individual friends.', 'friends' );
157 ?>
158 </p>
159 </td>
160 </tr>
161 <?php if ( current_user_can( 'manage_options' ) ) : ?>
162 <tr>
163 <th scope="row"><?php esc_html_e( 'Post Formats', 'friends' ); ?></th>
164 <td>
165 <fieldset>
166 <label for="force_enable_post_formats">
167 <input name="force_enable_post_formats" type="checkbox" id="force_enable_post_formats" value="1" <?php checked( '1', $args['force_enable_post_formats'] ); ?>>
168 <span><?php esc_html_e( 'Always enable Post Formats, regardless of the theme support.', 'friends' ); ?></span>
169 <p class="description">
170 <?php
171 echo wp_kses(
172 __( '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' ),
173 array(
174 'a' => array(
175 'href' => array(),
176 'rel' => array(),
177 'target' => array(),
178 ),
179 )
180 );
181 ?>
182 </p>
183 </label><br/>
184
185 <label for="expose_post_format_feeds">
186 <?php if ( current_theme_supports( 'post-format-feeds' ) ) : ?>
187 <span><?php esc_html_e( 'Your theme already supports exposing Post Formats as alternate feeds on your homepage.', 'friends' ); ?></span>
188 <?php else : ?>
189 <input name="expose_post_format_feeds" type="checkbox" id="expose_post_format_feeds" value="1" <?php checked( '1', $args['expose_post_format_feeds'] ); ?>>
190 <span>
191 <?php
192 // translators: %s is a HTML snippet.
193 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() ) );
194 ?>
195 </span>
196 <?php endif; ?>
197 </fieldset>
198 </td>
199 </tr>
200 <?php endif; ?>
201 <?php if ( current_user_can( 'manage_options' ) ) : ?>
202 <tr id="compose">
203 <th scope="row"><?php esc_html_e( 'Compose', 'friends' ); ?></th>
204 <td>
205 <fieldset>
206 <label for="friends_compose_post_format">
207 <span><?php esc_html_e( 'Default post format for new posts:', 'friends' ); ?></span>
208 <select name="friends_compose_post_format" id="friends_compose_post_format">
209 <?php foreach ( get_post_format_strings() as $format => $label ) : ?>
210 <option value="<?php echo esc_attr( $format ); ?>"<?php selected( $args['compose_post_format'], $format ); ?>><?php echo esc_html( $label ); ?></option>
211 <?php endforeach; ?>
212 </select>
213 </label>
214 <br/><br/>
215 <label for="friends_exclude_compose_format_from_feed">
216 <input name="friends_exclude_compose_format_from_feed" type="checkbox" id="friends_exclude_compose_format_from_feed" value="1" <?php checked( '1', $args['exclude_compose_format_from_feed'] ); ?>>
217 <span><?php esc_html_e( 'Exclude posts in this format from the main RSS feed.', 'friends' ); ?></span>
218 </label>
219 <p class="description">
220 <?php esc_html_e( 'This prevents short status posts from appearing in your regular blog RSS feed.', 'friends' ); ?>
221 </p>
222 </fieldset>
223 </td>
224 </tr>
225 <?php endif; ?>
226 <tr>
227 <th scope="row"><?php esc_html_e( 'Reactions', 'friends' ); ?></th>
228 <td>
229 <fieldset>
230 <span><?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?></span>
231
232 <ol id="available-emojis">
233 <?php
234 foreach ( Friends\Reactions::get_available_emojis() as $_id => $data ) {
235 Friends\Friends::template_loader()->get_template_part(
236 'admin/add-reaction-li',
237 null,
238 array(
239 'id' => $_id,
240 'emoji' => $data->char,
241 )
242 );
243 }
244 ?>
245 </ol>
246 <a href="" id="admin-add-emoji"><?php esc_html_e( 'Add an emoji', 'friends' ); ?></a>
247 <?php Friends\Friends::template_loader()->get_template_part( 'admin/reactions-picker' ); ?>
248 <?php if ( class_exists( 'Activitypub\Activitypub' ) ) : ?>
249 <p class="description"><?php esc_html_e( 'This will always send a "Like" on ActivityPub but you can use different reactions to distinguish them for yourself. For example ⭐️ for bookmarks and ❤️ for likes.', 'friends' ); ?></p>
250 <?php endif; ?>
251 </fieldset>
252 </td>
253 </tr>
254 <tr>
255 <th scope="row"><?php esc_html_e( 'Auto-Tagging', 'friends' ); ?></th>
256 <td>
257 <fieldset>
258 <label for="disable_auto_tagging">
259 <input name="disable_auto_tagging" type="checkbox" id="disable_auto_tagging" value="1" <?php checked( '1', $args['disable_auto_tagging'] ); ?> />
260 <span><?php esc_html_e( 'Disable automatic tagging of incoming posts with hashtags.', 'friends' ); ?></span>
261 </label>
262 <p class="description">
263 <?php
264 esc_html_e( 'When incoming friend posts are tagged based on contained hashtags, you can filter by tag.', 'friends' );
265 echo ' ';
266 esc_html_e( 'These tags are separate from the tags you use for your own posts.', 'friends' );
267 echo '<br>';
268 esc_html_e( 'If you like to avoid an increased number of taxonomy terms in your database, you can disable this, although tags indicating a mention for local users will always be applied.', 'friends' );
269 ?>
270 </p>
271 </fieldset>
272 </td>
273 </tr>
274 <tr>
275 <th scope="row"><?php esc_html_e( 'Link Previews', 'friends' ); ?></th>
276 <td>
277 <fieldset>
278 <label for="disable_link_previews">
279 <input name="disable_link_previews" type="checkbox" id="disable_link_previews" value="1" <?php checked( '1', $args['disable_link_previews'] ); ?> />
280 <span><?php esc_html_e( 'Disable link previews for incoming posts.', 'friends' ); ?></span>
281 </label>
282 <p class="description">
283 <?php
284 esc_html_e( 'When a status contains a link but no image or video of its own, a preview card with the linked page\'s title, description and image can be shown below the post.', 'friends' );
285 echo '<br>';
286 esc_html_e( 'To do so, your site downloads the linked page in the background, so disable this if you\'d rather not have your site contact the linked websites.', 'friends' );
287 ?>
288 </p>
289 </fieldset>
290 </td>
291 </tr>
292 <tr>
293 <th scope="row" rowspan="3"><?php esc_html_e( 'Frontend', 'friends' ); ?></th>
294 <td>
295 <fieldset>
296 <label for="frontend-default-view">
297 <span><?php esc_html_e( 'Default view:', 'friends' ); ?></span>
298 <select name="frontend_default_view" id="frontend-default-view">
299 <option value="expanded"<?php selected( $args['frontend_default_view'], 'expanded' ); ?>><?php esc_html_e( 'Expanded mode', 'friends' ); ?></option>
300 <option value="collapsed"<?php selected( $args['frontend_default_view'], 'collapsed' ); ?>><?php esc_html_e( 'Compact mode', 'friends' ); ?></option>
301 </select>
302 </label>
303 </fieldset>
304 </td>
305 </tr>
306 <tr>
307 <td>
308 <fieldset>
309 <label for="frontend-theme">
310 <span><?php esc_html_e( 'Main Theme:', 'friends' ); ?></span>
311 <select name="friends_frontend_theme" id="frontend-theme">
312 <?php foreach ( Friends\Frontend::get_themes() as $theme => $theme_name ) : ?>
313 <option value="<?php echo esc_attr( $theme ); ?>"<?php selected( $args['frontend_theme'], $theme ); ?>><?php echo esc_html( $theme_name ); ?></option>
314 <?php endforeach; ?>
315 </select>
316 </label>
317 <details><summary>Post Type Themes</summary>
318 <table>
319 <?php foreach ( $args['post_format_strings'] as $post_type_slug => $post_type_title ) : ?>
320 <tr>
321 <td><label for="frontend-theme-<?php echo esc_attr( $post_type_slug ); ?>"><?php echo esc_html( $post_type_title ); ?></label></td>
322 <td>
323 <select name="friends_frontend_theme_<?php echo esc_attr( $post_type_slug ); ?>" id="frontend-theme-<?php echo esc_attr( $post_type_slug ); ?>">
324 <option value=""><?php esc_html_e( 'Main Theme', 'friends' ); ?></option>
325 <?php foreach ( Friends\Frontend::get_themes() as $theme => $theme_name ) : ?>
326 <option value="<?php echo esc_attr( $theme ); ?>"<?php selected( $args[ 'frontend_theme_' . $post_type_slug ], $theme ); ?>><?php echo esc_html( $theme_name ); ?></option>
327 <?php endforeach; ?>
328 </select>
329 </td>
330 </tr>
331 <?php endforeach; ?>
332 </table>
333 </details>
334 </fieldset>
335 <p>
336 <?php
337 echo wp_kses_post(
338 sprintf(
339 // translators: %1$s is a link, %2$s is a link.
340 __( 'Check out the <a href=%1$s>available themes</a>, or <a href=%2$s>write your own</a>.', 'friends' ),
341 '"https://github.com/akirk/friends/blob/main/THEMES.md"',
342 '"https://github.com/akirk/friends/wiki/Writing-Themes"'
343 )
344 );
345 ?>
346 </p>
347 </td>
348 </tr>
349 </tbody>
350 </table>
351 <?php do_action( 'friends_settings_form_bottom' ); ?>
352 <p class="submit">
353 <input type="submit" id="submit" class="button button-primary" value="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Save Changes' ); ?>">
354 </p>
355 <?php if ( ! current_user_can( 'manage_options' ) ) : ?>
356 <p class="description">
357 <?php esc_html_e( 'Administrators have access to these additional settings:', 'friends' ); ?>
358 <ul class="ul-disc">
359 <?php
360 foreach ( array(
361 __( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain
362 __( 'Post Formats', 'friends' ),
363 __( 'Compose', 'friends' ),
364 ) as $setting ) :
365 ?>
366 <li><?php echo esc_html( $setting ); ?></li>
367 <?php endforeach; ?>
368 </ul>
369 </p>
370 <?php endif; ?>
371 </form>
372 <?php if ( current_user_can( 'manage_options' ) ) : ?>
373 <h2><?php esc_html_e( 'Advanced', 'friends' ); ?></h2>
374 <p>
375 <?php
376 printf(
377 /* translators: %s is a link to the migrations page. */
378 esc_html__( 'Database migrations can be managed on the %s page.', 'friends' ),
379 '<a href="' . esc_url( admin_url( 'admin.php?page=friends-migrations' ) ) . '">' . esc_html__( 'Migrations', 'friends' ) . '</a>'
380 );
381 ?>
382 </p>
383 <?php endif; ?>
384 <?php
385 do_action( 'friends_settings_after_form' );
386