Completed
Push — master ( aa4fea...197921 )
by
unknown
03:08
created
inc/google-font-collection.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) return; // Exit if accessed directly
3 3
 /**
4 4
  * Google Font_Collection Class
5 5
 **/
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	**/
16 16
 	public function __construct($fonts)
17 17
 	{
18
-		if(empty($fonts))
18
+		if (empty($fonts))
19 19
 		{
20 20
 			//we didn't get the required data
21 21
 			return false;
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		// create fonts
25 25
 		foreach ($fonts as $key => $value) 
26 26
 		{	
27
-			if( empty( $value["system"] ) ){
27
+			if (empty($value["system"])) {
28 28
 				$this->fonts[$value["title"]] = new LSX_Google_Font($value["title"], $value["location"], $value["cssDeclaration"], $value["cssClass"]);
29 29
 			}
30 30
 		}
@@ -106,9 +106,9 @@  discard block
 block discarded – undo
106 106
 		foreach ($this->fonts as $key => $value) 
107 107
 		{
108 108
 			$protocol = 'http';
109
-			if(is_ssl()){ $protocol.='s'; }
109
+			if (is_ssl()) { $protocol .= 's'; }
110 110
 			?>
111
-			<link href="<?php echo esc_attr( $protocol ); ?>://fonts.googleapis.com/css?family=<?php echo esc_attr( $value->__get( "location" ) ); ?>" rel='stylesheet'>
111
+			<link href="<?php echo esc_attr($protocol); ?>://fonts.googleapis.com/css?family=<?php echo esc_attr($value->__get("location")); ?>" rel='stylesheet'>
112 112
 			<?php
113 113
 		}
114 114
 	}
@@ -125,8 +125,8 @@  discard block
 block discarded – undo
125 125
 			foreach ($this->fonts as $key => $value) 
126 126
 			{
127 127
 				?>
128
-				.<?php echo esc_attr( $value->__get( "cssClass" ) ); ?>{
129
-					font-family: <?php echo esc_attr( $value->__get( "cssDeclaration" ) ); ?>;
128
+				.<?php echo esc_attr($value->__get("cssClass")); ?>{
129
+					font-family: <?php echo esc_attr($value->__get("cssDeclaration")); ?>;
130 130
 				}
131 131
 				<?php
132 132
 			}
Please login to merge, or discard this patch.
inc/jetpack.php 1 patch
Spacing   +100 added lines, -100 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function lsx_allowed_related_post_types($allowed_post_types) {
21 21
 	$allowed_post_types[] = 'jetpack-portfolio';
22
-	foreach($allowed_post_types as $key => $value){
23
-		if('page' == $value){
22
+	foreach ($allowed_post_types as $key => $value) {
23
+		if ('page' == $value) {
24 24
 			unset($allowed_post_types[$key]);
25 25
 		}
26 26
 	}
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
  * @category site-logo
36 36
  */
37 37
 
38
-function lsx_site_logo_title_tag( $html) {
38
+function lsx_site_logo_title_tag($html) {
39 39
 
40
-	$html = str_replace('<a', '<a title="'.get_bloginfo('name').'" ', $html);
40
+	$html = str_replace('<a', '<a title="' . get_bloginfo('name') . '" ', $html);
41 41
 	return $html;
42 42
 }
43
-add_filter( 'jetpack_the_site_logo', 'lsx_site_logo_title_tag');
43
+add_filter('jetpack_the_site_logo', 'lsx_site_logo_title_tag');
44 44
 
45 45
 
46 46
 /*
@@ -54,19 +54,19 @@  discard block
 block discarded – undo
54 54
  * @subpackage jetpack
55 55
  * @category portfolio
56 56
  */
57
-function lsx_portfolio_infinite_scroll(){
58
-	global $_wp_theme_features,$wp_query;
57
+function lsx_portfolio_infinite_scroll() {
58
+	global $_wp_theme_features, $wp_query;
59 59
 
60
-	if(is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')){
60
+	if (is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')) {
61 61
 		
62
-		if(class_exists('The_Neverending_Home_Page')){
62
+		if (class_exists('The_Neverending_Home_Page')) {
63 63
 			$_wp_theme_features['infinite-scroll'][0]['container'] = 'portfolio-infinite-scroll-wrapper';
64 64
 			$_wp_theme_features['infinite-scroll'][0]['posts_per_page'] = 99;
65 65
 		}
66 66
 	}
67 67
 
68 68
 }
69
-add_action('wp_head','lsx_portfolio_infinite_scroll',1000);
69
+add_action('wp_head', 'lsx_portfolio_infinite_scroll', 1000);
70 70
 
71 71
 /**
72 72
  * Disables the infinite scroll on the portfolio archive
@@ -75,13 +75,13 @@  discard block
 block discarded – undo
75 75
  * @subpackage jetpack
76 76
  * @category portfolio
77 77
  */
78
-function lsx_portfolio_infinite_scroll_disable($supported){
79
-	if(is_post_type_archive('jetpack-portfolio')){
78
+function lsx_portfolio_infinite_scroll_disable($supported) {
79
+	if (is_post_type_archive('jetpack-portfolio')) {
80 80
 		$supported = false;
81 81
 	}
82 82
 	return $supported;
83 83
 }
84
-add_filter( 'infinite_scroll_archive_supported', 'lsx_portfolio_infinite_scroll_disable', 1, 10 );
84
+add_filter('infinite_scroll_archive_supported', 'lsx_portfolio_infinite_scroll_disable', 1, 10);
85 85
 
86 86
 /**
87 87
  * Set the Portfolio to 9 posts per page
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
  * @subpackage jetpack
91 91
  * @category portfolio
92 92
 */
93
-function lsx_portfolio_archive_pagination( $query ) {
94
-	if(!is_admin()){
95
-		if ( $query->is_post_type_archive(array('jetpack-portfolio')) && $query->is_main_query() && class_exists('The_Neverending_Home_Page')) {
96
-			$query->set( 'posts_per_page', -1 );
93
+function lsx_portfolio_archive_pagination($query) {
94
+	if ( ! is_admin()) {
95
+		if ($query->is_post_type_archive(array('jetpack-portfolio')) && $query->is_main_query() && class_exists('The_Neverending_Home_Page')) {
96
+			$query->set('posts_per_page', -1);
97 97
 		}
98 98
 	}
99 99
 }
100
-add_action( 'pre_get_posts', 'lsx_portfolio_archive_pagination' , 100 );
100
+add_action('pre_get_posts', 'lsx_portfolio_archive_pagination', 100);
101 101
 
102 102
 /**
103 103
  * Remove the related posts from below the content area.
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
  * @category portfolio
108 108
  */
109 109
 function lsx_remove_portfolio_related_posts() {
110
-	if ( is_single() && 'jetpack-portfolio' == get_post_type() && class_exists( 'Jetpack_RelatedPosts' ) ) {
110
+	if (is_single() && 'jetpack-portfolio' == get_post_type() && class_exists('Jetpack_RelatedPosts')) {
111 111
 		$jprp = Jetpack_RelatedPosts::init();
112
-		$callback = array( $jprp, 'filter_add_target_to_dom' );
113
-		remove_filter( 'the_content', $callback, 40 );
112
+		$callback = array($jprp, 'filter_add_target_to_dom');
113
+		remove_filter('the_content', $callback, 40);
114 114
 	}
115 115
 }
116
-add_filter( 'wp', 'lsx_remove_portfolio_related_posts', 20 );
116
+add_filter('wp', 'lsx_remove_portfolio_related_posts', 20);
117 117
 
118 118
 /**
119 119
  * Remove the related posts from below the content area.
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
  * @category portfolio
124 124
  */
125 125
 function lsx_remove_single_related_posts() {
126
-    if ( is_single() && class_exists( 'Jetpack_RelatedPosts' ) ) {
126
+    if (is_single() && class_exists('Jetpack_RelatedPosts')) {
127 127
         $jprp = Jetpack_RelatedPosts::init();
128
-        $callback = array( $jprp, 'filter_add_target_to_dom' );
129
-        remove_filter( 'the_content', $callback, 40 );
128
+        $callback = array($jprp, 'filter_add_target_to_dom');
129
+        remove_filter('the_content', $callback, 40);
130 130
     }
131 131
 }
132
-add_filter( 'wp', 'lsx_remove_single_related_posts', 20 );
132
+add_filter('wp', 'lsx_remove_single_related_posts', 20);
133 133
 
134 134
 /**
135 135
  * A template tag to call the Portfolios Related posts
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
  * @subpackage jetpack
139 139
  * @category portfolio
140 140
  */
141
-function lsx_portfolio_related_posts(){
142
-	if(class_exists('Jetpack_RelatedPosts')){ ?>
141
+function lsx_portfolio_related_posts() {
142
+	if (class_exists('Jetpack_RelatedPosts')) { ?>
143 143
 		<div class="row">
144 144
 			<div class="col-md-12">
145 145
 				<?php echo do_shortcode('[jetpack-related-posts]'); ?>
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
  * @category portfolio
157 157
  */
158 158
 function lsx_portfolio_remove_share() {
159
-	if ( ( is_single() && 'jetpack-portfolio' == get_post_type() ) || is_page_template( 'page-templates/template-portfolio.php' ) ) {
160
-		remove_filter( 'the_content', 'sharing_display',19 );
161
-		remove_filter( 'the_excerpt', 'sharing_display',19 );
159
+	if ((is_single() && 'jetpack-portfolio' == get_post_type()) || is_page_template('page-templates/template-portfolio.php')) {
160
+		remove_filter('the_content', 'sharing_display', 19);
161
+		remove_filter('the_excerpt', 'sharing_display', 19);
162 162
 
163
-		if ( class_exists( 'Jetpack_Likes' ) ) {
164
-			remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
163
+		if (class_exists('Jetpack_Likes')) {
164
+			remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1);
165 165
 		}
166 166
 	}
167 167
 }
168
-add_action( 'loop_start', 'lsx_portfolio_remove_share' );
168
+add_action('loop_start', 'lsx_portfolio_remove_share');
169 169
 
170 170
 /**
171 171
  * Remove the sharing from single
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
  * @category post
176 176
  */
177 177
 function lsx_single_remove_share() {
178
-	if ( is_single() ) {
179
-		remove_filter( 'the_content', 'sharing_display',19 );
180
-		remove_filter( 'the_excerpt', 'sharing_display',19 );
178
+	if (is_single()) {
179
+		remove_filter('the_content', 'sharing_display', 19);
180
+		remove_filter('the_excerpt', 'sharing_display', 19);
181 181
 
182
-		if ( class_exists( 'Jetpack_Likes' ) ) {
183
-			remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 );
182
+		if (class_exists('Jetpack_Likes')) {
183
+			remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1);
184 184
 		}
185 185
 	}
186 186
 }
187
-add_action( 'loop_start', 'lsx_single_remove_share' );
187
+add_action('loop_start', 'lsx_single_remove_share');
188 188
 
189 189
 /**
190 190
  * Redirect the template archive to our one
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
  * @subpackage jetpack
194 194
  * @category portfolio
195 195
 */
196
-function lsx_portfolio_taxonomy_template( $template ) {
196
+function lsx_portfolio_taxonomy_template($template) {
197 197
 
198
-	if ( is_tax(array('jetpack-portfolio-type','jetpack-portfolio-tag'))  ) {
199
-		$new_template = locate_template( array( 'archive-jetpack-portfolio.php' ) );
200
-		if ( '' != $new_template ) {
201
-			return $new_template ;
198
+	if (is_tax(array('jetpack-portfolio-type', 'jetpack-portfolio-tag'))) {
199
+		$new_template = locate_template(array('archive-jetpack-portfolio.php'));
200
+		if ('' != $new_template) {
201
+			return $new_template;
202 202
 		}
203 203
 	}
204 204
 
205 205
 	return $template;
206 206
 }
207
-add_filter( 'template_include', 'lsx_portfolio_taxonomy_template', 99 );
207
+add_filter('template_include', 'lsx_portfolio_taxonomy_template', 99);
208 208
 
209 209
 
210 210
 /**
@@ -214,35 +214,35 @@  discard block
 block discarded – undo
214 214
  * @subpackage jetpack
215 215
  * @category portfolio
216 216
  */
217
-add_action( 'add_meta_boxes', 'lsx_add_portfolio_post_meta_boxes' );
218
-add_action( 'save_post', 'lsx_save_portfolio_post_meta', 100, 2 );
217
+add_action('add_meta_boxes', 'lsx_add_portfolio_post_meta_boxes');
218
+add_action('save_post', 'lsx_save_portfolio_post_meta', 100, 2);
219 219
 
220
-function lsx_save_portfolio_post_meta( $post_id, $post ) {
221
-	check_admin_referer( 'lsx_save_portfolio', '_lsx_client_nonce' );
222
-	check_admin_referer( 'lsx_save_portfolio', '_lsx_website_nonce' );
220
+function lsx_save_portfolio_post_meta($post_id, $post) {
221
+	check_admin_referer('lsx_save_portfolio', '_lsx_client_nonce');
222
+	check_admin_referer('lsx_save_portfolio', '_lsx_website_nonce');
223 223
 
224
-	$post_type = get_post_type_object( $post->post_type );
224
+	$post_type = get_post_type_object($post->post_type);
225 225
 
226
-	if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
226
+	if ( ! current_user_can($post_type->cap->edit_post, $post_id))
227 227
 		return $post_id;
228 228
 
229 229
 
230
-	$meta_keys = array('lsx-website','lsx-client');
230
+	$meta_keys = array('lsx-website', 'lsx-client');
231 231
 
232
-	foreach($meta_keys as $meta_key){
233
-		$new_meta_value = sanitize_text_field( wp_unslash( $_POST[$meta_key] ) );
234
-		$new_meta_value = ! empty( $new_meta_value ) ? $new_meta_value : '';
232
+	foreach ($meta_keys as $meta_key) {
233
+		$new_meta_value = sanitize_text_field(wp_unslash($_POST[$meta_key]));
234
+		$new_meta_value = ! empty($new_meta_value) ? $new_meta_value : '';
235 235
 
236
-		$meta_value = get_post_meta( $post_id, $meta_key, true );
236
+		$meta_value = get_post_meta($post_id, $meta_key, true);
237 237
 
238
-		if ( $new_meta_value && '' == $meta_value )
239
-			add_post_meta( $post_id, $meta_key, $new_meta_value, true );
238
+		if ($new_meta_value && '' == $meta_value)
239
+			add_post_meta($post_id, $meta_key, $new_meta_value, true);
240 240
 
241
-		elseif ( $new_meta_value && $new_meta_value != $meta_value )
242
-		update_post_meta( $post_id, $meta_key, $new_meta_value );
241
+		elseif ($new_meta_value && $new_meta_value != $meta_value)
242
+		update_post_meta($post_id, $meta_key, $new_meta_value);
243 243
 
244
-		elseif ( '' == $new_meta_value && $meta_value )
245
-		delete_post_meta( $post_id, $meta_key, $meta_value );
244
+		elseif ('' == $new_meta_value && $meta_value)
245
+		delete_post_meta($post_id, $meta_key, $meta_value);
246 246
 
247 247
 	}
248 248
 }
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 
252 252
 	add_meta_box(
253 253
 	'lsx_client_meta_box',
254
-	esc_html__( 'Client', 'lsx' ),
254
+	esc_html__('Client', 'lsx'),
255 255
 	'lsx_client_meta_box',
256 256
 	'jetpack-portfolio',
257 257
 	'side',
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 
261 261
 	add_meta_box(
262 262
 	'lsx_website_meta_box',
263
-	esc_html__( 'Website', 'lsx' ),
263
+	esc_html__('Website', 'lsx'),
264 264
 	'lsx_website_meta_box',
265 265
 	'jetpack-portfolio',
266 266
 	'side',
@@ -268,25 +268,25 @@  discard block
 block discarded – undo
268 268
 			);
269 269
 }
270 270
 
271
-function lsx_client_meta_box( $object, $box ) { ?>
271
+function lsx_client_meta_box($object, $box) { ?>
272 272
 
273
-  <?php wp_nonce_field( 'lsx_save_portfolio', '_lsx_client_nonce' ); ?>
273
+  <?php wp_nonce_field('lsx_save_portfolio', '_lsx_client_nonce'); ?>
274 274
 
275 275
   <p>
276
-    <input class="widefat" type="text" name="lsx-client" id="lsx-client" value="<?php echo esc_attr( get_post_meta( $object->ID, 'lsx-client', true ) ); ?>" size="30" />
276
+    <input class="widefat" type="text" name="lsx-client" id="lsx-client" value="<?php echo esc_attr(get_post_meta($object->ID, 'lsx-client', true)); ?>" size="30" />
277 277
     <br /><br />
278
-    <label for="lsx-client"><?php esc_html_e( 'Enter the name of the project client', 'lsx' ); ?></label>
278
+    <label for="lsx-client"><?php esc_html_e('Enter the name of the project client', 'lsx'); ?></label>
279 279
   </p>
280 280
 <?php }
281 281
 
282
-function lsx_website_meta_box( $object, $box ) { ?>
282
+function lsx_website_meta_box($object, $box) { ?>
283 283
 
284
-  <?php wp_nonce_field( 'lsx_save_portfolio', '_lsx_website_nonce' ); ?>
284
+  <?php wp_nonce_field('lsx_save_portfolio', '_lsx_website_nonce'); ?>
285 285
 
286 286
   <p>
287
-    <input class="widefat" type="text" name="lsx-website" id="lsx-website" value="<?php echo esc_attr( get_post_meta( $object->ID, 'lsx-website', true ) ); ?>" size="30" />
287
+    <input class="widefat" type="text" name="lsx-website" id="lsx-website" value="<?php echo esc_attr(get_post_meta($object->ID, 'lsx-website', true)); ?>" size="30" />
288 288
     <br /><br />
289
-    <label for="lsx-website"><?php esc_html_e( 'Enter the URL of the project website', 'lsx' ); ?></label>
289
+    <label for="lsx-website"><?php esc_html_e('Enter the URL of the project website', 'lsx'); ?></label>
290 290
   </p>
291 291
 <?php }
292 292
 
@@ -299,18 +299,18 @@  discard block
 block discarded – undo
299 299
  * @category portfolio
300 300
  */   
301 301
 
302
-function lsx_portfolio_sorter(){ ?>
302
+function lsx_portfolio_sorter() { ?>
303 303
 	<ul id="filterNav" class="clearfix">
304
-		<li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'lsx' ); ?></a></li>
304
+		<li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e('All', 'lsx'); ?></a></li>
305 305
 		<?php 
306 306
 		$types = get_terms('jetpack-portfolio-type');
307 307
 		
308
-		if(is_array($types)){
308
+		if (is_array($types)) {
309 309
 			foreach ($types as $type) {
310
-				$content = '<li><a href="#" data-filter=".'.$type->slug.'">';
310
+				$content = '<li><a href="#" data-filter=".' . $type->slug . '">';
311 311
 		    	$content .= $type->name;					
312 312
 				$content .= '</a></li>';
313
-				echo wp_kses_post( $content );
313
+				echo wp_kses_post($content);
314 314
 				echo "\n";
315 315
 			}
316 316
 		}?>
@@ -325,18 +325,18 @@  discard block
 block discarded – undo
325 325
  * @category portfolio
326 326
  */
327 327
 
328
-function lsx_portfolio_naviagtion_labels($labels){ 
328
+function lsx_portfolio_naviagtion_labels($labels) { 
329 329
 	
330
-	if(is_post_type_archive('jetpack-portfolio')){
330
+	if (is_post_type_archive('jetpack-portfolio')) {
331 331
 		$labels = array(
332
-				'next' 		=> '<span class="meta-nav">&larr;</span> '.__( 'Older', 'lsx' ),
333
-				'previous' 	=> __( 'Newer', 'lsx' ).' <span class="meta-nav">&rarr;</span>',
334
-				'title' 	=> __( 'Portfolio navigation', 'lsx' )
332
+				'next' 		=> '<span class="meta-nav">&larr;</span> ' . __('Older', 'lsx'),
333
+				'previous' 	=> __('Newer', 'lsx') . ' <span class="meta-nav">&rarr;</span>',
334
+				'title' 	=> __('Portfolio navigation', 'lsx')
335 335
 		);
336 336
 	}
337 337
 	return $labels;
338 338
 }
339
-add_filter('lsx_post_navigation_labels','lsx_portfolio_naviagtion_labels',1,10);
339
+add_filter('lsx_post_navigation_labels', 'lsx_portfolio_naviagtion_labels', 1, 10);
340 340
 
341 341
 
342 342
 /*
@@ -350,11 +350,11 @@  discard block
 block discarded – undo
350 350
  * @subpackage jetpack
351 351
  * @category related-posts
352 352
  */
353
-function lsx_remove_related_post_context(){
354
-	add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' );
355
-	add_filter( 'rest_api_allowed_post_types', 'lsx_allowed_related_post_types' );
353
+function lsx_remove_related_post_context() {
354
+	add_filter('jetpack_relatedposts_filter_post_context', '__return_empty_string');
355
+	add_filter('rest_api_allowed_post_types', 'lsx_allowed_related_post_types');
356 356
 }
357
-add_action('init','lsx_remove_related_post_context',20);
357
+add_action('init', 'lsx_remove_related_post_context', 20);
358 358
 
359 359
 
360 360
 /*
@@ -371,13 +371,13 @@  discard block
 block discarded – undo
371 371
 	$infinite_scroll_args = array(
372 372
 			'container' => 'main',
373 373
 			'type' => 'click',
374
-			'posts_per_page' => get_option('posts_per_page',10),
374
+			'posts_per_page' => get_option('posts_per_page', 10),
375 375
 			'render'    => 'lsx_infinite_scroll_render'
376 376
 	);
377 377
 
378
-	add_theme_support( 'infinite-scroll', $infinite_scroll_args );
378
+	add_theme_support('infinite-scroll', $infinite_scroll_args);
379 379
 }
380
-add_action( 'after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup' );
380
+add_action('after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup');
381 381
 
382 382
 /**
383 383
  * Set the code to be rendered on for calling posts,
@@ -390,13 +390,13 @@  discard block
 block discarded – undo
390 390
  function lsx_infinite_scroll_render() {
391 391
 	global $wp_query;
392 392
 	
393
-	while(have_posts()){
393
+	while (have_posts()) {
394 394
 		the_post();
395 395
 		
396
-		if('jetpack-portfolio' == get_post_type()){
397
-			get_template_part( 'content', 'portfolio' );
398
-		}else{
399
-			get_template_part( 'content', get_post_type() );
396
+		if ('jetpack-portfolio' == get_post_type()) {
397
+			get_template_part('content', 'portfolio');
398
+		} else {
399
+			get_template_part('content', get_post_type());
400 400
 		}
401 401
 	}
402 402
  }
@@ -408,8 +408,8 @@  discard block
 block discarded – undo
408 408
  * @subpackage jetpack
409 409
  * @category related posts
410 410
  */
411
-function lsx_related_posts_headline( $headline ) {
412
-	$headline = sprintf( '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html( 'Related Posts' ) );
411
+function lsx_related_posts_headline($headline) {
412
+	$headline = sprintf('<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html('Related Posts'));
413 413
 	return $headline;
414 414
 }
415
-add_filter( 'jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline' );
415
+add_filter('jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline');
Please login to merge, or discard this patch.
inc/lazyload.php 1 patch
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) return;
2
+if ( ! defined('ABSPATH')) return;
3 3
 
4 4
 /*
5 5
  * LSX Lazy Load Images Class
@@ -25,141 +25,141 @@  discard block
 block discarded – undo
25 25
 	protected static $noscripts   = array();
26 26
 
27 27
 	static function init() {
28
-		if ( is_admin() )
28
+		if (is_admin())
29 29
 			return;
30 30
 
31
-		if ( get_theme_mod( 'lsx_lazyload_status', '1' ) === false ) {
31
+		if (get_theme_mod('lsx_lazyload_status', '1') === false) {
32 32
 			self::$enabled = false;
33 33
 			return;
34 34
 		}
35 35
 
36
-		if ( ! apply_filters( 'lsx_lazyload_is_enabled', true ) ) {
36
+		if ( ! apply_filters('lsx_lazyload_is_enabled', true)) {
37 37
 			self::$enabled = false;
38 38
 			return;
39 39
 		}
40 40
 
41
-		add_action( 'wp_enqueue_scripts', array( __CLASS__, 'add_scripts' ) );
42
-		add_action( 'wp_head', array( __CLASS__, 'setup_filters' ), 9999 );
41
+		add_action('wp_enqueue_scripts', array(__CLASS__, 'add_scripts'));
42
+		add_action('wp_head', array(__CLASS__, 'setup_filters'), 9999);
43 43
 	}
44 44
 
45 45
 	static function setup_filters() {
46 46
 		// WordPress
47
-		add_filter( 'the_content', array( __CLASS__, 'filter_images' ), 200 );
48
-		add_filter( 'widget_text', array( __CLASS__, 'filter_images' ), 200 );
49
-		add_filter( 'post_thumbnail_html', array( __CLASS__, 'filter_images' ), 200 );
50
-		add_filter( 'get_avatar', array( __CLASS__, 'filter_images' ), 200 );
47
+		add_filter('the_content', array(__CLASS__, 'filter_images'), 200);
48
+		add_filter('widget_text', array(__CLASS__, 'filter_images'), 200);
49
+		add_filter('post_thumbnail_html', array(__CLASS__, 'filter_images'), 200);
50
+		add_filter('get_avatar', array(__CLASS__, 'filter_images'), 200);
51 51
 		
52 52
 		// LSX
53
-		add_filter( 'lsx_lazyload_filter_images', array( __CLASS__, 'filter_images' ), 200 );
53
+		add_filter('lsx_lazyload_filter_images', array(__CLASS__, 'filter_images'), 200);
54 54
 
55 55
 		// Envira Gallery
56
-		add_filter( 'envira_gallery_output_image', array( __CLASS__, 'filter_images' ), 200 );
56
+		add_filter('envira_gallery_output_image', array(__CLASS__, 'filter_images'), 200);
57 57
 	}
58 58
 
59 59
 	static function add_scripts() {
60
-		wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/lazysizes.min.js', array( 'jquery' ), null, true );
60
+		wp_enqueue_script('lazysizes', get_template_directory_uri() . '/js/vendor/lazysizes.min.js', array('jquery'), null, true);
61 61
 		// Plugin that enables use lazysizes in brackground images
62 62
 		//wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/ls.unveilhooks.min.js', array( 'jquery', 'lazysizes' ), null, true );
63 63
 	}
64 64
 
65
-	static function filter_images( $content ) {
66
-		if ( ! self::is_enabled() ) {
65
+	static function filter_images($content) {
66
+		if ( ! self::is_enabled()) {
67 67
 			return $content;
68 68
 		}
69 69
 
70
-		$http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
71
-		$http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : '';
70
+		$http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']));
71
+		$http_user_agent = ! empty($http_user_agent) ? $http_user_agent : '';
72 72
 
73
-		if ( is_feed()
73
+		if (is_feed()
74 74
 			|| is_preview()
75
-			|| intval( get_query_var( 'print' ) ) == 1
76
-			|| intval( get_query_var( 'printpage' ) ) == 1
77
-			|| strpos( $http_user_agent, 'Opera Mini' ) !== false
75
+			|| intval(get_query_var('print')) == 1
76
+			|| intval(get_query_var('printpage')) == 1
77
+			|| strpos($http_user_agent, 'Opera Mini') !== false
78 78
 		) {
79 79
 			return $content;
80 80
 		}
81 81
 
82 82
 		$skip_images_regex = '/class=".*(lazyload|disable-lazyload).*"/';
83
-		$placeholder_image = apply_filters( 'lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' );
83
+		$placeholder_image = apply_filters('lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==');
84 84
 
85 85
 		$matches = array();
86 86
 		$search = array();
87 87
 		$replace = array();
88 88
 		
89
-		$content = preg_replace_callback( '~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content );
90
-		preg_match_all( '/<img[^>]*>/', $content, $matches );
89
+		$content = preg_replace_callback('~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content);
90
+		preg_match_all('/<img[^>]*>/', $content, $matches);
91 91
 
92
-		foreach ( $matches[0] as $img_html ) {
93
-			if ( ! ( preg_match( $skip_images_regex, $img_html ) ) ) {
92
+		foreach ($matches[0] as $img_html) {
93
+			if ( ! (preg_match($skip_images_regex, $img_html))) {
94 94
 				$add_class = false;
95 95
 
96
-				if ( ! preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) && preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) {
97
-					$replace_html = preg_replace( '/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html );
96
+				if ( ! preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html) && preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) {
97
+					$replace_html = preg_replace('/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html);
98 98
 
99
-					if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) {
100
-						$replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html );
99
+					if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) {
100
+						$replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html);
101 101
 					} else {
102
-						$replace_html = preg_replace( '/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html );
102
+						$replace_html = preg_replace('/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html);
103 103
 					}
104 104
 
105 105
 					$add_class = true;
106
-				} elseif ( preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) ) {
107
-					$replace_html = preg_replace( '/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html );
106
+				} elseif (preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html)) {
107
+					$replace_html = preg_replace('/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html);
108 108
 
109
-					if ( preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) {
110
-						if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) {
111
-							$replace_html = preg_replace( '/srcset=/i', 'data-srcset=', $replace_html );
112
-							$replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html );
109
+					if (preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) {
110
+						if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) {
111
+							$replace_html = preg_replace('/srcset=/i', 'data-srcset=', $replace_html);
112
+							$replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html);
113 113
 						} else {
114
-							$replace_html = preg_replace( '/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html );
114
+							$replace_html = preg_replace('/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html);
115 115
 						}
116 116
 					}
117 117
 
118 118
 					$add_class = true;
119 119
 				}
120 120
 
121
-				if ( $add_class ) {
122
-					$replace_html = self::add_class( $replace_html, 'lazyload' );
121
+				if ($add_class) {
122
+					$replace_html = self::add_class($replace_html, 'lazyload');
123 123
 					$replace_html .= '<noscript>' . $img_html . '</noscript>';
124 124
 					
125
-					array_push( $search, $img_html );
126
-					array_push( $replace, $replace_html );
125
+					array_push($search, $img_html);
126
+					array_push($replace, $replace_html);
127 127
 				}
128 128
 			}
129 129
 		}
130 130
 
131
-		$content = str_replace( $search, $replace, $content );
132
-		$content = preg_replace_callback( '~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content );
131
+		$content = str_replace($search, $replace, $content);
132
+		$content = preg_replace_callback('~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content);
133 133
 		return $content;
134 134
 	}
135 135
 
136
-	static function noscripts_remove( $match ) {
136
+	static function noscripts_remove($match) {
137 137
 		self::$noscript_id++;
138 138
 		self::$noscripts[self::$noscript_id] = $match[0];
139 139
 		return chr(20) . self::$noscript_id . chr(20);
140 140
 	}
141 141
 
142
-	static function noscripts_restore( $match ) {
142
+	static function noscripts_restore($match) {
143 143
 		return self::$noscripts[(int) $match[1]];
144 144
 	}
145 145
 
146
-	static function add_class( $html_string = '', $new_class ) {
146
+	static function add_class($html_string = '', $new_class) {
147 147
 		$pattern = '/class=[\'"]([^\'"]*)[\'"]/';
148 148
 
149
-		if ( preg_match( $pattern, $html_string, $matches ) ) {
150
-			$defined_classes = explode( ' ', $matches[1] );
149
+		if (preg_match($pattern, $html_string, $matches)) {
150
+			$defined_classes = explode(' ', $matches[1]);
151 151
 
152
-			if ( ! in_array( $new_class, $defined_classes ) ) {
152
+			if ( ! in_array($new_class, $defined_classes)) {
153 153
 				$defined_classes[] = $new_class;
154 154
 
155 155
 				$html_string = str_replace(
156 156
 					$matches[0],
157
-					sprintf( 'class="%s"', implode( ' ', $defined_classes ) ),
157
+					sprintf('class="%s"', implode(' ', $defined_classes)),
158 158
 					$html_string
159 159
 				);
160 160
 			}
161 161
 		} else {
162
-			$html_string = preg_replace( '/(\<.+\s)/', sprintf( '$1class="%s" ', $new_class ), $html_string );
162
+			$html_string = preg_replace('/(\<.+\s)/', sprintf('$1class="%s" ', $new_class), $html_string);
163 163
 		}
164 164
 
165 165
 		return $html_string;
@@ -170,4 +170,4 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 }
172 172
 
173
-add_action( 'init', array( 'LSX_LazyLoadImages', 'init' ) );
173
+add_action('init', array('LSX_LazyLoadImages', 'init'));
Please login to merge, or discard this patch.
inc/layout.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) return; // Exit if accessed directly
3 3
 
4 4
 /**
5 5
  * Layout hooks
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  * @package lsx
8 8
  */
9 9
 
10
-function lsx_layout_selector( $class, $area = 'site' ) {
10
+function lsx_layout_selector($class, $area = 'site') {
11 11
 
12
-	$layout = get_theme_mod('lsx_layout','2cr');
13
-	$layout = apply_filters( 'lsx_layout', $layout );
12
+	$layout = get_theme_mod('lsx_layout', '2cr');
13
+	$layout = apply_filters('lsx_layout', $layout);
14 14
 
15 15
 	$default_size = 'sm';
16
-	$size = apply_filters( 'lsx_bootstrap_column_size', $default_size );
16
+	$size = apply_filters('lsx_bootstrap_column_size', $default_size);
17 17
 
18
-	switch ( $layout ) {
18
+	switch ($layout) {
19 19
 		case '1c':
20 20
 			$main_class = 'col-' . $size . '-12';
21 21
 			$sidebar_class = 'col-' . $size . '-12';
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 			break;
35 35
 	}
36 36
 
37
-	if ( $class == 'main' ) {
37
+	if ($class == 'main') {
38 38
 		return $main_class;
39 39
 	}
40 40
 
41
-	if ( $class == 'sidebar' ) {
41
+	if ($class == 'sidebar') {
42 42
 		return $sidebar_class;
43 43
 	}
44 44
 }
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
  * .main classes
48 48
  */
49 49
 function lsx_main_class() {
50
-	return lsx_layout_selector( 'main' );
50
+	return lsx_layout_selector('main');
51 51
 }
52 52
 
53 53
 function lsx_home_main_class() {
54
-	return lsx_layout_selector( 'main', 'home' );
54
+	return lsx_layout_selector('main', 'home');
55 55
 }
56 56
 
57 57
 /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
 function lsx_index_main_class() {
61 61
 
62 62
 	$show_on_front = get_option('show_on_front');
63
-	if('page' == $show_on_front){
64
-		return lsx_layout_selector( 'main', 'home' );
65
-	}else{
66
-		return lsx_layout_selector( 'main', 'site' );
63
+	if ('page' == $show_on_front) {
64
+		return lsx_layout_selector('main', 'home');
65
+	} else {
66
+		return lsx_layout_selector('main', 'site');
67 67
 	}
68 68
 
69 69
 }
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
  * .sidebar classes
73 73
  */
74 74
 function lsx_sidebar_class() {
75
-	return lsx_layout_selector( 'sidebar' );
75
+	return lsx_layout_selector('sidebar');
76 76
 }
77 77
 
78 78
 function lsx_home_sidebar_class() {
79
-	return lsx_layout_selector( 'sidebar', 'home' );
79
+	return lsx_layout_selector('sidebar', 'home');
80 80
 }
81 81
 
82 82
 /**
@@ -91,15 +91,15 @@  discard block
 block discarded – undo
91 91
 	$classes = 'banner navbar navbar-default';
92 92
 	
93 93
 	//Fixed header
94
-	$fixed_header = get_theme_mod('lsx_header_fixed',false);
95
-	if(false != $fixed_header){
94
+	$fixed_header = get_theme_mod('lsx_header_fixed', false);
95
+	if (false != $fixed_header) {
96 96
 		$classes .= ' navbar-static-top';
97 97
 	}
98 98
 	
99
-	if(false != $additional){
100
-		$classes .= ' '.$additional;
99
+	if (false != $additional) {
100
+		$classes .= ' ' . $additional;
101 101
 	}
102
-	echo esc_attr( $classes );
102
+	echo esc_attr($classes);
103 103
 }
104 104
 
105 105
 /**
@@ -114,37 +114,37 @@  discard block
 block discarded – undo
114 114
 	$classes = 'top-menu-default';
115 115
 	
116 116
 	//Fixed header
117
-	$fixed_header = get_theme_mod('lsx_header_fixed',false);
118
-	if(false != $fixed_header){
117
+	$fixed_header = get_theme_mod('lsx_header_fixed', false);
118
+	if (false != $fixed_header) {
119 119
 		$classes .= ' top-menu-fixed';
120 120
 	}
121 121
 	
122
-	if(false != $additional){
123
-		$classes .= ' '.$additional;
122
+	if (false != $additional) {
123
+		$classes .= ' ' . $additional;
124 124
 	}
125
-	echo esc_attr( $classes );
125
+	echo esc_attr($classes);
126 126
 }
127 127
 
128
-add_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' );
129
-if ( ! function_exists( 'lsx_add_footer_sidebar_area' ) ) { 
128
+add_action('lsx_footer_before', 'lsx_add_footer_sidebar_area');
129
+if ( ! function_exists('lsx_add_footer_sidebar_area')) { 
130 130
 	function lsx_add_footer_sidebar_area() {
131
-		if ( is_active_sidebar( 'sidebar-footer-cta' ) ) : ?>
131
+		if (is_active_sidebar('sidebar-footer-cta')) : ?>
132 132
 			<div id="footer-cta">
133 133
 				<div class="container">
134 134
 					<div class="lsx-full-width">
135 135
 						<div class="lsx-hero-unit">
136
-							<?php dynamic_sidebar( 'sidebar-footer-cta' ); ?>
136
+							<?php dynamic_sidebar('sidebar-footer-cta'); ?>
137 137
 						</div>
138 138
 					</div>
139 139
 				</div>
140 140
 			</div>
141 141
 		<?php endif; ?>
142 142
 
143
-		<?php if ( is_active_sidebar( 'sidebar-footer' ) ) : ?>
143
+		<?php if (is_active_sidebar('sidebar-footer')) : ?>
144 144
 			<div id="footer-widgets">
145 145
 				<div class="container">
146 146
 					<div class="row">
147
-						<?php dynamic_sidebar( 'sidebar-footer' ); ?>
147
+						<?php dynamic_sidebar('sidebar-footer'); ?>
148 148
 					</div>
149 149
 				</div>
150 150
 			</div>
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		<?php
168 168
 	else*/if (is_singular('post')) :
169 169
 		$format = get_post_format();
170
-		if ( false === $format ) {
170
+		if (false === $format) {
171 171
 			$format = 'standard';
172 172
 		}
173 173
 		$format_link = get_post_format_link($format);
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 		?>
176 176
 		<header class="archive-header">
177 177
 			<h1 class="archive-title">
178
-				<i class="format-link fa fa-<?php echo esc_attr( $format ) ?>"></i>
178
+				<i class="format-link fa fa-<?php echo esc_attr($format) ?>"></i>
179 179
 				<span><?php the_title(); ?></span>
180 180
 			</h1>
181 181
 		</header>
@@ -189,25 +189,25 @@  discard block
 block discarded – undo
189 189
 	elseif (is_search()) :
190 190
 		?>
191 191
 		<header class="archive-header">
192
-			<h1 class="archive-title"><?php printf( esc_html__( 'Search Results for: %s', 'lsx' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
192
+			<h1 class="archive-title"><?php printf(esc_html__('Search Results for: %s', 'lsx'), '<span>' . get_search_query() . '</span>'); ?></h1>
193 193
 		</header>
194 194
 		<?php
195 195
 	elseif (is_author()) :
196 196
 		?>
197 197
 		<header class="archive-header">
198 198
 			<h1 class="archive-title">
199
-				<?php printf( esc_html__( 'Author: %s', 'lsx' ), get_the_author() ); ?>
199
+				<?php printf(esc_html__('Author: %s', 'lsx'), get_the_author()); ?>
200 200
 			</h1>
201 201
 
202 202
 			<?php if (get_the_author_meta('description')) { ?>
203
-			    <p class="author-desc"><?php echo esc_html( get_the_author_meta( 'description' ) ) ?></p>
203
+			    <p class="author-desc"><?php echo esc_html(get_the_author_meta('description')) ?></p>
204 204
 			<?php } ?>
205 205
 		</header>
206 206
 		<?php
207
-	elseif (is_archive() && class_exists('WooCommerce') && is_post_type_archive('product') ) :
207
+	elseif (is_archive() && class_exists('WooCommerce') && is_post_type_archive('product')) :
208 208
 		?>
209 209
 		<header class="archive-header">
210
-			<h1 class="archive-title"><?php esc_html_e( 'Shop', 'lsx' ); ?></h1>
210
+			<h1 class="archive-title"><?php esc_html_e('Shop', 'lsx'); ?></h1>
211 211
 			<?php echo term_description(); ?>
212 212
 		</header>
213 213
 		<?php
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 		?>
216 216
 		<header class="archive-header">
217 217
 			<h1 class="archive-title">
218
-				<?php if ( has_post_format() && !is_category() && !is_tag() && !is_date() && !is_tax('post_format') ) { ?>
218
+				<?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?>
219 219
 					Type: <?php the_archive_title(); ?>
220 220
 				<?php } else { ?>
221 221
 					<?php the_archive_title(); ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 
241 241
 	if (in_array('blog', $classes)) { ?>
242 242
 		<header class="archive-header">
243
-			<h1 class="archive-title"><?php esc_html_e( 'Blog', 'lsx' ); ?></h1>
243
+			<h1 class="archive-title"><?php esc_html_e('Blog', 'lsx'); ?></h1>
244 244
 		</header>
245 245
 	<?php }
246 246
 }
@@ -253,16 +253,16 @@  discard block
 block discarded – undo
253 253
 	?>
254 254
 		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0">
255 255
 	<?php }
256
-add_action( 'wp_head', 'lsx_add_viewport_meta_tag' );
256
+add_action('wp_head', 'lsx_add_viewport_meta_tag');
257 257
 
258 258
 
259 259
 /**
260 260
  * Add a search form to just above the nav menu
261 261
  */
262 262
 function lsx_header_search_form() {
263
-	$search_form = get_theme_mod( 'lsx_header_search', 0 );
264
-	if($search_form || is_customize_preview()){
265
-		get_search_form( true );
263
+	$search_form = get_theme_mod('lsx_header_search', 0);
264
+	if ($search_form || is_customize_preview()) {
265
+		get_search_form(true);
266 266
 	}
267 267
 }
268
-add_action( 'lsx_nav_before', 'lsx_header_search_form', 0 );
269 268
\ No newline at end of file
269
+add_action('lsx_nav_before', 'lsx_header_search_form', 0);
270 270
\ No newline at end of file
Please login to merge, or discard this patch.
inc/extras.php 1 patch
Spacing   +90 added lines, -90 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly
2
+if ( ! defined('ABSPATH')) return; // Exit if accessed directly
3 3
 
4 4
 /**
5 5
  * Add and remove body_class() classes
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 	/*
9 9
 	 * Add the header layout class
10 10
 	 */
11
-	$header_layout = get_theme_mod('lsx_header_layout','inline');
12
-	$classes[] = 'header-'.$header_layout;
11
+	$header_layout = get_theme_mod('lsx_header_layout', 'inline');
12
+	$classes[] = 'header-' . $header_layout;
13 13
 		
14 14
 	
15 15
   // Add post/page slug
16
-  if (is_single() || is_page() && !is_front_page()) {
16
+  if (is_single() || is_page() && ! is_front_page()) {
17 17
     $classes[] = basename(get_permalink());
18 18
   }
19 19
   
20
-  if(!class_exists('Lsx_Banners')){
21
-		$post_types = array('page','post');
22
-		$post_types = apply_filters('lsx_allowed_post_type_banners',$post_types);  
20
+  if ( ! class_exists('Lsx_Banners')) {
21
+		$post_types = array('page', 'post');
22
+		$post_types = apply_filters('lsx_allowed_post_type_banners', $post_types);  
23 23
 
24
-		if((is_singular($post_types) && has_post_thumbnail()) 
25
-		|| (is_singular('jetpack-portfolio'))){
24
+		if ((is_singular($post_types) && has_post_thumbnail()) 
25
+		|| (is_singular('jetpack-portfolio'))) {
26 26
 			$classes[] = 'page-has-banner';
27 27
 		}
28 28
 	}
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
   	$classes[] = 'has-top-menu';
32 32
   }
33 33
 
34
-	if ( get_theme_mod( 'lsx_preloader_content_status', '1' ) === '1' ) {
34
+	if (get_theme_mod('lsx_preloader_content_status', '1') === '1') {
35 35
 		$classes[] = 'preloader-content-enable';
36 36
 	}
37 37
 
@@ -55,30 +55,30 @@  discard block
 block discarded – undo
55 55
  * @param string $sep Optional separator.
56 56
  * @return string The filtered title.
57 57
  */
58
-function lsx_wp_title( $title, $sep ) {
58
+function lsx_wp_title($title, $sep) {
59 59
 	global $page, $paged;
60 60
 
61
-	if ( is_feed() ) {
61
+	if (is_feed()) {
62 62
 		return $title;
63 63
 	}
64 64
 
65 65
 	// Add the blog name
66
-	$title .= get_bloginfo( 'name' );
66
+	$title .= get_bloginfo('name');
67 67
 
68 68
 	// Add the blog description for the home/front page.
69
-	$site_description = get_bloginfo( 'description', 'display' );
70
-	if ( $site_description && ( is_home() || is_front_page() ) ) {
69
+	$site_description = get_bloginfo('description', 'display');
70
+	if ($site_description && (is_home() || is_front_page())) {
71 71
 		$title .= " $sep $site_description";
72 72
 	}
73 73
 
74 74
 	// Add a page number if necessary:
75
-	if ( $paged >= 2 || $page >= 2 ) {
76
-		$title .= " $sep " . sprintf( __( 'Page %s', 'lsx' ), max( $paged, $page ) );
75
+	if ($paged >= 2 || $page >= 2) {
76
+		$title .= " $sep " . sprintf(__('Page %s', 'lsx'), max($paged, $page));
77 77
 	}
78 78
 
79 79
 	return $title;
80 80
 }
81
-add_filter( 'wp_title', 'lsx_wp_title', 10, 2 );
81
+add_filter('wp_title', 'lsx_wp_title', 10, 2);
82 82
 
83 83
 
84 84
 /**
@@ -99,12 +99,12 @@  discard block
 block discarded – undo
99 99
 function lsx_remove_self_closing_tags($input) {
100 100
   return str_replace(' />', '>', $input);
101 101
 }
102
-add_filter('get_avatar',          'lsx_remove_self_closing_tags'); // <img />
103
-add_filter('comment_id_fields',   'lsx_remove_self_closing_tags'); // <input />
102
+add_filter('get_avatar', 'lsx_remove_self_closing_tags'); // <img />
103
+add_filter('comment_id_fields', 'lsx_remove_self_closing_tags'); // <input />
104 104
 add_filter('post_thumbnail_html', 'lsx_remove_self_closing_tags'); // <img />
105 105
 
106 106
 
107
-if (!function_exists('lsx_get_attachment_id')) {
107
+if ( ! function_exists('lsx_get_attachment_id')) {
108 108
 	/**
109 109
 	 * Get the Attachment ID for a given image URL.
110 110
 	 *
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 	function lsx_get_attachment_id($url) {
116 116
 		$dir = wp_upload_dir();
117 117
 		// baseurl never has a trailing slash
118
-		if (false === strpos($url, $dir['baseurl'].'/')) {
118
+		if (false === strpos($url, $dir['baseurl'] . '/')) {
119 119
 			// URL points to a place outside of upload directory
120 120
 			return false;
121 121
 		}
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 		$query['meta_query'][0]['key'] = '_wp_attached_file';
134 134
 		// query attachments
135 135
 		$ids = get_posts($query);
136
-		if (!empty($ids)) {
136
+		if ( ! empty($ids)) {
137 137
 			foreach ($ids as $id) {
138 138
 				// first entry of returned array is the URL
139 139
 				$temp_url = wp_get_attachment_image_src($id, 'full');
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
  */
177 177
 function lsx_is_element_empty($element) {
178 178
 	$element = trim($element);
179
-	return empty($element)?false:true;
179
+	return empty($element) ? false : true;
180 180
 }
181 181
 
182 182
 
@@ -187,39 +187,39 @@  discard block
 block discarded – undo
187 187
  * @subpackage extras
188 188
  * @category thumbnails
189 189
  */
190
-function lsx_get_thumbnail($size,$image_src = false){
190
+function lsx_get_thumbnail($size, $image_src = false) {
191 191
 	
192
-	if(false === $image_src){
192
+	if (false === $image_src) {
193 193
 		$post_id = get_the_ID(); 
194
-		$post_thumbnail_id = get_post_thumbnail_id( $post_id );
195
-	}elseif(false != $image_src	){
196
-		if(is_numeric($image_src)){
194
+		$post_thumbnail_id = get_post_thumbnail_id($post_id);
195
+	}elseif (false != $image_src) {
196
+		if (is_numeric($image_src)) {
197 197
 			$post_thumbnail_id = $image_src;
198
-		}else{
198
+		} else {
199 199
 			$post_thumbnail_id = lsx_get_attachment_id_from_src($image_src);
200 200
 		}
201 201
 	}
202
-	$size = apply_filters('lsx_thumbnail_size',$size);
202
+	$size = apply_filters('lsx_thumbnail_size', $size);
203 203
 	$img = false;
204
-	if($size === 'lsx-thumbnail-wide' || $size === 'thumbnail'){
204
+	if ($size === 'lsx-thumbnail-wide' || $size === 'thumbnail') {
205 205
 		$srcset = false;
206
-		$img = wp_get_attachment_image_src($post_thumbnail_id,$size);
206
+		$img = wp_get_attachment_image_src($post_thumbnail_id, $size);
207 207
 		$img = $img[0];
208
-	}else{
208
+	} else {
209 209
 		$srcset = true;
210
-		$img = wp_get_attachment_image_srcset($post_thumbnail_id,$size);
211
-		if($img == false) {
210
+		$img = wp_get_attachment_image_srcset($post_thumbnail_id, $size);
211
+		if ($img == false) {
212 212
 			$srcset = false;
213
-			$img = wp_get_attachment_image_src($post_thumbnail_id,$size);
213
+			$img = wp_get_attachment_image_src($post_thumbnail_id, $size);
214 214
 			$img = $img[0];
215 215
 		}
216 216
 	}
217 217
 	if ($srcset) {
218
-		$img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" srcset="'.$img.'" />';
218
+		$img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" srcset="' . $img . '" />';
219 219
 	} else {
220
-		$img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" src="'.$img.'" />';
220
+		$img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" src="' . $img . '" />';
221 221
 	}
222
-	$img = apply_filters('lsx_lazyload_filter_images',$img);
222
+	$img = apply_filters('lsx_lazyload_filter_images', $img);
223 223
 	return $img;
224 224
 }
225 225
 
@@ -230,8 +230,8 @@  discard block
 block discarded – undo
230 230
  * @subpackage extras
231 231
  * @category thumbnails
232 232
  */
233
-function lsx_thumbnail( $size = 'thumbnail', $image_src = false ) {
234
-	echo wp_kses_post( lsx_get_thumbnail( $size, $image_src ) );
233
+function lsx_thumbnail($size = 'thumbnail', $image_src = false) {
234
+	echo wp_kses_post(lsx_get_thumbnail($size, $image_src));
235 235
 }
236 236
 
237 237
 
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
  * @subpackage extras
242 242
  * @category thumbnails
243 243
  */
244
-function lsx_get_attachment_id_from_src( $image_src ) {
245
-	$post_id = wp_cache_get( $image_src, 'lsx_get_attachment_id_from_src' );
244
+function lsx_get_attachment_id_from_src($image_src) {
245
+	$post_id = wp_cache_get($image_src, 'lsx_get_attachment_id_from_src');
246 246
 	
247
-	if ( false === $post_id ) {
247
+	if (false === $post_id) {
248 248
 		global $wpdb;
249
-		$post_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src ) );
250
-		wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 );
249
+		$post_id = $wpdb->get_var($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src));
250
+		wp_cache_set($image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600);
251 251
 	}
252 252
 
253 253
 	return $post_id;
@@ -261,28 +261,28 @@  discard block
 block discarded – undo
261 261
  * @subpackage extras
262 262
  * @category banner
263 263
  */
264
-if (!function_exists('lsx_page_banner')) {
264
+if ( ! function_exists('lsx_page_banner')) {
265 265
 	function lsx_page_banner() {
266 266
 
267
-		$post_types = array('page','post');
268
-		$post_types = apply_filters('lsx_allowed_post_type_banners',$post_types);	
267
+		$post_types = array('page', 'post');
268
+		$post_types = apply_filters('lsx_allowed_post_type_banners', $post_types);	
269 269
 		
270
-		if ( (is_singular($post_types) && has_post_thumbnail())
271
-		 || (is_singular('jetpack-portfolio')) ) { ?>
270
+		if ((is_singular($post_types) && has_post_thumbnail())
271
+		 || (is_singular('jetpack-portfolio'))) { ?>
272 272
 	        
273 273
 	        <?php 
274 274
 	        	$bg_image = '';
275
-	        	if(has_post_thumbnail()){
276
-	        		$bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full');
275
+	        	if (has_post_thumbnail()) {
276
+	        		$bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
277 277
 	        		$bg_image = $bg_image[0];
278 278
 	        	}
279 279
 	        ?>
280 280
 
281
-	   		<?php if ( ! empty( $bg_image ) ) : ?>
281
+	   		<?php if ( ! empty($bg_image)) : ?>
282 282
 	        
283 283
 	        <div class="page-banner-wrap">
284 284
 		        <div class="page-banner">
285
-		        	<div class="page-banner-image" style="background-image:url(<?php echo esc_attr( $bg_image ); ?>);"></div>
285
+		        	<div class="page-banner-image" style="background-image:url(<?php echo esc_attr($bg_image); ?>);"></div>
286 286
 
287 287
 		        	<div class="container">
288 288
 			            <header class="page-header">
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	    <?php } 
299 299
 	}
300 300
 }
301
-add_action( 'lsx_header_after', 'lsx_page_banner' );
301
+add_action('lsx_header_after', 'lsx_page_banner');
302 302
 
303 303
 
304 304
 /**
@@ -308,43 +308,43 @@  discard block
 block discarded – undo
308 308
  * @subpackage extras
309 309
  * @category mobile
310 310
  */
311
-function lsx_allow_sms_protocol( $protocols ) {
311
+function lsx_allow_sms_protocol($protocols) {
312 312
     $protocols[] = 'sms';
313 313
     return $protocols;
314 314
 }
315
-add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' );
315
+add_filter('kses_allowed_protocols', 'lsx_allow_sms_protocol');
316 316
 
317 317
 
318 318
 /**
319 319
  * Adding browser and user-agent classes to body
320 320
  */
321 321
 function mv_browser_body_class($classes) {
322
-		$http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
323
-		$http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : '';
322
+		$http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']));
323
+		$http_user_agent = ! empty($http_user_agent) ? $http_user_agent : '';
324 324
 
325 325
         global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
326
-        if($is_lynx) $classes[] = 'lynx';
327
-        elseif($is_gecko) $classes[] = 'gecko';
328
-        elseif($is_opera) $classes[] = 'opera';
329
-        elseif($is_NS4) $classes[] = 'ns4';
330
-        elseif($is_safari) $classes[] = 'safari';
331
-        elseif($is_chrome) $classes[] = 'chrome';
332
-        elseif($is_IE) {
326
+        if ($is_lynx) $classes[] = 'lynx';
327
+        elseif ($is_gecko) $classes[] = 'gecko';
328
+        elseif ($is_opera) $classes[] = 'opera';
329
+        elseif ($is_NS4) $classes[] = 'ns4';
330
+        elseif ($is_safari) $classes[] = 'safari';
331
+        elseif ($is_chrome) $classes[] = 'chrome';
332
+        elseif ($is_IE) {
333 333
                 $classes[] = 'ie';
334
-                if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
335
-                $classes[] = 'ie'.$browser_version[1];
334
+                if (preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
335
+                $classes[] = 'ie' . $browser_version[1];
336 336
         } else $classes[] = 'unknown';
337
-        if($is_iphone) $classes[] = 'iphone';
338
-        if ( stristr( $http_user_agent, "mac") ) {
337
+        if ($is_iphone) $classes[] = 'iphone';
338
+        if (stristr($http_user_agent, "mac")) {
339 339
                  $classes[] = 'osx';
340
-           } elseif ( stristr( $http_user_agent, "linux") ) {
340
+           } elseif (stristr($http_user_agent, "linux")) {
341 341
                  $classes[] = 'linux';
342
-           } elseif ( stristr( $http_user_agent, "windows") ) {
342
+           } elseif (stristr($http_user_agent, "windows")) {
343 343
                  $classes[] = 'windows';
344 344
            }
345 345
         return $classes;
346 346
 }
347
-add_filter('body_class','mv_browser_body_class');
347
+add_filter('body_class', 'mv_browser_body_class');
348 348
 
349 349
 
350 350
 /**
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
  * @param		$form		Object
358 358
  * @return		String
359 359
  */
360
-function lsx_form_submit_button($button, $form){
360
+function lsx_form_submit_button($button, $form) {
361 361
 	return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>";
362 362
 }
363 363
 add_filter("gform_submit_button", "lsx_form_submit_button", 10, 2);
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 	//return ' ... <a class="moretag" href="'. get_permalink($post->ID) . '">'.__('Continue reading','lsx').'</a>';
372 372
 	return '...';
373 373
 }
374
-add_filter( 'excerpt_more', 'lsx_excerpt_more' );
374
+add_filter('excerpt_more', 'lsx_excerpt_more');
375 375
 
376 376
 
377 377
 /**
@@ -380,44 +380,44 @@  discard block
 block discarded – undo
380 380
 function lsx_the_excerpt_filter($excerpt) {
381 381
 	$show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio')));
382 382
 	
383
-	if (!$show_full_content) {
384
-		if ('' !== $excerpt  && !stristr($excerpt, 'moretag')) {
385
-			$pagination = wp_link_pages( array(
383
+	if ( ! $show_full_content) {
384
+		if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) {
385
+			$pagination = wp_link_pages(array(
386 386
 							'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
387 387
 							'after' => '</div></div>',
388 388
 							'link_before' => '<span>',
389 389
 							'link_after' => '</span>',
390 390
 							'echo' => 0
391
-						) );
391
+						));
392 392
 
393
-			if ( ! empty( $pagination ) ) {
393
+			if ( ! empty($pagination)) {
394 394
 				$excerpt .= $pagination;
395 395
 			}
396 396
 			else {
397
-				$excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>';
397
+				$excerpt .= '<p><a class="moretag" href="' . get_permalink() . '">' . __('Continue reading', 'lsx') . '</a></p>';
398 398
 			}
399 399
 		}
400 400
 	}
401 401
 
402 402
 	return $excerpt;
403 403
 }
404
-add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 );
404
+add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20);
405 405
 
406 406
 
407 407
 /**
408 408
  * Allow HTML tags in excerpt
409 409
  */
410
-if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) {
410
+if ( ! function_exists('wpse_custom_wp_trim_excerpt')) {
411 411
 	function wpse_custom_wp_trim_excerpt($wpse_excerpt) {
412 412
 		global $post;
413 413
 		$raw_excerpt = $wpse_excerpt;
414 414
 
415
-		if ( '' == $wpse_excerpt ) {
415
+		if ('' == $wpse_excerpt) {
416 416
 			$wpse_excerpt = get_the_content('');
417 417
 			$show_full_content = has_post_format(array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio'));
418 418
 
419
-			if (!$show_full_content) {
420
-				$wpse_excerpt = strip_shortcodes( $wpse_excerpt );
419
+			if ( ! $show_full_content) {
420
+				$wpse_excerpt = strip_shortcodes($wpse_excerpt);
421 421
 				$wpse_excerpt = apply_filters('the_content', $wpse_excerpt);
422 422
 				$wpse_excerpt = str_replace(']]>', ']]>', $wpse_excerpt);
423 423
 				//$wpse_excerpt = strip_tags($wpse_excerpt, '<blockquote>,<p>');
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 				$wpse_excerpt = trim(force_balance_tags($excerptOutput));
446 446
 
447 447
 				if ($has_more) {
448
-					$excerpt_end = '<a class="moretag" href="'.get_permalink().'">'.__('More','lsx').'</a>';
448
+					$excerpt_end = '<a class="moretag" href="' . get_permalink() . '">' . __('More', 'lsx') . '</a>';
449 449
 					$excerpt_end = apply_filters('excerpt_more', ' ' . $excerpt_end); 
450 450
 
451 451
 					$pos = strrpos($wpse_excerpt, '</');
@@ -473,4 +473,4 @@  discard block
 block discarded – undo
473 473
 }
474 474
 remove_filter('get_the_excerpt', 'wp_trim_excerpt');
475 475
 add_filter('get_the_excerpt', 'wpse_custom_wp_trim_excerpt');
476
-remove_filter( 'the_excerpt', 'wpautop' );
476
+remove_filter('the_excerpt', 'wpautop');
Please login to merge, or discard this patch.