Passed
Push — master ( f50af0...bca8c5 )
by Warwick
03:32
created
includes/classes/class-lsx-walker-comment.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@  discard block
 block discarded – undo
6 6
  * @subpackage comment
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13
-if ( ! class_exists( 'Walker_Comment' ) ) {
13
+if ( ! class_exists('Walker_Comment')) {
14 14
 	return;
15 15
 }
16 16
 
17
-if ( ! class_exists( 'LSX_Walker_Comment' ) ) :
17
+if ( ! class_exists('LSX_Walker_Comment')) :
18 18
 
19 19
 	/**
20 20
 	 * Use Bootstrap's media object for listing comments.
@@ -26,35 +26,35 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	class LSX_Walker_Comment extends Walker_Comment {
28 28
 
29
-		function start_lvl( &$output, $depth = 0, $args = array() ) {
29
+		function start_lvl(&$output, $depth = 0, $args = array()) {
30 30
 			$GLOBALS['comment_depth'] = $depth + 1; ?>
31
-			<ul <?php comment_class( 'media media-reply unstyled list-unstyled comment-' . get_comment_ID() ); ?>>
31
+			<ul <?php comment_class('media media-reply unstyled list-unstyled comment-' . get_comment_ID()); ?>>
32 32
 			<?php
33 33
 		}
34 34
 
35
-		function end_lvl( &$output, $depth = 0, $args = array() ) {
35
+		function end_lvl(&$output, $depth = 0, $args = array()) {
36 36
 			$GLOBALS['comment_depth'] = $depth + 1;
37 37
 			echo '</ul>';
38 38
 		}
39 39
 
40
-		function start_el( &$output, $comment, $depth = 0, $args = array(), $id = 0 ) {
40
+		function start_el(&$output, $comment, $depth = 0, $args = array(), $id = 0) {
41 41
 			++$depth;
42 42
 			$GLOBALS['comment_depth'] = $depth;
43 43
 			$GLOBALS['comment']       = $comment;
44 44
 
45
-			if ( ! empty( $args['callback'] ) ) {
46
-				call_user_func( $args['callback'], $comment, $args, $depth );
45
+			if ( ! empty($args['callback'])) {
46
+				call_user_func($args['callback'], $comment, $args, $depth);
47 47
 				return;
48 48
 			}?>
49 49
 
50
-			<li id="comment-<?php comment_ID(); ?>" <?php comment_class( 'media comment-' . get_comment_ID() ); ?>>
51
-			<?php get_template_part( 'comment' ); ?>
50
+			<li id="comment-<?php comment_ID(); ?>" <?php comment_class('media comment-' . get_comment_ID()); ?>>
51
+			<?php get_template_part('comment'); ?>
52 52
 			<?php
53 53
 		}
54 54
 
55
-		function end_el( &$output, $comment, $depth = 0, $args = array() ) {
56
-			if ( ! empty( $args['end-callback'] ) ) {
57
-				call_user_func( $args['end-callback'], $comment, $args, $depth );
55
+		function end_el(&$output, $comment, $depth = 0, $args = array()) {
56
+			if ( ! empty($args['end-callback'])) {
57
+				call_user_func($args['end-callback'], $comment, $args, $depth);
58 58
 				return;
59 59
 			}
60 60
 
Please login to merge, or discard this patch.
page-templates/template-wc-thank-you.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -22,71 +22,71 @@  discard block
 block discarded – undo
22 22
 			<ul class="lsx-wc-checkout-steps-items">
23 23
 					<li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done">
24 24
 						<i class="fa fa-check-circle" aria-hidden="true"></i>
25
-						<span><span><?php esc_html_e( 'Choose your product', 'lsx' ); ?></span></span>
25
+						<span><span><?php esc_html_e('Choose your product', 'lsx'); ?></span></span>
26 26
 						<i class="fa fa-angle-right" aria-hidden="true"></i>
27 27
 					</li>
28 28
 
29 29
 					<li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done lsx-wc-checkout-steps-item-cart">
30 30
 						<i class="fa fa-check-circle" aria-hidden="true"></i>
31
-						<span><span><?php esc_html_e( 'My Cart', 'lsx' ); ?></span></span>
31
+						<span><span><?php esc_html_e('My Cart', 'lsx'); ?></span></span>
32 32
 					</li>
33 33
 
34 34
 					<li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-done lsx-wc-checkout-steps-item-payment">
35 35
 					<i class="fa fa-check-circle" aria-hidden="true"></i>
36
-						<span><span><?php esc_html_e( 'Payment details', 'lsx' ); ?></span></span>
36
+						<span><span><?php esc_html_e('Payment details', 'lsx'); ?></span></span>
37 37
 						<i class="fa fa-angle-right" aria-hidden="true"></i>
38 38
 					</li>
39 39
 
40 40
 					<li class="lsx-wc-checkout-steps-item lsx-wc-checkout-steps-item-current lsx-wc-checkout-steps-item-thankyou">
41
-						<i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e( '4', 'lsx' ); ?></i>
42
-						<span><span><?php esc_html_e( 'Thank you!', 'lsx' ); ?></span></span>
41
+						<i class="lsx-wc-checkout-steps-counter" aria-hidden="true"><?php esc_html_e('4', 'lsx'); ?></i>
42
+						<span><span><?php esc_html_e('Thank you!', 'lsx'); ?></span></span>
43 43
 					</li>
44 44
 			</ul>
45 45
 		</div>
46 46
 
47 47
 		<?php lsx_content_top(); ?>
48 48
 
49
-		<?php if ( have_posts() ) : ?>
49
+		<?php if (have_posts()) : ?>
50 50
 
51
-			<?php while ( have_posts() ) : the_post(); ?>
51
+			<?php while (have_posts()) : the_post(); ?>
52 52
 
53 53
 				<?php
54 54
 					WC()->payment_gateways()->payment_gateways;
55
-					$order_key = isset( $_GET['key'] ) ? wc_clean( $_GET['key'] ) : '';
56
-					$order_id  = absint( $wp->query_vars['order-received'] );
57
-					$order = wc_get_order( $order_id );
55
+					$order_key = isset($_GET['key']) ? wc_clean($_GET['key']) : '';
56
+					$order_id  = absint($wp->query_vars['order-received']);
57
+					$order = wc_get_order($order_id);
58 58
 				?>
59 59
 
60
-				<?php if ( $order && $order->get_id() === $order_id && $order->get_order_key() === $order_key ) : ?>
60
+				<?php if ($order && $order->get_id() === $order_id && $order->get_order_key() === $order_key) : ?>
61 61
 
62 62
 					<?php // @codingStandardsIgnoreStart ?>
63 63
 
64
-					<div class="alert alert-success"><?php echo apply_filters( 'woocommerce_thankyou_order_received_text', esc_html__( 'Thank you. Your order has been received.', 'lsx' ), $order ); ?></div>
64
+					<div class="alert alert-success"><?php echo apply_filters('woocommerce_thankyou_order_received_text', esc_html__('Thank you. Your order has been received.', 'lsx'), $order); ?></div>
65 65
 
66 66
 					<div class="row">
67 67
 						<div class="col-xs-12 col-sm-6">
68
-							<h2><?php esc_html_e( 'Order Details', 'lsx' ); ?></h2>
68
+							<h2><?php esc_html_e('Order Details', 'lsx'); ?></h2>
69 69
 
70 70
 							<table class="table">
71 71
 								<tbody>
72 72
 									<tr>
73
-										<th><?php esc_html_e( 'Order:', 'lsx' ); ?></th>
73
+										<th><?php esc_html_e('Order:', 'lsx'); ?></th>
74 74
 										<td><?php echo $order->get_order_number(); ?></td>
75 75
 									</tr>
76 76
 
77 77
 									<tr>
78
-										<th><?php esc_html_e( 'Date:', 'lsx' ); ?></th>
79
-										<td><?php echo date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) ); ?></td>
78
+										<th><?php esc_html_e('Date:', 'lsx'); ?></th>
79
+										<td><?php echo date_i18n(get_option('date_format'), strtotime($order->order_date)); ?></td>
80 80
 									</tr>
81 81
 
82 82
 									<tr>
83
-										<th><?php esc_html_e( 'Total:', 'lsx' ); ?></th>
83
+										<th><?php esc_html_e('Total:', 'lsx'); ?></th>
84 84
 										<td><?php echo $order->get_formatted_order_total(); ?></td>
85 85
 									</tr>
86 86
 
87
-									<?php if ( $order->payment_method_title ) : ?>
87
+									<?php if ($order->payment_method_title) : ?>
88 88
 										<tr>
89
-											<th><?php esc_html_e( 'Payment method:', 'lsx' ); ?></th>
89
+											<th><?php esc_html_e('Payment method:', 'lsx'); ?></th>
90 90
 											<td><?php echo $order->payment_method_title; ?></td>
91 91
 										</tr>
92 92
 									<?php endif; ?>
@@ -95,48 +95,48 @@  discard block
 block discarded – undo
95 95
 
96 96
 							<?php // do_action( 'woocommerce_order_details_after_order_table', $order ); ?>
97 97
 
98
-							<h2><?php esc_html_e( 'Customer details', 'lsx' ); ?></h2>
98
+							<h2><?php esc_html_e('Customer details', 'lsx'); ?></h2>
99 99
 
100 100
 							<dl class="customer_details">
101 101
 								<?php
102
-									if ( $order->billing_email ) echo '<dt>' . esc_html__( 'Email:', 'lsx' ) . '</dt><dd>' . $order->billing_email . '</dd>';
103
-									if ( $order->billing_phone ) echo '<dt>' . esc_html__( 'Telephone:', 'lsx' ) . '</dt><dd>' . $order->billing_phone . '</dd>';
102
+									if ($order->billing_email) echo '<dt>' . esc_html__('Email:', 'lsx') . '</dt><dd>' . $order->billing_email . '</dd>';
103
+									if ($order->billing_phone) echo '<dt>' . esc_html__('Telephone:', 'lsx') . '</dt><dd>' . $order->billing_phone . '</dd>';
104 104
 
105 105
 									// Additional customer details hook
106
-									do_action( 'woocommerce_order_details_after_customer_details', $order );
106
+									do_action('woocommerce_order_details_after_customer_details', $order);
107 107
 								?>
108 108
 							</dl>
109 109
 
110
-							<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && get_option( 'woocommerce_calc_shipping' ) !== 'no' ) : ?>
110
+							<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && get_option('woocommerce_calc_shipping') !== 'no') : ?>
111 111
 
112 112
 								<div class="row">
113 113
 									<div class="col-xs-12 col-sm-6">
114 114
 
115 115
 							<?php endif; ?>
116 116
 
117
-										<h3><?php esc_html_e( 'Billing Address', 'lsx' ); ?></h3>
117
+										<h3><?php esc_html_e('Billing Address', 'lsx'); ?></h3>
118 118
 
119 119
 										<address>
120 120
 											<?php
121
-												if ( ! $order->get_formatted_billing_address() ) {
122
-													esc_html_e( 'N/A', 'lsx' );
121
+												if ( ! $order->get_formatted_billing_address()) {
122
+													esc_html_e('N/A', 'lsx');
123 123
 												} else {
124 124
 													echo $order->get_formatted_billing_address();
125 125
 												}
126 126
 											?>
127 127
 										</address>
128 128
 
129
-							<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && get_option( 'woocommerce_calc_shipping' ) !== 'no' ) : ?>
129
+							<?php if ( ! wc_ship_to_billing_address_only() && $order->needs_shipping_address() && get_option('woocommerce_calc_shipping') !== 'no') : ?>
130 130
 
131 131
 									</div>
132 132
 
133 133
 									<div class="col-xs-12 col-sm-6">
134
-										<h3><?php esc_html_e( 'Shipping Address', 'lsx' ); ?></h3>
134
+										<h3><?php esc_html_e('Shipping Address', 'lsx'); ?></h3>
135 135
 
136 136
 										<address>
137 137
 											<?php
138
-												if ( ! $order->get_formatted_shipping_address() ) {
139
-													esc_html_e( 'N/A', 'lsx' );
138
+												if ( ! $order->get_formatted_shipping_address()) {
139
+													esc_html_e('N/A', 'lsx');
140 140
 												} else {
141 141
 													echo $order->get_formatted_shipping_address();
142 142
 												}
@@ -149,68 +149,68 @@  discard block
 block discarded – undo
149 149
 						</div>
150 150
 
151 151
 						<div class="col-xs-12 col-sm-6">
152
-							<h2><?php esc_html_e( 'Products details', 'lsx' ); ?></h2>
152
+							<h2><?php esc_html_e('Products details', 'lsx'); ?></h2>
153 153
 
154 154
 							<table class="table">
155 155
 								<thead>
156 156
 									<tr>
157
-										<th><?php esc_html_e( 'Product', 'lsx' ); ?></th>
158
-										<th><?php esc_html_e( 'Total', 'lsx' ); ?></th>
157
+										<th><?php esc_html_e('Product', 'lsx'); ?></th>
158
+										<th><?php esc_html_e('Total', 'lsx'); ?></th>
159 159
 									</tr>
160 160
 								</thead>
161 161
 
162 162
 								<tbody>
163 163
 									<?php
164
-										if ( sizeof( $order->get_items() ) > 0 ) :
165
-											foreach( $order->get_items() as $item ) :
166
-												$_product = apply_filters( 'woocommerce_order_item_product', $order->get_product_from_item( $item ), $item );
167
-												$item_meta = new WC_Order_Item_Meta( $item['item_meta'], $_product );
164
+										if (sizeof($order->get_items()) > 0) :
165
+											foreach ($order->get_items() as $item) :
166
+												$_product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item);
167
+												$item_meta = new WC_Order_Item_Meta($item['item_meta'], $_product);
168 168
 											?>
169 169
 
170 170
 											<tr>
171 171
 												<td>
172 172
 													<?php
173
-														if ( $_product && ! $_product->is_visible() ) {
174
-															echo apply_filters( 'woocommerce_order_item_name', $item['name'], $item );
173
+														if ($_product && ! $_product->is_visible()) {
174
+															echo apply_filters('woocommerce_order_item_name', $item['name'], $item);
175 175
 														} else {
176
-															echo apply_filters( 'woocommerce_order_item_name', sprintf( '<a href="%s">%s</a>', get_permalink( $item['product_id'] ), $item['name'] ), $item );
176
+															echo apply_filters('woocommerce_order_item_name', sprintf('<a href="%s">%s</a>', get_permalink($item['product_id']), $item['name']), $item);
177 177
 														}
178 178
 
179
-														echo apply_filters( 'woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf( '&times; %s', $item['qty'] ) . '</strong>', $item );
179
+														echo apply_filters('woocommerce_order_item_quantity_html', ' <strong class="product-quantity">' . sprintf('&times; %s', $item['qty']) . '</strong>', $item);
180 180
 
181 181
 														ob_start();
182 182
 														$item_meta->display();
183 183
 														$_item_meta = ob_get_clean();
184 184
 
185
-														if ( ! empty( $_item_meta ) ) {
185
+														if ( ! empty($_item_meta)) {
186 186
 															echo $_item_meta;
187 187
 														} else {
188 188
 															echo '<br>';
189 189
 														}
190 190
 
191
-														if ( $_product && $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted() ) {
192
-															$download_files = $order->get_item_downloads( $item );
191
+														if ($_product && $_product->exists() && $_product->is_downloadable() && $order->is_download_permitted()) {
192
+															$download_files = $order->get_item_downloads($item);
193 193
 															$i = 0;
194 194
 															$links = array();
195 195
 
196
-															if ( empty( $download_files ) ) {
196
+															if (empty($download_files)) {
197 197
 																$download_files = $_product->get_files();
198 198
 															}
199 199
 
200
-															foreach ( $download_files as $download_id => $file ) {
200
+															foreach ($download_files as $download_id => $file) {
201 201
 																++$i;
202 202
 
203
-																if ( $i > 1 ) {
203
+																if ($i > 1) {
204 204
 																	echo '<br>';
205 205
 																}
206 206
 
207
-																if ( ! empty( $_item_meta ) ) {
207
+																if ( ! empty($_item_meta)) {
208 208
 																	echo '<span style="margin-top: -2.4rem; display: block;">';
209 209
 																} else {
210 210
 																	echo '<span>';
211 211
 																}
212 212
 
213
-																echo '<a href="' . esc_url( $file['download_url'] ? $file['download_url'] : $file['file'] ) . '">' . sprintf( esc_html__( 'Download file%s', 'lsx' ), ( count( $download_files ) > 1 ? ' ' . $i . ': ' : ': ' ) ) . esc_html( $file['name'] ) . '</a>';
213
+																echo '<a href="' . esc_url($file['download_url'] ? $file['download_url'] : $file['file']) . '">' . sprintf(esc_html__('Download file%s', 'lsx'), (count($download_files) > 1 ? ' ' . $i . ': ' : ': ')) . esc_html($file['name']) . '</a>';
214 214
 																echo '</span>';
215 215
 															}
216 216
 														}
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 												</td>
219 219
 
220 220
 												<td>
221
-													<?php echo $order->get_formatted_line_subtotal( $item ); ?>
221
+													<?php echo $order->get_formatted_line_subtotal($item); ?>
222 222
 												</td>
223 223
 											</tr>
224 224
 
225 225
 											<?php
226
-												if ( $order->has_status( array( 'completed', 'processing' ) ) && ( $purchase_note = get_post_meta( $_product->id, '_purchase_note', true ) ) ) {
226
+												if ($order->has_status(array('completed', 'processing')) && ($purchase_note = get_post_meta($_product->id, '_purchase_note', true))) {
227 227
 													?>
228 228
 													<tr class="product-purchase-note">
229
-														<td colspan="3"><?php echo wpautop( do_shortcode( wp_kses_post( $purchase_note ) ) ); ?></td>
229
+														<td colspan="3"><?php echo wpautop(do_shortcode(wp_kses_post($purchase_note))); ?></td>
230 230
 													</tr>
231 231
 													<?php
232 232
 												}
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 
240 240
 								<tfoot>
241 241
 									<?php
242
-										if ( $totals = $order->get_order_item_totals() ) :
243
-											foreach ( $totals as $total ) :
242
+										if ($totals = $order->get_order_item_totals()) :
243
+											foreach ($totals as $total) :
244 244
 												?>
245 245
 												<tr>
246 246
 													<th scope="row"><?php echo $total['label']; ?></th>
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
 								</tfoot>
254 254
 							</table>
255 255
 
256
-							<?php if ( 'bacs' === $order->get_payment_method() ) { ?>
257
-								<h2><?php esc_html_e( 'Bank Details', 'lsx' ); ?></h2>
258
-								<?php do_action( 'woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id() ); ?>
256
+							<?php if ('bacs' === $order->get_payment_method()) { ?>
257
+								<h2><?php esc_html_e('Bank Details', 'lsx'); ?></h2>
258
+								<?php do_action('woocommerce_thankyou_' . $order->get_payment_method(), $order->get_id()); ?>
259 259
 							<?php } ?>
260 260
 						</div>
261 261
 					</div>
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 				<?php else : ?>
266 266
 
267
-					<div class="alert alert-danger"><?php esc_html_e( 'Invalid order.', 'lsx' ); ?></div>
267
+					<div class="alert alert-danger"><?php esc_html_e('Invalid order.', 'lsx'); ?></div>
268 268
 
269 269
 				<?php endif; ?>
270 270
 
Please login to merge, or discard this patch.
includes/classes/class-lsx-lazy-load-images.php 1 patch
Spacing   +59 added lines, -60 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@  discard block
 block discarded – undo
6 6
  * @subpackage lazyload
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
13
-if ( ! class_exists( 'LSX_Lazy_Load_Images' ) ) :
13
+if ( ! class_exists('LSX_Lazy_Load_Images')) :
14 14
 
15 15
 	/*
16 16
 	 * LSX Lazy Load Images Class
@@ -39,143 +39,142 @@  discard block
 block discarded – undo
39 39
 		protected static $noscripts   = array();
40 40
 
41 41
 		static function init() {
42
-			if ( is_admin() ) {
42
+			if (is_admin()) {
43 43
 				return;
44 44
 			}
45 45
 
46
-			if ( get_theme_mod( 'lsx_lazyload_status', '1' ) === false ) {
46
+			if (get_theme_mod('lsx_lazyload_status', '1') === false) {
47 47
 				self::$enabled = false;
48 48
 				return;
49 49
 			}
50 50
 
51
-			if ( ! apply_filters( 'lsx_lazyload_is_enabled', true ) ) {
51
+			if ( ! apply_filters('lsx_lazyload_is_enabled', true)) {
52 52
 				self::$enabled = false;
53 53
 				return;
54 54
 			}
55 55
 
56
-			add_action( 'wp_enqueue_scripts', array( 'LSX_Lazy_Load_Images', 'add_scripts' ) );
57
-			add_action( 'wp_head', array( 'LSX_Lazy_Load_Images', 'setup_filters' ), 9999 );
58
-			add_filter( 'wp_kses_allowed_html', array( 'LSX_Lazy_Load_Images', 'kses_allowed_html' ), 10, 2 );
56
+			add_action('wp_enqueue_scripts', array('LSX_Lazy_Load_Images', 'add_scripts'));
57
+			add_action('wp_head', array('LSX_Lazy_Load_Images', 'setup_filters'), 9999);
58
+			add_filter('wp_kses_allowed_html', array('LSX_Lazy_Load_Images', 'kses_allowed_html'), 10, 2);
59 59
 		}
60 60
 
61 61
 		static function setup_filters() {
62 62
 			// WordPress.
63
-			add_filter( 'the_content', array( 'LSX_Lazy_Load_Images', 'filter_images' ), 200 );
64
-			add_filter( 'widget_text', array( 'LSX_Lazy_Load_Images', 'filter_images' ), 200 );
65
-			add_filter( 'post_thumbnail_html', array( 'LSX_Lazy_Load_Images', 'filter_images' ), 200 );
66
-			add_filter( 'get_avatar', array( 'LSX_Lazy_Load_Images', 'filter_images' ), 200 );
63
+			add_filter('the_content', array('LSX_Lazy_Load_Images', 'filter_images'), 200);
64
+			add_filter('widget_text', array('LSX_Lazy_Load_Images', 'filter_images'), 200);
65
+			add_filter('post_thumbnail_html', array('LSX_Lazy_Load_Images', 'filter_images'), 200);
66
+			add_filter('get_avatar', array('LSX_Lazy_Load_Images', 'filter_images'), 200);
67 67
 
68 68
 			// LSX.
69
-			add_filter( 'lsx_lazyload_filter_images', array( 'LSX_Lazy_Load_Images', 'filter_images' ), 200 );
69
+			add_filter('lsx_lazyload_filter_images', array('LSX_Lazy_Load_Images', 'filter_images'), 200);
70 70
 
71 71
 			// Envira Gallery.
72
-			add_filter( 'envira_gallery_output_image', array( 'LSX_Lazy_Load_Images', 'filter_images' ), 200 );
72
+			add_filter('envira_gallery_output_image', array('LSX_Lazy_Load_Images', 'filter_images'), 200);
73 73
 		}
74 74
 
75 75
 		static function add_scripts() {
76
-			wp_enqueue_script( 'lazysizes', get_template_directory_uri() . '/assets/js/vendor/lazysizes.min.js', array( 'jquery' ), LSX_VERSION, true );
76
+			wp_enqueue_script('lazysizes', get_template_directory_uri() . '/assets/js/vendor/lazysizes.min.js', array('jquery'), LSX_VERSION, true);
77 77
 			// Plugin that enables use lazysizes in brackground images
78 78
 			// wp_enqueue_script( 'lazysizes', get_template_directory_uri() . '/assets/js/vendor/ls.unveilhooks.min.js', array( 'jquery', 'lazysizes' ), LSX_VERSION, true );
79 79
 		}
80 80
 
81
-		static function filter_images( $content ) {
82
-			if ( ! self::is_enabled() ) {
81
+		static function filter_images($content) {
82
+			if ( ! self::is_enabled()) {
83 83
 				return $content;
84 84
 			}
85 85
 
86
-			$http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
87
-			$http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : '';
86
+			$http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']));
87
+			$http_user_agent = ! empty($http_user_agent) ? $http_user_agent : '';
88 88
 
89
-			if ( is_feed()
89
+			if (is_feed()
90 90
 				|| is_preview()
91
-				|| 1 === intval( get_query_var( 'print' ) )
92
-				|| 1 === intval( get_query_var( 'printpage' ) )
93
-				|| strpos( $http_user_agent, 'Opera Mini' ) !== false
91
+				|| 1 === intval(get_query_var('print'))
92
+				|| 1 === intval(get_query_var('printpage'))
93
+				|| strpos($http_user_agent, 'Opera Mini') !== false
94 94
 			) {
95 95
 				return $content;
96 96
 			}
97 97
 
98 98
 			$skip_images_regex = '/class=".*(lazyload|disable-lazyload).*"/';
99
-			$placeholder_image = apply_filters( 'lsx_lazyload_placeholder_image', get_template_directory_uri() . '/assets/images/empty.gif' );
99
+			$placeholder_image = apply_filters('lsx_lazyload_placeholder_image', get_template_directory_uri() . '/assets/images/empty.gif');
100 100
 
101 101
 			$matches = array();
102 102
 			$search  = array();
103 103
 			$replace = array();
104 104
 
105
-			$content = preg_replace_callback( '~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content );
106
-			preg_match_all( '/^<img[^>]*>$/', $content, $matches );
105
+			$content = preg_replace_callback('~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content);
106
+			preg_match_all('/^<img[^>]*>$/', $content, $matches);
107 107
 
108
-			foreach ( $matches[0] as $img_html ) {
109
-				if ( ! ( preg_match( $skip_images_regex, $img_html ) ) ) {
108
+			foreach ($matches[0] as $img_html) {
109
+				if ( ! (preg_match($skip_images_regex, $img_html))) {
110 110
 					$add_class = false;
111 111
 
112
-					if ( ! preg_match( '/^src=[\'"]([^\'"]+)[\'"]$/', $img_html ) && preg_match( '/^srcset=[\'"]([^\'"]+)[\'"]$/', $img_html ) ) {
113
-						$replace_html = preg_replace( '/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html );
112
+					if ( ! preg_match('/^src=[\'"]([^\'"]+)[\'"]$/', $img_html) && preg_match('/^srcset=[\'"]([^\'"]+)[\'"]$/', $img_html)) {
113
+						$replace_html = preg_replace('/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html);
114 114
 
115
-						if ( preg_match( '/^sizes=[\'"]([^\'"]+)[\'"]$/', $img_html ) ) {
116
-							$replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html );
115
+						if (preg_match('/^sizes=[\'"]([^\'"]+)[\'"]$/', $img_html)) {
116
+							$replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html);
117 117
 						} else {
118
-							$replace_html = preg_replace( '/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html );
118
+							$replace_html = preg_replace('/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html);
119 119
 						}
120 120
 
121 121
 						$add_class = true;
122
-					} elseif ( preg_match( '/^src=[\'"]([^\'"]+)[\'"]$/', $img_html ) ) {
123
-						$replace_html = preg_replace( '/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html );
122
+					} elseif (preg_match('/^src=[\'"]([^\'"]+)[\'"]$/', $img_html)) {
123
+						$replace_html = preg_replace('/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html);
124 124
 
125
-						if ( preg_match( '/^srcset=[\'"]([^\'"]+)[\'"]$/', $img_html ) ) {
126
-							if ( preg_match( '/^sizes=[\'"]([^\'"]+)[\'"]$/', $img_html ) ) {
127
-								$replace_html = preg_replace( '/srcset=/i', 'data-srcset=', $replace_html );
128
-								$replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html );
125
+						if (preg_match('/^srcset=[\'"]([^\'"]+)[\'"]$/', $img_html)) {
126
+							if (preg_match('/^sizes=[\'"]([^\'"]+)[\'"]$/', $img_html)) {
127
+								$replace_html = preg_replace('/srcset=/i', 'data-srcset=', $replace_html);
128
+								$replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html);
129 129
 							} else {
130
-								$replace_html = preg_replace( '/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html );
130
+								$replace_html = preg_replace('/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html);
131 131
 							}
132 132
 						}
133 133
 
134 134
 						$add_class = true;
135 135
 					}
136 136
 
137
-					if ( $add_class ) {
138
-						$replace_html  = self::add_class( $replace_html, 'lazyload' );
137
+					if ($add_class) {
138
+						$replace_html  = self::add_class($replace_html, 'lazyload');
139 139
 						$replace_html .= '<noscript>' . $img_html . '</noscript>';
140 140
 
141
-						array_push( $search, $img_html );
142
-						array_push( $replace, $replace_html );
141
+						array_push($search, $img_html);
142
+						array_push($replace, $replace_html);
143 143
 					}
144 144
 				}
145 145
 			}
146 146
 
147
-			$content = str_replace( $search, $replace, $content );
148
-			$content = preg_replace_callback( '~' . chr( 20 ) . '([0-9]+)' . chr( 20 ) . '~', 'self::noscripts_restore', $content );
147
+			$content = str_replace($search, $replace, $content);
148
+			$content = preg_replace_callback('~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content);
149 149
 			return $content;
150 150
 		}
151 151
 
152
-		static function noscripts_remove( $match ) {
153
-			++self::$noscript_id;
154
-			self::$noscripts[ self::$noscript_id ] = $match[0];
155
-			return chr( 20 ) . self::$noscript_id . chr( 20 );
152
+		static function noscripts_remove($match) {++self::$noscript_id;
153
+			self::$noscripts[self::$noscript_id] = $match[0];
154
+			return chr(20) . self::$noscript_id . chr(20);
156 155
 		}
157 156
 
158
-		static function noscripts_restore( $match ) {
159
-			return self::$noscripts[ (int) $match[1] ];
157
+		static function noscripts_restore($match) {
158
+			return self::$noscripts[(int) $match[1]];
160 159
 		}
161 160
 
162
-		static function add_class( $html_string = '', $new_class ) {
161
+		static function add_class($html_string = '', $new_class) {
163 162
 			$pattern = '/^class=[\'"]([^\'"]*)[\'"]$/';
164 163
 
165
-			if ( preg_match( $pattern, $html_string, $matches ) ) {
166
-				$defined_classes = explode( ' ', $matches[1] );
164
+			if (preg_match($pattern, $html_string, $matches)) {
165
+				$defined_classes = explode(' ', $matches[1]);
167 166
 
168
-				if ( ! in_array( $new_class, $defined_classes ) ) {
167
+				if ( ! in_array($new_class, $defined_classes)) {
169 168
 					$defined_classes[] = $new_class;
170 169
 
171 170
 					$html_string = str_replace(
172 171
 						$matches[0],
173
-						sprintf( 'class="%s"', implode( ' ', $defined_classes ) ),
172
+						sprintf('class="%s"', implode(' ', $defined_classes)),
174 173
 						$html_string
175 174
 					);
176 175
 				}
177 176
 			} else {
178
-				$html_string = preg_replace( '/(\<.+\s)/', sprintf( '$1class="%s" ', $new_class ), $html_string );
177
+				$html_string = preg_replace('/(\<.+\s)/', sprintf('$1class="%s" ', $new_class), $html_string);
179 178
 			}
180 179
 
181 180
 			return $html_string;
@@ -185,7 +184,7 @@  discard block
 block discarded – undo
185 184
 			return self::$enabled;
186 185
 		}
187 186
 
188
-		static function kses_allowed_html( $allowedtags, $context ) {
187
+		static function kses_allowed_html($allowedtags, $context) {
189 188
 			$allowedtags['noscript'] = array();
190 189
 
191 190
 			$allowedtags['img']['data-src']    = true;
@@ -198,4 +197,4 @@  discard block
 block discarded – undo
198 197
 
199 198
 endif;
200 199
 
201
-add_action( 'init', array( 'LSX_Lazy_Load_Images', 'init' ) );
200
+add_action('init', array('LSX_Lazy_Load_Images', 'init'));
Please login to merge, or discard this patch.