wp/wp-admin/options-discussion.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
equal deleted inserted replaced
18:be944660c56a 19:3d72ae0968f4
    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 
       
    15 // Used in the HTML title tag.
    15 $title       = __( 'Discussion Settings' );
    16 $title       = __( 'Discussion Settings' );
    16 $parent_file = 'options-general.php';
    17 $parent_file = 'options-general.php';
    17 
    18 
    18 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' );
    19 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' );
    19 
    20 
    20 get_current_screen()->add_help_tab(
    21 get_current_screen()->add_help_tab(
    21 	array(
    22 	array(
    22 		'id'      => 'overview',
    23 		'id'      => 'overview',
    23 		'title'   => __( 'Overview' ),
    24 		'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&#8217;t all fit here! :) Use the documentation links to get information on what each discussion setting does.' ) . '</p>' .
    25 		'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 will not 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 			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
    26 	)
    27 	)
    27 );
    28 );
    28 
    29 
    29 get_current_screen()->set_help_sidebar(
    30 get_current_screen()->set_help_sidebar(
    55 <br />
    56 <br />
    56 <label for="default_comment_status">
    57 <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 <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 <?php _e( 'Allow people to submit comments on new posts' ); ?></label>
    59 <br />
    60 <br />
    60 <p class="description"><?php echo '(' . __( 'These settings may be overridden for individual posts.' ) . ')'; ?></p>
    61 <p class="description"><?php _e( 'Individual posts may override these settings. Changes here will only be applied to new posts.' ); ?></p>
    61 </fieldset></td>
    62 </fieldset></td>
    62 </tr>
    63 </tr>
    63 <tr>
    64 <tr>
    64 <th scope="row"><?php _e( 'Other comment settings' ); ?></th>
    65 <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 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Other comment settings' ); ?></span></legend>
   106 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
   107 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
   107 
   108 
   108 $thread_comments_depth = '</label> <label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
   109 $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 for ( $i = 2; $i <= $maxdeep; $i++ ) {
   110 	$thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'";
   111 	$thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'";
   111 	if ( get_option( 'thread_comments_depth' ) == $i ) {
   112 	if ( (int) get_option( 'thread_comments_depth' ) === $i ) {
   112 		$thread_comments_depth .= " selected='selected'";
   113 		$thread_comments_depth .= " selected='selected'";
   113 	}
   114 	}
   114 	$thread_comments_depth .= ">$i</option>";
   115 	$thread_comments_depth .= ">$i</option>";
   115 }
   116 }
   116 $thread_comments_depth .= '</select>';
   117 $thread_comments_depth .= '</select>';
   215 <?php do_settings_fields( 'discussion', 'default' ); ?>
   216 <?php do_settings_fields( 'discussion', 'default' ); ?>
   216 </table>
   217 </table>
   217 
   218 
   218 <h2 class="title"><?php _e( 'Avatars' ); ?></h2>
   219 <h2 class="title"><?php _e( 'Avatars' ); ?></h2>
   219 
   220 
   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 <p><?php _e( 'An avatar is an image that can be associated with a user across multiple websites. In this area, you can choose to display avatars of users who interact with the site.' ); ?></p>
   221 
   222 
   222 <?php
   223 <?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 // 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 
   225 $show_avatars       = get_option( 'show_avatars' );
   226 $show_avatars       = get_option( 'show_avatars' );
   253 	'R'  => __( 'R &#8212; Intended for adult audiences above 17' ),
   254 	'R'  => __( 'R &#8212; 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 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   255 	'X'  => __( 'X &#8212; Even more mature than above' ),
   256 	'X'  => __( 'X &#8212; Even more mature than above' ),
   256 );
   257 );
   257 foreach ( $ratings as $key => $rating ) :
   258 foreach ( $ratings as $key => $rating ) :
   258 	$selected = ( get_option( 'avatar_rating' ) == $key ) ? 'checked="checked"' : '';
   259 	$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 	echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr( $key ) . "' $selected/> $rating</label><br />";
   260 endforeach;
   261 endforeach;
   261 ?>
   262 ?>
   262 
   263 
   263 </fieldset></td>
   264 </fieldset></td>
   296 
   297 
   297 // Force avatars on to display these choices.
   298 // Force avatars on to display these choices.
   298 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
   299 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
   299 
   300 
   300 foreach ( $avatar_defaults as $default_key => $default_name ) {
   301 foreach ( $avatar_defaults as $default_key => $default_name ) {
   301 	$selected     = ( $default == $default_key ) ? 'checked="checked" ' : '';
   302 	$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 .= "\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 .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) );
   304 	$avatar_list .= ' ' . $default_name . '</label>';
   305 	$avatar_list .= ' ' . $default_name . '</label>';
   305 	$avatar_list .= '<br />';
   306 	$avatar_list .= '<br />';
   306 }
   307 }