[eluser]xwero[/eluser]
Why wouldn't you define a meta variable if you know you added the meta function? You can if every variable if you want to be overly careful.
The most view friendly way is to change the meta function to output an empty string if there is no content.
Code:
function meta($name = '', $content = '', $type = 'name', $newline = "\n")
{
// Since we allow the data to be passes as a string, a simple array
// or a multidimensional one, we need to do a little prepping.
if ( ! is_array($name))
{
if($content == ''){ return ''; } // added
$name = array(array('name' => $name, 'content' => $content, 'type' => $type, 'newline' => $newline));
}
else
{
// Turn single array into multidimensional
if (isset($name['name']))
{
$name = array($name);
}
}
$str = '';
foreach ($name as $meta)
{
if($meta['content'] == ''){ continue; } // added
$type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
$name = ( ! isset($meta['name'])) ? '' : $meta['name'];
/*$content = ( ! isset($meta['content'])) ? '' : $meta['content']; // removed */
$content = $meta['content']; // added
$newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
$str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
}
return $str;
}