﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
22251,Helper function to simplify checking for constants,evansolomon,,"Love 'em or hate 'em, WordPress uses lots of constants.  As a result, this pattern is all over core and plugins, and occasionally themes:

`if ( defined( 'CONSTANT_NAME' ) && CONSTANT_NAME )`

Right now on trunk, it's used 57 times (excluding 2 in Akismet).

{{{
~/code/wptrunk $ ack ""defined\( ?('|\"")([^'\""]+)\1 ?\) \&\& \2"" -h --ignore-dir=wp-content/plugins/ | wc -l
      57
}}}

How about a new function to make that verbose logic a little bit less repetitive.

{{{
function wp_constant( $constant ) {
	return defined( $constant ) && constant( $constant );
}
}}}",enhancement,new,normal,Awaiting Review,General,,normal,,has-patch,info@… mike@… nashwan.doaqan@… scribu
