summaryrefslogtreecommitdiffstats
path: root/system/helpers/html_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/html_helper.php')
-rw-r--r--system/helpers/html_helper.php27
1 files changed, 21 insertions, 6 deletions
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index fdc463fca..696f0eee2 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -229,7 +229,7 @@ if ( ! function_exists('doctype'))
* @param string type The doctype to be generated
* @return string
*/
- function doctype($type = 'xhtml1-strict')
+ function doctype($type = 'html5')
{
static $doctypes;
@@ -360,15 +360,30 @@ if ( ! function_exists('meta'))
$name = array($name);
}
+ $allowed_types = array('charset', 'http-equiv', 'name', 'property');
$str = '';
foreach ($name as $meta)
{
- $type = (isset($meta['type']) && $meta['type'] !== 'name') ? 'http-equiv' : 'name';
- $name = isset($meta['name']) ? $meta['name'] : '';
- $content = isset($meta['content']) ? $meta['content'] : '';
- $newline = isset($meta['newline']) ? $meta['newline'] : "\n";
+ // This is to preserve BC with pre-3.1 versions where only
+ // 'http-equiv' (default) and 'name' were supported.
+ if (isset($meta['type']))
+ {
+ if ($meta['type'] === 'equiv')
+ {
+ $meta['type'] === 'http-equiv';
+ }
+ elseif ( ! in_array($meta['type'], $allowed_types, TRUE))
+ {
+ $meta['type'] = 'name';
+ }
+ }
+
+ $type = isset($meta['type']) ? $meta['type'] : 'name';
+ $name = isset($meta['name']) ? $meta['name'] : '';
+ $content = isset($meta['content']) ? $meta['content'] : '';
+ $newline = isset($meta['newline']) ? $meta['newline'] : "\n";
- $str .= '<meta '.$type.'="'.$name.'" content="'.$content.'" />'.$newline;
+ $str .= '<meta '.$type.'="'.$name.($type === 'charset' ? '' : '" content="'.$content).'" />'.$newline;
}
return $str;