summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/html_helper.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index e175c4c05..ef5a84a4d 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -322,12 +322,32 @@ if ( ! function_exists('link_tag'))
*/
if ( ! function_exists('meta'))
{
- function meta($meta = array(), $newline = "\n")
+ 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))
+ {
+ $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 ($meta as $key => $val)
+ foreach ($name as $meta)
{
- $str .= '<meta http-equiv="'.$key.'" content="'.$val.'" />'.$newline;
+ $type = ( ! isset($meta['type']) OR $meta['type'] == 'name') ? 'name' : 'http-equiv';
+ $name = ( ! isset($meta['name'])) ? '' : $meta['name'];
+ $content = ( ! isset($meta['content'])) ? '' : $meta['content'];
+ $newline = ( ! isset($meta['newline'])) ? "\n" : $meta['newline'];
+
+ $str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
}
return $str;