Further to my last post about the quality of code in certain well known PHP projects, I just stumbled across this fantastically pointless finger spew.
function the_title($before = '', $after = '', $echo = true) {
$title = get_the_title();
if ( strlen($title) == 0 )
return;
$title = $before . $title . $after;
if ( $echo )
echo $title;
else
return $title;
}
How entirely pointless that is, indeed, it gets worse, the entire thing is bloody well restrictive.
$title = get_the_title(); goes off and gets the title, but it adds HTML to it. I just want to get the title, but instead I end up getting <span blah blah>TITLE</span>.
Very poor code folks, and I think the naming conventions for the functions are not even worth commenting about… oh go on, I can’t resist “the _title”? Nice and descriptive, ain’t it.
The thing is, I cannot understand why somebody would have done this. It’s just adding code that is in no way required. I think you’ll find that this particular program is riddled with dodgy designs, or lack thereof, like this, and if it was just coded properly in the first place, I dare say it would run considerably quicker, not to mention making the lives of us developers infinitely easier.