Completed
Push — master ( bcb77d...aa4fea )
by
unknown
03:19
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
-			<?php echo wp_keses_post( '<' ); ?>link href="<?php echo esc_attr( $protocol ); ?>://fonts.googleapis.com/css?family=<?php echo esc_attr( $value->__get( "location" ) ); ?>" rel='stylesheet' type='text/css'<?php echo wp_keses_post( '>' ); ?>
111
+			<?php echo wp_keses_post('<'); ?>link href="<?php echo esc_attr($protocol); ?>://fonts.googleapis.com/css?family=<?php echo esc_attr($value->__get("location")); ?>" rel='stylesheet' type='text/css'<?php echo wp_keses_post('>'); ?>
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/customizer-font.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  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
  * LSX_Customize_Font_Control Class
6 6
 **/
7
-if( !class_exists( 'WP_Customize_Control' ) ){
7
+if ( ! class_exists('WP_Customize_Control')) {
8 8
 	return;
9 9
 }
10
-class LSX_Customize_Font_Control extends WP_Customize_Control{
10
+class LSX_Customize_Font_Control extends WP_Customize_Control {
11 11
 	public $fonts;
12 12
 
13 13
 	/**
14 14
 	 * Enqueue the styles and scripts
15 15
 	**/
16
-	public function enqueue(){
16
+	public function enqueue() {
17 17
 		// styles
18
-		wp_enqueue_style( 'lsx-font-picker-custom-control', get_template_directory_uri() .'/css/customizer-font.css');
18
+		wp_enqueue_style('lsx-font-picker-custom-control', get_template_directory_uri() . '/css/customizer-font.css');
19 19
 			
20 20
 		// scripts
21
-		wp_enqueue_script( 'lsx-font-picker-custom-control', get_template_directory_uri() .'/js/customizer-font.js');
21
+		wp_enqueue_script('lsx-font-picker-custom-control', get_template_directory_uri() . '/js/customizer-font.js');
22 22
 	}
23 23
 
24 24
 	/**
25 25
 	 * Render the content on the theme customizer page
26 26
 	**/
27
-	public function render_content(){
28
-		if ( empty( $this->choices ) ){
27
+	public function render_content() {
28
+		if (empty($this->choices)) {
29 29
 			// if there are no choices then don't print anything
30 30
 			return;
31 31
 		}
32 32
 		$fonts = array();
33
-		foreach( $this->choices as $slug=>$font ){
33
+		foreach ($this->choices as $slug=>$font) {
34 34
 			$fonts[] = $font['header'];
35 35
 			$fonts[] = $font['body'];
36 36
 			$this->choices[$slug] = $font;
37 37
 		}
38 38
 		
39
-		$this->fonts = new LSX_Google_Font_Collection( $fonts );
39
+		$this->fonts = new LSX_Google_Font_Collection($fonts);
40 40
 
41 41
 		$fonts = $this->fonts->get_font_family_name_array();
42 42
 		//print links to css files
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 		<div class="fontPickerCustomControl">
52 52
 			<select <?php $this->link(); ?>>
53 53
 				<?php
54
-				foreach ( $this->choices as $value => $conf ){
55
-					echo '<option value="' . esc_attr( $value ) . '">' . esc_html( $value ) . '</option>';
54
+				foreach ($this->choices as $value => $conf) {
55
+					echo '<option value="' . esc_attr($value) . '">' . esc_html($value) . '</option>';
56 56
 				}
57 57
 				?>
58 58
 			</select>
@@ -60,16 +60,16 @@  discard block
 block discarded – undo
60 60
 				<ul>
61 61
 					<?php
62 62
 					//$cssClassArray = $this->fonts->get_css_class_array();
63
-					foreach ($this->choices as $key => $font){
63
+					foreach ($this->choices as $key => $font) {
64 64
 						$class = null;
65
-						if( $key == $set_value ){
65
+						if ($key == $set_value) {
66 66
 							$class = ' selected';
67 67
 						}
68 68
 						
69 69
 						?>
70
-						<li class="font-choice <?php echo esc_attr( $class ); ?>">
71
-							<div class="<?php echo esc_attr( $font['header']['cssClass'] ); ?>"><?php echo esc_html( $font['header']['title'] ); ?></div>
72
-							<small class="<?php echo esc_attr( $font['body']['cssClass'] ); ?>"><?php echo esc_html( $font['body']['title'] ); ?></small>
70
+						<li class="font-choice <?php echo esc_attr($class); ?>">
71
+							<div class="<?php echo esc_attr($font['header']['cssClass']); ?>"><?php echo esc_html($font['header']['title']); ?></div>
72
+							<small class="<?php echo esc_attr($font['body']['cssClass']); ?>"><?php echo esc_html($font['body']['title']); ?></small>
73 73
 						</li>
74 74
 						<?php
75 75
 					}
Please login to merge, or discard this patch.
inc/extras.php 3 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	
15 15
   // Add post/page slug
16 16
   if (is_single() || is_page() && !is_front_page()) {
17
-    $classes[] = basename(get_permalink());
17
+	$classes[] = basename(get_permalink());
18 18
   }
19 19
   
20 20
   if(!class_exists('Lsx_Banners')){
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
   // Remove unnecessary classes
39 39
   $home_id_class = 'page-id-' . get_option('page_on_front');
40 40
   $remove_classes = array(
41
-    'page-template-default',
42
-    $home_id_class
41
+	'page-template-default',
42
+	$home_id_class
43 43
   );
44 44
   $classes = array_diff($classes, $remove_classes);
45 45
 
@@ -272,12 +272,12 @@  discard block
 block discarded – undo
272 272
 		 || (is_singular('jetpack-portfolio')) ) { ?>
273 273
 	        
274 274
 	        <?php 
275
-	        	$bg_image = '';
276
-	        	if(has_post_thumbnail()){
277
-	        		$bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full');
278
-	        		$bg_image = $bg_image[0];
279
-	        	}
280
-	        ?>
275
+				$bg_image = '';
276
+				if(has_post_thumbnail()){
277
+					$bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full');
278
+					$bg_image = $bg_image[0];
279
+				}
280
+			?>
281 281
 
282 282
 	   		<?php if ( ! empty( $bg_image ) ) : ?>
283 283
 	        
@@ -310,8 +310,8 @@  discard block
 block discarded – undo
310 310
  * @category mobile
311 311
  */
312 312
 function lsx_allow_sms_protocol( $protocols ) {
313
-    $protocols[] = 'sms';
314
-    return $protocols;
313
+	$protocols[] = 'sms';
314
+	return $protocols;
315 315
 }
316 316
 add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' );
317 317
 
@@ -323,27 +323,27 @@  discard block
 block discarded – undo
323 323
 		$http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
324 324
 		$http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : '';
325 325
 
326
-        global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
327
-        if($is_lynx) $classes[] = 'lynx';
328
-        elseif($is_gecko) $classes[] = 'gecko';
329
-        elseif($is_opera) $classes[] = 'opera';
330
-        elseif($is_NS4) $classes[] = 'ns4';
331
-        elseif($is_safari) $classes[] = 'safari';
332
-        elseif($is_chrome) $classes[] = 'chrome';
333
-        elseif($is_IE) {
334
-                $classes[] = 'ie';
335
-                if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
336
-                $classes[] = 'ie'.$browser_version[1];
337
-        } else $classes[] = 'unknown';
338
-        if($is_iphone) $classes[] = 'iphone';
339
-        if ( stristr( $http_user_agent, "mac") ) {
340
-                 $classes[] = 'osx';
341
-           } elseif ( stristr( $http_user_agent, "linux") ) {
342
-                 $classes[] = 'linux';
343
-           } elseif ( stristr( $http_user_agent, "windows") ) {
344
-                 $classes[] = 'windows';
345
-           }
346
-        return $classes;
326
+		global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
327
+		if($is_lynx) $classes[] = 'lynx';
328
+		elseif($is_gecko) $classes[] = 'gecko';
329
+		elseif($is_opera) $classes[] = 'opera';
330
+		elseif($is_NS4) $classes[] = 'ns4';
331
+		elseif($is_safari) $classes[] = 'safari';
332
+		elseif($is_chrome) $classes[] = 'chrome';
333
+		elseif($is_IE) {
334
+				$classes[] = 'ie';
335
+				if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
336
+				$classes[] = 'ie'.$browser_version[1];
337
+		} else $classes[] = 'unknown';
338
+		if($is_iphone) $classes[] = 'iphone';
339
+		if ( stristr( $http_user_agent, "mac") ) {
340
+				 $classes[] = 'osx';
341
+		   } elseif ( stristr( $http_user_agent, "linux") ) {
342
+				 $classes[] = 'linux';
343
+		   } elseif ( stristr( $http_user_agent, "windows") ) {
344
+				 $classes[] = 'windows';
345
+		   }
346
+		return $classes;
347 347
 }
348 348
 add_filter('body_class','mv_browser_body_class');
349 349
 
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 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,14 +241,14 @@  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
-		$query = $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src );
250
-		$post_id = $wpdb->get_var( $query );
251
-		wp_cache_set( $image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600 );
249
+		$query = $wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid='%s' LIMIT 1", $image_src);
250
+		$post_id = $wpdb->get_var($query);
251
+		wp_cache_set($image_src, $post_id, 'lsx_get_attachment_id_from_src', 3600);
252 252
 	}
253 253
 
254 254
 	return $post_id;
@@ -262,28 +262,28 @@  discard block
 block discarded – undo
262 262
  * @subpackage extras
263 263
  * @category banner
264 264
  */
265
-if (!function_exists('lsx_page_banner')) {
265
+if ( ! function_exists('lsx_page_banner')) {
266 266
 	function lsx_page_banner() {
267 267
 
268
-		$post_types = array('page','post');
269
-		$post_types = apply_filters('lsx_allowed_post_type_banners',$post_types);	
268
+		$post_types = array('page', 'post');
269
+		$post_types = apply_filters('lsx_allowed_post_type_banners', $post_types);	
270 270
 		
271
-		if ( (is_singular($post_types) && has_post_thumbnail())
272
-		 || (is_singular('jetpack-portfolio')) ) { ?>
271
+		if ((is_singular($post_types) && has_post_thumbnail())
272
+		 || (is_singular('jetpack-portfolio'))) { ?>
273 273
 	        
274 274
 	        <?php 
275 275
 	        	$bg_image = '';
276
-	        	if(has_post_thumbnail()){
277
-	        		$bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full');
276
+	        	if (has_post_thumbnail()) {
277
+	        		$bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full');
278 278
 	        		$bg_image = $bg_image[0];
279 279
 	        	}
280 280
 	        ?>
281 281
 
282
-	   		<?php if ( ! empty( $bg_image ) ) : ?>
282
+	   		<?php if ( ! empty($bg_image)) : ?>
283 283
 	        
284 284
 	        <div class="page-banner-wrap">
285 285
 		        <div class="page-banner">
286
-		        	<div class="page-banner-image" style="background-image:url(<?php echo esc_attr( $bg_image ); ?>);"></div>
286
+		        	<div class="page-banner-image" style="background-image:url(<?php echo esc_attr($bg_image); ?>);"></div>
287 287
 
288 288
 		        	<div class="container">
289 289
 			            <header class="page-header">
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 	    <?php } 
300 300
 	}
301 301
 }
302
-add_action( 'lsx_header_after', 'lsx_page_banner' );
302
+add_action('lsx_header_after', 'lsx_page_banner');
303 303
 
304 304
 
305 305
 /**
@@ -309,43 +309,43 @@  discard block
 block discarded – undo
309 309
  * @subpackage extras
310 310
  * @category mobile
311 311
  */
312
-function lsx_allow_sms_protocol( $protocols ) {
312
+function lsx_allow_sms_protocol($protocols) {
313 313
     $protocols[] = 'sms';
314 314
     return $protocols;
315 315
 }
316
-add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' );
316
+add_filter('kses_allowed_protocols', 'lsx_allow_sms_protocol');
317 317
 
318 318
 
319 319
 /**
320 320
  * Adding browser and user-agent classes to body
321 321
  */
322 322
 function mv_browser_body_class($classes) {
323
-		$http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) );
324
-		$http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : '';
323
+		$http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT']));
324
+		$http_user_agent = ! empty($http_user_agent) ? $http_user_agent : '';
325 325
 
326 326
         global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
327
-        if($is_lynx) $classes[] = 'lynx';
328
-        elseif($is_gecko) $classes[] = 'gecko';
329
-        elseif($is_opera) $classes[] = 'opera';
330
-        elseif($is_NS4) $classes[] = 'ns4';
331
-        elseif($is_safari) $classes[] = 'safari';
332
-        elseif($is_chrome) $classes[] = 'chrome';
333
-        elseif($is_IE) {
327
+        if ($is_lynx) $classes[] = 'lynx';
328
+        elseif ($is_gecko) $classes[] = 'gecko';
329
+        elseif ($is_opera) $classes[] = 'opera';
330
+        elseif ($is_NS4) $classes[] = 'ns4';
331
+        elseif ($is_safari) $classes[] = 'safari';
332
+        elseif ($is_chrome) $classes[] = 'chrome';
333
+        elseif ($is_IE) {
334 334
                 $classes[] = 'ie';
335
-                if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
336
-                $classes[] = 'ie'.$browser_version[1];
335
+                if (preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
336
+                $classes[] = 'ie' . $browser_version[1];
337 337
         } else $classes[] = 'unknown';
338
-        if($is_iphone) $classes[] = 'iphone';
339
-        if ( stristr( $http_user_agent, "mac") ) {
338
+        if ($is_iphone) $classes[] = 'iphone';
339
+        if (stristr($http_user_agent, "mac")) {
340 340
                  $classes[] = 'osx';
341
-           } elseif ( stristr( $http_user_agent, "linux") ) {
341
+           } elseif (stristr($http_user_agent, "linux")) {
342 342
                  $classes[] = 'linux';
343
-           } elseif ( stristr( $http_user_agent, "windows") ) {
343
+           } elseif (stristr($http_user_agent, "windows")) {
344 344
                  $classes[] = 'windows';
345 345
            }
346 346
         return $classes;
347 347
 }
348
-add_filter('body_class','mv_browser_body_class');
348
+add_filter('body_class', 'mv_browser_body_class');
349 349
 
350 350
 
351 351
 /**
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
  * @param		$form		Object
359 359
  * @return		String
360 360
  */
361
-function lsx_form_submit_button($button, $form){
361
+function lsx_form_submit_button($button, $form) {
362 362
 	return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>";
363 363
 }
364 364
 add_filter("gform_submit_button", "lsx_form_submit_button", 10, 2);
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	//return ' ... <a class="moretag" href="'. get_permalink($post->ID) . '">'.__('Continue reading','lsx').'</a>';
373 373
 	return '...';
374 374
 }
375
-add_filter( 'excerpt_more', 'lsx_excerpt_more' );
375
+add_filter('excerpt_more', 'lsx_excerpt_more');
376 376
 
377 377
 
378 378
 /**
@@ -381,44 +381,44 @@  discard block
 block discarded – undo
381 381
 function lsx_the_excerpt_filter($excerpt) {
382 382
 	$show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio')));
383 383
 	
384
-	if (!$show_full_content) {
385
-		if ('' !== $excerpt  && !stristr($excerpt, 'moretag')) {
386
-			$pagination = wp_link_pages( array(
384
+	if ( ! $show_full_content) {
385
+		if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) {
386
+			$pagination = wp_link_pages(array(
387 387
 							'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
388 388
 							'after' => '</div></div>',
389 389
 							'link_before' => '<span>',
390 390
 							'link_after' => '</span>',
391 391
 							'echo' => 0
392
-						) );
392
+						));
393 393
 
394
-			if ( ! empty( $pagination ) ) {
394
+			if ( ! empty($pagination)) {
395 395
 				$excerpt .= $pagination;
396 396
 			}
397 397
 			else {
398
-				$excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>';
398
+				$excerpt .= '<p><a class="moretag" href="' . get_permalink() . '">' . __('Continue reading', 'lsx') . '</a></p>';
399 399
 			}
400 400
 		}
401 401
 	}
402 402
 
403 403
 	return $excerpt;
404 404
 }
405
-add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 );
405
+add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20);
406 406
 
407 407
 
408 408
 /**
409 409
  * Allow HTML tags in excerpt
410 410
  */
411
-if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) {
411
+if ( ! function_exists('wpse_custom_wp_trim_excerpt')) {
412 412
 	function wpse_custom_wp_trim_excerpt($wpse_excerpt) {
413 413
 		global $post;
414 414
 		$raw_excerpt = $wpse_excerpt;
415 415
 
416
-		if ( '' == $wpse_excerpt ) {
416
+		if ('' == $wpse_excerpt) {
417 417
 			$wpse_excerpt = get_the_content('');
418 418
 			$show_full_content = has_post_format(array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio'));
419 419
 
420
-			if (!$show_full_content) {
421
-				$wpse_excerpt = strip_shortcodes( $wpse_excerpt );
420
+			if ( ! $show_full_content) {
421
+				$wpse_excerpt = strip_shortcodes($wpse_excerpt);
422 422
 				$wpse_excerpt = apply_filters('the_content', $wpse_excerpt);
423 423
 				$wpse_excerpt = str_replace(']]>', ']]>', $wpse_excerpt);
424 424
 				//$wpse_excerpt = strip_tags($wpse_excerpt, '<blockquote>,<p>');
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
 				$wpse_excerpt = trim(force_balance_tags($excerptOutput));
447 447
 
448 448
 				if ($has_more) {
449
-					$excerpt_end = '<a class="moretag" href="'.get_permalink().'">'.__('More','lsx').'</a>';
449
+					$excerpt_end = '<a class="moretag" href="' . get_permalink() . '">' . __('More', 'lsx') . '</a>';
450 450
 					$excerpt_end = apply_filters('excerpt_more', ' ' . $excerpt_end); 
451 451
 
452 452
 					$pos = strrpos($wpse_excerpt, '</');
@@ -474,4 +474,4 @@  discard block
 block discarded – undo
474 474
 }
475 475
 remove_filter('get_the_excerpt', 'wp_trim_excerpt');
476 476
 add_filter('get_the_excerpt', 'wpse_custom_wp_trim_excerpt');
477
-remove_filter( 'the_excerpt', 'wpautop' );
477
+remove_filter('the_excerpt', 'wpautop');
Please login to merge, or discard this patch.
Braces   +30 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,5 +1,8 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly
2
+if ( ! defined( 'ABSPATH' ) ) {
3
+	return;
4
+}
5
+// Exit if accessed directly
3 6
 
4 7
 /**
5 8
  * Add and remove body_class() classes
@@ -192,10 +195,10 @@  discard block
 block discarded – undo
192 195
 	if(false === $image_src){
193 196
 		$post_id = get_the_ID(); 
194 197
 		$post_thumbnail_id = get_post_thumbnail_id( $post_id );
195
-	}elseif(false != $image_src	){
198
+	} elseif(false != $image_src	){
196 199
 		if(is_numeric($image_src)){
197 200
 			$post_thumbnail_id = $image_src;
198
-		}else{
201
+		} else{
199 202
 			$post_thumbnail_id = lsx_get_attachment_id_from_src($image_src);
200 203
 		}
201 204
 	}
@@ -205,7 +208,7 @@  discard block
 block discarded – undo
205 208
 		$srcset = false;
206 209
 		$img = wp_get_attachment_image_src($post_thumbnail_id,$size);
207 210
 		$img = $img[0];
208
-	}else{
211
+	} else{
209 212
 		$srcset = true;
210 213
 		$img = wp_get_attachment_image_srcset($post_thumbnail_id,$size);
211 214
 		if($img == false) {
@@ -324,18 +327,29 @@  discard block
 block discarded – undo
324 327
 		$http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : '';
325 328
 
326 329
         global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
327
-        if($is_lynx) $classes[] = 'lynx';
328
-        elseif($is_gecko) $classes[] = 'gecko';
329
-        elseif($is_opera) $classes[] = 'opera';
330
-        elseif($is_NS4) $classes[] = 'ns4';
331
-        elseif($is_safari) $classes[] = 'safari';
332
-        elseif($is_chrome) $classes[] = 'chrome';
333
-        elseif($is_IE) {
330
+        if($is_lynx) {
331
+        	$classes[] = 'lynx';
332
+        } elseif($is_gecko) {
333
+        	$classes[] = 'gecko';
334
+        } elseif($is_opera) {
335
+        	$classes[] = 'opera';
336
+        } elseif($is_NS4) {
337
+        	$classes[] = 'ns4';
338
+        } elseif($is_safari) {
339
+        	$classes[] = 'safari';
340
+        } elseif($is_chrome) {
341
+        	$classes[] = 'chrome';
342
+        } elseif($is_IE) {
334 343
                 $classes[] = 'ie';
335
-                if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version))
336
-                $classes[] = 'ie'.$browser_version[1];
337
-        } else $classes[] = 'unknown';
338
-        if($is_iphone) $classes[] = 'iphone';
344
+                if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) {
345
+                                $classes[] = 'ie'.$browser_version[1];
346
+                }
347
+        } else {
348
+        	$classes[] = 'unknown';
349
+        }
350
+        if($is_iphone) {
351
+        	$classes[] = 'iphone';
352
+        }
339 353
         if ( stristr( $http_user_agent, "mac") ) {
340 354
                  $classes[] = 'osx';
341 355
            } elseif ( stristr( $http_user_agent, "linux") ) {
@@ -393,8 +407,7 @@  discard block
 block discarded – undo
393 407
 
394 408
 			if ( ! empty( $pagination ) ) {
395 409
 				$excerpt .= $pagination;
396
-			}
397
-			else {
410
+			} else {
398 411
 				$excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>';
399 412
 			}
400 413
 		}
Please login to merge, or discard this patch.
inc/jetpack.php 2 patches
Spacing   +101 added lines, -101 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,39 +214,39 @@  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
-	$lsx_website_nonce = sanitize_text_field( wp_unslash( $_POST['lsx_website_nonce'] ) );
222
-	$lsx_client_nonce = sanitize_text_field( wp_unslash( $_POST['lsx_client_nonce'] ) );
220
+function lsx_save_portfolio_post_meta($post_id, $post) {
221
+	$lsx_website_nonce = sanitize_text_field(wp_unslash($_POST['lsx_website_nonce']));
222
+	$lsx_client_nonce = sanitize_text_field(wp_unslash($_POST['lsx_client_nonce']));
223 223
 
224
-	if ( ! wp_verify_nonce( $lsx_website_nonce, basename( __FILE__ ) ) || ! wp_verify_nonce( $lsx_client_nonce, basename( __FILE__ ) ) ) {
224
+	if ( ! wp_verify_nonce($lsx_website_nonce, basename(__FILE__)) || ! wp_verify_nonce($lsx_client_nonce, basename(__FILE__))) {
225 225
 		return $post_id;
226 226
 	}
227 227
 
228
-	$post_type = get_post_type_object( $post->post_type );
228
+	$post_type = get_post_type_object($post->post_type);
229 229
 
230
-	if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
230
+	if ( ! current_user_can($post_type->cap->edit_post, $post_id))
231 231
 		return $post_id;
232 232
 
233 233
 
234
-	$meta_keys = array('lsx-website','lsx-client');
234
+	$meta_keys = array('lsx-website', 'lsx-client');
235 235
 
236
-	foreach($meta_keys as $meta_key){
237
-		$new_meta_value = sanitize_text_field( wp_unslash( $_POST[$meta_key] ) );
238
-		$new_meta_value = ! empty( $new_meta_value ) ? $new_meta_value : '';
236
+	foreach ($meta_keys as $meta_key) {
237
+		$new_meta_value = sanitize_text_field(wp_unslash($_POST[$meta_key]));
238
+		$new_meta_value = ! empty($new_meta_value) ? $new_meta_value : '';
239 239
 
240
-		$meta_value = get_post_meta( $post_id, $meta_key, true );
240
+		$meta_value = get_post_meta($post_id, $meta_key, true);
241 241
 
242
-		if ( $new_meta_value && '' == $meta_value )
243
-			add_post_meta( $post_id, $meta_key, $new_meta_value, true );
242
+		if ($new_meta_value && '' == $meta_value)
243
+			add_post_meta($post_id, $meta_key, $new_meta_value, true);
244 244
 
245
-		elseif ( $new_meta_value && $new_meta_value != $meta_value )
246
-		update_post_meta( $post_id, $meta_key, $new_meta_value );
245
+		elseif ($new_meta_value && $new_meta_value != $meta_value)
246
+		update_post_meta($post_id, $meta_key, $new_meta_value);
247 247
 
248
-		elseif ( '' == $new_meta_value && $meta_value )
249
-		delete_post_meta( $post_id, $meta_key, $meta_value );
248
+		elseif ('' == $new_meta_value && $meta_value)
249
+		delete_post_meta($post_id, $meta_key, $meta_value);
250 250
 
251 251
 	}
252 252
 }
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 
256 256
 	add_meta_box(
257 257
 	'lsx_client_meta_box',
258
-	esc_html__( 'Client', 'lsx' ),
258
+	esc_html__('Client', 'lsx'),
259 259
 	'lsx_client_meta_box',
260 260
 	'jetpack-portfolio',
261 261
 	'side',
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
 	add_meta_box(
266 266
 	'lsx_website_meta_box',
267
-	esc_html__( 'Website', 'lsx' ),
267
+	esc_html__('Website', 'lsx'),
268 268
 	'lsx_website_meta_box',
269 269
 	'jetpack-portfolio',
270 270
 	'side',
@@ -272,25 +272,25 @@  discard block
 block discarded – undo
272 272
 			);
273 273
 }
274 274
 
275
-function lsx_client_meta_box( $object, $box ) { ?>
275
+function lsx_client_meta_box($object, $box) { ?>
276 276
 
277
-  <?php wp_nonce_field( basename( __FILE__ ), 'lsx_client_nonce' ); ?>
277
+  <?php wp_nonce_field(basename(__FILE__), 'lsx_client_nonce'); ?>
278 278
 
279 279
   <p>
280
-    <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" />
280
+    <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" />
281 281
     <br /><br />
282
-    <label for="lsx-client"><?php esc_html_e( 'Enter the name of the project client', 'lsx' ); ?></label>
282
+    <label for="lsx-client"><?php esc_html_e('Enter the name of the project client', 'lsx'); ?></label>
283 283
   </p>
284 284
 <?php }
285 285
 
286
-function lsx_website_meta_box( $object, $box ) { ?>
286
+function lsx_website_meta_box($object, $box) { ?>
287 287
 
288
-  <?php wp_nonce_field( basename( __FILE__ ), 'lsx_website_nonce' ); ?>
288
+  <?php wp_nonce_field(basename(__FILE__), 'lsx_website_nonce'); ?>
289 289
 
290 290
   <p>
291
-    <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" />
291
+    <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" />
292 292
     <br /><br />
293
-    <label for="lsx-website"><?php esc_html_e( 'Enter the URL of the project website', 'lsx' ); ?></label>
293
+    <label for="lsx-website"><?php esc_html_e('Enter the URL of the project website', 'lsx'); ?></label>
294 294
   </p>
295 295
 <?php }
296 296
 
@@ -303,18 +303,18 @@  discard block
 block discarded – undo
303 303
  * @category portfolio
304 304
  */   
305 305
 
306
-function lsx_portfolio_sorter(){ ?>
306
+function lsx_portfolio_sorter() { ?>
307 307
 	<ul id="filterNav" class="clearfix">
308
-		<li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'lsx' ); ?></a></li>
308
+		<li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e('All', 'lsx'); ?></a></li>
309 309
 		<?php 
310 310
 		$types = get_terms('jetpack-portfolio-type');
311 311
 		
312
-		if(is_array($types)){
312
+		if (is_array($types)) {
313 313
 			foreach ($types as $type) {
314
-				$content = '<li><a href="#" data-filter=".'.$type->slug.'">';
314
+				$content = '<li><a href="#" data-filter=".' . $type->slug . '">';
315 315
 		    	$content .= $type->name;					
316 316
 				$content .= '</a></li>';
317
-				echo wp_kses_post( $content );
317
+				echo wp_kses_post($content);
318 318
 				echo "\n";
319 319
 			}
320 320
 		}?>
@@ -329,18 +329,18 @@  discard block
 block discarded – undo
329 329
  * @category portfolio
330 330
  */
331 331
 
332
-function lsx_portfolio_naviagtion_labels($labels){ 
332
+function lsx_portfolio_naviagtion_labels($labels) { 
333 333
 	
334
-	if(is_post_type_archive('jetpack-portfolio')){
334
+	if (is_post_type_archive('jetpack-portfolio')) {
335 335
 		$labels = array(
336
-				'next' 		=> '<span class="meta-nav">&larr;</span> '.__( 'Older', 'lsx' ),
337
-				'previous' 	=> __( 'Newer', 'lsx' ).' <span class="meta-nav">&rarr;</span>',
338
-				'title' 	=> __( 'Portfolio navigation', 'lsx' )
336
+				'next' 		=> '<span class="meta-nav">&larr;</span> ' . __('Older', 'lsx'),
337
+				'previous' 	=> __('Newer', 'lsx') . ' <span class="meta-nav">&rarr;</span>',
338
+				'title' 	=> __('Portfolio navigation', 'lsx')
339 339
 		);
340 340
 	}
341 341
 	return $labels;
342 342
 }
343
-add_filter('lsx_post_navigation_labels','lsx_portfolio_naviagtion_labels',1,10);
343
+add_filter('lsx_post_navigation_labels', 'lsx_portfolio_naviagtion_labels', 1, 10);
344 344
 
345 345
 
346 346
 /*
@@ -354,11 +354,11 @@  discard block
 block discarded – undo
354 354
  * @subpackage jetpack
355 355
  * @category related-posts
356 356
  */
357
-function lsx_remove_related_post_context(){
358
-	add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' );
359
-	add_filter( 'rest_api_allowed_post_types', 'lsx_allowed_related_post_types' );
357
+function lsx_remove_related_post_context() {
358
+	add_filter('jetpack_relatedposts_filter_post_context', '__return_empty_string');
359
+	add_filter('rest_api_allowed_post_types', 'lsx_allowed_related_post_types');
360 360
 }
361
-add_action('init','lsx_remove_related_post_context',20);
361
+add_action('init', 'lsx_remove_related_post_context', 20);
362 362
 
363 363
 
364 364
 /*
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
 	$infinite_scroll_args = array(
376 376
 			'container' => 'main',
377 377
 			'type' => 'click',
378
-			'posts_per_page' => get_option('posts_per_page',10),
378
+			'posts_per_page' => get_option('posts_per_page', 10),
379 379
 			'render'    => 'lsx_infinite_scroll_render'
380 380
 	);
381 381
 
382
-	add_theme_support( 'infinite-scroll', $infinite_scroll_args );
382
+	add_theme_support('infinite-scroll', $infinite_scroll_args);
383 383
 }
384
-add_action( 'after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup' );
384
+add_action('after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup');
385 385
 
386 386
 /**
387 387
  * Set the code to be rendered on for calling posts,
@@ -394,13 +394,13 @@  discard block
 block discarded – undo
394 394
  function lsx_infinite_scroll_render() {
395 395
 	global $wp_query;
396 396
 	
397
-	while(have_posts()){
397
+	while (have_posts()) {
398 398
 		the_post();
399 399
 		
400
-		if('jetpack-portfolio' == get_post_type()){
401
-			get_template_part( 'content', 'portfolio' );
402
-		}else{
403
-			get_template_part( 'content', get_post_type() );
400
+		if ('jetpack-portfolio' == get_post_type()) {
401
+			get_template_part('content', 'portfolio');
402
+		} else {
403
+			get_template_part('content', get_post_type());
404 404
 		}
405 405
 	}
406 406
  }
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
  * @subpackage jetpack
413 413
  * @category related posts
414 414
  */
415
-function lsx_related_posts_headline( $headline ) {
416
-	$headline = sprintf( '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html( 'Related Posts' ) );
415
+function lsx_related_posts_headline($headline) {
416
+	$headline = sprintf('<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html('Related Posts'));
417 417
 	return $headline;
418 418
 }
419
-add_filter( 'jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline' );
419
+add_filter('jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline');
Please login to merge, or discard this patch.
Braces   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -227,8 +227,9 @@  discard block
 block discarded – undo
227 227
 
228 228
 	$post_type = get_post_type_object( $post->post_type );
229 229
 
230
-	if ( !current_user_can( $post_type->cap->edit_post, $post_id ) )
231
-		return $post_id;
230
+	if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) {
231
+			return $post_id;
232
+	}
232 233
 
233 234
 
234 235
 	$meta_keys = array('lsx-website','lsx-client');
@@ -239,14 +240,13 @@  discard block
 block discarded – undo
239 240
 
240 241
 		$meta_value = get_post_meta( $post_id, $meta_key, true );
241 242
 
242
-		if ( $new_meta_value && '' == $meta_value )
243
-			add_post_meta( $post_id, $meta_key, $new_meta_value, true );
244
-
245
-		elseif ( $new_meta_value && $new_meta_value != $meta_value )
246
-		update_post_meta( $post_id, $meta_key, $new_meta_value );
247
-
248
-		elseif ( '' == $new_meta_value && $meta_value )
249
-		delete_post_meta( $post_id, $meta_key, $meta_value );
243
+		if ( $new_meta_value && '' == $meta_value ) {
244
+					add_post_meta( $post_id, $meta_key, $new_meta_value, true );
245
+		} elseif ( $new_meta_value && $new_meta_value != $meta_value ) {
246
+				update_post_meta( $post_id, $meta_key, $new_meta_value );
247
+		} elseif ( '' == $new_meta_value && $meta_value ) {
248
+				delete_post_meta( $post_id, $meta_key, $meta_value );
249
+		}
250 250
 
251 251
 	}
252 252
 }
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 		
400 400
 		if('jetpack-portfolio' == get_post_type()){
401 401
 			get_template_part( 'content', 'portfolio' );
402
-		}else{
402
+		} else{
403 403
 			get_template_part( 'content', get_post_type() );
404 404
 		}
405 405
 	}
Please login to merge, or discard this patch.