From 8f1047ff6bc961159a7103e7be02e6cc459d925e Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Mon, 11 Jan 2016 13:20:12 +0200 Subject: Polish changes from PR #4269 --- system/helpers/html_helper.php | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'system') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 5cc994ff1..becd9a00c 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -359,17 +359,31 @@ if ( ! function_exists('meta')) // Turn single array into multidimensional $name = array($name); } - $allowed_type = array('charset', 'http-equiv', 'name', 'property'); + + $allowed_types = array('charset', 'http-equiv', 'name', 'property'); $str = ''; foreach ($name as $meta) { - $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"; + // 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 .= ''.$newline; + $str .= ''.$newline; } return $str; -- cgit v1.2.3-24-g4f1b