lightspeeddevelopment /
lsx
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * LSX functions and definitions - Comment Walker. |
||
| 4 | * |
||
| 5 | * @package lsx |
||
| 6 | * @subpackage comment |
||
| 7 | */ |
||
| 8 | |||
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 10 | exit; |
||
| 11 | } |
||
| 12 | |||
| 13 | if ( ! class_exists( 'Walker_Comment' ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 14 | return; |
||
| 15 | } |
||
| 16 | |||
| 17 | if ( ! class_exists( 'LSX_Walker_Comment' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 18 | |||
| 19 | /** |
||
| 20 | * Use Bootstrap's media object for listing comments. |
||
| 21 | * |
||
| 22 | * @link http://getbootstrap.com/components/#media |
||
| 23 | * |
||
| 24 | * @package lsx |
||
| 25 | * @subpackage comment |
||
| 26 | */ |
||
| 27 | class LSX_Walker_Comment extends Walker_Comment { |
||
| 28 | |||
| 29 | function start_lvl( &$output, $depth = 0, $args = array() ) { |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
start_lvl.
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with Loading history...
|
|||
| 30 | $GLOBALS['comment_depth'] = $depth + 1; ?> |
||
| 31 | <ul <?php comment_class( 'media media-reply unstyled list-unstyled comment-' . get_comment_ID() ); ?>> |
||
| 32 | <?php |
||
| 33 | } |
||
|
0 ignored issues
–
show
|
|||
| 34 | |||
| 35 | function end_lvl( &$output, $depth = 0, $args = array() ) { |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
end_lvl.
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with Loading history...
|
|||
| 36 | $GLOBALS['comment_depth'] = $depth + 1; |
||
| 37 | echo '</ul>'; |
||
| 38 | } |
||
|
0 ignored issues
–
show
|
|||
| 39 | |||
| 40 | function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) { |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
start_el.
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with Loading history...
|
|||
| 41 | ++$depth; |
||
| 42 | $GLOBALS['comment_depth'] = $depth; |
||
| 43 | $GLOBALS['comment'] = $comment; |
||
| 44 | |||
| 45 | if ( ! empty( $args['callback'] ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 46 | call_user_func( $args['callback'], $comment, $args, $depth ); |
||
| 47 | return; |
||
| 48 | } |
||
| 49 | ?> |
||
| 50 | |||
| 51 | <li id="comment-<?php comment_ID(); ?>" <?php comment_class( 'media comment-' . get_comment_ID() ); ?>> |
||
| 52 | <?php get_template_part( 'comment' ); ?> |
||
| 53 | <?php |
||
| 54 | } |
||
|
0 ignored issues
–
show
|
|||
| 55 | |||
| 56 | function end_el( &$output, $comment, $depth = 0, $args = array() ) { |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
It is recommend to declare an explicit visibility for
end_el.
Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed. If you are not sure which visibility to choose, it is a good idea to start with
the most restrictive visibility, and then raise visibility as needed, i.e.
start with Loading history...
|
|||
| 57 | if ( ! empty( $args['end-callback'] ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 58 | call_user_func( $args['end-callback'], $comment, $args, $depth ); |
||
| 59 | return; |
||
| 60 | } |
||
| 61 | |||
| 62 | echo "</div></li>\n"; |
||
| 63 | } |
||
|
0 ignored issues
–
show
|
|||
| 64 | |||
| 65 | } |
||
| 66 | |||
| 67 | endif; |
||
| 68 |