Issues (461)

Branch: master

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

includes/classes/class-lsx-theme-customizer.php (21 issues)

1
<?php
2
/**
3
 * LSX functions and definitions - Customizer.
4
 *
5
 * @package    lsx
6
 * @subpackage customizer
7
 */
8
9
if ( ! defined( 'ABSPATH' ) ) {
10
	exit;
11
}
12
13
if ( ! class_exists( 'LSX_Theme_Customizer' ) ) :
14
15
	/**
16
	 * Customizer Configuration File
17
	 *
18
	 * @package    lsx
19
	 * @subpackage customizer
20
	 */
21
	class LSX_Theme_Customizer {
22
23
		public $post_types = array();
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
24
		private $controls  = array();
0 ignored issues
show
Coding Style Documentation introduced by
Missing member variable doc comment
Loading history...
25
26
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$controls" missing
Loading history...
27
		 * Initialize the plugin by setting localization and loading public scripts and styles.
28
		 */
29
		public function __construct( $controls ) {
30
			require get_template_directory() . '/includes/classes/class-lsx-customize-core-control.php';
31
			require get_template_directory() . '/includes/classes/class-lsx-customize-layout-control.php';
32
			require get_template_directory() . '/includes/classes/class-lsx-customize-header-layout-control.php';
33
			require get_template_directory() . '/includes/classes/class-lsx-customize-mobile-header-layout-control.php';
34
35
			$this->controls = $controls;
36
37
			add_action( 'customize_preview_init', array( $this, 'customize_preview_js' ), 20 );
38
			add_action( 'customize_register', array( $this, 'customizer' ), 11 );
39
		}
40
41
		/**
42
		 * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
43
		 */
44
		public function customize_preview_js() {
45
			wp_enqueue_script( 'lsx_customizer', get_template_directory_uri() . '/assets/js/admin/customizer.js', array( 'customize-preview' ), LSX_VERSION, true );
46
47
			wp_localize_script(
48
				'lsx_customizer',
49
				'lsx_customizer_params',
50
				array(
51
					'template_directory' => get_template_directory_uri(),
52
				)
53
			);
54
		}
55
56
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$wp_customize" missing
Loading history...
57
		 * Create customiser controls.
58
		 */
59
		public function customizer( $wp_customize ) {
60
			// Start panels.
61
			if ( ! empty( $this->controls['panels'] ) ) {
62
				foreach ( $this->controls['panels'] as $panel_slug => $args ) {
63
					$this->add_panel( $panel_slug, $args, $wp_customize );
64
				}
65
			}
66
67
			// Start sections.
68
			if ( ! empty( $this->controls['sections'] ) ) {
69
				foreach ( $this->controls['sections'] as $section_slug => $args ) {
70
					$this->add_section( $section_slug, $args, $wp_customize );
71
				}
72
			}
73
74
			// Start settings.
75
			if ( ! empty( $this->controls['settings'] ) ) {
76
				foreach ( $this->controls['settings'] as $settings_slug => $args ) {
77
					$this->add_setting( $settings_slug, $args, $wp_customize );
78
				}
79
			}
80
81
			// Start fields.
82
			if ( ! empty( $this->controls['fields'] ) ) {
83
				foreach ( $this->controls['fields'] as $field_slug => $args ) {
84
					$this->add_control( $field_slug, $args, $wp_customize );
85
				}
86
			}
87
88
			// Start selective refresh.
89
			if ( ! empty( $this->controls['selective_refresh'] ) ) {
90
				foreach ( $this->controls['selective_refresh'] as $field_slug => $args ) {
91
					$this->add_selective_refresh( $field_slug, $args, $wp_customize );
92
				}
93
			}
94
95
			$wp_customize->get_setting( 'blogname' )->transport         = 'postMessage';
96
			$wp_customize->get_setting( 'blogdescription' )->transport  = 'postMessage';
97
			$wp_customize->get_setting( 'background_color' )->transport = 'postMessage';
98
99
			$wp_customize->selective_refresh->add_partial(
100
				'blogname',
101
				array(
102
					'selector'        => 'h1.site-title a',
103
					'render_callback' => function() {
104
						bloginfo( 'name' );
105
					},
106
				)
107
			);
108
109
			$wp_customize->selective_refresh->add_partial(
110
				'blogdescription',
111
				array(
112
					'selector'        => '.site-description',
113
					'render_callback' => function() {
114
						bloginfo( 'description' );
115
					},
116
				)
117
			);
118
		}
119
120
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$slug" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$args" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$wp_customize" missing
Loading history...
121
		 * Create a panel.
122
		 */
123
		private function add_panel( $slug, $args, $wp_customize ) {
124
			$default_args = array(
125
				'title'       => null,
126
				'description' => null,
127
			);
128
129
			$wp_customize->add_panel(
130
				$slug,
131
				array_merge( $default_args, $args )
132
			);
133
		}
134
135
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$slug" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$args" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$wp_customize" missing
Loading history...
136
		 * Create a section.
137
		 */
138
		private function add_section( $slug, $args, $wp_customize ) {
139
			$default_args = array(
140
				'capability'  => 'edit_theme_options',
141
				'description' => null,
142
			);
143
144
			$wp_customize->add_section( $slug, array_merge( $default_args, $args ) );
145
		}
146
147
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$slug" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$args" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$wp_customize" missing
Loading history...
148
		 * Create a setting.
149
		 */
150
		private function add_setting( $slug, $args, $wp_customize ) {
151
			$wp_customize->add_setting(
152
				$slug,
153
				array_merge(
154
					array(
155
						'default'           => null,
156
						'type'              => 'theme_mod',
157
						'capability'        => 'edit_theme_options',
158
						'transport'         => 'postMessage',
159
						'sanitize_callback' => 'lsx_sanitize_choices',
160
					),
161
					$args
162
				)
163
			);
164
		}
165
166
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$slug" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$args" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$wp_customize" missing
Loading history...
167
		 * Create a control.
168
		 */
169
		private function add_control( $slug, $args, $wp_customize ) {
170
			$default_args = array();
171
172
			if ( isset( $args['control'] ) && class_exists( $args['control'] ) ) {
173
				$control_class = $args['control'];
174
				unset( $args['control'] );
175
176
				$control = new $control_class( $wp_customize, $slug, array_merge( $default_args, $args ) );
177
				$wp_customize->add_control( $control );
178
			} else {
179
				if ( isset( $args['control'] ) ) {
180
					unset( $args['control'] );
181
				}
182
183
				$wp_customize->add_control(
184
					$slug,
185
					array_merge( $default_args, $args )
186
				);
187
			}
188
		}
189
190
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$slug" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$args" missing
Loading history...
Coding Style Documentation introduced by
Doc comment for parameter "$wp_customize" missing
Loading history...
191
		 * Create a selective refresh.
192
		 */
193
		private function add_selective_refresh( $slug, $args, $wp_customize ) {
194
			$default_args = array(
195
				'selector'        => null,
196
				'render_callback' => null,
197
			);
198
199
			$wp_customize->selective_refresh->add_partial(
200
				$slug,
201
				array_merge( $default_args, $args )
202
			);
203
		}
204
205
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$id" missing
Loading history...
206
		 * Returns a registered field.
207
		 */
208
		public function get_control( $id ) {
209
			$field = $this->controls['fields'][ $id ];
210
			return $field;
211
		}
212
213
		/**
0 ignored issues
show
Coding Style Documentation introduced by
Doc comment for parameter "$id" missing
Loading history...
214
		 * Returns a registered setting.
215
		 */
216
		public function get_setting( $id ) {
217
			$setting = $this->controls['settings'][ $id ];
218
			return $setting;
219
		}
220
221
	}
222
223
endif;
224