2011-10-04, 12:00 PM
Actually, I only have a single request: Please don't hardcode HTML in PHP files. It's not just bad practice. It makes customization of styles a lot harder.
As everybody should do, I use sprites for my images. I had a hard time changing the expcolimage (it has the .gif exension hardcoded), but with selectors, it's posible to do so. Worse are the buddy_options:
I can give quite a few other examples, but I'm sure you get my point: No HTML should be hardcoded within PHP files.
As everybody should do, I use sprites for my images. I had a hard time changing the expcolimage (it has the .gif exension hardcoded), but with selectors, it's posible to do so. Worse are the buddy_options:
$buddy_list = explode(',', $mybb->user['buddylist']);
if(in_array($mybb->input['uid'], $buddy_list))
{
$buddy_options = "<br /><a href=\"./usercp.php?action=do_editlists&delete={$mybb->input['uid']}&my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/remove_buddy.gif\" alt=\"{$lang->remove_from_buddy_list}\" /> {$lang->remove_from_buddy_list}</a>";
}
else
{
$buddy_options = "<br /><a href=\"./usercp.php?action=do_editlists&add_username=".urlencode($memprofile['username'])."&my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/add_buddy.gif\" alt=\"{$lang->add_to_buddy_list}\" /> {$lang->add_to_buddy_list}</a>";
}
$ignore_list = explode(',', $mybb->user['ignorelist']);
if(in_array($mybb->input['uid'], $ignore_list))
{
$buddy_options .= "<br /><a href=\"./usercp.php?action=do_editlists&manage=ignored&delete={$mybb->input['uid']}&my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/remove_ignore.gif\" alt=\"{$lang->remove_from_ignore_list}\" /> {$lang->remove_from_ignore_list}</a>";
}
else
{
$buddy_options .= "<br /><a href=\"./usercp.php?action=do_editlists&manage=ignored&add_username=".urlencode($memprofile['username'])."&my_post_key={$mybb->post_code}\"><img src=\"{$theme['imgdir']}/add_ignore.gif\" alt=\"{$lang->add_to_ignore_list}\" /> {$lang->add_to_ignore_list}</a>";
}
why is this hard coded? It should be just like the topic subscribe links. The links don't even contain an id or class. Not even a title. Nothing that can be used to style them with CSS. The only posibility is to wrap the buddy/ignore in a span, and style the first-child differently (killing IE6, but who cares). Even doing that, IE7 will still download the img. In practice, one has to either keep using the .gif (an 8-bit image) or write a plugin to correct MyBB's default behaviour.I can give quite a few other examples, but I'm sure you get my point: No HTML should be hardcoded within PHP files.