Changeset 35723
- Timestamp:
- 11/20/2015 06:55:31 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r35546 r35723 2038 2038 * @type string $must_log_in HTML element for a 'must be logged in to comment' message. 2039 2039 * @type string $logged_in_as HTML element for a 'logged in as [user]' message. 2040 * @type string $comment_notes_before HTML element for a message displayed before the comment form. 2040 * @type string $comment_notes_before HTML element for a message displayed before the comment fields 2041 * if the user is not logged in. 2041 2042 * Default 'Your email address will not be published.'. 2042 * @type string $comment_notes_after HTML element for a message displayed after the comment form.2043 * @type string $comment_notes_after HTML element for a message displayed after the textarea field. 2043 2044 * @type string $id_form The comment form element id attribute. Default 'commentform'. 2044 2045 * @type string $id_submit The comment submit element id attribute. Default 'submit'. … … 2215 2216 endif; 2216 2217 2218 // Prepare an array of all fields, including the textarea 2219 $comment_fields = array( 'comment' => $args['comment_field'] ) + (array) $args['fields']; 2220 2217 2221 /** 2218 * Filter the co ntent of the comment textarea field for display.2222 * Filter the comment form fields. 2219 2223 * 2220 * @since 3.0.02224 * @since 4.4.0 2221 2225 * 2222 * @param string $args_comment_field The content of the comment textarea field.2226 * @param array $comment_fields The comment fields. 2223 2227 */ 2224 echo apply_filters( 'comment_form_field_comment', $args['comment_field'] ); 2225 2226 echo $args['comment_notes_after']; 2227 2228 if ( ! is_user_logged_in() ) : 2229 /** 2230 * Fires before the comment fields in the comment form. 2231 * 2232 * @since 3.0.0 2233 */ 2234 do_action( 'comment_form_before_fields' ); 2235 foreach ( (array) $args['fields'] as $name => $field ) { 2228 $comment_fields = apply_filters( 'comment_form_fields', $comment_fields ); 2229 2230 // Get an array of field names, excluding the textarea 2231 $comment_field_keys = array_diff( array_keys( $comment_fields ), array( 'comment' ) ); 2232 2233 // Get the first and the last field name, excluding the textarea 2234 $first_field = reset( $comment_field_keys ); 2235 $last_field = end( $comment_field_keys ); 2236 2237 foreach ( $comment_fields as $name => $field ) { 2238 2239 if ( 'comment' === $name ) { 2240 2241 /** 2242 * Filter the content of the comment textarea field for display. 2243 * 2244 * @since 3.0.0 2245 * 2246 * @param string $args_comment_field The content of the comment textarea field. 2247 */ 2248 echo apply_filters( 'comment_form_field_comment', $field ); 2249 2250 echo $args['comment_notes_after']; 2251 2252 } elseif ( ! is_user_logged_in() ) { 2253 2254 if ( $first_field === $name ) { 2255 /** 2256 * Fires before the comment fields in the comment form, excluding the textarea. 2257 * 2258 * @since 3.0.0 2259 */ 2260 do_action( 'comment_form_before_fields' ); 2261 } 2262 2236 2263 /** 2237 2264 * Filter a comment form field for display. … … 2245 2272 */ 2246 2273 echo apply_filters( "comment_form_field_{$name}", $field ) . "\n"; 2274 2275 if ( $last_field === $name ) { 2276 /** 2277 * Fires after the comment fields in the comment form, excluding the textarea. 2278 * 2279 * @since 3.0.0 2280 */ 2281 do_action( 'comment_form_after_fields' ); 2282 } 2247 2283 } 2248 /** 2249 * Fires after the comment fields in the comment form. 2250 * 2251 * @since 3.0.0 2252 */ 2253 do_action( 'comment_form_after_fields' ); 2254 2255 endif; 2284 } 2256 2285 2257 2286 $submit_button = sprintf(
Note: See TracChangeset
for help on using the changeset viewer.