@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | * @category bootstrap-walker |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | 11 | exit; |
12 | 12 | } |
13 | 13 | |
14 | -if ( ! class_exists( 'Walker_Nav_Menu' ) ) { |
|
14 | +if ( ! class_exists('Walker_Nav_Menu')) { |
|
15 | 15 | return; |
16 | 16 | } |
17 | 17 | |
18 | -if ( ! class_exists( 'LSX_Nav_Walker' ) ) : |
|
18 | +if ( ! class_exists('LSX_Nav_Walker')) : |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Cleaner walker for wp_nav_menu() |
@@ -34,46 +34,46 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class LSX_Nav_Walker extends Walker_Nav_Menu { |
36 | 36 | |
37 | - function check_current( $classes ) { |
|
38 | - return preg_match( '/^(current[-_])|active|dropdown$/', $classes ); |
|
37 | + function check_current($classes) { |
|
38 | + return preg_match('/^(current[-_])|active|dropdown$/', $classes); |
|
39 | 39 | } |
40 | 40 | |
41 | - function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
41 | + function start_lvl(&$output, $depth = 0, $args = array()) { |
|
42 | 42 | $output .= "\n<ul class=\"dropdown-menu\">\n"; |
43 | 43 | } |
44 | 44 | |
45 | - function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { |
|
45 | + function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { |
|
46 | 46 | $item_html = ''; |
47 | 47 | |
48 | - if ( isset( $item->title ) ) { |
|
49 | - parent::start_el( $item_html, $item, $depth, $args ); |
|
48 | + if (isset($item->title)) { |
|
49 | + parent::start_el($item_html, $item, $depth, $args); |
|
50 | 50 | |
51 | - if ( $item->is_dropdown && ( 0 === $depth ) ) { |
|
52 | - $item_html = str_replace( '<a', '<a class="dropdown-toggle" data-target="#"', $item_html ); |
|
53 | - $item_html = str_replace( '</a>', ' <b class="caret"></b></a>', $item_html ); |
|
54 | - } elseif ( stristr( $item_html, 'li class="divider"' ) ) { |
|
55 | - $item_html = preg_replace( '/<a[^>]*>.*?<\/a>/iU', '', $item_html ); |
|
56 | - } elseif ( stristr( $item_html, 'li class="dropdown-header"' ) ) { |
|
57 | - $item_html = preg_replace( '/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html ); |
|
51 | + if ($item->is_dropdown && (0 === $depth)) { |
|
52 | + $item_html = str_replace('<a', '<a class="dropdown-toggle" data-target="#"', $item_html); |
|
53 | + $item_html = str_replace('</a>', ' <b class="caret"></b></a>', $item_html); |
|
54 | + } elseif (stristr($item_html, 'li class="divider"')) { |
|
55 | + $item_html = preg_replace('/<a[^>]*>.*?<\/a>/iU', '', $item_html); |
|
56 | + } elseif (stristr($item_html, 'li class="dropdown-header"')) { |
|
57 | + $item_html = preg_replace('/<a[^>]*>(.*)<\/a>/iU', '$1', $item_html); |
|
58 | 58 | } |
59 | 59 | |
60 | - $item_html = apply_filters( 'lsx_wp_nav_menu_item', $item_html ); |
|
60 | + $item_html = apply_filters('lsx_wp_nav_menu_item', $item_html); |
|
61 | 61 | $output .= $item_html; |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | - function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) { |
|
66 | - $element->is_dropdown = ( ( ! empty( $children_elements[ $element->ID ] ) && ( ( $depth + 1 ) < $max_depth || ( 0 === $max_depth ) ) ) ); |
|
65 | + function display_element($element, &$children_elements, $max_depth, $depth = 0, $args, &$output) { |
|
66 | + $element->is_dropdown = (( ! empty($children_elements[$element->ID]) && (($depth + 1) < $max_depth || (0 === $max_depth)))); |
|
67 | 67 | |
68 | - if ( $element->is_dropdown ) { |
|
69 | - if ( $depth > 0 ) { |
|
68 | + if ($element->is_dropdown) { |
|
69 | + if ($depth > 0) { |
|
70 | 70 | $element->classes[] = 'dropdown-submenu'; |
71 | 71 | } else { |
72 | 72 | $element->classes[] = 'dropdown'; |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output ); |
|
76 | + parent::display_element($element, $children_elements, $max_depth, $depth, $args, $output); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | } |
@@ -1,42 +1,42 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'ABSPATH' ) ) { |
|
2 | +if ( ! defined('ABSPATH')) { |
|
3 | 3 | exit; |
4 | 4 | } |
5 | 5 | |
6 | 6 | global $comment, $stored_comment, $_product, $rating; |
7 | 7 | $the_comment = $comment; |
8 | -if ( null !== $stored_comment ) { |
|
8 | +if (null !== $stored_comment) { |
|
9 | 9 | $the_comment = $stored_comment; |
10 | 10 | } |
11 | 11 | ?> |
12 | 12 | |
13 | 13 | <div class="lsx-woocommerce-review-slot"> |
14 | 14 | <div class="lsx-woocommerce-review-flex"> |
15 | - <a href="<?php echo esc_url( get_comment_link( $the_comment->comment_ID ) ); ?>"> |
|
15 | + <a href="<?php echo esc_url(get_comment_link($the_comment->comment_ID)); ?>"> |
|
16 | 16 | <figure class="lsx-woocommerce-avatar"> |
17 | - <?php echo wp_kses_post( $_product->get_image( 'lsx-thumbnail-square' ) ); ?> |
|
17 | + <?php echo wp_kses_post($_product->get_image('lsx-thumbnail-square')); ?> |
|
18 | 18 | </figure> |
19 | 19 | </a> |
20 | 20 | |
21 | 21 | <div class="lsx-woocommerce-review-box"> |
22 | 22 | <div class="lsx-woocommerce-rating"> |
23 | - <?php echo wp_kses_post( wc_get_rating_html( $rating ) ); ?> |
|
23 | + <?php echo wp_kses_post(wc_get_rating_html($rating)); ?> |
|
24 | 24 | </div> |
25 | 25 | |
26 | 26 | <h5 class="lsx-woocommerce-title"> |
27 | - <a href="<?php echo esc_url( get_comment_link( $the_comment->comment_ID ) ); ?>"><?php echo wp_kses_post( $_product->get_name() ); ?></a> |
|
27 | + <a href="<?php echo esc_url(get_comment_link($the_comment->comment_ID)); ?>"><?php echo wp_kses_post($_product->get_name()); ?></a> |
|
28 | 28 | </h5> |
29 | 29 | |
30 | 30 | <p class="lsx-woocommerce-reviewer"> |
31 | 31 | <?php |
32 | 32 | /* translators: %s: review author */ |
33 | - echo wp_kses_post( esc_html__( 'by ', 'lsx' ) . get_comment_author( $the_comment->comment_ID ) ); |
|
33 | + echo wp_kses_post(esc_html__('by ', 'lsx') . get_comment_author($the_comment->comment_ID)); |
|
34 | 34 | ?> |
35 | 35 | </p> |
36 | 36 | |
37 | 37 | <div class="lsx-woocommerce-content"> |
38 | - <p><?php echo wp_kses_post( $the_comment->comment_content ); ?></p> |
|
39 | - <p><a href="<?php echo esc_url( get_comment_link( $the_comment->comment_ID ) ); ?>" class="moretag"><?php esc_attr_e( 'View more', 'lsx' ); ?></a></p> |
|
38 | + <p><?php echo wp_kses_post($the_comment->comment_content); ?></p> |
|
39 | + <p><a href="<?php echo esc_url(get_comment_link($the_comment->comment_ID)); ?>" class="moretag"><?php esc_attr_e('View more', 'lsx'); ?></a></p> |
|
40 | 40 | </div> |
41 | 41 | </div> |
42 | 42 | </div> |
@@ -79,14 +79,20 @@ discard block |
||
79 | 79 | <h2 class="entry-title"> |
80 | 80 | <?php if ( has_post_thumbnail() ) : ?> |
81 | 81 | <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ); ?>"></a> |
82 | - <?php else : ?> |
|
83 | - <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
82 | + <?php else { |
|
83 | + : ?> |
|
84 | + <a href="<?php echo esc_url( $archive_link ); |
|
85 | +} |
|
86 | +?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
84 | 87 | <?php endif; ?> |
85 | 88 | |
86 | 89 | <?php if ( has_post_format( array( 'link' ) ) ) : ?> |
87 | 90 | <a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
88 | - <?php else : ?> |
|
89 | - <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
|
91 | + <?php else { |
|
92 | + : ?> |
|
93 | + <a href="<?php the_permalink(); |
|
94 | +} |
|
95 | +?>" rel="bookmark"><?php the_title(); ?></a> |
|
90 | 96 | <?php endif; ?> |
91 | 97 | |
92 | 98 | <?php if ( is_sticky() ) : ?> |
@@ -111,11 +117,13 @@ discard block |
||
111 | 117 | <?php the_content(); ?> |
112 | 118 | </div><!-- .entry-content --> |
113 | 119 | |
114 | - <?php else : ?> |
|
120 | + <?php else { |
|
121 | + : ?> |
|
115 | 122 | |
116 | 123 | <div class="entry-content"> |
117 | 124 | <?php |
118 | 125 | the_content(); |
126 | +} |
|
119 | 127 | |
120 | 128 | wp_link_pages( array( |
121 | 129 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
@@ -17,38 +17,38 @@ discard block |
||
17 | 17 | 'quote' => 'quote', |
18 | 18 | 'video' => 'video', |
19 | 19 | ); |
20 | - $no_thumb_post_formats = apply_filters( 'lsx_no_thumb_post_formats', $no_thumb_post_types ); |
|
20 | + $no_thumb_post_formats = apply_filters('lsx_no_thumb_post_formats', $no_thumb_post_types); |
|
21 | 21 | |
22 | - $has_thumb = has_post_thumbnail() && ! has_post_format( $no_thumb_post_formats ); |
|
22 | + $has_thumb = has_post_thumbnail() && ! has_post_format($no_thumb_post_formats); |
|
23 | 23 | |
24 | - if ( $has_thumb ) { |
|
24 | + if ($has_thumb) { |
|
25 | 25 | $thumb_class = 'has-thumb'; |
26 | 26 | } else { |
27 | 27 | $thumb_class = 'no-thumb'; |
28 | 28 | } |
29 | 29 | |
30 | - $blog_layout = apply_filters( 'lsx_blog_layout', 'default' ); |
|
30 | + $blog_layout = apply_filters('lsx_blog_layout', 'default'); |
|
31 | 31 | |
32 | 32 | $image_class = ''; |
33 | 33 | |
34 | - $thumbnail_id = get_post_thumbnail_id( get_the_ID() ); |
|
35 | - $image_arr = wp_get_attachment_image_src( $thumbnail_id, 'lsx-thumbnail-single' ); |
|
34 | + $thumbnail_id = get_post_thumbnail_id(get_the_ID()); |
|
35 | + $image_arr = wp_get_attachment_image_src($thumbnail_id, 'lsx-thumbnail-single'); |
|
36 | 36 | |
37 | - if ( is_array( $image_arr ) ) { |
|
37 | + if (is_array($image_arr)) { |
|
38 | 38 | $image_src = $image_arr[0]; |
39 | 39 | } |
40 | 40 | ?> |
41 | 41 | |
42 | -<article id="post-<?php the_ID(); ?>" <?php post_class( array( 'lsx-slot', $thumb_class ) ); ?>> |
|
42 | +<article id="post-<?php the_ID(); ?>" <?php post_class(array('lsx-slot', $thumb_class)); ?>> |
|
43 | 43 | <?php lsx_entry_top(); ?> |
44 | 44 | |
45 | 45 | <div class="entry-layout"> |
46 | 46 | <div class="entry-layout-content entry-layout-content-<?php echo has_post_thumbnail() ? '67' : '100'; ?>"> |
47 | 47 | <header class="entry-header"> |
48 | - <?php if ( $has_thumb ) : ?> |
|
49 | - <div class="entry-image <?php echo esc_attr( $image_class ); ?>"> |
|
48 | + <?php if ($has_thumb) : ?> |
|
49 | + <div class="entry-image <?php echo esc_attr($image_class); ?>"> |
|
50 | 50 | <a class="thumbnail" href="<?php the_permalink(); ?>"> |
51 | - <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
|
51 | + <?php lsx_thumbnail('lsx-thumbnail-single'); ?> |
|
52 | 52 | </a> |
53 | 53 | </div> |
54 | 54 | <?php endif; ?> |
@@ -56,37 +56,37 @@ discard block |
||
56 | 56 | <?php |
57 | 57 | $format = get_post_format(); |
58 | 58 | |
59 | - if ( false === $format ) { |
|
59 | + if (false === $format) { |
|
60 | 60 | $format = 'standard'; |
61 | - $show_on_front = get_option( 'show_on_front', 'posts' ); |
|
61 | + $show_on_front = get_option('show_on_front', 'posts'); |
|
62 | 62 | |
63 | - if ( 'page' === $show_on_front ) { |
|
64 | - $archive_link = get_permalink( get_option( 'page_for_posts' ) ); |
|
63 | + if ('page' === $show_on_front) { |
|
64 | + $archive_link = get_permalink(get_option('page_for_posts')); |
|
65 | 65 | } else { |
66 | 66 | $archive_link = home_url(); |
67 | 67 | } |
68 | 68 | } else { |
69 | - $archive_link = get_post_format_link( $format ); |
|
69 | + $archive_link = get_post_format_link($format); |
|
70 | 70 | } |
71 | 71 | |
72 | - $format = lsx_translate_format_to_fontawesome( $format ); |
|
72 | + $format = lsx_translate_format_to_fontawesome($format); |
|
73 | 73 | ?> |
74 | 74 | |
75 | 75 | <h2 class="entry-title"> |
76 | - <?php if ( has_post_thumbnail() ) : ?> |
|
77 | - <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
76 | + <?php if (has_post_thumbnail()) : ?> |
|
77 | + <a href="<?php echo esc_url($archive_link); ?>" class="format-link has-thumb fa fa-<?php echo esc_attr($format); ?>"></a> |
|
78 | 78 | <?php else : ?> |
79 | - <a href="<?php echo esc_url( $archive_link ); ?>" class="format-link fa fa-<?php echo esc_attr( $format ); ?>"></a> |
|
79 | + <a href="<?php echo esc_url($archive_link); ?>" class="format-link fa fa-<?php echo esc_attr($format); ?>"></a> |
|
80 | 80 | <?php endif; ?> |
81 | 81 | |
82 | - <?php if ( has_post_format( array( 'link' ) ) ) : ?> |
|
83 | - <a href="<?php echo esc_url( lsx_get_my_url() ); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
|
82 | + <?php if (has_post_format(array('link'))) : ?> |
|
83 | + <a href="<?php echo esc_url(lsx_get_my_url()); ?>" rel="bookmark"><?php the_title(); ?> <span class="fa fa-external-link"></span></a> |
|
84 | 84 | <?php else : ?> |
85 | 85 | <a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a> |
86 | 86 | <?php endif; ?> |
87 | 87 | |
88 | - <?php if ( is_sticky() ) : ?> |
|
89 | - <span class="label label-default label-sticky"><?php esc_html_e( 'Featured', 'lsx' ); ?></span> |
|
88 | + <?php if (is_sticky()) : ?> |
|
89 | + <span class="label label-default label-sticky"><?php esc_html_e('Featured', 'lsx'); ?></span> |
|
90 | 90 | <?php endif; ?> |
91 | 91 | </h2> |
92 | 92 | <div class="entry-meta"> |
@@ -97,27 +97,27 @@ discard block |
||
97 | 97 | |
98 | 98 | </header><!-- .entry-header --> |
99 | 99 | |
100 | - <?php if ( has_post_format( array( 'quote' ) ) || apply_filters( 'lsx_blog_display_text_on_list', true ) ) : ?> |
|
100 | + <?php if (has_post_format(array('quote')) || apply_filters('lsx_blog_display_text_on_list', true)) : ?> |
|
101 | 101 | |
102 | - <?php if ( lsx_post_format_force_content_on_list() && ! apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
|
102 | + <?php if (lsx_post_format_force_content_on_list() && ! apply_filters('lsx_blog_force_content_on_list', false)) : ?> |
|
103 | 103 | |
104 | 104 | <div class="entry-summary"> |
105 | 105 | <?php |
106 | - if ( ! has_excerpt() ) { |
|
106 | + if ( ! has_excerpt()) { |
|
107 | 107 | |
108 | - $excerpt_more = '<p><a class="moretag" href="' . esc_url( get_permalink() ) . '">' . esc_html__( 'Read More', 'lsx' ) . '</a></p>'; |
|
109 | - $content = wp_trim_words( get_the_content(), 50 ); |
|
108 | + $excerpt_more = '<p><a class="moretag" href="' . esc_url(get_permalink()) . '">' . esc_html__('Read More', 'lsx') . '</a></p>'; |
|
109 | + $content = wp_trim_words(get_the_content(), 50); |
|
110 | 110 | $content = '<p>' . $content . '</p>' . $excerpt_more; |
111 | - echo wp_kses_post( $content ); |
|
111 | + echo wp_kses_post($content); |
|
112 | 112 | } else { |
113 | 113 | the_excerpt(); |
114 | 114 | } |
115 | 115 | ?> |
116 | 116 | </div><!-- .entry-summary --> |
117 | 117 | |
118 | - <?php elseif ( has_post_format( array( 'link' ) ) ) : ?> |
|
118 | + <?php elseif (has_post_format(array('link'))) : ?> |
|
119 | 119 | |
120 | - <?php elseif ( apply_filters( 'lsx_blog_force_content_on_list', false ) ) : ?> |
|
120 | + <?php elseif (apply_filters('lsx_blog_force_content_on_list', false)) : ?> |
|
121 | 121 | |
122 | 122 | <div class="entry-content"> |
123 | 123 | <?php the_content(); ?> |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | <?php |
130 | 130 | the_content(); |
131 | 131 | |
132 | - wp_link_pages( array( |
|
132 | + wp_link_pages(array( |
|
133 | 133 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
134 | 134 | 'after' => '</div></div>', |
135 | 135 | 'link_before' => '<span>', |
136 | 136 | 'link_after' => '</span>', |
137 | - ) ); |
|
137 | + )); |
|
138 | 138 | ?> |
139 | 139 | </div><!-- .entry-content --> |
140 | 140 | |
@@ -150,23 +150,23 @@ discard block |
||
150 | 150 | |
151 | 151 | <?php lsx_content_post_tags(); ?> |
152 | 152 | |
153 | - <?php if ( comments_open() && ! empty( $comments_number ) ) : ?> |
|
153 | + <?php if (comments_open() && ! empty($comments_number)) : ?> |
|
154 | 154 | <div class="post-comments"> |
155 | 155 | <a href="<?php the_permalink(); ?>#comments"> |
156 | 156 | <?php |
157 | - if ( '1' === $comments_number ) { |
|
158 | - echo esc_html_x( 'One Comment', 'content.php', 'lsx' ); |
|
157 | + if ('1' === $comments_number) { |
|
158 | + echo esc_html_x('One Comment', 'content.php', 'lsx'); |
|
159 | 159 | } else { |
160 | 160 | printf( |
161 | 161 | /* Translators: %s: number of comments */ |
162 | - esc_html( _nx( |
|
162 | + esc_html(_nx( |
|
163 | 163 | '%s Comment', |
164 | 164 | '%s Comments', |
165 | 165 | $comments_number, |
166 | 166 | 'content.php', |
167 | 167 | 'lsx' |
168 | - ) ), |
|
169 | - esc_html( number_format_i18n( $comments_number ) ) |
|
168 | + )), |
|
169 | + esc_html(number_format_i18n($comments_number)) |
|
170 | 170 | ); |
171 | 171 | } |
172 | 172 | ?> |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | </div> |
177 | 177 | </div> |
178 | 178 | |
179 | - <?php if ( has_post_thumbnail() ) : ?> |
|
179 | + <?php if (has_post_thumbnail()) : ?> |
|
180 | 180 | |
181 | 181 | <div class="entry-image hidden-xs"> |
182 | - <a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url( $image_src ); ?>);"> |
|
183 | - <?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?> |
|
182 | + <a class="thumbnail" href="<?php the_permalink(); ?>" style="background-image:url(<?php echo esc_url($image_src); ?>);"> |
|
183 | + <?php lsx_thumbnail('lsx-thumbnail-single'); ?> |
|
184 | 184 | </a> |
185 | 185 | </div> |
186 | 186 |
@@ -15,42 +15,42 @@ |
||
15 | 15 | */ |
16 | 16 | |
17 | 17 | // Exit if accessed directly |
18 | -if ( ! defined( 'ABSPATH' ) ) { |
|
18 | +if ( ! defined('ABSPATH')) { |
|
19 | 19 | exit; |
20 | 20 | } |
21 | 21 | |
22 | 22 | global $product; |
23 | 23 | |
24 | -if ( ! is_a( $product, 'WC_Product' ) ) { |
|
24 | +if ( ! is_a($product, 'WC_Product')) { |
|
25 | 25 | return; |
26 | 26 | } ?> |
27 | 27 | |
28 | 28 | <div class="lsx-woocommerce-slot"> |
29 | - <a href="<?php echo esc_url( $product->get_permalink() ); ?>"> |
|
29 | + <a href="<?php echo esc_url($product->get_permalink()); ?>"> |
|
30 | 30 | <figure class="lsx-woocommerce-avatar"> |
31 | - <?php echo wp_kses_post( $product->get_image( 'lsx-thumbnail-square' ) ); ?> |
|
31 | + <?php echo wp_kses_post($product->get_image('lsx-thumbnail-square')); ?> |
|
32 | 32 | </figure> |
33 | 33 | </a> |
34 | 34 | |
35 | 35 | <h5 class="lsx-woocommerce-title"> |
36 | - <a href="<?php echo esc_url( $product->get_permalink() ); ?>"><?php echo wp_kses_post( $product->get_name() ); ?></a> |
|
36 | + <a href="<?php echo esc_url($product->get_permalink()); ?>"><?php echo wp_kses_post($product->get_name()); ?></a> |
|
37 | 37 | </h5> |
38 | 38 | |
39 | - <?php if ( ! empty( $show_rating ) ) : ?> |
|
39 | + <?php if ( ! empty($show_rating)) : ?> |
|
40 | 40 | <div class="lsx-woocommerce-rating"> |
41 | - <?php echo wp_kses_post( wc_get_rating_html( $product->get_average_rating() ) ); ?> |
|
41 | + <?php echo wp_kses_post(wc_get_rating_html($product->get_average_rating())); ?> |
|
42 | 42 | </div> |
43 | 43 | <?php endif; ?> |
44 | 44 | |
45 | 45 | <?php |
46 | 46 | $price_html = $product->get_price_html(); |
47 | - if ( $price_html ) : ?> |
|
47 | + if ($price_html) : ?> |
|
48 | 48 | <div class="lsx-woocommerce-price"> |
49 | - <?php echo wp_kses_post( $price_html ); ?> |
|
49 | + <?php echo wp_kses_post($price_html); ?> |
|
50 | 50 | </div> |
51 | 51 | <?php endif; ?> |
52 | 52 | |
53 | 53 | <div class="lsx-woocommerce-content"> |
54 | - <a href="<?php echo esc_url( $product->get_permalink() ); ?>" class="moretag"><?php esc_attr_e( 'View more', 'lsx' ); ?></a> |
|
54 | + <a href="<?php echo esc_url($product->get_permalink()); ?>" class="moretag"><?php esc_attr_e('View more', 'lsx'); ?></a> |
|
55 | 55 | </div> |
56 | 56 | </div> |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return bool True if it has schema, false if not. |
20 | 20 | */ |
21 | - public static function is_type( $post_type = null, $comparison_type = null ) { |
|
22 | - if ( is_null( $comparison_type ) ) { |
|
21 | + public static function is_type($post_type = null, $comparison_type = null) { |
|
22 | + if (is_null($comparison_type)) { |
|
23 | 23 | return false; |
24 | 24 | } |
25 | - if ( is_null( $post_type ) ) { |
|
25 | + if (is_null($post_type)) { |
|
26 | 26 | $post_type = get_post_type(); |
27 | 27 | } |
28 | 28 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @api string[] $post_types The post types for which we output Review. |
32 | 32 | */ |
33 | - $post_types = apply_filters( 'wpseo_schema_' . $comparison_type . '_post_types', array( $comparison_type ) ); |
|
34 | - return in_array( $post_type, $post_types ); |
|
33 | + $post_types = apply_filters('wpseo_schema_' . $comparison_type . '_post_types', array($comparison_type)); |
|
34 | + return in_array($post_type, $post_types); |
|
35 | 35 | } |
36 | 36 | /** |
37 | 37 | * Retrieve a users Schema ID. |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string The user's schema ID. |
44 | 44 | */ |
45 | - public static function get_places_schema_id( $place_id, $type, $context ) { |
|
46 | - $url = $context->site_url . '#/schema/' . strtolower( $type ) . '/' . wp_hash( $place_id . get_the_title( $place_id ) ); |
|
47 | - return trailingslashit( $url ); |
|
45 | + public static function get_places_schema_id($place_id, $type, $context) { |
|
46 | + $url = $context->site_url . '#/schema/' . strtolower($type) . '/' . wp_hash($place_id . get_the_title($place_id)); |
|
47 | + return trailingslashit($url); |
|
48 | 48 | } |
49 | 49 | /** |
50 | 50 | * Retrieve a users Schema ID. |
@@ -54,9 +54,9 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return string The user's schema ID. |
56 | 56 | */ |
57 | - public static function get_subtrip_schema_id( $name, $context ) { |
|
58 | - $url = $context->site_url . '#/subtrip/' . wp_hash( $name . $context->id ); |
|
59 | - return trailingslashit( $url ); |
|
57 | + public static function get_subtrip_schema_id($name, $context) { |
|
58 | + $url = $context->site_url . '#/subtrip/' . wp_hash($name . $context->id); |
|
59 | + return trailingslashit($url); |
|
60 | 60 | } |
61 | 61 | /** |
62 | 62 | * Retrieve an offer Schema ID. |
@@ -67,15 +67,15 @@ discard block |
||
67 | 67 | * |
68 | 68 | * @return string The user's schema ID. |
69 | 69 | */ |
70 | - public static function get_offer_schema_id( $id, $context, $local = false ) { |
|
71 | - if ( false === $local ) { |
|
70 | + public static function get_offer_schema_id($id, $context, $local = false) { |
|
71 | + if (false === $local) { |
|
72 | 72 | $url = $context->site_url; |
73 | 73 | } else { |
74 | - $url = get_permalink( $context->id ); |
|
74 | + $url = get_permalink($context->id); |
|
75 | 75 | } |
76 | 76 | $url .= '#/schema/offer/'; |
77 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
78 | - return trailingslashit( $url ); |
|
77 | + $url .= wp_hash($id . get_the_title($id)); |
|
78 | + return trailingslashit($url); |
|
79 | 79 | } |
80 | 80 | /** |
81 | 81 | * Retrieve an review Schema ID. |
@@ -86,15 +86,15 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @return string The user's schema ID. |
88 | 88 | */ |
89 | - public static function get_review_schema_id( $id, $context, $local = false ) { |
|
90 | - if ( false === $local ) { |
|
89 | + public static function get_review_schema_id($id, $context, $local = false) { |
|
90 | + if (false === $local) { |
|
91 | 91 | $url = $context->site_url; |
92 | 92 | } else { |
93 | - $url = get_permalink( $context->id ); |
|
93 | + $url = get_permalink($context->id); |
|
94 | 94 | } |
95 | 95 | $url .= '#/schema/review/'; |
96 | - $url .= wp_hash( $id . get_the_title( $id ) ); |
|
97 | - return trailingslashit( $url ); |
|
96 | + $url .= wp_hash($id . get_the_title($id)); |
|
97 | + return trailingslashit($url); |
|
98 | 98 | } |
99 | 99 | /** |
100 | 100 | * Retrieve an Article Schema ID. |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @return string The user's schema ID. |
107 | 107 | */ |
108 | - public static function get_article_schema_id( $id, $context, $local = false ) { |
|
109 | - if ( false === $local ) { |
|
110 | - $url = get_permalink( $id ) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
108 | + public static function get_article_schema_id($id, $context, $local = false) { |
|
109 | + if (false === $local) { |
|
110 | + $url = get_permalink($id) . \WPSEO_Schema_IDs::ARTICLE_HASH; |
|
111 | 111 | } else { |
112 | - $url = get_permalink( $context->id ) . '#/schema/article/' . wp_hash( $id . get_the_title( $id ) ); |
|
112 | + $url = get_permalink($context->id) . '#/schema/article/' . wp_hash($id . get_the_title($id)); |
|
113 | 113 | } |
114 | - return trailingslashit( $url ); |
|
114 | + return trailingslashit($url); |
|
115 | 115 | } |
116 | 116 | /** |
117 | 117 | * Retrieve a users Schema ID. |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | * |
122 | 122 | * @return string The user's schema ID. |
123 | 123 | */ |
124 | - public static function get_author_schema_id( $name, $email, $context ) { |
|
125 | - return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash( $name . $email ); |
|
124 | + public static function get_author_schema_id($name, $email, $context) { |
|
125 | + return $context->site_url . \WPSEO_Schema_IDs::PERSON_HASH . wp_hash($name . $email); |
|
126 | 126 | } |
127 | 127 | /** |
128 | 128 | * Generates the place graph piece for the subtrip / Itinerary arrays. |
@@ -135,16 +135,16 @@ discard block |
||
135 | 135 | * |
136 | 136 | * @return mixed array $data Place data. |
137 | 137 | */ |
138 | - public static function add_place( $data, $type, $post_id, $context, $contained_in = false ) { |
|
139 | - $at_id = self::get_places_schema_id( $post_id, $type, $context ); |
|
138 | + public static function add_place($data, $type, $post_id, $context, $contained_in = false) { |
|
139 | + $at_id = self::get_places_schema_id($post_id, $type, $context); |
|
140 | 140 | $place = array( |
141 | 141 | '@type' => $type, |
142 | 142 | '@id' => $at_id, |
143 | - 'name' => get_the_title( $post_id ), |
|
144 | - 'description' => get_the_excerpt( $post_id ), |
|
145 | - 'url' => get_permalink( $post_id ), |
|
143 | + 'name' => get_the_title($post_id), |
|
144 | + 'description' => get_the_excerpt($post_id), |
|
145 | + 'url' => get_permalink($post_id), |
|
146 | 146 | ); |
147 | - if ( false !== $contained_in ) { |
|
147 | + if (false !== $contained_in) { |
|
148 | 148 | $place['containedInPlace'] = array( |
149 | 149 | '@type' => 'Country', |
150 | 150 | '@id' => $contained_in, |
@@ -161,8 +161,8 @@ discard block |
||
161 | 161 | * |
162 | 162 | * @return array $data The Review data. |
163 | 163 | */ |
164 | - public static function add_image( $data, $context ) { |
|
165 | - if ( $context->has_image ) { |
|
164 | + public static function add_image($data, $context) { |
|
165 | + if ($context->has_image) { |
|
166 | 166 | $data['image'] = array( |
167 | 167 | '@id' => $context->canonical . \WPSEO_Schema_IDs::PRIMARY_IMAGE_HASH, |
168 | 168 | ); |
@@ -176,18 +176,18 @@ discard block |
||
176 | 176 | * @param string $type The schema type. |
177 | 177 | * @return array $schema An array of the schema markup. |
178 | 178 | */ |
179 | - public static function get_item_reviewed( $items = array(), $type = '' ) { |
|
179 | + public static function get_item_reviewed($items = array(), $type = '') { |
|
180 | 180 | $schema = array(); |
181 | - if ( false !== $items && ! empty( $items ) && '' !== $type ) { |
|
182 | - array_unique( $items ); |
|
183 | - foreach ( $items as $item ) { |
|
184 | - $title = get_the_title( $item ); |
|
185 | - if ( '' !== $title ) { |
|
181 | + if (false !== $items && ! empty($items) && '' !== $type) { |
|
182 | + array_unique($items); |
|
183 | + foreach ($items as $item) { |
|
184 | + $title = get_the_title($item); |
|
185 | + if ('' !== $title) { |
|
186 | 186 | $item_schema = array( |
187 | 187 | '@type' => $type, |
188 | 188 | 'name' => $title, |
189 | 189 | ); |
190 | - $schema[] = $item_schema; |
|
190 | + $schema[] = $item_schema; |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | } |
@@ -203,18 +203,18 @@ discard block |
||
203 | 203 | * |
204 | 204 | * @return mixed array $data Review data. |
205 | 205 | */ |
206 | - public static function add_terms( $data, $post_id, $key, $taxonomy ) { |
|
207 | - $terms = get_the_terms( $post_id, $taxonomy ); |
|
208 | - if ( is_array( $terms ) ) { |
|
206 | + public static function add_terms($data, $post_id, $key, $taxonomy) { |
|
207 | + $terms = get_the_terms($post_id, $taxonomy); |
|
208 | + if (is_array($terms)) { |
|
209 | 209 | $keywords = array(); |
210 | - foreach ( $terms as $term ) { |
|
210 | + foreach ($terms as $term) { |
|
211 | 211 | // We are checking against the WordPress internal translation. |
212 | 212 | // @codingStandardsIgnoreLine |
213 | - if ( $term->name !== __( 'Uncategorized' ) ) { |
|
213 | + if ($term->name !== __('Uncategorized')) { |
|
214 | 214 | $keywords[] = $term->name; |
215 | 215 | } |
216 | 216 | } |
217 | - $data[ $key ] = implode( ',', $keywords ); |
|
217 | + $data[$key] = implode(',', $keywords); |
|
218 | 218 | } |
219 | 219 | return $data; |
220 | 220 | } |
@@ -46,7 +46,6 @@ discard block |
||
46 | 46 | /** |
47 | 47 | * Defers the JS loading till Last |
48 | 48 | * |
49 | - * @param string $url The url to check and defer. |
|
50 | 49 | * @return string |
51 | 50 | */ |
52 | 51 | public function preload_css( $tag, $handle, $href, $media ) { |
@@ -59,7 +58,6 @@ discard block |
||
59 | 58 | /** |
60 | 59 | * Defers the JS loading till Last |
61 | 60 | * |
62 | - * @param string $url The url to check and defer. |
|
63 | 61 | * @return string |
64 | 62 | */ |
65 | 63 | public function defer_parsing_of_js( $tag, $handle, $href ) { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if ( ! defined('ABSPATH')) { |
|
4 | 4 | exit; |
5 | 5 | } |
6 | 6 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | public function __construct() { |
29 | 29 | //add_filter( 'style_loader_tag', array( $this, 'preload_css' ), 100, 4 ); |
30 | 30 | //add_filter( 'script_loader_tag', array( $this, 'defer_parsing_of_js' ), 100, 3 ); |
31 | - add_action( 'init', array( $this, 'pum_remove_admin_bar_tools' ), 100 ); |
|
31 | + add_action('init', array($this, 'pum_remove_admin_bar_tools'), 100); |
|
32 | 32 | } |
33 | 33 | /** |
34 | 34 | * Return an instance of this class. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function get_instance() { |
40 | 40 | // If the single instance hasn't been set, set it now. |
41 | - if ( null === self::$instance ) { |
|
41 | + if (null === self::$instance) { |
|
42 | 42 | self::$instance = new self; |
43 | 43 | } |
44 | 44 | return self::$instance; |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | * @param string $url The url to check and defer. |
51 | 51 | * @return string |
52 | 52 | */ |
53 | - public function preload_css( $tag, $handle, $href, $media ) { |
|
54 | - if ( 'lsx_fonts' === $handle || 'fontawesome' === $handle ) { |
|
55 | - $tag = str_replace( 'href', ' preload href', $tag ); |
|
53 | + public function preload_css($tag, $handle, $href, $media) { |
|
54 | + if ('lsx_fonts' === $handle || 'fontawesome' === $handle) { |
|
55 | + $tag = str_replace('href', ' preload href', $tag); |
|
56 | 56 | } |
57 | 57 | return $tag; |
58 | 58 | } |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | * @param string $url The url to check and defer. |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - public function defer_parsing_of_js( $tag, $handle, $href ) { |
|
67 | - $skip_defer = apply_filters( 'lsx_defer_parsing_of_js', false, $tag, $handle, $href ); |
|
68 | - if ( ! is_admin() && false !== stripos( $href, '.js' ) && false === stripos( $href, 'jquery.js' ) && false === $skip_defer ) { |
|
69 | - $tag = str_replace( 'src=', ' defer src=', $tag ); |
|
66 | + public function defer_parsing_of_js($tag, $handle, $href) { |
|
67 | + $skip_defer = apply_filters('lsx_defer_parsing_of_js', false, $tag, $handle, $href); |
|
68 | + if ( ! is_admin() && false !== stripos($href, '.js') && false === stripos($href, 'jquery.js') && false === $skip_defer) { |
|
69 | + $tag = str_replace('src=', ' defer src=', $tag); |
|
70 | 70 | } |
71 | 71 | return $tag; |
72 | 72 | } |
73 | 73 | |
74 | 74 | public function pum_remove_admin_bar_tools() { |
75 | - remove_action( 'admin_bar_menu', array( 'PUM_Modules_Admin_Bar', 'toolbar_links' ), 999 ); |
|
76 | - remove_action( 'wp_footer', array( 'PUM_Modules_Admin_Bar', 'admin_bar_styles' ), 999 ); |
|
77 | - remove_action( 'init', array( 'PUM_Modules_Admin_Bar', 'show_debug_bar' ) ); |
|
75 | + remove_action('admin_bar_menu', array('PUM_Modules_Admin_Bar', 'toolbar_links'), 999); |
|
76 | + remove_action('wp_footer', array('PUM_Modules_Admin_Bar', 'admin_bar_styles'), 999); |
|
77 | + remove_action('init', array('PUM_Modules_Admin_Bar', 'show_debug_bar')); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | LSX_Optimisation::get_instance(); |
@@ -6,7 +6,7 @@ |
||
6 | 6 | * @subpackage deprecated |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 |
@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | * @subpackage customizer |
7 | 7 | */ |
8 | 8 | |
9 | -if ( ! defined( 'ABSPATH' ) ) { |
|
9 | +if ( ! defined('ABSPATH')) { |
|
10 | 10 | exit; |
11 | 11 | } |
12 | 12 | |
13 | -if ( ! function_exists( 'lsx_customizer_core_controls' ) ) : |
|
13 | +if ( ! function_exists('lsx_customizer_core_controls')) : |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * Returns an array of the core panel. |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | * |
21 | 21 | * @return $lsx_controls array() |
22 | 22 | */ |
23 | - function lsx_customizer_core_controls( $lsx_controls ) { |
|
23 | + function lsx_customizer_core_controls($lsx_controls) { |
|
24 | 24 | $lsx_controls['sections']['lsx-core'] = array( |
25 | - 'title' => esc_html__( 'Core Settings', 'lsx' ), |
|
26 | - 'description' => esc_html__( 'Change the core settings.', 'lsx' ), |
|
25 | + 'title' => esc_html__('Core Settings', 'lsx'), |
|
26 | + 'description' => esc_html__('Change the core settings.', 'lsx'), |
|
27 | 27 | 'priority' => 21, |
28 | 28 | ); |
29 | 29 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | ); |
35 | 35 | |
36 | 36 | $lsx_controls['fields']['lsx_preloader_content_status'] = array( |
37 | - 'label' => esc_html__( 'Preloader Content', 'lsx' ), |
|
37 | + 'label' => esc_html__('Preloader Content', 'lsx'), |
|
38 | 38 | 'section' => 'lsx-core', |
39 | 39 | 'type' => 'checkbox', |
40 | 40 | ); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | ); |
47 | 47 | |
48 | 48 | $lsx_controls['fields']['lsx_disable_fonts'] = array( |
49 | - 'label' => esc_html__( 'Disable Fonts', 'lsx' ), |
|
49 | + 'label' => esc_html__('Disable Fonts', 'lsx'), |
|
50 | 50 | 'section' => 'lsx-core', |
51 | 51 | 'type' => 'checkbox', |
52 | 52 | ); |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | |
57 | 57 | endif; |
58 | 58 | |
59 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_core_controls' ); |
|
59 | +add_filter('lsx_customizer_controls', 'lsx_customizer_core_controls'); |
|
60 | 60 | |
61 | -if ( ! function_exists( 'lsx_customizer_layout_controls' ) ) : |
|
61 | +if ( ! function_exists('lsx_customizer_layout_controls')) : |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * Returns an array of the layout panel. |
@@ -68,10 +68,10 @@ discard block |
||
68 | 68 | * |
69 | 69 | * @return $lsx_controls array() |
70 | 70 | */ |
71 | - function lsx_customizer_layout_controls( $lsx_controls ) { |
|
71 | + function lsx_customizer_layout_controls($lsx_controls) { |
|
72 | 72 | $lsx_controls['sections']['lsx-layout'] = array( |
73 | - 'title' => esc_html__( 'Layout', 'lsx' ), |
|
74 | - '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' ), |
|
73 | + 'title' => esc_html__('Layout', 'lsx'), |
|
74 | + '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'), |
|
75 | 75 | 'priority' => 22, |
76 | 76 | ); |
77 | 77 | |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ); |
83 | 83 | |
84 | 84 | $lsx_controls['fields']['lsx_header_layout'] = array( |
85 | - 'label' => esc_html__( 'Header', 'lsx' ), |
|
85 | + 'label' => esc_html__('Header', 'lsx'), |
|
86 | 86 | 'section' => 'lsx-layout', |
87 | 87 | 'control' => 'LSX_Customize_Header_Layout_Control', |
88 | 88 | 'choices' => array( |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ); |
100 | 100 | |
101 | 101 | $lsx_controls['fields']['lsx_layout'] = array( |
102 | - 'label' => esc_html__( 'Body', 'lsx' ), |
|
102 | + 'label' => esc_html__('Body', 'lsx'), |
|
103 | 103 | 'section' => 'lsx-layout', |
104 | 104 | 'control' => 'LSX_Customize_Layout_Control', |
105 | 105 | 'choices' => array( |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | ); |
117 | 117 | |
118 | 118 | $lsx_controls['fields']['lsx_header_fixed'] = array( |
119 | - 'label' => esc_html__( 'Fixed Header', 'lsx' ), |
|
119 | + 'label' => esc_html__('Fixed Header', 'lsx'), |
|
120 | 120 | 'section' => 'lsx-layout', |
121 | 121 | 'type' => 'checkbox', |
122 | 122 | ); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | ); |
129 | 129 | |
130 | 130 | $lsx_controls['fields']['lsx_header_search'] = array( |
131 | - 'label' => esc_html__( 'Search Box in Header', 'lsx' ), |
|
131 | + 'label' => esc_html__('Search Box in Header', 'lsx'), |
|
132 | 132 | 'section' => 'lsx-layout', |
133 | 133 | 'type' => 'checkbox', |
134 | 134 | ); |
@@ -136,9 +136,9 @@ discard block |
||
136 | 136 | $lsx_controls['selective_refresh']['lsx_header_search'] = array( |
137 | 137 | 'selector' => '#lsx-header-search-css', |
138 | 138 | 'render_callback' => function() { |
139 | - $search_form = get_theme_mod( 'lsx_header_search' ); |
|
139 | + $search_form = get_theme_mod('lsx_header_search'); |
|
140 | 140 | |
141 | - if ( false !== $search_form ) { |
|
141 | + if (false !== $search_form) { |
|
142 | 142 | echo 'body #searchform { display: block; }'; |
143 | 143 | } else { |
144 | 144 | echo 'body #searchform { display: none; }'; |
@@ -151,9 +151,9 @@ discard block |
||
151 | 151 | |
152 | 152 | endif; |
153 | 153 | |
154 | -add_filter( 'lsx_customizer_controls', 'lsx_customizer_layout_controls' ); |
|
154 | +add_filter('lsx_customizer_controls', 'lsx_customizer_layout_controls'); |
|
155 | 155 | |
156 | -if ( ! function_exists( 'lsx_get_customizer_controls' ) ) : |
|
156 | +if ( ! function_exists('lsx_get_customizer_controls')) : |
|
157 | 157 | |
158 | 158 | /** |
159 | 159 | * Returns an array of $controls for the customizer class to generate. |
@@ -165,10 +165,10 @@ discard block |
||
165 | 165 | */ |
166 | 166 | function lsx_get_customizer_controls() { |
167 | 167 | $lsx_controls = array(); |
168 | - $lsx_controls = apply_filters( 'lsx_customizer_controls', $lsx_controls ); |
|
168 | + $lsx_controls = apply_filters('lsx_customizer_controls', $lsx_controls); |
|
169 | 169 | return $lsx_controls; |
170 | 170 | } |
171 | 171 | |
172 | 172 | endif; |
173 | 173 | |
174 | -$lsx_customizer = new LSX_Theme_Customizer( lsx_get_customizer_controls() ); |
|
174 | +$lsx_customizer = new LSX_Theme_Customizer(lsx_get_customizer_controls()); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * |
10 | 10 | * @since 10.2 |
11 | 11 | */ |
12 | -if ( interface_exists( 'WPSEO_Graph_Piece' ) ) { |
|
12 | +if (interface_exists('WPSEO_Graph_Piece')) { |
|
13 | 13 | |
14 | 14 | class LSX_Schema_Graph_Piece implements WPSEO_Graph_Piece { |
15 | 15 | /** |
@@ -53,13 +53,13 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @param \WPSEO_Schema_Context $context A value object with context variables. |
55 | 55 | */ |
56 | - public function __construct( WPSEO_Schema_Context $context ) { |
|
56 | + public function __construct(WPSEO_Schema_Context $context) { |
|
57 | 57 | $this->context = $context; |
58 | 58 | $this->place_ids = array(); |
59 | - $this->post = get_post( $this->context->id ); |
|
60 | - $this->post_url = get_permalink( $this->context->id ); |
|
59 | + $this->post = get_post($this->context->id); |
|
60 | + $this->post_url = get_permalink($this->context->id); |
|
61 | 61 | $this->is_top_level = false; |
62 | - if ( is_object( $this->post ) && isset( $this->post->post_parent ) && ( false === $this->post->post_parent || 0 === $this->post->post_parent || '' === $this->post->post_parent ) ) { |
|
62 | + if (is_object($this->post) && isset($this->post->post_parent) && (false === $this->post->post_parent || 0 === $this->post->post_parent || '' === $this->post->post_parent)) { |
|
63 | 63 | $this->is_top_level = true; |
64 | 64 | } |
65 | 65 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | * @return bool |
70 | 70 | */ |
71 | 71 | public function is_needed() { |
72 | - if ( ! is_singular() ) { |
|
72 | + if ( ! is_singular()) { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | - if ( false === $this->context->site_represents ) { |
|
75 | + if (false === $this->context->site_represents) { |
|
76 | 76 | return false; |
77 | 77 | } |
78 | - return LSX_Schema_Utils::is_type( get_post_type(), $this->post_type ); |
|
78 | + return LSX_Schema_Utils::is_type(get_post_type(), $this->post_type); |
|
79 | 79 | } |
80 | 80 | /** |
81 | 81 | * Returns Review data. |
@@ -94,32 +94,32 @@ discard block |
||
94 | 94 | * @param boolean $include_aggregate |
95 | 95 | * @return array $data |
96 | 96 | */ |
97 | - public function add_reviews( $data, $data_key = 'reviews', $include_aggregate = true ) { |
|
98 | - $reviews = get_post_meta( $this->context->id, 'review_to_' . $this->post_type, false ); |
|
97 | + public function add_reviews($data, $data_key = 'reviews', $include_aggregate = true) { |
|
98 | + $reviews = get_post_meta($this->context->id, 'review_to_' . $this->post_type, false); |
|
99 | 99 | $reviews_array = array(); |
100 | - if ( ! empty( $reviews ) ) { |
|
100 | + if ( ! empty($reviews)) { |
|
101 | 101 | $aggregate_value = 1; |
102 | 102 | $review_count = 0; |
103 | - foreach ( $reviews as $review_id ) { |
|
104 | - $rating = get_post_meta( $review_id, 'rating', true ); |
|
105 | - $author = get_post_meta( $review_id, 'reviewer_name', true ); |
|
106 | - $description = wp_strip_all_tags( get_the_excerpt( $review_id ) ); |
|
103 | + foreach ($reviews as $review_id) { |
|
104 | + $rating = get_post_meta($review_id, 'rating', true); |
|
105 | + $author = get_post_meta($review_id, 'reviewer_name', true); |
|
106 | + $description = wp_strip_all_tags(get_the_excerpt($review_id)); |
|
107 | 107 | $review_args = array( |
108 | 108 | 'author' => $author, |
109 | 109 | 'reviewBody' => $description, |
110 | 110 | ); |
111 | 111 | // Add in the review rating. |
112 | - if ( false !== $rating && '' !== $rating && '0' !== $rating && 0 !== $rating ) { |
|
112 | + if (false !== $rating && '' !== $rating && '0' !== $rating && 0 !== $rating) { |
|
113 | 113 | $review_args['reviewRating'] = array( |
114 | 114 | '@type' => 'Rating', |
115 | 115 | 'ratingValue' => $rating, |
116 | 116 | ); |
117 | 117 | } |
118 | - $reviews_array = LSX_Schema_Utils::add_review( $reviews_array, $review_id, $this->context, $review_args ); |
|
118 | + $reviews_array = LSX_Schema_Utils::add_review($reviews_array, $review_id, $this->context, $review_args); |
|
119 | 119 | $review_count++; |
120 | 120 | } |
121 | - if ( ! empty( $reviews_array ) ) { |
|
122 | - if ( true === $include_aggregate ) { |
|
121 | + if ( ! empty($reviews_array)) { |
|
122 | + if (true === $include_aggregate) { |
|
123 | 123 | $data['aggregateRating'] = array( |
124 | 124 | '@type' => 'AggregateRating', |
125 | 125 | 'ratingValue' => (string) $aggregate_value, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | 'worstRating' => '1', |
129 | 129 | ); |
130 | 130 | } |
131 | - $data[ $data_key ] = $reviews_array; |
|
131 | + $data[$data_key] = $reviews_array; |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | return $data; |
@@ -140,30 +140,30 @@ discard block |
||
140 | 140 | * @param string $data_key |
141 | 141 | * @return array $data |
142 | 142 | */ |
143 | - public function add_articles( $data, $data_key = 'subjectOf' ) { |
|
144 | - $posts = get_post_meta( $this->context->id, 'post_to_' . $this->post_type, false ); |
|
143 | + public function add_articles($data, $data_key = 'subjectOf') { |
|
144 | + $posts = get_post_meta($this->context->id, 'post_to_' . $this->post_type, false); |
|
145 | 145 | $posts_array = array(); |
146 | - if ( ! empty( $posts ) ) { |
|
147 | - foreach ( $posts as $post_id ) { |
|
146 | + if ( ! empty($posts)) { |
|
147 | + foreach ($posts as $post_id) { |
|
148 | 148 | $post_args = array( |
149 | - 'articleBody' => wp_strip_all_tags( get_the_excerpt( $post_id ) ), |
|
150 | - 'headline' => get_the_title( $post_id ), |
|
149 | + 'articleBody' => wp_strip_all_tags(get_the_excerpt($post_id)), |
|
150 | + 'headline' => get_the_title($post_id), |
|
151 | 151 | ); |
152 | - $section = get_the_term_list( $post_id, 'category' ); |
|
153 | - if ( ! is_wp_error( $section ) && '' !== $section && false !== $section ) { |
|
154 | - $post_args['articleSection'] = wp_strip_all_tags( $section ); |
|
152 | + $section = get_the_term_list($post_id, 'category'); |
|
153 | + if ( ! is_wp_error($section) && '' !== $section && false !== $section) { |
|
154 | + $post_args['articleSection'] = wp_strip_all_tags($section); |
|
155 | 155 | } |
156 | - if ( $this->context->site_represents_reference ) { |
|
156 | + if ($this->context->site_represents_reference) { |
|
157 | 157 | $post_args['publisher'] = $this->context->site_represents_reference; |
158 | 158 | } |
159 | - $image_url = get_the_post_thumbnail_url( $post_id, 'lsx-thumbnail-wide' ); |
|
160 | - if ( false !== $image_url ) { |
|
159 | + $image_url = get_the_post_thumbnail_url($post_id, 'lsx-thumbnail-wide'); |
|
160 | + if (false !== $image_url) { |
|
161 | 161 | $post_args['image'] = $image_url; |
162 | 162 | } |
163 | - $posts_array = LSX_Schema_Utils::add_article( $posts_array, $post_id, $this->context, $post_args ); |
|
163 | + $posts_array = LSX_Schema_Utils::add_article($posts_array, $post_id, $this->context, $post_args); |
|
164 | 164 | } |
165 | - if ( ! empty( $posts_array ) ) { |
|
166 | - $data[ $data_key ] = $posts_array; |
|
165 | + if ( ! empty($posts_array)) { |
|
166 | + $data[$data_key] = $posts_array; |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 | return $data; |
@@ -175,19 +175,19 @@ discard block |
||
175 | 175 | * |
176 | 176 | * @return array $data |
177 | 177 | */ |
178 | - public function add_connections( $data ) { |
|
178 | + public function add_connections($data) { |
|
179 | 179 | $connections_array = array(); |
180 | - if ( $this->is_top_level ) { |
|
181 | - $connections_array = $this->add_regions( $connections_array ); |
|
182 | - $connections_array = $this->add_accommodation( $connections_array ); |
|
183 | - if ( ! empty( $connections_array ) ) { |
|
180 | + if ($this->is_top_level) { |
|
181 | + $connections_array = $this->add_regions($connections_array); |
|
182 | + $connections_array = $this->add_accommodation($connections_array); |
|
183 | + if ( ! empty($connections_array)) { |
|
184 | 184 | $data['containsPlace'] = $connections_array; |
185 | 185 | } |
186 | 186 | } else { |
187 | - $connections_array = $this->add_countries( $connections_array ); |
|
187 | + $connections_array = $this->add_countries($connections_array); |
|
188 | 188 | $data['containedInPlace'] = $connections_array; |
189 | 189 | $connections_array = array(); |
190 | - $connections_array = $this->add_accommodation( $connections_array ); |
|
190 | + $connections_array = $this->add_accommodation($connections_array); |
|
191 | 191 | $data['containsPlace'] = $connections_array; |
192 | 192 | } |
193 | 193 | return $data; |
@@ -201,14 +201,14 @@ discard block |
||
201 | 201 | * |
202 | 202 | * @return array $data Review data. |
203 | 203 | */ |
204 | - public function add_taxonomy_terms( $data, $data_key, $taxonomy ) { |
|
204 | + public function add_taxonomy_terms($data, $data_key, $taxonomy) { |
|
205 | 205 | /** |
206 | 206 | * Filter: 'lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy' - Allow changing the taxonomy used to assign keywords to a post type Review data. |
207 | 207 | * |
208 | 208 | * @api string $taxonomy The chosen taxonomy. |
209 | 209 | */ |
210 | - $taxonomy = apply_filters( 'lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy', $taxonomy ); |
|
211 | - return LSX_Schema_Utils::add_terms( $data, $this->context->id, $data_key, $taxonomy ); |
|
210 | + $taxonomy = apply_filters('lsx_schema_' . $this->post_type . '_' . $data_key . '_taxonomy', $taxonomy); |
|
211 | + return LSX_Schema_Utils::add_terms($data, $this->context->id, $data_key, $taxonomy); |
|
212 | 212 | } |
213 | 213 | /** |
214 | 214 | * Adds the custom field value for the supplied key |
@@ -220,10 +220,10 @@ discard block |
||
220 | 220 | * |
221 | 221 | * @return array $data Review data. |
222 | 222 | */ |
223 | - public function add_custom_field( $data, $data_key, $meta_key, $single = true ) { |
|
224 | - $value = get_post_meta( $this->context->id, $meta_key, $single ); |
|
225 | - if ( '' !== $value && false !== $value ) { |
|
226 | - $data[ $data_key ] = $value; |
|
223 | + public function add_custom_field($data, $data_key, $meta_key, $single = true) { |
|
224 | + $value = get_post_meta($this->context->id, $meta_key, $single); |
|
225 | + if ('' !== $value && false !== $value) { |
|
226 | + $data[$data_key] = $value; |
|
227 | 227 | } |
228 | 228 | return $data; |
229 | 229 | } |