Passed
Push — dev ( 750e95...fb5225 )
by Eric
02:29
created

_s_entry_footer()   C

Complexity

Conditions 8
Paths 10

Size

Total Lines 52
Code Lines 28

Duplication

Lines 52
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 8
eloc 28
nc 10
nop 0
dl 52
loc 52
rs 6.8493
c 1
b 0
f 1

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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 _s
8
 */
9
10 View Code Duplication
if ( ! function_exists( '_s_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 _s_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', '_s' ),
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', '_s' ),
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', '_s' ),
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 View Code Duplication
if ( ! function_exists( '_s_entry_footer' ) ) :
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...
45
	/**
46
	 * Prints HTML with meta information for the categories, tags and comments.
47
	 */
48
	function _s_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__( ', ', '_s' ) );
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__( ', ', '_s' ) );
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__( ', ', '_s' ) );
Loading history...
53
			if ( $categories_list ) {
54
				/* translators: 1: list of categories. */
55
				printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', '_s' ) . '</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', '_s' ) );
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', '_s' ) );
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', '_s' ) );
Loading history...
60
			if ( $tags_list ) {
61
				/* translators: 1: list of tags. */
62
				printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', '_s' ) . '</span>', $tags_list ); // WPCS: XSS OK.
63
			}
64
		}
65
66
		if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
4 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 is_single 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 ( ! /** @scrutinizer ignore-call */ is_single() && ! post_password_required() && ( comments_open() || 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>', '_s' ),
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>', '_s' ),
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>', '_s' ),
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