diff options
author | Sébastien Adam <sebastien.adam.webdev@gmail.com> | 2015-12-01 20:02:07 +0100 |
---|---|---|
committer | Sébastien Adam <sebastien.adam.webdev@gmail.com> | 2015-12-01 20:02:07 +0100 |
commit | 6ab09773d96ce6ac672a3d852256126d10aa25d8 (patch) | |
tree | 6b068464f44bf72064a4df8731d7aa44bd4c91e1 /system/helpers/html_helper.php | |
parent | dfcc5318d378ae66dd21806c6ac2dad67d73dc26 (diff) |
Modified as asked after pull request:
* comment of meta fuction adapted
* alignments in meta fuction adapted
* using '===' comparator in meta function
* changing back the example of the meta function help
* changing back the default value of the doctype function
Also changing test unit to reflect the modification of the meta
function (original tests not modified).
Diffstat (limited to 'system/helpers/html_helper.php')
-rw-r--r-- | system/helpers/html_helper.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index b4c605a01..36680053a 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 = 'html5') + function doctype($type = 'xhtml1-strict') { static $doctypes; @@ -363,13 +363,13 @@ if ( ! function_exists('meta')) $str = ''; foreach ($name as $meta) { - $meta['type'] = (isset($meta['type']) && ($meta['type'] == 'equiv')) ? 'http-equiv' : $meta['type']; // backward compatibility - $type = (isset($meta['type']) && in_array($meta['type'], $allowed_type))? $meta['type'] : 'name'; - $name = isset($meta['name']) ? $meta['name'] : ''; - $content = (isset($meta['content']) && $type != 'charset') ? $meta['content'] : ''; - $newline = isset($meta['newline']) ? $meta['newline'] : "\n"; + $meta['type'] = isset($meta['type']) ? (($meta['type'] === 'equiv') ? 'http-equiv' : $meta['type']) : ''; // backward compatibility + $type = in_array($meta['type'], $allowed_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; |