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