Walker_Comment::start_el()
最后更新于:2021-11-26 06:26:20
Walker_Comment::start_el( string$output, GC_Comment$comment, int$depth, array$args=array(), int$id)Starts the element output.
参数
- $output
-
(string) (Required) Used to append additional content. Passed by reference.
- $comment
-
(GC_Comment) (Required) Comment data object.
- $depth
-
(int) (Optional) Depth of the current comment in reference to parents. Default 0.
- $args
-
(array) (Optional) An array of arguments.
Default value: array()
- $id
-
(int) (Optional) ID of the current comment. Default 0 (unused).
源文件
文件: gc-includes/class-walker-comment.php
public function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
$depth++;
$GLOBALS['comment_depth'] = $depth;
$GLOBALS['comment'] = $comment;
if ( ! empty( $args['callback'] ) ) {
ob_start();
call_user_func( $args['callback'], $comment, $args, $depth );
$output .= ob_get_clean();
return;
}
if ( 'comment' === $comment->comment_type ) {
add_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40, 2 );
}
if ( ( 'pingback' === $comment->comment_type || 'trackback' === $comment->comment_type ) && $args['short_ping'] ) {
ob_start();
$this->ping( $comment, $depth, $args );
$output .= ob_get_clean();
} elseif ( 'html5' === $args['format'] ) {
ob_start();
$this->html5_comment( $comment, $depth, $args );
$output .= ob_get_clean();
} else {
ob_start();
$this->comment( $comment, $depth, $args );
$output .= ob_get_clean();
}
if ( 'comment' === $comment->comment_type ) {
remove_filter( 'comment_text', array( $this, 'filter_comment_text' ), 40 );
}
}