Passed
Push — master ( 2e0b8e...1bd345 )
by Warwick
03:19
created

customizer.php ➔ lsx_customizer_font_controls()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 31
rs 9.424
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A customizer.php ➔ lsx_get_customizer_controls() 0 5 1
1
<?php
2
/**
3
 * LSX functions and definitions - Customizer.
4
 *
5
 * @package    lsx
6
 * @subpackage customizer
7
 */
8
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
if ( ! function_exists( 'lsx_customizer_core_controls' ) ) :
14
15
	/**
16
	 * Returns an array of the core panel.
17
	 *
18
	 * @package    lsx
19
	 * @subpackage customizer
20
	 *
21
	 * @return $lsx_controls array()
0 ignored issues
show
Documentation introduced by
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
22
	 */
23
	function lsx_customizer_core_controls( $lsx_controls ) {
24
		$lsx_controls['sections']['lsx-core'] = array(
25
			'title'       => esc_html__( 'Core Settings', 'lsx' ),
26
			'description' => esc_html__( 'Change the core settings.', 'lsx' ),
27
			'priority'    => 21,
28
		);
29
30
		$lsx_controls['settings']['lsx_lazyload_status'] = array(
31
			'default'           => '1',
32
			'sanitize_callback' => 'lsx_sanitize_checkbox',
33
			'transport'         => 'postMessage',
34
		);
35
36
		$lsx_controls['fields']['lsx_lazyload_status'] = array(
37
			'label'   => esc_html__( 'Lazy Loading Images', 'lsx' ),
38
			'section' => 'lsx-core',
39
			'type'    => 'checkbox',
40
		);
41
42
		$lsx_controls['settings']['lsx_preloader_content_status'] = array(
43
			'default'           => '1',
44
			'sanitize_callback' => 'lsx_sanitize_checkbox',
45
			'transport'         => 'postMessage',
46
		);
47
48
		$lsx_controls['fields']['lsx_preloader_content_status'] = array(
49
			'label'   => esc_html__( 'Preloader Content', 'lsx' ),
50
			'section' => 'lsx-core',
51
			'type'    => 'checkbox',
52
		);
53
54
		$lsx_controls['settings']['lsx_disable_fonts'] = array(
55
			'default'           => 0,
56
			'sanitize_callback' => 'lsx_sanitize_checkbox',
57
			'transport'         => 'postMessage',
58
		);
59
60
		$lsx_controls['fields']['lsx_disable_fonts'] = array(
61
			'label'   => esc_html__( 'Disable Fonts', 'lsx' ),
62
			'section' => 'lsx-core',
63
			'type'    => 'checkbox',
64
		);
65
66
		return $lsx_controls;
67
	}
68
69
endif;
70
71
add_filter( 'lsx_customizer_controls', 'lsx_customizer_core_controls' );
72
73
if ( ! function_exists( 'lsx_customizer_layout_controls' ) ) :
74
75
	/**
76
	 * Returns an array of the layout panel.
77
	 *
78
	 * @package    lsx
79
	 * @subpackage customizer
80
	 *
81
	 * @return $lsx_controls array()
0 ignored issues
show
Documentation introduced by
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
82
	 */
83
	function lsx_customizer_layout_controls( $lsx_controls ) {
84
		$lsx_controls['sections']['lsx-layout'] = array(
85
			'title'       => esc_html__( 'Layout', 'lsx' ),
86
			'description' => esc_html__( 'Change the layout sitewide. If your homepage is set to use a page with a template, the following will not apply to it.', 'lsx' ),
87
			'priority'    => 22,
88
		);
89
90
		$lsx_controls['settings']['lsx_header_layout'] = array(
91
			'default'   => 'inline',
92
			'type'      => 'theme_mod',
93
			'transport' => 'postMessage',
94
		);
95
96
		$lsx_controls['fields']['lsx_header_layout'] = array(
97
			'label'   => esc_html__( 'Header', 'lsx' ),
98
			'section' => 'lsx-layout',
99
			'control' => 'LSX_Customize_Header_Layout_Control',
100
			'choices' => array(
101
				'central',
102
				'expanded',
103
				'inline',
104
			),
105
		);
106
107
		$lsx_controls['settings']['lsx_layout'] = array(
108
			'default'   => '1c',
109
			'type'      => 'theme_mod',
110
			'transport' => 'refresh',
111
		);
112
113
		$lsx_controls['fields']['lsx_layout'] = array(
114
			'label'   => esc_html__( 'Body', 'lsx' ),
115
			'section' => 'lsx-layout',
116
			'control' => 'LSX_Customize_Layout_Control',
117
			'choices' => array(
118
				'1c',
119
				'2cr',
120
				'2cl',
121
			),
122
		);
123
124
		$lsx_controls['settings']['lsx_header_fixed'] = array(
125
			'default'           => false,
126
			'sanitize_callback' => 'lsx_sanitize_checkbox',
127
			'transport'         => 'postMessage',
128
		);
129
130
		$lsx_controls['fields']['lsx_header_fixed'] = array(
131
			'label'   => esc_html__( 'Fixed Header', 'lsx' ),
132
			'section' => 'lsx-layout',
133
			'type'    => 'checkbox',
134
		);
135
136
		$lsx_controls['settings']['lsx_header_search'] = array(
137
			'default'           => false,
138
			'sanitize_callback' => 'lsx_sanitize_checkbox',
139
			'transport'         => 'postMessage',
140
		);
141
142
		$lsx_controls['fields']['lsx_header_search'] = array(
143
			'label'   => esc_html__( 'Search Box in Header', 'lsx' ),
144
			'section' => 'lsx-layout',
145
			'type'    => 'checkbox',
146
		);
147
148
		$lsx_controls['selective_refresh']['lsx_header_search'] = array(
149
			'selector'        => '#lsx-header-search-css',
150
			'render_callback' => function() {
151
				$search_form = get_theme_mod( 'lsx_header_search' );
152
153
				if ( false !== $search_form ) {
154
					echo 'body #searchform { display: block; }';
155
				} else {
156
					echo 'body #searchform { display: none; }';
157
				}
158
			},
159
		);
160
161
		return $lsx_controls;
162
	}
163
164
endif;
165
166
add_filter( 'lsx_customizer_controls', 'lsx_customizer_layout_controls' );
167
168
if ( ! function_exists( 'lsx_get_customizer_controls' ) ) :
169
170
	/**
171
	 * Returns an array of $controls for the customizer class to generate.
172
	 *
173
	 * @package    lsx
174
	 * @subpackage customizer
175
	 *
176
	 * @return $lsx_controls array()
0 ignored issues
show
Documentation introduced by
The doc-type $lsx_controls could not be parsed: Unknown type name "$lsx_controls" at position 0. (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
177
	 */
178
	function lsx_get_customizer_controls() {
179
		$lsx_controls = array();
180
		$lsx_controls = apply_filters( 'lsx_customizer_controls', $lsx_controls );
181
		return $lsx_controls;
182
	}
183
184
endif;
185
186
$lsx_customizer = new LSX_Theme_Customizer( lsx_get_customizer_controls() );
187