[wp-trac] Re: [WordPress Trac] #3450: wp_return() function for
echo/return logic
WordPress Trac
wp-trac at lists.automattic.com
Sat Jan 6 21:45:14 GMT 2007
#3450: wp_return() function for echo/return logic
-----------------------------------+----------------------------------------
Reporter: markjaquith | Owner: anonymous
Type: enhancement | Status: new
Priority: low | Milestone: 2.1
Component: Administration | Version: 2.1
Severity: minor | Resolution:
Keywords: has-patch 2nd-opinion |
-----------------------------------+----------------------------------------
Comment (by xmarcos):
Replying to [ticket:3450 markjaquith]:
> Elegant echo/return logic wrapper by Andy Skelton
>
> Look at all the red in the patch!
>
> {{{
> // Implementation within function: return wp_return($func_data,
$echo_flag);
> function wp_return($data, $echo = true) {
> echo ( $echo ) ? $data : '';
> return $data;
> }
> }}}
As Viper007Bond says, this is wrong, it will always produce and echo and
then return the same value.
The function should be as follows,
{{{
function wp_return($data, $echo = true) {
if ($echo) :
echo $data;
else :
return $data;
endif;
}
}}}
--
Ticket URL: <http://trac.wordpress.org/ticket/3450#comment:2>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list