Passed
Push — master ( 6b5406...9e2256 )
by Virginia
02:25
created
includes/extras.php 1 patch
Spacing   +159 added lines, -159 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage extras
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if ( ! defined('ABSPATH')) {
10 10
 	exit;
11 11
 }
12 12
 
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
  * @package    lsx
17 17
  * @subpackage extras
18 18
  */
19
-add_filter( 'widget_text', 'shortcode_unautop' );
20
-add_filter( 'widget_text', 'do_shortcode' );
19
+add_filter('widget_text', 'shortcode_unautop');
20
+add_filter('widget_text', 'do_shortcode');
21 21
 
22
-if ( ! function_exists( 'lsx_kses_allowed_html' ) ) :
22
+if ( ! function_exists('lsx_kses_allowed_html')) :
23 23
 
24 24
 	/**
25 25
 	 * Enable extra attributes (srcset, sizes) in img tag.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @package    lsx
28 28
 	 * @subpackage extras
29 29
 	 */
30
-	function lsx_kses_allowed_html( $allowedtags, $context ) {
30
+	function lsx_kses_allowed_html($allowedtags, $context) {
31 31
 		$allowedtags['img']['srcset'] = true;
32 32
 		$allowedtags['img']['sizes']  = true;
33 33
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 
43 43
 endif;
44 44
 
45
-add_filter( 'wp_kses_allowed_html', 'lsx_kses_allowed_html', 10, 2 );
45
+add_filter('wp_kses_allowed_html', 'lsx_kses_allowed_html', 10, 2);
46 46
 
47
-if ( ! function_exists( 'lsx_body_class' ) ) :
47
+if ( ! function_exists('lsx_body_class')) :
48 48
 
49 49
 	/**
50 50
 	 * Add and remove body_class() classes.
@@ -52,55 +52,55 @@  discard block
 block discarded – undo
52 52
 	 * @package    lsx
53 53
 	 * @subpackage extras
54 54
 	 */
55
-	function lsx_body_class( $classes ) {
55
+	function lsx_body_class($classes) {
56 56
 		global $post;
57 57
 
58
-		$header_layout = get_theme_mod( 'lsx_header_layout', 'inline' );
58
+		$header_layout = get_theme_mod('lsx_header_layout', 'inline');
59 59
 		$classes[]     = 'header-' . $header_layout;
60 60
 
61
-		if ( isset( $post ) ) {
61
+		if (isset($post)) {
62 62
 			$classes[] = $post->post_name;
63 63
 		}
64 64
 
65
-		if ( class_exists( 'LSX_Banners' ) || empty( apply_filters( 'lsx_banner_plugin_disable', false ) ) ) {
66
-			$post_types = array( 'page', 'post' );
67
-			$post_types = apply_filters( 'lsx_allowed_post_type_banners', $post_types );
65
+		if (class_exists('LSX_Banners') || empty(apply_filters('lsx_banner_plugin_disable', false))) {
66
+			$post_types = array('page', 'post');
67
+			$post_types = apply_filters('lsx_allowed_post_type_banners', $post_types);
68 68
 
69
-			if ( is_singular( $post_types ) && has_post_thumbnail() ) {
69
+			if (is_singular($post_types) && has_post_thumbnail()) {
70 70
 				$classes[] = 'page-has-banner';
71 71
 			}
72 72
 		}
73 73
 
74
-		if ( function_exists( 'tour_operator' ) ) {
75
-			$post_types = array( 'page', 'post' );
74
+		if (function_exists('tour_operator')) {
75
+			$post_types = array('page', 'post');
76 76
 
77 77
 			$classes[] = 'to-active';
78 78
 		}
79 79
 
80
-		if ( has_nav_menu( 'top-menu' ) || has_nav_menu( 'top-menu-left' ) ) {
80
+		if (has_nav_menu('top-menu') || has_nav_menu('top-menu-left')) {
81 81
 			$classes[] = 'has-top-menu';
82 82
 		}
83 83
 
84
-		$fixed_header = get_theme_mod( 'lsx_header_fixed', false );
84
+		$fixed_header = get_theme_mod('lsx_header_fixed', false);
85 85
 
86
-		if ( false !== $fixed_header ) {
86
+		if (false !== $fixed_header) {
87 87
 			$classes[] = 'top-menu-fixed';
88 88
 		}
89 89
 
90
-		$search_form  = get_theme_mod( 'lsx_header_search', false );
90
+		$search_form = get_theme_mod('lsx_header_search', false);
91 91
 
92
-		if ( false !== $search_form ) {
92
+		if (false !== $search_form) {
93 93
 			$classes[] = 'has-header-search';
94 94
 		}
95 95
 
96
-		$preloader_content  = get_theme_mod( 'lsx_preloader_content_status', false );
96
+		$preloader_content = get_theme_mod('lsx_preloader_content_status', false);
97 97
 
98
-		if ( false !== $preloader_content ) {
98
+		if (false !== $preloader_content) {
99 99
 			$classes[] = 'preloader-content-enable';
100 100
 		}
101 101
 
102
-		$register_enabled = get_option( 'users_can_register', false );
103
-		if ( ( $register_enabled ) && is_page( 'my-account' ) && is_singular() ) {
102
+		$register_enabled = get_option('users_can_register', false);
103
+		if (($register_enabled) && is_page('my-account') && is_singular()) {
104 104
 			$classes[] = 'register-enabled';
105 105
 		}
106 106
 
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 
110 110
 endif;
111 111
 
112
-add_filter( 'body_class', 'lsx_body_class' );
112
+add_filter('body_class', 'lsx_body_class');
113 113
 
114
-if ( ! function_exists( 'lsx_embed_wrap' ) ) :
114
+if ( ! function_exists('lsx_embed_wrap')) :
115 115
 
116 116
 	/**
117 117
 	 * Wrap embedded media as suggested by Readability.
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 	 * @link https://gist.github.com/965956
123 123
 	 * @link http://www.readability.com/publishers/guidelines#publisher
124 124
 	 */
125
-	function lsx_embed_wrap( $cache, $url, $attr = '', $post_id = '' ) {
126
-		if ( false !== strpos( $cache, '<iframe' ) ) {
125
+	function lsx_embed_wrap($cache, $url, $attr = '', $post_id = '') {
126
+		if (false !== strpos($cache, '<iframe')) {
127 127
 			return '<div class="entry-content-asset">' . $cache . '</div>';
128 128
 		}
129 129
 
@@ -132,9 +132,9 @@  discard block
 block discarded – undo
132 132
 
133 133
 endif;
134 134
 
135
-add_filter( 'embed_oembed_html', 'lsx_embed_wrap', 10, 4 );
135
+add_filter('embed_oembed_html', 'lsx_embed_wrap', 10, 4);
136 136
 
137
-if ( ! function_exists( 'lsx_remove_self_closing_tags' ) ) :
137
+if ( ! function_exists('lsx_remove_self_closing_tags')) :
138 138
 
139 139
 	/**
140 140
 	 * Remove unnecessary self-closing tags.
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 	 * @package    lsx
143 143
 	 * @subpackage extras
144 144
 	 */
145
-	function lsx_remove_self_closing_tags( $input ) {
146
-		return str_replace( ' />', '>', $input );
145
+	function lsx_remove_self_closing_tags($input) {
146
+		return str_replace(' />', '>', $input);
147 147
 	}
148 148
 
149 149
 endif;
150 150
 
151
-add_filter( 'get_avatar',          'lsx_remove_self_closing_tags' ); // <img />
152
-add_filter( 'comment_id_fields',   'lsx_remove_self_closing_tags' ); // <input />
153
-add_filter( 'post_thumbnail_html', 'lsx_remove_self_closing_tags' ); // <img />
151
+add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img />
152
+add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input />
153
+add_filter('post_thumbnail_html', 'lsx_remove_self_closing_tags'); // <img />
154 154
 
155
-if ( ! function_exists( 'lsx_is_element_empty' ) ) :
155
+if ( ! function_exists('lsx_is_element_empty')) :
156 156
 
157 157
 	/**
158 158
 	 * Checks if a Nav $element is empty or not.
@@ -160,14 +160,14 @@  discard block
 block discarded – undo
160 160
 	 * @package    lsx
161 161
 	 * @subpackage extras
162 162
 	 */
163
-	function lsx_is_element_empty( $element ) {
164
-		$element = trim( $element );
165
-		return empty( $element ) ? false : true;
163
+	function lsx_is_element_empty($element) {
164
+		$element = trim($element);
165
+		return empty($element) ? false : true;
166 166
 	}
167 167
 
168 168
 endif;
169 169
 
170
-if ( ! function_exists( 'lsx_get_thumbnail' ) ) :
170
+if ( ! function_exists('lsx_get_thumbnail')) :
171 171
 
172 172
 	/**
173 173
 	 * return the responsive images.
@@ -175,62 +175,62 @@  discard block
 block discarded – undo
175 175
 	 * @package    lsx
176 176
 	 * @subpackage extras
177 177
 	 */
178
-	function lsx_get_thumbnail( $size, $image_src = false ) {
179
-		if ( false === $image_src ) {
178
+	function lsx_get_thumbnail($size, $image_src = false) {
179
+		if (false === $image_src) {
180 180
 			$post_id           = get_the_ID();
181
-			$post_thumbnail_id = get_post_thumbnail_id( $post_id );
182
-		} elseif ( false !== $image_src ) {
183
-			if ( is_numeric( $image_src ) ) {
181
+			$post_thumbnail_id = get_post_thumbnail_id($post_id);
182
+		} elseif (false !== $image_src) {
183
+			if (is_numeric($image_src)) {
184 184
 				$post_thumbnail_id = $image_src;
185 185
 			} else {
186
-				$post_thumbnail_id = lsx_get_attachment_id_from_src( $image_src );
186
+				$post_thumbnail_id = lsx_get_attachment_id_from_src($image_src);
187 187
 			}
188 188
 		}
189 189
 
190
-		$size = apply_filters( 'lsx_thumbnail_size', $size );
190
+		$size = apply_filters('lsx_thumbnail_size', $size);
191 191
 		$img       = '';
192 192
 		$lazy_img  = '';
193 193
 		$image_url = '';
194 194
 
195
-		if ( 'lsx-thumbnail-single' === $size || 'lsx-thumbnail-wide' === $size || 'lsx-thumbnail-square' === $size || 'thumbnail' === $size ) {
195
+		if ('lsx-thumbnail-single' === $size || 'lsx-thumbnail-wide' === $size || 'lsx-thumbnail-square' === $size || 'thumbnail' === $size) {
196 196
 			$srcset = false;
197
-			if ( ( ( 'team' === get_post_type() ) || ( 'testimonial' === get_post_type() ) ) && is_search() ) {
198
-				$img = get_the_post_thumbnail_url( get_the_ID(), 'lsx-thumbnail-wide' );
197
+			if ((('team' === get_post_type()) || ('testimonial' === get_post_type())) && is_search()) {
198
+				$img = get_the_post_thumbnail_url(get_the_ID(), 'lsx-thumbnail-wide');
199 199
 			} else {
200
-				$temp_img = wp_get_attachment_image_src( $post_thumbnail_id, $size );
201
-				if ( ! empty( $temp_img ) ) {
202
-					$img    = $temp_img[0];
200
+				$temp_img = wp_get_attachment_image_src($post_thumbnail_id, $size);
201
+				if ( ! empty($temp_img)) {
202
+					$img = $temp_img[0];
203 203
 				}
204 204
 			}
205 205
 		} else {
206 206
 			$srcset = true;
207
-			$img = wp_get_attachment_image_srcset( $post_thumbnail_id, $size );
207
+			$img = wp_get_attachment_image_srcset($post_thumbnail_id, $size);
208 208
 
209
-			$temp_lazy = wp_get_attachment_image_src( $post_thumbnail_id, $size );
210
-			if ( ! empty( $temp_lazy ) ) {
209
+			$temp_lazy = wp_get_attachment_image_src($post_thumbnail_id, $size);
210
+			if ( ! empty($temp_lazy)) {
211 211
 				$lazy_img = $temp_lazy[0];
212 212
 			}
213 213
 
214
-			if ( empty( $img ) ) {
214
+			if (empty($img)) {
215 215
 				$srcset = false;
216
-				if ( ! empty( $lazy_img ) ) {
216
+				if ( ! empty($lazy_img)) {
217 217
 					$img = $lazy_img;
218 218
 				}
219 219
 			}
220 220
 		}
221 221
 
222
-		if ( '' !== $img ) {
222
+		if ('' !== $img) {
223 223
 			$image_url = $img;
224
-			$img = '<img alt="' . the_title_attribute( 'echo=0' ) . '" class="attachment-responsive wp-post-image lsx-responsive" ';
225
-			if ( $srcset ) {
226
-				$img .= 'srcset="' . esc_attr( $image_url ) . '" ';
224
+			$img = '<img alt="' . the_title_attribute('echo=0') . '" class="attachment-responsive wp-post-image lsx-responsive" ';
225
+			if ($srcset) {
226
+				$img .= 'srcset="' . esc_attr($image_url) . '" ';
227 227
 			} else {
228
-				$img .= 'src="' . esc_url( $image_url ) . '" ';
228
+				$img .= 'src="' . esc_url($image_url) . '" ';
229 229
 			}
230 230
 			$img .= '/>';
231 231
 
232
-			$img = apply_filters( 'lsx_lazyload_filter_images', $img );
233
-			$img = apply_filters( 'lsx_lazyload_slider_images', $img, $post_thumbnail_id, $size, $srcset, $image_url );
232
+			$img = apply_filters('lsx_lazyload_filter_images', $img);
233
+			$img = apply_filters('lsx_lazyload_slider_images', $img, $post_thumbnail_id, $size, $srcset, $image_url);
234 234
 		}
235 235
 
236 236
 		return $img;
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 
239 239
 endif;
240 240
 
241
-if ( ! function_exists( 'lsx_thumbnail' ) ) :
241
+if ( ! function_exists('lsx_thumbnail')) :
242 242
 
243 243
 	/**
244 244
 	 * Output the Resonsive Images.
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 	 * @package    lsx
247 247
 	 * @subpackage extras
248 248
 	 */
249
-	function lsx_thumbnail( $size = 'thumbnail', $image_src = false ) {
250
-		echo wp_kses_post( lsx_get_thumbnail( $size, $image_src ) );
249
+	function lsx_thumbnail($size = 'thumbnail', $image_src = false) {
250
+		echo wp_kses_post(lsx_get_thumbnail($size, $image_src));
251 251
 	}
252 252
 
253 253
 endif;
254 254
 
255
-if ( ! function_exists( 'lsx_get_attachment_id_from_src' ) ) :
255
+if ( ! function_exists('lsx_get_attachment_id_from_src')) :
256 256
 
257 257
 	/**
258 258
 	 * Gets the attachments ID from the src.
@@ -260,13 +260,13 @@  discard block
 block discarded – undo
260 260
 	 * @package    lsx
261 261
 	 * @subpackage extras
262 262
 	 */
263
-	function lsx_get_attachment_id_from_src( $image_src ) {
264
-		$post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' );
263
+	function lsx_get_attachment_id_from_src($image_src) {
264
+		$post_id = wp_cache_get($image_src, 'lsx_get_attachment_id_from_src');
265 265
 
266
-		if ( false === $post_id ) {
266
+		if (false === $post_id) {
267 267
 			global $wpdb;
268
-			$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src ) );
269
-			wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 );
268
+			$post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src));
269
+			wp_cache_set($image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600);
270 270
 		}
271 271
 
272 272
 		return $post_id;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
 
275 275
 endif;
276 276
 
277
-if ( ! function_exists( 'lsx_page_banner' ) ) :
277
+if ( ! function_exists('lsx_page_banner')) :
278 278
 
279 279
 	/**
280 280
 	 * Add Featured Image as Banner on Single Pages.
@@ -283,30 +283,30 @@  discard block
 block discarded – undo
283 283
 	 * @subpackage extras
284 284
 	 */
285 285
 	function lsx_page_banner() {
286
-		if ( true === apply_filters( 'lsx_page_banner_disable', false ) ) {
286
+		if (true === apply_filters('lsx_page_banner_disable', false)) {
287 287
 			return;
288 288
 		}
289 289
 
290
-		$post_types = array( 'page', 'post' );
291
-		$post_types = apply_filters( 'lsx_allowed_post_type_banners', $post_types );
290
+		$post_types = array('page', 'post');
291
+		$post_types = apply_filters('lsx_allowed_post_type_banners', $post_types);
292 292
 
293
-		if ( is_singular( $post_types ) && has_post_thumbnail() ) :
293
+		if (is_singular($post_types) && has_post_thumbnail()) :
294 294
 			$bg_image = '';
295 295
 
296
-			if ( has_post_thumbnail() ) {
297
-				$temp_bg_image = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ), 'full' );
298
-				if ( ! empty( $temp_bg_image ) ) {
296
+			if (has_post_thumbnail()) {
297
+				$temp_bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
298
+				if ( ! empty($temp_bg_image)) {
299 299
 					$bg_image = $temp_bg_image[0];
300 300
 				}
301 301
 			}
302 302
 
303
-			if ( '' !== $bg_image ) :
303
+			if ('' !== $bg_image) :
304 304
 				?>
305 305
 					<div class="page-banner-wrap">
306 306
 						<div class="page-banner">
307 307
 							<?php lsx_banner_inner_top(); ?>
308 308
 
309
-							<div class="page-banner-image" style="background-image:url(<?php echo esc_attr( $bg_image ); ?>);"></div>
309
+							<div class="page-banner-image" style="background-image:url(<?php echo esc_attr($bg_image); ?>);"></div>
310 310
 
311 311
 							<div class="container">
312 312
 								<header class="page-header">
@@ -325,11 +325,11 @@  discard block
 block discarded – undo
325 325
 
326 326
 endif;
327 327
 
328
-add_filter( 'lsx_banner_disable', 'lsx_disable_banner_for_blocks' );
329
-add_filter( 'lsx_global_header_disable', 'lsx_disable_banner_for_blocks' );
328
+add_filter('lsx_banner_disable', 'lsx_disable_banner_for_blocks');
329
+add_filter('lsx_global_header_disable', 'lsx_disable_banner_for_blocks');
330 330
 
331 331
 
332
-if ( ! function_exists( 'lsx_disable_banner_for_blocks' ) ) :
332
+if ( ! function_exists('lsx_disable_banner_for_blocks')) :
333 333
 
334 334
 	/**
335 335
 	 * Disable the Banner if the page is using Blocks
@@ -340,15 +340,15 @@  discard block
 block discarded – undo
340 340
 	 * @param  $disable boolean
341 341
 	 * @return boolean
342 342
 	 */
343
-	function lsx_disable_banner_for_blocks( $disable ) {
343
+	function lsx_disable_banner_for_blocks($disable) {
344 344
 		$queried_object = get_queried_object_id();
345
-		$show_on_front  = get_option( 'show_on_front' );
345
+		$show_on_front  = get_option('show_on_front');
346 346
 
347
-		if ( 'page' === $show_on_front && (int) get_option( 'page_for_posts' ) === $queried_object ) {
347
+		if ('page' === $show_on_front && (int) get_option('page_for_posts') === $queried_object) {
348 348
 			return $disable;
349 349
 		}
350 350
 
351
-		if ( function_exists( 'has_blocks' ) && has_blocks() && ( ! is_archive() ) ) {
351
+		if (function_exists('has_blocks') && has_blocks() && ( ! is_archive())) {
352 352
 			$disable = true;
353 353
 		}
354 354
 		return $disable;
@@ -356,9 +356,9 @@  discard block
 block discarded – undo
356 356
 
357 357
 endif;
358 358
 
359
-add_action( 'lsx_header_after', 'lsx_page_banner' );
359
+add_action('lsx_header_after', 'lsx_page_banner');
360 360
 
361
-if ( ! function_exists( 'lsx_form_submit_button' ) ) :
361
+if ( ! function_exists('lsx_form_submit_button')) :
362 362
 
363 363
 	/**
364 364
 	 * filter the Gravity Forms button type.
@@ -370,15 +370,15 @@  discard block
 block discarded – undo
370 370
 	 * @param  $form   Object
371 371
 	 * @return String
372 372
 	 */
373
-	function lsx_form_submit_button( $button, $form ) {
373
+	function lsx_form_submit_button($button, $form) {
374 374
 		return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>";
375 375
 	}
376 376
 
377 377
 endif;
378 378
 
379
-add_filter( 'gform_submit_button', 'lsx_form_submit_button', 10, 2 );
379
+add_filter('gform_submit_button', 'lsx_form_submit_button', 10, 2);
380 380
 
381
-if ( ! function_exists( 'lsx_excerpt_more' ) ) :
381
+if ( ! function_exists('lsx_excerpt_more')) :
382 382
 
383 383
 	/**
384 384
 	 * Replaces the excerpt "more" text by a link.
@@ -386,15 +386,15 @@  discard block
 block discarded – undo
386 386
 	 * @package    lsx
387 387
 	 * @subpackage extras
388 388
 	 */
389
-	function lsx_excerpt_more( $more ) {
389
+	function lsx_excerpt_more($more) {
390 390
 		return '...';
391 391
 	}
392 392
 
393 393
 endif;
394 394
 
395
-add_filter( 'excerpt_more', 'lsx_excerpt_more' );
395
+add_filter('excerpt_more', 'lsx_excerpt_more');
396 396
 
397
-if ( ! function_exists( 'lsx_the_excerpt_filter' ) ) :
397
+if ( ! function_exists('lsx_the_excerpt_filter')) :
398 398
 
399 399
 	/**
400 400
 	 * Add a continue reading link to the excerpt.
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
 	 * @package    lsx
403 403
 	 * @subpackage extras
404 404
 	 */
405
-	function lsx_the_excerpt_filter( $excerpt ) {
405
+	function lsx_the_excerpt_filter($excerpt) {
406 406
 
407 407
 		$post_formats = array(
408 408
 			'aside'   => 'aside',
@@ -415,23 +415,23 @@  discard block
 block discarded – undo
415 415
 			'audio'   => 'audio',
416 416
 		);
417 417
 
418
-		$show_full_content = has_post_format( apply_filters( 'lsx_the_excerpt_filter_post_types', $post_formats ) );
418
+		$show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', $post_formats));
419 419
 
420
-		if ( ! $show_full_content ) {
421
-			if ( '' !== $excerpt && ! stristr( $excerpt, 'moretag' ) ) {
422
-				$pagination = wp_link_pages( array(
420
+		if ( ! $show_full_content) {
421
+			if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) {
422
+				$pagination = wp_link_pages(array(
423 423
 					'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
424 424
 					'after'       => '</div></div>',
425 425
 					'link_before' => '<span>',
426 426
 					'link_after'  => '</span>',
427 427
 					'echo'        => 0,
428
-				) );
428
+				));
429 429
 
430
-				if ( ! empty( $pagination ) ) {
430
+				if ( ! empty($pagination)) {
431 431
 					$excerpt .= $pagination;
432 432
 				} else {
433
-					$excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>';
434
-					$excerpt .= apply_filters( 'excerpt_more_p', $excerpt_more );
433
+					$excerpt_more = '<p><a class="moretag" href="' . esc_url(get_permalink()) . '">' . esc_html__('Read More', 'lsx') . '</a></p>';
434
+					$excerpt .= apply_filters('excerpt_more_p', $excerpt_more);
435 435
 				}
436 436
 			}
437 437
 		}
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 
442 442
 endif;
443 443
 
444
-add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 );
444
+add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20);
445 445
 
446
-if ( ! function_exists( 'lsx_full_width_widget_classes' ) ) :
446
+if ( ! function_exists('lsx_full_width_widget_classes')) :
447 447
 
448 448
 	/**
449 449
 	 * Filter sidebar widget params, to add the widget_lsx_full_width_alt or widget_lsx_full_width classes to the text widget.
@@ -451,8 +451,8 @@  discard block
 block discarded – undo
451 451
 	 * @package    lsx
452 452
 	 * @subpackage extras
453 453
 	 */
454
-	function lsx_full_width_widget_classes( $params ) {
455
-		if ( is_admin() ) {
454
+	function lsx_full_width_widget_classes($params) {
455
+		if (is_admin()) {
456 456
 			return $params;
457 457
 		}
458 458
 
@@ -461,9 +461,9 @@  discard block
 block discarded – undo
461 461
 		$widget_id   = $params[0]['widget_id'];
462 462
 		$widget_name = $params[0]['widget_name'];
463 463
 
464
-		if ( 'Text' === $widget_name ) {
465
-			$wp_registered_widgets[ $widget_id ]['original_callback'] = $wp_registered_widgets[ $widget_id ]['callback'];
466
-			$wp_registered_widgets[ $widget_id ]['callback'] = 'lsx_full_width_widget_custom_callback';
464
+		if ('Text' === $widget_name) {
465
+			$wp_registered_widgets[$widget_id]['original_callback'] = $wp_registered_widgets[$widget_id]['callback'];
466
+			$wp_registered_widgets[$widget_id]['callback'] = 'lsx_full_width_widget_custom_callback';
467 467
 		}
468 468
 
469 469
 		return $params;
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
 
472 472
 endif;
473 473
 
474
-add_filter( 'dynamic_sidebar_params', 'lsx_full_width_widget_classes' );
474
+add_filter('dynamic_sidebar_params', 'lsx_full_width_widget_classes');
475 475
 
476
-if ( ! function_exists( 'lsx_full_width_widget_custom_callback' ) ) :
476
+if ( ! function_exists('lsx_full_width_widget_custom_callback')) :
477 477
 
478 478
 	/**
479 479
 	 * Filter sidebar widget params, to add the widget_lsx_full_width_alt or widget_lsx_full_width classes to the text widget.
@@ -487,25 +487,25 @@  discard block
 block discarded – undo
487 487
 		$original_callback_params = func_get_args();
488 488
 		$widget_id = $original_callback_params[0]['widget_id'];
489 489
 
490
-		$original_callback = $wp_registered_widgets[ $widget_id ]['original_callback'];
491
-		$wp_registered_widgets[ $widget_id ]['callback'] = $original_callback;
490
+		$original_callback = $wp_registered_widgets[$widget_id]['original_callback'];
491
+		$wp_registered_widgets[$widget_id]['callback'] = $original_callback;
492 492
 
493
-		$widget_id_base = $wp_registered_widgets[ $widget_id ]['callback'][0]->id_base;
493
+		$widget_id_base = $wp_registered_widgets[$widget_id]['callback'][0]->id_base;
494 494
 
495 495
 		$widget_classname = '';
496 496
 
497
-		if ( is_callable( $original_callback ) ) {
497
+		if (is_callable($original_callback)) {
498 498
 			ob_start();
499
-			call_user_func_array( $original_callback, $original_callback_params );
499
+			call_user_func_array($original_callback, $original_callback_params);
500 500
 			$widget_output = ob_get_clean();
501 501
 
502
-			echo wp_kses_post( apply_filters( 'lsx_widget_output', $widget_output, $widget_id_base, $widget_classname, $widget_id ) );
502
+			echo wp_kses_post(apply_filters('lsx_widget_output', $widget_output, $widget_id_base, $widget_classname, $widget_id));
503 503
 		}
504 504
 	}
505 505
 
506 506
 endif;
507 507
 
508
-if ( ! function_exists( 'lsx_full_width_widget_output' ) ) :
508
+if ( ! function_exists('lsx_full_width_widget_output')) :
509 509
 
510 510
 	/**
511 511
 	 * Filter sidebar widget params, to add the widget_lsx_full_width_alt or widget_lsx_full_width classes to the text widget.
@@ -513,12 +513,12 @@  discard block
 block discarded – undo
513 513
 	 * @package    lsx
514 514
 	 * @subpackage extras
515 515
 	 */
516
-	function lsx_full_width_widget_output( $widget_output, $widget_id_base, $widget_id ) {
517
-		if ( 'text' === $widget_id_base ) {
518
-			if ( false !== strpos( $widget_output, '<div class="lsx-full-width-alt">' ) ) {
519
-				$widget_output = str_replace( 'class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width_alt"', $widget_output );
520
-			} elseif ( false !== strpos( $widget_output, '<div class="lsx-full-width">' ) ) {
521
-				$widget_output = str_replace( 'class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width"', $widget_output );
516
+	function lsx_full_width_widget_output($widget_output, $widget_id_base, $widget_id) {
517
+		if ('text' === $widget_id_base) {
518
+			if (false !== strpos($widget_output, '<div class="lsx-full-width-alt">')) {
519
+				$widget_output = str_replace('class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width_alt"', $widget_output);
520
+			} elseif (false !== strpos($widget_output, '<div class="lsx-full-width">')) {
521
+				$widget_output = str_replace('class="widget widget_text"', 'class="widget widget_text widget_lsx_full_width"', $widget_output);
522 522
 			}
523 523
 		}
524 524
 
@@ -527,13 +527,13 @@  discard block
 block discarded – undo
527 527
 
528 528
 endif;
529 529
 
530
-add_filter( 'lsx_widget_output', 'lsx_full_width_widget_output', 10, 3 );
530
+add_filter('lsx_widget_output', 'lsx_full_width_widget_output', 10, 3);
531 531
 
532 532
 /**
533 533
  * Check if the content has a restricted post format that needs to show a full excerpt.
534 534
  */
535 535
 function lsx_post_format_force_content_on_list() {
536
-	$post_formats = apply_filters( 'lsx_post_format_force_content_on_list',
536
+	$post_formats = apply_filters('lsx_post_format_force_content_on_list',
537 537
 		array(
538 538
 				'video' => 'video',
539 539
 				'audio' => 'audio',
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 			)
543 543
 	);
544 544
 	$return = false;
545
-	if ( ! has_post_format( $post_formats ) ) {
545
+	if ( ! has_post_format($post_formats)) {
546 546
 		$return = true;
547 547
 	}
548 548
 	return $return;
@@ -551,67 +551,67 @@  discard block
 block discarded – undo
551 551
 /**
552 552
  * Remove the Hentry Class Every
553 553
  */
554
-function lsx_remove_hentry( $classes ) {
555
-	if ( 'post' !== get_post_type() ) {
556
-		$classes = array_diff( $classes, array( 'hentry' ) );
554
+function lsx_remove_hentry($classes) {
555
+	if ('post' !== get_post_type()) {
556
+		$classes = array_diff($classes, array('hentry'));
557 557
 	}
558 558
 	return $classes;
559 559
 }
560
-add_filter( 'post_class','lsx_remove_hentry' );
560
+add_filter('post_class', 'lsx_remove_hentry');
561 561
 
562 562
 /**
563 563
  * Strip Excerpts.
564 564
  *
565 565
  */
566
-function lsx_strip_excerpt( $content ) {
567
-	if ( is_search() || is_archive() || ( is_blog_installed() && ! is_single() && ! is_page() ) ) {
568
-		$content = strip_shortcodes( $content );
569
-		$content = str_replace( ']]>', ']]&gt;', $content );
570
-		$content = strip_tags( $content );
566
+function lsx_strip_excerpt($content) {
567
+	if (is_search() || is_archive() || (is_blog_installed() && ! is_single() && ! is_page())) {
568
+		$content = strip_shortcodes($content);
569
+		$content = str_replace(']]>', ']]&gt;', $content);
570
+		$content = strip_tags($content);
571 571
 	}
572 572
 	return $content;
573 573
 }
574
-add_filter( 'the_content', 'lsx_strip_excerpt' );
574
+add_filter('the_content', 'lsx_strip_excerpt');
575 575
 
576 576
 /**
577 577
  * Disable Gutenberg for LSX Custom Post Tpes.
578 578
  *
579 579
  */
580
-function lsx_disable_gutenberg_product_type( $is_enabled, $post_type ) {
581
-	if ( 'testimonial' === $post_type || 'team' === $post_type || 'project' === $post_type ) {
580
+function lsx_disable_gutenberg_product_type($is_enabled, $post_type) {
581
+	if ('testimonial' === $post_type || 'team' === $post_type || 'project' === $post_type) {
582 582
 		return false;
583 583
 	}
584 584
 
585 585
 	return $is_enabled;
586 586
 }
587
-add_filter( 'gutenberg_add_edit_link_for_post_type', 'lsx_disable_gutenberg_product_type', 10, 2 );
587
+add_filter('gutenberg_add_edit_link_for_post_type', 'lsx_disable_gutenberg_product_type', 10, 2);
588 588
 
589 589
 /**
590 590
  * Add the "Blog" link to the breadcrumbs
591 591
  * @param $crumbs
592 592
  * @return array
593 593
  */
594
-function lsx_breadcrumbs_blog_link( $crumbs ) {
594
+function lsx_breadcrumbs_blog_link($crumbs) {
595 595
 
596
-	$show_on_front = get_option( 'show_on_front' );
596
+	$show_on_front = get_option('show_on_front');
597 597
 
598
-	if ( 'page' === $show_on_front && ( is_category() || is_tag() ) ) {
598
+	if ('page' === $show_on_front && (is_category() || is_tag())) {
599 599
 
600
-		$blog_page = get_option( 'page_for_posts' );
601
-		if ( false !== $blog_page && '' !== $blog_page ) {
600
+		$blog_page = get_option('page_for_posts');
601
+		if (false !== $blog_page && '' !== $blog_page) {
602 602
 
603 603
 			$new_crumbs = array();
604 604
 			$new_crumbs[0] = $crumbs[0];
605 605
 
606
-			if ( function_exists( 'woocommerce_breadcrumb' ) ) {
606
+			if (function_exists('woocommerce_breadcrumb')) {
607 607
 				$new_crumbs[1] = array(
608
-					0	=> get_the_title( $blog_page ),
609
-					1	=> get_permalink( $blog_page ),
608
+					0	=> get_the_title($blog_page),
609
+					1	=> get_permalink($blog_page),
610 610
 				);
611 611
 			} else {
612 612
 				$new_crumbs[1] = array(
613
-					'text'	=> get_the_title( $blog_page ),
614
-					'url'	=> get_permalink( $blog_page ),
613
+					'text'	=> get_the_title($blog_page),
614
+					'url'	=> get_permalink($blog_page),
615 615
 				);
616 616
 			}
617 617
 			$new_crumbs[2] = $crumbs[1];
@@ -621,5 +621,5 @@  discard block
 block discarded – undo
621 621
 	}
622 622
 	return $crumbs;
623 623
 }
624
-add_filter( 'wpseo_breadcrumb_links', 'lsx_breadcrumbs_blog_link', 30, 1 );
625
-add_filter( 'woocommerce_get_breadcrumb', 'lsx_breadcrumbs_blog_link', 30, 1 );
624
+add_filter('wpseo_breadcrumb_links', 'lsx_breadcrumbs_blog_link', 30, 1);
625
+add_filter('woocommerce_get_breadcrumb', 'lsx_breadcrumbs_blog_link', 30, 1);
Please login to merge, or discard this patch.