Completed
Push — master ( 8df4c6...bcb67f )
by Fernando
03:23
created

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