[ Index ] |
PHP Cross Reference of WordPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Discussion settings administration panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 /** WordPress Administration Bootstrap */ 9 require_once __DIR__ . '/admin.php'; 10 11 if ( ! current_user_can( 'manage_options' ) ) { 12 wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); 13 } 14 15 $title = __( 'Discussion Settings' ); 16 $parent_file = 'options-general.php'; 17 18 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' ); 19 20 get_current_screen()->add_help_tab( 21 array( 22 'id' => 'overview', 23 'title' => __( 'Overview' ), 24 'content' => '<p>' . __( 'This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won’t all fit here! :) Use the documentation links to get information on what each discussion setting does.' ) . '</p>' . 25 '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>', 26 ) 27 ); 28 29 get_current_screen()->set_help_sidebar( 30 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . 31 '<p>' . __( '<a href="https://wordpress.org/support/article/settings-discussion-screen/">Documentation on Discussion Settings</a>' ) . '</p>' . 32 '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>' 33 ); 34 35 require_once ABSPATH . 'wp-admin/admin-header.php'; 36 ?> 37 38 <div class="wrap"> 39 <h1><?php echo esc_html( $title ); ?></h1> 40 41 <form method="post" action="options.php"> 42 <?php settings_fields( 'discussion' ); ?> 43 44 <table class="form-table" role="presentation"> 45 <tr> 46 <th scope="row"><?php _e( 'Default post settings' ); ?></th> 47 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Default post settings' ); ?></span></legend> 48 <label for="default_pingback_flag"> 49 <input name="default_pingback_flag" type="checkbox" id="default_pingback_flag" value="1" <?php checked( '1', get_option( 'default_pingback_flag' ) ); ?> /> 50 <?php _e( 'Attempt to notify any blogs linked to from the post' ); ?></label> 51 <br /> 52 <label for="default_ping_status"> 53 <input name="default_ping_status" type="checkbox" id="default_ping_status" value="open" <?php checked( 'open', get_option( 'default_ping_status' ) ); ?> /> 54 <?php _e( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new posts' ); ?></label> 55 <br /> 56 <label for="default_comment_status"> 57 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked( 'open', get_option( 'default_comment_status' ) ); ?> /> 58 <?php _e( 'Allow people to submit comments on new posts' ); ?></label> 59 <br /> 60 <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual posts.' ) . ')'; ?></p> 61 </fieldset></td> 62 </tr> 63 <tr> 64 <th scope="row"><?php _e( 'Other comment settings' ); ?></th> 65 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Other comment settings' ); ?></span></legend> 66 <label for="require_name_email"><input type="checkbox" name="require_name_email" id="require_name_email" value="1" <?php checked( '1', get_option( 'require_name_email' ) ); ?> /> <?php _e( 'Comment author must fill out name and email' ); ?></label> 67 <br /> 68 <label for="comment_registration"> 69 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked( '1', get_option( 'comment_registration' ) ); ?> /> 70 <?php _e( 'Users must be registered and logged in to comment' ); ?> 71 <?php 72 if ( ! get_option( 'users_can_register' ) && is_multisite() ) { 73 echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' );} 74 ?> 75 </label> 76 <br /> 77 78 <label for="close_comments_for_old_posts"> 79 <input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked( '1', get_option( 'close_comments_for_old_posts' ) ); ?> /> 80 <?php 81 printf( 82 /* translators: %s: Number of days. */ 83 __( 'Automatically close comments on posts older than %s days' ), 84 '</label> <label for="close_comments_days_old"><input name="close_comments_days_old" type="number" min="0" step="1" id="close_comments_days_old" value="' . esc_attr( get_option( 'close_comments_days_old' ) ) . '" class="small-text" />' 85 ); 86 ?> 87 </label> 88 <br /> 89 90 <label for="show_comments_cookies_opt_in"> 91 <input name="show_comments_cookies_opt_in" type="checkbox" id="show_comments_cookies_opt_in" value="1" <?php checked( '1', get_option( 'show_comments_cookies_opt_in' ) ); ?> /> 92 <?php _e( 'Show comments cookies opt-in checkbox, allowing comment author cookies to be set' ); ?> 93 </label> 94 <br /> 95 96 <label for="thread_comments"> 97 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked( '1', get_option( 'thread_comments' ) ); ?> /> 98 <?php 99 /** 100 * Filters the maximum depth of threaded/nested comments. 101 * 102 * @since 2.7.0 103 * 104 * @param int $max_depth The maximum depth of threaded comments. Default 10. 105 */ 106 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 ); 107 108 $thread_comments_depth = '</label> <label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">'; 109 for ( $i = 2; $i <= $maxdeep; $i++ ) { 110 $thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'"; 111 if ( get_option( 'thread_comments_depth' ) == $i ) { 112 $thread_comments_depth .= " selected='selected'"; 113 } 114 $thread_comments_depth .= ">$i</option>"; 115 } 116 $thread_comments_depth .= '</select>'; 117 118 /* translators: %s: Number of levels. */ 119 printf( __( 'Enable threaded (nested) comments %s levels deep' ), $thread_comments_depth ); 120 121 ?> 122 </label> 123 <br /> 124 <label for="page_comments"> 125 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> /> 126 <?php 127 $default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"'; 128 if ( 'newest' === get_option( 'default_comments_page' ) ) { 129 $default_comments_page .= ' selected="selected"'; 130 } 131 $default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"'; 132 if ( 'oldest' === get_option( 'default_comments_page' ) ) { 133 $default_comments_page .= ' selected="selected"'; 134 } 135 $default_comments_page .= '>' . __( 'first' ) . '</option></select>'; 136 printf( 137 /* translators: 1: Form field control for number of top level comments per page, 2: Form field control for the 'first' or 'last' page. */ 138 __( 'Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default' ), 139 '</label> <label for="comments_per_page"><input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="' . esc_attr( get_option( 'comments_per_page' ) ) . '" class="small-text" />', 140 $default_comments_page 141 ); 142 ?> 143 </label> 144 <br /> 145 <label for="comment_order"> 146 <?php 147 148 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"'; 149 if ( 'asc' === get_option( 'comment_order' ) ) { 150 $comment_order .= ' selected="selected"'; 151 } 152 $comment_order .= '>' . __( 'older' ) . '</option><option value="desc"'; 153 if ( 'desc' === get_option( 'comment_order' ) ) { 154 $comment_order .= ' selected="selected"'; 155 } 156 $comment_order .= '>' . __( 'newer' ) . '</option></select>'; 157 158 /* translators: %s: Form field control for 'older' or 'newer' comments. */ 159 printf( __( 'Comments should be displayed with the %s comments at the top of each page' ), $comment_order ); 160 161 ?> 162 </label> 163 </fieldset></td> 164 </tr> 165 <tr> 166 <th scope="row"><?php _e( 'Email me whenever' ); ?></th> 167 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Email me whenever' ); ?></span></legend> 168 <label for="comments_notify"> 169 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked( '1', get_option( 'comments_notify' ) ); ?> /> 170 <?php _e( 'Anyone posts a comment' ); ?> </label> 171 <br /> 172 <label for="moderation_notify"> 173 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked( '1', get_option( 'moderation_notify' ) ); ?> /> 174 <?php _e( 'A comment is held for moderation' ); ?> </label> 175 </fieldset></td> 176 </tr> 177 <tr> 178 <th scope="row"><?php _e( 'Before a comment appears' ); ?></th> 179 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Before a comment appears' ); ?></span></legend> 180 <label for="comment_moderation"> 181 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked( '1', get_option( 'comment_moderation' ) ); ?> /> 182 <?php _e( 'Comment must be manually approved' ); ?> </label> 183 <br /> 184 <label for="comment_previously_approved"><input type="checkbox" name="comment_previously_approved" id="comment_previously_approved" value="1" <?php checked( '1', get_option( 'comment_previously_approved' ) ); ?> /> <?php _e( 'Comment author must have a previously approved comment' ); ?></label> 185 </fieldset></td> 186 </tr> 187 <tr> 188 <th scope="row"><?php _e( 'Comment Moderation' ); ?></th> 189 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Comment Moderation' ); ?></span></legend> 190 <p><label for="comment_max_links"> 191 <?php 192 printf( 193 /* translators: %s: Number of links. */ 194 __( 'Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)' ), 195 '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr( get_option( 'comment_max_links' ) ) . '" class="small-text" />' 196 ); 197 ?> 198 </label></p> 199 200 <p><label for="moderation_keys"><?php _e( 'When a comment contains any of these words in its content, author name, URL, email, IP address, or browser’s user agent string, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP address per line. It will match inside words, so “press” will match “WordPress”.' ); ?></label></p> 201 <p> 202 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea> 203 </p> 204 </fieldset></td> 205 </tr> 206 <tr> 207 <th scope="row"><?php _e( 'Disallowed Comment Keys' ); ?></th> 208 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Disallowed Comment Keys' ); ?></span></legend> 209 <p><label for="disallowed_keys"><?php _e( 'When a comment contains any of these words in its content, author name, URL, email, IP address, or browser’s user agent string, it will be put in the Trash. One word or IP address per line. It will match inside words, so “press” will match “WordPress”.' ); ?></label></p> 210 <p> 211 <textarea name="disallowed_keys" rows="10" cols="50" id="disallowed_keys" class="large-text code"><?php echo esc_textarea( get_option( 'disallowed_keys' ) ); ?></textarea> 212 </p> 213 </fieldset></td> 214 </tr> 215 <?php do_settings_fields( 'discussion', 'default' ); ?> 216 </table> 217 218 <h2 class="title"><?php _e( 'Avatars' ); ?></h2> 219 220 <p><?php _e( 'An avatar is an image that follows you from weblog to weblog appearing beside your name when you comment on avatar enabled sites. Here you can enable the display of avatars for people who comment on your site.' ); ?></p> 221 222 <?php 223 // The above would be a good place to link to the documentation on the Gravatar functions, for putting it in themes. Anything like that? 224 225 $show_avatars = get_option( 'show_avatars' ); 226 $show_avatars_class = ''; 227 if ( ! $show_avatars ) { 228 $show_avatars_class = ' hide-if-js'; 229 } 230 ?> 231 232 <table class="form-table" role="presentation"> 233 <tr> 234 <th scope="row"><?php _e( 'Avatar Display' ); ?></th> 235 <td> 236 <label for="show_avatars"> 237 <input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> /> 238 <?php _e( 'Show Avatars' ); ?> 239 </label> 240 </td> 241 </tr> 242 <tr class="avatar-settings<?php echo $show_avatars_class; ?>"> 243 <th scope="row"><?php _e( 'Maximum Rating' ); ?></th> 244 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Maximum Rating' ); ?></span></legend> 245 246 <?php 247 $ratings = array( 248 /* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */ 249 'G' => __( 'G — Suitable for all audiences' ), 250 /* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */ 251 'PG' => __( 'PG — Possibly offensive, usually for audiences 13 and above' ), 252 /* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */ 253 'R' => __( 'R — Intended for adult audiences above 17' ), 254 /* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */ 255 'X' => __( 'X — Even more mature than above' ), 256 ); 257 foreach ( $ratings as $key => $rating ) : 258 $selected = ( get_option( 'avatar_rating' ) == $key ) ? 'checked="checked"' : ''; 259 echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr( $key ) . "' $selected/> $rating</label><br />"; 260 endforeach; 261 ?> 262 263 </fieldset></td> 264 </tr> 265 <tr class="avatar-settings<?php echo $show_avatars_class; ?>"> 266 <th scope="row"><?php _e( 'Default Avatar' ); ?></th> 267 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Default Avatar' ); ?></span></legend> 268 269 <p> 270 <?php _e( 'For users without a custom avatar of their own, you can either display a generic logo or a generated one based on their email address.' ); ?><br /> 271 </p> 272 273 <?php 274 $avatar_defaults = array( 275 'mystery' => __( 'Mystery Person' ), 276 'blank' => __( 'Blank' ), 277 'gravatar_default' => __( 'Gravatar Logo' ), 278 'identicon' => __( 'Identicon (Generated)' ), 279 'wavatar' => __( 'Wavatar (Generated)' ), 280 'monsterid' => __( 'MonsterID (Generated)' ), 281 'retro' => __( 'Retro (Generated)' ), 282 ); 283 /** 284 * Filters the default avatars. 285 * 286 * Avatars are stored in key/value pairs, where the key is option value, 287 * and the name is the displayed avatar name. 288 * 289 * @since 2.6.0 290 * 291 * @param string[] $avatar_defaults Associative array of default avatars. 292 */ 293 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults ); 294 $default = get_option( 'avatar_default', 'mystery' ); 295 $avatar_list = ''; 296 297 // Force avatars on to display these choices. 298 add_filter( 'pre_option_show_avatars', '__return_true', 100 ); 299 300 foreach ( $avatar_defaults as $default_key => $default_name ) { 301 $selected = ( $default == $default_key ) ? 'checked="checked" ' : ''; 302 $avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr( $default_key ) . "' {$selected}/> "; 303 $avatar_list .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) ); 304 $avatar_list .= ' ' . $default_name . '</label>'; 305 $avatar_list .= '<br />'; 306 } 307 308 remove_filter( 'pre_option_show_avatars', '__return_true', 100 ); 309 310 /** 311 * Filters the HTML output of the default avatar list. 312 * 313 * @since 2.6.0 314 * 315 * @param string $avatar_list HTML markup of the avatar list. 316 */ 317 echo apply_filters( 'default_avatar_select', $avatar_list ); 318 ?> 319 320 </fieldset></td> 321 </tr> 322 <?php do_settings_fields( 'discussion', 'avatars' ); ?> 323 </table> 324 325 <?php do_settings_sections( 'discussion' ); ?> 326 327 <?php submit_button(); ?> 328 </form> 329 </div> 330 331 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Mar 8 01:00:04 2021 | Cross-referenced by PHPXref 0.7.1 |