| @@ -4,18 +4,8 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package Friends |
| 6 | 6 | */ |
| 7 | 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 | 8 | do_action( 'friends_settings_before_form' ); |
| 19 | 9 | |
| 20 | 10 | ?> |
| 21 | 11 | <form method="post"> |
| @@ -21,190 +11,50 @@ | ||
| 21 | 11 | <form method="post"> |
| 22 | 12 | <?php wp_nonce_field( 'friends-settings' ); ?> |
| 23 | 13 | <table class="form-table"> |
| 24 | 14 | <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 | - ?> | |
| 15 | + <?php if ( $args['potential_main_users']->get_total() > 1 ) : ?> | |
| 68 | 16 | <tr> |
| 69 | 17 | <th scope="row"><?php esc_html_e( 'Main Friend User', 'friends' ); ?></th> |
| 70 | 18 | <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> | |
| 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 : ?> | |
| 79 | 29 | <?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 | - ?> | |
| 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 | + ?> | |
| 86 | 35 | <span id="main_user_id"><?php echo esc_html( $potential_main_user->display_name ); ?></span> |
| 87 | 36 | <?php |
| 37 | + } | |
| 88 | 38 | } |
| 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> | |
| 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> | |
| 102 | 51 | <p class="description"><?php esc_html_e( 'An administrator can change this.', 'friends' ); ?></p> |
| 103 | - <?php | |
| 104 | - } | |
| 105 | - ?> | |
| 52 | + <?php endif; ?> | |
| 106 | 53 | </td> |
| 107 | 54 | </tr> |
| 108 | - <?php | |
| 109 | - endif; | |
| 110 | - ?> | |
| 55 | + <?php endif; ?> | |
| 111 | 56 | <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 | 57 | <th><?php esc_html_e( 'Retention', 'friends' ); ?></th> |
| 208 | 58 | <td> |
| 209 | 59 | <fieldset> |
| 210 | 60 | <div> |
| @@ -210,12 +60,13 @@ | ||
| 210 | 60 | <div> |
| 211 | 61 | <input type="checkbox" name="friends_enable_retention_days" id="friends_enable_retention_days" value="1" <?php checked( '1', $args['retention_days_enabled'] ); ?> /> |
| 212 | 62 | <span id="friends_enable_retention_days_line" class="<?php echo esc_attr( $args['retention_days_enabled'] ? '' : 'disabled' ); ?>"> |
| 213 | 63 | <?php |
| 64 | + echo '<span>'; | |
| 214 | 65 | echo wp_kses( |
| 215 | 66 | sprintf( |
| 216 | 67 | // translators: %s is an input field that allows specifying a number. |
| 217 | - __( 'Only keep posts for %s days', 'friends' ), | |
| 68 | + __( 'Only keep posts for %s days.', 'friends' ), | |
| 218 | 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">' |
| 219 | 70 | ), |
| 220 | 71 | array( |
| 221 | 72 | 'input' => array( |
| @@ -228,9 +79,9 @@ | ||
| 228 | 79 | 'disabled' => array(), |
| 229 | 80 | ), |
| 230 | 81 | ) |
| 231 | 82 | ); |
| 232 | - echo '. '; | |
| 83 | + echo '</span> <span>'; | |
| 233 | 84 | echo esc_html( |
| 234 | 85 | sprintf( |
| 235 | 86 | // translators: %s is a date. |
| 236 | 87 | __( 'Earliest post: %s', 'friends' ), |
| @@ -236,8 +87,9 @@ | ||
| 236 | 87 | __( 'Earliest post: %s', 'friends' ), |
| 237 | 88 | /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ date_i18n( __( 'F j, Y' ), $args['earliest_post_date'] ) |
| 238 | 89 | ) |
| 239 | 90 | ); |
| 91 | + echo '</span>'; | |
| 240 | 92 | ?> |
| 241 | 93 | </span> |
| 242 | 94 | </div> |
| 243 | 95 | <div> |
| @@ -243,12 +95,13 @@ | ||
| 243 | 95 | <div> |
| 244 | 96 | <input type="checkbox" name="friends_enable_retention_number" id="friends_enable_retention_number" value="1" <?php checked( '1', $args['retention_number_enabled'] ); ?> /> |
| 245 | 97 | <span id="friends_enable_retention_number_line" class="<?php echo esc_attr( $args['retention_number_enabled'] ? '' : 'disabled' ); ?>"> |
| 246 | 98 | <?php |
| 99 | + echo '<span>'; | |
| 247 | 100 | echo wp_kses( |
| 248 | 101 | sprintf( |
| 249 | 102 | // translators: %s is an input field that allows specifying a number. |
| 250 | - __( 'Only keep the last %s posts', 'friends' ), | |
| 103 | + __( 'Only keep the last %s posts.', 'friends' ), | |
| 251 | 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">' |
| 252 | 105 | ), |
| 253 | 106 | array( |
| 254 | 107 | 'input' => array( |
| @@ -261,9 +114,9 @@ | ||
| 261 | 114 | 'disabled' => array(), |
| 262 | 115 | ), |
| 263 | 116 | ) |
| 264 | 117 | ); |
| 265 | - echo '. '; | |
| 118 | + echo '</span> <span>'; | |
| 266 | 119 | echo esc_html( |
| 267 | 120 | sprintf( |
| 268 | 121 | // translators: %s is a date. |
| 269 | 122 | __( 'Current number of posts: %s', 'friends' ), |
| @@ -269,11 +122,16 @@ | ||
| 269 | 122 | __( 'Current number of posts: %s', 'friends' ), |
| 270 | 123 | number_format_i18n( $args['post_count'] ) |
| 271 | 124 | ) |
| 272 | 125 | ); |
| 126 | + echo '</span>'; | |
| 273 | 127 | ?> |
| 274 | 128 | </span> |
| 275 | 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> | |
| 276 | 134 | </fieldset> |
| 277 | 135 | <p class="description"> |
| 278 | 136 | <?php |
| 279 | 137 | echo esc_html( |
| @@ -285,14 +143,14 @@ | ||
| 285 | 143 | ); |
| 286 | 144 | ?> |
| 287 | 145 | </p> |
| 288 | 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> | |
| 289 | 149 | <?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 | 150 | esc_html_e( 'The next auto-delete will kick in when refreshing the feeds.', 'friends' ); |
| 294 | 151 | ?> |
| 152 | + </span> | |
| 295 | 153 | </p> |
| 296 | 154 | <p class="description"> |
| 297 | 155 | <?php |
| 298 | 156 | esc_html_e( 'You can also specify this for individual friends.', 'friends' ); |
| @@ -304,47 +162,11 @@ | ||
| 304 | 162 | <tr> |
| 305 | 163 | <th scope="row"><?php esc_html_e( 'Post Formats', 'friends' ); ?></th> |
| 306 | 164 | <td> |
| 307 | 165 | <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 | 166 | <label for="force_enable_post_formats"> |
| 345 | 167 | <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' ); ?> | |
| 168 | + <span><?php esc_html_e( 'Always enable Post Formats, regardless of the theme support.', 'friends' ); ?></span> | |
| 347 | 169 | <p class="description"> |
| 348 | 170 | <?php |
| 349 | 171 | echo wp_kses( |
| 350 | 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' ), |
| @@ -355,10 +177,8 @@ | ||
| 355 | 177 | 'target' => array(), |
| 356 | 178 | ), |
| 357 | 179 | ) |
| 358 | 180 | ); |
| 359 | - | |
| 360 | - | |
| 361 | 181 | ?> |
| 362 | 182 | </p> |
| 363 | 183 | </label><br/> |
| 364 | 184 | |
| @@ -363,34 +183,61 @@ | ||
| 363 | 183 | </label><br/> |
| 364 | 184 | |
| 365 | 185 | <label for="expose_post_format_feeds"> |
| 366 | 186 | <?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' ); ?> | |
| 187 | + <span><?php esc_html_e( 'Your theme already supports exposing Post Formats as alternate feeds on your homepage.', 'friends' ); ?></span> | |
| 368 | 188 | <?php else : ?> |
| 369 | 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> | |
| 370 | 191 | <?php |
| 371 | 192 | // translators: %s is a HTML snippet. |
| 372 | 193 | echo wp_kses( sprintf( __( 'Expose Post Formats as alternate feeds on your homepage (as %s).', 'friends' ), '<code><link rel="alternate"/ ></code>' ), array( 'code' => array() ) ); |
| 373 | 194 | ?> |
| 195 | + </span> | |
| 374 | 196 | <?php endif; ?> |
| 375 | 197 | </fieldset> |
| 376 | 198 | </td> |
| 377 | 199 | </tr> |
| 378 | 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; ?> | |
| 379 | 226 | <tr> |
| 380 | 227 | <th scope="row"><?php esc_html_e( 'Reactions', 'friends' ); ?></th> |
| 381 | 228 | <td> |
| 382 | 229 | <fieldset> |
| 383 | - <?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?> | |
| 230 | + <span><?php esc_html_e( 'Allow these emojis for reactions:', 'friends' ); ?></span> | |
| 384 | 231 | |
| 385 | 232 | <ol id="available-emojis"> |
| 386 | 233 | <?php |
| 387 | - foreach ( Friends\Reactions::get_available_emojis() as $id => $data ) { | |
| 234 | + foreach ( Friends\Reactions::get_available_emojis() as $_id => $data ) { | |
| 388 | 235 | Friends\Friends::template_loader()->get_template_part( |
| 389 | 236 | 'admin/add-reaction-li', |
| 390 | 237 | null, |
| 391 | 238 | array( |
| 392 | - 'id' => $id, | |
| 239 | + 'id' => $_id, | |
| 393 | 240 | 'emoji' => $data->char, |
| 394 | 241 | ) |
| 395 | 242 | ); |
| 396 | 243 | } |
| @@ -397,71 +244,107 @@ | ||
| 397 | 244 | ?> |
| 398 | 245 | </ol> |
| 399 | 246 | <a href="" id="admin-add-emoji"><?php esc_html_e( 'Add an emoji', 'friends' ); ?></a> |
| 400 | 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; ?> | |
| 401 | 251 | </fieldset> |
| 402 | 252 | </td> |
| 403 | 253 | </tr> |
| 404 | 254 | <tr> |
| 405 | - <th scope="row" rowspan="2"><?php esc_html_e( 'Frontend', 'friends' ); ?></th> | |
| 255 | + <th scope="row"><?php esc_html_e( 'Auto-Tagging', 'friends' ); ?></th> | |
| 406 | 256 | <td> |
| 407 | 257 | <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> | |
| 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> | |
| 414 | 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> | |
| 415 | 271 | </fieldset> |
| 416 | 272 | </td> |
| 417 | 273 | </tr> |
| 418 | - <?php if ( ! function_exists( 'classicpress_version' ) ) : ?> | |
| 419 | 274 | <tr> |
| 275 | + <th scope="row"><?php esc_html_e( 'Link Previews', 'friends' ); ?></th> | |
| 420 | 276 | <td> |
| 421 | 277 | <fieldset> |
| 422 | - <label for="blocks_everywhere"> | |
| 423 | - <input name="blocks_everywhere" type="checkbox" id="blocks_everywhere" value="1" <?php checked( '1', $args['blocks_everywhere'] ); ?> /> | |
| 424 | - <span><?php esc_html_e( 'Enable Gutenberg on the frontend.', 'friends' ); ?></span> | |
| 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> | |
| 425 | 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> | |
| 426 | 289 | </fieldset> |
| 427 | 290 | </td> |
| 428 | 291 | </tr> |
| 429 | - <?php endif; ?> | |
| 430 | 292 | <tr> |
| 431 | - <th scope="row" rowspan="2"><?php esc_html_e( 'Feed Reader', 'friends' ); ?></th> | |
| 293 | + <th scope="row" rowspan="3"><?php esc_html_e( 'Frontend', 'friends' ); ?></th> | |
| 432 | 294 | <td> |
| 433 | - <span> | |
| 434 | - <?php | |
| 435 | - // translators: %s is a URL. | |
| 436 | - 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() ) ) ); | |
| 437 | - ?> | |
| 438 | - </span> | |
| 439 | - <span> | |
| 440 | - <?php | |
| 441 | - // translators: %s is a URL. | |
| 442 | - 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() ) ) ); | |
| 443 | - ?> | |
| 444 | - </span> | |
| 445 | - <p class="description"> | |
| 446 | - <?php | |
| 447 | - 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' ); | |
| 448 | - ?> | |
| 449 | - </p> | |
| 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> | |
| 450 | 304 | </td> |
| 451 | 305 | </tr> |
| 452 | 306 | <tr> |
| 453 | 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> | |
| 454 | 336 | <?php |
| 455 | - // translators: %s is a URL. | |
| 456 | - 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() ) ) ); | |
| 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 | + ); | |
| 457 | 345 | ?> |
| 458 | - <p class="description"> | |
| 459 | - <?php | |
| 460 | - echo __( 'Please be careful what you do with these feeds as they might contain private posts of your friends.', 'friends' ); | |
| 461 | - ?> | |
| 462 | - </p> | |
| 463 | - | |
| 346 | + </p> | |
| 464 | 347 | </td> |
| 465 | 348 | </tr> |
| 466 | 349 | </tbody> |
| 467 | 350 | </table> |
| @@ -476,8 +359,9 @@ | ||
| 476 | 359 | <?php |
| 477 | 360 | foreach ( array( |
| 478 | 361 | __( 'Comments' ), // phpcs:ignore WordPress.WP.I18n.MissingArgDomain |
| 479 | 362 | __( 'Post Formats', 'friends' ), |
| 363 | + __( 'Compose', 'friends' ), | |
| 480 | 364 | ) as $setting ) : |
| 481 | 365 | ?> |
| 482 | 366 | <li><?php echo esc_html( $setting ); ?></li> |
| 483 | 367 | <?php endforeach; ?> |
| @@ -484,6 +368,18 @@ | ||
| 484 | 368 | </ul> |
| 485 | 369 | </p> |
| 486 | 370 | <?php endif; ?> |
| 487 | 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; ?> | |
| 488 | 384 | <?php |
| 489 | 385 | do_action( 'friends_settings_after_form' ); |