Completed
Push — master ( 55f18a...0fb8d7 )
by Fernando
05:05 queued 02:16
created

functions.php (6 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * lsx functions and definitions
4
 *
5
 * @package lsx
6
 */
7
if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly
8
9
define('LSX_VERSION', '1.8.0');
10
11
require get_template_directory() . '/inc/config.php';
12
//require get_template_directory() . '/inc/example/customizer-colour-extended.php';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% 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.

Loading history...
13
require get_template_directory() . '/inc/customizer-colour-options.php';
14
require get_template_directory() . '/inc/customizer.php';
15
require get_template_directory() . '/inc/sanitize.php';
16
require get_template_directory() . '/inc/layout.php';
17
require get_template_directory() . '/inc/hooks.php';
18
require get_template_directory() . '/inc/widgets.php';
19
require get_template_directory() . '/inc/scripts.php';
20
require get_template_directory() . '/inc/nav.php';
21
require get_template_directory() . '/inc/comment-walker.php';
22
require get_template_directory() . '/inc/jetpack.php';
23
require get_template_directory() . '/inc/lazyload.php';
24
if(class_exists('BuddyPress')){
25
	require get_template_directory() . '/inc/buddypress.php';
26
}
27
if(class_exists('WooCommerce')){
28
	require get_template_directory() . '/inc/woocommerce.php';
29
}
30
if(class_exists('WP_Job_Manager')){
31
	require get_template_directory() . '/inc/wp-job-manager.php';
32
}
33
if(class_exists('Tribe__Events__Main')){
34
	require get_template_directory() . '/inc/the-events-calendar.php';
35
}
36
require get_template_directory() . '/inc/template-tags.php';
37
require get_template_directory() . '/inc/extras.php';
38
require get_template_directory() . '/inc/wp-bootstrap-navwalker.php';
39
if(class_exists('Sensei_WC')){
40
	require get_template_directory() . '/inc/sensei.php';
41
}
42
43
/**
44
 * Returns an array of the core panel.
45
 *
46
 * @package 	lsx
47
 * @subpackage	functions
48
 * @category	customizer
49
 * @return		$lsx_controls array()
0 ignored issues
show
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...
50
 */
51
function lsx_customizer_core_controls( $lsx_controls ) {
52
	$lsx_controls['sections']['lsx-core'] = array(
53
		'title'       =>  esc_html__( 'Core Settings', 'lsx' ),
54
		'description' => __( 'Change the core settings.', 'lsx' ),
55
		'priority'    => 21
56
	);
57
58
	$lsx_controls['settings']['lsx_lazyload_status'] = array(
59
		'default'           =>  '1',
60
		'sanitize_callback' => 'lsx_sanitize_checkbox',
61
		'transport'         =>  'postMessage',
62
	);
63
64
	$lsx_controls['fields']['lsx_lazyload_status'] = array(
65
		'label'         =>  __( 'Lazy Loading Images', 'lsx' ),
66
		'section'       =>  'lsx-core',
67
		'type'          =>  'checkbox',
68
	);
69
70
	$lsx_controls['settings']['lsx_preloader_content_status'] = array(
71
		'default'           =>  '1',
72
		'sanitize_callback' => 'lsx_sanitize_checkbox',
73
		'transport'         =>  'postMessage',
74
	);
75
76
	$lsx_controls['fields']['lsx_preloader_content_status'] = array(
77
		'label'         =>  __( 'Preloader Content', 'lsx' ),
78
		'section'       =>  'lsx-core',
79
		'type'          =>  'checkbox',
80
	);
81
82
	return $lsx_controls;
83
}
84
add_filter( 'lsx_customizer_controls', 'lsx_customizer_core_controls' );
85
86
/**
87
 * Returns an array of the colour scheme picker.
88
 *
89
 * @package 	lsx
90
 * @subpackage	functions
91
 * @category	customizer
92
 * @return		$lsx_controls array()
0 ignored issues
show
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...
93
 */
94
function lsx_customizer_colour_scheme_controls( $lsx_controls ) {
95
	global $customizer_colour_names;
96
	global $customizer_colour_choices;
97
	
98
	$lsx_controls['settings']['color_scheme'] = array(
99
		'default'       =>  'default',
100
		'type'	        =>  'theme_mod',
101
		'transport'     =>  'postMessage',
102
	);
103
104
	$lsx_controls['fields']['color_scheme'] = array(
105
		'label'         =>  esc_html__( 'Base Color Scheme', 'lsx' ),
106
		'section'       =>  'colors',
107
		'type'          =>  'select',
108
		'priority'      =>  1,
109
		'control'       =>  'LSX_Customize_Colour_Control',
110
		'choices'       =>  $customizer_colour_choices
111
	);
112
113
	foreach ( $customizer_colour_names as $key => $value ) {
114
		$sanitize_callback = 'sanitize_hex_color';
115
116
		if ( 'background_color' === $key ) {
117
			$sanitize_callback = 'sanitize_hex_color_no_hash';
118
		}
119
120
		$lsx_controls['settings'][$key] = array(
121
			'default'           => $customizer_colour_choices['default']['colors'][$key],
122
			'type'	            => 'theme_mod',
123
			'transport'         => 'postMessage',
124
			'sanitize_callback' => $sanitize_callback,
125
		);
126
127
		$lsx_controls['fields'][$key] = array(
128
			'label'         =>  $value,
129
			'section'       =>  'colors',
130
			'control'       =>  'WP_Customize_Color_Control',
131
		);
132
	}
133
134
	return $lsx_controls;
135
}
136
add_filter( 'lsx_customizer_controls', 'lsx_customizer_colour_scheme_controls' );
137
138
/**
139
 * Returns an array of the layout panel.
140
 *
141
 * @package 	lsx
142
 * @subpackage	functions
143
 * @category	customizer
144
 * @return		$lsx_controls array()
0 ignored issues
show
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...
145
 */
146
function lsx_customizer_layout_controls($lsx_controls) {
147
	$lsx_controls['settings']['lsx_header_layout']  = array(
148
			'default'       =>  'inline', //Default setting/value to save
149
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
150
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
151
	);
152
	$lsx_controls['fields']['lsx_header_layout'] = array(
153
			'label'         =>  __('Header','lsx'),
154
			'section'       =>  'lsx-layout',
155
			'control'   =>  'LSX_Customize_Header_Layout_Control',
156
			'choices'		=>	array('central','expanded','inline')
157
	);	
158
	$lsx_controls['sections']['lsx-layout'] = array(
159
			'title'       =>  esc_html__( 'Layout', 'lsx' ),
160
			'description' => __( 'Change the layout sitewide. If your homepage is set to use a page with a template, the following will not apply to it.', 'lsx' ),
161
			'priority' => 22
162
	);
163
	$lsx_controls['settings']['lsx_layout']  = array(
164
			'default'       =>  '2cr', //Default setting/value to save
165
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
166
			'transport'     =>  'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
167
	);
168
	$lsx_controls['settings']['lsx_header_fixed']  = array(
169
			'default'       =>  false, //Default setting/value to save
170
			'sanitize_callback' => 'lsx_sanitize_checkbox',
171
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
172
	);
173
	$lsx_controls['fields']['lsx_header_fixed'] = array(
174
			'label'         =>  __('Fixed Header','lsx'),
175
			'section'       =>  'lsx-layout',
176
			'type'       =>  'checkbox',
177
	);
178
	$lsx_controls['settings']['lsx_header_search']  = array(
179
			'default'       =>  false, //Default setting/value to save
180
			'sanitize_callback' => 'lsx_sanitize_checkbox',
181
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
182
	);
183
	$lsx_controls['fields']['lsx_header_search'] = array(
184
			'label'         =>  __('Search Box in Header','lsx'),
185
			'section'       =>  'lsx-layout',
186
			'type'       =>  'checkbox',
187
	);	
188
	$lsx_controls['fields']['lsx_layout'] = array(
189
			'label'         =>  __('Body','lsx'),
190
			'section'       =>  'lsx-layout',
191
			'control'   =>  'LSX_Customize_Layout_Control',
192
			'choices'		=>	array('1c','2cr','2cl')
193
	);	
194
	return $lsx_controls;
195
}
196
add_filter('lsx_customizer_controls','lsx_customizer_layout_controls');
197
198
/**
199
 * Returns an array of the font controls.
200
 *
201
 * @package 	lsx
202
 * @subpackage	functions
203
 * @category	customizer
204
 * @return		$lsx_controls array()
0 ignored issues
show
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...
205
 */
206
function lsx_customizer_font_controls($lsx_controls) {
207
	$lsx_controls['sections']['lsx-font'] = array(
208
			'title'       =>  __( 'Font', 'lsx' ),
209
			'description' => 'Change the fonts sitewide.',
210
			'priority' => 41
211
	);
212
	$lsx_controls['settings']['lsx_font']  = array(
213
			'default'       =>  'raleway_open_sans', //Default setting/value to save
214
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
215
			'transport'     =>  'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
216
	);
217
	/// add the control
218
	$lsx_controls['fields']['lsx_font'] = array(
219
			'label'         =>  '',
220
			'section'       =>  'lsx-font',
221
			'settings'      =>  'lsx_font',
222
			'control'   =>  'LSX_Customize_Font_Control',
223
			'choices'   =>  array(
224
					'raleway_open_sans' => array(
225
							'header'  => array(
226
									"title" => __( 'Raleway', 'lsx' ),
227
									"location" => "Raleway",
228
									"cssDeclaration" => "'Raleway', sans-serif",
229
									"cssClass" => "raleway",
230
							),
231
							'body'  => array(
232
									"title" => __( 'Open Sans', 'lsx' ),
233
									"location" => "Open+Sans",
234
									"cssDeclaration" => "'Open Sans', sans-serif",
235
									"cssClass" => "openSans"
236
							),
237
					),
238
					'noto_serif_noto_sans' => array(
239
							'header'  => array(
240
									"title" => __( 'Noto Serif', 'lsx' ),
241
									"location" => "Noto+Serif",
242
									"cssDeclaration" => "'Noto Serif', serif",
243
									"cssClass" => "notoSerif",
244
							),
245
							'body'  => array(
246
									"title" => __( 'Noto Sans', 'lsx' ),
247
									"location" => "Noto+Sans",
248
									"cssDeclaration" => "'Noto Sans', sans-serif",
249
									"cssClass" => "notoSans",
250
							),
251
					),
252
					'noto_sans_noto_sans' => array(
253
					'header'  => array(
254
					"title" => __( 'Noto Sans', 'lsx' ),
255
					"location" => "Noto+Sans",
256
					"cssDeclaration" => "'Noto Sans', sans-serif",
257
					"cssClass" => "notoSans",
258
					),
259
					'body'  => array(
260
					"title" => __( 'Noto Sans', 'lsx' ),
261
					"location" => "Noto+Sans",
262
					"cssDeclaration" => "'Noto Sans', sans-serif",
263
					"cssClass" => "notoSans",
264
					),
265
					),
266
					'alegreya_open_sans' => array(
267
					'header'  => array(
268
					"title" => __( 'Alegreya', 'lsx' ),
269
					"location" => "Alegreya",
270
					"cssDeclaration" => "'Alegreya', serif",
271
					"cssClass" => "alegreya",
272
					),
273
					'body'  => array(
274
					"title" => __( 'Open Sans', 'lsx' ),
275
					"location" => "Open+Sans",
276
					"cssDeclaration" => "'Open Sans', sans-serif",
277
					"cssClass" => "openSans"
278
							),
279
					),
280
			),
281
			'priority' => 2,
282
	);	
283
	return $lsx_controls;
284
}
285
add_filter('lsx_customizer_controls','lsx_customizer_font_controls');
286
287
/**
288
 * Returns an array of $controls for the customizer class to generate.
289
 *
290
 * @package 	lsx
291
 * @subpackage	functions
292
 * @category	customizer
293
 * @return		$lsx_controls array()
0 ignored issues
show
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...
294
 */
295
function lsx_get_customizer_controls(){
296
	$lsx_controls = array();
297
	$lsx_controls = apply_filters('lsx_customizer_controls', $lsx_controls);
298
	return $lsx_controls;
299
}
300
$lsx_customizer = new LSX_Theme_Customizer( lsx_get_customizer_controls() );
301
302
add_image_size( 'lsx-thumbnail-wide', 350, 230, true );
303
add_image_size( 'lsx-thumbnail-single', 750, 350, true );