wp/wp-admin/options-discussion.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 19 3d72ae0968f4
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     4  *
     4  *
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 /** WordPress Administration Bootstrap */
     8 /** WordPress Administration Bootstrap */
     9 require_once( dirname( __FILE__ ) . '/admin.php' );
     9 require_once __DIR__ . '/admin.php';
    10 
    10 
    11 if ( ! current_user_can( 'manage_options' ) ) {
    11 if ( ! current_user_can( 'manage_options' ) ) {
    12 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
    12 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
    13 }
    13 }
    14 
    14 
    26 	)
    26 	)
    27 );
    27 );
    28 
    28 
    29 get_current_screen()->set_help_sidebar(
    29 get_current_screen()->set_help_sidebar(
    30 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    30 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    31 	'<p>' . __( '<a href="https://codex.wordpress.org/Settings_Discussion_Screen">Documentation on Discussion Settings</a>' ) . '</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>'
    32 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    33 );
    33 );
    34 
    34 
    35 include( ABSPATH . 'wp-admin/admin-header.php' );
    35 require_once ABSPATH . 'wp-admin/admin-header.php';
    36 ?>
    36 ?>
    37 
    37 
    38 <div class="wrap">
    38 <div class="wrap">
    39 <h1><?php echo esc_html( $title ); ?></h1>
    39 <h1><?php echo esc_html( $title ); ?></h1>
    40 
    40 
    41 <form method="post" action="options.php">
    41 <form method="post" action="options.php">
    42 <?php settings_fields( 'discussion' ); ?>
    42 <?php settings_fields( 'discussion' ); ?>
    43 
    43 
    44 <table class="form-table" role="presentation">
    44 <table class="form-table" role="presentation">
    45 <tr>
    45 <tr>
    46 <th scope="row"><?php _e( 'Default article settings' ); ?></th>
    46 <th scope="row"><?php _e( 'Default post settings' ); ?></th>
    47 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Default article settings' ); ?></span></legend>
    47 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Default post settings' ); ?></span></legend>
    48 <label for="default_pingback_flag">
    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' ) ); ?> />
    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 article' ); ?></label>
    50 <?php _e( 'Attempt to notify any blogs linked to from the post' ); ?></label>
    51 <br />
    51 <br />
    52 <label for="default_ping_status">
    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' ) ); ?> />
    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 articles' ); ?></label>
    54 <?php _e( 'Allow link notifications from other blogs (pingbacks and trackbacks) on new posts' ); ?></label>
    55 <br />
    55 <br />
    56 <label for="default_comment_status">
    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' ) ); ?> />
    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 post comments on new articles' ); ?></label>
    58 <?php _e( 'Allow people to submit comments on new posts' ); ?></label>
    59 <br />
    59 <br />
    60 <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual articles.' ) . ')'; ?></p>
    60 <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual posts.' ) . ')'; ?></p>
    61 </fieldset></td>
    61 </fieldset></td>
    62 </tr>
    62 </tr>
    63 <tr>
    63 <tr>
    64 <th scope="row"><?php _e( 'Other comment settings' ); ?></th>
    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>
    65 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Other comment settings' ); ?></span></legend>
    77 
    77 
    78 <label for="close_comments_for_old_posts">
    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' ) ); ?> />
    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
    80 <?php
    81 printf(
    81 printf(
    82 	__( 'Automatically close comments on articles older than %s days' ),
    82 	/* translators: %s: Number of days. */
       
    83 	__( 'Automatically close comments on posts older than %s days' ),
    83 	'</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" />'
    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" />'
    84 );
    85 );
    85 ?>
    86 ?>
    86 </label>
    87 </label>
    87 <br />
    88 <br />
    88 
    89 
    89 <label for="show_comments_cookies_opt_in">
    90 <label for="show_comments_cookies_opt_in">
    90 <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' ) ); ?> />
    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' ) ); ?> />
    91 <?php _e( 'Show comments cookies opt-in checkbox, allowing comment author cookies to be set.' ); ?>
    92 <?php _e( 'Show comments cookies opt-in checkbox, allowing comment author cookies to be set' ); ?>
    92 </label>
    93 </label>
    93 <br />
    94 <br />
    94 
    95 
    95 <label for="thread_comments">
    96 <label for="thread_comments">
    96 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked( '1', get_option( 'thread_comments' ) ); ?> />
    97 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked( '1', get_option( 'thread_comments' ) ); ?> />
   112 	}
   113 	}
   113 	$thread_comments_depth .= ">$i</option>";
   114 	$thread_comments_depth .= ">$i</option>";
   114 }
   115 }
   115 $thread_comments_depth .= '</select>';
   116 $thread_comments_depth .= '</select>';
   116 
   117 
       
   118 /* translators: %s: Number of levels. */
   117 printf( __( 'Enable threaded (nested) comments %s levels deep' ), $thread_comments_depth );
   119 printf( __( 'Enable threaded (nested) comments %s levels deep' ), $thread_comments_depth );
   118 
   120 
   119 ?>
   121 ?>
   120 </label>
   122 </label>
   121 <br />
   123 <br />
   122 <label for="page_comments">
   124 <label for="page_comments">
   123 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
   125 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
   124 <?php
   126 <?php
   125 $default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
   127 $default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
   126 if ( 'newest' == get_option( 'default_comments_page' ) ) {
   128 if ( 'newest' === get_option( 'default_comments_page' ) ) {
   127 	$default_comments_page .= ' selected="selected"';
   129 	$default_comments_page .= ' selected="selected"';
   128 }
   130 }
   129 $default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"';
   131 $default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"';
   130 if ( 'oldest' == get_option( 'default_comments_page' ) ) {
   132 if ( 'oldest' === get_option( 'default_comments_page' ) ) {
   131 	$default_comments_page .= ' selected="selected"';
   133 	$default_comments_page .= ' selected="selected"';
   132 }
   134 }
   133 $default_comments_page .= '>' . __( 'first' ) . '</option></select>';
   135 $default_comments_page .= '>' . __( 'first' ) . '</option></select>';
   134 printf(
   136 printf(
   135 	/* translators: 1: Form field control for number of top level comments per page, 2: Form field control for the 'first' or 'last' page */
   137 	/* translators: 1: Form field control for number of top level comments per page, 2: Form field control for the 'first' or 'last' page. */
   136 	__( 'Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default' ),
   138 	__( 'Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default' ),
   137 	'</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" />',
   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" />',
   138 	$default_comments_page
   140 	$default_comments_page
   139 );
   141 );
   140 ?>
   142 ?>
   142 <br />
   144 <br />
   143 <label for="comment_order">
   145 <label for="comment_order">
   144 <?php
   146 <?php
   145 
   147 
   146 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
   148 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
   147 if ( 'asc' == get_option( 'comment_order' ) ) {
   149 if ( 'asc' === get_option( 'comment_order' ) ) {
   148 	$comment_order .= ' selected="selected"';
   150 	$comment_order .= ' selected="selected"';
   149 }
   151 }
   150 $comment_order .= '>' . __( 'older' ) . '</option><option value="desc"';
   152 $comment_order .= '>' . __( 'older' ) . '</option><option value="desc"';
   151 if ( 'desc' == get_option( 'comment_order' ) ) {
   153 if ( 'desc' === get_option( 'comment_order' ) ) {
   152 	$comment_order .= ' selected="selected"';
   154 	$comment_order .= ' selected="selected"';
   153 }
   155 }
   154 $comment_order .= '>' . __( 'newer' ) . '</option></select>';
   156 $comment_order .= '>' . __( 'newer' ) . '</option></select>';
   155 
   157 
       
   158 /* translators: %s: Form field control for 'older' or 'newer' comments. */
   156 printf( __( 'Comments should be displayed with the %s comments at the top of each page' ), $comment_order );
   159 printf( __( 'Comments should be displayed with the %s comments at the top of each page' ), $comment_order );
   157 
   160 
   158 ?>
   161 ?>
   159 </label>
   162 </label>
   160 </fieldset></td>
   163 </fieldset></td>
   176 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Before a comment appears' ); ?></span></legend>
   179 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Before a comment appears' ); ?></span></legend>
   177 <label for="comment_moderation">
   180 <label for="comment_moderation">
   178 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked( '1', get_option( 'comment_moderation' ) ); ?> />
   181 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked( '1', get_option( 'comment_moderation' ) ); ?> />
   179 <?php _e( 'Comment must be manually approved' ); ?> </label>
   182 <?php _e( 'Comment must be manually approved' ); ?> </label>
   180 <br />
   183 <br />
   181 <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked( '1', get_option( 'comment_whitelist' ) ); ?> /> <?php _e( 'Comment author must have a previously approved comment' ); ?></label>
   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>
   182 </fieldset></td>
   185 </fieldset></td>
   183 </tr>
   186 </tr>
   184 <tr>
   187 <tr>
   185 <th scope="row"><?php _e( 'Comment Moderation' ); ?></th>
   188 <th scope="row"><?php _e( 'Comment Moderation' ); ?></th>
   186 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Comment Moderation' ); ?></span></legend>
   189 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Comment Moderation' ); ?></span></legend>
   187 <p><label for="comment_max_links"><?php printf( __( '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.)' ), '<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" />' ); ?></label></p>
   190 <p><label for="comment_max_links">
   188 
   191 <?php
   189 <p><label for="moderation_keys"><?php _e( 'When a comment contains any of these words in its content, name, URL, email, or IP address, 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 &#8220;press&#8221; will match &#8220;WordPress&#8221;.' ); ?></label></p>
   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&#8217;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 &#8220;press&#8221; will match &#8220;WordPress&#8221;.' ); ?></label></p>
   190 <p>
   201 <p>
   191 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea>
   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>
   192 </p>
   203 </p>
   193 </fieldset></td>
   204 </fieldset></td>
   194 </tr>
   205 </tr>
   195 <tr>
   206 <tr>
   196 <th scope="row"><?php _e( 'Comment Blacklist' ); ?></th>
   207 <th scope="row"><?php _e( 'Disallowed Comment Keys' ); ?></th>
   197 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Comment Blacklist' ); ?></span></legend>
   208 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Disallowed Comment Keys' ); ?></span></legend>
   198 <p><label for="blacklist_keys"><?php _e( 'When a comment contains any of these words in its content, name, URL, email, or IP address, it will be put in the trash. One word or IP address per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.' ); ?></label></p>
   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&#8217;s user agent string, it will be put in the Trash. One word or IP address per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.' ); ?></label></p>
   199 <p>
   210 <p>
   200 <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea>
   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>
   201 </p>
   212 </p>
   202 </fieldset></td>
   213 </fieldset></td>
   203 </tr>
   214 </tr>
   204 <?php do_settings_fields( 'discussion', 'default' ); ?>
   215 <?php do_settings_fields( 'discussion', 'default' ); ?>
   205 </table>
   216 </table>
   207 <h2 class="title"><?php _e( 'Avatars' ); ?></h2>
   218 <h2 class="title"><?php _e( 'Avatars' ); ?></h2>
   208 
   219 
   209 <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>
   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>
   210 
   221 
   211 <?php
   222 <?php
   212 // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that?
   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?
   213 
   224 
   214 $show_avatars       = get_option( 'show_avatars' );
   225 $show_avatars       = get_option( 'show_avatars' );
   215 $show_avatars_class = '';
   226 $show_avatars_class = '';
   216 if ( ! $show_avatars ) {
   227 if ( ! $show_avatars ) {
   217 	$show_avatars_class = ' hide-if-js';
   228 	$show_avatars_class = ' hide-if-js';
   281  */
   292  */
   282 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
   293 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
   283 $default         = get_option( 'avatar_default', 'mystery' );
   294 $default         = get_option( 'avatar_default', 'mystery' );
   284 $avatar_list     = '';
   295 $avatar_list     = '';
   285 
   296 
   286 // Force avatars on to display these choices
   297 // Force avatars on to display these choices.
   287 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
   298 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
   288 
   299 
   289 foreach ( $avatar_defaults as $default_key => $default_name ) {
   300 foreach ( $avatar_defaults as $default_key => $default_name ) {
   290 	$selected     = ( $default == $default_key ) ? 'checked="checked" ' : '';
   301 	$selected     = ( $default == $default_key ) ? 'checked="checked" ' : '';
   291 	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr( $default_key ) . "' {$selected}/> ";
   302 	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr( $default_key ) . "' {$selected}/> ";
   315 
   326 
   316 <?php submit_button(); ?>
   327 <?php submit_button(); ?>
   317 </form>
   328 </form>
   318 </div>
   329 </div>
   319 
   330 
   320 <?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
   331 <?php require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>