Make WordPress Core

Opened 3 weeks ago

Last modified 12 days ago

#62079 new defect (bug)

Twenty Fifteen : PHPCS Fixes

Reported by: pitamdey's profile pitamdey Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: has-patch 2nd-opinion
Focuses: docs, coding-standards Cc:

Description

In theme Twenty-Fifteen, I can see there are a few PHPCS errors, so I have applied an patch to fix it.

Attachments (2)

phpcs-fixes.patch (10.3 KB) - added by pitamdey 3 weeks ago.
Patch for this issue
62079.docs.patch (539 bytes) - added by sabernhardt 3 weeks ago.
adds only the param documentation for twentyfifteen_excerpt_more()

Download all attachments as: .zip

Change History (6)

@pitamdey
3 weeks ago

Patch for this issue

#1 @sabernhardt
3 weeks ago

  • Focuses docs coding-standards added
  • Keywords 2nd-opinion added

The patch proposes many changes:

  • adds a param note in the twentyfifteen_excerpt_more() docblock
  • escapes 21 translations
  • escapes number_format_i18n() in the comments template
  • escapes $GLOBALS['wp_version'] in back-compat.php functions
  • escapes multiple items in twentyfifteen_entry_meta()
    1. get_post_format_string(), which returns a translation
    2. $categories_list and $tags_list (TT1 does not escape taxonomy lists)
    3. width and height for the full size attachment link (TT1 uses absint() in its image template)

I do not recommend all the escaping for (only) this theme.

Core translations are trusted (ticket:58127#comment:1), and #30724 specifically removed escaping functions for Twenty Fifteen's translations. If that policy ever changes for bundled themes before Twenty Twenty-One, that effort could have one ticket for all the themes.

For future reference, note that _e() would need to be replaced with esc_html_e(), not esc_html__() (404.php template).

The twentyfifteen_excerpt_more() function should document the $more parameter, and I like the similar description in Twenty Fourteen and Twenty Thirteen:

	 * @param string $more Default Read More excerpt link.

@sabernhardt
3 weeks ago

adds only the param documentation for twentyfifteen_excerpt_more()

#2 @SergeyBiryukov
2 weeks ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 6.7

Hi there, thanks for the ticket!

It appears that while the other changes could use some more discussion, 62079.docs.patch is ready for commit.

#3 @SergeyBiryukov
12 days ago

In 59110:

Twenty Fifteen: Document the $more parameter in twentyfifteen_excerpt_more().

Follow-up to [30237], [30569].

Props pitamdey, sabernhardt.
See #62079.

#4 @SergeyBiryukov
12 days ago

  • Keywords commit removed
  • Milestone changed from 6.7 to Awaiting Review

Moving back to Awaiting Review for the other changes here, as per comment:1.

Note: See TracTickets for help on using tickets.