Passed
Push — lsx-wp6 ( 4c21d3 )
by
unknown
04:54
created

classes/class-lsx-customizer.php (2 issues)

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
				require_once( LSX_CUSTOMIZER_PATH . 'includes/woocommerce/woocommerce.php' );
49
				require_once( LSX_CUSTOMIZER_PATH . 'includes/woocommerce/addons.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
50
			}
51
		}
52
53
		/**
54
		 * Customizer Controls and Settings.
55
		 *
56
		 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
57
		 * @since 1.1.1
58
		 */
59
		public function wysiwyg_editor_control() {
60
			if ( class_exists( 'WP_Customize_Control' ) ) {
61
				require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-wysiwyg-control.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
62
			}
63
		}
64
65
		/**
66
		 * Sanitize checkbox.
67
		 *
68
		 * @since 1.0.0
69
		 */
70
		public function sanitize_checkbox( $input ) {
71
			return ( 1 === absint( $input ) ) ? 1 : 0;
72
		}
73
74
		/**
75
		 * Sanitize select.
76
		 *
77
		 * @since 1.1.1
78
		 */
79
		public function sanitize_select( $input ) {
80
			if ( is_string( $input ) || is_integer( $input ) || is_bool( $input ) ) {
81
				return $input;
82
			} else {
83
				return '';
84
			}
85
		}
86
87
		/**
88
		 * Sanitize textarea.
89
		 *
90
		 * @since 1.1.1
91
		 */
92
		public function sanitize_textarea( $input ) {
93
			return wp_kses_post( $input );
94
		}
95
96
		function custom_login_url() {
97
			return home_url();
98
		}
99
100
	}
101
102
	new LSX_Customizer();
103
104
}
105