@@ -1,12 +1,12 @@ 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 | * Customize Swatch Control Class |
| 6 | 6 | * |
| 7 | 7 | * @since 1.0.0 |
| 8 | 8 | */ |
| 9 | -if( !class_exists( 'WP_Customize_Control' ) ){ |
|
| 9 | +if ( ! class_exists('WP_Customize_Control')) { |
|
| 10 | 10 | return; |
| 11 | 11 | } |
| 12 | 12 | class LSX_Customize_Layout_Control extends WP_Customize_Control { |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @param string $id |
| 39 | 39 | * @param array $args |
| 40 | 40 | */ |
| 41 | - public function __construct( $manager, $id, $args = array() ) { |
|
| 42 | - parent::__construct( $manager, $id, $args ); |
|
| 43 | - if( !empty( $args['choices'] ) ){ |
|
| 41 | + public function __construct($manager, $id, $args = array()) { |
|
| 42 | + parent::__construct($manager, $id, $args); |
|
| 43 | + if ( ! empty($args['choices'])) { |
|
| 44 | 44 | $this->layouts = $args['choices']; |
| 45 | 45 | } |
| 46 | 46 | } |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | */ |
| 53 | 53 | public function enqueue() { |
| 54 | 54 | // |
| 55 | - wp_enqueue_script( 'lsx-layout-control', get_template_directory_uri() .'/js/customizer-layout.js', array('jquery'), LSX_VERSION, true ); |
|
| 55 | + wp_enqueue_script('lsx-layout-control', get_template_directory_uri() . '/js/customizer-layout.js', array('jquery'), LSX_VERSION, true); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
@@ -62,30 +62,30 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function render_content() { |
| 64 | 64 | |
| 65 | - $post_id = 'customize-control-' . str_replace( '[', '-', str_replace( ']', '', $this->id ) ); |
|
| 65 | + $post_id = 'customize-control-' . str_replace('[', '-', str_replace(']', '', $this->id)); |
|
| 66 | 66 | $class = 'customize-control customize-control-' . $this->type; |
| 67 | 67 | $value = $this->value(); |
| 68 | 68 | |
| 69 | 69 | ?> |
| 70 | 70 | <label> |
| 71 | - <?php if ( ! empty( $this->label ) ) { ?> |
|
| 72 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
| 71 | + <?php if ( ! empty($this->label)) { ?> |
|
| 72 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
| 73 | 73 | <?php } |
| 74 | - if ( ! empty( $this->description ) ) { ?> |
|
| 75 | - <span class="description customize-control-description"><?php echo esc_html( $this->description ); ?></span> |
|
| 74 | + if ( ! empty($this->description)) { ?> |
|
| 75 | + <span class="description customize-control-description"><?php echo esc_html($this->description); ?></span> |
|
| 76 | 76 | <?php } ?> |
| 77 | 77 | <div class="layouts-selector"> |
| 78 | 78 | <?php |
| 79 | - foreach( $this->layouts as $layout ){ |
|
| 79 | + foreach ($this->layouts as $layout) { |
|
| 80 | 80 | $sel = 'border: 1px solid transparent;'; |
| 81 | - if( $value == $layout ){ |
|
| 81 | + if ($value == $layout) { |
|
| 82 | 82 | $sel = 'border: 1px solid rgb(43, 166, 203);'; |
| 83 | 83 | } |
| 84 | - echo '<img class="layout-button" style="padding:2px;'. esc_attr( $sel ) .'" src="' . esc_attr( get_template_directory_uri() ) .'/img/' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
| 84 | + echo '<img class="layout-button" style="padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/img/' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | ?> |
| 88 | - <input <?php $this->link(); ?> class="selected-layout <?php echo esc_attr( $class ); ?>" id="<?php echo esc_attr( $post_id ); ?>" type="hidden" value="<?php echo esc_attr( $value ); ?>" <?php $this->input_attrs(); ?>> |
|
| 88 | + <input <?php $this->link(); ?> class="selected-layout <?php echo esc_attr($class); ?>" id="<?php echo esc_attr($post_id); ?>" type="hidden" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> |
|
| 89 | 89 | </div> |
| 90 | 90 | </label> |
| 91 | 91 | <?php |
@@ -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 | * Enqueue scripts and styles. |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | wp_enqueue_style('lsx_main', get_template_directory_uri() . '/css/app.css', array(), LSX_VERSION); |
| 16 | 16 | |
| 17 | - if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { |
|
| 18 | - wp_enqueue_script( 'comment-reply' ); |
|
| 17 | + if (is_singular() && comments_open() && get_option('thread_comments')) { |
|
| 18 | + wp_enqueue_script('comment-reply'); |
|
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | wp_enqueue_script('bootstrap', get_template_directory_uri() . '/js/vendor/bootstrap.min.js', array('jquery'), LSX_VERSION, false); |
@@ -26,38 +26,38 @@ discard block |
||
| 26 | 26 | wp_enqueue_script('picturefill', get_template_directory_uri() . '/js/vendor/picturefill.min.js', array(), LSX_VERSION, false); |
| 27 | 27 | |
| 28 | 28 | wp_enqueue_script('masonry'); |
| 29 | - wp_enqueue_script('imagesLoaded', get_template_directory_uri().'/js/vendor/imagesloaded.pkgd.min.js', array('jquery','masonry'), LSX_VERSION); |
|
| 30 | - if(defined('WP_DEBUG') && true === WP_DEBUG){ |
|
| 29 | + wp_enqueue_script('imagesLoaded', get_template_directory_uri() . '/js/vendor/imagesloaded.pkgd.min.js', array('jquery', 'masonry'), LSX_VERSION); |
|
| 30 | + if (defined('WP_DEBUG') && true === WP_DEBUG) { |
|
| 31 | 31 | wp_enqueue_script('lsx_script', get_template_directory_uri() . '/js/lsx-script.js', array('masonry'), LSX_VERSION, false); |
| 32 | - }else{ |
|
| 32 | + } else { |
|
| 33 | 33 | wp_enqueue_script('lsx_script', get_template_directory_uri() . '/js/lsx-script.min.js', array('masonry'), LSX_VERSION, false); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | //Set some parameters that we can use in the JS |
| 37 | 37 | $is_portfolio = false; |
| 38 | - if(is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag') || is_page_template('page-templates/template-portfolio.php')){ |
|
| 38 | + if (is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag') || is_page_template('page-templates/template-portfolio.php')) { |
|
| 39 | 39 | $is_portfolio = true; |
| 40 | 40 | } |
| 41 | 41 | $param_array = array( |
| 42 | 42 | 'is_portfolio' => $is_portfolio |
| 43 | 43 | ); |
| 44 | 44 | //Set the columns for the archives |
| 45 | - $param_array['columns'] = apply_filters('lsx_archive_column_number',3); |
|
| 46 | - wp_localize_script( 'lsx_script', 'lsx_params', $param_array ); |
|
| 45 | + $param_array['columns'] = apply_filters('lsx_archive_column_number', 3); |
|
| 46 | + wp_localize_script('lsx_script', 'lsx_params', $param_array); |
|
| 47 | 47 | |
| 48 | 48 | |
| 49 | - wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), LSX_VERSION ); |
|
| 49 | + wp_enqueue_style('fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), LSX_VERSION); |
|
| 50 | 50 | |
| 51 | 51 | |
| 52 | - if(is_child_theme() && file_exists(get_stylesheet_directory() . '/custom.css')) { |
|
| 53 | - wp_enqueue_style( 'child-css', get_stylesheet_directory_uri() . '/custom.css', array(), LSX_VERSION ); |
|
| 52 | + if (is_child_theme() && file_exists(get_stylesheet_directory() . '/custom.css')) { |
|
| 53 | + wp_enqueue_style('child-css', get_stylesheet_directory_uri() . '/custom.css', array(), LSX_VERSION); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | wp_enqueue_style('medium-break', get_template_directory_uri() . '/css/medium-nav-break.css', array(), LSX_VERSION); |
| 57 | 57 | |
| 58 | 58 | |
| 59 | - $font = get_theme_mod('lsx_font','raleway_open_sans'); |
|
| 60 | - switch($font){ |
|
| 59 | + $font = get_theme_mod('lsx_font', 'raleway_open_sans'); |
|
| 60 | + switch ($font) { |
|
| 61 | 61 | case 'raleway_open_sans': |
| 62 | 62 | $header_font_location = 'Raleway'; |
| 63 | 63 | $body_font_location = 'Open+Sans'; |
@@ -86,18 +86,18 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $http_var = 'http'; |
| 89 | - if(is_ssl()){ $http_var .= 's'; } |
|
| 89 | + if (is_ssl()) { $http_var .= 's'; } |
|
| 90 | 90 | |
| 91 | 91 | //Call the Google Fonts and then Enque them. |
| 92 | - wp_register_style('lsx-header-font', $http_var.'://fonts.googleapis.com/css?family='.$header_font_location); |
|
| 93 | - wp_register_style('lsx-body-font', $http_var.'://fonts.googleapis.com/css?family='.$body_font_location); |
|
| 94 | - wp_enqueue_style( 'lsx-header-font' ); |
|
| 95 | - wp_enqueue_style( 'lsx-body-font' ); |
|
| 92 | + wp_register_style('lsx-header-font', $http_var . '://fonts.googleapis.com/css?family=' . $header_font_location); |
|
| 93 | + wp_register_style('lsx-body-font', $http_var . '://fonts.googleapis.com/css?family=' . $body_font_location); |
|
| 94 | + wp_enqueue_style('lsx-header-font'); |
|
| 95 | + wp_enqueue_style('lsx-body-font'); |
|
| 96 | 96 | |
| 97 | - wp_enqueue_style('lsx_font_scheme', esc_url( get_template_directory_uri() . '/css/'.$font.'.css' ), array(), LSX_VERSION); |
|
| 97 | + wp_enqueue_style('lsx_font_scheme', esc_url(get_template_directory_uri() . '/css/' . $font . '.css'), array(), LSX_VERSION); |
|
| 98 | 98 | |
| 99 | 99 | } |
| 100 | -add_action( 'wp_enqueue_scripts', 'lsx_scripts' ); |
|
| 100 | +add_action('wp_enqueue_scripts', 'lsx_scripts'); |
|
| 101 | 101 | |
| 102 | 102 | /** |
| 103 | 103 | * Defer JavaScript |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | * @package lsx |
| 106 | 106 | * @subpackage scripts |
| 107 | 107 | */ |
| 108 | -function lsx_scripts_defer_parsing( $url ) { |
|
| 109 | - if ( ! ( is_admin() ) ) { |
|
| 110 | - if ( FALSE === strpos( $url, '.js' ) ) return $url; |
|
| 111 | - if ( strpos( $url, 'jquery.js' ) ) return $url; |
|
| 112 | - if ( strpos( $url, ' defer ' ) ) return $url; |
|
| 108 | +function lsx_scripts_defer_parsing($url) { |
|
| 109 | + if ( ! (is_admin())) { |
|
| 110 | + if (FALSE === strpos($url, '.js')) return $url; |
|
| 111 | + if (strpos($url, 'jquery.js')) return $url; |
|
| 112 | + if (strpos($url, ' defer ')) return $url; |
|
| 113 | 113 | return "$url' defer onload='"; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | return $url; |
| 117 | 117 | } |
| 118 | -add_filter( 'clean_url', 'lsx_scripts_defer_parsing', 11, 1 ); |
|
| 118 | +add_filter('clean_url', 'lsx_scripts_defer_parsing', 11, 1); |
|
@@ -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,143 +25,143 @@ 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 ); |
|
| 43 | - add_filter( 'wp_kses_allowed_html', array( __CLASS__, 'kses_allowed_html' ), 10, 2 ); |
|
| 44 | - add_filter( 'kses_allowed_protocols', array( __CLASS__, 'kses_allowed_protocols' ) ); |
|
| 41 | + add_action('wp_enqueue_scripts', array(__CLASS__, 'add_scripts')); |
|
| 42 | + add_action('wp_head', array(__CLASS__, 'setup_filters'), 9999); |
|
| 43 | + add_filter('wp_kses_allowed_html', array(__CLASS__, 'kses_allowed_html'), 10, 2); |
|
| 44 | + add_filter('kses_allowed_protocols', array(__CLASS__, 'kses_allowed_protocols')); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | static function setup_filters() { |
| 48 | 48 | // WordPress |
| 49 | - add_filter( 'the_content', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 50 | - add_filter( 'widget_text', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 51 | - add_filter( 'post_thumbnail_html', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 52 | - add_filter( 'get_avatar', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 49 | + add_filter('the_content', array(__CLASS__, 'filter_images'), 200); |
|
| 50 | + add_filter('widget_text', array(__CLASS__, 'filter_images'), 200); |
|
| 51 | + add_filter('post_thumbnail_html', array(__CLASS__, 'filter_images'), 200); |
|
| 52 | + add_filter('get_avatar', array(__CLASS__, 'filter_images'), 200); |
|
| 53 | 53 | |
| 54 | 54 | // LSX |
| 55 | - add_filter( 'lsx_lazyload_filter_images', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 55 | + add_filter('lsx_lazyload_filter_images', array(__CLASS__, 'filter_images'), 200); |
|
| 56 | 56 | |
| 57 | 57 | // Envira Gallery |
| 58 | - add_filter( 'envira_gallery_output_image', array( __CLASS__, 'filter_images' ), 200 ); |
|
| 58 | + add_filter('envira_gallery_output_image', array(__CLASS__, 'filter_images'), 200); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | static function add_scripts() { |
| 62 | - wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/lazysizes.min.js', array( 'jquery' ), LSX_VERSION, true ); |
|
| 62 | + wp_enqueue_script('lazysizes', get_template_directory_uri() . '/js/vendor/lazysizes.min.js', array('jquery'), LSX_VERSION, true); |
|
| 63 | 63 | // Plugin that enables use lazysizes in brackground images |
| 64 | 64 | //wp_enqueue_script( 'lazysizes', get_template_directory_uri() .'/js/vendor/ls.unveilhooks.min.js', array( 'jquery', 'lazysizes' ), LSX_VERSION, true ); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - static function filter_images( $content ) { |
|
| 68 | - if ( ! self::is_enabled() ) { |
|
| 67 | + static function filter_images($content) { |
|
| 68 | + if ( ! self::is_enabled()) { |
|
| 69 | 69 | return $content; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); |
|
| 73 | - $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
|
| 72 | + $http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])); |
|
| 73 | + $http_user_agent = ! empty($http_user_agent) ? $http_user_agent : ''; |
|
| 74 | 74 | |
| 75 | - if ( is_feed() |
|
| 75 | + if (is_feed() |
|
| 76 | 76 | || is_preview() |
| 77 | - || intval( get_query_var( 'print' ) ) == 1 |
|
| 78 | - || intval( get_query_var( 'printpage' ) ) == 1 |
|
| 79 | - || strpos( $http_user_agent, 'Opera Mini' ) !== false |
|
| 77 | + || intval(get_query_var('print')) == 1 |
|
| 78 | + || intval(get_query_var('printpage')) == 1 |
|
| 79 | + || strpos($http_user_agent, 'Opera Mini') !== false |
|
| 80 | 80 | ) { |
| 81 | 81 | return $content; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $skip_images_regex = '/class=".*(lazyload|disable-lazyload).*"/'; |
| 85 | - $placeholder_image = apply_filters( 'lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ); |
|
| 85 | + $placeholder_image = apply_filters('lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); |
|
| 86 | 86 | |
| 87 | 87 | $matches = array(); |
| 88 | 88 | $search = array(); |
| 89 | 89 | $replace = array(); |
| 90 | 90 | |
| 91 | - $content = preg_replace_callback( '~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content ); |
|
| 92 | - preg_match_all( '/<img[^>]*>/', $content, $matches ); |
|
| 91 | + $content = preg_replace_callback('~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content); |
|
| 92 | + preg_match_all('/<img[^>]*>/', $content, $matches); |
|
| 93 | 93 | |
| 94 | - foreach ( $matches[0] as $img_html ) { |
|
| 95 | - if ( ! ( preg_match( $skip_images_regex, $img_html ) ) ) { |
|
| 94 | + foreach ($matches[0] as $img_html) { |
|
| 95 | + if ( ! (preg_match($skip_images_regex, $img_html))) { |
|
| 96 | 96 | $add_class = false; |
| 97 | 97 | |
| 98 | - if ( ! preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) && preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 99 | - $replace_html = preg_replace( '/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html ); |
|
| 98 | + if ( ! preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html) && preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 99 | + $replace_html = preg_replace('/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html); |
|
| 100 | 100 | |
| 101 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 102 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
| 101 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 102 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
| 103 | 103 | } else { |
| 104 | - $replace_html = preg_replace( '/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
| 104 | + $replace_html = preg_replace('/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | $add_class = true; |
| 108 | - } elseif ( preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 109 | - $replace_html = preg_replace( '/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html ); |
|
| 108 | + } elseif (preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 109 | + $replace_html = preg_replace('/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html); |
|
| 110 | 110 | |
| 111 | - if ( preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 112 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
| 113 | - $replace_html = preg_replace( '/srcset=/i', 'data-srcset=', $replace_html ); |
|
| 114 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
| 111 | + if (preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 112 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
| 113 | + $replace_html = preg_replace('/srcset=/i', 'data-srcset=', $replace_html); |
|
| 114 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
| 115 | 115 | } else { |
| 116 | - $replace_html = preg_replace( '/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
| 116 | + $replace_html = preg_replace('/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $add_class = true; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if ( $add_class ) { |
|
| 124 | - $replace_html = self::add_class( $replace_html, 'lazyload' ); |
|
| 123 | + if ($add_class) { |
|
| 124 | + $replace_html = self::add_class($replace_html, 'lazyload'); |
|
| 125 | 125 | $replace_html .= '<noscript>' . $img_html . '</noscript>'; |
| 126 | 126 | |
| 127 | - array_push( $search, $img_html ); |
|
| 128 | - array_push( $replace, $replace_html ); |
|
| 127 | + array_push($search, $img_html); |
|
| 128 | + array_push($replace, $replace_html); |
|
| 129 | 129 | } |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - $content = str_replace( $search, $replace, $content ); |
|
| 134 | - $content = preg_replace_callback( '~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content ); |
|
| 133 | + $content = str_replace($search, $replace, $content); |
|
| 134 | + $content = preg_replace_callback('~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content); |
|
| 135 | 135 | return $content; |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - static function noscripts_remove( $match ) { |
|
| 138 | + static function noscripts_remove($match) { |
|
| 139 | 139 | self::$noscript_id++; |
| 140 | 140 | self::$noscripts[self::$noscript_id] = $match[0]; |
| 141 | 141 | return chr(20) . self::$noscript_id . chr(20); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - static function noscripts_restore( $match ) { |
|
| 144 | + static function noscripts_restore($match) { |
|
| 145 | 145 | return self::$noscripts[(int) $match[1]]; |
| 146 | 146 | } |
| 147 | 147 | |
| 148 | - static function add_class( $html_string = '', $new_class ) { |
|
| 148 | + static function add_class($html_string = '', $new_class) { |
|
| 149 | 149 | $pattern = '/class=[\'"]([^\'"]*)[\'"]/'; |
| 150 | 150 | |
| 151 | - if ( preg_match( $pattern, $html_string, $matches ) ) { |
|
| 152 | - $defined_classes = explode( ' ', $matches[1] ); |
|
| 151 | + if (preg_match($pattern, $html_string, $matches)) { |
|
| 152 | + $defined_classes = explode(' ', $matches[1]); |
|
| 153 | 153 | |
| 154 | - if ( ! in_array( $new_class, $defined_classes ) ) { |
|
| 154 | + if ( ! in_array($new_class, $defined_classes)) { |
|
| 155 | 155 | $defined_classes[] = $new_class; |
| 156 | 156 | |
| 157 | 157 | $html_string = str_replace( |
| 158 | 158 | $matches[0], |
| 159 | - sprintf( 'class="%s"', implode( ' ', $defined_classes ) ), |
|
| 159 | + sprintf('class="%s"', implode(' ', $defined_classes)), |
|
| 160 | 160 | $html_string |
| 161 | 161 | ); |
| 162 | 162 | } |
| 163 | 163 | } else { |
| 164 | - $html_string = preg_replace( '/(\<.+\s)/', sprintf( '$1class="%s" ', $new_class ), $html_string ); |
|
| 164 | + $html_string = preg_replace('/(\<.+\s)/', sprintf('$1class="%s" ', $new_class), $html_string); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return $html_string; |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | return self::$enabled; |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | - static function kses_allowed_html( $allowedtags, $context ) { |
|
| 174 | + static function kses_allowed_html($allowedtags, $context) { |
|
| 175 | 175 | $allowedtags['noscript'] = array(); |
| 176 | 176 | |
| 177 | 177 | $allowedtags['img']['data-src'] = true; |
@@ -181,10 +181,10 @@ discard block |
||
| 181 | 181 | return $allowedtags; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - static function kses_allowed_protocols( $allowedprotocols ) { |
|
| 184 | + static function kses_allowed_protocols($allowedprotocols) { |
|
| 185 | 185 | $allowedprotocols[] = 'data'; |
| 186 | 186 | return $allowedprotocols; |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | -add_action( 'init', array( 'LSX_LazyLoadImages', 'init' ) ); |
|
| 190 | +add_action('init', array('LSX_LazyLoadImages', 'init')); |
|
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | <h3> |
| 28 | 28 | <?php |
| 29 | 29 | $count = get_comments_number(); |
| 30 | - printf( esc_html( _n( 'One Response to “%2$s”', '%1$s Responses to “%2$s”', $count, 'lsx' ) ), esc_html( number_format_i18n( $count ) ), get_the_title() ); |
|
| 30 | + printf(esc_html(_n('One Response to “%2$s”', '%1$s Responses to “%2$s”', $count, 'lsx')), esc_html(number_format_i18n($count)), get_the_title()); |
|
| 31 | 31 | ?> |
| 32 | 32 | </h3> |
| 33 | 33 | |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | </nav> |
| 49 | 49 | <?php endif; ?> |
| 50 | 50 | |
| 51 | -<?php if (!comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 51 | +<?php if ( ! comments_open() && ! is_page() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 52 | 52 | <div class="alert alert-warning"> |
| 53 | 53 | <?php esc_html_e('Comments are closed.', 'lsx'); ?> |
| 54 | 54 | </div> |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | <?php endif; ?> |
| 61 | 61 | |
| 62 | -<?php if (!have_comments() && !comments_open() && !is_page() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 62 | +<?php if ( ! have_comments() && ! comments_open() && ! is_page() && post_type_supports(get_post_type(), 'comments')) : ?> |
|
| 63 | 63 | <section id="comments"> |
| 64 | 64 | <div class="alert alert-warning"> |
| 65 | 65 | <?php esc_html_e('Comments are closed.', 'lsx'); ?> |
@@ -72,24 +72,24 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | <?php |
| 74 | 74 | $commenter = wp_get_current_commenter(); |
| 75 | - $req = get_option( 'require_name_email' ); |
|
| 76 | - $aria_req = ( $req ? " aria-required='true'" : '' ); |
|
| 77 | - $html_req = ( $req ? " required='required'" : '' ); |
|
| 75 | + $req = get_option('require_name_email'); |
|
| 76 | + $aria_req = ($req ? " aria-required='true'" : ''); |
|
| 77 | + $html_req = ($req ? " required='required'" : ''); |
|
| 78 | 78 | |
| 79 | 79 | $comment_form_args = array( |
| 80 | - 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="'. esc_html__( 'Comment', 'lsx' ) .'" id="comment" class="form-control" name="comment" cols="45" rows="8"'. $aria_req . $html_req .'></textarea></p>', |
|
| 80 | + 'comment_field' => '<p class="comment-form-comment"><textarea placeholder="' . esc_html__('Comment', 'lsx') . '" id="comment" class="form-control" name="comment" cols="45" rows="8"' . $aria_req . $html_req . '></textarea></p>', |
|
| 81 | 81 | |
| 82 | 82 | 'fields' => array( |
| 83 | - 'author' => '<p class="comment-form-author"><label for="author">'. esc_html__( 'Name', 'lsx' ) .'</label> ' . |
|
| 84 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 85 | - '<input class="form-control" placeholder="'. esc_html__( 'Name', 'lsx' ) .'" id="author" name="author" type="text" value="'. esc_attr( $commenter['comment_author'] ) .'" size="30"'. $aria_req . $html_req .'></p>', |
|
| 83 | + 'author' => '<p class="comment-form-author"><label for="author">' . esc_html__('Name', 'lsx') . '</label> ' . |
|
| 84 | + ($req ? '<span class="required">*</span>' : '') . |
|
| 85 | + '<input class="form-control" placeholder="' . esc_html__('Name', 'lsx') . '" id="author" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 86 | 86 | |
| 87 | - 'email' => '<p class="comment-form-email"><label for="email">'. esc_html__( 'Email', 'lsx' ) .'</label> ' . |
|
| 88 | - ( $req ? '<span class="required">*</span>' : '' ) . |
|
| 89 | - '<input class="form-control" placeholder="'. esc_html__( 'Email', 'lsx' ) .'" id="email" name="email" type="text" value="'. esc_attr( $commenter['comment_author_email'] ) .'" size="30"' . $aria_req . $html_req . '></p>', |
|
| 87 | + 'email' => '<p class="comment-form-email"><label for="email">' . esc_html__('Email', 'lsx') . '</label> ' . |
|
| 88 | + ($req ? '<span class="required">*</span>' : '') . |
|
| 89 | + '<input class="form-control" placeholder="' . esc_html__('Email', 'lsx') . '" id="email" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . $html_req . '></p>', |
|
| 90 | 90 | |
| 91 | - 'url' => '<p class="comment-form-url"><label for="url">'. esc_html__( 'Website', 'lsx' ) .'</label>' . |
|
| 92 | - '<input class="form-control" placeholder="'. esc_html__( 'Website', 'lsx' ) .'" id="url" name="url" type="text" value="'. esc_attr( $commenter['comment_author_url'] ) .'" size="30"></p>' |
|
| 91 | + 'url' => '<p class="comment-form-url"><label for="url">' . esc_html__('Website', 'lsx') . '</label>' . |
|
| 92 | + '<input class="form-control" placeholder="' . esc_html__('Website', 'lsx') . '" id="url" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30"></p>' |
|
| 93 | 93 | ) |
| 94 | 94 | ); |
| 95 | 95 | ?> |
@@ -16,15 +16,15 @@ |
||
| 16 | 16 | <?php |
| 17 | 17 | the_content(); |
| 18 | 18 | |
| 19 | - wp_link_pages( array( |
|
| 19 | + wp_link_pages(array( |
|
| 20 | 20 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 21 | 21 | 'after' => '</div></div>', |
| 22 | 22 | 'link_before' => '<span>', |
| 23 | 23 | 'link_after' => '</span>' |
| 24 | - ) ); |
|
| 24 | + )); |
|
| 25 | 25 | ?> |
| 26 | 26 | </div><!-- .entry-content --> |
| 27 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?> |
|
| 27 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>'); ?> |
|
| 28 | 28 | |
| 29 | 29 | <?php lsx_entry_bottom(); ?> |
| 30 | 30 | |
@@ -18,17 +18,17 @@ discard block |
||
| 18 | 18 | <div class="col-sm-12"> |
| 19 | 19 | <div class="entry-content"> |
| 20 | 20 | |
| 21 | - <?php if ( ! is_singular() ) { |
|
| 21 | + <?php if ( ! is_singular()) { |
|
| 22 | 22 | the_excerpt(); |
| 23 | 23 | } else { |
| 24 | 24 | the_content(); |
| 25 | 25 | |
| 26 | - wp_link_pages( array( |
|
| 26 | + wp_link_pages(array( |
|
| 27 | 27 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 28 | 28 | 'after' => '</div></div>', |
| 29 | 29 | 'link_before' => '<span>', |
| 30 | 30 | 'link_after' => '</span>' |
| 31 | - ) ); |
|
| 31 | + )); |
|
| 32 | 32 | } ?> |
| 33 | 33 | |
| 34 | 34 | <?php lsx_portfolio_gallery(); ?> |
@@ -36,13 +36,13 @@ discard block |
||
| 36 | 36 | <?php lsx_post_nav(); ?> |
| 37 | 37 | |
| 38 | 38 | <?php |
| 39 | - if ( function_exists( 'sharing_display' ) ) { |
|
| 40 | - sharing_display( '', true ); |
|
| 39 | + if (function_exists('sharing_display')) { |
|
| 40 | + sharing_display('', true); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
| 43 | + if (class_exists('Jetpack_Likes')) { |
|
| 44 | 44 | $custom_likes = new Jetpack_Likes; |
| 45 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
| 45 | + echo wp_kses_post($custom_likes->post_likes('')); |
|
| 46 | 46 | } |
| 47 | 47 | ?> |
| 48 | 48 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | </div> |
| 54 | 54 | </div> |
| 55 | 55 | |
| 56 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?> |
|
| 56 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>'); ?> |
|
| 57 | 57 | |
| 58 | 58 | <?php lsx_entry_bottom(); ?> |
| 59 | 59 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | <?php lsx_content_wrap_before(); ?> |
| 12 | 12 | |
| 13 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 13 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 14 | 14 | |
| 15 | 15 | <?php lsx_content_before(); ?> |
| 16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | <?php lsx_content_top(); ?> |
| 20 | 20 | |
| 21 | - <?php while ( have_posts() ) : the_post(); ?> |
|
| 21 | + <?php while (have_posts()) : the_post(); ?> |
|
| 22 | 22 | |
| 23 | 23 | <?php lsx_entry_before(); ?> |
| 24 | 24 | |
@@ -32,25 +32,25 @@ discard block |
||
| 32 | 32 | <div class="entry-meta"> |
| 33 | 33 | <?php |
| 34 | 34 | $metadata = wp_get_attachment_metadata(); |
| 35 | - printf( wp_kses_post( '%1$s <span class="entry-date"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></span> %4$s <a href="%5$s">%6$s × %7$s</a> %8$s <a href="%9$s" title="%10$s" rel="gallery">%10$s</a>' ), |
|
| 36 | - esc_html__( 'Published', 'lsx' ), |
|
| 37 | - esc_attr( get_the_date( 'c' ) ), |
|
| 38 | - esc_html( get_the_date() ), |
|
| 39 | - esc_html__( 'at', 'lsx' ), |
|
| 40 | - esc_url( wp_get_attachment_url() ), |
|
| 41 | - esc_attr( $metadata['width'] ), |
|
| 42 | - esc_attr( $metadata['height'] ), |
|
| 43 | - esc_html__( 'in', 'lsx' ), |
|
| 44 | - esc_url( get_permalink( $post->post_parent ) ), |
|
| 45 | - get_the_title( $post->post_parent ) |
|
| 35 | + printf(wp_kses_post('%1$s <span class="entry-date"><time class="entry-date" datetime="%2$s" pubdate>%3$s</time></span> %4$s <a href="%5$s">%6$s × %7$s</a> %8$s <a href="%9$s" title="%10$s" rel="gallery">%10$s</a>'), |
|
| 36 | + esc_html__('Published', 'lsx'), |
|
| 37 | + esc_attr(get_the_date('c')), |
|
| 38 | + esc_html(get_the_date()), |
|
| 39 | + esc_html__('at', 'lsx'), |
|
| 40 | + esc_url(wp_get_attachment_url()), |
|
| 41 | + esc_attr($metadata['width']), |
|
| 42 | + esc_attr($metadata['height']), |
|
| 43 | + esc_html__('in', 'lsx'), |
|
| 44 | + esc_url(get_permalink($post->post_parent)), |
|
| 45 | + get_the_title($post->post_parent) |
|
| 46 | 46 | ); |
| 47 | 47 | ?> |
| 48 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<span class="sep"> | </span> <span class="edit-link">', '</span>' ); ?> |
|
| 48 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<span class="sep"> | </span> <span class="edit-link">', '</span>'); ?> |
|
| 49 | 49 | </div><!-- .entry-meta --> |
| 50 | 50 | |
| 51 | 51 | <nav id="image-navigation" class="site-navigation"> |
| 52 | - <span class="previous-image"><?php previous_image_link( false, '← '.esc_html__( 'Previous', 'lsx' ) ); ?></span> |
|
| 53 | - <span class="next-image"><?php next_image_link( false, esc_html__( 'Next', 'lsx' ).' →' ); ?></span> |
|
| 52 | + <span class="previous-image"><?php previous_image_link(false, '← ' . esc_html__('Previous', 'lsx')); ?></span> |
|
| 53 | + <span class="next-image"><?php next_image_link(false, esc_html__('Next', 'lsx') . ' →'); ?></span> |
|
| 54 | 54 | </nav><!-- #image-navigation --> |
| 55 | 55 | </header><!-- .entry-header --> |
| 56 | 56 | |
@@ -63,33 +63,33 @@ discard block |
||
| 63 | 63 | * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery, |
| 64 | 64 | * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file |
| 65 | 65 | */ |
| 66 | - $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); |
|
| 67 | - foreach ( $attachments as $k => $attachment ) { |
|
| 68 | - if ( $attachment->ID == $post->ID ) |
|
| 66 | + $attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID'))); |
|
| 67 | + foreach ($attachments as $k => $attachment) { |
|
| 68 | + if ($attachment->ID == $post->ID) |
|
| 69 | 69 | break; |
| 70 | 70 | } |
| 71 | 71 | $k++; |
| 72 | 72 | // If there is more than 1 attachment in a gallery |
| 73 | - if ( count( $attachments ) > 1 ) { |
|
| 74 | - if ( isset( $attachments[ $k ] ) ) |
|
| 73 | + if (count($attachments) > 1) { |
|
| 74 | + if (isset($attachments[$k])) |
|
| 75 | 75 | // get the URL of the next image attachment |
| 76 | - $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); |
|
| 76 | + $next_attachment_url = get_attachment_link($attachments[$k]->ID); |
|
| 77 | 77 | else |
| 78 | 78 | // or get the URL of the first image attachment |
| 79 | - $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); |
|
| 79 | + $next_attachment_url = get_attachment_link($attachments[0]->ID); |
|
| 80 | 80 | } else { |
| 81 | 81 | // or, if there's only 1 image, get the URL of the image |
| 82 | 82 | $next_attachment_url = wp_get_attachment_url(); |
| 83 | 83 | } |
| 84 | 84 | ?> |
| 85 | 85 | |
| 86 | - <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php |
|
| 87 | - $attachment_size = apply_filters( 'shape_attachment_size', array( 1200, 1200 ) ); // Filterable image size. |
|
| 88 | - echo wp_get_attachment_image( $post->ID, $attachment_size ); |
|
| 86 | + <a href="<?php echo esc_url($next_attachment_url); ?>" title="<?php echo esc_attr(get_the_title()); ?>" rel="attachment"><?php |
|
| 87 | + $attachment_size = apply_filters('shape_attachment_size', array(1200, 1200)); // Filterable image size. |
|
| 88 | + echo wp_get_attachment_image($post->ID, $attachment_size); |
|
| 89 | 89 | ?></a> |
| 90 | 90 | </div><!-- .attachment --> |
| 91 | 91 | |
| 92 | - <?php if ( ! empty( $post->post_excerpt ) ) : ?> |
|
| 92 | + <?php if ( ! empty($post->post_excerpt)) : ?> |
|
| 93 | 93 | <div class="entry-caption"> |
| 94 | 94 | <?php the_excerpt(); ?> |
| 95 | 95 | </div><!-- .entry-caption --> |
@@ -99,27 +99,27 @@ discard block |
||
| 99 | 99 | <?php |
| 100 | 100 | the_content(); |
| 101 | 101 | |
| 102 | - wp_link_pages( array( |
|
| 102 | + wp_link_pages(array( |
|
| 103 | 103 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 104 | 104 | 'after' => '</div></div>', |
| 105 | 105 | 'link_before' => '<span>', |
| 106 | 106 | 'link_after' => '</span>' |
| 107 | - ) ); |
|
| 107 | + )); |
|
| 108 | 108 | ?> |
| 109 | 109 | |
| 110 | 110 | </div><!-- .entry-content --> |
| 111 | 111 | |
| 112 | 112 | <footer class="entry-meta"> |
| 113 | 113 | |
| 114 | - <?php if ( ! is_single() ) : ?> |
|
| 115 | - <a class="read-more" href="<?php the_permalink(); ?>"><?php esc_html_e( 'Read More', 'lsx' ); ?></a> |
|
| 114 | + <?php if ( ! is_single()) : ?> |
|
| 115 | + <a class="read-more" href="<?php the_permalink(); ?>"><?php esc_html_e('Read More', 'lsx'); ?></a> |
|
| 116 | 116 | <?php endif ?> |
| 117 | 117 | |
| 118 | - <?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?> |
|
| 119 | - <span class="comments-link"><?php comments_popup_link( esc_html__( 'Leave a comment', 'lsx' ), esc_html__( '1 Comment', 'lsx' ), esc_html__( '% Comments', 'lsx' ) ); ?></span> |
|
| 118 | + <?php if ( ! post_password_required() && (comments_open() || '0' != get_comments_number())) : ?> |
|
| 119 | + <span class="comments-link"><?php comments_popup_link(esc_html__('Leave a comment', 'lsx'), esc_html__('1 Comment', 'lsx'), esc_html__('% Comments', 'lsx')); ?></span> |
|
| 120 | 120 | <?php endif; ?> |
| 121 | 121 | |
| 122 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<span class="edit-link">', '</span>' ); ?> |
|
| 122 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<span class="edit-link">', '</span>'); ?> |
|
| 123 | 123 | </footer><!-- .entry-meta --> |
| 124 | 124 | |
| 125 | 125 | <?php lsx_entry_bottom(); ?> |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | <?php |
| 130 | 130 | // If comments are open or we have at least one comment, load up the comment template |
| 131 | - if ( comments_open() || '0' != get_comments_number() ) : |
|
| 131 | + if (comments_open() || '0' != get_comments_number()) : |
|
| 132 | 132 | comments_template(); |
| 133 | 133 | endif; |
| 134 | 134 | ?> |
@@ -12,20 +12,20 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | <?php |
| 14 | 14 | $format = get_post_format(); |
| 15 | - if ( false === $format ) { |
|
| 15 | + if (false === $format) { |
|
| 16 | 16 | $format = 'standard'; |
| 17 | 17 | } |
| 18 | 18 | $format_link = get_post_format_link($format); |
| 19 | 19 | $format = lsx_translate_format_to_fontawesome($format); |
| 20 | 20 | ?> |
| 21 | 21 | |
| 22 | - <?php if ( ! is_single() ) { ?> |
|
| 22 | + <?php if ( ! is_single()) { ?> |
|
| 23 | 23 | <header class="entry-header"> |
| 24 | 24 | <h1 class="entry-title"> |
| 25 | - <?php if ( has_post_thumbnail() ) { ?> |
|
| 26 | - <a href="<?php echo esc_url($format_link) ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ) ?>"></a> |
|
| 25 | + <?php if (has_post_thumbnail()) { ?> |
|
| 26 | + <a href="<?php echo esc_url($format_link) ?>" class="format-link has-thumb fa fa-<?php echo esc_attr($format) ?>"></a> |
|
| 27 | 27 | <?php } else { ?> |
| 28 | - <a href="<?php echo esc_url($format_link) ?>" class="format-link fa fa-<?php echo esc_attr( $format ) ?>"></a> |
|
| 28 | + <a href="<?php echo esc_url($format_link) ?>" class="format-link fa fa-<?php echo esc_attr($format) ?>"></a> |
|
| 29 | 29 | <?php } ?> |
| 30 | 30 | |
| 31 | 31 | <span><?php the_title(); ?></span> |
@@ -39,33 +39,33 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | <div class="entry-content"> |
| 41 | 41 | <?php |
| 42 | - if ( ! is_singular() ) { |
|
| 42 | + if ( ! is_singular()) { |
|
| 43 | 43 | the_excerpt(); |
| 44 | 44 | } else { |
| 45 | 45 | the_content(); |
| 46 | 46 | |
| 47 | - wp_link_pages( array( |
|
| 47 | + wp_link_pages(array( |
|
| 48 | 48 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
| 49 | 49 | 'after' => '</div></div>', |
| 50 | 50 | 'link_before' => '<span>', |
| 51 | 51 | 'link_after' => '</span>' |
| 52 | - ) ); |
|
| 52 | + )); |
|
| 53 | 53 | } ?> |
| 54 | 54 | </div><!-- .entry-content --> |
| 55 | 55 | |
| 56 | 56 | <footer class="footer-meta"> |
| 57 | - <?php if ( has_tag() || ( function_exists( 'sharing_display' ) || class_exists( 'Jetpack_Likes' ) ) ) : ?> |
|
| 57 | + <?php if (has_tag() || (function_exists('sharing_display') || class_exists('Jetpack_Likes'))) : ?> |
|
| 58 | 58 | <div class="post-tags-wrapper"> |
| 59 | 59 | <?php lsx_content_post_tags(); ?> |
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | - if ( function_exists( 'sharing_display' ) ) { |
|
| 63 | - sharing_display( '', true ); |
|
| 62 | + if (function_exists('sharing_display')) { |
|
| 63 | + sharing_display('', true); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
| 66 | + if (class_exists('Jetpack_Likes')) { |
|
| 67 | 67 | $custom_likes = new Jetpack_Likes; |
| 68 | - echo wp_kses_post( $custom_likes->post_likes( '' ) ); |
|
| 68 | + echo wp_kses_post($custom_likes->post_likes('')); |
|
| 69 | 69 | } |
| 70 | 70 | ?> |
| 71 | 71 | </div> |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | |
| 74 | 74 | <?php |
| 75 | 75 | // If comments are open or we have at least one comment, load up the comment template |
| 76 | - if ( comments_open() || '0' != get_comments_number() ) : ?> |
|
| 77 | - <a class="comments-link post-meta-link" data-toggle="collapse" href="#comments-collapse"><strong><?php echo esc_html( get_comments_number() ) ?></strong> <?php esc_html_e('Comments','lsx'); ?> <span class="fa fa-chevron-down"></span></a> |
|
| 76 | + if (comments_open() || '0' != get_comments_number()) : ?> |
|
| 77 | + <a class="comments-link post-meta-link" data-toggle="collapse" href="#comments-collapse"><strong><?php echo esc_html(get_comments_number()) ?></strong> <?php esc_html_e('Comments', 'lsx'); ?> <span class="fa fa-chevron-down"></span></a> |
|
| 78 | 78 | |
| 79 | 79 | <div class="collapse" id="comments-collapse"> |
| 80 | 80 | <?php |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | <?php endif; ?> |
| 85 | 85 | </footer><!-- .footer-meta --> |
| 86 | 86 | |
| 87 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?> |
|
| 87 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>'); ?> |
|
| 88 | 88 | |
| 89 | 89 | <?php lsx_entry_bottom(); ?> |
| 90 | 90 | |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | * @package lsx |
| 6 | 6 | */ |
| 7 | -if ( ! defined( 'ABSPATH' ) ) return; // Exit if accessed directly |
|
| 7 | +if ( ! defined('ABSPATH')) return; // Exit if accessed directly |
|
| 8 | 8 | |
| 9 | 9 | define('LSX_VERSION', '1.8.0'); |
| 10 | 10 | |
@@ -19,22 +19,22 @@ discard block |
||
| 19 | 19 | require get_template_directory() . '/inc/comment-walker.php'; |
| 20 | 20 | require get_template_directory() . '/inc/jetpack.php'; |
| 21 | 21 | require get_template_directory() . '/inc/lazyload.php'; |
| 22 | -if(class_exists('BuddyPress')){ |
|
| 22 | +if (class_exists('BuddyPress')) { |
|
| 23 | 23 | require get_template_directory() . '/inc/buddypress.php'; |
| 24 | 24 | } |
| 25 | -if(class_exists('WooCommerce')){ |
|
| 25 | +if (class_exists('WooCommerce')) { |
|
| 26 | 26 | require get_template_directory() . '/inc/woocommerce.php'; |
| 27 | 27 | } |
| 28 | -if(class_exists('WP_Job_Manager')){ |
|
| 28 | +if (class_exists('WP_Job_Manager')) { |
|
| 29 | 29 | require get_template_directory() . '/inc/wp-job-manager.php'; |
| 30 | 30 | } |
| 31 | -if(class_exists('Tribe__Events__Main')){ |
|
| 31 | +if (class_exists('Tribe__Events__Main')) { |
|
| 32 | 32 | require get_template_directory() . '/inc/the-events-calendar.php'; |
| 33 | 33 | } |
| 34 | 34 | require get_template_directory() . '/inc/template-tags.php'; |
| 35 | 35 | require get_template_directory() . '/inc/extras.php'; |
| 36 | 36 | require get_template_directory() . '/inc/wp-bootstrap-navwalker.php'; |
| 37 | -if(class_exists('Sensei_WC')){ |
|
| 37 | +if (class_exists('Sensei_WC')) { |
|
| 38 | 38 | require get_template_directory() . '/inc/sensei.php'; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | * @category customizer |
| 47 | 47 | * @return $lsx_controls array() |
| 48 | 48 | */ |
| 49 | -function lsx_customizer_core_controls( $lsx_controls ) { |
|
| 49 | +function lsx_customizer_core_controls($lsx_controls) { |
|
| 50 | 50 | $lsx_controls['sections']['lsx-core'] = array( |
| 51 | - 'title' => esc_html__( 'Core Settings', 'lsx' ), |
|
| 52 | - 'description' => esc_html__( 'Change the core settings.', 'lsx' ), |
|
| 51 | + 'title' => esc_html__('Core Settings', 'lsx'), |
|
| 52 | + 'description' => esc_html__('Change the core settings.', 'lsx'), |
|
| 53 | 53 | 'priority' => 21 |
| 54 | 54 | ); |
| 55 | 55 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | 62 | $lsx_controls['fields']['lsx_lazyload_status'] = array( |
| 63 | - 'label' => esc_html__( 'Lazy Loading Images', 'lsx' ), |
|
| 63 | + 'label' => esc_html__('Lazy Loading Images', 'lsx'), |
|
| 64 | 64 | 'section' => 'lsx-core', |
| 65 | 65 | 'type' => 'checkbox', |
| 66 | 66 | ); |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | ); |
| 73 | 73 | |
| 74 | 74 | $lsx_controls['fields']['lsx_preloader_content_status'] = array( |
| 75 | - 'label' => esc_html__( 'Preloader Content', 'lsx' ), |
|
| 75 | + 'label' => esc_html__('Preloader Content', 'lsx'), |
|
| 76 | 76 | 'section' => 'lsx-core', |
| 77 | 77 | 'type' => 'checkbox', |
| 78 | 78 | ); |
| 79 | 79 | |
| 80 | 80 | return $lsx_controls; |
| 81 | 81 | } |
| 82 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_core_controls' ); |
|
| 82 | +add_filter('lsx_customizer_controls', 'lsx_customizer_core_controls'); |
|
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | 85 | * Returns an array of the layout panel. |
@@ -90,56 +90,56 @@ discard block |
||
| 90 | 90 | * @return $lsx_controls array() |
| 91 | 91 | */ |
| 92 | 92 | function lsx_customizer_layout_controls($lsx_controls) { |
| 93 | - $lsx_controls['settings']['lsx_header_layout'] = array( |
|
| 93 | + $lsx_controls['settings']['lsx_header_layout'] = array( |
|
| 94 | 94 | 'default' => 'inline', //Default setting/value to save |
| 95 | 95 | 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? |
| 96 | 96 | 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? |
| 97 | 97 | ); |
| 98 | 98 | $lsx_controls['fields']['lsx_header_layout'] = array( |
| 99 | - 'label' => esc_html__('Header','lsx'), |
|
| 99 | + 'label' => esc_html__('Header', 'lsx'), |
|
| 100 | 100 | 'section' => 'lsx-layout', |
| 101 | 101 | 'control' => 'LSX_Customize_Header_Layout_Control', |
| 102 | - 'choices' => array('central','expanded','inline') |
|
| 102 | + 'choices' => array('central', 'expanded', 'inline') |
|
| 103 | 103 | ); |
| 104 | 104 | $lsx_controls['sections']['lsx-layout'] = array( |
| 105 | - 'title' => esc_html__( 'Layout', 'lsx' ), |
|
| 106 | - 'description' => esc_html__( 'Change the layout sitewide. If your homepage is set to use a page with a template, the following will not apply to it.', 'lsx' ), |
|
| 105 | + 'title' => esc_html__('Layout', 'lsx'), |
|
| 106 | + 'description' => esc_html__('Change the layout sitewide. If your homepage is set to use a page with a template, the following will not apply to it.', 'lsx'), |
|
| 107 | 107 | 'priority' => 22 |
| 108 | 108 | ); |
| 109 | - $lsx_controls['settings']['lsx_layout'] = array( |
|
| 109 | + $lsx_controls['settings']['lsx_layout'] = array( |
|
| 110 | 110 | 'default' => '2cr', //Default setting/value to save |
| 111 | 111 | 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? |
| 112 | 112 | 'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? |
| 113 | 113 | ); |
| 114 | - $lsx_controls['settings']['lsx_header_fixed'] = array( |
|
| 114 | + $lsx_controls['settings']['lsx_header_fixed'] = array( |
|
| 115 | 115 | 'default' => false, //Default setting/value to save |
| 116 | 116 | 'sanitize_callback' => 'lsx_sanitize_checkbox', |
| 117 | 117 | 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? |
| 118 | 118 | ); |
| 119 | 119 | $lsx_controls['fields']['lsx_header_fixed'] = array( |
| 120 | - 'label' => esc_html__('Fixed Header','lsx'), |
|
| 120 | + 'label' => esc_html__('Fixed Header', 'lsx'), |
|
| 121 | 121 | 'section' => 'lsx-layout', |
| 122 | 122 | 'type' => 'checkbox', |
| 123 | 123 | ); |
| 124 | - $lsx_controls['settings']['lsx_header_search'] = array( |
|
| 124 | + $lsx_controls['settings']['lsx_header_search'] = array( |
|
| 125 | 125 | 'default' => false, //Default setting/value to save |
| 126 | 126 | 'sanitize_callback' => 'lsx_sanitize_checkbox', |
| 127 | 127 | 'transport' => 'postMessage', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? |
| 128 | 128 | ); |
| 129 | 129 | $lsx_controls['fields']['lsx_header_search'] = array( |
| 130 | - 'label' => esc_html__('Search Box in Header','lsx'), |
|
| 130 | + 'label' => esc_html__('Search Box in Header', 'lsx'), |
|
| 131 | 131 | 'section' => 'lsx-layout', |
| 132 | 132 | 'type' => 'checkbox', |
| 133 | 133 | ); |
| 134 | 134 | $lsx_controls['fields']['lsx_layout'] = array( |
| 135 | - 'label' => esc_html__('Body','lsx'), |
|
| 135 | + 'label' => esc_html__('Body', 'lsx'), |
|
| 136 | 136 | 'section' => 'lsx-layout', |
| 137 | 137 | 'control' => 'LSX_Customize_Layout_Control', |
| 138 | - 'choices' => array('1c','2cr','2cl') |
|
| 138 | + 'choices' => array('1c', '2cr', '2cl') |
|
| 139 | 139 | ); |
| 140 | 140 | return $lsx_controls; |
| 141 | 141 | } |
| 142 | -add_filter('lsx_customizer_controls','lsx_customizer_layout_controls'); |
|
| 142 | +add_filter('lsx_customizer_controls', 'lsx_customizer_layout_controls'); |
|
| 143 | 143 | |
| 144 | 144 | /** |
| 145 | 145 | * Returns an array of the font controls. |
@@ -151,11 +151,11 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | function lsx_customizer_font_controls($lsx_controls) { |
| 153 | 153 | $lsx_controls['sections']['lsx-font'] = array( |
| 154 | - 'title' => esc_html__( 'Font', 'lsx' ), |
|
| 154 | + 'title' => esc_html__('Font', 'lsx'), |
|
| 155 | 155 | 'description' => 'Change the fonts sitewide.', |
| 156 | 156 | 'priority' => 41 |
| 157 | 157 | ); |
| 158 | - $lsx_controls['settings']['lsx_font'] = array( |
|
| 158 | + $lsx_controls['settings']['lsx_font'] = array( |
|
| 159 | 159 | 'default' => 'raleway_open_sans', //Default setting/value to save |
| 160 | 160 | 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? |
| 161 | 161 | 'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? |
@@ -169,13 +169,13 @@ discard block |
||
| 169 | 169 | 'choices' => array( |
| 170 | 170 | 'raleway_open_sans' => array( |
| 171 | 171 | 'header' => array( |
| 172 | - "title" => esc_html__( 'Raleway', 'lsx' ), |
|
| 172 | + "title" => esc_html__('Raleway', 'lsx'), |
|
| 173 | 173 | "location" => "Raleway", |
| 174 | 174 | "cssDeclaration" => "'Raleway', sans-serif", |
| 175 | 175 | "cssClass" => "raleway", |
| 176 | 176 | ), |
| 177 | 177 | 'body' => array( |
| 178 | - "title" => esc_html__( 'Open Sans', 'lsx' ), |
|
| 178 | + "title" => esc_html__('Open Sans', 'lsx'), |
|
| 179 | 179 | "location" => "Open+Sans", |
| 180 | 180 | "cssDeclaration" => "'Open Sans', sans-serif", |
| 181 | 181 | "cssClass" => "openSans" |
@@ -183,13 +183,13 @@ discard block |
||
| 183 | 183 | ), |
| 184 | 184 | 'noto_serif_noto_sans' => array( |
| 185 | 185 | 'header' => array( |
| 186 | - "title" => esc_html__( 'Noto Serif', 'lsx' ), |
|
| 186 | + "title" => esc_html__('Noto Serif', 'lsx'), |
|
| 187 | 187 | "location" => "Noto+Serif", |
| 188 | 188 | "cssDeclaration" => "'Noto Serif', serif", |
| 189 | 189 | "cssClass" => "notoSerif", |
| 190 | 190 | ), |
| 191 | 191 | 'body' => array( |
| 192 | - "title" => esc_html__( 'Noto Sans', 'lsx' ), |
|
| 192 | + "title" => esc_html__('Noto Sans', 'lsx'), |
|
| 193 | 193 | "location" => "Noto+Sans", |
| 194 | 194 | "cssDeclaration" => "'Noto Sans', sans-serif", |
| 195 | 195 | "cssClass" => "notoSans", |
@@ -197,13 +197,13 @@ discard block |
||
| 197 | 197 | ), |
| 198 | 198 | 'noto_sans_noto_sans' => array( |
| 199 | 199 | 'header' => array( |
| 200 | - "title" => esc_html__( 'Noto Sans', 'lsx' ), |
|
| 200 | + "title" => esc_html__('Noto Sans', 'lsx'), |
|
| 201 | 201 | "location" => "Noto+Sans", |
| 202 | 202 | "cssDeclaration" => "'Noto Sans', sans-serif", |
| 203 | 203 | "cssClass" => "notoSans", |
| 204 | 204 | ), |
| 205 | 205 | 'body' => array( |
| 206 | - "title" => esc_html__( 'Noto Sans', 'lsx' ), |
|
| 206 | + "title" => esc_html__('Noto Sans', 'lsx'), |
|
| 207 | 207 | "location" => "Noto+Sans", |
| 208 | 208 | "cssDeclaration" => "'Noto Sans', sans-serif", |
| 209 | 209 | "cssClass" => "notoSans", |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | ), |
| 212 | 212 | 'alegreya_open_sans' => array( |
| 213 | 213 | 'header' => array( |
| 214 | - "title" => esc_html__( 'Alegreya', 'lsx' ), |
|
| 214 | + "title" => esc_html__('Alegreya', 'lsx'), |
|
| 215 | 215 | "location" => "Alegreya", |
| 216 | 216 | "cssDeclaration" => "'Alegreya', serif", |
| 217 | 217 | "cssClass" => "alegreya", |
| 218 | 218 | ), |
| 219 | 219 | 'body' => array( |
| 220 | - "title" => esc_html__( 'Open Sans', 'lsx' ), |
|
| 220 | + "title" => esc_html__('Open Sans', 'lsx'), |
|
| 221 | 221 | "location" => "Open+Sans", |
| 222 | 222 | "cssDeclaration" => "'Open Sans', sans-serif", |
| 223 | 223 | "cssClass" => "openSans" |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | ); |
| 229 | 229 | return $lsx_controls; |
| 230 | 230 | } |
| 231 | -add_filter('lsx_customizer_controls','lsx_customizer_font_controls'); |
|
| 231 | +add_filter('lsx_customizer_controls', 'lsx_customizer_font_controls'); |
|
| 232 | 232 | |
| 233 | 233 | /** |
| 234 | 234 | * Returns an array of $controls for the customizer class to generate. |
@@ -238,12 +238,12 @@ discard block |
||
| 238 | 238 | * @category customizer |
| 239 | 239 | * @return $lsx_controls array() |
| 240 | 240 | */ |
| 241 | -function lsx_get_customizer_controls(){ |
|
| 241 | +function lsx_get_customizer_controls() { |
|
| 242 | 242 | $lsx_controls = array(); |
| 243 | 243 | $lsx_controls = apply_filters('lsx_customizer_controls', $lsx_controls); |
| 244 | 244 | return $lsx_controls; |
| 245 | 245 | } |
| 246 | -$lsx_customizer = new LSX_Theme_Customizer( lsx_get_customizer_controls() ); |
|
| 246 | +$lsx_customizer = new LSX_Theme_Customizer(lsx_get_customizer_controls()); |
|
| 247 | 247 | |
| 248 | -add_image_size( 'lsx-thumbnail-wide', 350, 230, true ); |
|
| 249 | -add_image_size( 'lsx-thumbnail-single', 750, 350, true ); |
|
| 250 | 248 | \ No newline at end of file |
| 249 | +add_image_size('lsx-thumbnail-wide', 350, 230, true); |
|
| 250 | +add_image_size('lsx-thumbnail-single', 750, 350, true); |
|
| 251 | 251 | \ No newline at end of file |