@@ -14,7 +14,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -271,12 +271,12 @@ discard block |
||
| 271 | 271 | || (is_singular('jetpack-portfolio')) ) { ?> |
| 272 | 272 | |
| 273 | 273 | <?php |
| 274 | - $bg_image = ''; |
|
| 275 | - if(has_post_thumbnail()){ |
|
| 276 | - $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 277 | - $bg_image = $bg_image[0]; |
|
| 278 | - } |
|
| 279 | - ?> |
|
| 274 | + $bg_image = ''; |
|
| 275 | + if(has_post_thumbnail()){ |
|
| 276 | + $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 277 | + $bg_image = $bg_image[0]; |
|
| 278 | + } |
|
| 279 | + ?> |
|
| 280 | 280 | |
| 281 | 281 | <?php if ( ! empty( $bg_image ) ) : ?> |
| 282 | 282 | |
@@ -309,8 +309,8 @@ discard block |
||
| 309 | 309 | * @category mobile |
| 310 | 310 | */ |
| 311 | 311 | function lsx_allow_sms_protocol( $protocols ) { |
| 312 | - $protocols[] = 'sms'; |
|
| 313 | - return $protocols; |
|
| 312 | + $protocols[] = 'sms'; |
|
| 313 | + return $protocols; |
|
| 314 | 314 | } |
| 315 | 315 | add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' ); |
| 316 | 316 | |
@@ -322,27 +322,27 @@ discard block |
||
| 322 | 322 | $http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); |
| 323 | 323 | $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
| 324 | 324 | |
| 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) { |
|
| 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]; |
|
| 336 | - } else $classes[] = 'unknown'; |
|
| 337 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 338 | - if ( stristr( $http_user_agent, "mac") ) { |
|
| 339 | - $classes[] = 'osx'; |
|
| 340 | - } elseif ( stristr( $http_user_agent, "linux") ) { |
|
| 341 | - $classes[] = 'linux'; |
|
| 342 | - } elseif ( stristr( $http_user_agent, "windows") ) { |
|
| 343 | - $classes[] = 'windows'; |
|
| 344 | - } |
|
| 345 | - return $classes; |
|
| 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) { |
|
| 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]; |
|
| 336 | + } else $classes[] = 'unknown'; |
|
| 337 | + if($is_iphone) $classes[] = 'iphone'; |
|
| 338 | + if ( stristr( $http_user_agent, "mac") ) { |
|
| 339 | + $classes[] = 'osx'; |
|
| 340 | + } elseif ( stristr( $http_user_agent, "linux") ) { |
|
| 341 | + $classes[] = 'linux'; |
|
| 342 | + } elseif ( stristr( $http_user_agent, "windows") ) { |
|
| 343 | + $classes[] = 'windows'; |
|
| 344 | + } |
|
| 345 | + return $classes; |
|
| 346 | 346 | } |
| 347 | 347 | add_filter('body_class','mv_browser_body_class'); |
| 348 | 348 | |
@@ -1,5 +1,5 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 445 | 445 | $wpse_excerpt = trim(force_balance_tags($excerpt_output)); |
| 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 |
||
| 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'); |
|
@@ -1,5 +1,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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) { |
@@ -323,18 +326,29 @@ discard block |
||
| 323 | 326 | $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
| 324 | 327 | |
| 325 | 328 | 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) { |
|
| 329 | + if($is_lynx) { |
|
| 330 | + $classes[] = 'lynx'; |
|
| 331 | + } elseif($is_gecko) { |
|
| 332 | + $classes[] = 'gecko'; |
|
| 333 | + } elseif($is_opera) { |
|
| 334 | + $classes[] = 'opera'; |
|
| 335 | + } elseif($is_ns4) { |
|
| 336 | + $classes[] = 'ns4'; |
|
| 337 | + } elseif($is_safari) { |
|
| 338 | + $classes[] = 'safari'; |
|
| 339 | + } elseif($is_chrome) { |
|
| 340 | + $classes[] = 'chrome'; |
|
| 341 | + } elseif($is_ie) { |
|
| 333 | 342 | $classes[] = 'ie'; |
| 334 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) |
|
| 335 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 336 | - } else $classes[] = 'unknown'; |
|
| 337 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 343 | + if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $http_user_agent, $browser_version)) { |
|
| 344 | + $classes[] = 'ie'.$browser_version[1]; |
|
| 345 | + } |
|
| 346 | + } else { |
|
| 347 | + $classes[] = 'unknown'; |
|
| 348 | + } |
|
| 349 | + if($is_iphone) { |
|
| 350 | + $classes[] = 'iphone'; |
|
| 351 | + } |
|
| 338 | 352 | if ( stristr( $http_user_agent, "mac") ) { |
| 339 | 353 | $classes[] = 'osx'; |
| 340 | 354 | } elseif ( stristr( $http_user_agent, "linux") ) { |
@@ -392,8 +406,7 @@ discard block |
||
| 392 | 406 | |
| 393 | 407 | if ( ! empty( $pagination ) ) { |
| 394 | 408 | $excerpt .= $pagination; |
| 395 | - } |
|
| 396 | - else { |
|
| 409 | + } else { |
|
| 397 | 410 | $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>'; |
| 398 | 411 | } |
| 399 | 412 | } |