Completed
Push — master ( 0e00e1...c8b83c )
by Fernando
06:22
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
	$counter = 0;
114
115
	foreach ( $customizer_colour_names as $key => $value ) {
116
		$lsx_controls['settings'][$key] = array(
117
			'default'       =>  $customizer_colour_choices['default']['colors'][$counter],
118
			'type'	        =>  'theme_mod',
119
			'transport'     =>  'postMessage',
120
			'sanitize_callback' => 'sanitize_hex_color',
121
		);
122
123
		$lsx_controls['fields'][$key] = array(
124
			'label'         =>  $value,
125
			'section'       =>  'colors',
126
			'control'       =>  'WP_Customize_Color_Control',
127
		);
128
129
		$counter++;
130
	}
131
132
	return $lsx_controls;
133
}
134
add_filter( 'lsx_customizer_controls', 'lsx_customizer_colour_scheme_controls' );
135
136
/**
137
 * Returns an array of the layout panel.
138
 *
139
 * @package 	lsx
140
 * @subpackage	functions
141
 * @category	customizer
142
 * @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...
143
 */
144
function lsx_customizer_layout_controls($lsx_controls) {
145
	$lsx_controls['settings']['lsx_header_layout']  = array(
146
			'default'       =>  'inline', //Default setting/value to save
147
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
148
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
149
	);
150
	$lsx_controls['fields']['lsx_header_layout'] = array(
151
			'label'         =>  __('Header','lsx'),
152
			'section'       =>  'lsx-layout',
153
			'control'   =>  'LSX_Customize_Header_Layout_Control',
154
			'choices'		=>	array('central','expanded','inline')
155
	);	
156
	$lsx_controls['sections']['lsx-layout'] = array(
157
			'title'       =>  esc_html__( 'Layout', 'lsx' ),
158
			'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' ),
159
			'priority' => 22
160
	);
161
	$lsx_controls['settings']['lsx_layout']  = array(
162
			'default'       =>  '2cr', //Default setting/value to save
163
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
164
			'transport'     =>  'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
165
	);
166
	$lsx_controls['settings']['lsx_header_fixed']  = array(
167
			'default'       =>  false, //Default setting/value to save
168
			'sanitize_callback' => 'lsx_sanitize_checkbox',
169
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
170
	);
171
	$lsx_controls['fields']['lsx_header_fixed'] = array(
172
			'label'         =>  __('Fixed Header','lsx'),
173
			'section'       =>  'lsx-layout',
174
			'type'       =>  'checkbox',
175
	);
176
	$lsx_controls['settings']['lsx_header_search']  = array(
177
			'default'       =>  false, //Default setting/value to save
178
			'sanitize_callback' => 'lsx_sanitize_checkbox',
179
			'transport'     =>  'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
180
	);
181
	$lsx_controls['fields']['lsx_header_search'] = array(
182
			'label'         =>  __('Search Box in Header','lsx'),
183
			'section'       =>  'lsx-layout',
184
			'type'       =>  'checkbox',
185
	);	
186
	$lsx_controls['fields']['lsx_layout'] = array(
187
			'label'         =>  __('Body','lsx'),
188
			'section'       =>  'lsx-layout',
189
			'control'   =>  'LSX_Customize_Layout_Control',
190
			'choices'		=>	array('1c','2cr','2cl')
191
	);	
192
	return $lsx_controls;
193
}
194
add_filter('lsx_customizer_controls','lsx_customizer_layout_controls');
195
196
/**
197
 * Returns an array of the font controls.
198
 *
199
 * @package 	lsx
200
 * @subpackage	functions
201
 * @category	customizer
202
 * @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...
203
 */
204
function lsx_customizer_font_controls($lsx_controls) {
205
	$lsx_controls['sections']['lsx-font'] = array(
206
			'title'       =>  __( 'Font', 'lsx' ),
207
			'description' => 'Change the fonts sitewide.',
208
			'priority' => 41
209
	);
210
	$lsx_controls['settings']['lsx_font']  = array(
211
			'default'       =>  'raleway_open_sans', //Default setting/value to save
212
			'type'        =>  'theme_mod', //Is this an 'option' or a 'theme_mod'?
213
			'transport'     =>  'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)?
214
	);
215
	/// add the control
216
	$lsx_controls['fields']['lsx_font'] = array(
217
			'label'         =>  '',
218
			'section'       =>  'lsx-font',
219
			'settings'      =>  'lsx_font',
220
			'control'   =>  'LSX_Customize_Font_Control',
221
			'choices'   =>  array(
222
					'raleway_open_sans' => array(
223
							'header'  => array(
224
									"title" => __( 'Raleway', 'lsx' ),
225
									"location" => "Raleway",
226
									"cssDeclaration" => "'Raleway', sans-serif",
227
									"cssClass" => "raleway",
228
							),
229
							'body'  => array(
230
									"title" => __( 'Open Sans', 'lsx' ),
231
									"location" => "Open+Sans",
232
									"cssDeclaration" => "'Open Sans', sans-serif",
233
									"cssClass" => "openSans"
234
							),
235
					),
236
					'noto_serif_noto_sans' => array(
237
							'header'  => array(
238
									"title" => __( 'Noto Serif', 'lsx' ),
239
									"location" => "Noto+Serif",
240
									"cssDeclaration" => "'Noto Serif', serif",
241
									"cssClass" => "notoSerif",
242
							),
243
							'body'  => array(
244
									"title" => __( 'Noto Sans', 'lsx' ),
245
									"location" => "Noto+Sans",
246
									"cssDeclaration" => "'Noto Sans', sans-serif",
247
									"cssClass" => "notoSans",
248
							),
249
					),
250
					'noto_sans_noto_sans' => array(
251
					'header'  => array(
252
					"title" => __( 'Noto Sans', 'lsx' ),
253
					"location" => "Noto+Sans",
254
					"cssDeclaration" => "'Noto Sans', sans-serif",
255
					"cssClass" => "notoSans",
256
					),
257
					'body'  => array(
258
					"title" => __( 'Noto Sans', 'lsx' ),
259
					"location" => "Noto+Sans",
260
					"cssDeclaration" => "'Noto Sans', sans-serif",
261
					"cssClass" => "notoSans",
262
					),
263
					),
264
					'alegreya_open_sans' => array(
265
					'header'  => array(
266
					"title" => __( 'Alegreya', 'lsx' ),
267
					"location" => "Alegreya",
268
					"cssDeclaration" => "'Alegreya', serif",
269
					"cssClass" => "alegreya",
270
					),
271
					'body'  => array(
272
					"title" => __( 'Open Sans', 'lsx' ),
273
					"location" => "Open+Sans",
274
					"cssDeclaration" => "'Open Sans', sans-serif",
275
					"cssClass" => "openSans"
276
							),
277
					),
278
			),
279
			'priority' => 2,
280
	);	
281
	return $lsx_controls;
282
}
283
add_filter('lsx_customizer_controls','lsx_customizer_font_controls');
284
285
/**
286
 * Returns an array of $controls for the customizer class to generate.
287
 *
288
 * @package 	lsx
289
 * @subpackage	functions
290
 * @category	customizer
291
 * @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...
292
 */
293
function lsx_get_customizer_controls(){
294
	$lsx_controls = array();
295
	$lsx_controls = apply_filters('lsx_customizer_controls', $lsx_controls);
296
	return $lsx_controls;
297
}
298
$lsx_customizer = new LSX_Theme_Customizer( lsx_get_customizer_controls() );
299
300
add_image_size( 'lsx-thumbnail-wide', 350, 230, true );
301
add_image_size( 'lsx-thumbnail-single', 750, 350, true );