Make WordPress Core

Opened 11 years ago

Closed 11 years ago

#27181 closed enhancement (fixed)

get_the_date() - useless var and concatenation

Reported by: juliobox's profile juliobox Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 3.9 Priority: low
Severity: trivial Version: 3.0
Component: Date/Time Keywords: has-patch commit
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Hello

Function get_the_date():

function get_the_date( $d = '' ) {
	        $post = get_post();
	        $the_date = '';

	        if ( '' == $d )
	                $the_date .= mysql2date(get_option('date_format'), $post->post_date);
	        else
	                $the_date .= mysql2date($d, $post->post_date);
	
	        return apply_filters('get_the_date', $the_date, $d);
	}

$the_date = ''; is useless.

So the 2 .= are useless too.

My 2 cents ;)

Attachments (4)

27181.patch (1.3 KB) - added by SergeyBiryukov 11 years ago.
27181.2.patch (1001 bytes) - added by TobiasBg 11 years ago.
Simplify/Cleanup get_the_date() and fix return type
27181.3.patch (925 bytes) - added by TobiasBg 11 years ago.
27181.4.patch (596 bytes) - added by TobiasBg 11 years ago.
Just the docs change

Download all attachments as: .zip

Change History (12)

#1 @SergeyBiryukov
11 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
11 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 3.9
  • Priority changed from normal to low
  • Severity changed from normal to trivial

#3 @juliobox
11 years ago

Thank you Sergey!

#4 @SergeyBiryukov
11 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 27230:

Remove unnecessary assignment and concatenation from the_date() and get_the_date().

props juliobox.
fixes #27181.

@TobiasBg
11 years ago

Simplify/Cleanup get_the_date() and fix return type

#5 @TobiasBg
11 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Argh, I'm too slow today :-) I had a slightly different simplification, but that's ok.
We might however as well fix the inline docs of get_the_date() while working on it.

#6 @SergeyBiryukov
11 years ago

27181.2.patch would change the $d value passed to the filter, but the docs fix looks good.

@TobiasBg
11 years ago

#7 @TobiasBg
11 years ago

Good call there... Scratch that code change then.

@TobiasBg
11 years ago

Just the docs change

#8 @SergeyBiryukov
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 27231:

Correct @return value for get_the_date().

props TobiasBg.
fixes #27181.

Note: See TracTickets for help on using tickets.