[wp-hackers] Returning instead of echoing

Owen Winkler ringmaster at midnightcircus.com
Fri Nov 12 05:59:48 UTC 2004


Ryan Boren wrote:

>>Is anyone else thinking of taking this on, or am I doing it?
>>    
>>
>
>We're probably waiting for Godot there.  How about you take one or two
>template functions files, convert them as per your suggestions, and
>forward them to the list for discussion?  Once we haggle out the scope
>and the details, I'll help on the other files.
>  
>
Ok, here's my logic in this so far:

When adding a get_, if a parameter exists in the old the_ for echoing, 
retain the parameter in the the_, and remove it from the get_.  Because 
the get_ is new, removing the parameter doesn't break anything, and the 
parameter list then implies the exact funtionality required from the 
function.  An example of this logic in action is the_author() in 
template-functions-author.php.

I put all of the matching pairs next to each other in the code, 
separating the pairs from each other with a  newline, which makes the 
intent a little more clear.

More importantly:

template-functions-general.php and template-functions-category.php do 
not appear to need conversions according to the suggestions I've made.  
Most functions I've seen (apart the from the file I've included) have 
get_/the_ pairs or some analog -- but there is an exception.

The suggestions for changes (omitting my second bullet point, as per 
your review) will not accomplish Mike's task.  (See: 
http://wordpress.org/pipermail/hackers_wordpress.org/2004-November/002680.html 
)

There are quite a few wp_something functions that generate URLs, then 
stuff them into HTML links and output them before a hacker can mess with 
them.  And there is no other way to get the URL besides opening up the 
template code and duplicating what's in the output function.

On review of the work, I think that second bullet item needs to be done 
to make any changes at all worthwhile, if only because it's only those 
rare functions that are really causing problems.  (Everything else is 
pretty well covered.)  Also note that if these functions are split, a 
decision on where any existing or new filter should go is required - On 
the URL itself, or the HTML output.

Regardless, I've attached a modified template-functions-author.php for 
review, which is modified as prescribed.

Tired now.  Hope this makes sense.

Owen

-------------- next part --------------
A non-text attachment was scrubbed...
Name: template-functions-author.php
Type: text/x-patch
Size: 7575 bytes
Desc: not available
Url : /pipermail/hackers_wordpress.org/attachments/20041112/5aa71f5a/template-functions-author.bin


More information about the hackers mailing list