@@ -128,7 +128,7 @@ |
||
| 128 | 128 | * Builds an image object array from an image URL |
| 129 | 129 | * |
| 130 | 130 | * @param string $image_url |
| 131 | - * @param string|array $size Optional. Image size. Accepts any valid image size, or an array of width |
|
| 131 | + * @param integer[] $size Optional. Image size. Accepts any valid image size, or an array of width |
|
| 132 | 132 | * and height values in pixels (in that order). Default 'full'. |
| 133 | 133 | * |
| 134 | 134 | * @return bool|array |
@@ -15,9 +15,9 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | function lsx_amp_init() { |
| 18 | - add_post_type_support( 'jetpack-portfolio', AMP_QUERY_VAR ); |
|
| 19 | - add_post_type_support( 'pages', AMP_QUERY_VAR ); |
|
| 20 | - add_post_type_support( 'product', AMP_QUERY_VAR ); |
|
| 18 | + add_post_type_support( 'jetpack-portfolio', AMP_QUERY_VAR ); |
|
| 19 | + add_post_type_support( 'pages', AMP_QUERY_VAR ); |
|
| 20 | + add_post_type_support( 'product', AMP_QUERY_VAR ); |
|
| 21 | 21 | } |
| 22 | 22 | add_action( 'amp_init', 'lsx_amp_init' ); |
| 23 | 23 | |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @category template |
| 31 | 31 | */ |
| 32 | 32 | function lxs_amp_custom_template( $file, $type, $post ) { |
| 33 | - if ( 'single' === $type) { |
|
| 34 | - $file = get_template_directory() . '/mobile-templates/single-'.$post->post_type.'.php'; |
|
| 35 | - } |
|
| 36 | - return $file; |
|
| 33 | + if ( 'single' === $type) { |
|
| 34 | + $file = get_template_directory() . '/mobile-templates/single-'.$post->post_type.'.php'; |
|
| 35 | + } |
|
| 36 | + return $file; |
|
| 37 | 37 | } |
| 38 | 38 | add_filter( 'amp_post_template_file', 'lxs_amp_custom_template', 10, 3 ); |
| 39 | 39 | |
@@ -15,11 +15,11 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | function lsx_amp_init() { |
| 18 | - add_post_type_support( 'jetpack-portfolio', AMP_QUERY_VAR ); |
|
| 19 | - add_post_type_support( 'pages', AMP_QUERY_VAR ); |
|
| 20 | - add_post_type_support( 'product', AMP_QUERY_VAR ); |
|
| 18 | + add_post_type_support('jetpack-portfolio', AMP_QUERY_VAR); |
|
| 19 | + add_post_type_support('pages', AMP_QUERY_VAR); |
|
| 20 | + add_post_type_support('product', AMP_QUERY_VAR); |
|
| 21 | 21 | } |
| 22 | -add_action( 'amp_init', 'lsx_amp_init' ); |
|
| 22 | +add_action('amp_init', 'lsx_amp_init'); |
|
| 23 | 23 | |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | * @subpackage amp |
| 30 | 30 | * @category template |
| 31 | 31 | */ |
| 32 | -function lxs_amp_custom_template( $file, $type, $post ) { |
|
| 33 | - if ( 'single' === $type) { |
|
| 34 | - $file = get_template_directory() . '/mobile-templates/single-'.$post->post_type.'.php'; |
|
| 32 | +function lxs_amp_custom_template($file, $type, $post) { |
|
| 33 | + if ('single' === $type) { |
|
| 34 | + $file = get_template_directory() . '/mobile-templates/single-' . $post->post_type . '.php'; |
|
| 35 | 35 | } |
| 36 | 36 | return $file; |
| 37 | 37 | } |
| 38 | -add_filter( 'amp_post_template_file', 'lxs_amp_custom_template', 10, 3 ); |
|
| 38 | +add_filter('amp_post_template_file', 'lxs_amp_custom_template', 10, 3); |
|
| 39 | 39 | |
| 40 | 40 | /** |
| 41 | 41 | * @package YoastSEO_AMP_Glue |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * Defines the YoastSEO AMP class. In a wrapper function so we can overwrite this from within Yoast SEO later on. |
| 56 | 56 | */ |
| 57 | -if ( ! class_exists( 'YoastSEO_AMP' ) ) { |
|
| 57 | +if ( ! class_exists('YoastSEO_AMP')) { |
|
| 58 | 58 | /** |
| 59 | 59 | * This class improves upon the AMP output by the default WordPress AMP plugin using Yoast SEO metadata. |
| 60 | 60 | */ |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | public function __construct() { |
| 74 | 74 | $this->front = WPSEO_Frontend::get_instance(); |
| 75 | 75 | $this->options = WPSEO_Options::get_all(); |
| 76 | - add_filter( 'amp_post_template_data', array( $this, 'fix_amp_post_data' ), 10, 2 ); |
|
| 77 | - add_filter( 'amp_post_template_metadata', array( $this, 'fix_amp_post_metadata' ), 10, 2 ); |
|
| 76 | + add_filter('amp_post_template_data', array($this, 'fix_amp_post_data'), 10, 2); |
|
| 77 | + add_filter('amp_post_template_metadata', array($this, 'fix_amp_post_metadata'), 10, 2); |
|
| 78 | 78 | } |
| 79 | 79 | /** |
| 80 | 80 | * Fix the basic AMP post data |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return array |
| 86 | 86 | */ |
| 87 | - public function fix_amp_post_data( $data, $post ) { |
|
| 88 | - $data['canonical_url'] = $this->front->canonical( false ); |
|
| 87 | + public function fix_amp_post_data($data, $post) { |
|
| 88 | + $data['canonical_url'] = $this->front->canonical(false); |
|
| 89 | 89 | return $data; |
| 90 | 90 | } |
| 91 | 91 | /** |
@@ -96,14 +96,14 @@ discard block |
||
| 96 | 96 | * |
| 97 | 97 | * @return array |
| 98 | 98 | */ |
| 99 | - public function fix_amp_post_metadata( $metadata, $post ) { |
|
| 100 | - $this->build_organization_object( $metadata ); |
|
| 101 | - $desc = $this->front->metadesc( false ); |
|
| 102 | - if ( $desc ) { |
|
| 99 | + public function fix_amp_post_metadata($metadata, $post) { |
|
| 100 | + $this->build_organization_object($metadata); |
|
| 101 | + $desc = $this->front->metadesc(false); |
|
| 102 | + if ($desc) { |
|
| 103 | 103 | $metadata['description'] = $desc; |
| 104 | 104 | } |
| 105 | - $og_img = $this->get_image_object( WPSEO_Meta::get_value( 'opengraph-image', $post->ID ) ); |
|
| 106 | - if ( is_array( $og_img ) ) { |
|
| 105 | + $og_img = $this->get_image_object(WPSEO_Meta::get_value('opengraph-image', $post->ID)); |
|
| 106 | + if (is_array($og_img)) { |
|
| 107 | 107 | $metadata['image'] = $og_img; |
| 108 | 108 | } |
| 109 | 109 | return $metadata; |
@@ -113,14 +113,14 @@ discard block |
||
| 113 | 113 | * |
| 114 | 114 | * @param array $metadata |
| 115 | 115 | */ |
| 116 | - private function build_organization_object( &$metadata ) { |
|
| 116 | + private function build_organization_object(&$metadata) { |
|
| 117 | 117 | // While it's using the blog name, it's actually outputting the company name |
| 118 | - if ( ! empty( $this->options['company_name'] ) ) { |
|
| 118 | + if ( ! empty($this->options['company_name'])) { |
|
| 119 | 119 | $metadata['publisher']['name'] = $this->options['company_name']; |
| 120 | 120 | } |
| 121 | 121 | // The logo needs to be 600px wide max, 60px high max |
| 122 | - $logo = $this->get_image_object( $this->options['company_logo'], array( 600, 60 ) ); |
|
| 123 | - if ( is_array( $logo ) ) { |
|
| 122 | + $logo = $this->get_image_object($this->options['company_logo'], array(600, 60)); |
|
| 123 | + if (is_array($logo)) { |
|
| 124 | 124 | $metadata['publisher']['logo'] = $logo; |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -133,13 +133,13 @@ discard block |
||
| 133 | 133 | * |
| 134 | 134 | * @return bool|array |
| 135 | 135 | */ |
| 136 | - private function get_image_object( $image_url, $size = 'full' ) { |
|
| 137 | - if ( empty( $image_url ) ) { |
|
| 136 | + private function get_image_object($image_url, $size = 'full') { |
|
| 137 | + if (empty($image_url)) { |
|
| 138 | 138 | return false; |
| 139 | 139 | } |
| 140 | - $image_id = attachment_url_to_postid( $image_url ); |
|
| 141 | - $image_src = wp_get_attachment_image_src( $image_id, $size ); |
|
| 142 | - if ( is_array( $image_src ) ) { |
|
| 140 | + $image_id = attachment_url_to_postid($image_url); |
|
| 141 | + $image_src = wp_get_attachment_image_src($image_id, $size); |
|
| 142 | + if (is_array($image_src)) { |
|
| 143 | 143 | return array( |
| 144 | 144 | '@type' => 'ImageObject', |
| 145 | 145 | 'url' => $image_src[0], |
@@ -155,11 +155,11 @@ discard block |
||
| 155 | 155 | * Initialize the Yoast SEO AMP Glue plugin |
| 156 | 156 | */ |
| 157 | 157 | function lsx_yoast_seo_amp_glue_init() { |
| 158 | - if ( class_exists( 'WPSEO_Frontend' ) ) { |
|
| 158 | + if (class_exists('WPSEO_Frontend')) { |
|
| 159 | 159 | new YoastSEO_AMP(); |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | -add_action( 'init', 'lsx_yoast_seo_amp_glue_init', 12 ); |
|
| 162 | +add_action('init', 'lsx_yoast_seo_amp_glue_init', 12); |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * Load custom CSS |
@@ -169,4 +169,4 @@ discard block |
||
| 169 | 169 | <link href="<?php echo get_stylesheet_directory_uri(); ?>/css/amp.css" rel="stylesheet" type="text/css"> |
| 170 | 170 | <?php |
| 171 | 171 | } |
| 172 | -add_action( 'amp_post_template_head', 'lsx_add_amp_css'); |
|
| 173 | 172 | \ No newline at end of file |
| 173 | +add_action('amp_post_template_head', 'lsx_add_amp_css'); |
|
| 174 | 174 | \ No newline at end of file |
@@ -198,6 +198,7 @@ discard block |
||
| 198 | 198 | * @package lsx |
| 199 | 199 | * @subpackage extras |
| 200 | 200 | * @category thumbnails |
| 201 | + * @param string $size |
|
| 201 | 202 | */ |
| 202 | 203 | function lsx_get_thumbnail($size,$image_src = false){ |
| 203 | 204 | |
@@ -252,6 +253,7 @@ discard block |
||
| 252 | 253 | * @package lsx |
| 253 | 254 | * @subpackage extras |
| 254 | 255 | * @category thumbnails |
| 256 | + * @param boolean $image_src |
|
| 255 | 257 | */ |
| 256 | 258 | function lsx_get_attachment_id_from_src($image_src) { |
| 257 | 259 | global $wpdb; |
@@ -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 | |
@@ -278,12 +278,12 @@ discard block |
||
| 278 | 278 | || (is_singular('jetpack-portfolio')) ) { ?> |
| 279 | 279 | |
| 280 | 280 | <?php |
| 281 | - $bg_image = ''; |
|
| 282 | - if(has_post_thumbnail()){ |
|
| 283 | - $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 284 | - $bg_image = $bg_image[0]; |
|
| 285 | - } |
|
| 286 | - ?> |
|
| 281 | + $bg_image = ''; |
|
| 282 | + if(has_post_thumbnail()){ |
|
| 283 | + $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 284 | + $bg_image = $bg_image[0]; |
|
| 285 | + } |
|
| 286 | + ?> |
|
| 287 | 287 | |
| 288 | 288 | <?php if ( ! empty( $bg_image ) ) : ?> |
| 289 | 289 | |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | * @category mobile |
| 317 | 317 | */ |
| 318 | 318 | function lsx_allow_sms_protocol( $protocols ) { |
| 319 | - $protocols[] = 'sms'; |
|
| 320 | - return $protocols; |
|
| 319 | + $protocols[] = 'sms'; |
|
| 320 | + return $protocols; |
|
| 321 | 321 | } |
| 322 | 322 | add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' ); |
| 323 | 323 | |
@@ -326,27 +326,27 @@ discard block |
||
| 326 | 326 | * Adding browser and user-agent classes to body |
| 327 | 327 | */ |
| 328 | 328 | function mv_browser_body_class($classes) { |
| 329 | - 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) { |
|
| 337 | - $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'; |
|
| 342 | - if ( stristr( $_SERVER['HTTP_USER_AGENT'],"mac") ) { |
|
| 343 | - $classes[] = 'osx'; |
|
| 344 | - } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"linux") ) { |
|
| 345 | - $classes[] = 'linux'; |
|
| 346 | - } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"windows") ) { |
|
| 347 | - $classes[] = 'windows'; |
|
| 348 | - } |
|
| 349 | - return $classes; |
|
| 329 | + 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) { |
|
| 337 | + $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'; |
|
| 342 | + if ( stristr( $_SERVER['HTTP_USER_AGENT'],"mac") ) { |
|
| 343 | + $classes[] = 'osx'; |
|
| 344 | + } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"linux") ) { |
|
| 345 | + $classes[] = 'linux'; |
|
| 346 | + } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"windows") ) { |
|
| 347 | + $classes[] = 'windows'; |
|
| 348 | + } |
|
| 349 | + return $classes; |
|
| 350 | 350 | } |
| 351 | 351 | add_filter('body_class','mv_browser_body_class'); |
| 352 | 352 | |
@@ -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,8 +99,8 @@ 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 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | add_filter('style_loader_tag', 'lsx_clean_style_tag'); |
| 117 | 117 | |
| 118 | 118 | |
| 119 | -if (!function_exists('lsx_get_attachment_id')) { |
|
| 119 | +if ( ! function_exists('lsx_get_attachment_id')) { |
|
| 120 | 120 | /** |
| 121 | 121 | * Get the Attachment ID for a given image URL. |
| 122 | 122 | * |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | function lsx_get_attachment_id($url) { |
| 128 | 128 | $dir = wp_upload_dir(); |
| 129 | 129 | // baseurl never has a trailing slash |
| 130 | - if (false === strpos($url, $dir['baseurl'].'/')) { |
|
| 130 | + if (false === strpos($url, $dir['baseurl'] . '/')) { |
|
| 131 | 131 | // URL points to a place outside of upload directory |
| 132 | 132 | return false; |
| 133 | 133 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $query['meta_query'][0]['key'] = '_wp_attached_file'; |
| 146 | 146 | // query attachments |
| 147 | 147 | $ids = get_posts($query); |
| 148 | - if (!empty($ids)) { |
|
| 148 | + if ( ! empty($ids)) { |
|
| 149 | 149 | foreach ($ids as $id) { |
| 150 | 150 | // first entry of returned array is the URL |
| 151 | 151 | $temp_url = wp_get_attachment_image_src($id, 'full'); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | function lsx_is_element_empty($element) { |
| 190 | 190 | $element = trim($element); |
| 191 | - return empty($element)?false:true; |
|
| 191 | + return empty($element) ? false : true; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -199,39 +199,39 @@ discard block |
||
| 199 | 199 | * @subpackage extras |
| 200 | 200 | * @category thumbnails |
| 201 | 201 | */ |
| 202 | -function lsx_get_thumbnail($size,$image_src = false){ |
|
| 202 | +function lsx_get_thumbnail($size, $image_src = false) { |
|
| 203 | 203 | |
| 204 | - if(false === $image_src){ |
|
| 204 | + if (false === $image_src) { |
|
| 205 | 205 | $post_id = get_the_ID(); |
| 206 | - $post_thumbnail_id = get_post_thumbnail_id( $post_id ); |
|
| 207 | - }elseif(false != $image_src ){ |
|
| 208 | - if(is_numeric($image_src)){ |
|
| 206 | + $post_thumbnail_id = get_post_thumbnail_id($post_id); |
|
| 207 | + }elseif (false != $image_src) { |
|
| 208 | + if (is_numeric($image_src)) { |
|
| 209 | 209 | $post_thumbnail_id = $image_src; |
| 210 | - }else{ |
|
| 210 | + } else { |
|
| 211 | 211 | $post_thumbnail_id = lsx_get_attachment_id_from_src($image_src); |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - $size = apply_filters('lsx_thumbnail_size',$size); |
|
| 214 | + $size = apply_filters('lsx_thumbnail_size', $size); |
|
| 215 | 215 | $img = false; |
| 216 | - if($size === 'lsx-thumbnail-wide' || $size === 'thumbnail'){ |
|
| 216 | + if ($size === 'lsx-thumbnail-wide' || $size === 'thumbnail') { |
|
| 217 | 217 | $srcset = false; |
| 218 | - $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
|
| 218 | + $img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 219 | 219 | $img = $img[0]; |
| 220 | - }else{ |
|
| 220 | + } else { |
|
| 221 | 221 | $srcset = true; |
| 222 | - $img = wp_get_attachment_image_srcset($post_thumbnail_id,$size); |
|
| 223 | - if($img == false) { |
|
| 222 | + $img = wp_get_attachment_image_srcset($post_thumbnail_id, $size); |
|
| 223 | + if ($img == false) { |
|
| 224 | 224 | $srcset = false; |
| 225 | - $img = wp_get_attachment_image_src($post_thumbnail_id,$size); |
|
| 225 | + $img = wp_get_attachment_image_src($post_thumbnail_id, $size); |
|
| 226 | 226 | $img = $img[0]; |
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | if ($srcset) { |
| 230 | - $img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" srcset="'.$img.'" />'; |
|
| 230 | + $img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" srcset="' . $img . '" />'; |
|
| 231 | 231 | } else { |
| 232 | - $img = '<img alt="'.get_the_title(get_the_ID()).'" class="attachment-responsive wp-post-image lsx-responsive" src="'.$img.'" />'; |
|
| 232 | + $img = '<img alt="' . get_the_title(get_the_ID()) . '" class="attachment-responsive wp-post-image lsx-responsive" src="' . $img . '" />'; |
|
| 233 | 233 | } |
| 234 | - $img = apply_filters('lsx_lazyload_filter_images',$img); |
|
| 234 | + $img = apply_filters('lsx_lazyload_filter_images', $img); |
|
| 235 | 235 | return $img; |
| 236 | 236 | } |
| 237 | 237 | |
@@ -242,8 +242,8 @@ discard block |
||
| 242 | 242 | * @subpackage extras |
| 243 | 243 | * @category thumbnails |
| 244 | 244 | */ |
| 245 | -function lsx_thumbnail($size = 'thumbnail',$image_src = false){ |
|
| 246 | - echo lsx_get_thumbnail($size,$image_src); |
|
| 245 | +function lsx_thumbnail($size = 'thumbnail', $image_src = false) { |
|
| 246 | + echo lsx_get_thumbnail($size, $image_src); |
|
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
@@ -268,24 +268,24 @@ discard block |
||
| 268 | 268 | * @subpackage extras |
| 269 | 269 | * @category banner |
| 270 | 270 | */ |
| 271 | -if (!function_exists('lsx_page_banner')) { |
|
| 271 | +if ( ! function_exists('lsx_page_banner')) { |
|
| 272 | 272 | function lsx_page_banner() { |
| 273 | 273 | |
| 274 | - $post_types = array('page','post'); |
|
| 275 | - $post_types = apply_filters('lsx_allowed_post_type_banners',$post_types); |
|
| 274 | + $post_types = array('page', 'post'); |
|
| 275 | + $post_types = apply_filters('lsx_allowed_post_type_banners', $post_types); |
|
| 276 | 276 | |
| 277 | - if ( (is_singular($post_types) && has_post_thumbnail()) |
|
| 278 | - || (is_singular('jetpack-portfolio')) ) { ?> |
|
| 277 | + if ((is_singular($post_types) && has_post_thumbnail()) |
|
| 278 | + || (is_singular('jetpack-portfolio'))) { ?> |
|
| 279 | 279 | |
| 280 | 280 | <?php |
| 281 | 281 | $bg_image = ''; |
| 282 | - if(has_post_thumbnail()){ |
|
| 283 | - $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()),'full'); |
|
| 282 | + if (has_post_thumbnail()) { |
|
| 283 | + $bg_image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'full'); |
|
| 284 | 284 | $bg_image = $bg_image[0]; |
| 285 | 285 | } |
| 286 | 286 | ?> |
| 287 | 287 | |
| 288 | - <?php if ( ! empty( $bg_image ) ) : ?> |
|
| 288 | + <?php if ( ! empty($bg_image)) : ?> |
|
| 289 | 289 | |
| 290 | 290 | <div class="page-banner-wrap"> |
| 291 | 291 | <div class="page-banner"> |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | <?php } |
| 306 | 306 | } |
| 307 | 307 | } |
| 308 | -add_action( 'lsx_header_after', 'lsx_page_banner' ); |
|
| 308 | +add_action('lsx_header_after', 'lsx_page_banner'); |
|
| 309 | 309 | |
| 310 | 310 | |
| 311 | 311 | /** |
@@ -315,11 +315,11 @@ discard block |
||
| 315 | 315 | * @subpackage extras |
| 316 | 316 | * @category mobile |
| 317 | 317 | */ |
| 318 | -function lsx_allow_sms_protocol( $protocols ) { |
|
| 318 | +function lsx_allow_sms_protocol($protocols) { |
|
| 319 | 319 | $protocols[] = 'sms'; |
| 320 | 320 | return $protocols; |
| 321 | 321 | } |
| 322 | -add_filter( 'kses_allowed_protocols', 'lsx_allow_sms_protocol' ); |
|
| 322 | +add_filter('kses_allowed_protocols', 'lsx_allow_sms_protocol'); |
|
| 323 | 323 | |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -327,28 +327,28 @@ discard block |
||
| 327 | 327 | */ |
| 328 | 328 | function mv_browser_body_class($classes) { |
| 329 | 329 | 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) { |
|
| 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) { |
|
| 337 | 337 | $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]; |
|
| 338 | + if (preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $browser_version)) |
|
| 339 | + $classes[] = 'ie' . $browser_version[1]; |
|
| 340 | 340 | } else $classes[] = 'unknown'; |
| 341 | - if($is_iphone) $classes[] = 'iphone'; |
|
| 342 | - if ( stristr( $_SERVER['HTTP_USER_AGENT'],"mac") ) { |
|
| 341 | + if ($is_iphone) $classes[] = 'iphone'; |
|
| 342 | + if (stristr($_SERVER['HTTP_USER_AGENT'], "mac")) { |
|
| 343 | 343 | $classes[] = 'osx'; |
| 344 | - } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"linux") ) { |
|
| 344 | + } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "linux")) { |
|
| 345 | 345 | $classes[] = 'linux'; |
| 346 | - } elseif ( stristr( $_SERVER['HTTP_USER_AGENT'],"windows") ) { |
|
| 346 | + } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "windows")) { |
|
| 347 | 347 | $classes[] = 'windows'; |
| 348 | 348 | } |
| 349 | 349 | return $classes; |
| 350 | 350 | } |
| 351 | -add_filter('body_class','mv_browser_body_class'); |
|
| 351 | +add_filter('body_class', 'mv_browser_body_class'); |
|
| 352 | 352 | |
| 353 | 353 | |
| 354 | 354 | /** |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | * @param $form Object |
| 362 | 362 | * @return String |
| 363 | 363 | */ |
| 364 | -function lsx_form_submit_button($button, $form){ |
|
| 364 | +function lsx_form_submit_button($button, $form) { |
|
| 365 | 365 | return "<button class='btn btn-primary' id='gform_submit_button_{$form["id"]}'><span>Submit</span></button>"; |
| 366 | 366 | } |
| 367 | 367 | add_filter("gform_submit_button", "lsx_form_submit_button", 10, 2); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | //return ' ... <a class="moretag" href="'. get_permalink($post->ID) . '">'.__('Continue reading','lsx').'</a>'; |
| 376 | 376 | return '...'; |
| 377 | 377 | } |
| 378 | -add_filter( 'excerpt_more', 'lsx_excerpt_more' ); |
|
| 378 | +add_filter('excerpt_more', 'lsx_excerpt_more'); |
|
| 379 | 379 | |
| 380 | 380 | |
| 381 | 381 | /** |
@@ -384,44 +384,44 @@ discard block |
||
| 384 | 384 | function lsx_the_excerpt_filter($excerpt) { |
| 385 | 385 | $show_full_content = has_post_format(apply_filters('lsx_the_excerpt_filter_post_types', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio'))); |
| 386 | 386 | |
| 387 | - if (!$show_full_content) { |
|
| 388 | - if ('' !== $excerpt && !stristr($excerpt, 'moretag')) { |
|
| 389 | - $pagination = wp_link_pages( array( |
|
| 387 | + if ( ! $show_full_content) { |
|
| 388 | + if ('' !== $excerpt && ! stristr($excerpt, 'moretag')) { |
|
| 389 | + $pagination = wp_link_pages(array( |
|
| 390 | 390 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 391 | 391 | 'after' => '</div></div>', |
| 392 | 392 | 'link_before' => '<span>', |
| 393 | 393 | 'link_after' => '</span>', |
| 394 | 394 | 'echo' => 0 |
| 395 | - ) ); |
|
| 395 | + )); |
|
| 396 | 396 | |
| 397 | - if ( ! empty( $pagination ) ) { |
|
| 397 | + if ( ! empty($pagination)) { |
|
| 398 | 398 | $excerpt .= $pagination; |
| 399 | 399 | } |
| 400 | 400 | else { |
| 401 | - $excerpt .= '<p><a class="moretag" href="'.get_permalink().'">'.__('Continue reading','lsx').'</a></p>'; |
|
| 401 | + $excerpt .= '<p><a class="moretag" href="' . get_permalink() . '">' . __('Continue reading', 'lsx') . '</a></p>'; |
|
| 402 | 402 | } |
| 403 | 403 | } |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | return $excerpt; |
| 407 | 407 | } |
| 408 | -add_filter( 'the_excerpt', 'lsx_the_excerpt_filter' , 1 , 20 ); |
|
| 408 | +add_filter('the_excerpt', 'lsx_the_excerpt_filter', 1, 20); |
|
| 409 | 409 | |
| 410 | 410 | |
| 411 | 411 | /** |
| 412 | 412 | * Allow HTML tags in excerpt |
| 413 | 413 | */ |
| 414 | -if ( ! function_exists( 'wpse_custom_wp_trim_excerpt' ) ) { |
|
| 414 | +if ( ! function_exists('wpse_custom_wp_trim_excerpt')) { |
|
| 415 | 415 | function wpse_custom_wp_trim_excerpt($wpse_excerpt) { |
| 416 | 416 | global $post; |
| 417 | 417 | $raw_excerpt = $wpse_excerpt; |
| 418 | 418 | |
| 419 | - if ( '' == $wpse_excerpt ) { |
|
| 419 | + if ('' == $wpse_excerpt) { |
|
| 420 | 420 | $wpse_excerpt = get_the_content(''); |
| 421 | 421 | $show_full_content = has_post_format(array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio')); |
| 422 | 422 | |
| 423 | - if (!$show_full_content) { |
|
| 424 | - $wpse_excerpt = strip_shortcodes( $wpse_excerpt ); |
|
| 423 | + if ( ! $show_full_content) { |
|
| 424 | + $wpse_excerpt = strip_shortcodes($wpse_excerpt); |
|
| 425 | 425 | $wpse_excerpt = apply_filters('the_content', $wpse_excerpt); |
| 426 | 426 | $wpse_excerpt = str_replace(']]>', ']]>', $wpse_excerpt); |
| 427 | 427 | //$wpse_excerpt = strip_tags($wpse_excerpt, '<blockquote>,<p>'); |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $wpse_excerpt = trim(force_balance_tags($excerptOutput)); |
| 450 | 450 | |
| 451 | 451 | if ($has_more) { |
| 452 | - $excerpt_end = '<a class="moretag" href="'.get_permalink().'">'.__('More','lsx').'</a>'; |
|
| 452 | + $excerpt_end = '<a class="moretag" href="' . get_permalink() . '">' . __('More', 'lsx') . '</a>'; |
|
| 453 | 453 | $excerpt_end = apply_filters('excerpt_more', ' ' . $excerpt_end); |
| 454 | 454 | |
| 455 | 455 | $pos = strrpos($wpse_excerpt, '</'); |
@@ -477,4 +477,4 @@ discard block |
||
| 477 | 477 | } |
| 478 | 478 | remove_filter('get_the_excerpt', 'wp_trim_excerpt'); |
| 479 | 479 | add_filter('get_the_excerpt', 'wpse_custom_wp_trim_excerpt'); |
| 480 | -remove_filter( 'the_excerpt', 'wpautop' ); |
|
| 480 | +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 |
@@ -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 | } |
@@ -5,6 +5,7 @@ |
||
| 5 | 5 | * Layout hooks |
| 6 | 6 | * |
| 7 | 7 | * @package lsx |
| 8 | + * @param string $class |
|
| 8 | 9 | */ |
| 9 | 10 | |
| 10 | 11 | function lsx_layout_selector( $class, $area = 'site' ) { |
@@ -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 | |
@@ -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 | * Layout hooks |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | * @package lsx |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -function lsx_layout_selector( $class, $area = 'site' ) { |
|
| 10 | +function lsx_layout_selector($class, $area = 'site') { |
|
| 11 | 11 | |
| 12 | - $layout = get_theme_mod('lsx_layout','2cr'); |
|
| 13 | - $layout = apply_filters( 'lsx_layout', $layout ); |
|
| 12 | + $layout = get_theme_mod('lsx_layout', '2cr'); |
|
| 13 | + $layout = apply_filters('lsx_layout', $layout); |
|
| 14 | 14 | |
| 15 | 15 | $default_size = 'sm'; |
| 16 | - $size = apply_filters( 'lsx_bootstrap_column_size', $default_size ); |
|
| 16 | + $size = apply_filters('lsx_bootstrap_column_size', $default_size); |
|
| 17 | 17 | |
| 18 | - switch ( $layout ) { |
|
| 18 | + switch ($layout) { |
|
| 19 | 19 | case '1c': |
| 20 | 20 | $main_class = 'col-' . $size . '-12'; |
| 21 | 21 | $sidebar_class = 'col-' . $size . '-12'; |
@@ -34,11 +34,11 @@ discard block |
||
| 34 | 34 | break; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - if ( $class == 'main' ) { |
|
| 37 | + if ($class == 'main') { |
|
| 38 | 38 | return $main_class; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - if ( $class == 'sidebar' ) { |
|
| 41 | + if ($class == 'sidebar') { |
|
| 42 | 42 | return $sidebar_class; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | * .main classes |
| 48 | 48 | */ |
| 49 | 49 | function lsx_main_class() { |
| 50 | - return lsx_layout_selector( 'main' ); |
|
| 50 | + return lsx_layout_selector('main'); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function lsx_home_main_class() { |
| 54 | - return lsx_layout_selector( 'main', 'home' ); |
|
| 54 | + return lsx_layout_selector('main', 'home'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -60,10 +60,10 @@ discard block |
||
| 60 | 60 | function lsx_index_main_class() { |
| 61 | 61 | |
| 62 | 62 | $show_on_front = get_option('show_on_front'); |
| 63 | - if('page' == $show_on_front){ |
|
| 64 | - return lsx_layout_selector( 'main', 'home' ); |
|
| 65 | - }else{ |
|
| 66 | - return lsx_layout_selector( 'main', 'site' ); |
|
| 63 | + if ('page' == $show_on_front) { |
|
| 64 | + return lsx_layout_selector('main', 'home'); |
|
| 65 | + } else { |
|
| 66 | + return lsx_layout_selector('main', 'site'); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | } |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | * .sidebar classes |
| 73 | 73 | */ |
| 74 | 74 | function lsx_sidebar_class() { |
| 75 | - return lsx_layout_selector( 'sidebar' ); |
|
| 75 | + return lsx_layout_selector('sidebar'); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | function lsx_home_sidebar_class() { |
| 79 | - return lsx_layout_selector( 'sidebar', 'home' ); |
|
| 79 | + return lsx_layout_selector('sidebar', 'home'); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
@@ -91,13 +91,13 @@ discard block |
||
| 91 | 91 | $classes = 'banner navbar navbar-default'; |
| 92 | 92 | |
| 93 | 93 | //Fixed header |
| 94 | - $fixed_header = get_theme_mod('lsx_header_fixed',false); |
|
| 95 | - if(false != $fixed_header){ |
|
| 94 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
| 95 | + if (false != $fixed_header) { |
|
| 96 | 96 | $classes .= ' navbar-static-top'; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if(false != $additional){ |
|
| 100 | - $classes .= ' '.$additional; |
|
| 99 | + if (false != $additional) { |
|
| 100 | + $classes .= ' ' . $additional; |
|
| 101 | 101 | } |
| 102 | 102 | echo $classes; |
| 103 | 103 | } |
@@ -114,37 +114,37 @@ discard block |
||
| 114 | 114 | $classes = 'top-menu-default'; |
| 115 | 115 | |
| 116 | 116 | //Fixed header |
| 117 | - $fixed_header = get_theme_mod('lsx_header_fixed',false); |
|
| 118 | - if(false != $fixed_header){ |
|
| 117 | + $fixed_header = get_theme_mod('lsx_header_fixed', false); |
|
| 118 | + if (false != $fixed_header) { |
|
| 119 | 119 | $classes .= ' top-menu-fixed'; |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if(false != $additional){ |
|
| 123 | - $classes .= ' '.$additional; |
|
| 122 | + if (false != $additional) { |
|
| 123 | + $classes .= ' ' . $additional; |
|
| 124 | 124 | } |
| 125 | 125 | echo $classes; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | -add_action( 'lsx_footer_before', 'lsx_add_footer_sidebar_area' ); |
|
| 129 | -if ( ! function_exists( 'lsx_add_footer_sidebar_area' ) ) { |
|
| 128 | +add_action('lsx_footer_before', 'lsx_add_footer_sidebar_area'); |
|
| 129 | +if ( ! function_exists('lsx_add_footer_sidebar_area')) { |
|
| 130 | 130 | function lsx_add_footer_sidebar_area() { |
| 131 | - if ( is_active_sidebar( 'sidebar-footer-cta' ) ) : ?> |
|
| 131 | + if (is_active_sidebar('sidebar-footer-cta')) : ?> |
|
| 132 | 132 | <div id="footer-cta"> |
| 133 | 133 | <div class="container"> |
| 134 | 134 | <div class="lsx-full-width"> |
| 135 | 135 | <div class="lsx-hero-unit"> |
| 136 | - <?php dynamic_sidebar( 'sidebar-footer-cta' ); ?> |
|
| 136 | + <?php dynamic_sidebar('sidebar-footer-cta'); ?> |
|
| 137 | 137 | </div> |
| 138 | 138 | </div> |
| 139 | 139 | </div> |
| 140 | 140 | </div> |
| 141 | 141 | <?php endif; ?> |
| 142 | 142 | |
| 143 | - <?php if ( is_active_sidebar( 'sidebar-footer' ) ) : ?> |
|
| 143 | + <?php if (is_active_sidebar('sidebar-footer')) : ?> |
|
| 144 | 144 | <div id="footer-widgets"> |
| 145 | 145 | <div class="container"> |
| 146 | 146 | <div class="row"> |
| 147 | - <?php dynamic_sidebar( 'sidebar-footer' ); ?> |
|
| 147 | + <?php dynamic_sidebar('sidebar-footer'); ?> |
|
| 148 | 148 | </div> |
| 149 | 149 | </div> |
| 150 | 150 | </div> |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | <?php |
| 168 | 168 | else*/if (is_singular('post')) : |
| 169 | 169 | $format = get_post_format(); |
| 170 | - if ( false === $format ) { |
|
| 170 | + if (false === $format) { |
|
| 171 | 171 | $format = 'standard'; |
| 172 | 172 | } |
| 173 | 173 | $format_link = get_post_format_link($format); |
@@ -189,14 +189,14 @@ discard block |
||
| 189 | 189 | elseif (is_search()) : |
| 190 | 190 | ?> |
| 191 | 191 | <header class="archive-header"> |
| 192 | - <h1 class="archive-title"><?php printf( __( 'Search Results for: %s', 'lsx' ), '<span>' . get_search_query() . '</span>' ); ?></h1> |
|
| 192 | + <h1 class="archive-title"><?php printf(__('Search Results for: %s', 'lsx'), '<span>' . get_search_query() . '</span>'); ?></h1> |
|
| 193 | 193 | </header> |
| 194 | 194 | <?php |
| 195 | 195 | elseif (is_author()) : |
| 196 | 196 | ?> |
| 197 | 197 | <header class="archive-header"> |
| 198 | 198 | <h1 class="archive-title"> |
| 199 | - <?php printf( __( 'Author: %s', 'lsx' ), get_the_author() ); ?> |
|
| 199 | + <?php printf(__('Author: %s', 'lsx'), get_the_author()); ?> |
|
| 200 | 200 | </h1> |
| 201 | 201 | |
| 202 | 202 | <?php if (get_the_author_meta('description')) { ?> |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | <?php } ?> |
| 205 | 205 | </header> |
| 206 | 206 | <?php |
| 207 | - elseif (is_archive() && class_exists('WooCommerce') && is_post_type_archive('product') ) : |
|
| 207 | + elseif (is_archive() && class_exists('WooCommerce') && is_post_type_archive('product')) : |
|
| 208 | 208 | ?> |
| 209 | 209 | <header class="archive-header"> |
| 210 | 210 | <h1 class="archive-title"><?php _e('Shop', 'lsx'); ?></h1> |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | ?> |
| 216 | 216 | <header class="archive-header"> |
| 217 | 217 | <h1 class="archive-title"> |
| 218 | - <?php if ( has_post_format() && !is_category() && !is_tag() && !is_date() && !is_tax('post_format') ) { ?> |
|
| 218 | + <?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?> |
|
| 219 | 219 | Type: <?php the_archive_title(); ?> |
| 220 | 220 | <?php } else { ?> |
| 221 | 221 | <?php the_archive_title(); ?> |
@@ -253,16 +253,16 @@ discard block |
||
| 253 | 253 | ?> |
| 254 | 254 | <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"> |
| 255 | 255 | <?php } |
| 256 | -add_action( 'wp_head', 'lsx_add_viewport_meta_tag' ); |
|
| 256 | +add_action('wp_head', 'lsx_add_viewport_meta_tag'); |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | /** |
| 260 | 260 | * Add a search form to just above the nav menu |
| 261 | 261 | */ |
| 262 | 262 | function lsx_header_search_form() { |
| 263 | - $search_form = get_theme_mod( 'lsx_header_search', 0 ); |
|
| 264 | - if($search_form || is_customize_preview()){ |
|
| 265 | - get_search_form( true ); |
|
| 263 | + $search_form = get_theme_mod('lsx_header_search', 0); |
|
| 264 | + if ($search_form || is_customize_preview()) { |
|
| 265 | + get_search_form(true); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | -add_action( 'lsx_nav_before', 'lsx_header_search_form', 0 ); |
|
| 269 | 268 | \ No newline at end of file |
| 269 | +add_action('lsx_nav_before', 'lsx_header_search_form', 0); |
|
| 270 | 270 | \ No newline at end of file |
@@ -140,6 +140,9 @@ |
||
| 140 | 140 | return self::$noscripts[(int) $match[1]]; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $new_class |
|
| 145 | + */ |
|
| 143 | 146 | static function add_class( $html_string = '', $new_class ) { |
| 144 | 147 | $pattern = '/class=[\'"]([^\'"]*)[\'"]/'; |
| 145 | 148 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined( 'ABSPATH' ) ) return; |
|
| 2 | +if ( ! defined('ABSPATH')) return; |
|
| 3 | 3 | |
| 4 | 4 | /* |
| 5 | 5 | * LSX Lazy Load Images Class |
@@ -25,138 +25,138 @@ discard block |
||
| 25 | 25 | protected static $noscripts = array(); |
| 26 | 26 | |
| 27 | 27 | static function init() { |
| 28 | - if ( is_admin() ) |
|
| 28 | + if (is_admin()) |
|
| 29 | 29 | return; |
| 30 | 30 | |
| 31 | - if ( get_theme_mod( 'lsx_lazyload_status', '1' ) === false ) { |
|
| 31 | + if (get_theme_mod('lsx_lazyload_status', '1') === false) { |
|
| 32 | 32 | self::$enabled = false; |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( ! apply_filters( 'lsx_lazyload_is_enabled', true ) ) { |
|
| 36 | + if ( ! apply_filters('lsx_lazyload_is_enabled', true)) { |
|
| 37 | 37 | self::$enabled = false; |
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - add_action( 'wp_enqueue_scripts', array( __CLASS__, 'add_scripts' ) ); |
|
| 42 | - add_action( 'wp_head', array( __CLASS__, 'setup_filters' ), 9999 ); |
|
| 41 | + add_action('wp_enqueue_scripts', array(__CLASS__, 'add_scripts')); |
|
| 42 | + add_action('wp_head', array(__CLASS__, 'setup_filters'), 9999); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | static function setup_filters() { |
| 46 | 46 | // WordPress |
| 47 | - add_filter( 'the_content', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 48 | - add_filter( 'widget_text', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 49 | - add_filter( 'post_thumbnail_html', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 50 | - add_filter( 'get_avatar', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 47 | + add_filter('the_content', array(__CLASS__, 'filter_images'), 200); |
|
| 48 | + add_filter('widget_text', array(__CLASS__, 'filter_images'), 200); |
|
| 49 | + add_filter('post_thumbnail_html', array(__CLASS__, 'filter_images'), 200); |
|
| 50 | + add_filter('get_avatar', array(__CLASS__, 'filter_images'), 200); |
|
| 51 | 51 | |
| 52 | 52 | // LSX |
| 53 | - add_filter( 'lsx_lazyload_filter_images', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 53 | + add_filter('lsx_lazyload_filter_images', array(__CLASS__, 'filter_images'), 200); |
|
| 54 | 54 | |
| 55 | 55 | // Envira Gallery |
| 56 | - add_filter( 'envira_gallery_output_image', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 56 | + add_filter('envira_gallery_output_image', array(__CLASS__, 'filter_images'), 200); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | static function add_scripts() { |
| 60 | - wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/lazysizes.min.js', array( 'jquery' ), null, true ); |
|
| 60 | + wp_enqueue_script('lazysizes', get_template_directory_uri() . '/js/vendor/lazysizes.min.js', array('jquery'), null, true); |
|
| 61 | 61 | // Plugin that enables use lazysizes in brackground images |
| 62 | 62 | //wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/ls.unveilhooks.min.js', array( 'jquery', 'lazysizes' ), null, true ); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - static function filter_images( $content ) { |
|
| 66 | - if ( ! self::is_enabled() ) { |
|
| 65 | + static function filter_images($content) { |
|
| 66 | + if ( ! self::is_enabled()) { |
|
| 67 | 67 | return $content; |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | - if ( is_feed() |
|
| 70 | + if (is_feed() |
|
| 71 | 71 | || is_preview() |
| 72 | - || intval( get_query_var( 'print' ) ) == 1 |
|
| 73 | - || intval( get_query_var( 'printpage' ) ) == 1 |
|
| 74 | - || strpos( $_SERVER['HTTP_USER_AGENT'], 'Opera Mini' ) !== false |
|
| 72 | + || intval(get_query_var('print')) == 1 |
|
| 73 | + || intval(get_query_var('printpage')) == 1 |
|
| 74 | + || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera Mini') !== false |
|
| 75 | 75 | ) { |
| 76 | 76 | return $content; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $skip_images_regex = '/class=".*(lazyload|disable-lazyload).*"/'; |
| 80 | - $placeholder_image = apply_filters( 'lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ); |
|
| 80 | + $placeholder_image = apply_filters('lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); |
|
| 81 | 81 | |
| 82 | 82 | $matches = array(); |
| 83 | 83 | $search = array(); |
| 84 | 84 | $replace = array(); |
| 85 | 85 | |
| 86 | - $content = preg_replace_callback( '~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content ); |
|
| 87 | - preg_match_all( '/<img[^>]*>/', $content, $matches ); |
|
| 86 | + $content = preg_replace_callback('~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content); |
|
| 87 | + preg_match_all('/<img[^>]*>/', $content, $matches); |
|
| 88 | 88 | |
| 89 | - foreach ( $matches[0] as $img_html ) { |
|
| 90 | - if ( ! ( preg_match( $skip_images_regex, $img_html ) ) ) { |
|
| 89 | + foreach ($matches[0] as $img_html) { |
|
| 90 | + if ( ! (preg_match($skip_images_regex, $img_html))) { |
|
| 91 | 91 | $add_class = false; |
| 92 | 92 | |
| 93 | - if ( ! preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) && preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 94 | - $replace_html = preg_replace( '/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html ); |
|
| 93 | + if ( ! preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html) && preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 94 | + $replace_html = preg_replace('/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html); |
|
| 95 | 95 | |
| 96 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 97 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
| 96 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 97 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
| 98 | 98 | } else { |
| 99 | - $replace_html = preg_replace( '/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
| 99 | + $replace_html = preg_replace('/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | $add_class = true; |
| 103 | - } elseif ( preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 104 | - $replace_html = preg_replace( '/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html ); |
|
| 103 | + } elseif (preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 104 | + $replace_html = preg_replace('/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html); |
|
| 105 | 105 | |
| 106 | - if ( preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 107 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 108 | - $replace_html = preg_replace( '/srcset=/i', 'data-srcset=', $replace_html ); |
|
| 109 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
| 106 | + if (preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 107 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 108 | + $replace_html = preg_replace('/srcset=/i', 'data-srcset=', $replace_html); |
|
| 109 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
| 110 | 110 | } else { |
| 111 | - $replace_html = preg_replace( '/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
| 111 | + $replace_html = preg_replace('/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $add_class = true; |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - if ( $add_class ) { |
|
| 119 | - $replace_html = self::add_class( $replace_html, 'lazyload' ); |
|
| 118 | + if ($add_class) { |
|
| 119 | + $replace_html = self::add_class($replace_html, 'lazyload'); |
|
| 120 | 120 | $replace_html .= '<noscript>' . $img_html . '</noscript>'; |
| 121 | 121 | |
| 122 | - array_push( $search, $img_html ); |
|
| 123 | - array_push( $replace, $replace_html ); |
|
| 122 | + array_push($search, $img_html); |
|
| 123 | + array_push($replace, $replace_html); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $content = str_replace( $search, $replace, $content ); |
|
| 129 | - $content = preg_replace_callback( '~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content ); |
|
| 128 | + $content = str_replace($search, $replace, $content); |
|
| 129 | + $content = preg_replace_callback('~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content); |
|
| 130 | 130 | return $content; |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - static function noscripts_remove( $match ) { |
|
| 133 | + static function noscripts_remove($match) { |
|
| 134 | 134 | self::$noscript_id++; |
| 135 | 135 | self::$noscripts[self::$noscript_id] = $match[0]; |
| 136 | 136 | return chr(20) . self::$noscript_id . chr(20); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - static function noscripts_restore( $match ) { |
|
| 139 | + static function noscripts_restore($match) { |
|
| 140 | 140 | return self::$noscripts[(int) $match[1]]; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | - static function add_class( $html_string = '', $new_class ) { |
|
| 143 | + static function add_class($html_string = '', $new_class) { |
|
| 144 | 144 | $pattern = '/class=[\'"]([^\'"]*)[\'"]/'; |
| 145 | 145 | |
| 146 | - if ( preg_match( $pattern, $html_string, $matches ) ) { |
|
| 147 | - $defined_classes = explode( ' ', $matches[1] ); |
|
| 146 | + if (preg_match($pattern, $html_string, $matches)) { |
|
| 147 | + $defined_classes = explode(' ', $matches[1]); |
|
| 148 | 148 | |
| 149 | - if ( ! in_array( $new_class, $defined_classes ) ) { |
|
| 149 | + if ( ! in_array($new_class, $defined_classes)) { |
|
| 150 | 150 | $defined_classes[] = $new_class; |
| 151 | 151 | |
| 152 | 152 | $html_string = str_replace( |
| 153 | 153 | $matches[0], |
| 154 | - sprintf( 'class="%s"', implode( ' ', $defined_classes ) ), |
|
| 154 | + sprintf('class="%s"', implode(' ', $defined_classes)), |
|
| 155 | 155 | $html_string |
| 156 | 156 | ); |
| 157 | 157 | } |
| 158 | 158 | } else { |
| 159 | - $html_string = preg_replace( '/(\<.+\s)/', sprintf( '$1class="%s" ', $new_class ), $html_string ); |
|
| 159 | + $html_string = preg_replace('/(\<.+\s)/', sprintf('$1class="%s" ', $new_class), $html_string); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $html_string; |
@@ -167,4 +167,4 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | -add_action( 'init', array( 'LSX_LazyLoadImages', 'init' ) ); |
|
| 170 | +add_action('init', array('LSX_LazyLoadImages', 'init')); |
|
@@ -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; |
@@ -97,7 +97,7 @@ |
||
| 97 | 97 | * @subpackage sanitize |
| 98 | 98 | * |
| 99 | 99 | * @param array $input |
| 100 | - * @return array $output |
|
| 100 | + * @return string|false $output |
|
| 101 | 101 | */ |
| 102 | 102 | function lsx_sanitize_checkbox( $input ) { |
| 103 | 103 | if ( $input ) { |
@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | * @param mixed $setting The setting for which the sanitizing is occurring. |
| 18 | 18 | * @return mixed The sanitized value. |
| 19 | 19 | */ |
| 20 | -function lsx_sanitize_choices( $value, $setting ) { |
|
| 21 | - if ( is_object( $setting ) ) { |
|
| 20 | +function lsx_sanitize_choices($value, $setting) { |
|
| 21 | + if (is_object($setting)) { |
|
| 22 | 22 | $setting = $setting->id; |
| 23 | 23 | } |
| 24 | - $choices = lsx_customizer_sanitize_get_choices( $setting ); |
|
| 25 | - $allowed_choices = array_keys( $choices ); |
|
| 26 | - if ( ! in_array( $value, $allowed_choices ) ) { |
|
| 27 | - $value = lsx_customizer_sanitize_get_default( $setting ); |
|
| 24 | + $choices = lsx_customizer_sanitize_get_choices($setting); |
|
| 25 | + $allowed_choices = array_keys($choices); |
|
| 26 | + if ( ! in_array($value, $allowed_choices)) { |
|
| 27 | + $value = lsx_customizer_sanitize_get_default($setting); |
|
| 28 | 28 | } |
| 29 | 29 | return $value; |
| 30 | 30 | } |
@@ -39,13 +39,13 @@ discard block |
||
| 39 | 39 | * @return mixed $field |
| 40 | 40 | */ |
| 41 | 41 | |
| 42 | -function lsx_customizer_sanitize_get_choices( $id ) { |
|
| 42 | +function lsx_customizer_sanitize_get_choices($id) { |
|
| 43 | 43 | global $lsx_customizer; |
| 44 | 44 | //LSX_Theme_Customizer |
| 45 | 45 | |
| 46 | 46 | $field = $lsx_customizer->get_control($id); |
| 47 | 47 | |
| 48 | - if ( isset( $field['choices'] ) ) { |
|
| 48 | + if (isset($field['choices'])) { |
|
| 49 | 49 | return $field['choices']; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | * @return mixed $default |
| 62 | 62 | */ |
| 63 | 63 | |
| 64 | -function lsx_customizer_sanitize_get_default( $id ) { |
|
| 64 | +function lsx_customizer_sanitize_get_default($id) { |
|
| 65 | 65 | global $lsx_customizer; |
| 66 | 66 | //LSX_Theme_Customizer |
| 67 | 67 | |
| 68 | 68 | $setting = $lsx_customizer->get_setting($id); |
| 69 | 69 | |
| 70 | - if ( isset( $setting['default'] ) ) { |
|
| 70 | + if (isset($setting['default'])) { |
|
| 71 | 71 | return $setting['default']; |
| 72 | 72 | } |
| 73 | 73 | } |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | * @param obj $setting |
| 83 | 83 | * @return string $default |
| 84 | 84 | */ |
| 85 | -function lsx_sanitize_email( $email, $setting ) { |
|
| 85 | +function lsx_sanitize_email($email, $setting) { |
|
| 86 | 86 | // Sanitize $input as a hex value without the hash prefix. |
| 87 | - $email = sanitize_email( $email ); |
|
| 87 | + $email = sanitize_email($email); |
|
| 88 | 88 | |
| 89 | 89 | // If $email is a valid email, return it; otherwise, return the default. |
| 90 | - return ( ! is_null( $email ) ? $email : $setting->default ); |
|
| 90 | + return ( ! is_null($email) ? $email : $setting->default); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | * @param array $input |
| 100 | 100 | * @return array $output |
| 101 | 101 | */ |
| 102 | -function lsx_sanitize_checkbox( $input ) { |
|
| 103 | - if ( $input ) { |
|
| 102 | +function lsx_sanitize_checkbox($input) { |
|
| 103 | + if ($input) { |
|
| 104 | 104 | $output = '1'; |
| 105 | 105 | } else { |
| 106 | 106 | $output = false; |
@@ -7,7 +7,6 @@ discard block |
||
| 7 | 7 | * @author Novrian <[email protected]> |
| 8 | 8 | * @copyright (c) 2013. Novrian Y.F. |
| 9 | 9 | * @license MIT License |
| 10 | - * @param string $sep Your custom separator |
|
| 11 | 10 | */ |
| 12 | 11 | function lsx_breadcrumbs() { |
| 13 | 12 | if (!function_exists('yoast_breadcrumb') && !function_exists('woocommerce_breadcrumb')) { |
@@ -262,7 +261,7 @@ discard block |
||
| 262 | 261 | /** |
| 263 | 262 | * Display navigation to next/previous set of posts when applicable. |
| 264 | 263 | * |
| 265 | - * @return void |
|
| 264 | + * @return null|boolean |
|
| 266 | 265 | */ |
| 267 | 266 | function lsx_paging_nav() { |
| 268 | 267 | // Don't print empty markup if there's only one page. |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | function lsx_breadcrumbs() { |
| 13 | 13 | if (!function_exists('yoast_breadcrumb') && !function_exists('woocommerce_breadcrumb')) { |
| 14 | - return null; |
|
| 14 | + return null; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | $show_on_front = get_option('show_on_front'); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * Displays logo when applicable |
| 69 | 69 | * |
| 70 | 70 | * @return void |
| 71 | - */ |
|
| 71 | + */ |
|
| 72 | 72 | function lsx_site_title() { |
| 73 | 73 | ?> |
| 74 | 74 | <div class="site-branding"> |
@@ -117,13 +117,13 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | <?php |
| 120 | - $post_categories = wp_get_post_categories( get_the_ID() ); |
|
| 121 | - $cats = array(); |
|
| 122 | - foreach($post_categories as $c){ |
|
| 123 | - $cat = get_category( $c ); |
|
| 124 | - $cats[] = '<a href="' . get_category_link( $cat->term_id ) . '" title="' . sprintf( __( "View all posts in %s" , 'lsx' ), $cat->name ) . '" ' . '>' . $cat->name.'</a>'; |
|
| 125 | - } |
|
| 126 | - if(!empty($cats)){ ?> |
|
| 120 | + $post_categories = wp_get_post_categories( get_the_ID() ); |
|
| 121 | + $cats = array(); |
|
| 122 | + foreach($post_categories as $c){ |
|
| 123 | + $cat = get_category( $c ); |
|
| 124 | + $cats[] = '<a href="' . get_category_link( $cat->term_id ) . '" title="' . sprintf( __( "View all posts in %s" , 'lsx' ), $cat->name ) . '" ' . '>' . $cat->name.'</a>'; |
|
| 125 | + } |
|
| 126 | + if(!empty($cats)){ ?> |
|
| 127 | 127 | <span class="post-meta-categories"><span><?php _e('Posted in:','lsx'); ?></span> <?php echo implode(', ', $cats); ?></span> |
| 128 | 128 | <?php } ?> |
| 129 | 129 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | |
| 411 | 411 | //print_r(get_nav_menu_locations()); |
| 412 | 412 | |
| 413 | - if(false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']){ ?> |
|
| 413 | + if(false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']){ ?> |
|
| 414 | 414 | <nav class="primary-navbar collapse navbar-collapse"> |
| 415 | 415 | <?php |
| 416 | 416 | wp_nav_menu( array( |
@@ -538,9 +538,9 @@ discard block |
||
| 538 | 538 | if(null != $tag_cloud){ |
| 539 | 539 | printf( '<h2>'.__( '%1$s', 'lsx' ).'</h2>', $taxonomy ); |
| 540 | 540 | echo '<aside id="'.$taxonomy_id.'" class="widget widget_'.$taxonomy_id.'">'.$tag_cloud.'</aside>'; |
| 541 | - } |
|
| 542 | - } |
|
| 543 | - } |
|
| 541 | + } |
|
| 542 | + } |
|
| 543 | + } |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | /** |
@@ -589,11 +589,11 @@ discard block |
||
| 589 | 589 | <div class="container"> |
| 590 | 590 | <nav class="top-menu"> |
| 591 | 591 | <?php |
| 592 | - wp_nav_menu( array( |
|
| 592 | + wp_nav_menu( array( |
|
| 593 | 593 | 'theme_location' => 'top-menu', |
| 594 | 594 | 'walker' => new lsx_bootstrap_navwalker()) |
| 595 | 595 | ); |
| 596 | - ?> |
|
| 596 | + ?> |
|
| 597 | 597 | </nav> |
| 598 | 598 | </div> |
| 599 | 599 | </div> |
@@ -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 | * Yoast Breadcrumbs on Twitter Bootstrap |
@@ -10,21 +10,21 @@ discard block |
||
| 10 | 10 | * @param string $sep Your custom separator |
| 11 | 11 | */ |
| 12 | 12 | function lsx_breadcrumbs() { |
| 13 | - if (!function_exists('yoast_breadcrumb') && !function_exists('woocommerce_breadcrumb')) { |
|
| 13 | + if ( ! function_exists('yoast_breadcrumb') && ! function_exists('woocommerce_breadcrumb')) { |
|
| 14 | 14 | return null; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | $show_on_front = get_option('show_on_front'); |
| 18 | - if ( ('posts' == $show_on_front && is_home()) || ('page' == $show_on_front && is_front_page()) ) { |
|
| 18 | + if (('posts' == $show_on_front && is_home()) || ('page' == $show_on_front && is_front_page())) { |
|
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - if(function_exists('woocommerce_breadcrumb')){ |
|
| 22 | + if (function_exists('woocommerce_breadcrumb')) { |
|
| 23 | 23 | ob_start(); |
| 24 | 24 | woocommerce_breadcrumb(); |
| 25 | 25 | $output = ob_get_clean(); |
| 26 | 26 | $output = str_replace('woocommerce-breadcrumb', 'woocommerce-breadcrumb breadcrumbs-container', $output); |
| 27 | - }elseif(function_exists('yoast_breadcrumb')){ |
|
| 27 | + }elseif (function_exists('yoast_breadcrumb')) { |
|
| 28 | 28 | // Default Yoast Breadcrumbs Separator |
| 29 | 29 | $old_sep = '\»\;'; |
| 30 | 30 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | $output = '<div class="breadcrumbs-container">' . $output . '</div>'; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - $output = apply_filters('lsx_breadcrumbs',$output); |
|
| 45 | + $output = apply_filters('lsx_breadcrumbs', $output); |
|
| 46 | 46 | |
| 47 | 47 | echo $output; |
| 48 | 48 | } |
| 49 | -add_action( 'lsx_content_top', 'lsx_breadcrumbs', 100 ); |
|
| 49 | +add_action('lsx_content_top', 'lsx_breadcrumbs', 100); |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Replaces the seperator with a blank space. |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | function lsx_breadcrumbs_seperator_filter($seperator) { |
| 56 | 56 | return ''; |
| 57 | 57 | } |
| 58 | -add_filter( 'wpseo_breadcrumb_separator', 'lsx_breadcrumbs_seperator_filter' ); |
|
| 58 | +add_filter('wpseo_breadcrumb_separator', 'lsx_breadcrumbs_seperator_filter'); |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Custom template tags for this theme. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @package lsx |
| 65 | 65 | */ |
| 66 | -if ( ! function_exists( 'lsx_site_title' ) ) : |
|
| 66 | +if ( ! function_exists('lsx_site_title')) : |
|
| 67 | 67 | /** |
| 68 | 68 | * Displays logo when applicable |
| 69 | 69 | * |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | function lsx_site_title() { |
| 73 | 73 | ?> |
| 74 | 74 | <div class="site-branding"> |
| 75 | - <h1 class="site-title"><a title="<?php bloginfo( 'name' ); ?>" href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1> |
|
| 76 | - <p class="site-description"><?php bloginfo( 'description' ); ?></p> |
|
| 75 | + <h1 class="site-title"><a title="<?php bloginfo('name'); ?>" href="<?php echo esc_url(home_url('/')); ?>" rel="home"><?php bloginfo('name'); ?></a></h1> |
|
| 76 | + <p class="site-description"><?php bloginfo('description'); ?></p> |
|
| 77 | 77 | </div> |
| 78 | 78 | <?php |
| 79 | 79 | } |
@@ -88,43 +88,43 @@ discard block |
||
| 88 | 88 | * to be added/modified where necessary. |
| 89 | 89 | */ |
| 90 | 90 | |
| 91 | -if ( ! function_exists( 'lsx_post_meta' ) ) { |
|
| 91 | +if ( ! function_exists('lsx_post_meta')) { |
|
| 92 | 92 | function lsx_post_meta() { |
| 93 | - if ( (is_page() && !(is_home() || is_front_page())) && ! is_page_template( 'page-templates/template-blog.php' ) ) { return; } ?> |
|
| 93 | + if ((is_page() && ! (is_home() || is_front_page())) && ! is_page_template('page-templates/template-blog.php')) { return; } ?> |
|
| 94 | 94 | |
| 95 | 95 | <div class="post-meta"> |
| 96 | 96 | <?php |
| 97 | 97 | $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; |
| 98 | 98 | |
| 99 | - $time_string = sprintf( $time_string, |
|
| 100 | - esc_attr( get_the_date( 'c' ) ), |
|
| 99 | + $time_string = sprintf($time_string, |
|
| 100 | + esc_attr(get_the_date('c')), |
|
| 101 | 101 | get_the_date(), |
| 102 | - esc_attr( get_the_modified_date( 'c' ) ), |
|
| 102 | + esc_attr(get_the_modified_date('c')), |
|
| 103 | 103 | get_the_modified_date() |
| 104 | 104 | ); |
| 105 | - printf( '<span class="post-meta-time"><span>%1$s</span> <a href="%2$s" rel="bookmark">%3$s</a></span>', |
|
| 106 | - _x( 'Posted on:', 'Used before publish date.', 'lsx' ), |
|
| 107 | - esc_url( get_permalink() ), |
|
| 105 | + printf('<span class="post-meta-time"><span>%1$s</span> <a href="%2$s" rel="bookmark">%3$s</a></span>', |
|
| 106 | + _x('Posted on:', 'Used before publish date.', 'lsx'), |
|
| 107 | + esc_url(get_permalink()), |
|
| 108 | 108 | $time_string |
| 109 | 109 | ); |
| 110 | 110 | ?> |
| 111 | 111 | |
| 112 | - <?php printf( '<span class="post-meta-author"><span>%1$s</span> <a href="%2$s">%3$s</a></span>', |
|
| 113 | - _x( 'Posted by:', 'Used before post author name.', 'lsx' ), |
|
| 114 | - esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), |
|
| 112 | + <?php printf('<span class="post-meta-author"><span>%1$s</span> <a href="%2$s">%3$s</a></span>', |
|
| 113 | + _x('Posted by:', 'Used before post author name.', 'lsx'), |
|
| 114 | + esc_url(get_author_posts_url(get_the_author_meta('ID'))), |
|
| 115 | 115 | get_the_author() |
| 116 | 116 | ); ?> |
| 117 | 117 | |
| 118 | 118 | |
| 119 | 119 | <?php |
| 120 | - $post_categories = wp_get_post_categories( get_the_ID() ); |
|
| 120 | + $post_categories = wp_get_post_categories(get_the_ID()); |
|
| 121 | 121 | $cats = array(); |
| 122 | - foreach($post_categories as $c){ |
|
| 123 | - $cat = get_category( $c ); |
|
| 124 | - $cats[] = '<a href="' . get_category_link( $cat->term_id ) . '" title="' . sprintf( __( "View all posts in %s" , 'lsx' ), $cat->name ) . '" ' . '>' . $cat->name.'</a>'; |
|
| 122 | + foreach ($post_categories as $c) { |
|
| 123 | + $cat = get_category($c); |
|
| 124 | + $cats[] = '<a href="' . get_category_link($cat->term_id) . '" title="' . sprintf(__("View all posts in %s", 'lsx'), $cat->name) . '" ' . '>' . $cat->name . '</a>'; |
|
| 125 | 125 | } |
| 126 | - if(!empty($cats)){ ?> |
|
| 127 | - <span class="post-meta-categories"><span><?php _e('Posted in:','lsx'); ?></span> <?php echo implode(', ', $cats); ?></span> |
|
| 126 | + if ( ! empty($cats)) { ?> |
|
| 127 | + <span class="post-meta-categories"><span><?php _e('Posted in:', 'lsx'); ?></span> <?php echo implode(', ', $cats); ?></span> |
|
| 128 | 128 | <?php } ?> |
| 129 | 129 | |
| 130 | 130 | <div class="clearfix"></div> |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | * Translate post format to Font Awesome class |
| 138 | 138 | */ |
| 139 | 139 | |
| 140 | -if ( ! function_exists( 'lsx_translate_format_to_fontawesome' ) ) { |
|
| 141 | - function lsx_translate_format_to_fontawesome( $format ) { |
|
| 142 | - switch ( $format ) { |
|
| 140 | +if ( ! function_exists('lsx_translate_format_to_fontawesome')) { |
|
| 141 | + function lsx_translate_format_to_fontawesome($format) { |
|
| 142 | + switch ($format) { |
|
| 143 | 143 | case 'image': |
| 144 | 144 | $format = 'camera'; |
| 145 | 145 | break; |
@@ -184,44 +184,44 @@ discard block |
||
| 184 | 184 | * to be added/modified where necessary. |
| 185 | 185 | */ |
| 186 | 186 | |
| 187 | -if ( ! function_exists( 'lsx_portfolio_meta' ) ) { |
|
| 187 | +if ( ! function_exists('lsx_portfolio_meta')) { |
|
| 188 | 188 | function lsx_portfolio_meta() { |
| 189 | 189 | ?> |
| 190 | 190 | <div id="portfolio-meta" class="portfolio-meta info-box-sticky info-box sticky-wrapper"> |
| 191 | 191 | <?php |
| 192 | - $client = get_post_meta(get_the_ID(),'lsx-client',true); |
|
| 193 | - if(false != $client){ ?> |
|
| 192 | + $client = get_post_meta(get_the_ID(), 'lsx-client', true); |
|
| 193 | + if (false != $client) { ?> |
|
| 194 | 194 | <div class="portfolio-client"> |
| 195 | - <span><span class="fa fa-user"></span><?php _e('Client','lsx'); ?></span> |
|
| 195 | + <span><span class="fa fa-user"></span><?php _e('Client', 'lsx'); ?></span> |
|
| 196 | 196 | <span><?php echo $client ?></span> |
| 197 | 197 | </div> |
| 198 | 198 | <?php } ?> |
| 199 | 199 | |
| 200 | 200 | <?php |
| 201 | - $portfolio_type = get_the_term_list( get_the_ID(), 'jetpack-portfolio-type', '', ', ', '' ); |
|
| 201 | + $portfolio_type = get_the_term_list(get_the_ID(), 'jetpack-portfolio-type', '', ', ', ''); |
|
| 202 | 202 | |
| 203 | - if($portfolio_type){ |
|
| 203 | + if ($portfolio_type) { |
|
| 204 | 204 | ?> |
| 205 | 205 | <div class="portfolio-industry"> |
| 206 | - <span><span class="fa fa-folder-open"></span><?php _e('Industry','lsx'); ?></span> |
|
| 206 | + <span><span class="fa fa-folder-open"></span><?php _e('Industry', 'lsx'); ?></span> |
|
| 207 | 207 | <?php echo $portfolio_type; ?> |
| 208 | 208 | </div> |
| 209 | 209 | <?php } ?> |
| 210 | 210 | |
| 211 | 211 | <?php |
| 212 | - $services = get_the_term_list( get_the_ID(), 'jetpack-portfolio-tag', '', ', ', '' ); |
|
| 213 | - if(false != $services){ ?> |
|
| 212 | + $services = get_the_term_list(get_the_ID(), 'jetpack-portfolio-tag', '', ', ', ''); |
|
| 213 | + if (false != $services) { ?> |
|
| 214 | 214 | <div class="portfolio-services"> |
| 215 | - <span><span class="fa fa-cog"></span><?php _e('Services','lsx'); ?></span> |
|
| 215 | + <span><span class="fa fa-cog"></span><?php _e('Services', 'lsx'); ?></span> |
|
| 216 | 216 | <?php echo $services ?> |
| 217 | 217 | </div> |
| 218 | 218 | <?php } ?> |
| 219 | 219 | |
| 220 | 220 | <?php |
| 221 | - $website = esc_url( get_post_meta(get_the_ID(),'lsx-website',true) ); |
|
| 222 | - if(false != $website){ ?> |
|
| 221 | + $website = esc_url(get_post_meta(get_the_ID(), 'lsx-website', true)); |
|
| 222 | + if (false != $website) { ?> |
|
| 223 | 223 | <div class="portfolio-website"> |
| 224 | - <span><span class="fa fa-link"></span><?php _e('Website','lsx'); ?></span> |
|
| 224 | + <span><span class="fa fa-link"></span><?php _e('Website', 'lsx'); ?></span> |
|
| 225 | 225 | <a target="_blank" href="<?php echo esc_url($website); ?>"><?php echo $website ?></a> |
| 226 | 226 | </div> |
| 227 | 227 | <?php } ?> |
@@ -236,29 +236,29 @@ discard block |
||
| 236 | 236 | * |
| 237 | 237 | */ |
| 238 | 238 | |
| 239 | -if ( ! function_exists( 'lsx_portfolio_gallery' ) ) { |
|
| 239 | +if ( ! function_exists('lsx_portfolio_gallery')) { |
|
| 240 | 240 | function lsx_portfolio_gallery() { |
| 241 | 241 | |
| 242 | - $media = get_attached_media( 'image' ); |
|
| 242 | + $media = get_attached_media('image'); |
|
| 243 | 243 | $media_array = array(); |
| 244 | 244 | $post_thumbnail_id = get_post_thumbnail_id(get_the_ID()); |
| 245 | 245 | |
| 246 | - if(!empty($media)){ |
|
| 247 | - foreach($media as $media_item){ |
|
| 248 | - if($post_thumbnail_id != $media_item->ID) { |
|
| 246 | + if ( ! empty($media)) { |
|
| 247 | + foreach ($media as $media_item) { |
|
| 248 | + if ($post_thumbnail_id != $media_item->ID) { |
|
| 249 | 249 | $media_array[] = $media_item->ID; |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - if(!empty($media_array)){ |
|
| 254 | - echo gallery_shortcode(array('size'=>'full','ids'=>implode(',', $media_array))); |
|
| 253 | + if ( ! empty($media_array)) { |
|
| 254 | + echo gallery_shortcode(array('size'=>'full', 'ids'=>implode(',', $media_array))); |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | } |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | -if ( ! function_exists( 'lsx_paging_nav' ) ) : |
|
| 261 | +if ( ! function_exists('lsx_paging_nav')) : |
|
| 262 | 262 | /** |
| 263 | 263 | * Display navigation to next/previous set of posts when applicable. |
| 264 | 264 | * |
@@ -266,22 +266,22 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | function lsx_paging_nav() { |
| 268 | 268 | // Don't print empty markup if there's only one page. |
| 269 | - if ( $GLOBALS['wp_query']->max_num_pages < 2 ) { |
|
| 269 | + if ($GLOBALS['wp_query']->max_num_pages < 2) { |
|
| 270 | 270 | return; |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - if(current_theme_supports('infinite-scroll') && class_exists('The_Neverending_Home_Page')){ |
|
| 273 | + if (current_theme_supports('infinite-scroll') && class_exists('The_Neverending_Home_Page')) { |
|
| 274 | 274 | return true; |
| 275 | - }elseif(function_exists('wp_pagenavi')){ |
|
| 275 | + }elseif (function_exists('wp_pagenavi')) { |
|
| 276 | 276 | wp_pagenavi(); |
| 277 | - }else{ |
|
| 277 | + } else { |
|
| 278 | 278 | |
| 279 | 279 | $labels = array( |
| 280 | - 'next' => '<span class="meta-nav">←</span> '.__( 'Older posts', 'lsx' ), |
|
| 281 | - 'previous' => __( 'Newer posts', 'lsx' ).' <span class="meta-nav">→</span>', |
|
| 282 | - 'title' => __( 'Posts navigation', 'lsx' ) |
|
| 280 | + 'next' => '<span class="meta-nav">←</span> ' . __('Older posts', 'lsx'), |
|
| 281 | + 'previous' => __('Newer posts', 'lsx') . ' <span class="meta-nav">→</span>', |
|
| 282 | + 'title' => __('Posts navigation', 'lsx') |
|
| 283 | 283 | ); |
| 284 | - $labels = apply_filters('lsx_post_navigation_labels',$labels); |
|
| 284 | + $labels = apply_filters('lsx_post_navigation_labels', $labels); |
|
| 285 | 285 | |
| 286 | 286 | extract($labels); |
| 287 | 287 | ?> |
@@ -289,12 +289,12 @@ discard block |
||
| 289 | 289 | <div class="lsx-breaker"></div> |
| 290 | 290 | <h1 class="screen-reader-text"><?php echo $title; ?></h1> |
| 291 | 291 | <div class="nav-links"> |
| 292 | - <?php if ( get_next_posts_link() ) : ?> |
|
| 293 | - <div class="nav-previous"><?php next_posts_link( $next ); ?></div> |
|
| 292 | + <?php if (get_next_posts_link()) : ?> |
|
| 293 | + <div class="nav-previous"><?php next_posts_link($next); ?></div> |
|
| 294 | 294 | <?php endif; ?> |
| 295 | 295 | |
| 296 | - <?php if ( get_previous_posts_link() ) : ?> |
|
| 297 | - <div class="nav-next"><?php previous_posts_link( $previous ); ?></div> |
|
| 296 | + <?php if (get_previous_posts_link()) : ?> |
|
| 297 | + <div class="nav-next"><?php previous_posts_link($previous); ?></div> |
|
| 298 | 298 | <?php endif; ?> |
| 299 | 299 | |
| 300 | 300 | <div class="clearfix"></div> |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | } |
| 306 | 306 | endif; |
| 307 | 307 | |
| 308 | -if ( ! function_exists( 'lsx_post_nav' ) ) : |
|
| 308 | +if ( ! function_exists('lsx_post_nav')) : |
|
| 309 | 309 | /** |
| 310 | 310 | * Display navigation to next/previous post when applicable. |
| 311 | 311 | * |
@@ -313,10 +313,10 @@ discard block |
||
| 313 | 313 | */ |
| 314 | 314 | function lsx_post_nav() { |
| 315 | 315 | // Don't print empty markup if there's nowhere to navigate. |
| 316 | - $previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true ); |
|
| 317 | - $next = get_adjacent_post( false, '', false ); |
|
| 316 | + $previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true); |
|
| 317 | + $next = get_adjacent_post(false, '', false); |
|
| 318 | 318 | |
| 319 | - if ( ! $next && ! $previous ) { |
|
| 319 | + if ( ! $next && ! $previous) { |
|
| 320 | 320 | return; |
| 321 | 321 | } |
| 322 | 322 | ?> |
@@ -326,13 +326,13 @@ discard block |
||
| 326 | 326 | <div class="nav-links pager row"> |
| 327 | 327 | |
| 328 | 328 | <?php |
| 329 | - $previous_post = get_previous_post_link( '%link', '<div class="previous col-md-6"><p class="nav-links-description">'._x( 'Previous Post', 'Previous post link', 'lsx' ).'</p><h3>%title</h3></div>' ); |
|
| 330 | - $previous_post = str_replace('<a','<a',$previous_post); |
|
| 329 | + $previous_post = get_previous_post_link('%link', '<div class="previous col-md-6"><p class="nav-links-description">' . _x('Previous Post', 'Previous post link', 'lsx') . '</p><h3>%title</h3></div>'); |
|
| 330 | + $previous_post = str_replace('<a', '<a', $previous_post); |
|
| 331 | 331 | echo $previous_post; |
| 332 | 332 | ?> |
| 333 | 333 | <?php |
| 334 | - $next_post = get_next_post_link( '%link', '<div class="next col-md-6"><p class="nav-links-description">'._x( 'Next Post', 'Next post link', 'lsx' ).'</p><h3>%title</h3></div>' ); |
|
| 335 | - $next_post = str_replace('<a','<a',$next_post); |
|
| 334 | + $next_post = get_next_post_link('%link', '<div class="next col-md-6"><p class="nav-links-description">' . _x('Next Post', 'Next post link', 'lsx') . '</p><h3>%title</h3></div>'); |
|
| 335 | + $next_post = str_replace('<a', '<a', $next_post); |
|
| 336 | 336 | echo $next_post; |
| 337 | 337 | ?> |
| 338 | 338 | |
@@ -349,16 +349,16 @@ discard block |
||
| 349 | 349 | * @subpackage template-tags |
| 350 | 350 | * @category header |
| 351 | 351 | */ |
| 352 | -if(!function_exists('lsx_site_identity')){ |
|
| 353 | - function lsx_site_identity(){ |
|
| 352 | +if ( ! function_exists('lsx_site_identity')) { |
|
| 353 | + function lsx_site_identity() { |
|
| 354 | 354 | |
| 355 | - if ( function_exists('has_custom_logo') && has_custom_logo() ) { |
|
| 355 | + if (function_exists('has_custom_logo') && has_custom_logo()) { |
|
| 356 | 356 | the_custom_logo(); |
| 357 | - }elseif ( function_exists( 'jetpack_has_site_logo' ) && jetpack_has_site_logo() ) { |
|
| 357 | + }elseif (function_exists('jetpack_has_site_logo') && jetpack_has_site_logo()) { |
|
| 358 | 358 | jetpack_the_site_logo(); |
| 359 | - }else{ |
|
| 359 | + } else { |
|
| 360 | 360 | // shouldn't show both together.. its just strange |
| 361 | - if(true == get_theme_mod('site_logo_header_text',1)){ |
|
| 361 | + if (true == get_theme_mod('site_logo_header_text', 1)) { |
|
| 362 | 362 | lsx_site_title(); |
| 363 | 363 | } |
| 364 | 364 | } |
@@ -373,17 +373,17 @@ discard block |
||
| 373 | 373 | * @subpackage template-tags |
| 374 | 374 | * @category navigation |
| 375 | 375 | */ |
| 376 | -if(!function_exists('lsx_navbar_header')){ |
|
| 377 | - function lsx_navbar_header(){ ?> |
|
| 376 | +if ( ! function_exists('lsx_navbar_header')) { |
|
| 377 | + function lsx_navbar_header() { ?> |
|
| 378 | 378 | <div class="navbar-header" itemscope itemtype="http://schema.org/WebPage"> |
| 379 | 379 | |
| 380 | 380 | <?php |
| 381 | - $nav_menu = get_theme_mod('nav_menu_locations',false); |
|
| 381 | + $nav_menu = get_theme_mod('nav_menu_locations', false); |
|
| 382 | 382 | //print_r(get_nav_menu_locations()); |
| 383 | 383 | |
| 384 | - if(false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']){ ?> |
|
| 384 | + if (false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']) { ?> |
|
| 385 | 385 | <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".primary-navbar"> |
| 386 | - <span class="sr-only"><?php _e('Toggle navigation','lsx'); ?></span> |
|
| 386 | + <span class="sr-only"><?php _e('Toggle navigation', 'lsx'); ?></span> |
|
| 387 | 387 | <span class="icon-bar"></span> |
| 388 | 388 | <span class="icon-bar"></span> |
| 389 | 389 | <span class="icon-bar"></span> |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | <?php } |
| 396 | 396 | } |
| 397 | 397 | //the if statement is for backwards compatability with previous versions of the theme. |
| 398 | -add_action('lsx_nav_before','lsx_navbar_header'); |
|
| 398 | +add_action('lsx_nav_before', 'lsx_navbar_header'); |
|
| 399 | 399 | |
| 400 | 400 | /** |
| 401 | 401 | * Outputs the Nav Menu |
@@ -404,16 +404,16 @@ discard block |
||
| 404 | 404 | * @subpackage template-tags |
| 405 | 405 | * @category navigation |
| 406 | 406 | */ |
| 407 | -if(!function_exists('lsx_nav_menu')){ |
|
| 408 | - function lsx_nav_menu(){ |
|
| 409 | - $nav_menu = get_theme_mod('nav_menu_locations',false); |
|
| 407 | +if ( ! function_exists('lsx_nav_menu')) { |
|
| 408 | + function lsx_nav_menu() { |
|
| 409 | + $nav_menu = get_theme_mod('nav_menu_locations', false); |
|
| 410 | 410 | |
| 411 | 411 | //print_r(get_nav_menu_locations()); |
| 412 | 412 | |
| 413 | - if(false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']){ ?> |
|
| 413 | + if (false != $nav_menu && isset($nav_menu['primary']) && 0 != $nav_menu['primary']) { ?> |
|
| 414 | 414 | <nav class="primary-navbar collapse navbar-collapse"> |
| 415 | 415 | <?php |
| 416 | - wp_nav_menu( array( |
|
| 416 | + wp_nav_menu(array( |
|
| 417 | 417 | 'theme_location' => 'primary', |
| 418 | 418 | 'menu' => $nav_menu['primary'], |
| 419 | 419 | 'depth' => 3, |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | ); |
| 424 | 424 | ?> |
| 425 | 425 | </nav> |
| 426 | - <?php } elseif(is_customize_preview()) { ?> |
|
| 426 | + <?php } elseif (is_customize_preview()) { ?> |
|
| 427 | 427 | <nav class="primary-navbar collapse navbar-collapse"> |
| 428 | - <div class="alert alert-info" role="alert"><?php _e('Create a menu and assign it here via the "Navigation" panel.','lsx');?></div> |
|
| 428 | + <div class="alert alert-info" role="alert"><?php _e('Create a menu and assign it here via the "Navigation" panel.', 'lsx'); ?></div> |
|
| 429 | 429 | </nav> |
| 430 | 430 | </div> |
| 431 | 431 | <?php } |
@@ -439,9 +439,9 @@ discard block |
||
| 439 | 439 | * @subpackage template-tags |
| 440 | 440 | * @category sitemap |
| 441 | 441 | */ |
| 442 | -function lsx_sitemap_pages(){ |
|
| 442 | +function lsx_sitemap_pages() { |
|
| 443 | 443 | $posts_per_page = get_option('posts_per_page'); |
| 444 | - if(false == $posts_per_page){ |
|
| 444 | + if (false == $posts_per_page) { |
|
| 445 | 445 | $posts_per_page = 10; |
| 446 | 446 | } |
| 447 | 447 | |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | 'post_type' => 'page', |
| 453 | 453 | ); |
| 454 | 454 | $pages = new WP_Query($page_args); |
| 455 | - if($pages->have_posts()){ |
|
| 455 | + if ($pages->have_posts()) { |
|
| 456 | 456 | |
| 457 | - echo '<h2>'.__( 'Pages', 'lsx' ).'</h2>'; |
|
| 457 | + echo '<h2>' . __('Pages', 'lsx') . '</h2>'; |
|
| 458 | 458 | |
| 459 | 459 | echo '<ul>'; |
| 460 | - while($pages->have_posts()){ $pages->the_post(); |
|
| 461 | - echo '<li class="page_item page-item-'.get_the_ID().'"><a href="'.get_permalink().'" title="">'.get_the_title().'</a></li>'; |
|
| 460 | + while ($pages->have_posts()) { $pages->the_post(); |
|
| 461 | + echo '<li class="page_item page-item-' . get_the_ID() . '"><a href="' . get_permalink() . '" title="">' . get_the_title() . '</a></li>'; |
|
| 462 | 462 | } |
| 463 | 463 | echo '</ul>'; |
| 464 | 464 | |
@@ -473,10 +473,10 @@ discard block |
||
| 473 | 473 | * @subpackage template-tags |
| 474 | 474 | * @category sitemap |
| 475 | 475 | */ |
| 476 | -function lsx_sitemap_custom_post_type(){ |
|
| 476 | +function lsx_sitemap_custom_post_type() { |
|
| 477 | 477 | |
| 478 | 478 | $posts_per_page = get_option('posts_per_page'); |
| 479 | - if(false == $posts_per_page){ |
|
| 479 | + if (false == $posts_per_page) { |
|
| 480 | 480 | $posts_per_page = 10; |
| 481 | 481 | } |
| 482 | 482 | |
@@ -484,8 +484,8 @@ discard block |
||
| 484 | 484 | 'public' => true, |
| 485 | 485 | '_builtin' => false |
| 486 | 486 | ); |
| 487 | - $post_types = get_post_types($args , 'names'); |
|
| 488 | - foreach($post_types as $post_type){ |
|
| 487 | + $post_types = get_post_types($args, 'names'); |
|
| 488 | + foreach ($post_types as $post_type) { |
|
| 489 | 489 | |
| 490 | 490 | $post_type_args = array( |
| 491 | 491 | 'post_type' => 'page', |
@@ -496,19 +496,19 @@ discard block |
||
| 496 | 496 | $post_type_items = new WP_Query($post_type_args); |
| 497 | 497 | |
| 498 | 498 | $post_type_object = get_post_type_object($post_type); |
| 499 | - if(null != $post_type_object){ |
|
| 499 | + if (null != $post_type_object) { |
|
| 500 | 500 | $title = $post_type_object->labels->name; |
| 501 | - }else{ |
|
| 501 | + } else { |
|
| 502 | 502 | $title = ucwords($post_type); |
| 503 | 503 | } |
| 504 | 504 | |
| 505 | - if($post_type_items->have_posts()){ |
|
| 505 | + if ($post_type_items->have_posts()) { |
|
| 506 | 506 | |
| 507 | - printf( '<h2>'.__( '%1$s', 'lsx' ).'</h2>', $title ); |
|
| 507 | + printf('<h2>' . __('%1$s', 'lsx') . '</h2>', $title); |
|
| 508 | 508 | |
| 509 | 509 | echo '<ul>'; |
| 510 | - while($post_type_items->have_posts()){ $post_type_items->the_post(); |
|
| 511 | - echo '<li class="'.get_post_type().'_item '.get_post_type().'-item-'.get_the_ID().'"><a href="'.get_permalink().'" title="">'.get_the_title().'</a></li>'; |
|
| 510 | + while ($post_type_items->have_posts()) { $post_type_items->the_post(); |
|
| 511 | + echo '<li class="' . get_post_type() . '_item ' . get_post_type() . '-item-' . get_the_ID() . '"><a href="' . get_permalink() . '" title="">' . get_the_title() . '</a></li>'; |
|
| 512 | 512 | } |
| 513 | 513 | echo '</ul>'; |
| 514 | 514 | |
@@ -524,20 +524,20 @@ discard block |
||
| 524 | 524 | * @subpackage template-tags |
| 525 | 525 | * @category sitemap |
| 526 | 526 | */ |
| 527 | -function lsx_sitemap_taxonomy_clouds(){ |
|
| 527 | +function lsx_sitemap_taxonomy_clouds() { |
|
| 528 | 528 | |
| 529 | - $taxonomy_args = array( |
|
| 529 | + $taxonomy_args = array( |
|
| 530 | 530 | 'public' => true, |
| 531 | 531 | '_builtin' => false |
| 532 | 532 | ); |
| 533 | 533 | $taxonomies = get_taxonomies($taxonomy_args); |
| 534 | - if(!empty($taxonomies)){ |
|
| 535 | - foreach($taxonomies as $taxonomy_id => $taxonomy) { |
|
| 534 | + if ( ! empty($taxonomies)) { |
|
| 535 | + foreach ($taxonomies as $taxonomy_id => $taxonomy) { |
|
| 536 | 536 | |
| 537 | - $tag_cloud = wp_tag_cloud(array('taxonomy'=>$taxonomy_id,'echo'=>false)); |
|
| 538 | - if(null != $tag_cloud){ |
|
| 539 | - printf( '<h2>'.__( '%1$s', 'lsx' ).'</h2>', $taxonomy ); |
|
| 540 | - echo '<aside id="'.$taxonomy_id.'" class="widget widget_'.$taxonomy_id.'">'.$tag_cloud.'</aside>'; |
|
| 537 | + $tag_cloud = wp_tag_cloud(array('taxonomy'=>$taxonomy_id, 'echo'=>false)); |
|
| 538 | + if (null != $tag_cloud) { |
|
| 539 | + printf('<h2>' . __('%1$s', 'lsx') . '</h2>', $taxonomy); |
|
| 540 | + echo '<aside id="' . $taxonomy_id . '" class="widget widget_' . $taxonomy_id . '">' . $tag_cloud . '</aside>'; |
|
| 541 | 541 | } |
| 542 | 542 | } |
| 543 | 543 | } |
@@ -550,15 +550,15 @@ discard block |
||
| 550 | 550 | * @subpackage hooks |
| 551 | 551 | * @category forms |
| 552 | 552 | */ |
| 553 | -add_action( 'lsx_footer_before', 'lsx_footer_subscription_cta', 10 ); |
|
| 553 | +add_action('lsx_footer_before', 'lsx_footer_subscription_cta', 10); |
|
| 554 | 554 | function lsx_footer_subscription_cta() { |
| 555 | - if(!function_exists('lsx_is_form_enabled')){ return; } |
|
| 555 | + if ( ! function_exists('lsx_is_form_enabled')) { return; } |
|
| 556 | 556 | $subscribe_form_id = lsx_is_form_enabled('subscribe'); |
| 557 | - if(false == $subscribe_form_id) { return; } |
|
| 557 | + if (false == $subscribe_form_id) { return; } |
|
| 558 | 558 | |
| 559 | 559 | //add Caldera Forms Fields Scripts |
| 560 | - if( defined( 'CFCORE_VER' ) ){ |
|
| 561 | - wp_enqueue_script( 'cf-frontend-fields', CFCORE_URL . 'assets/js/fields.min.js', array('jquery'), CFCORE_VER ); |
|
| 560 | + if (defined('CFCORE_VER')) { |
|
| 561 | + wp_enqueue_script('cf-frontend-fields', CFCORE_URL . 'assets/js/fields.min.js', array('jquery'), CFCORE_VER); |
|
| 562 | 562 | } |
| 563 | 563 | |
| 564 | 564 | ?> |
@@ -566,8 +566,8 @@ discard block |
||
| 566 | 566 | <div class="container"> |
| 567 | 567 | <div class="row"> |
| 568 | 568 | <div class="col-md-12"> |
| 569 | - <h2><?php _e( 'Subscribe to Our Newsletter', 'lsx' ); ?></h2> |
|
| 570 | - <?php echo do_shortcode( '[caldera_form id="'.$subscribe_form_id.'"]' ); ?> |
|
| 569 | + <h2><?php _e('Subscribe to Our Newsletter', 'lsx'); ?></h2> |
|
| 570 | + <?php echo do_shortcode('[caldera_form id="' . $subscribe_form_id . '"]'); ?> |
|
| 571 | 571 | </div> |
| 572 | 572 | </div> |
| 573 | 573 | </div> |
@@ -582,14 +582,14 @@ discard block |
||
| 582 | 582 | * @subpackage hooks |
| 583 | 583 | * @category menu |
| 584 | 584 | */ |
| 585 | -add_action( 'lsx_header_top', 'lsx_add_top_menu' ); |
|
| 585 | +add_action('lsx_header_top', 'lsx_add_top_menu'); |
|
| 586 | 586 | function lsx_add_top_menu() { |
| 587 | 587 | if (has_nav_menu('top-menu')) { ?> |
| 588 | 588 | <div id="top-menu" class="<?php lsx_top_menu_classes(); ?>"> |
| 589 | 589 | <div class="container"> |
| 590 | 590 | <nav class="top-menu"> |
| 591 | 591 | <?php |
| 592 | - wp_nav_menu( array( |
|
| 592 | + wp_nav_menu(array( |
|
| 593 | 593 | 'theme_location' => 'top-menu', |
| 594 | 594 | 'walker' => new lsx_bootstrap_navwalker()) |
| 595 | 595 | ); |
@@ -607,24 +607,24 @@ discard block |
||
| 607 | 607 | * @subpackage template-tag |
| 608 | 608 | * @category forms |
| 609 | 609 | */ |
| 610 | -if ( class_exists('Caldera_Forms') && !function_exists( 'lsx_is_form_enabled' ) ) { |
|
| 610 | +if (class_exists('Caldera_Forms') && ! function_exists('lsx_is_form_enabled')) { |
|
| 611 | 611 | function lsx_is_form_enabled($slug = false) { |
| 612 | - if(false == $slug){ return false; } |
|
| 612 | + if (false == $slug) { return false; } |
|
| 613 | 613 | |
| 614 | 614 | $match = false; |
| 615 | - $forms = get_option( '_caldera_forms' , false ); |
|
| 616 | - if(false !== $forms ) { |
|
| 617 | - foreach($forms as $form_id=>$form_maybe){ |
|
| 618 | - if( trim(strtolower($slug)) == strtolower($form_maybe['name']) ){ |
|
| 615 | + $forms = get_option('_caldera_forms', false); |
|
| 616 | + if (false !== $forms) { |
|
| 617 | + foreach ($forms as $form_id=>$form_maybe) { |
|
| 618 | + if (trim(strtolower($slug)) == strtolower($form_maybe['name'])) { |
|
| 619 | 619 | $match = $form_id; |
| 620 | 620 | break; |
| 621 | 621 | } |
| 622 | 622 | } |
| 623 | 623 | } |
| 624 | - if( false === $match ){ |
|
| 625 | - $is_form = Caldera_Forms::get_form( strtolower( $slug ) ); |
|
| 626 | - if( !empty( $is_form ) ){ |
|
| 627 | - return strtolower( $slug ); |
|
| 624 | + if (false === $match) { |
|
| 625 | + $is_form = Caldera_Forms::get_form(strtolower($slug)); |
|
| 626 | + if ( ! empty($is_form)) { |
|
| 627 | + return strtolower($slug); |
|
| 628 | 628 | } |
| 629 | 629 | } |
| 630 | 630 | |
@@ -640,10 +640,10 @@ discard block |
||
| 640 | 640 | * @category urls |
| 641 | 641 | */ |
| 642 | 642 | function lsx_get_my_url() { |
| 643 | - if ( ! preg_match( '/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) ) |
|
| 643 | + if ( ! preg_match('/<a\s[^>]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches)) |
|
| 644 | 644 | return false; |
| 645 | 645 | |
| 646 | - return esc_url_raw( $matches[1] ); |
|
| 646 | + return esc_url_raw($matches[1]); |
|
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | /** |
@@ -653,19 +653,19 @@ discard block |
||
| 653 | 653 | * @subpackage extras |
| 654 | 654 | * @category urls |
| 655 | 655 | */ |
| 656 | -function lsx_get_template_part($slug,$part) { |
|
| 656 | +function lsx_get_template_part($slug, $part) { |
|
| 657 | 657 | $template = array(); |
| 658 | 658 | $part = (string) $part; |
| 659 | - if ( '' !== $part ){ |
|
| 659 | + if ('' !== $part) { |
|
| 660 | 660 | $template = "{$slug}-{$part}.php"; |
| 661 | - }else{ |
|
| 661 | + } else { |
|
| 662 | 662 | $template = "{$slug}.php"; |
| 663 | 663 | } |
| 664 | - $file_path = apply_filters('lsx_content_path',false,$slug,$part); |
|
| 664 | + $file_path = apply_filters('lsx_content_path', false, $slug, $part); |
|
| 665 | 665 | |
| 666 | - if ( false !== $file_path && '' == locate_template( array( $template ) ) && file_exists( $file_path.$template) ) { |
|
| 667 | - load_template( $file_path.$template, false ); |
|
| 668 | - }else{ |
|
| 669 | - get_template_part($slug,$part); |
|
| 666 | + if (false !== $file_path && '' == locate_template(array($template)) && file_exists($file_path . $template)) { |
|
| 667 | + load_template($file_path . $template, false); |
|
| 668 | + } else { |
|
| 669 | + get_template_part($slug, $part); |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | \ 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 | * 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 |
@@ -30,7 +30,6 @@ |
||
| 30 | 30 | * @param string $output Passed by reference. Used to append additional content. |
| 31 | 31 | * @param object $item Menu item data object. |
| 32 | 32 | * @param int $depth Depth of menu item. Used for padding. |
| 33 | - * @param int $current_page Menu item ID. |
|
| 34 | 33 | * @param object $args |
| 35 | 34 | */ |
| 36 | 35 | public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
@@ -159,17 +159,17 @@ |
||
| 159 | 159 | * @return null Null on failure with no changes to parameters. |
| 160 | 160 | */ |
| 161 | 161 | public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
| 162 | - if ( ! $element ) |
|
| 163 | - return; |
|
| 162 | + if ( ! $element ) |
|
| 163 | + return; |
|
| 164 | 164 | |
| 165 | - $id_field = $this->db_fields['id']; |
|
| 165 | + $id_field = $this->db_fields['id']; |
|
| 166 | 166 | |
| 167 | - // Display this element. |
|
| 168 | - if ( is_object( $args[0] ) ) |
|
| 169 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 167 | + // Display this element. |
|
| 168 | + if ( is_object( $args[0] ) ) |
|
| 169 | + $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 170 | 170 | |
| 171 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 172 | - } |
|
| 171 | + parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 172 | + } |
|
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * Menu Fallback |
@@ -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 | class lsx_bootstrap_navwalker extends Walker_Nav_Menu { |
| 5 | 5 | |
@@ -10,15 +10,15 @@ discard block |
||
| 10 | 10 | * @param string $output Passed by reference. Used to append additional content. |
| 11 | 11 | * @param int $depth Depth of page. Used for padding. |
| 12 | 12 | */ |
| 13 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
| 14 | - $indent = str_repeat( "\t", $depth ); |
|
| 13 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
| 14 | + $indent = str_repeat("\t", $depth); |
|
| 15 | 15 | $output .= "\n$indent<ul role=\"menu\" class=\" dropdown-menu\">\n"; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * @param string $item Passed by reference. Used to append additional content. |
| 20 | 20 | */ |
| 21 | - public function filter_default_pages( &$item ) { |
|
| 21 | + public function filter_default_pages(&$item) { |
|
| 22 | 22 | |
| 23 | 23 | return $item; |
| 24 | 24 | } |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | * @param int $current_page Menu item ID. |
| 34 | 34 | * @param object $args |
| 35 | 35 | */ |
| 36 | - public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
| 37 | - $indent = ( $depth ) ? str_repeat( "\t", $depth ) : ''; |
|
| 36 | + public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
| 37 | + $indent = ($depth) ? str_repeat("\t", $depth) : ''; |
|
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | 40 | * If this is a default menu being called we need to fix |
| 41 | 41 | * the item object thats coming through. |
| 42 | 42 | */ |
| 43 | - if(!isset($item->title)){ |
|
| 43 | + if ( ! isset($item->title)) { |
|
| 44 | 44 | return; |
| 45 | 45 | } |
| 46 | 46 | |
@@ -52,63 +52,63 @@ discard block |
||
| 52 | 52 | * comparison that is not case sensitive. The strcasecmp() function returns |
| 53 | 53 | * a 0 if the strings are equal. |
| 54 | 54 | */ |
| 55 | - if ( strcasecmp( $item->attr_title, 'divider' ) == 0 && $depth === 1 ) { |
|
| 55 | + if (strcasecmp($item->attr_title, 'divider') == 0 && $depth === 1) { |
|
| 56 | 56 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 57 | - } else if ( strcasecmp( $item->title, 'divider') == 0 && $depth === 1 ) { |
|
| 57 | + } else if (strcasecmp($item->title, 'divider') == 0 && $depth === 1) { |
|
| 58 | 58 | $output .= $indent . '<li role="presentation" class="divider">'; |
| 59 | - } else if ( strcasecmp( $item->attr_title, 'dropdown-header') == 0 && $depth === 1 ) { |
|
| 60 | - $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title ); |
|
| 61 | - } else if ( strcasecmp($item->attr_title, 'disabled' ) == 0 ) { |
|
| 62 | - $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr( $item->title ) . '</a>'; |
|
| 59 | + } else if (strcasecmp($item->attr_title, 'dropdown-header') == 0 && $depth === 1) { |
|
| 60 | + $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr($item->title); |
|
| 61 | + } else if (strcasecmp($item->attr_title, 'disabled') == 0) { |
|
| 62 | + $output .= $indent . '<li role="presentation" class="disabled"><a href="#">' . esc_attr($item->title) . '</a>'; |
|
| 63 | 63 | } else { |
| 64 | 64 | |
| 65 | 65 | $class_names = $value = ''; |
| 66 | 66 | |
| 67 | - $classes = empty( $item->classes ) ? array() : (array) $item->classes; |
|
| 67 | + $classes = empty($item->classes) ? array() : (array) $item->classes; |
|
| 68 | 68 | $classes[] = 'menu-item-' . $item->ID; |
| 69 | 69 | |
| 70 | - $classes = apply_filters( 'lsx_nav_menu_css_class', array_filter( $classes ), $item, $args , $depth ); |
|
| 70 | + $classes = apply_filters('lsx_nav_menu_css_class', array_filter($classes), $item, $args, $depth); |
|
| 71 | 71 | |
| 72 | - $class_names = join( ' ', $classes ); |
|
| 72 | + $class_names = join(' ', $classes); |
|
| 73 | 73 | |
| 74 | - if ( $args->has_children ) |
|
| 74 | + if ($args->has_children) |
|
| 75 | 75 | $class_names .= ' dropdown'; |
| 76 | 76 | |
| 77 | - if ( in_array( 'current-menu-item', $classes ) ) |
|
| 77 | + if (in_array('current-menu-item', $classes)) |
|
| 78 | 78 | $class_names .= ' active'; |
| 79 | 79 | |
| 80 | - if ( in_array( 'current-menu-parent', $classes ) ) |
|
| 80 | + if (in_array('current-menu-parent', $classes)) |
|
| 81 | 81 | $class_names .= ' active'; |
| 82 | 82 | |
| 83 | 83 | //Check if this is ment to be a "social" type menu |
| 84 | - $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; |
|
| 84 | + $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; |
|
| 85 | 85 | |
| 86 | - $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); |
|
| 87 | - $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; |
|
| 86 | + $id = apply_filters('nav_menu_item_id', 'menu-item-' . $item->ID, $item, $args); |
|
| 87 | + $id = $id ? ' id="' . esc_attr($id) . '"' : ''; |
|
| 88 | 88 | |
| 89 | - $output .= $indent . '<li' . $id . $value . $class_names .'>'; |
|
| 89 | + $output .= $indent . '<li' . $id . $value . $class_names . '>'; |
|
| 90 | 90 | |
| 91 | 91 | $atts = array(); |
| 92 | - $atts['title'] = ! empty( $item->title ) ? $item->title : ''; |
|
| 93 | - $atts['target'] = ! empty( $item->target ) ? $item->target : ''; |
|
| 94 | - $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; |
|
| 92 | + $atts['title'] = ! empty($item->title) ? $item->title : ''; |
|
| 93 | + $atts['target'] = ! empty($item->target) ? $item->target : ''; |
|
| 94 | + $atts['rel'] = ! empty($item->xfn) ? $item->xfn : ''; |
|
| 95 | 95 | |
| 96 | 96 | // If item has_children add atts to a. |
| 97 | - if ( $args->has_children ) { |
|
| 98 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 99 | - $atts['data-toggle'] = 'dropdown'; |
|
| 100 | - $atts['class'] = 'dropdown-toggle'; |
|
| 101 | - $atts['aria-haspopup'] = 'true'; |
|
| 97 | + if ($args->has_children) { |
|
| 98 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 99 | + $atts['data-toggle'] = 'dropdown'; |
|
| 100 | + $atts['class'] = 'dropdown-toggle'; |
|
| 101 | + $atts['aria-haspopup'] = 'true'; |
|
| 102 | 102 | } else { |
| 103 | - $atts['href'] = ! empty( $item->url ) ? $item->url : ''; |
|
| 103 | + $atts['href'] = ! empty($item->url) ? $item->url : ''; |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | - $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); |
|
| 106 | + $atts = apply_filters('nav_menu_link_attributes', $atts, $item, $args); |
|
| 107 | 107 | |
| 108 | 108 | $attributes = ''; |
| 109 | - foreach ( $atts as $attr => $value ) { |
|
| 110 | - if ( ! empty( $value ) ) { |
|
| 111 | - $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); |
|
| 109 | + foreach ($atts as $attr => $value) { |
|
| 110 | + if ( ! empty($value)) { |
|
| 111 | + $value = ('href' === $attr) ? esc_url($value) : esc_attr($value); |
|
| 112 | 112 | $attributes .= ' ' . $attr . '="' . $value . '"'; |
| 113 | 113 | } |
| 114 | 114 | } |
@@ -122,19 +122,19 @@ discard block |
||
| 122 | 122 | * if there is a value in the attr_title property. If the attr_title |
| 123 | 123 | * property is NOT null we apply it as the class name for the glyphicon. |
| 124 | 124 | */ |
| 125 | - if ( ! empty( $item->attr_title ) ) { |
|
| 126 | - $item_output .= '<a'. $attributes .'"><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span> '; |
|
| 125 | + if ( ! empty($item->attr_title)) { |
|
| 126 | + $item_output .= '<a' . $attributes . '"><span class="glyphicon ' . esc_attr($item->attr_title) . '"></span> '; |
|
| 127 | 127 | } else { |
| 128 | - $item_output .= '<a'. $attributes .'>'; |
|
| 128 | + $item_output .= '<a' . $attributes . '>'; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; |
|
| 132 | - $item_output .= ( $args->has_children && 0 === $depth ) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 131 | + $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; |
|
| 132 | + $item_output .= ($args->has_children && 0 === $depth) ? ' <span class="caret"></span></a>' : '</a>'; |
|
| 133 | 133 | $item_output .= $args->after; |
| 134 | 134 | |
| 135 | 135 | |
| 136 | 136 | |
| 137 | - $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); |
|
| 137 | + $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); |
|
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
@@ -158,17 +158,17 @@ discard block |
||
| 158 | 158 | * @param string $output Passed by reference. Used to append additional content. |
| 159 | 159 | * @return null Null on failure with no changes to parameters. |
| 160 | 160 | */ |
| 161 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
| 162 | - if ( ! $element ) |
|
| 161 | + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { |
|
| 162 | + if ( ! $element) |
|
| 163 | 163 | return; |
| 164 | 164 | |
| 165 | 165 | $id_field = $this->db_fields['id']; |
| 166 | 166 | |
| 167 | 167 | // Display this element. |
| 168 | - if ( is_object( $args[0] ) ) |
|
| 169 | - $args[0]->has_children = ! empty( $children_elements[ $element->$id_field ] ); |
|
| 168 | + if (is_object($args[0])) |
|
| 169 | + $args[0]->has_children = ! empty($children_elements[$element->$id_field]); |
|
| 170 | 170 | |
| 171 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
| 171 | + parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -182,20 +182,20 @@ discard block |
||
| 182 | 182 | * @param array $args passed from the wp_nav_menu function. |
| 183 | 183 | * |
| 184 | 184 | */ |
| 185 | - public static function fallback( $args ) { |
|
| 186 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 185 | + public static function fallback($args) { |
|
| 186 | + if (current_user_can('manage_options')) { |
|
| 187 | 187 | |
| 188 | - extract( $args ); |
|
| 188 | + extract($args); |
|
| 189 | 189 | |
| 190 | 190 | $fb_output = null; |
| 191 | 191 | |
| 192 | - if ( $container ) { |
|
| 192 | + if ($container) { |
|
| 193 | 193 | $fb_output = '<' . $container; |
| 194 | 194 | |
| 195 | - if ( $container_id ) |
|
| 195 | + if ($container_id) |
|
| 196 | 196 | $fb_output .= ' id="' . $container_id . '"'; |
| 197 | 197 | |
| 198 | - if ( $container_class ) |
|
| 198 | + if ($container_class) |
|
| 199 | 199 | $fb_output .= ' class="' . $container_class . '"'; |
| 200 | 200 | |
| 201 | 201 | $fb_output .= '>'; |
@@ -203,17 +203,17 @@ discard block |
||
| 203 | 203 | |
| 204 | 204 | $fb_output .= '<ul'; |
| 205 | 205 | |
| 206 | - if ( $menu_id ) |
|
| 206 | + if ($menu_id) |
|
| 207 | 207 | $fb_output .= ' id="' . $menu_id . '"'; |
| 208 | 208 | |
| 209 | - if ( $menu_class ) |
|
| 209 | + if ($menu_class) |
|
| 210 | 210 | $fb_output .= ' class="' . $menu_class . '"'; |
| 211 | 211 | |
| 212 | 212 | $fb_output .= '>'; |
| 213 | - $fb_output .= '<li><a href="' . admin_url( 'nav-menus.php' ) . '">'.__('Add a menu','lsx').'</a></li>'; |
|
| 213 | + $fb_output .= '<li><a href="' . admin_url('nav-menus.php') . '">' . __('Add a menu', 'lsx') . '</a></li>'; |
|
| 214 | 214 | $fb_output .= '</ul>'; |
| 215 | 215 | |
| 216 | - if ( $container ) |
|
| 216 | + if ($container) |
|
| 217 | 217 | $fb_output .= '</' . $container . '>'; |
| 218 | 218 | |
| 219 | 219 | echo $fb_output; |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | /** |
| 226 | 226 | * Add in our custom classes to the menus |
| 227 | 227 | */ |
| 228 | -function wpml_nav_language_switcher_fix( $items , $args ) { |
|
| 229 | - $items = str_replace('menu-item-language-current','menu-item-language-current dropdown',$items); |
|
| 230 | - $items = str_replace('submenu-languages','submenu-languages dropdown-menu',$items); |
|
| 228 | +function wpml_nav_language_switcher_fix($items, $args) { |
|
| 229 | + $items = str_replace('menu-item-language-current', 'menu-item-language-current dropdown', $items); |
|
| 230 | + $items = str_replace('submenu-languages', 'submenu-languages dropdown-menu', $items); |
|
| 231 | 231 | return $items; |
| 232 | 232 | } |
| 233 | -add_filter( 'wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2 ); |
|
| 233 | +add_filter('wp_nav_menu_items', 'wpml_nav_language_switcher_fix', 10, 2); |
|
@@ -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 | } |
@@ -60,12 +60,12 @@ |
||
| 60 | 60 | <strong><?php _e( 'Get your Tourism Establishment Online', 'lsx' ); ?></strong> |
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - if(is_singular('landing-page')){ |
|
| 64 | - $email_address = get_post_meta(get_the_ID(),'email_address',true); |
|
| 65 | - if(false === $email_address){ |
|
| 63 | + if(is_singular('landing-page')){ |
|
| 64 | + $email_address = get_post_meta(get_the_ID(),'email_address',true); |
|
| 65 | + if(false === $email_address){ |
|
| 66 | 66 | $email_address = '[email protected]'; |
| 67 | 67 | } |
| 68 | - } ?> |
|
| 68 | + } ?> |
|
| 69 | 69 | |
| 70 | 70 | <span class="email-address"><?php _e( 'Questions? Email Us: ', 'lsx' ); ?><a href="mailto:<?php echo $email_address; ?>"><?php echo $email_address; ?></a></span> |
| 71 | 71 | </div> |
@@ -12,16 +12,16 @@ discard block |
||
| 12 | 12 | <html <?php language_attributes(); ?>> |
| 13 | 13 | <head> |
| 14 | 14 | <?php lsx_head_top(); ?> |
| 15 | -<meta charset="<?php bloginfo( 'charset' ); ?>"> |
|
| 15 | +<meta charset="<?php bloginfo('charset'); ?>"> |
|
| 16 | 16 | <link rel="profile" href="http://gmpg.org/xfn/11"> |
| 17 | -<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>"> |
|
| 17 | +<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>"> |
|
| 18 | 18 | <?php lsx_head_bottom(); ?> |
| 19 | 19 | <?php wp_head(); ?> |
| 20 | 20 | </head> |
| 21 | -<body <?php body_class( 'lsx' ); ?>> |
|
| 21 | +<body <?php body_class('lsx'); ?>> |
|
| 22 | 22 | <?php lsx_body_top(); ?> |
| 23 | 23 | |
| 24 | -<?php if ( !is_singular('landing-page') ) { ?> |
|
| 24 | +<?php if ( ! is_singular('landing-page')) { ?> |
|
| 25 | 25 | |
| 26 | 26 | <?php lsx_header_before(); ?> |
| 27 | 27 | <header class="<?php lsx_header_classes(); ?>"> |
@@ -57,17 +57,17 @@ discard block |
||
| 57 | 57 | </div> |
| 58 | 58 | |
| 59 | 59 | <div class="header-links"> |
| 60 | - <strong><?php _e( 'Get your Tourism Establishment Online', 'lsx' ); ?></strong> |
|
| 60 | + <strong><?php _e('Get your Tourism Establishment Online', 'lsx'); ?></strong> |
|
| 61 | 61 | |
| 62 | 62 | <?php |
| 63 | - if(is_singular('landing-page')){ |
|
| 64 | - $email_address = get_post_meta(get_the_ID(),'email_address',true); |
|
| 65 | - if(false === $email_address){ |
|
| 63 | + if (is_singular('landing-page')) { |
|
| 64 | + $email_address = get_post_meta(get_the_ID(), 'email_address', true); |
|
| 65 | + if (false === $email_address) { |
|
| 66 | 66 | $email_address = '[email protected]'; |
| 67 | 67 | } |
| 68 | 68 | } ?> |
| 69 | 69 | |
| 70 | - <span class="email-address"><?php _e( 'Questions? Email Us: ', 'lsx' ); ?><a href="mailto:<?php echo $email_address; ?>"><?php echo $email_address; ?></a></span> |
|
| 70 | + <span class="email-address"><?php _e('Questions? Email Us: ', 'lsx'); ?><a href="mailto:<?php echo $email_address; ?>"><?php echo $email_address; ?></a></span> |
|
| 71 | 71 | </div> |
| 72 | 72 | </div> |
| 73 | 73 | |
@@ -21,9 +21,9 @@ |
||
| 21 | 21 | |
| 22 | 22 | <?php lsx_content_top(); ?> |
| 23 | 23 | |
| 24 | - <?php while ( have_posts() ) : the_post(); ?> |
|
| 24 | + <?php while (have_posts()) : the_post(); ?> |
|
| 25 | 25 | |
| 26 | - <?php get_template_part( 'content', 'portfolio-single' ); ?> |
|
| 26 | + <?php get_template_part('content', 'portfolio-single'); ?> |
|
| 27 | 27 | |
| 28 | 28 | <?php endwhile; ?> |
| 29 | 29 | |