| @@ -11,24 +11,50 @@ | ||
| 11 | 11 | <form method="post"> |
| 12 | 12 | <?php wp_nonce_field( 'friends-settings' ); ?> |
| 13 | 13 | <table class="form-table"> |
| 14 | 14 | <tbody> |
| 15 | - <?php if ( current_user_can( 'manage_options' ) ) : ?> | |
| 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; ?> | |
| 16 | 56 | <tr> |
| 17 | - <th scope="row"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Friendships' ); ?></th> | |
| 18 | - <td> | |
| 19 | - <fieldset> | |
| 20 | - <label for="enable_wp_friendships"> | |
| 21 | - <input name="enable_wp_friendships" type="checkbox" id="enable_wp_friendships" value="1" <?php checked( '1', $args['enable_wp_friendships'] ); ?> /> | |
| 22 | - <span><?php esc_html_e( 'Enable friendships between WordPresses.', 'friends' ); ?></span> | |
| 23 | - </label> | |
| 24 | - </fieldset> | |
| 25 | - </td> | |
| 26 | - </tr> | |
| 27 | - <?php | |
| 28 | - endif; | |
| 29 | - ?> | |
| 30 | - <tr> | |
| 31 | 57 | <th><?php esc_html_e( 'Retention', 'friends' ); ?></th> |
| 32 | 58 | <td> |
| 33 | 59 | <fieldset> |
| 34 | 60 | <div> |
| @@ -100,8 +126,12 @@ | ||
| 100 | 126 | echo '</span>'; |
| 101 | 127 | ?> |
| 102 | 128 | </span> |
| 103 | 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> | |
| 104 | 134 | </fieldset> |
| 105 | 135 | <p class="description"> |
| 106 | 136 | <?php |
| 107 | 137 | echo esc_html( |
| @@ -132,44 +162,8 @@ | ||
| 132 | 162 | <tr> |
| 133 | 163 | <th scope="row"><?php esc_html_e( 'Post Formats', 'friends' ); ?></th> |
| 134 | 164 | <td> |
| 135 | 165 | <fieldset> |
| 136 | - <label for="limit_homepage_post_format"> | |
| 137 | - <?php | |
| 138 | - $select = '<select name="limit_homepage_post_format" id="limit_homepage_post_format">'; | |
| 139 | - $select .= '<option value="0"' . selected( $args['limit_homepage_post_format'], false, false ) . '>' . esc_html( _x( 'All', 'All post-formats', 'friends' ) ) . '</option>'; | |
| 140 | - foreach ( $args['post_format_strings'] as $format => $title ) { | |
| 141 | - // translators: %s is a post format title. | |
| 142 | - $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>'; | |
| 143 | - } | |
| 144 | - $select .= '</select>'; | |
| 145 | - | |
| 146 | - echo wp_kses( | |
| 147 | - sprintf( | |
| 148 | - // translators: %s is a Select dropdown of post formats, e.g. "All" or "Standard only" (see "post-format only"). | |
| 149 | - __( 'On your homepage, show %s posts.', 'friends' ), | |
| 150 | - $select | |
| 151 | - ), | |
| 152 | - array( | |
| 153 | - 'select' => array( | |
| 154 | - 'name' => array(), | |
| 155 | - ), | |
| 156 | - 'label' => array(), | |
| 157 | - 'option' => array( | |
| 158 | - 'value' => array(), | |
| 159 | - 'selected' => array(), | |
| 160 | - ), | |
| 161 | - 'a' => array( | |
| 162 | - 'href' => array(), | |
| 163 | - 'rel' => array(), | |
| 164 | - 'target' => array(), | |
| 165 | - ), | |
| 166 | - ) | |
| 167 | - ); | |
| 168 | - ?> | |
| 169 | - </label> | |
| 170 | - <br/> | |
| 171 | - | |
| 172 | 166 | <label for="force_enable_post_formats"> |
| 173 | 167 | <input name="force_enable_post_formats" type="checkbox" id="force_enable_post_formats" value="1" <?php checked( '1', $args['force_enable_post_formats'] ); ?>> |
| 174 | 168 | <span><?php esc_html_e( 'Always enable Post Formats, regardless of the theme support.', 'friends' ); ?></span> |
| 175 | 169 | <p class="description"> |
| @@ -203,8 +197,33 @@ | ||
| 203 | 197 | </fieldset> |
| 204 | 198 | </td> |
| 205 | 199 | </tr> |
| 206 | 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; ?> | |
| 207 | 226 | <tr> |
| 208 | 227 | <th scope="row"><?php esc_html_e( 'Reactions', 'friends' ); ?></th> |
| 209 | 228 | <td> |
| 210 | 229 | <fieldset> |
| @@ -211,14 +230,14 @@ | ||
| 211 | 230 | <span><?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?></span> |
| 212 | 231 | |
| 213 | 232 | <ol id="available-emojis"> |
| 214 | 233 | <?php |
| 215 | - foreach ( Friends\Reactions::get_available_emojis() as $id => $data ) { | |
| 234 | + foreach ( Friends\Reactions::get_available_emojis() as $_id => $data ) { | |
| 216 | 235 | Friends\Friends::template_loader()->get_template_part( |
| 217 | 236 | 'admin/add-reaction-li', |
| 218 | 237 | null, |
| 219 | 238 | array( |
| 220 | - 'id' => $id, | |
| 239 | + 'id' => $_id, | |
| 221 | 240 | 'emoji' => $data->char, |
| 222 | 241 | ) |
| 223 | 242 | ); |
| 224 | 243 | } |
| @@ -225,37 +244,109 @@ | ||
| 225 | 244 | ?> |
| 226 | 245 | </ol> |
| 227 | 246 | <a href="" id="admin-add-emoji"><?php esc_html_e( 'Add an emoji', 'friends' ); ?></a> |
| 228 | 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; ?> | |
| 229 | 251 | </fieldset> |
| 230 | 252 | </td> |
| 231 | 253 | </tr> |
| 232 | 254 | <tr> |
| 233 | - <th scope="row" rowspan="2"><?php esc_html_e( 'Frontend', 'friends' ); ?></th> | |
| 255 | + <th scope="row"><?php esc_html_e( 'Auto-Tagging', 'friends' ); ?></th> | |
| 234 | 256 | <td> |
| 235 | 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> | |
| 236 | 296 | <label for="frontend-default-view"> |
| 237 | 297 | <span><?php esc_html_e( 'Default view:', 'friends' ); ?></span> |
| 238 | 298 | <select name="frontend_default_view" id="frontend-default-view"> |
| 239 | - <option value="expanded"<?php selected( $args['frontend_default_view'], 'expanded' ); ?>><?php esc_html_e( 'Expanded', 'friends' ); ?></option> | |
| 240 | - <option value="collapsed"<?php selected( $args['frontend_default_view'], 'collapsed' ); ?>><?php esc_html_e( 'Collapsed', 'friends' ); ?></option> | |
| 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> | |
| 241 | 301 | </select> |
| 242 | 302 | </label> |
| 243 | 303 | </fieldset> |
| 244 | 304 | </td> |
| 245 | 305 | </tr> |
| 246 | - <?php if ( ! function_exists( 'classicpress_version' ) ) : ?> | |
| 247 | 306 | <tr> |
| 248 | 307 | <td> |
| 249 | 308 | <fieldset> |
| 250 | - <label for="blocks_everywhere"> | |
| 251 | - <input name="blocks_everywhere" type="checkbox" id="blocks_everywhere" value="1" <?php checked( '1', $args['blocks_everywhere'] ); ?> disabled="disabled" /> | |
| 252 | - <span><?php esc_html_e( 'Unfortunately, Gutenberg on the frontend is currently unavailable.', 'friends' ); ?></span> | |
| 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> | |
| 253 | 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> | |
| 254 | 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> | |
| 255 | 347 | </td> |
| 256 | 348 | </tr> |
| 257 | - <?php endif; ?> | |
| 258 | 349 | </tbody> |
| 259 | 350 | </table> |
| 260 | 351 | <?php do_action( 'friends_settings_form_bottom' ); ?> |
| 261 | 352 | <p class="submit"> |
| @@ -268,8 +359,9 @@ | ||
| 268 | 359 | <?php |
| 269 | 360 | foreach ( array( |
| 270 | 361 | __( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain |
| 271 | 362 | __( 'Post Formats', 'friends' ), |
| 363 | + __( 'Compose', 'friends' ), | |
| 272 | 364 | ) as $setting ) : |
| 273 | 365 | ?> |
| 274 | 366 | <li><?php echo esc_html( $setting ); ?></li> |
| 275 | 367 | <?php endforeach; ?> |
| @@ -276,6 +368,18 @@ | ||
| 276 | 368 | </ul> |
| 277 | 369 | </p> |
| 278 | 370 | <?php endif; ?> |
| 279 | 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; ?> | |
| 280 | 384 | <?php |
| 281 | 385 | do_action( 'friends_settings_after_form' ); |