wp/wp-admin/options-discussion.php
changeset 22 8c2e4d02f4ef
parent 21 48c4eec2b7e6
equal deleted inserted replaced
21:48c4eec2b7e6 22:8c2e4d02f4ef
    40 <h1><?php echo esc_html( $title ); ?></h1>
    40 <h1><?php echo esc_html( $title ); ?></h1>
    41 
    41 
    42 <form method="post" action="options.php">
    42 <form method="post" action="options.php">
    43 <?php settings_fields( 'discussion' ); ?>
    43 <?php settings_fields( 'discussion' ); ?>
    44 
    44 
    45 <table class="form-table" role="presentation">
    45 <table class="form-table indent-children" role="presentation">
    46 <tr>
    46 <tr>
    47 <th scope="row"><?php _e( 'Default post settings' ); ?></th>
    47 <th scope="row"><?php _e( 'Default post settings' ); ?></th>
    48 <td><fieldset><legend class="screen-reader-text"><span>
    48 <td><fieldset><legend class="screen-reader-text"><span>
    49 	<?php
    49 	<?php
    50 	/* translators: Hidden accessibility text. */
    50 	/* translators: Hidden accessibility text. */
    84 	echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' );
    84 	echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' );
    85 }
    85 }
    86 ?>
    86 ?>
    87 </label>
    87 </label>
    88 <br />
    88 <br />
    89 
    89 <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' ) ); ?> /> <label for="close_comments_for_old_posts"><?php _e( 'Automatically close comments on old posts' ); ?></label>
    90 <label for="close_comments_for_old_posts">
    90 <ul>
    91 <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' ) ); ?> />
    91 	<li>
    92 <?php
    92 		<label for="close_comments_days_old"><?php _e( 'Close comments when post is how many days old' ); ?></label>
    93 printf(
    93 		<input name="close_comments_days_old" type="number" step="1" min="0" id="close_comments_days_old" value="<?php echo esc_attr( get_option( 'close_comments_days_old' ) ); ?>" class="small-text" />
    94 	/* translators: %s: Number of days. */
    94 	</li>
    95 	__( 'Automatically close comments on posts older than %s days' ),
    95 </ul>
    96 	'</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" />'
    96 
    97 );
       
    98 ?>
       
    99 </label>
       
   100 <br />
       
   101 
       
   102 <label for="show_comments_cookies_opt_in">
       
   103 <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' ) ); ?> />
    97 <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' ) ); ?> />
   104 <?php _e( 'Show comments cookies opt-in checkbox, allowing comment author cookies to be set' ); ?>
    98 <label for="show_comments_cookies_opt_in"><?php _e( 'Show comments cookies opt-in checkbox, allowing comment author cookies to be set' ); ?></label>
   105 </label>
    99 <br />
   106 <br />
       
   107 
       
   108 <label for="thread_comments">
       
   109 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked( '1', get_option( 'thread_comments' ) ); ?> />
   100 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked( '1', get_option( 'thread_comments' ) ); ?> />
       
   101 <label for="thread_comments"><?php _e( 'Enable threaded (nested) comments' ); ?></label>
       
   102 
   110 <?php
   103 <?php
   111 /**
   104 /**
   112  * Filters the maximum depth of threaded/nested comments.
   105  * Filters the maximum depth of threaded/nested comments.
   113  *
   106  *
   114  * @since 2.7.0
   107  * @since 2.7.0
   115  *
   108  *
   116  * @param int $max_depth The maximum depth of threaded comments. Default 10.
   109  * @param int $max_depth The maximum depth of threaded comments. Default 10.
   117  */
   110  */
   118 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
   111 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
   119 
   112 
   120 $thread_comments_depth = '</label> <label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
   113 $thread_comments_depth = '<select name="thread_comments_depth" id="thread_comments_depth">';
   121 for ( $i = 2; $i <= $maxdeep; $i++ ) {
   114 for ( $i = 2; $i <= $maxdeep; $i++ ) {
   122 	$thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'";
   115 	$thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'";
   123 	if ( (int) get_option( 'thread_comments_depth' ) === $i ) {
   116 	if ( (int) get_option( 'thread_comments_depth' ) === $i ) {
   124 		$thread_comments_depth .= " selected='selected'";
   117 		$thread_comments_depth .= " selected='selected'";
   125 	}
   118 	}
   126 	$thread_comments_depth .= ">$i</option>";
   119 	$thread_comments_depth .= ">$i</option>";
   127 }
   120 }
   128 $thread_comments_depth .= '</select>';
   121 $thread_comments_depth .= '</select>';
   129 
   122 ?>
   130 /* translators: %s: Number of levels. */
   123 <ul>
   131 printf( __( 'Enable threaded (nested) comments %s levels deep' ), $thread_comments_depth );
   124 	<li>
   132 
   125 		<label for="thread_comments_depth"><?php _e( 'Number of levels for threaded (nested) comments' ); ?></label>
   133 ?>
   126 		<?php echo $thread_comments_depth; ?>
   134 </label>
   127 	</li>
   135 <br />
   128 </ul>
   136 <label for="page_comments">
   129 </fieldset></td>
       
   130 </tr>
       
   131 
       
   132 <tr>
       
   133 <th scope="row"><?php _e( 'Comment Pagination' ); ?></th>
       
   134 <td><fieldset><legend class="screen-reader-text"><span>
       
   135 	<?php
       
   136 	/* translators: Hidden accessibility text. */
       
   137 	_e( 'Comment Pagination' );
       
   138 	?>
       
   139 </span></legend>
   137 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
   140 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
   138 <?php
   141 <label for="page_comments"><?php _e( 'Break comments into pages' ); ?></label>
   139 $default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
   142 <ul>
   140 if ( 'newest' === get_option( 'default_comments_page' ) ) {
   143 	<li>
   141 	$default_comments_page .= ' selected="selected"';
   144 		<label for="comments_per_page"><?php _e( 'Top level comments per page' ); ?></label>
   142 }
   145 		<input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="<?php echo esc_attr( get_option( 'comments_per_page' ) ); ?>" class="small-text" />
   143 $default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"';
   146 	</li>
   144 if ( 'oldest' === get_option( 'default_comments_page' ) ) {
   147 	<li>
   145 	$default_comments_page .= ' selected="selected"';
   148 		<label for="default_comments_page"><?php _e( 'Comments page to display by default' ); ?></label>
   146 }
   149 		<select name="default_comments_page" id="default_comments_page">
   147 $default_comments_page .= '>' . __( 'first' ) . '</option></select>';
   150 			<option value="newest" <?php selected( 'newest', get_option( 'default_comments_page' ) ); ?>><?php _e( 'last page' ); ?></option>
   148 printf(
   151 			<option value="oldest" <?php selected( 'oldest', get_option( 'default_comments_page' ) ); ?>><?php _e( 'first page' ); ?></option>
   149 	/* translators: 1: Form field control for number of top level comments per page, 2: Form field control for the 'first' or 'last' page. */
   152 		</select>
   150 	__( 'Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default' ),
   153 	</li>
   151 	'</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" />',
   154 	<li>
   152 	$default_comments_page
   155 		<label for="comment_order"><?php _e( 'Comments to display at the top of each page' ); ?></label>
   153 );
   156 		<select name="comment_order" id="comment_order">
   154 ?>
   157 			<option value="asc" <?php selected( 'asc', get_option( 'comment_order' ) ); ?>><?php _e( 'older' ); ?></option>
   155 </label>
   158 			<option value="desc" <?php selected( 'desc', get_option( 'comment_order' ) ); ?>><?php _e( 'newer' ); ?></option>
   156 <br />
   159 		</select>
   157 <label for="comment_order">
   160 	</li>
   158 <?php
   161 </ul>
   159 
       
   160 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
       
   161 if ( 'asc' === get_option( 'comment_order' ) ) {
       
   162 	$comment_order .= ' selected="selected"';
       
   163 }
       
   164 $comment_order .= '>' . __( 'older' ) . '</option><option value="desc"';
       
   165 if ( 'desc' === get_option( 'comment_order' ) ) {
       
   166 	$comment_order .= ' selected="selected"';
       
   167 }
       
   168 $comment_order .= '>' . __( 'newer' ) . '</option></select>';
       
   169 
       
   170 /* translators: %s: Form field control for 'older' or 'newer' comments. */
       
   171 printf( __( 'Comments should be displayed with the %s comments at the top of each page' ), $comment_order );
       
   172 
       
   173 ?>
       
   174 </label>
       
   175 </fieldset></td>
   162 </fieldset></td>
   176 </tr>
   163 </tr>
   177 <tr>
   164 <tr>
   178 <th scope="row"><?php _e( 'Email me whenever' ); ?></th>
   165 <th scope="row"><?php _e( 'Email me whenever' ); ?></th>
   179 <td><fieldset><legend class="screen-reader-text"><span>
   166 <td><fieldset><legend class="screen-reader-text"><span>