lsx_get_avatar()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * LSX functions and definitions - Comment Walker.
4
 *
5
 * @package    lsx
6
 * @subpackage comment-walker
7
 */
8
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
if ( ! function_exists( 'lsx_get_avatar' ) ) :
14
15
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$avatar" missing
Loading history...
16
	 * Comment Form Field Filter.
17
	 *
18
	 * @package    lsx
19
	 * @subpackage comment-walker
20
	 */
21
	function lsx_get_avatar( $avatar ) {
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
	}
26
27
endif;
28
29
add_filter( 'get_avatar', 'lsx_get_avatar' );
30
31
add_action( 'admin_bar_menu', function() {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
32
	remove_filter( 'get_avatar', 'lsx_get_avatar' );
33
}, 0 );
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
Coding Style introduced by
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
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
Coding Style introduced by
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
36
	add_filter( 'get_avatar', 'lsx_get_avatar' );
37
} );
0 ignored issues
show
Coding Style introduced by
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' ) ) :
40
41
	/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$fields" missing
Loading history...
42
	 * Comment Form Field Filter.
43
	 *
44
	 * @package    lsx
45
	 * @subpackage comment-walker
46
	 */
47
	function lsx_comment_form_fields_filter( $fields ) {
48
		foreach ( $fields as &$field ) {
49
			if ( stristr( 'class=', $field ) ) {
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
	}
58
59
endif;
60
61
add_filter( 'comment_form_default_fields', 'lsx_comment_form_fields_filter' );
62