1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | if ( ! class_exists( 'LSX_Customizer_Colour_Control' ) ) { |
||
0 ignored issues
–
show
|
|||
3 | |||
4 | /** |
||
5 | * LSX Customizer Colour Control Class |
||
6 | * |
||
7 | * @package LSX Customizer |
||
8 | * @author LightSpeed |
||
9 | * @license GPL3 |
||
10 | * @link |
||
11 | * @copyright 2016 LightSpeed |
||
12 | */ |
||
13 | class LSX_Customizer_Colour_Control extends WP_Customize_Control { |
||
14 | |||
15 | /** |
||
16 | * Enqueue control related scripts/styles. |
||
17 | * |
||
18 | * @since 1.0.0 |
||
19 | */ |
||
20 | public function enqueue() { |
||
0 ignored issues
–
show
|
|||
21 | wp_enqueue_script( 'lsx_customizer_colour_admin', LSX_CUSTOMIZER_URL . 'assets/js/lsx-customizer-colour-admin.min.js', array( 'customize-controls', 'iris', 'underscore', 'wp-util' ), LSX_CUSTOMIZER_VER, true ); |
||
22 | //wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme', $this->choices ); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
60% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
23 | |||
24 | global $customizer_colour_names; |
||
25 | $colors = array(); |
||
26 | foreach ( $customizer_colour_names as $key => $value ) { |
||
0 ignored issues
–
show
|
|||
27 | $colors[] = $key; |
||
28 | } |
||
0 ignored issues
–
show
|
|||
29 | wp_localize_script( 'lsx_customizer_colour_admin', 'color_scheme_keys', $colors ); |
||
30 | } |
||
0 ignored issues
–
show
|
|||
31 | |||
32 | /** |
||
33 | * Render the control's content. |
||
34 | * |
||
35 | * @since 1.0.0 |
||
36 | */ |
||
37 | public function render_content() { |
||
38 | if ( empty( $this->choices ) ) { |
||
0 ignored issues
–
show
|
|||
39 | return; |
||
40 | } |
||
41 | |||
42 | ?> |
||
43 | <label> |
||
44 | <?php if ( ! empty( $this->label ) ) { ?> |
||
0 ignored issues
–
show
|
|||
45 | <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
||
46 | <?php |
||
47 | } |
||
0 ignored issues
–
show
|
|||
48 | if ( ! empty( $this->description ) ) { |
||
0 ignored issues
–
show
|
|||
49 | ?> |
||
50 | <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
||
51 | <?php } ?> |
||
0 ignored issues
–
show
|
|||
52 | <select <?php $this->link(); ?>> |
||
53 | <?php |
||
54 | foreach ( $this->choices as $value => $label ) { |
||
0 ignored issues
–
show
|
|||
55 | echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . esc_html( $label['label'] ) . '</option>'; |
||
56 | } |
||
57 | ?> |
||
58 | </select> |
||
59 | </label> |
||
60 | <?php |
||
61 | } |
||
0 ignored issues
–
show
|
|||
62 | |||
63 | } |
||
64 | |||
65 | } |
||
66 | |||
67 |