Completed
Push — master ( 848746...1d9c94 )
by SILENT
02:27
created
inc/template-tags.php 1 patch
Spacing   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -12,88 +12,88 @@  discard block
 block discarded – undo
12 12
  * Add custom header image to header area
13 13
  */
14 14
 function strip_header_background() {
15
-	if ( get_header_image() ) {
16
-		$css = '.site-branding { background-image: url(' . esc_url( get_header_image() ) . '); }';
17
-		wp_add_inline_style( 'strip-style', $css );
15
+	if (get_header_image()) {
16
+		$css = '.site-branding { background-image: url(' . esc_url(get_header_image()) . '); }';
17
+		wp_add_inline_style('strip-style', $css);
18 18
 	}
19 19
 }
20
-add_action( 'wp_enqueue_scripts', 'strip_header_background', 11 );
20
+add_action('wp_enqueue_scripts', 'strip_header_background', 11);
21 21
 
22
-if ( ! function_exists( 'strip_content_nav' ) ) :
22
+if ( ! function_exists('strip_content_nav')) :
23 23
 
24 24
 	/**
25 25
 	 * Display navigation to next/previous pages when applicable
26 26
 	 *
27 27
 	 * @param array $nav_id strip_content_nav.
28 28
 	 */
29
-	function strip_content_nav( $nav_id ) {
29
+	function strip_content_nav($nav_id) {
30 30
 
31
-		$nav_class = ( is_single() || is_post_type( 'comic' ) ) ? 'post-navigation' : 'paging-navigation' ;
31
+		$nav_class = (is_single() || is_post_type('comic')) ? 'post-navigation' : 'paging-navigation';
32 32
 
33 33
 		?> <div class="wrap clear">
34 34
 
35
-		<nav role="navigation" id="<?php echo esc_attr( $nav_id ); ?>" class="<?php echo esc_attr( $nav_class ); ?> clear">
36
-		<h1 class="screen-reader-text"><?php esc_html_e( 'Post navigation', 'strip' ); ?></h1>
35
+		<nav role="navigation" id="<?php echo esc_attr($nav_id); ?>" class="<?php echo esc_attr($nav_class); ?> clear">
36
+		<h1 class="screen-reader-text"><?php esc_html_e('Post navigation', 'strip'); ?></h1>
37 37
 
38
-		<?php  if ( 'comic' === get_post_type() && ( is_single() ) ) : // comics navigation links.
38
+		<?php  if ('comic' === get_post_type() && (is_single())) : // comics navigation links.
39 39
 
40 40
 			$nav_class .= ' navigation-comic'; ?>
41 41
 
42 42
 				<div class="navigation-comic">
43
-				<nav class="nav-first"><a href="<?php echo esc_url( first_comic_link() ); ?>"><?php esc_html_e( 'Start', 'strip' ); ?></a></nav>
44
-				<nav class="nav-previous"><?php previous_post_link( '%link', __( 'Previous', 'strip' ), true, '', 'story' ); ?></nav>
45
-				<nav class="nav-title"><?php the_title( '<h4 class="series-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h4>' ); ?></nav>
46
-				<nav class="nav-next"><?php next_post_link( '%link', __( 'Next', 'strip' ), true, '', 'story' ); ?></nav>
47
-				<nav class="nav-last"><a href="<?php echo esc_url( last_comic_link() ); ?>"><?php esc_html_e( 'Last', 'strip' ); ?></a></nav>
43
+				<nav class="nav-first"><a href="<?php echo esc_url(first_comic_link()); ?>"><?php esc_html_e('Start', 'strip'); ?></a></nav>
44
+				<nav class="nav-previous"><?php previous_post_link('%link', __('Previous', 'strip'), true, '', 'story'); ?></nav>
45
+				<nav class="nav-title"><?php the_title('<h4 class="series-title"><a href="' . esc_url(get_permalink()) . '" rel="bookmark">', '</a></h4>'); ?></nav>
46
+				<nav class="nav-next"><?php next_post_link('%link', __('Next', 'strip'), true, '', 'story'); ?></nav>
47
+				<nav class="nav-last"><a href="<?php echo esc_url(last_comic_link()); ?>"><?php esc_html_e('Last', 'strip'); ?></a></nav>
48 48
 			</div><!-- .navigation-comic -->
49 49
 
50
-		<?php elseif ( is_single() ) : // navigation links for single posts. ?>
50
+		<?php elseif (is_single()) : // navigation links for single posts. ?>
51 51
 
52
-		<?php previous_post_link( '<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x( '&#8592;', 'Previous post link', 'strip' ) . '</span> %title' ); ?>
53
-		<?php next_post_link( '<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x( '&#8594;', 'Next post link', 'strip' ) . '</span>' ); ?>
52
+		<?php previous_post_link('<div class="nav-previous">%link</div>', '<span class="meta-nav">' . _x('&#8592;', 'Previous post link', 'strip') . '</span> %title'); ?>
53
+		<?php next_post_link('<div class="nav-next">%link</div>', '%title <span class="meta-nav">' . _x('&#8594;', 'Next post link', 'strip') . '</span>'); ?>
54 54
 
55 55
 		<?php endif; ?>
56 56
 
57 57
 				</div><!-- .entry-wrap -->
58
-			</nav><!-- #<?php echo esc_attr( $nav_id ); ?> -->
58
+			</nav><!-- #<?php echo esc_attr($nav_id); ?> -->
59 59
 			<?php
60 60
 	}
61 61
 endif; // strip_content_nav.
62 62
 
63
-if ( ! function_exists( 'strip_entry_meta' ) ) :
63
+if ( ! function_exists('strip_entry_meta')) :
64 64
 	/**
65 65
 	 * Prints HTML with meta information for the current post-date/time and author.
66 66
 	 */
67 67
 	function strip_entry_meta() {
68
-		if ( is_sticky() && is_home() ) {
68
+		if (is_sticky() && is_home()) {
69 69
 			printf(
70
-				wp_kses( '<span class="featured-post"><a href="%1$s" title="%2$s" rel="bookmark">Sticky</a></span>', 'strip' ),
71
-				esc_url( get_permalink() ),
72
-				esc_attr( get_the_time() )
70
+				wp_kses('<span class="featured-post"><a href="%1$s" title="%2$s" rel="bookmark">Sticky</a></span>', 'strip'),
71
+				esc_url(get_permalink()),
72
+				esc_attr(get_the_time())
73 73
 			);
74 74
 		}
75 75
 
76
-		if ( 'post' === get_post_type() ) {
76
+		if ('post' === get_post_type()) {
77 77
 			printf(
78
-				wp_kses_post( '<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a></span><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span>', 'strip' ),
79
-				esc_url( get_permalink() ),
80
-				esc_attr( get_the_time() ),
81
-				esc_attr( get_the_date( 'c' ) ),
78
+				wp_kses_post('<span class="entry-date"><a href="%1$s" title="%2$s" rel="bookmark"><time datetime="%3$s">%4$s</time></a></span><span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span>', 'strip'),
79
+				esc_url(get_permalink()),
80
+				esc_attr(get_the_time()),
81
+				esc_attr(get_the_date('c')),
82 82
 				get_the_date(),
83
-				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
84
-				esc_attr( sprintf( __( 'View all posts by %s', 'strip' ), get_the_author() ) ),
83
+				esc_url(get_author_posts_url(get_the_author_meta('ID'))),
84
+				esc_attr(sprintf(__('View all posts by %s', 'strip'), get_the_author())),
85 85
 				get_the_author()
86 86
 			);
87 87
 		}
88 88
 
89
-		$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'strip' ) );
90
-		if ( $tags_list ) {
91
-			printf( '<span class="tags-links">' . esc_html( '%1$s', 'strip' ) . '</span>', $tags_list ); // WPCS: XSS OK.
89
+		$tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'strip'));
90
+		if ($tags_list) {
91
+			printf('<span class="tags-links">' . esc_html('%1$s', 'strip') . '</span>', $tags_list); // WPCS: XSS OK.
92 92
 		}
93 93
 	}
94 94
 endif;
95 95
 
96
-if ( ! function_exists( 'strip_term_description' ) ) :
96
+if ( ! function_exists('strip_term_description')) :
97 97
 	/**
98 98
 	 * Display optional term description for category, tag and custom taxonomy pages.
99 99
 	 *
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		// Show an optional term description.
104 104
 		$term_description = term_description();
105 105
 
106
-		if ( is_post_type_archive( 'comic' ) || is_category() || is_tag() || is_tax( 'story' ) && ! empty( $term_description ) ) :
107
-			printf( '<div class="taxonomy-description">%s</div>', $term_description, 'strip' ); // WPCS: XSS OK.
106
+		if (is_post_type_archive('comic') || is_category() || is_tag() || is_tax('story') && ! empty($term_description)) :
107
+			printf('<div class="taxonomy-description">%s</div>', $term_description, 'strip'); // WPCS: XSS OK.
108 108
 			endif;
109 109
 	}
110 110
 endif; // ends check for strip_term_description.
@@ -115,25 +115,25 @@  discard block
 block discarded – undo
115 115
  * @return bool
116 116
  */
117 117
 function strip_categorized_blog() {
118
-	$category_count = get_transient( 'strip_categories' );
118
+	$category_count = get_transient('strip_categories');
119 119
 
120
-	if ( false === $category_count ) {
120
+	if (false === $category_count) {
121 121
 		// Create an array of all the categories that are attached to posts.
122
-		$categories = get_categories( array(
122
+		$categories = get_categories(array(
123 123
 			'fields'     => 'ids',
124 124
 			'hide_empty' => 1,
125 125
 			// We only need to know if there is more than one category.
126 126
 			'number'     => 2,
127
-		) );
127
+		));
128 128
 
129 129
 		// Count the number of categories that are attached to the posts.
130
-		$category_count = count( $categories );
130
+		$category_count = count($categories);
131 131
 
132
-		set_transient( 'strip_categories', $category_count );
132
+		set_transient('strip_categories', $category_count);
133 133
 	}
134 134
 
135 135
 	// Allow viewing case of 0 or 1 categories in post preview.
136
-	if ( is_preview() ) {
136
+	if (is_preview()) {
137 137
 		return true;
138 138
 	}
139 139
 
@@ -145,16 +145,16 @@  discard block
 block discarded – undo
145 145
  * Flush out the transients used in strip_categorized_blog.
146 146
  */
147 147
 function strip_category_transient_flusher() {
148
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
148
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
149 149
 		return;
150 150
 	}
151 151
 	// Like, beat it. Dig?
152
-	delete_transient( 'strip_categories' );
152
+	delete_transient('strip_categories');
153 153
 }
154
-add_action( 'edit_category', 'strip_category_transient_flusher' );
155
-add_action( 'save_post',     'strip_category_transient_flusher' );
154
+add_action('edit_category', 'strip_category_transient_flusher');
155
+add_action('save_post', 'strip_category_transient_flusher');
156 156
 
157
-if ( ! function_exists( 'strip_the_custom_logo' ) ) :
157
+if ( ! function_exists('strip_the_custom_logo')) :
158 158
 	/**
159 159
 	 * Displays the optional custom logo.
160 160
 	 *
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	 * @since strip 1.0
164 164
 	 */
165 165
 	function strip_the_custom_logo() {
166
-		if ( function_exists( 'the_custom_logo' ) ) {
166
+		if (function_exists('the_custom_logo')) {
167 167
 			the_custom_logo();
168 168
 		}
169 169
 	}
@@ -179,10 +179,10 @@  discard block
 block discarded – undo
179 179
  * @param string $taxonomy       Optional. Taxonomy, if $in_same_term is true. Default 'category'.
180 180
  * @return mixed Array containing the boundary post object if successful, null otherwise.
181 181
  */
182
-function get_comic_boundary_post( $in_same_term = false, $start = true, $taxonomy = 'category' ) {
182
+function get_comic_boundary_post($in_same_term = false, $start = true, $taxonomy = 'category') {
183 183
 	global $post;
184
-	setup_postdata( $post );
185
-	if ( ! taxonomy_exists( $taxonomy ) ) {
184
+	setup_postdata($post);
185
+	if ( ! taxonomy_exists($taxonomy)) {
186 186
 		return null;
187 187
 	}
188 188
 
@@ -196,37 +196,37 @@  discard block
 block discarded – undo
196 196
 	);
197 197
 
198 198
 	$term_array = array();
199
-	if ( $in_same_term ) {
200
-		if ( $in_same_term ) {
201
-			$term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
199
+	if ($in_same_term) {
200
+		if ($in_same_term) {
201
+			$term_array = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'ids'));
202 202
 		}
203
-		$query_args['tax_query'] = array( array(
203
+		$query_args['tax_query'] = array(array(
204 204
 			'taxonomy' => $taxonomy,
205
-			'terms' => array_merge( $term_array ),
205
+			'terms' => array_merge($term_array),
206 206
 		),
207 207
 		);
208 208
 	}
209 209
 
210 210
 	$get_posts = new wp_query;
211
-	return $get_posts -> query( $query_args );
211
+	return $get_posts -> query($query_args);
212 212
 }
213 213
 
214 214
 /**
215 215
  * Link to the first comic post in same term
216 216
  */
217 217
 function first_comic_link() {
218
-	$first = get_comic_boundary_post( true, true, 'story' );
219
-	apply_filters( 'the_title', $first[0]->post_title );
218
+	$first = get_comic_boundary_post(true, true, 'story');
219
+	apply_filters('the_title', $first[0]->post_title);
220 220
 
221
-	echo esc_html( get_permalink( $first[0]->ID ) );
221
+	echo esc_html(get_permalink($first[0]->ID));
222 222
 }
223 223
 
224 224
 /**
225 225
  * Link to the last comic post in same term
226 226
  */
227 227
 function last_comic_link() {
228
-	$last = get_comic_boundary_post( true, false, 'story' );
229
-	apply_filters( 'the_title', $last[0]->post_title );
228
+	$last = get_comic_boundary_post(true, false, 'story');
229
+	apply_filters('the_title', $last[0]->post_title);
230 230
 
231
-	echo esc_html( get_permalink( $last[0]->ID ) );
231
+	echo esc_html(get_permalink($last[0]->ID));
232 232
 }
Please login to merge, or discard this patch.