Issues (1724)

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

1
<?php
0 ignored issues
show
This file is missing a doc comment.
Loading history...
2
if ( ! class_exists( 'LSX_Customizer' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
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
Expected 2 blank lines before function; 1 found
Loading history...
29
			require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-admin.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
30
			require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-frontend.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
31
			require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-core.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
32
			require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-colour.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
33
			require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-login.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
47
				require_once( LSX_CUSTOMIZER_PATH . 'classes/class-lsx-customizer-woocommerce.php' );
0 ignored issues
show
"require_once" is a statement not a function; no parentheses are required
Loading history...
48
			}
49
		}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
50
51
		/**
52
		 * Customizer Controls and Settings.
53
		 *
54
		 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
0 ignored issues
show
Superfluous parameter comment
Loading history...
55
		 * @since 1.1.1
56
		 */
57
		public function wysiwyg_editor_control() {
58
			if ( class_exists( 'WP_Customize_Control' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
59
				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...
60
			}
61
		}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
62
63
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$input" missing
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
71
72
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$input" missing
Loading history...
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
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
79
				return $input;
80
			} else {
81
				return '';
82
			}
83
		}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
84
85
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$input" missing
Loading history...
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
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
93
94
		function custom_login_url() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Coding Style Documentation introduced by
Missing doc comment for function custom_login_url()
Loading history...
Comprehensibility Best Practice introduced by
It is recommend to declare an explicit visibility for custom_login_url.

Generally, we recommend to declare visibility for all methods in your source code. This has the advantage of clearly communication to other developers, and also yourself, how this method should be consumed.

If you are not sure which visibility to choose, it is a good idea to start with the most restrictive visibility, and then raise visibility as needed, i.e. start with private, and only raise it to protected if a sub-class needs to have access, or public if an external class needs access.

Loading history...
95
			return home_url();
96
		}
0 ignored issues
show
Expected 1 blank line before closing function brace; 0 found
Loading history...
Expected 2 blank lines after function; 1 found
Loading history...
97
98
	}
99
100
	new LSX_Customizer();
101
0 ignored issues
show
Blank line found at end of control structure
Loading history...
102
}
103