1 | <?php |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
2 | if ( ! class_exists( 'LSX_Customizer' ) ) { |
||
0 ignored issues
–
show
|
|||
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() { |
||
0 ignored issues
–
show
|
|||
29 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php' ); |
||
0 ignored issues
–
show
|
|||
30 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php' ); |
||
0 ignored issues
–
show
|
|||
31 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php' ); |
||
0 ignored issues
–
show
|
|||
32 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php' ); |
||
0 ignored issues
–
show
|
|||
33 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php' ); |
||
0 ignored issues
–
show
|
|||
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 | } |
||
0 ignored issues
–
show
|
|||
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' ) ) { |
||
0 ignored issues
–
show
|
|||
47 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php' ); |
||
0 ignored issues
–
show
|
|||
48 | } |
||
49 | } |
||
0 ignored issues
–
show
|
|||
50 | |||
51 | /** |
||
52 | * Customizer Controls and Settings. |
||
53 | * |
||
54 | * @param WP_Customize_Manager $wp_customize Theme Customizer object. |
||
0 ignored issues
–
show
|
|||
55 | * @since 1.1.1 |
||
56 | */ |
||
57 | public function wysiwyg_editor_control() { |
||
58 | if ( class_exists( 'WP_Customize_Control' ) ) { |
||
0 ignored issues
–
show
|
|||
59 | require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php' ); |
||
0 ignored issues
–
show
|
|||
60 | } |
||
61 | } |
||
0 ignored issues
–
show
|
|||
62 | |||
63 | /** |
||
0 ignored issues
–
show
|
|||
64 | * Sanitize checkbox. |
||
65 | * |
||
66 | * @since 1.0.0 |
||
67 | */ |
||
68 | public function sanitize_checkbox( $input ) { |
||
69 | return ( 1 === absint( $input ) ) ? 1 : 0; |
||
70 | } |
||
0 ignored issues
–
show
|
|||
71 | |||
72 | /** |
||
0 ignored issues
–
show
|
|||
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 ) ) { |
||
0 ignored issues
–
show
|
|||
79 | return $input; |
||
80 | } else { |
||
81 | return ''; |
||
82 | } |
||
83 | } |
||
0 ignored issues
–
show
|
|||
84 | |||
85 | /** |
||
0 ignored issues
–
show
|
|||
86 | * Sanitize textarea. |
||
87 | * |
||
88 | * @since 1.1.1 |
||
89 | */ |
||
90 | public function sanitize_textarea( $input ) { |
||
91 | return wp_kses_post( $input ); |
||
92 | } |
||
0 ignored issues
–
show
|
|||
93 | |||
94 | function custom_login_url() { |
||
0 ignored issues
–
show
|
|||
95 | return home_url(); |
||
96 | } |
||
0 ignored issues
–
show
|
|||
97 | |||
98 | } |
||
99 | |||
100 | new LSX_Customizer(); |
||
101 | |||
0 ignored issues
–
show
|
|||
102 | } |
||
103 |