Passed
Push — dev ( 552ebc...9b9f09 )
by Eric
02:24
created

bitsy_left_sidebar()   B

Complexity

Conditions 6
Paths 3

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
cc 6
eloc 4
nc 3
nop 0
dl 6
loc 6
rs 8.8571
c 0
b 0
f 0
1
<?php
2
/**
3
 * Custom template tags for this theme
4
 *
5
 * Eventually, some of the functionality here could be replaced by core features.
6
 *
7
 * @package bitsy
8
 */
9
10 View Code Duplication
if ( ! function_exists( 'bitsy_posted_on' ) ) :
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
	/**
12
	 * Prints HTML with meta information for the current post-date/time and author.
13
	 */
14
	function bitsy_posted_on() {
15
		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
16
		if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
2 ignored issues
show
Bug introduced by
The function get_the_modified_time was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
		if ( get_the_time( 'U' ) !== /** @scrutinizer ignore-call */ get_the_modified_time( 'U' ) ) {
Loading history...
Bug introduced by
The function get_the_time was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
		if ( /** @scrutinizer ignore-call */ get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
Loading history...
17
			$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
18
		}
19
20
		$time_string = sprintf( $time_string,
21
			esc_attr( get_the_date( 'c' ) ),
2 ignored issues
show
Bug introduced by
The function esc_attr was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
			/** @scrutinizer ignore-call */ 
22
   esc_attr( get_the_date( 'c' ) ),
Loading history...
Bug introduced by
The function get_the_date was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

21
			esc_attr( /** @scrutinizer ignore-call */ get_the_date( 'c' ) ),
Loading history...
22
			esc_html( get_the_date() ),
1 ignored issue
show
Bug introduced by
The function esc_html was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

22
			/** @scrutinizer ignore-call */ 
23
   esc_html( get_the_date() ),
Loading history...
23
			esc_attr( get_the_modified_date( 'c' ) ),
1 ignored issue
show
Bug introduced by
The function get_the_modified_date was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
			esc_attr( /** @scrutinizer ignore-call */ get_the_modified_date( 'c' ) ),
Loading history...
24
			esc_html( get_the_modified_date() )
25
		);
26
27
		$posted_on = sprintf(
28
		/* translators: %s: post date. */
29
			esc_html_x( 'Posted on %s', 'post date', 'bitsy' ),
1 ignored issue
show
Bug introduced by
The function esc_html_x was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
			/** @scrutinizer ignore-call */ 
30
   esc_html_x( 'Posted on %s', 'post date', 'bitsy' ),
Loading history...
30
			'<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
2 ignored issues
show
Bug introduced by
The function get_permalink was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
			'<a href="' . esc_url( /** @scrutinizer ignore-call */ get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
Loading history...
Bug introduced by
The function esc_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
			'<a href="' . /** @scrutinizer ignore-call */ esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
Loading history...
31
		);
32
33
		$byline = sprintf(
34
		/* translators: %s: post author. */
35
			esc_html_x( 'by %s', 'post author', 'bitsy' ),
36
			'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
3 ignored issues
show
Bug introduced by
The function get_the_author was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
			'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( /** @scrutinizer ignore-call */ get_the_author() ) . '</a></span>'
Loading history...
Bug introduced by
The function get_the_author_meta was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
			'<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( /** @scrutinizer ignore-call */ get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
Loading history...
Bug introduced by
The function get_author_posts_url was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

36
			'<span class="author vcard"><a class="url fn n" href="' . esc_url( /** @scrutinizer ignore-call */ get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
Loading history...
37
		);
38
39
		echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK.
40
41
	}
42
endif;
43
44
if ( ! function_exists( 'bitsy_entry_footer' ) ) :
45
	/**
46
	 * Prints HTML with meta information for the categories, tags and comments.
47
	 */
48
	function bitsy_entry_footer() {
49
		// Hide category and tag text for pages.
50
		if ( 'post' === get_post_type() ) {
1 ignored issue
show
Bug introduced by
The function get_post_type was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
		if ( 'post' === /** @scrutinizer ignore-call */ get_post_type() ) {
Loading history...
51
			/* translators: used between list items, there is a space after the comma */
52
			$categories_list = get_the_category_list( esc_html__( ', ', 'bitsy' ) );
2 ignored issues
show
Bug introduced by
The function get_the_category_list was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
			$categories_list = /** @scrutinizer ignore-call */ get_the_category_list( esc_html__( ', ', 'bitsy' ) );
Loading history...
Bug introduced by
The function esc_html__ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

52
			$categories_list = get_the_category_list( /** @scrutinizer ignore-call */ esc_html__( ', ', 'bitsy' ) );
Loading history...
53
			if ( $categories_list ) {
54
				/* translators: 1: list of categories. */
55
				printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'bitsy' ) . '</span>', $categories_list ); // WPCS: XSS OK.
56
			}
57
58
			/* translators: used between list items, there is a space after the comma */
59
			$tags_list = get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'bitsy' ) );
2 ignored issues
show
Bug introduced by
The function esc_html_x was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
			$tags_list = get_the_tag_list( '', /** @scrutinizer ignore-call */ esc_html_x( ', ', 'list item separator', 'bitsy' ) );
Loading history...
Bug introduced by
The function get_the_tag_list was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
			$tags_list = /** @scrutinizer ignore-call */ get_the_tag_list( '', esc_html_x( ', ', 'list item separator', 'bitsy' ) );
Loading history...
60
			if ( $tags_list ) {
61
				/* translators: 1: list of tags. */
62
				printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'bitsy' ) . '</span>', $tags_list ); // WPCS: XSS OK.
63
			}
64
		}
65
66
		if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
3 ignored issues
show
Bug introduced by
The function comments_open was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

66
		if ( ! is_single() && ! post_password_required() && ( /** @scrutinizer ignore-call */ comments_open() || get_comments_number() ) ) {
Loading history...
Bug introduced by
The function get_comments_number was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

66
		if ( ! is_single() && ! post_password_required() && ( comments_open() || /** @scrutinizer ignore-call */ get_comments_number() ) ) {
Loading history...
Bug introduced by
The function post_password_required was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

66
		if ( ! is_single() && ! /** @scrutinizer ignore-call */ post_password_required() && ( comments_open() || get_comments_number() ) ) {
Loading history...
67
			echo '<span class="comments-link">';
68
			comments_popup_link(
1 ignored issue
show
Bug introduced by
The function comments_popup_link was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

68
			/** @scrutinizer ignore-call */ 
69
   comments_popup_link(
Loading history...
69
				sprintf(
70
					wp_kses(
1 ignored issue
show
Bug introduced by
The function wp_kses was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

70
					/** @scrutinizer ignore-call */ 
71
     wp_kses(
Loading history...
71
					/* translators: %s: post title */
72
						__( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'bitsy' ),
1 ignored issue
show
Bug introduced by
The function __ was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

72
						/** @scrutinizer ignore-call */ 
73
      __( 'Leave a Comment<span class="screen-reader-text"> on %s</span>', 'bitsy' ),
Loading history...
73
						array(
74
							'span' => array(
75
								'class' => array(),
76
							),
77
						)
78
					),
79
					get_the_title()
1 ignored issue
show
Bug introduced by
The function get_the_title was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

79
					/** @scrutinizer ignore-call */ 
80
     get_the_title()
Loading history...
80
				)
81
			);
82
			echo '</span>';
83
		}
84
85
		edit_post_link(
1 ignored issue
show
Bug introduced by
The function edit_post_link was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

85
		/** @scrutinizer ignore-call */ 
86
  edit_post_link(
Loading history...
86
			sprintf(
87
				wp_kses(
88
				/* translators: %s: Name of current post. Only visible to screen readers */
89
					__( 'Edit <span class="screen-reader-text">%s</span>', 'bitsy' ),
90
					array(
91
						'span' => array(
92
							'class' => array(),
93
						),
94
					)
95
				),
96
				get_the_title()
97
			),
98
			'<span class="edit-link">',
99
			'</span>'
100
		);
101
	}
102
endif;
103
104
/**
105
 * Returns true if a blog has more than 1 category.
106
 *
107
 * @return bool
108
 */
109
function bitsy_categorized_blog() {
110
	if ( false === ( $all_the_cool_cats = get_transient( 'bitsy_categories' ) ) ) {
1 ignored issue
show
Bug introduced by
The function get_transient was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

110
	if ( false === ( $all_the_cool_cats = /** @scrutinizer ignore-call */ get_transient( 'bitsy_categories' ) ) ) {
Loading history...
111
		// Create an array of all the categories that are attached to posts.
112
		$all_the_cool_cats = get_categories( array(
1 ignored issue
show
Bug introduced by
The function get_categories was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

112
		$all_the_cool_cats = /** @scrutinizer ignore-call */ get_categories( array(
Loading history...
113
			'fields'     => 'ids',
114
			'hide_empty' => 1,
115
			// We only need to know if there is more than one category.
116
			'number'     => 2,
117
		) );
118
		// Count the number of categories that are attached to the posts.
119
		$all_the_cool_cats = count( $all_the_cool_cats );
120
		set_transient( 'bitsy_categories', $all_the_cool_cats );
1 ignored issue
show
Bug introduced by
The function set_transient was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

120
		/** @scrutinizer ignore-call */ 
121
  set_transient( 'bitsy_categories', $all_the_cool_cats );
Loading history...
121
	}
122
	if ( $all_the_cool_cats > 1 ) {
123
		// This blog has more than 1 category so components_categorized_blog should return true.
124
		return true;
125
	} else {
126
		// This blog has only 1 category so components_categorized_blog should return false.
127
		return false;
128
	}
129
}
130
131
/**
132
 * Flush out the transients used in bitsy_categorized_blog.
133
 */
134
function bitsy_category_transient_flusher() {
135
	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
1 ignored issue
show
Bug introduced by
The constant DOING_AUTOSAVE was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
136
		return;
137
	}
138
	// Like, beat it. Dig?
139
	delete_transient( 'bitsy_categories' );
1 ignored issue
show
Bug introduced by
The function delete_transient was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

139
	/** @scrutinizer ignore-call */ 
140
 delete_transient( 'bitsy_categories' );
Loading history...
140
}
141
142
add_action( 'edit_category', 'bitsy_category_transient_flusher' );
1 ignored issue
show
Bug introduced by
The function add_action was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

142
/** @scrutinizer ignore-call */ 
143
add_action( 'edit_category', 'bitsy_category_transient_flusher' );
Loading history...
143
add_action( 'save_post', 'bitsy_category_transient_flusher' );
144
145
/**
146
 * Left sidebar loading logic
147
 */
148 View Code Duplication
if ( ! function_exists( 'bitsy_left_sidebar' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
149
150
	function bitsy_left_sidebar() {
151
		$sidebar_position = get_theme_mod( 'bitsy_sidebar_position' );
1 ignored issue
show
Bug introduced by
The function get_theme_mod was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

151
		$sidebar_position = /** @scrutinizer ignore-call */ get_theme_mod( 'bitsy_sidebar_position' );
Loading history...
152
153
		if ( ! is_page_template( 'page-templates/full-width.php' ) ) {
1 ignored issue
show
Bug introduced by
The function is_page_template was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

153
		if ( ! /** @scrutinizer ignore-call */ is_page_template( 'page-templates/full-width.php' ) ) {
Loading history...
154
			if ( is_page_template( 'page-templates/left-sidebar.php' ) || is_page_template( 'page-templates/both-sidebars.php' ) || 'left' === $sidebar_position || 'both' === $sidebar_position ) {
155
				get_sidebar( 'left' );
1 ignored issue
show
Bug introduced by
The function get_sidebar was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

155
				/** @scrutinizer ignore-call */ 
156
    get_sidebar( 'left' );
Loading history...
156
			}
157
		}
158
	}
159
160
}
161
162
/**
163
 * Right sidebar loading logic
164
 */
165 View Code Duplication
if ( ! function_exists( 'bitsy_right_sidebar' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
166
167
	function bitsy_right_sidebar() {
168
		$sidebar_position = get_theme_mod( 'bitsy_sidebar_position' );
1 ignored issue
show
Bug introduced by
The function get_theme_mod was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

168
		$sidebar_position = /** @scrutinizer ignore-call */ get_theme_mod( 'bitsy_sidebar_position' );
Loading history...
169
170
		if ( ! is_page_template( 'page-templates/full-width.php' ) ) {
1 ignored issue
show
Bug introduced by
The function is_page_template was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

170
		if ( ! /** @scrutinizer ignore-call */ is_page_template( 'page-templates/full-width.php' ) ) {
Loading history...
171
			if ( is_page_template( 'page-templates/right-sidebar.php' ) || is_page_template( 'page-templates/both-sidebars.php' ) || 'right' === $sidebar_position || 'both' === $sidebar_position ) {
172
				get_sidebar( 'right' );
1 ignored issue
show
Bug introduced by
The function get_sidebar was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

172
				/** @scrutinizer ignore-call */ 
173
    get_sidebar( 'right' );
Loading history...
173
			}
174
		}
175
	}
176
177
}
178
179
/**
180
 * Content classes loading logic
181
 */
182
if ( ! function_exists( 'bitsy_content_classes' ) ) {
183
184
	/**
185
	 * Prints classes for content area div depending on active sidebars.
186
	 *
187
	 * Usage add this function between the class quotes like so
188
	 *      <div class="<?php bitsy_content_classes(); ?>" id="primary">
189
	 */
190
	function bitsy_content_classes() {
191
		$sidebar_position = get_theme_mod( 'bitsy_sidebar_position' );
1 ignored issue
show
Bug introduced by
The function get_theme_mod was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

191
		$sidebar_position = /** @scrutinizer ignore-call */ get_theme_mod( 'bitsy_sidebar_position' );
Loading history...
192
		$html             = '';
193
194
		if ( is_page_template( 'page-templates/left-sidebar.php' ) && is_active_sidebar( 'left-sidebar' ) ) {
2 ignored issues
show
Bug introduced by
The function is_page_template was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

194
		if ( /** @scrutinizer ignore-call */ is_page_template( 'page-templates/left-sidebar.php' ) && is_active_sidebar( 'left-sidebar' ) ) {
Loading history...
Bug introduced by
The function is_active_sidebar was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

194
		if ( is_page_template( 'page-templates/left-sidebar.php' ) && /** @scrutinizer ignore-call */ is_active_sidebar( 'left-sidebar' ) ) {
Loading history...
195
			$html .= 'left-sidebar-template 8u 12u(small) content-area';
196
			echo $html; // WPCS: XSS OK.
197
198
		} elseif ( is_page_template( 'page-templates/right-sidebar.php' ) && is_active_sidebar( 'right-sidebar' ) ) {
199
			$html .= 'right-sidebar-template 8u 12u(small) content-area';
200
			echo $html; // WPCS: XSS OK.
201
202 View Code Duplication
		} elseif ( is_page_template( 'page-templates/both-sidebars.php' ) && ( is_active_sidebar( 'left-sidebar' ) ) && is_active_sidebar( 'right-sidebar' ) ) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
203
			$html .= 'both-sidebar-template 6u 12u(small) content-area';
204
			echo $html; // WPCS: XSS OK.
205
206
		} elseif ( is_page_template( 'page-templates/full-width.php' ) ) {
207
			$html .= 'full-width-template 12u content-area';
208
			echo $html; // WPCS: XSS OK.
209
210
		} elseif ( 'right' === $sidebar_position || 'left' === $sidebar_position ) {
211
212
			if ( is_active_sidebar( 'right-sidebar' ) || is_active_sidebar( 'left-sidebar' ) ) {
213
				$html .= '8u 12u(small) content-area';
214
			} else {
215
				$html .= '12u content-area';
216
			}
217
			echo $html; // WPCS: XSS OK.
218
219
		} elseif ( is_active_sidebar( 'right-sidebar' ) && is_active_sidebar( 'left-sidebar' ) ) {
220
			$html = '';
221
			if ( 'both' === $sidebar_position ) {
222
				$html .= '6u 12u(small) content-area';
223
			} else {
224
				$html .= '12u content-area';
225
			}
226
			echo $html; // WPCS: XSS OK.
227
228
		} else {
229
			echo '12u content-area';
230
		}
231
	}
232
}
233
234
/**
235
 * Sidebar classes
236
 */
237
if ( ! function_exists( 'bitsy_sidebar_classes' ) ) {
238
239
	/**
240
	 * Prints classes for sidebars area div depending on active sidebars.
241
	 *
242
	 * Add this function between the class quotes like so
243
	 *      <div class="<?php bitsy_sidebar_classes(); ?>">
244
	 */
245
	function bitsy_sidebar_classes() {
246
		$sidebar_position = get_theme_mod( 'bitsy_sidebar_position' );
1 ignored issue
show
Bug introduced by
The function get_theme_mod was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

246
		$sidebar_position = /** @scrutinizer ignore-call */ get_theme_mod( 'bitsy_sidebar_position' );
Loading history...
247
		$html = '';
248
249
		if ( is_page_template( 'page-templates/both-sidebars.php' ) && ( is_active_sidebar( 'left-sidebar' ) ) && is_active_sidebar( 'right-sidebar' ) ) {
2 ignored issues
show
Bug introduced by
The function is_page_template was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

249
		if ( /** @scrutinizer ignore-call */ is_page_template( 'page-templates/both-sidebars.php' ) && ( is_active_sidebar( 'left-sidebar' ) ) && is_active_sidebar( 'right-sidebar' ) ) {
Loading history...
Bug introduced by
The function is_active_sidebar was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

249
		if ( is_page_template( 'page-templates/both-sidebars.php' ) && ( /** @scrutinizer ignore-call */ is_active_sidebar( 'left-sidebar' ) ) && is_active_sidebar( 'right-sidebar' ) ) {
Loading history...
250
			$html .= '3u 12u(small) widget-area';
251
			echo $html; // WPCS: XSS OK.
252 View Code Duplication
		} elseif ( ( is_page_template( 'page-templates/left-sidebar.php' ) && is_active_sidebar( 'left-sidebar' ) ) ||
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
253
		           ( is_page_template( 'page-templates/right-sidebar.php' ) && is_active_sidebar( 'right-sidebar' ) ) ) {
254
			$html .= '4u 12u(small) widget-area';
255
			echo $html; // WPCS: XSS OK.
256
		} elseif ( ( 'right' === $sidebar_position || 'left' === $sidebar_position ) && ( is_active_sidebar( 'right-sidebar' ) || is_active_sidebar( 'left-sidebar' ) ) ) {
257
			$html .= '4u 12u(small) content-area';
258
			echo $html; // WPCS: XSS OK.
259
		} elseif ( ( 'both' === $sidebar_position ) && ( is_active_sidebar( 'right-sidebar' ) && is_active_sidebar( 'left-sidebar' ) ) ) {
260
			$html .= '3u 12u(small) content-area';
261
			echo $html; // WPCS: XSS OK.
262
		} else {
263
			$html .= '12u widget-area';
264
			echo $html; // WPCS: XSS OK.
265
		}
266
	}
267
268
}
269
270
271
272
273