wp/wp-admin/options-discussion.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 16 a86126ab1dd4
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
     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( dirname( __FILE__ ) . '/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 $title = __('Discussion Settings');
    14 
       
    15 $title       = __( 'Discussion Settings' );
    15 $parent_file = 'options-general.php';
    16 $parent_file = 'options-general.php';
    16 
    17 
    17 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' );
    18 add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' );
    18 
    19 
    19 get_current_screen()->add_help_tab( array(
    20 get_current_screen()->add_help_tab(
    20 	'id'      => 'overview',
    21 	array(
    21 	'title'   => __('Overview'),
    22 		'id'      => 'overview',
    22 	'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>' .
    23 		'title'   => __( 'Overview' ),
    23 		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
    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>' .
    24 ) );
    25 			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
       
    26 	)
       
    27 );
    25 
    28 
    26 get_current_screen()->set_help_sidebar(
    29 get_current_screen()->set_help_sidebar(
    27 	'<p><strong>' . __('For more information:') . '</strong></p>' .
    30 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
    28 	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Discussion_Screen">Documentation on Discussion Settings</a>') . '</p>' .
    31 	'<p>' . __( '<a href="https://codex.wordpress.org/Settings_Discussion_Screen">Documentation on Discussion Settings</a>' ) . '</p>' .
    29 	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
    32 	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
    30 );
    33 );
    31 
    34 
    32 include( ABSPATH . 'wp-admin/admin-header.php' );
    35 include( ABSPATH . 'wp-admin/admin-header.php' );
    33 ?>
    36 ?>
    34 
    37 
    35 <div class="wrap">
    38 <div class="wrap">
    36 <h1><?php echo esc_html( $title ); ?></h1>
    39 <h1><?php echo esc_html( $title ); ?></h1>
    37 
    40 
    38 <form method="post" action="options.php">
    41 <form method="post" action="options.php">
    39 <?php settings_fields('discussion'); ?>
    42 <?php settings_fields( 'discussion' ); ?>
    40 
    43 
    41 <table class="form-table">
    44 <table class="form-table" role="presentation">
    42 <tr>
    45 <tr>
    43 <th scope="row"><?php _e('Default article settings'); ?></th>
    46 <th scope="row"><?php _e( 'Default article settings' ); ?></th>
    44 <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 article settings' ); ?></span></legend>
    45 <label for="default_pingback_flag">
    48 <label for="default_pingback_flag">
    46 <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' ) ); ?> />
    47 <?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 article' ); ?></label>
    48 <br />
    51 <br />
    49 <label for="default_ping_status">
    52 <label for="default_ping_status">
    50 <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' ) ); ?> />
    51 <?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 articles' ); ?></label>
    52 <br />
    55 <br />
    53 <label for="default_comment_status">
    56 <label for="default_comment_status">
    54 <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' ) ); ?> />
    55 <?php _e('Allow people to post comments on new articles'); ?></label>
    58 <?php _e( 'Allow people to post comments on new articles' ); ?></label>
    56 <br />
    59 <br />
    57 <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 articles.' ) . ')'; ?></p>
    58 </fieldset></td>
    61 </fieldset></td>
    59 </tr>
    62 </tr>
    60 <tr>
    63 <tr>
    61 <th scope="row"><?php _e('Other comment settings'); ?></th>
    64 <th scope="row"><?php _e( 'Other comment settings' ); ?></th>
    62 <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>
    63 <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>
    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>
    64 <br />
    67 <br />
    65 <label for="comment_registration">
    68 <label for="comment_registration">
    66 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
    69 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked( '1', get_option( 'comment_registration' ) ); ?> />
    67 <?php _e('Users must be registered and logged in to comment'); ?>
    70 <?php _e( 'Users must be registered and logged in to comment' ); ?>
    68 <?php if ( !get_option( 'users_can_register' ) && is_multisite() ) echo ' ' . __( '(Signup has been disabled. Only members of this site can 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 ?>
    69 </label>
    75 </label>
    70 <br />
    76 <br />
    71 
    77 
    72 <label for="close_comments_for_old_posts">
    78 <label for="close_comments_for_old_posts">
    73 <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' ) ); ?> />
    74 <?php printf(
    80 <?php
       
    81 printf(
    75 	__( 'Automatically close comments on articles older than %s days' ),
    82 	__( 'Automatically close comments on articles older than %s days' ),
    76 	'</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" />'
    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" />'
    77 ); ?>
    84 );
       
    85 ?>
    78 </label>
    86 </label>
    79 <br />
    87 <br />
    80 
    88 
    81 <label for="show_comments_cookies_opt_in">
    89 <label for="show_comments_cookies_opt_in">
    82 <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' ) ); ?> />
    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' ) ); ?> />
    83 <?php _e( 'Show comments cookies opt-in checkbox.' ); ?>
    91 <?php _e( 'Show comments cookies opt-in checkbox, allowing comment author cookies to be set.' ); ?>
    84 </label>
    92 </label>
    85 <br />
    93 <br />
    86 
    94 
    87 <label for="thread_comments">
    95 <label for="thread_comments">
    88 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
    96 <input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked( '1', get_option( 'thread_comments' ) ); ?> />
    89 <?php
    97 <?php
    90 /**
    98 /**
    91  * Filters the maximum depth of threaded/nested comments.
    99  * Filters the maximum depth of threaded/nested comments.
    92  *
   100  *
    93  * @since 2.7.0.
   101  * @since 2.7.0
    94  *
   102  *
    95  * @param int $max_depth The maximum depth of threaded comments. Default 10.
   103  * @param int $max_depth The maximum depth of threaded comments. Default 10.
    96  */
   104  */
    97 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
   105 $maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
    98 
   106 
    99 $thread_comments_depth = '</label> <label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
   107 $thread_comments_depth = '</label> <label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
   100 for ( $i = 2; $i <= $maxdeep; $i++ ) {
   108 for ( $i = 2; $i <= $maxdeep; $i++ ) {
   101 	$thread_comments_depth .= "<option value='" . esc_attr($i) . "'";
   109 	$thread_comments_depth .= "<option value='" . esc_attr( $i ) . "'";
   102 	if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
   110 	if ( get_option( 'thread_comments_depth' ) == $i ) {
       
   111 		$thread_comments_depth .= " selected='selected'";
       
   112 	}
   103 	$thread_comments_depth .= ">$i</option>";
   113 	$thread_comments_depth .= ">$i</option>";
   104 }
   114 }
   105 $thread_comments_depth .= '</select>';
   115 $thread_comments_depth .= '</select>';
   106 
   116 
   107 printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
   117 printf( __( 'Enable threaded (nested) comments %s levels deep' ), $thread_comments_depth );
   108 
   118 
   109 ?></label>
   119 ?>
       
   120 </label>
   110 <br />
   121 <br />
   111 <label for="page_comments">
   122 <label for="page_comments">
   112 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
   123 <input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked( '1', get_option( 'page_comments' ) ); ?> />
   113 <?php
   124 <?php
   114 $default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
   125 $default_comments_page = '</label> <label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
   115 if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
   126 if ( 'newest' == get_option( 'default_comments_page' ) ) {
   116 $default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
   127 	$default_comments_page .= ' selected="selected"';
   117 if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
   128 }
   118 $default_comments_page .= '>' . __('first') . '</option></select>';
   129 $default_comments_page .= '>' . __( 'last' ) . '</option><option value="oldest"';
       
   130 if ( 'oldest' == get_option( 'default_comments_page' ) ) {
       
   131 	$default_comments_page .= ' selected="selected"';
       
   132 }
       
   133 $default_comments_page .= '>' . __( 'first' ) . '</option></select>';
   119 printf(
   134 printf(
   120 	/* translators: 1: Form field control for number of top level comments per page, 2: Form field control for the 'first' or 'last' page */
   135 	/* translators: 1: Form field control for number of top level comments per page, 2: Form field control for the 'first' or 'last' page */
   121 	__( 'Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default' ),
   136 	__( 'Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default' ),
   122 	'</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" />',
   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" />',
   123 	$default_comments_page
   138 	$default_comments_page
   124 );
   139 );
   125 ?></label>
   140 ?>
   126 <br />
   141 </label>
   127 <label for="comment_order"><?php
   142 <br />
       
   143 <label for="comment_order">
       
   144 <?php
   128 
   145 
   129 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
   146 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
   130 if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
   147 if ( 'asc' == get_option( 'comment_order' ) ) {
   131 $comment_order .= '>' . __('older') . '</option><option value="desc"';
   148 	$comment_order .= ' selected="selected"';
   132 if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
   149 }
   133 $comment_order .= '>' . __('newer') . '</option></select>';
   150 $comment_order .= '>' . __( 'older' ) . '</option><option value="desc"';
   134 
   151 if ( 'desc' == get_option( 'comment_order' ) ) {
   135 printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
   152 	$comment_order .= ' selected="selected"';
   136 
   153 }
   137 ?></label>
   154 $comment_order .= '>' . __( 'newer' ) . '</option></select>';
   138 </fieldset></td>
   155 
   139 </tr>
   156 printf( __( 'Comments should be displayed with the %s comments at the top of each page' ), $comment_order );
   140 <tr>
   157 
   141 <th scope="row"><?php _e('Email me whenever'); ?></th>
   158 ?>
   142 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Email me whenever'); ?></span></legend>
   159 </label>
       
   160 </fieldset></td>
       
   161 </tr>
       
   162 <tr>
       
   163 <th scope="row"><?php _e( 'Email me whenever' ); ?></th>
       
   164 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Email me whenever' ); ?></span></legend>
   143 <label for="comments_notify">
   165 <label for="comments_notify">
   144 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked('1', get_option('comments_notify')); ?> />
   166 <input name="comments_notify" type="checkbox" id="comments_notify" value="1" <?php checked( '1', get_option( 'comments_notify' ) ); ?> />
   145 <?php _e('Anyone posts a comment'); ?> </label>
   167 <?php _e( 'Anyone posts a comment' ); ?> </label>
   146 <br />
   168 <br />
   147 <label for="moderation_notify">
   169 <label for="moderation_notify">
   148 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked('1', get_option('moderation_notify')); ?> />
   170 <input name="moderation_notify" type="checkbox" id="moderation_notify" value="1" <?php checked( '1', get_option( 'moderation_notify' ) ); ?> />
   149 <?php _e('A comment is held for moderation'); ?> </label>
   171 <?php _e( 'A comment is held for moderation' ); ?> </label>
   150 </fieldset></td>
   172 </fieldset></td>
   151 </tr>
   173 </tr>
   152 <tr>
   174 <tr>
   153 <th scope="row"><?php _e('Before a comment appears'); ?></th>
   175 <th scope="row"><?php _e( 'Before a comment appears' ); ?></th>
   154 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Before a comment appears'); ?></span></legend>
   176 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Before a comment appears' ); ?></span></legend>
   155 <label for="comment_moderation">
   177 <label for="comment_moderation">
   156 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked('1', get_option('comment_moderation')); ?> />
   178 <input name="comment_moderation" type="checkbox" id="comment_moderation" value="1" <?php checked( '1', get_option( 'comment_moderation' ) ); ?> />
   157 <?php _e('Comment must be manually approved'); ?> </label>
   179 <?php _e( 'Comment must be manually approved' ); ?> </label>
   158 <br />
   180 <br />
   159 <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>
   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>
   160 </fieldset></td>
   182 </fieldset></td>
   161 </tr>
   183 </tr>
   162 <tr>
   184 <tr>
   163 <th scope="row"><?php _e('Comment Moderation'); ?></th>
   185 <th scope="row"><?php _e( 'Comment Moderation' ); ?></th>
   164 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend>
   186 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Comment Moderation' ); ?></span></legend>
   165 <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>
   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>
   166 
   188 
   167 <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>
   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>
   168 <p>
   190 <p>
   169 <textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea>
   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>
   170 </p>
   192 </p>
   171 </fieldset></td>
   193 </fieldset></td>
   172 </tr>
   194 </tr>
   173 <tr>
   195 <tr>
   174 <th scope="row"><?php _e('Comment Blacklist'); ?></th>
   196 <th scope="row"><?php _e( 'Comment Blacklist' ); ?></th>
   175 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist'); ?></span></legend>
   197 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Comment Blacklist' ); ?></span></legend>
   176 <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>
   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>
   177 <p>
   199 <p>
   178 <textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea>
   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>
   179 </p>
   201 </p>
   180 </fieldset></td>
   202 </fieldset></td>
   181 </tr>
   203 </tr>
   182 <?php do_settings_fields('discussion', 'default'); ?>
   204 <?php do_settings_fields( 'discussion', 'default' ); ?>
   183 </table>
   205 </table>
   184 
   206 
   185 <h2 class="title"><?php _e('Avatars'); ?></h2>
   207 <h2 class="title"><?php _e( 'Avatars' ); ?></h2>
   186 
   208 
   187 <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>
   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>
   188 
   210 
   189 <?php
   211 <?php
   190 // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that?
   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?
   191 
   213 
   192 $show_avatars = get_option( 'show_avatars' );
   214 $show_avatars       = get_option( 'show_avatars' );
   193 ?>
   215 $show_avatars_class = '';
   194 
   216 if ( ! $show_avatars ) {
   195 <table class="form-table">
   217 	$show_avatars_class = ' hide-if-js';
   196 <tr>
   218 }
   197 <th scope="row"><?php _e('Avatar Display'); ?></th>
   219 ?>
   198 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
   220 
       
   221 <table class="form-table" role="presentation">
       
   222 <tr>
       
   223 <th scope="row"><?php _e( 'Avatar Display' ); ?></th>
       
   224 <td>
   199 	<label for="show_avatars">
   225 	<label for="show_avatars">
   200 		<input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> />
   226 		<input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> />
   201 		<?php _e( 'Show Avatars' ); ?>
   227 		<?php _e( 'Show Avatars' ); ?>
   202 	</label>
   228 	</label>
   203 </fieldset></td>
   229 </td>
   204 </tr>
   230 </tr>
   205 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
   231 <tr class="avatar-settings<?php echo $show_avatars_class; ?>">
   206 <th scope="row"><?php _e('Maximum Rating'); ?></th>
   232 <th scope="row"><?php _e( 'Maximum Rating' ); ?></th>
   207 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend>
   233 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Maximum Rating' ); ?></span></legend>
   208 
   234 
   209 <?php
   235 <?php
   210 $ratings = array(
   236 $ratings = array(
   211 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   237 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   212 	'G' => __('G &#8212; Suitable for all audiences'),
   238 	'G'  => __( 'G &#8212; Suitable for all audiences' ),
   213 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   239 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   214 	'PG' => __('PG &#8212; Possibly offensive, usually for audiences 13 and above'),
   240 	'PG' => __( 'PG &#8212; Possibly offensive, usually for audiences 13 and above' ),
   215 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   241 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   216 	'R' => __('R &#8212; Intended for adult audiences above 17'),
   242 	'R'  => __( 'R &#8212; Intended for adult audiences above 17' ),
   217 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   243 	/* translators: Content suitability rating: https://en.wikipedia.org/wiki/Motion_Picture_Association_of_America_film_rating_system */
   218 	'X' => __('X &#8212; Even more mature than above')
   244 	'X'  => __( 'X &#8212; Even more mature than above' ),
   219 );
   245 );
   220 foreach ($ratings as $key => $rating) :
   246 foreach ( $ratings as $key => $rating ) :
   221 	$selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
   247 	$selected = ( get_option( 'avatar_rating' ) == $key ) ? 'checked="checked"' : '';
   222 	echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />";
   248 	echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr( $key ) . "' $selected/> $rating</label><br />";
   223 endforeach;
   249 endforeach;
   224 ?>
   250 ?>
   225 
   251 
   226 </fieldset></td>
   252 </fieldset></td>
   227 </tr>
   253 </tr>
   228 <tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
   254 <tr class="avatar-settings<?php echo $show_avatars_class; ?>">
   229 <th scope="row"><?php _e('Default Avatar'); ?></th>
   255 <th scope="row"><?php _e( 'Default Avatar' ); ?></th>
   230 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend>
   256 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Default Avatar' ); ?></span></legend>
   231 
   257 
   232 <?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 />
   258 <p>
       
   259 <?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 />
       
   260 </p>
   233 
   261 
   234 <?php
   262 <?php
   235 $avatar_defaults = array(
   263 $avatar_defaults = array(
   236 	'mystery' => __('Mystery Person'),
   264 	'mystery'          => __( 'Mystery Person' ),
   237 	'blank' => __('Blank'),
   265 	'blank'            => __( 'Blank' ),
   238 	'gravatar_default' => __('Gravatar Logo'),
   266 	'gravatar_default' => __( 'Gravatar Logo' ),
   239 	'identicon' => __('Identicon (Generated)'),
   267 	'identicon'        => __( 'Identicon (Generated)' ),
   240 	'wavatar' => __('Wavatar (Generated)'),
   268 	'wavatar'          => __( 'Wavatar (Generated)' ),
   241 	'monsterid' => __('MonsterID (Generated)'),
   269 	'monsterid'        => __( 'MonsterID (Generated)' ),
   242 	'retro' => __('Retro (Generated)')
   270 	'retro'            => __( 'Retro (Generated)' ),
   243 );
   271 );
   244 /**
   272 /**
   245  * Filters the default avatars.
   273  * Filters the default avatars.
   246  *
   274  *
   247  * Avatars are stored in key/value pairs, where the key is option value,
   275  * Avatars are stored in key/value pairs, where the key is option value,
   248  * and the name is the displayed avatar name.
   276  * and the name is the displayed avatar name.
   249  *
   277  *
   250  * @since 2.6.0
   278  * @since 2.6.0
   251  *
   279  *
   252  * @param array $avatar_defaults Array of default avatars.
   280  * @param string[] $avatar_defaults Associative array of default avatars.
   253  */
   281  */
   254 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
   282 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
   255 $default = get_option( 'avatar_default', 'mystery' );
   283 $default         = get_option( 'avatar_default', 'mystery' );
   256 $avatar_list = '';
   284 $avatar_list     = '';
   257 
   285 
   258 // Force avatars on to display these choices
   286 // Force avatars on to display these choices
   259 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
   287 add_filter( 'pre_option_show_avatars', '__return_true', 100 );
   260 
   288 
   261 foreach ( $avatar_defaults as $default_key => $default_name ) {
   289 foreach ( $avatar_defaults as $default_key => $default_name ) {
   262 	$selected = ($default == $default_key) ? 'checked="checked" ' : '';
   290 	$selected     = ( $default == $default_key ) ? 'checked="checked" ' : '';
   263 	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
   291 	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr( $default_key ) . "' {$selected}/> ";
   264 	$avatar_list .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) );
   292 	$avatar_list .= get_avatar( $user_email, 32, $default_key, '', array( 'force_default' => true ) );
   265 	$avatar_list .= ' ' . $default_name . '</label>';
   293 	$avatar_list .= ' ' . $default_name . '</label>';
   266 	$avatar_list .= '<br />';
   294 	$avatar_list .= '<br />';
   267 }
   295 }
   268 
   296 
   278 echo apply_filters( 'default_avatar_select', $avatar_list );
   306 echo apply_filters( 'default_avatar_select', $avatar_list );
   279 ?>
   307 ?>
   280 
   308 
   281 </fieldset></td>
   309 </fieldset></td>
   282 </tr>
   310 </tr>
   283 <?php do_settings_fields('discussion', 'avatars'); ?>
   311 <?php do_settings_fields( 'discussion', 'avatars' ); ?>
   284 </table>
   312 </table>
   285 
   313 
   286 <?php do_settings_sections('discussion'); ?>
   314 <?php do_settings_sections( 'discussion' ); ?>
   287 
   315 
   288 <?php submit_button(); ?>
   316 <?php submit_button(); ?>
   289 </form>
   317 </form>
   290 </div>
   318 </div>
   291 
   319