Issues (70)

Security Analysis    no request data  

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

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

inc/woocommerce.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * WooCommerce Compatibility File
4
 *
5
 * @link https://woocommerce.com/
6
 *
7
 * @package bitsy
8
 */
9
10
/**
11
 * WooCommerce setup function.
12
 *
13
 * @link https://docs.woocommerce.com/document/third-party-custom-theme-compatibility/
14
 * @link https://github.com/woocommerce/woocommerce/wiki/Enabling-product-gallery-features-(zoom,-swipe,-lightbox)-in-3.0.0
15
 *
16
 * @return void
17
 */
18
function bitsy_woocommerce_setup() {
19
	add_theme_support( 'woocommerce' );
20
	add_theme_support( 'wc-product-gallery-zoom' );
21
	add_theme_support( 'wc-product-gallery-lightbox' );
22
	add_theme_support( 'wc-product-gallery-slider' );
23
}
24
add_action( 'after_setup_theme', 'bitsy_woocommerce_setup' );
25
26
/**
27
 * WooCommerce specific scripts & stylesheets.
28
 *
29
 * @return void
30
 */
31
function bitsy_woocommerce_scripts() {
32
	wp_enqueue_style( 'bitsy-woocommerce-style', get_template_directory_uri() . '/woocommerce.css' );
33
34
	$font_path   = WC()->plugin_url() . '/assets/fonts/';
35
	$inline_font = '@font-face {
36
			font-family: "star";
37
			src: url("' . $font_path . 'star.eot");
38
			src: url("' . $font_path . 'star.eot?#iefix") format("embedded-opentype"),
39
				url("' . $font_path . 'star.woff") format("woff"),
40
				url("' . $font_path . 'star.ttf") format("truetype"),
41
				url("' . $font_path . 'star.svg#star") format("svg");
42
			font-weight: normal;
43
			font-style: normal;
44
		}';
45
46
	wp_add_inline_style( 'bitsy-woocommerce-style', $inline_font );
47
}
48
add_action( 'wp_enqueue_scripts', 'bitsy_woocommerce_scripts' );
49
50
/**
51
 * Disable the default WooCommerce stylesheet.
52
 *
53
 * Removing the default WooCommerce stylesheet and enqueing your own will
54
 * protect you during WooCommerce core updates.
55
 *
56
 * @link https://docs.woocommerce.com/document/disable-the-default-stylesheet/
57
 */
58
add_filter( 'woocommerce_enqueue_styles', '__return_empty_array' );
59
60
/**
61
 * Add 'woocommerce-active' class to the body tag.
62
 *
63
 * @param  array $classes CSS classes applied to the body tag.
64
 * @return array $classes modified to include 'woocommerce-active' class.
65
 */
66
function bitsy_woocommerce_active_body_class( $classes ) {
67
	$classes[] = 'woocommerce-active';
68
69
	return $classes;
70
}
71
add_filter( 'body_class', 'bitsy_woocommerce_active_body_class' );
72
73
/**
74
 * Products per page.
75
 *
76
 * @return integer number of products.
77
 */
78
function bitsy_woocommerce_products_per_page() {
79
	return 12;
80
}
81
add_filter( 'loop_shop_per_page', 'bitsy_woocommerce_products_per_page' );
82
83
/**
84
 * Product gallery thumnbail columns.
85
 *
86
 * @return integer number of columns.
87
 */
88
function bitsy_woocommerce_thumbnail_columns() {
89
	return 4;
90
}
91
add_filter( 'woocommerce_product_thumbnails_columns', 'bitsy_woocommerce_thumbnail_columns' );
92
93
/**
94
 * Default loop columns on product archives.
95
 *
96
 * @return integer products per row.
97
 */
98
function bitsy_woocommerce_loop_columns() {
99
	return 3;
100
}
101
add_filter( 'loop_shop_columns', 'bitsy_woocommerce_loop_columns' );
102
103
/**
104
 * Related Products Args.
105
 *
106
 * @param array $args related products args.
107
 * @return array $args related products args.
108
 */
109
function bitsy_woocommerce_related_products_args( $args ) {
110
	$defaults = array(
111
		'posts_per_page' => 3,
112
		'columns'        => 3,
113
	);
114
115
	$args = wp_parse_args( $defaults, $args );
0 ignored issues
show
Consider using a different name than the parameter $args. This often makes code more readable.
Loading history...
116
117
	return $args;
118
}
119
add_filter( 'woocommerce_output_related_products_args', 'bitsy_woocommerce_related_products_args' );
120
121
if ( ! function_exists( 'bitsy_woocommerce_product_columns_wrapper' ) ) {
122
	/**
123
	 * Product columns wrapper.
124
	 *
125
	 * @return  void
126
	 */
127
	function bitsy_woocommerce_product_columns_wrapper() {
128
		$columns = bitsy_woocommerce_loop_columns();
129
		echo '<div class="columns-' . absint( $columns ) . '">';
130
	}
131
}
132
add_action( 'woocommerce_before_shop_loop', 'bitsy_woocommerce_product_columns_wrapper', 40 );
133
134
if ( ! function_exists( 'bitsy_woocommerce_product_columns_wrapper_close' ) ) {
135
	/**
136
	 * Product columns wrapper close.
137
	 *
138
	 * @return  void
139
	 */
140
	function bitsy_woocommerce_product_columns_wrapper_close() {
141
		echo '</div>';
142
	}
143
}
144
add_action( 'woocommerce_after_shop_loop', 'bitsy_woocommerce_product_columns_wrapper_close', 40 );
145
146
/**
147
 * Remove default WooCommerce wrapper.
148
 */
149
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
150
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
151
152
if ( ! function_exists( 'bitsy_woocommerce_wrapper_before' ) ) {
153
	/**
154
	 * Before Content.
155
	 *
156
	 * Wraps all WooCommerce content in wrappers which match the theme markup.
157
	 *
158
	 * @return void
159
	 */
160
	function bitsy_woocommerce_wrapper_before() {
161
		?>
162
		<div id="primary" class="content-area">
163
			<main id="main" class="site-main" role="main">
164
		<?php
165
	}
166
}
167
add_action( 'woocommerce_before_main_content', 'bitsy_woocommerce_wrapper_before' );
168
169
if ( ! function_exists( 'bitsy_woocommerce_wrapper_after' ) ) {
170
	/**
171
	 * After Content.
172
	 *
173
	 * Closes the wrapping divs.
174
	 *
175
	 * @return void
176
	 */
177
	function bitsy_woocommerce_wrapper_after() {
178
		?>
179
			</main><!-- #main -->
180
		</div><!-- #primary -->
181
		<?php
182
	}
183
}
184
add_action( 'woocommerce_after_main_content', 'bitsy_woocommerce_wrapper_after' );
185
186
/**
187
 * Sample implementation of the WooCommerce Mini Cart.
188
 *
189
 * You can add the WooCommerce Mini Cart to header.php like so ...
190
 *
191
	<?php
192
		if ( function_exists( 'bitsy_woocommerce_header_cart' ) ) {
193
			_s_woocommerce_header_cart();
194
		}
195
	?>
196
 */
197
198
if ( ! function_exists( 'bitsy_woocommerce_cart_link_fragment' ) ) {
199
	/**
200
	 * Cart Fragments.
201
	 *
202
	 * Ensure cart contents update when products are added to the cart via AJAX.
203
	 *
204
	 * @param array $fragments Fragments to refresh via AJAX.
205
	 * @return array Fragments to refresh via AJAX.
206
	 */
207
	function bitsy_woocommerce_cart_link_fragment( $fragments ) {
208
		ob_start();
209
		_s_woocommerce_cart_link();
210
		$fragments['a.cart-contents'] = ob_get_clean();
211
212
		return $fragments;
213
	}
214
}
215
add_filter( 'woocommerce_add_to_cart_fragments', 'bitsy_woocommerce_cart_link_fragment' );
216
217
if ( ! function_exists( 'bitsy_woocommerce_cart_link' ) ) {
218
	/**
219
	 * Cart Link.
220
	 *
221
	 * Displayed a link to the cart including the number of items present and the cart total.
222
	 *
223
	 * @return void
224
	 */
225
	function bitsy_woocommerce_cart_link() {
226
		?>
227
			<a class="cart-contents" href="<?php echo esc_url( wc_get_cart_url() ); ?>" title="<?php esc_attr_e( 'View your shopping cart', '_s' ); ?>">
228
				<?php /* translators: number of items in the mini cart. */ ?>
229
				<span class="amount"><?php echo wp_kses_data( WC()->cart->get_cart_subtotal() ); ?></span> <span class="count"><?php echo wp_kses_data( sprintf( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count(), '_s' ), WC()->cart->get_cart_contents_count() ) ); ?></span>
230
			</a>
231
		<?php
232
	}
233
}
234
235
if ( ! function_exists( 'bitsy_woocommerce_header_cart' ) ) {
236
	/**
237
	 * Display Header Cart.
238
	 *
239
	 * @return void
240
	 */
241
	function bitsy_woocommerce_header_cart() {
242
		if ( is_cart() ) {
243
			$class = 'current-menu-item';
244
		} else {
245
			$class = '';
246
		}
247
		?>
248
		<ul id="site-header-cart" class="site-header-cart">
249
			<li class="<?php echo esc_attr( $class ); ?>">
250
				<?php bitsy_woocommerce_cart_link(); ?>
251
			</li>
252
			<li>
253
				<?php
254
					$instance = array(
255
						'title' => '',
256
					);
257
258
					the_widget( 'WC_Widget_Cart', $instance );
259
				?>
260
			</li>
261
		</ul>
262
		<?php
263
	}
264
}
265