@@ -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 | * Customizer Header 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_Header_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-header-layout-control', get_template_directory_uri() .'/js/customizer-header-layout.js', array('jquery'), null, true ); |
|
55 | + wp_enqueue_script('lsx-header-layout-control', get_template_directory_uri() . '/js/customizer-header-layout.js', array('jquery'), null, 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="header-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="header-layout-button" style="padding:2px;'. esc_attr( $sel ) .'" src="' . esc_attr( get_template_directory_uri() ) .'/img/header-' . esc_attr( $layout ) . '.png" data-option="' . esc_attr( $layout ) . '">'; |
|
84 | + echo '<img class="header-layout-button" style="padding:2px;' . esc_attr($sel) . '" src="' . esc_attr(get_template_directory_uri()) . '/img/header-' . esc_attr($layout) . '.png" data-option="' . esc_attr($layout) . '">'; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | ?> |
88 | - <input <?php $this->link(); ?> class="selected-header-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-header-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,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 | * Customizer Header Fixed 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_Header_Fixed_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-header-fixed-control', get_template_directory_uri() .'/js/customizer-header-fixed.js', array('jquery'), null, true ); |
|
55 | + wp_enqueue_script('lsx-header-fixed-control', get_template_directory_uri() . '/js/customizer-header-fixed.js', array('jquery'), null, true); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -62,21 +62,21 @@ 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="header-fixed"> |
78 | 78 | <label> |
79 | - <input <?php $this->link(); ?> type="checkbox" id="<?php echo esc_attr( $post_id ); ?>" class="header-fixed <?php echo esc_attr( $class ); ?>" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> Uncheck for standard header |
|
79 | + <input <?php $this->link(); ?> type="checkbox" id="<?php echo esc_attr($post_id); ?>" class="header-fixed <?php echo esc_attr($class); ?>" value="<?php echo esc_attr($value); ?>" <?php $this->input_attrs(); ?>> Uncheck for standard header |
|
80 | 80 | </label> |
81 | 81 | </div> |
82 | 82 | </label> |
@@ -1,42 +1,42 @@ 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 | * LSX_Customize_Font_Control Class |
6 | 6 | **/ |
7 | -if( !class_exists( 'WP_Customize_Control' ) ){ |
|
7 | +if ( ! class_exists('WP_Customize_Control')) { |
|
8 | 8 | return; |
9 | 9 | } |
10 | -class LSX_Customize_Font_Control extends WP_Customize_Control{ |
|
10 | +class LSX_Customize_Font_Control extends WP_Customize_Control { |
|
11 | 11 | public $fonts; |
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Enqueue the styles and scripts |
15 | 15 | **/ |
16 | - public function enqueue(){ |
|
16 | + public function enqueue() { |
|
17 | 17 | // styles |
18 | - wp_enqueue_style( 'lsx-font-picker-custom-control', get_template_directory_uri() .'/css/customizer-font.css'); |
|
18 | + wp_enqueue_style('lsx-font-picker-custom-control', get_template_directory_uri() . '/css/customizer-font.css'); |
|
19 | 19 | |
20 | 20 | // scripts |
21 | - wp_enqueue_script( 'lsx-font-picker-custom-control', get_template_directory_uri() .'/js/customizer-font.js'); |
|
21 | + wp_enqueue_script('lsx-font-picker-custom-control', get_template_directory_uri() . '/js/customizer-font.js'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
25 | 25 | * Render the content on the theme customizer page |
26 | 26 | **/ |
27 | - public function render_content(){ |
|
28 | - if ( empty( $this->choices ) ){ |
|
27 | + public function render_content() { |
|
28 | + if (empty($this->choices)) { |
|
29 | 29 | // if there are no choices then don't print anything |
30 | 30 | return; |
31 | 31 | } |
32 | 32 | $fonts = array(); |
33 | - foreach( $this->choices as $slug=>$font ){ |
|
33 | + foreach ($this->choices as $slug=>$font) { |
|
34 | 34 | $fonts[] = $font['header']; |
35 | 35 | $fonts[] = $font['body']; |
36 | 36 | $this->choices[$slug] = $font; |
37 | 37 | } |
38 | 38 | |
39 | - $this->fonts = new LSX_Google_Font_Collection( $fonts ); |
|
39 | + $this->fonts = new LSX_Google_Font_Collection($fonts); |
|
40 | 40 | |
41 | 41 | $fonts = $this->fonts->get_font_family_name_array(); |
42 | 42 | //print links to css files |
@@ -51,8 +51,8 @@ discard block |
||
51 | 51 | <div class="fontPickerCustomControl"> |
52 | 52 | <select <?php $this->link(); ?>> |
53 | 53 | <?php |
54 | - foreach ( $this->choices as $value => $conf ){ |
|
55 | - echo '<option value="' . esc_attr( $value ) . '">' . esc_html( $value ) . '</option>'; |
|
54 | + foreach ($this->choices as $value => $conf) { |
|
55 | + echo '<option value="' . esc_attr($value) . '">' . esc_html($value) . '</option>'; |
|
56 | 56 | } |
57 | 57 | ?> |
58 | 58 | </select> |
@@ -60,16 +60,16 @@ discard block |
||
60 | 60 | <ul> |
61 | 61 | <?php |
62 | 62 | //$cssClassArray = $this->fonts->get_css_class_array(); |
63 | - foreach ($this->choices as $key => $font){ |
|
63 | + foreach ($this->choices as $key => $font) { |
|
64 | 64 | $class = null; |
65 | - if( $key == $set_value ){ |
|
65 | + if ($key == $set_value) { |
|
66 | 66 | $class = ' selected'; |
67 | 67 | } |
68 | 68 | |
69 | 69 | ?> |
70 | - <li class="font-choice <?php echo esc_attr( $class ); ?>"> |
|
71 | - <div class="<?php echo esc_attr( $font['header']['cssClass'] ); ?>"><?php echo esc_html( $font['header']['title'] ); ?></div> |
|
72 | - <small class="<?php echo esc_attr( $font['body']['cssClass'] ); ?>"><?php echo esc_html( $font['body']['title'] ); ?></small> |
|
70 | + <li class="font-choice <?php echo esc_attr($class); ?>"> |
|
71 | + <div class="<?php echo esc_attr($font['header']['cssClass']); ?>"><?php echo esc_html($font['header']['title']); ?></div> |
|
72 | + <small class="<?php echo esc_attr($font['body']['cssClass']); ?>"><?php echo esc_html($font['body']['title']); ?></small> |
|
73 | 73 | </li> |
74 | 74 | <?php |
75 | 75 | } |
@@ -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'), null, true ); |
|
55 | + wp_enqueue_script('lsx-layout-control', get_template_directory_uri() . '/js/customizer-layout.js', array('jquery'), null, 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 | * Google Font_Collection Class |
5 | 5 | **/ |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | **/ |
16 | 16 | public function __construct($fonts) |
17 | 17 | { |
18 | - if(empty($fonts)) |
|
18 | + if (empty($fonts)) |
|
19 | 19 | { |
20 | 20 | //we didn't get the required data |
21 | 21 | return false; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | // create fonts |
25 | 25 | foreach ($fonts as $key => $value) |
26 | 26 | { |
27 | - if( empty( $value["system"] ) ){ |
|
27 | + if (empty($value["system"])) { |
|
28 | 28 | $this->fonts[$value["title"]] = new LSX_Google_Font($value["title"], $value["location"], $value["cssDeclaration"], $value["cssClass"]); |
29 | 29 | } |
30 | 30 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | foreach ($this->fonts as $key => $value) |
107 | 107 | { |
108 | 108 | $protocol = 'http'; |
109 | - if(is_ssl()){ $protocol.='s'; } |
|
109 | + if (is_ssl()) { $protocol .= 's'; } |
|
110 | 110 | ?> |
111 | - <link href="<?php echo esc_attr( $protocol ); ?>://fonts.googleapis.com/css?family=<?php echo esc_attr( $value->__get( "location" ) ); ?>" rel='stylesheet'> |
|
111 | + <link href="<?php echo esc_attr($protocol); ?>://fonts.googleapis.com/css?family=<?php echo esc_attr($value->__get("location")); ?>" rel='stylesheet'> |
|
112 | 112 | <?php |
113 | 113 | } |
114 | 114 | } |
@@ -125,8 +125,8 @@ discard block |
||
125 | 125 | foreach ($this->fonts as $key => $value) |
126 | 126 | { |
127 | 127 | ?> |
128 | - .<?php echo esc_attr( $value->__get( "cssClass" ) ); ?>{ |
|
129 | - font-family: <?php echo esc_attr( $value->__get( "cssDeclaration" ) ); ?>; |
|
128 | + .<?php echo esc_attr($value->__get("cssClass")); ?>{ |
|
129 | + font-family: <?php echo esc_attr($value->__get("cssDeclaration")); ?>; |
|
130 | 130 | } |
131 | 131 | <?php |
132 | 132 | } |
@@ -19,8 +19,8 @@ discard block |
||
19 | 19 | */ |
20 | 20 | function lsx_allowed_related_post_types($allowed_post_types) { |
21 | 21 | $allowed_post_types[] = 'jetpack-portfolio'; |
22 | - foreach($allowed_post_types as $key => $value){ |
|
23 | - if('page' == $value){ |
|
22 | + foreach ($allowed_post_types as $key => $value) { |
|
23 | + if ('page' == $value) { |
|
24 | 24 | unset($allowed_post_types[$key]); |
25 | 25 | } |
26 | 26 | } |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | * @category site-logo |
36 | 36 | */ |
37 | 37 | |
38 | -function lsx_site_logo_title_tag( $html) { |
|
38 | +function lsx_site_logo_title_tag($html) { |
|
39 | 39 | |
40 | - $html = str_replace('<a', '<a title="'.get_bloginfo('name').'" ', $html); |
|
40 | + $html = str_replace('<a', '<a title="' . get_bloginfo('name') . '" ', $html); |
|
41 | 41 | return $html; |
42 | 42 | } |
43 | -add_filter( 'jetpack_the_site_logo', 'lsx_site_logo_title_tag'); |
|
43 | +add_filter('jetpack_the_site_logo', 'lsx_site_logo_title_tag'); |
|
44 | 44 | |
45 | 45 | |
46 | 46 | /* |
@@ -54,19 +54,19 @@ discard block |
||
54 | 54 | * @subpackage jetpack |
55 | 55 | * @category portfolio |
56 | 56 | */ |
57 | -function lsx_portfolio_infinite_scroll(){ |
|
58 | - global $_wp_theme_features,$wp_query; |
|
57 | +function lsx_portfolio_infinite_scroll() { |
|
58 | + global $_wp_theme_features, $wp_query; |
|
59 | 59 | |
60 | - if(is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')){ |
|
60 | + if (is_post_type_archive('jetpack-portfolio') || is_tax('jetpack-portfolio-type') || is_tax('jetpack-portfolio-tag')) { |
|
61 | 61 | |
62 | - if(class_exists('The_Neverending_Home_Page')){ |
|
62 | + if (class_exists('The_Neverending_Home_Page')) { |
|
63 | 63 | $_wp_theme_features['infinite-scroll'][0]['container'] = 'portfolio-infinite-scroll-wrapper'; |
64 | 64 | $_wp_theme_features['infinite-scroll'][0]['posts_per_page'] = 99; |
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | 68 | } |
69 | -add_action('wp_head','lsx_portfolio_infinite_scroll',1000); |
|
69 | +add_action('wp_head', 'lsx_portfolio_infinite_scroll', 1000); |
|
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Disables the infinite scroll on the portfolio archive |
@@ -75,13 +75,13 @@ discard block |
||
75 | 75 | * @subpackage jetpack |
76 | 76 | * @category portfolio |
77 | 77 | */ |
78 | -function lsx_portfolio_infinite_scroll_disable($supported){ |
|
79 | - if(is_post_type_archive('jetpack-portfolio')){ |
|
78 | +function lsx_portfolio_infinite_scroll_disable($supported) { |
|
79 | + if (is_post_type_archive('jetpack-portfolio')) { |
|
80 | 80 | $supported = false; |
81 | 81 | } |
82 | 82 | return $supported; |
83 | 83 | } |
84 | -add_filter( 'infinite_scroll_archive_supported', 'lsx_portfolio_infinite_scroll_disable', 1, 10 ); |
|
84 | +add_filter('infinite_scroll_archive_supported', 'lsx_portfolio_infinite_scroll_disable', 1, 10); |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Set the Portfolio to 9 posts per page |
@@ -90,14 +90,14 @@ discard block |
||
90 | 90 | * @subpackage jetpack |
91 | 91 | * @category portfolio |
92 | 92 | */ |
93 | -function lsx_portfolio_archive_pagination( $query ) { |
|
94 | - if(!is_admin()){ |
|
95 | - if ( $query->is_post_type_archive(array('jetpack-portfolio')) && $query->is_main_query() && class_exists('The_Neverending_Home_Page')) { |
|
96 | - $query->set( 'posts_per_page', -1 ); |
|
93 | +function lsx_portfolio_archive_pagination($query) { |
|
94 | + if ( ! is_admin()) { |
|
95 | + if ($query->is_post_type_archive(array('jetpack-portfolio')) && $query->is_main_query() && class_exists('The_Neverending_Home_Page')) { |
|
96 | + $query->set('posts_per_page', -1); |
|
97 | 97 | } |
98 | 98 | } |
99 | 99 | } |
100 | -add_action( 'pre_get_posts', 'lsx_portfolio_archive_pagination' , 100 ); |
|
100 | +add_action('pre_get_posts', 'lsx_portfolio_archive_pagination', 100); |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Remove the related posts from below the content area. |
@@ -107,13 +107,13 @@ discard block |
||
107 | 107 | * @category portfolio |
108 | 108 | */ |
109 | 109 | function lsx_remove_portfolio_related_posts() { |
110 | - if ( is_single() && 'jetpack-portfolio' == get_post_type() && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
110 | + if (is_single() && 'jetpack-portfolio' == get_post_type() && class_exists('Jetpack_RelatedPosts')) { |
|
111 | 111 | $jprp = Jetpack_RelatedPosts::init(); |
112 | - $callback = array( $jprp, 'filter_add_target_to_dom' ); |
|
113 | - remove_filter( 'the_content', $callback, 40 ); |
|
112 | + $callback = array($jprp, 'filter_add_target_to_dom'); |
|
113 | + remove_filter('the_content', $callback, 40); |
|
114 | 114 | } |
115 | 115 | } |
116 | -add_filter( 'wp', 'lsx_remove_portfolio_related_posts', 20 ); |
|
116 | +add_filter('wp', 'lsx_remove_portfolio_related_posts', 20); |
|
117 | 117 | |
118 | 118 | /** |
119 | 119 | * Remove the related posts from below the content area. |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | * @category portfolio |
124 | 124 | */ |
125 | 125 | function lsx_remove_single_related_posts() { |
126 | - if ( is_single() && class_exists( 'Jetpack_RelatedPosts' ) ) { |
|
126 | + if (is_single() && class_exists('Jetpack_RelatedPosts')) { |
|
127 | 127 | $jprp = Jetpack_RelatedPosts::init(); |
128 | - $callback = array( $jprp, 'filter_add_target_to_dom' ); |
|
129 | - remove_filter( 'the_content', $callback, 40 ); |
|
128 | + $callback = array($jprp, 'filter_add_target_to_dom'); |
|
129 | + remove_filter('the_content', $callback, 40); |
|
130 | 130 | } |
131 | 131 | } |
132 | -add_filter( 'wp', 'lsx_remove_single_related_posts', 20 ); |
|
132 | +add_filter('wp', 'lsx_remove_single_related_posts', 20); |
|
133 | 133 | |
134 | 134 | /** |
135 | 135 | * A template tag to call the Portfolios Related posts |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | * @subpackage jetpack |
139 | 139 | * @category portfolio |
140 | 140 | */ |
141 | -function lsx_portfolio_related_posts(){ |
|
142 | - if(class_exists('Jetpack_RelatedPosts')){ ?> |
|
141 | +function lsx_portfolio_related_posts() { |
|
142 | + if (class_exists('Jetpack_RelatedPosts')) { ?> |
|
143 | 143 | <div class="row"> |
144 | 144 | <div class="col-md-12"> |
145 | 145 | <?php echo do_shortcode('[jetpack-related-posts]'); ?> |
@@ -156,16 +156,16 @@ discard block |
||
156 | 156 | * @category portfolio |
157 | 157 | */ |
158 | 158 | function lsx_portfolio_remove_share() { |
159 | - if ( ( is_single() && 'jetpack-portfolio' == get_post_type() ) || is_page_template( 'page-templates/template-portfolio.php' ) ) { |
|
160 | - remove_filter( 'the_content', 'sharing_display',19 ); |
|
161 | - remove_filter( 'the_excerpt', 'sharing_display',19 ); |
|
159 | + if ((is_single() && 'jetpack-portfolio' == get_post_type()) || is_page_template('page-templates/template-portfolio.php')) { |
|
160 | + remove_filter('the_content', 'sharing_display', 19); |
|
161 | + remove_filter('the_excerpt', 'sharing_display', 19); |
|
162 | 162 | |
163 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
164 | - remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); |
|
163 | + if (class_exists('Jetpack_Likes')) { |
|
164 | + remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
168 | -add_action( 'loop_start', 'lsx_portfolio_remove_share' ); |
|
168 | +add_action('loop_start', 'lsx_portfolio_remove_share'); |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * Remove the sharing from single |
@@ -175,16 +175,16 @@ discard block |
||
175 | 175 | * @category post |
176 | 176 | */ |
177 | 177 | function lsx_single_remove_share() { |
178 | - if ( is_single() ) { |
|
179 | - remove_filter( 'the_content', 'sharing_display',19 ); |
|
180 | - remove_filter( 'the_excerpt', 'sharing_display',19 ); |
|
178 | + if (is_single()) { |
|
179 | + remove_filter('the_content', 'sharing_display', 19); |
|
180 | + remove_filter('the_excerpt', 'sharing_display', 19); |
|
181 | 181 | |
182 | - if ( class_exists( 'Jetpack_Likes' ) ) { |
|
183 | - remove_filter( 'the_content', array( Jetpack_Likes::init(), 'post_likes' ), 30, 1 ); |
|
182 | + if (class_exists('Jetpack_Likes')) { |
|
183 | + remove_filter('the_content', array(Jetpack_Likes::init(), 'post_likes'), 30, 1); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | -add_action( 'loop_start', 'lsx_single_remove_share' ); |
|
187 | +add_action('loop_start', 'lsx_single_remove_share'); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Redirect the template archive to our one |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | * @subpackage jetpack |
194 | 194 | * @category portfolio |
195 | 195 | */ |
196 | -function lsx_portfolio_taxonomy_template( $template ) { |
|
196 | +function lsx_portfolio_taxonomy_template($template) { |
|
197 | 197 | |
198 | - if ( is_tax(array('jetpack-portfolio-type','jetpack-portfolio-tag')) ) { |
|
199 | - $new_template = locate_template( array( 'archive-jetpack-portfolio.php' ) ); |
|
200 | - if ( '' != $new_template ) { |
|
201 | - return $new_template ; |
|
198 | + if (is_tax(array('jetpack-portfolio-type', 'jetpack-portfolio-tag'))) { |
|
199 | + $new_template = locate_template(array('archive-jetpack-portfolio.php')); |
|
200 | + if ('' != $new_template) { |
|
201 | + return $new_template; |
|
202 | 202 | } |
203 | 203 | } |
204 | 204 | |
205 | 205 | return $template; |
206 | 206 | } |
207 | -add_filter( 'template_include', 'lsx_portfolio_taxonomy_template', 99 ); |
|
207 | +add_filter('template_include', 'lsx_portfolio_taxonomy_template', 99); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | /** |
@@ -214,35 +214,35 @@ discard block |
||
214 | 214 | * @subpackage jetpack |
215 | 215 | * @category portfolio |
216 | 216 | */ |
217 | -add_action( 'add_meta_boxes', 'lsx_add_portfolio_post_meta_boxes' ); |
|
218 | -add_action( 'save_post', 'lsx_save_portfolio_post_meta', 100, 2 ); |
|
217 | +add_action('add_meta_boxes', 'lsx_add_portfolio_post_meta_boxes'); |
|
218 | +add_action('save_post', 'lsx_save_portfolio_post_meta', 100, 2); |
|
219 | 219 | |
220 | -function lsx_save_portfolio_post_meta( $post_id, $post ) { |
|
221 | - check_admin_referer( 'lsx_save_portfolio', '_lsx_client_nonce' ); |
|
222 | - check_admin_referer( 'lsx_save_portfolio', '_lsx_website_nonce' ); |
|
220 | +function lsx_save_portfolio_post_meta($post_id, $post) { |
|
221 | + check_admin_referer('lsx_save_portfolio', '_lsx_client_nonce'); |
|
222 | + check_admin_referer('lsx_save_portfolio', '_lsx_website_nonce'); |
|
223 | 223 | |
224 | - $post_type = get_post_type_object( $post->post_type ); |
|
224 | + $post_type = get_post_type_object($post->post_type); |
|
225 | 225 | |
226 | - if ( !current_user_can( $post_type->cap->edit_post, $post_id ) ) |
|
226 | + if ( ! current_user_can($post_type->cap->edit_post, $post_id)) |
|
227 | 227 | return $post_id; |
228 | 228 | |
229 | 229 | |
230 | - $meta_keys = array('lsx-website','lsx-client'); |
|
230 | + $meta_keys = array('lsx-website', 'lsx-client'); |
|
231 | 231 | |
232 | - foreach($meta_keys as $meta_key){ |
|
233 | - $new_meta_value = sanitize_text_field( wp_unslash( $_POST[$meta_key] ) ); |
|
234 | - $new_meta_value = ! empty( $new_meta_value ) ? $new_meta_value : ''; |
|
232 | + foreach ($meta_keys as $meta_key) { |
|
233 | + $new_meta_value = sanitize_text_field(wp_unslash($_POST[$meta_key])); |
|
234 | + $new_meta_value = ! empty($new_meta_value) ? $new_meta_value : ''; |
|
235 | 235 | |
236 | - $meta_value = get_post_meta( $post_id, $meta_key, true ); |
|
236 | + $meta_value = get_post_meta($post_id, $meta_key, true); |
|
237 | 237 | |
238 | - if ( $new_meta_value && '' == $meta_value ) |
|
239 | - add_post_meta( $post_id, $meta_key, $new_meta_value, true ); |
|
238 | + if ($new_meta_value && '' == $meta_value) |
|
239 | + add_post_meta($post_id, $meta_key, $new_meta_value, true); |
|
240 | 240 | |
241 | - elseif ( $new_meta_value && $new_meta_value != $meta_value ) |
|
242 | - update_post_meta( $post_id, $meta_key, $new_meta_value ); |
|
241 | + elseif ($new_meta_value && $new_meta_value != $meta_value) |
|
242 | + update_post_meta($post_id, $meta_key, $new_meta_value); |
|
243 | 243 | |
244 | - elseif ( '' == $new_meta_value && $meta_value ) |
|
245 | - delete_post_meta( $post_id, $meta_key, $meta_value ); |
|
244 | + elseif ('' == $new_meta_value && $meta_value) |
|
245 | + delete_post_meta($post_id, $meta_key, $meta_value); |
|
246 | 246 | |
247 | 247 | } |
248 | 248 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | |
252 | 252 | add_meta_box( |
253 | 253 | 'lsx_client_meta_box', |
254 | - esc_html__( 'Client', 'lsx' ), |
|
254 | + esc_html__('Client', 'lsx'), |
|
255 | 255 | 'lsx_client_meta_box', |
256 | 256 | 'jetpack-portfolio', |
257 | 257 | 'side', |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | add_meta_box( |
262 | 262 | 'lsx_website_meta_box', |
263 | - esc_html__( 'Website', 'lsx' ), |
|
263 | + esc_html__('Website', 'lsx'), |
|
264 | 264 | 'lsx_website_meta_box', |
265 | 265 | 'jetpack-portfolio', |
266 | 266 | 'side', |
@@ -268,25 +268,25 @@ discard block |
||
268 | 268 | ); |
269 | 269 | } |
270 | 270 | |
271 | -function lsx_client_meta_box( $object, $box ) { ?> |
|
271 | +function lsx_client_meta_box($object, $box) { ?> |
|
272 | 272 | |
273 | - <?php wp_nonce_field( 'lsx_save_portfolio', '_lsx_client_nonce' ); ?> |
|
273 | + <?php wp_nonce_field('lsx_save_portfolio', '_lsx_client_nonce'); ?> |
|
274 | 274 | |
275 | 275 | <p> |
276 | - <input class="widefat" type="text" name="lsx-client" id="lsx-client" value="<?php echo esc_attr( get_post_meta( $object->ID, 'lsx-client', true ) ); ?>" size="30" /> |
|
276 | + <input class="widefat" type="text" name="lsx-client" id="lsx-client" value="<?php echo esc_attr(get_post_meta($object->ID, 'lsx-client', true)); ?>" size="30" /> |
|
277 | 277 | <br /><br /> |
278 | - <label for="lsx-client"><?php esc_html_e( 'Enter the name of the project client', 'lsx' ); ?></label> |
|
278 | + <label for="lsx-client"><?php esc_html_e('Enter the name of the project client', 'lsx'); ?></label> |
|
279 | 279 | </p> |
280 | 280 | <?php } |
281 | 281 | |
282 | -function lsx_website_meta_box( $object, $box ) { ?> |
|
282 | +function lsx_website_meta_box($object, $box) { ?> |
|
283 | 283 | |
284 | - <?php wp_nonce_field( 'lsx_save_portfolio', '_lsx_website_nonce' ); ?> |
|
284 | + <?php wp_nonce_field('lsx_save_portfolio', '_lsx_website_nonce'); ?> |
|
285 | 285 | |
286 | 286 | <p> |
287 | - <input class="widefat" type="text" name="lsx-website" id="lsx-website" value="<?php echo esc_attr( get_post_meta( $object->ID, 'lsx-website', true ) ); ?>" size="30" /> |
|
287 | + <input class="widefat" type="text" name="lsx-website" id="lsx-website" value="<?php echo esc_attr(get_post_meta($object->ID, 'lsx-website', true)); ?>" size="30" /> |
|
288 | 288 | <br /><br /> |
289 | - <label for="lsx-website"><?php esc_html_e( 'Enter the URL of the project website', 'lsx' ); ?></label> |
|
289 | + <label for="lsx-website"><?php esc_html_e('Enter the URL of the project website', 'lsx'); ?></label> |
|
290 | 290 | </p> |
291 | 291 | <?php } |
292 | 292 | |
@@ -299,18 +299,18 @@ discard block |
||
299 | 299 | * @category portfolio |
300 | 300 | */ |
301 | 301 | |
302 | -function lsx_portfolio_sorter(){ ?> |
|
302 | +function lsx_portfolio_sorter() { ?> |
|
303 | 303 | <ul id="filterNav" class="clearfix"> |
304 | - <li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e( 'All', 'lsx' ); ?></a></li> |
|
304 | + <li class="allBtn"><a href="#" data-filter="*" class="selected"><?php esc_html_e('All', 'lsx'); ?></a></li> |
|
305 | 305 | <?php |
306 | 306 | $types = get_terms('jetpack-portfolio-type'); |
307 | 307 | |
308 | - if(is_array($types)){ |
|
308 | + if (is_array($types)) { |
|
309 | 309 | foreach ($types as $type) { |
310 | - $content = '<li><a href="#" data-filter=".'.$type->slug.'">'; |
|
310 | + $content = '<li><a href="#" data-filter=".' . $type->slug . '">'; |
|
311 | 311 | $content .= $type->name; |
312 | 312 | $content .= '</a></li>'; |
313 | - echo wp_kses_post( $content ); |
|
313 | + echo wp_kses_post($content); |
|
314 | 314 | echo "\n"; |
315 | 315 | } |
316 | 316 | }?> |
@@ -325,18 +325,18 @@ discard block |
||
325 | 325 | * @category portfolio |
326 | 326 | */ |
327 | 327 | |
328 | -function lsx_portfolio_naviagtion_labels($labels){ |
|
328 | +function lsx_portfolio_naviagtion_labels($labels) { |
|
329 | 329 | |
330 | - if(is_post_type_archive('jetpack-portfolio')){ |
|
330 | + if (is_post_type_archive('jetpack-portfolio')) { |
|
331 | 331 | $labels = array( |
332 | - 'next' => '<span class="meta-nav">←</span> '.__( 'Older', 'lsx' ), |
|
333 | - 'previous' => __( 'Newer', 'lsx' ).' <span class="meta-nav">→</span>', |
|
334 | - 'title' => __( 'Portfolio navigation', 'lsx' ) |
|
332 | + 'next' => '<span class="meta-nav">←</span> ' . __('Older', 'lsx'), |
|
333 | + 'previous' => __('Newer', 'lsx') . ' <span class="meta-nav">→</span>', |
|
334 | + 'title' => __('Portfolio navigation', 'lsx') |
|
335 | 335 | ); |
336 | 336 | } |
337 | 337 | return $labels; |
338 | 338 | } |
339 | -add_filter('lsx_post_navigation_labels','lsx_portfolio_naviagtion_labels',1,10); |
|
339 | +add_filter('lsx_post_navigation_labels', 'lsx_portfolio_naviagtion_labels', 1, 10); |
|
340 | 340 | |
341 | 341 | |
342 | 342 | /* |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | * @subpackage jetpack |
351 | 351 | * @category related-posts |
352 | 352 | */ |
353 | -function lsx_remove_related_post_context(){ |
|
354 | - add_filter( 'jetpack_relatedposts_filter_post_context', '__return_empty_string' ); |
|
355 | - add_filter( 'rest_api_allowed_post_types', 'lsx_allowed_related_post_types' ); |
|
353 | +function lsx_remove_related_post_context() { |
|
354 | + add_filter('jetpack_relatedposts_filter_post_context', '__return_empty_string'); |
|
355 | + add_filter('rest_api_allowed_post_types', 'lsx_allowed_related_post_types'); |
|
356 | 356 | } |
357 | -add_action('init','lsx_remove_related_post_context',20); |
|
357 | +add_action('init', 'lsx_remove_related_post_context', 20); |
|
358 | 358 | |
359 | 359 | |
360 | 360 | /* |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | $infinite_scroll_args = array( |
372 | 372 | 'container' => 'main', |
373 | 373 | 'type' => 'click', |
374 | - 'posts_per_page' => get_option('posts_per_page',10), |
|
374 | + 'posts_per_page' => get_option('posts_per_page', 10), |
|
375 | 375 | 'render' => 'lsx_infinite_scroll_render' |
376 | 376 | ); |
377 | 377 | |
378 | - add_theme_support( 'infinite-scroll', $infinite_scroll_args ); |
|
378 | + add_theme_support('infinite-scroll', $infinite_scroll_args); |
|
379 | 379 | } |
380 | -add_action( 'after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup' ); |
|
380 | +add_action('after_setup_theme', 'lsx_jetpack_infinite_scroll_after_setup'); |
|
381 | 381 | |
382 | 382 | /** |
383 | 383 | * Set the code to be rendered on for calling posts, |
@@ -390,13 +390,13 @@ discard block |
||
390 | 390 | function lsx_infinite_scroll_render() { |
391 | 391 | global $wp_query; |
392 | 392 | |
393 | - while(have_posts()){ |
|
393 | + while (have_posts()) { |
|
394 | 394 | the_post(); |
395 | 395 | |
396 | - if('jetpack-portfolio' == get_post_type()){ |
|
397 | - get_template_part( 'content', 'portfolio' ); |
|
398 | - }else{ |
|
399 | - get_template_part( 'content', get_post_type() ); |
|
396 | + if ('jetpack-portfolio' == get_post_type()) { |
|
397 | + get_template_part('content', 'portfolio'); |
|
398 | + } else { |
|
399 | + get_template_part('content', get_post_type()); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | } |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | * @subpackage jetpack |
409 | 409 | * @category related posts |
410 | 410 | */ |
411 | -function lsx_related_posts_headline( $headline ) { |
|
412 | - $headline = sprintf( '<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html( 'Related Posts' ) ); |
|
411 | +function lsx_related_posts_headline($headline) { |
|
412 | + $headline = sprintf('<h3 class="jp-relatedposts-headline"><em>%s</em></h3>', esc_html('Related Posts')); |
|
413 | 413 | return $headline; |
414 | 414 | } |
415 | -add_filter( 'jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline' ); |
|
415 | +add_filter('jetpack_relatedposts_filter_headline', 'lsx_related_posts_headline'); |
@@ -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,141 +25,141 @@ 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 | - $http_user_agent = sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ); |
|
71 | - $http_user_agent = ! empty( $http_user_agent ) ? $http_user_agent : ''; |
|
70 | + $http_user_agent = sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])); |
|
71 | + $http_user_agent = ! empty($http_user_agent) ? $http_user_agent : ''; |
|
72 | 72 | |
73 | - if ( is_feed() |
|
73 | + if (is_feed() |
|
74 | 74 | || is_preview() |
75 | - || intval( get_query_var( 'print' ) ) == 1 |
|
76 | - || intval( get_query_var( 'printpage' ) ) == 1 |
|
77 | - || strpos( $http_user_agent, 'Opera Mini' ) !== false |
|
75 | + || intval(get_query_var('print')) == 1 |
|
76 | + || intval(get_query_var('printpage')) == 1 |
|
77 | + || strpos($http_user_agent, 'Opera Mini') !== false |
|
78 | 78 | ) { |
79 | 79 | return $content; |
80 | 80 | } |
81 | 81 | |
82 | 82 | $skip_images_regex = '/class=".*(lazyload|disable-lazyload).*"/'; |
83 | - $placeholder_image = apply_filters( 'lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' ); |
|
83 | + $placeholder_image = apply_filters('lsx_lazyload_placeholder_image', 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=='); |
|
84 | 84 | |
85 | 85 | $matches = array(); |
86 | 86 | $search = array(); |
87 | 87 | $replace = array(); |
88 | 88 | |
89 | - $content = preg_replace_callback( '~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content ); |
|
90 | - preg_match_all( '/<img[^>]*>/', $content, $matches ); |
|
89 | + $content = preg_replace_callback('~<noscript.+?</noscript>~s', 'self::noscripts_remove', $content); |
|
90 | + preg_match_all('/<img[^>]*>/', $content, $matches); |
|
91 | 91 | |
92 | - foreach ( $matches[0] as $img_html ) { |
|
93 | - if ( ! ( preg_match( $skip_images_regex, $img_html ) ) ) { |
|
92 | + foreach ($matches[0] as $img_html) { |
|
93 | + if ( ! (preg_match($skip_images_regex, $img_html))) { |
|
94 | 94 | $add_class = false; |
95 | 95 | |
96 | - if ( ! preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) && preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
97 | - $replace_html = preg_replace( '/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html ); |
|
96 | + if ( ! preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html) && preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
97 | + $replace_html = preg_replace('/<img(.*?)srcset=/i', '<img$1srcset="' . $placeholder_image . '" data-srcset=', $img_html); |
|
98 | 98 | |
99 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
100 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
99 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
100 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
101 | 101 | } else { |
102 | - $replace_html = preg_replace( '/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
102 | + $replace_html = preg_replace('/data-srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | $add_class = true; |
106 | - } elseif ( preg_match( '/src=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
107 | - $replace_html = preg_replace( '/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html ); |
|
106 | + } elseif (preg_match('/src=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
107 | + $replace_html = preg_replace('/<img(.*?)src=/i', '<img$1src="' . $placeholder_image . '" data-src=', $img_html); |
|
108 | 108 | |
109 | - if ( preg_match( '/srcset=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
110 | - if ( preg_match( '/sizes=[\'"]([^\'"]+)[\'"]/', $img_html ) ) { |
|
111 | - $replace_html = preg_replace( '/srcset=/i', 'data-srcset=', $replace_html ); |
|
112 | - $replace_html = preg_replace( '/sizes=/i', 'data-sizes=', $replace_html ); |
|
109 | + if (preg_match('/srcset=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
110 | + if (preg_match('/sizes=[\'"]([^\'"]+)[\'"]/', $img_html)) { |
|
111 | + $replace_html = preg_replace('/srcset=/i', 'data-srcset=', $replace_html); |
|
112 | + $replace_html = preg_replace('/sizes=/i', 'data-sizes=', $replace_html); |
|
113 | 113 | } else { |
114 | - $replace_html = preg_replace( '/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html ); |
|
114 | + $replace_html = preg_replace('/srcset=/i', 'data-sizes="auto" data-srcset=', $replace_html); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
118 | 118 | $add_class = true; |
119 | 119 | } |
120 | 120 | |
121 | - if ( $add_class ) { |
|
122 | - $replace_html = self::add_class( $replace_html, 'lazyload' ); |
|
121 | + if ($add_class) { |
|
122 | + $replace_html = self::add_class($replace_html, 'lazyload'); |
|
123 | 123 | $replace_html .= '<noscript>' . $img_html . '</noscript>'; |
124 | 124 | |
125 | - array_push( $search, $img_html ); |
|
126 | - array_push( $replace, $replace_html ); |
|
125 | + array_push($search, $img_html); |
|
126 | + array_push($replace, $replace_html); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - $content = str_replace( $search, $replace, $content ); |
|
132 | - $content = preg_replace_callback( '~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content ); |
|
131 | + $content = str_replace($search, $replace, $content); |
|
132 | + $content = preg_replace_callback('~' . chr(20) . '([0-9]+)' . chr(20) . '~', 'self::noscripts_restore', $content); |
|
133 | 133 | return $content; |
134 | 134 | } |
135 | 135 | |
136 | - static function noscripts_remove( $match ) { |
|
136 | + static function noscripts_remove($match) { |
|
137 | 137 | self::$noscript_id++; |
138 | 138 | self::$noscripts[self::$noscript_id] = $match[0]; |
139 | 139 | return chr(20) . self::$noscript_id . chr(20); |
140 | 140 | } |
141 | 141 | |
142 | - static function noscripts_restore( $match ) { |
|
142 | + static function noscripts_restore($match) { |
|
143 | 143 | return self::$noscripts[(int) $match[1]]; |
144 | 144 | } |
145 | 145 | |
146 | - static function add_class( $html_string = '', $new_class ) { |
|
146 | + static function add_class($html_string = '', $new_class) { |
|
147 | 147 | $pattern = '/class=[\'"]([^\'"]*)[\'"]/'; |
148 | 148 | |
149 | - if ( preg_match( $pattern, $html_string, $matches ) ) { |
|
150 | - $defined_classes = explode( ' ', $matches[1] ); |
|
149 | + if (preg_match($pattern, $html_string, $matches)) { |
|
150 | + $defined_classes = explode(' ', $matches[1]); |
|
151 | 151 | |
152 | - if ( ! in_array( $new_class, $defined_classes ) ) { |
|
152 | + if ( ! in_array($new_class, $defined_classes)) { |
|
153 | 153 | $defined_classes[] = $new_class; |
154 | 154 | |
155 | 155 | $html_string = str_replace( |
156 | 156 | $matches[0], |
157 | - sprintf( 'class="%s"', implode( ' ', $defined_classes ) ), |
|
157 | + sprintf('class="%s"', implode(' ', $defined_classes)), |
|
158 | 158 | $html_string |
159 | 159 | ); |
160 | 160 | } |
161 | 161 | } else { |
162 | - $html_string = preg_replace( '/(\<.+\s)/', sprintf( '$1class="%s" ', $new_class ), $html_string ); |
|
162 | + $html_string = preg_replace('/(\<.+\s)/', sprintf('$1class="%s" ', $new_class), $html_string); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | return $html_string; |
@@ -170,4 +170,4 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
173 | -add_action( 'init', array( 'LSX_LazyLoadImages', 'init' ) ); |
|
173 | +add_action('init', array('LSX_LazyLoadImages', 'init')); |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | |
6 | 6 | <?php lsx_content_wrap_before(); ?> |
7 | 7 | |
8 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
8 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
9 | 9 | |
10 | 10 | <?php lsx_content_before(); ?> |
11 | 11 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | <?php lsx_content_top(); ?> |
15 | 15 | |
16 | - <?php while ( have_posts() ) : the_post(); ?> |
|
16 | + <?php while (have_posts()) : the_post(); ?> |
|
17 | 17 | |
18 | 18 | <?php lsx_entry_before(); ?> |
19 | 19 | |
@@ -22,28 +22,28 @@ discard block |
||
22 | 22 | <?php lsx_entry_top(); ?> |
23 | 23 | |
24 | 24 | <div class="entry-content"> |
25 | - <h2><?php esc_html_e( 'The Last 30 Posts', 'lsx' ); ?></h3> |
|
25 | + <h2><?php esc_html_e('The Last 30 Posts', 'lsx'); ?></h3> |
|
26 | 26 | <ul> |
27 | - <?php $loop = new WP_Query( array( 'posts_per_page' => 30 ) ); ?> |
|
28 | - <?php if ( $loop->have_posts() ) { while ( $loop->have_posts() ) { $loop->the_post(); ?> |
|
27 | + <?php $loop = new WP_Query(array('posts_per_page' => 30)); ?> |
|
28 | + <?php if ($loop->have_posts()) { while ($loop->have_posts()) { $loop->the_post(); ?> |
|
29 | 29 | <?php $loop->is_home = false; ?> |
30 | - <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time( get_option( 'date_format' ) ); ?> - <?php echo esc_html( $post->comment_count ); ?> <?php esc_html_e( 'comments', 'lsx' ); ?></li> |
|
30 | + <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> - <?php the_time(get_option('date_format')); ?> - <?php echo esc_html($post->comment_count); ?> <?php esc_html_e('comments', 'lsx'); ?></li> |
|
31 | 31 | <?php } } wp_reset_postdata(); ?> |
32 | 32 | </ul> |
33 | 33 | |
34 | - <h2><?php esc_html_e( 'Categories', 'lsx' ); ?></h3> |
|
34 | + <h2><?php esc_html_e('Categories', 'lsx'); ?></h3> |
|
35 | 35 | |
36 | 36 | <ul> |
37 | - <?php wp_list_categories( 'title_li=&hierarchical=0&show_count=1' ); ?> |
|
37 | + <?php wp_list_categories('title_li=&hierarchical=0&show_count=1'); ?> |
|
38 | 38 | </ul> |
39 | 39 | |
40 | - <h2><?php esc_html_e( 'Monthly Archives', 'lsx' ); ?></h3> |
|
40 | + <h2><?php esc_html_e('Monthly Archives', 'lsx'); ?></h3> |
|
41 | 41 | |
42 | 42 | <ul> |
43 | - <?php wp_get_archives( 'type=monthly&show_post_count=1' ); ?> |
|
43 | + <?php wp_get_archives('type=monthly&show_post_count=1'); ?> |
|
44 | 44 | </ul> |
45 | 45 | </div><!-- .entry-content --> |
46 | - <?php edit_post_link( esc_html__( 'Edit', 'lsx' ), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>' ); ?> |
|
46 | + <?php edit_post_link(esc_html__('Edit', 'lsx'), '<footer class="entry-meta"><span class="edit-link">', '</span></footer>'); ?> |
|
47 | 47 | |
48 | 48 | <?php lsx_entry_bottom(); ?> |
49 | 49 |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php lsx_content_top(); ?> |
19 | 19 | |
20 | - <?php if(have_posts()) { ?> |
|
21 | - <?php while(have_posts()) { the_post(); ?> |
|
20 | + <?php if (have_posts()) { ?> |
|
21 | + <?php while (have_posts()) { the_post(); ?> |
|
22 | 22 | <div class="entry-content"> |
23 | 23 | |
24 | 24 | <?php the_content(); ?> |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | <?php } ?> |
30 | 30 | |
31 | 31 | <?php |
32 | - if ( get_query_var( 'paged' ) ) : |
|
33 | - $paged = get_query_var( 'paged' ); |
|
34 | - elseif ( get_query_var( 'page' ) ) : |
|
35 | - $paged = get_query_var( 'page' ); |
|
32 | + if (get_query_var('paged')) : |
|
33 | + $paged = get_query_var('paged'); |
|
34 | + elseif (get_query_var('page')) : |
|
35 | + $paged = get_query_var('page'); |
|
36 | 36 | else : |
37 | 37 | $paged = 1; |
38 | 38 | endif; |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | 'post_type' => 'jetpack-portfolio', |
42 | 42 | 'posts_per_page' => 99, |
43 | 43 | ); |
44 | - $project_query = new WP_Query ( $args ); |
|
45 | - if ( post_type_exists( 'jetpack-portfolio' ) && $project_query -> have_posts() ) : |
|
44 | + $project_query = new WP_Query($args); |
|
45 | + if (post_type_exists('jetpack-portfolio') && $project_query -> have_posts()) : |
|
46 | 46 | ?> |
47 | 47 | |
48 | 48 | <?php lsx_portfolio_sorter(); ?> |
49 | 49 | |
50 | 50 | <div class="filter-items-wrapper lsx-portfolio-wrapper"> |
51 | 51 | <div class="filter-items-container lsx-portfolio masonry"> |
52 | - <?php while ( $project_query -> have_posts() ) : $project_query -> the_post(); ?> |
|
52 | + <?php while ($project_query -> have_posts()) : $project_query -> the_post(); ?> |
|
53 | 53 | |
54 | - <?php if(has_post_thumbnail()) { ?> |
|
55 | - <?php get_template_part( 'content', 'portfolio' ); ?> |
|
54 | + <?php if (has_post_thumbnail()) { ?> |
|
55 | + <?php get_template_part('content', 'portfolio'); ?> |
|
56 | 56 | <?php } ?> |
57 | 57 | |
58 | 58 | <?php endwhile; ?> |
@@ -63,17 +63,17 @@ discard block |
||
63 | 63 | |
64 | 64 | <section class="no-results not-found"> |
65 | 65 | <header class="page-header"> |
66 | - <h1 class="page-title"><?php esc_html_e( 'Nothing Found', 'lsx' ); ?></h1> |
|
66 | + <h1 class="page-title"><?php esc_html_e('Nothing Found', 'lsx'); ?></h1> |
|
67 | 67 | </header><!-- .page-header --> |
68 | 68 | |
69 | 69 | <div class="page-content"> |
70 | - <?php if ( current_user_can( 'publish_posts' ) ) : ?> |
|
70 | + <?php if (current_user_can('publish_posts')) : ?> |
|
71 | 71 | |
72 | - <p><?php esc_html_e( 'Ready to publish your first project?', 'lsx' ); ?> <a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=jetpack-portfolio' ) ) ?>"><?php esc_html_e( 'Get started here', 'lsx' ); ?></a></p> |
|
72 | + <p><?php esc_html_e('Ready to publish your first project?', 'lsx'); ?> <a href="<?php echo esc_url(admin_url('post-new.php?post_type=jetpack-portfolio')) ?>"><?php esc_html_e('Get started here', 'lsx'); ?></a></p> |
|
73 | 73 | |
74 | 74 | <?php else : ?> |
75 | 75 | |
76 | - <p><?php esc_html_e( 'It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx' ); ?></p> |
|
76 | + <p><?php esc_html_e('It seems we can’t find what you’re looking for. Perhaps searching can help.', 'lsx'); ?></p> |
|
77 | 77 | <?php get_search_form(); ?> |
78 | 78 | |
79 | 79 | <?php endif; ?> |