Make WordPress Core

Opened 13 years ago

Closed 13 years ago

#27181 closed enhancement (fixed)

get_the_date() - useless var and concatenation

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

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 13 years ago.
27181.2.patch (1001 bytes ) - added by TobiasBg 13 years ago.
Simplify/Cleanup get_the_date() and fix return type
27181.3.patch (925 bytes ) - added by TobiasBg 13 years ago.
27181.4.patch (596 bytes ) - added by TobiasBg 13 years ago.
Just the docs change

Download all attachments as: .zip

Change History (12)

#1 @SergeyBiryukov
13 years ago

  • Description modified (diff)

#2 @SergeyBiryukov
13 years ago

  • Keywords has-patch commit added
  • Milestone Awaiting Review3.9
  • Priority normallow
  • Severity normaltrivial

#3 @juliobox
13 years ago

Thank you Sergey!

#4 @SergeyBiryukov
13 years ago

  • Owner set to SergeyBiryukov
  • Resolutionfixed
  • Status newclosed

In 27230:

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

props juliobox.
fixes #27181.

@TobiasBg
13 years ago

Simplify/Cleanup get_the_date() and fix return type

#5 @TobiasBg
13 years ago

  • Resolution fixed
  • Status closedreopened

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
13 years ago

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

@TobiasBg
13 years ago

#7 @TobiasBg
13 years ago

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

@TobiasBg
13 years ago

Just the docs change

#8 @SergeyBiryukov
13 years ago

  • Resolutionfixed
  • Status reopenedclosed

In 27231:

Correct @return value for get_the_date().

props TobiasBg.
fixes #27181.

Note: See TracTickets for help on using tickets.