wp/wp-includes/class-walker-comment.php
changeset 21 48c4eec2b7e6
parent 19 3d72ae0968f4
equal deleted inserted replaced
20:7b1b88e27a20 21:48c4eec2b7e6
   148 				$this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output );
   148 				$this->display_element( $child, $children_elements, $max_depth, $depth, $args, $output );
   149 			}
   149 			}
   150 
   150 
   151 			unset( $children_elements[ $id ] );
   151 			unset( $children_elements[ $id ] );
   152 		}
   152 		}
   153 
       
   154 	}
   153 	}
   155 
   154 
   156 	/**
   155 	/**
   157 	 * Starts the element output.
   156 	 * Starts the element output.
   158 	 *
   157 	 *
   173 	 */
   172 	 */
   174 	public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
   173 	public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
   175 		// Restores the more descriptive, specific name for use within this method.
   174 		// Restores the more descriptive, specific name for use within this method.
   176 		$comment = $data_object;
   175 		$comment = $data_object;
   177 
   176 
   178 		$depth++;
   177 		++$depth;
   179 		$GLOBALS['comment_depth'] = $depth;
   178 		$GLOBALS['comment_depth'] = $depth;
   180 		$GLOBALS['comment']       = $comment;
   179 		$GLOBALS['comment']       = $comment;
   181 
   180 
   182 		if ( ! empty( $args['callback'] ) ) {
   181 		if ( ! empty( $args['callback'] ) ) {
   183 			ob_start();
   182 			ob_start();
   277 	 */
   276 	 */
   278 	public function filter_comment_text( $comment_text, $comment ) {
   277 	public function filter_comment_text( $comment_text, $comment ) {
   279 		$commenter          = wp_get_current_commenter();
   278 		$commenter          = wp_get_current_commenter();
   280 		$show_pending_links = ! empty( $commenter['comment_author'] );
   279 		$show_pending_links = ! empty( $commenter['comment_author'] );
   281 
   280 
   282 		if ( $comment && '0' == $comment->comment_approved && ! $show_pending_links ) {
   281 		if ( $comment && '0' === $comment->comment_approved && ! $show_pending_links ) {
   283 			$comment_text = wp_kses( $comment_text, array() );
   282 			$comment_text = wp_kses( $comment_text, array() );
   284 		}
   283 		}
   285 
   284 
   286 		return $comment_text;
   285 		return $comment_text;
   287 	}
   286 	}
   319 		<?php if ( 'div' !== $args['style'] ) : ?>
   318 		<?php if ( 'div' !== $args['style'] ) : ?>
   320 		<div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
   319 		<div id="div-comment-<?php comment_ID(); ?>" class="comment-body">
   321 		<?php endif; ?>
   320 		<?php endif; ?>
   322 		<div class="comment-author vcard">
   321 		<div class="comment-author vcard">
   323 			<?php
   322 			<?php
   324 			if ( 0 != $args['avatar_size'] ) {
   323 			if ( 0 !== $args['avatar_size'] ) {
   325 				echo get_avatar( $comment, $args['avatar_size'] );
   324 				echo get_avatar( $comment, $args['avatar_size'] );
   326 			}
   325 			}
   327 			?>
   326 			?>
   328 			<?php
   327 			<?php
   329 			$comment_author = get_comment_author_link( $comment );
   328 			$comment_author = get_comment_author_link( $comment );
   330 
   329 
   331 			if ( '0' == $comment->comment_approved && ! $show_pending_links ) {
   330 			if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
   332 				$comment_author = get_comment_author( $comment );
   331 				$comment_author = get_comment_author( $comment );
   333 			}
   332 			}
   334 
   333 
   335 			printf(
   334 			printf(
   336 				/* translators: %s: Comment author link. */
   335 				/* translators: %s: Comment author link. */
   337 				__( '%s <span class="says">says:</span>' ),
   336 				__( '%s <span class="says">says:</span>' ),
   338 				sprintf( '<cite class="fn">%s</cite>', $comment_author )
   337 				sprintf( '<cite class="fn">%s</cite>', $comment_author )
   339 			);
   338 			);
   340 			?>
   339 			?>
   341 		</div>
   340 		</div>
   342 		<?php if ( '0' == $comment->comment_approved ) : ?>
   341 		<?php if ( '0' === $comment->comment_approved ) : ?>
   343 		<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
   342 		<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
   344 		<br />
   343 		<br />
   345 		<?php endif; ?>
   344 		<?php endif; ?>
   346 
   345 
   347 		<div class="comment-meta commentmetadata">
   346 		<div class="comment-meta commentmetadata">
   422 		<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
   421 		<<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?>>
   423 			<article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
   422 			<article id="div-comment-<?php comment_ID(); ?>" class="comment-body">
   424 				<footer class="comment-meta">
   423 				<footer class="comment-meta">
   425 					<div class="comment-author vcard">
   424 					<div class="comment-author vcard">
   426 						<?php
   425 						<?php
   427 						if ( 0 != $args['avatar_size'] ) {
   426 						if ( 0 !== $args['avatar_size'] ) {
   428 							echo get_avatar( $comment, $args['avatar_size'] );
   427 							echo get_avatar( $comment, $args['avatar_size'] );
   429 						}
   428 						}
   430 						?>
   429 						?>
   431 						<?php
   430 						<?php
   432 						$comment_author = get_comment_author_link( $comment );
   431 						$comment_author = get_comment_author_link( $comment );
   433 
   432 
   434 						if ( '0' == $comment->comment_approved && ! $show_pending_links ) {
   433 						if ( '0' === $comment->comment_approved && ! $show_pending_links ) {
   435 							$comment_author = get_comment_author( $comment );
   434 							$comment_author = get_comment_author( $comment );
   436 						}
   435 						}
   437 
   436 
   438 						printf(
   437 						printf(
   439 							/* translators: %s: Comment author link. */
   438 							/* translators: %s: Comment author link. */
   459 
   458 
   460 						edit_comment_link( __( 'Edit' ), ' <span class="edit-link">', '</span>' );
   459 						edit_comment_link( __( 'Edit' ), ' <span class="edit-link">', '</span>' );
   461 						?>
   460 						?>
   462 					</div><!-- .comment-metadata -->
   461 					</div><!-- .comment-metadata -->
   463 
   462 
   464 					<?php if ( '0' == $comment->comment_approved ) : ?>
   463 					<?php if ( '0' === $comment->comment_approved ) : ?>
   465 					<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
   464 					<em class="comment-awaiting-moderation"><?php echo $moderation_note; ?></em>
   466 					<?php endif; ?>
   465 					<?php endif; ?>
   467 				</footer><!-- .comment-meta -->
   466 				</footer><!-- .comment-meta -->
   468 
   467 
   469 				<div class="comment-content">
   468 				<div class="comment-content">
   470 					<?php comment_text(); ?>
   469 					<?php comment_text(); ?>
   471 				</div><!-- .comment-content -->
   470 				</div><!-- .comment-content -->
   472 
   471 
   473 				<?php
   472 				<?php
   474 				if ( '1' == $comment->comment_approved || $show_pending_links ) {
   473 				if ( '1' === $comment->comment_approved || $show_pending_links ) {
   475 					comment_reply_link(
   474 					comment_reply_link(
   476 						array_merge(
   475 						array_merge(
   477 							$args,
   476 							$args,
   478 							array(
   477 							array(
   479 								'add_below' => 'div-comment',
   478 								'add_below' => 'div-comment',