@@ -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 | class lsx_bootstrap_navwalker extends Walker_Nav_Menu { |
| 5 | 8 | |
@@ -71,14 +74,17 @@ discard block |
||
| 71 | 74 | |
| 72 | 75 | $class_names = join( ' ', $classes ); |
| 73 | 76 | |
| 74 | - if ( $args->has_children ) |
|
| 75 | - $class_names .= ' dropdown'; |
|
| 77 | + if ( $args->has_children ) { |
|
| 78 | + $class_names .= ' dropdown'; |
|
| 79 | + } |
|
| 76 | 80 | |
| 77 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 78 | - $class_names .= ' active'; |
|
| 81 | + if ( in_array( 'current-menu-item', $classes ) ) { |
|
| 82 | + $class_names .= ' active'; |
|
| 83 | + } |
|
| 79 | 84 | |
| 80 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 81 | - $class_names .= ' active'; |
|
| 85 | + if ( in_array( 'current-menu-parent', $classes ) ) { |
|
| 86 | + $class_names .= ' active'; |
|
| 87 | + } |
|
| 82 | 88 | |
| 83 | 89 | //Check if this is ment to be a "social" type menu |
| 84 | 90 | $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
@@ -159,14 +165,16 @@ discard block |
||
| 159 | 165 | * @return null Null on failure with no changes to parameters. |
| 160 | 166 | */ |
| 161 | 167 | public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
| 162 | - if ( ! $element ) |
|
| 163 | - return; |
|
| 168 | + if ( ! $element ) { |
|
| 169 | + return; |
|
| 170 | + } |
|
| 164 | 171 | |
| 165 | 172 | $id_field = $this->db_fields['id']; |
| 166 | 173 | |
| 167 | 174 | // Display this element. |
| 168 | - if ( is_object( $args[0] ) ) |
|
| 169 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 175 | + if ( is_object( $args[0] ) ) { |
|
| 176 | + $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 177 | + } |
|
| 170 | 178 | |
| 171 | 179 | parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
| 172 | 180 | } |
@@ -192,29 +200,34 @@ discard block |
||
| 192 | 200 | if ( $container ) { |
| 193 | 201 | $fb_output = '<' . $container; |
| 194 | 202 | |
| 195 | - if ( $container_id ) |
|
| 196 | - $fb_output .= ' id="' . $container_id . '"'; |
|
| 203 | + if ( $container_id ) { |
|
| 204 | + $fb_output .= ' id="' . $container_id . '"'; |
|
| 205 | + } |
|
| 197 | 206 | |
| 198 | - if ( $container_class ) |
|
| 199 | - $fb_output .= ' class="' . $container_class . '"'; |
|
| 207 | + if ( $container_class ) { |
|
| 208 | + $fb_output .= ' class="' . $container_class . '"'; |
|
| 209 | + } |
|
| 200 | 210 | |
| 201 | 211 | $fb_output .= '>'; |
| 202 | 212 | } |
| 203 | 213 | |
| 204 | 214 | $fb_output .= '<ul'; |
| 205 | 215 | |
| 206 | - if ( $menu_id ) |
|
| 207 | - $fb_output .= ' id="' . $menu_id . '"'; |
|
| 216 | + if ( $menu_id ) { |
|
| 217 | + $fb_output .= ' id="' . $menu_id . '"'; |
|
| 218 | + } |
|
| 208 | 219 | |
| 209 | - if ( $menu_class ) |
|
| 210 | - $fb_output .= ' class="' . $menu_class . '"'; |
|
| 220 | + if ( $menu_class ) { |
|
| 221 | + $fb_output .= ' class="' . $menu_class . '"'; |
|
| 222 | + } |
|
| 211 | 223 | |
| 212 | 224 | $fb_output .= '>'; |
| 213 | 225 | $fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">'.__('Add a menu','lsx').'</a></li>'; |
| 214 | 226 | $fb_output .= '</ul>'; |
| 215 | 227 | |
| 216 | - if ( $container ) |
|
| 217 | - $fb_output .= '</' . $container . '>'; |
|
| 228 | + if ( $container ) { |
|
| 229 | + $fb_output .= '</' . $container . '>'; |
|
| 230 | + } |
|
| 218 | 231 | |
| 219 | 232 | echo $fb_output; |
| 220 | 233 | } |
@@ -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 | * Layout hooks |
@@ -62,7 +65,7 @@ discard block |
||
| 62 | 65 | $show_on_front = get_option('show_on_front'); |
| 63 | 66 | if('page' == $show_on_front){ |
| 64 | 67 | return lsx_layout_selector( 'main', 'home' ); |
| 65 | - }else{ |
|
| 68 | + } else{ |
|
| 66 | 69 | return lsx_layout_selector( 'main', 'site' ); |
| 67 | 70 | } |
| 68 | 71 | |
@@ -221,13 +221,15 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | if ( (!isset( $_POST['lsx_website_nonce'] ) || !wp_verify_nonce( $_POST['lsx_website_nonce'], basename( __FILE__ ) )) |
| 224 | - || (!isset( $_POST['lsx_client_nonce'] ) || !wp_verify_nonce( $_POST['lsx_client_nonce'], basename( __FILE__ ) )) ) |
|
| 225 | - return $post_id; |
|
| 224 | + || (!isset( $_POST['lsx_client_nonce'] ) || !wp_verify_nonce( $_POST['lsx_client_nonce'], basename( __FILE__ ) )) ) { |
|
| 225 | + return $post_id; |
|
| 226 | + } |
|
| 226 | 227 | |
| 227 | 228 | $post_type = get_post_type_object( $post->post_type ); |
| 228 | 229 | |
| 229 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) |
|
| 230 | - return $post_id; |
|
| 230 | + if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) { |
|
| 231 | + return $post_id; |
|
| 232 | + } |
|
| 231 | 233 | |
| 232 | 234 | |
| 233 | 235 | $meta_keys = array('lsx-website','lsx-client'); |
@@ -238,14 +240,13 @@ discard block |
||
| 238 | 240 | |
| 239 | 241 | $meta_value = get_post_meta( $post_id, $meta_key, true ); |
| 240 | 242 | |
| 241 | - if ( $new_meta_value && '' == $meta_value ) |
|
| 242 | - add_post_meta( $post_id, $meta_key, $new_meta_value, true ); |
|
| 243 | - |
|
| 244 | - elseif ( $new_meta_value && $new_meta_value != $meta_value ) |
|
| 245 | - update_post_meta( $post_id, $meta_key, $new_meta_value ); |
|
| 246 | - |
|
| 247 | - elseif ( '' == $new_meta_value && $meta_value ) |
|
| 248 | - 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 | + } |
|
| 249 | 250 | |
| 250 | 251 | } |
| 251 | 252 | } |
@@ -398,7 +399,7 @@ discard block |
||
| 398 | 399 | |
| 399 | 400 | if('jetpack-portfolio' == get_post_type()){ |
| 400 | 401 | get_template_part( 'content', 'portfolio' ); |
| 401 | - }else{ |
|
| 402 | + } else{ |
|
| 402 | 403 | get_template_part( 'content', get_post_type() ); |
| 403 | 404 | } |
| 404 | 405 | } |
@@ -1,5 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) return; |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | + return; |
|
| 4 | +} |
|
| 3 | 5 | |
| 4 | 6 | /* |
| 5 | 7 | * LSX Lazy Load Images Class |
@@ -25,8 +27,9 @@ discard block |
||
| 25 | 27 | protected static $noscripts = array(); |
| 26 | 28 | |
| 27 | 29 | static function init() { |
| 28 | - if ( is_admin() ) |
|
| 29 | - return; |
|
| 30 | + if ( is_admin() ) { |
|
| 31 | + return; |
|
| 32 | + } |
|
| 30 | 33 | |
| 31 | 34 | if ( get_theme_mod( 'lsx_lazyload_status', '1' ) === false ) { |
| 32 | 35 | self::$enabled = false; |
@@ -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 | * lsx Comment Walker |
@@ -67,7 +70,7 @@ discard block |
||
| 67 | 70 | foreach($fields as &$field){ |
| 68 | 71 | if(stristr('class=', $field)){ |
| 69 | 72 | $field = str_replace('class="', 'class="form-control ', $field); |
| 70 | - }else{ |
|
| 73 | + } else{ |
|
| 71 | 74 | $field = str_replace('<input', '<input class="form-control" ', $field); |
| 72 | 75 | } |
| 73 | 76 | } |
@@ -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 | * Yoast Breadcrumbs on Twitter Bootstrap |
@@ -24,7 +27,7 @@ discard block |
||
| 24 | 27 | woocommerce_breadcrumb(); |
| 25 | 28 | $output = ob_get_clean(); |
| 26 | 29 | $output = str_replace('woocommerce-breadcrumb', 'woocommerce-breadcrumb breadcrumbs-container', $output); |
| 27 | - }elseif(function_exists('yoast_breadcrumb')){ |
|
| 30 | + } elseif(function_exists('yoast_breadcrumb')){ |
|
| 28 | 31 | // Default Yoast Breadcrumbs Separator |
| 29 | 32 | $old_sep = '\»\;'; |
| 30 | 33 | |
@@ -272,9 +275,9 @@ discard block |
||
| 272 | 275 | |
| 273 | 276 | if(current_theme_supports('infinite-scroll') && class_exists('The_Neverending_Home_Page')){ |
| 274 | 277 | return true; |
| 275 | - }elseif(function_exists('wp_pagenavi')){ |
|
| 278 | + } elseif(function_exists('wp_pagenavi')){ |
|
| 276 | 279 | wp_pagenavi(); |
| 277 | - }else{ |
|
| 280 | + } else{ |
|
| 278 | 281 | |
| 279 | 282 | $labels = array( |
| 280 | 283 | 'next' => '<span class="meta-nav">←</span> '.__( 'Older posts', 'lsx' ), |
@@ -354,9 +357,9 @@ discard block |
||
| 354 | 357 | |
| 355 | 358 | if ( function_exists('has_custom_logo') && has_custom_logo() ) { |
| 356 | 359 | the_custom_logo(); |
| 357 | - }elseif ( function_exists( 'jetpack_has_site_logo' ) && jetpack_has_site_logo() ) { |
|
| 360 | + } elseif ( function_exists( 'jetpack_has_site_logo' ) && jetpack_has_site_logo() ) { |
|
| 358 | 361 | jetpack_the_site_logo(); |
| 359 | - }else{ |
|
| 362 | + } else{ |
|
| 360 | 363 | // shouldn't show both together.. its just strange |
| 361 | 364 | if(true == get_theme_mod('site_logo_header_text',1)){ |
| 362 | 365 | lsx_site_title(); |
@@ -498,7 +501,7 @@ discard block |
||
| 498 | 501 | $post_type_object = get_post_type_object($post_type); |
| 499 | 502 | if(null != $post_type_object){ |
| 500 | 503 | $title = $post_type_object->labels->name; |
| 501 | - }else{ |
|
| 504 | + } else{ |
|
| 502 | 505 | $title = ucwords($post_type); |
| 503 | 506 | } |
| 504 | 507 | |
@@ -640,8 +643,9 @@ discard block |
||
| 640 | 643 | * @category urls |
| 641 | 644 | */ |
| 642 | 645 | function lsx_get_my_url() { |
| 643 | - if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) |
|
| 644 | - return false; |
|
| 646 | + if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) { |
|
| 647 | + return false; |
|
| 648 | + } |
|
| 645 | 649 | |
| 646 | 650 | return esc_url_raw( $matches[1] ); |
| 647 | 651 | } |
@@ -658,14 +662,14 @@ discard block |
||
| 658 | 662 | $part = (string) $part; |
| 659 | 663 | if ( '' !== $part ){ |
| 660 | 664 | $template = "{$slug}-{$part}.php"; |
| 661 | - }else{ |
|
| 665 | + } else{ |
|
| 662 | 666 | $template = "{$slug}.php"; |
| 663 | 667 | } |
| 664 | 668 | $file_path = apply_filters('lsx_content_path',false,$slug,$part); |
| 665 | 669 | |
| 666 | 670 | if ( false !== $file_path && '' == locate_template( array( $template ) ) && file_exists( $file_path.$template) ) { |
| 667 | 671 | load_template( $file_path.$template, false ); |
| 668 | - }else{ |
|
| 672 | + } else{ |
|
| 669 | 673 | get_template_part($slug,$part); |
| 670 | 674 | } |
| 671 | 675 | } |
| 672 | 676 | \ No newline at end of file |
@@ -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 |
@@ -204,10 +207,10 @@ discard block |
||
| 204 | 207 | if(false === $image_src){ |
| 205 | 208 | $post_id = get_the_ID(); |
| 206 | 209 | $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
| 207 | - }elseif(false != $image_src ){ |
|
| 210 | + } elseif(false != $image_src ){ |
|
| 208 | 211 | if(is_numeric($image_src)){ |
| 209 | 212 | $post_thumbnail_id = $image_src; |
| 210 | - }else{ |
|
| 213 | + } else{ |
|
| 211 | 214 | $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
| 212 | 215 | } |
| 213 | 216 | } |
@@ -217,7 +220,7 @@ discard block |
||
| 217 | 220 | $srcset = false; |
| 218 | 221 | $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
| 219 | 222 | $img = $img[0]; |
| 220 | - }else{ |
|
| 223 | + } else{ |
|
| 221 | 224 | $srcset = true; |
| 222 | 225 | $img = wp_get_attachment_image_srcset($post_thumbnail_id,$size); |
| 223 | 226 | if($img == false) { |
@@ -327,18 +330,29 @@ discard block |
||
| 327 | 330 | */ |
| 328 | 331 | function mv_browser_body_class($classes) { |
| 329 | 332 | global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; |
| 330 | - if($is_lynx) $classes[] = 'lynx'; |
|
| 331 | - elseif($is_gecko) $classes[] = 'gecko'; |
|
| 332 | - elseif($is_opera) $classes[] = 'opera'; |
|
| 333 | - elseif($is_NS4) $classes[] = 'ns4'; |
|
| 334 | - elseif($is_safari) $classes[] = 'safari'; |
|
| 335 | - elseif($is_chrome) $classes[] = 'chrome'; |
|
| 336 | - elseif($is_IE) { |
|
| 333 | + if($is_lynx) { |
|
| 334 | + $classes[] = 'lynx'; |
|
| 335 | + } elseif($is_gecko) { |
|
| 336 | + $classes[] = 'gecko'; |
|
| 337 | + } elseif($is_opera) { |
|
| 338 | + $classes[] = 'opera'; |
|
| 339 | + } elseif($is_NS4) { |
|
| 340 | + $classes[] = 'ns4'; |
|
| 341 | + } elseif($is_safari) { |
|
| 342 | + $classes[] = 'safari'; |
|
| 343 | + } elseif($is_chrome) { |
|
| 344 | + $classes[] = 'chrome'; |
|
| 345 | + } elseif($is_IE) { |
|
| 337 | 346 | $classes[] = 'ie'; |
| 338 | - if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $browser_version)) |
|
| 339 | - $classes[] = 'ie'.$browser_version[1]; |
|
| 340 | - } else $classes[] = 'unknown'; |
|
| 341 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 347 | + if(preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $browser_version)) { |
|
| 348 | + $classes[] = 'ie'.$browser_version[1]; |
|
| 349 | + } |
|
| 350 | + } else { |
|
| 351 | + $classes[] = 'unknown'; |
|
| 352 | + } |
|
| 353 | + if($is_iphone) { |
|
| 354 | + $classes[] = 'iphone'; |
|
| 355 | + } |
|
| 342 | 356 | if ( stristr( $_SERVER['HTTP_USER_AGENT'],"mac") ) { |
| 343 | 357 | $classes[] = 'osx'; |
| 344 | 358 | } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"linux") ) { |
@@ -396,8 +410,7 @@ discard block |
||
| 396 | 410 | |
| 397 | 411 | if ( ! empty( $pagination ) ) { |
| 398 | 412 | $excerpt .= $pagination; |
| 399 | - } |
|
| 400 | - else { |
|
| 413 | + } else { |
|
| 401 | 414 | $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>'; |
| 402 | 415 | } |
| 403 | 416 | } |
@@ -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 | * Enqueue scripts and styles. |
@@ -29,7 +32,7 @@ discard block |
||
| 29 | 32 | wp_enqueue_script('imagesLoaded', get_template_directory_uri().'/js/vendor/imagesloaded.pkgd.min.js', array('jquery','masonry')); |
| 30 | 33 | if(defined('WP_DEBUG') && true === WP_DEBUG){ |
| 31 | 34 | wp_enqueue_script('lsx_script', get_template_directory_uri() . '/js/lsx-script.js', array('masonry'), null, false); |
| 32 | - }else{ |
|
| 35 | + } else{ |
|
| 33 | 36 | wp_enqueue_script('lsx_script', get_template_directory_uri() . '/js/lsx-script.min.js', array('masonry'), null, false); |
| 34 | 37 | } |
| 35 | 38 | |
@@ -107,9 +110,15 @@ discard block |
||
| 107 | 110 | */ |
| 108 | 111 | function lsx_scripts_defer_parsing( $url ) { |
| 109 | 112 | if ( ! ( is_admin() ) ) { |
| 110 | - if ( FALSE === strpos( $url, '.js' ) ) return $url; |
|
| 111 | - if ( strpos( $url, 'jquery.js' ) ) return $url; |
|
| 112 | - if ( strpos( $url, ' defer ' ) ) return $url; |
|
| 113 | + if ( FALSE === strpos( $url, '.js' ) ) { |
|
| 114 | + return $url; |
|
| 115 | + } |
|
| 116 | + if ( strpos( $url, 'jquery.js' ) ) { |
|
| 117 | + return $url; |
|
| 118 | + } |
|
| 119 | + if ( strpos( $url, ' defer ' ) ) { |
|
| 120 | + return $url; |
|
| 121 | + } |
|
| 113 | 122 | return "$url' defer onload='"; |
| 114 | 123 | } |
| 115 | 124 | |
@@ -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 | * Customizer Configuration File |
@@ -164,7 +167,7 @@ discard block |
||
| 164 | 167 | $control = new $control_class( $wp_customize, $slug, array_merge( $default_args, $args ) ); |
| 165 | 168 | $wp_customize->add_control( $control ); |
| 166 | 169 | |
| 167 | - }else{ |
|
| 170 | + } else{ |
|
| 168 | 171 | |
| 169 | 172 | if( isset( $args['control'] ) ){ |
| 170 | 173 | unset( $args['control'] ); |