1
|
|
|
<?php |
|
|
|
|
2
|
|
|
if ( ! class_exists( 'LSX_Customizer' ) ) { |
|
|
|
|
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* LSX Customizer Main Class |
6
|
|
|
* |
7
|
|
|
* @package LSX Customizer |
8
|
|
|
* @author LightSpeed |
9
|
|
|
* @license GPL3 |
10
|
|
|
* @link |
11
|
|
|
* @copyright 2016 LightSpeed |
12
|
|
|
*/ |
13
|
|
|
class LSX_Customizer { |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Plugin slug. |
17
|
|
|
* |
18
|
|
|
* @var string |
19
|
|
|
* @since 1.0.0 |
20
|
|
|
*/ |
21
|
|
|
public $plugin_slug = 'lsx-customizer'; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Constructor. |
25
|
|
|
* |
26
|
|
|
* @since 1.0.0 |
27
|
|
|
*/ |
28
|
|
|
public function __construct() { |
|
|
|
|
29
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php' ); |
|
|
|
|
30
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php' ); |
|
|
|
|
31
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php' ); |
|
|
|
|
32
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php' ); |
|
|
|
|
33
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php' ); |
|
|
|
|
34
|
|
|
|
35
|
|
|
add_action( 'plugins_loaded', array( $this, 'woocommerce' ) ); |
36
|
|
|
add_action( 'after_setup_theme', array( $this, 'wysiwyg_editor_control' ), 20 ); |
37
|
|
|
add_filter( 'login_headerurl', array( $this, 'custom_login_url' ) ); |
38
|
|
|
} |
|
|
|
|
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Check if WooCommerce is installed to load the related file. |
42
|
|
|
* |
43
|
|
|
* @since 1.1.1 |
44
|
|
|
*/ |
45
|
|
|
public function woocommerce() { |
46
|
|
|
if ( class_exists( 'WooCommerce' ) ) { |
|
|
|
|
47
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php' ); |
|
|
|
|
48
|
|
|
} |
49
|
|
|
} |
|
|
|
|
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Customizer Controls and Settings. |
53
|
|
|
* |
54
|
|
|
* @param WP_Customize_Manager $wp_customize Theme Customizer object. |
|
|
|
|
55
|
|
|
* @since 1.1.1 |
56
|
|
|
*/ |
57
|
|
|
public function wysiwyg_editor_control() { |
58
|
|
|
if ( class_exists( 'WP_Customize_Control' ) ) { |
|
|
|
|
59
|
|
|
require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php' ); |
|
|
|
|
60
|
|
|
} |
61
|
|
|
} |
|
|
|
|
62
|
|
|
|
63
|
|
|
/** |
|
|
|
|
64
|
|
|
* Sanitize checkbox. |
65
|
|
|
* |
66
|
|
|
* @since 1.0.0 |
67
|
|
|
*/ |
68
|
|
|
public function sanitize_checkbox( $input ) { |
69
|
|
|
return ( 1 === absint( $input ) ) ? 1 : 0; |
70
|
|
|
} |
|
|
|
|
71
|
|
|
|
72
|
|
|
/** |
|
|
|
|
73
|
|
|
* Sanitize select. |
74
|
|
|
* |
75
|
|
|
* @since 1.1.1 |
76
|
|
|
*/ |
77
|
|
|
public function sanitize_select( $input ) { |
78
|
|
|
if ( is_string( $input ) || is_integer( $input ) || is_bool( $input ) ) { |
|
|
|
|
79
|
|
|
return $input; |
80
|
|
|
} else { |
81
|
|
|
return ''; |
82
|
|
|
} |
83
|
|
|
} |
|
|
|
|
84
|
|
|
|
85
|
|
|
/** |
|
|
|
|
86
|
|
|
* Sanitize textarea. |
87
|
|
|
* |
88
|
|
|
* @since 1.1.1 |
89
|
|
|
*/ |
90
|
|
|
public function sanitize_textarea( $input ) { |
91
|
|
|
return wp_kses_post( $input ); |
92
|
|
|
} |
|
|
|
|
93
|
|
|
|
94
|
|
|
function custom_login_url() { |
|
|
|
|
95
|
|
|
return home_url(); |
96
|
|
|
} |
|
|
|
|
97
|
|
|
|
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
new LSX_Customizer(); |
101
|
|
|
|
|
|
|
|
102
|
|
|
} |
103
|
|
|
|