lightspeeddevelopment /
lsx
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * LSX functions and definitions - Comment Walker. |
||
| 4 | * |
||
| 5 | * @package lsx |
||
| 6 | * @subpackage comment-walker |
||
| 7 | */ |
||
| 8 | |||
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 10 | exit; |
||
| 11 | } |
||
| 12 | |||
| 13 | if ( ! function_exists( 'lsx_get_avatar' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | /** |
||
|
0 ignored issues
–
show
|
|||
| 16 | * Comment Form Field Filter. |
||
| 17 | * |
||
| 18 | * @package lsx |
||
| 19 | * @subpackage comment-walker |
||
| 20 | */ |
||
| 21 | function lsx_get_avatar( $avatar ) { |
||
|
0 ignored issues
–
show
|
|||
| 22 | $avatar = str_replace( "class='avatar", "class='avatar pull-left media-object ", $avatar ); |
||
| 23 | $avatar = str_replace( 'class="avatar', 'class="avatar pull-left media-object ', $avatar ); |
||
| 24 | return $avatar; |
||
| 25 | } |
||
|
0 ignored issues
–
show
|
|||
| 26 | |||
| 27 | endif; |
||
| 28 | |||
| 29 | add_filter( 'get_avatar', 'lsx_get_avatar' ); |
||
| 30 | |||
| 31 | add_action( 'admin_bar_menu', function() { |
||
|
0 ignored issues
–
show
|
|||
| 32 | remove_filter( 'get_avatar', 'lsx_get_avatar' ); |
||
| 33 | }, 0 ); |
||
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
| 34 | |||
| 35 | add_action( 'wp_after_admin_bar_render', function() { |
||
|
0 ignored issues
–
show
|
|||
| 36 | add_filter( 'get_avatar', 'lsx_get_avatar' ); |
||
| 37 | } ); |
||
|
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
Loading history...
|
|||
| 38 | |||
| 39 | if ( ! function_exists( 'lsx_comment_form_fields_filter' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 40 | |||
| 41 | /** |
||
|
0 ignored issues
–
show
|
|||
| 42 | * Comment Form Field Filter. |
||
| 43 | * |
||
| 44 | * @package lsx |
||
| 45 | * @subpackage comment-walker |
||
| 46 | */ |
||
| 47 | function lsx_comment_form_fields_filter( $fields ) { |
||
|
0 ignored issues
–
show
|
|||
| 48 | foreach ( $fields as &$field ) { |
||
|
0 ignored issues
–
show
|
|||
| 49 | if ( stristr( 'class=', $field ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 50 | $field = str_replace( 'class="', 'class="form-control ', $field ); |
||
| 51 | } else { |
||
| 52 | $field = str_replace( '<input', '<input class="form-control" ', $field ); |
||
| 53 | } |
||
| 54 | } |
||
| 55 | |||
| 56 | return $fields; |
||
| 57 | } |
||
|
0 ignored issues
–
show
|
|||
| 58 | |||
| 59 | endif; |
||
| 60 | |||
| 61 | add_filter( 'comment_form_default_fields', 'lsx_comment_form_fields_filter' ); |
||
| 62 |