From 2a1c01f1c90315ef0111ff2afcff7464d73a2107 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 6 Jul 2011 14:29:48 -0700 Subject: [PATCH] Cleaning up HTML class bloat. --- system/html.php | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/system/html.php b/system/html.php index 18a680bd..b568efc5 100644 --- a/system/html.php +++ b/system/html.php @@ -206,11 +206,8 @@ public static function attributes($attributes) foreach ($attributes as $key => $value) { - // ------------------------------------------------------- - // If the attribute key is numeric, assign the attribute - // value to the key. This allows for attributes such as - // "required", "checked", etc. - // ------------------------------------------------------- + // Assume numeric-keyed attributes to have the same key and value. + // Example: required="required", autofocus="autofocus", etc. if (is_numeric($key)) { $key = $value; @@ -235,30 +232,21 @@ public static function obfuscate($value) { $safe = ''; - // ------------------------------------------------------- - // Spin through the string letter by letter. - // ------------------------------------------------------- foreach (str_split($value) as $letter) { switch (rand(1, 3)) { - // ------------------------------------------------------- // Convert the letter to its entity representation. - // ------------------------------------------------------- case 1: $safe .= '&#'.ord($letter).';'; break; - // ------------------------------------------------------- // Convert the letter to a Hex character code. - // ------------------------------------------------------- case 2: $safe .= '&#x'.dechex(ord($letter)).';'; break; - // ------------------------------------------------------- // No encoding. - // ------------------------------------------------------- case 3: $safe .= $letter; } @@ -272,18 +260,14 @@ public static function obfuscate($value) */ public static function __callStatic($method, $parameters) { - // ------------------------------------------------------- // Handle the dynamic creation of links to secure routes. - // ------------------------------------------------------- if (strpos($method, 'link_to_secure_') === 0) { array_unshift($parameters, substr($method, 15)); return forward_static_call_array('HTML::link_to_secure_route', $parameters); } - // ------------------------------------------------------- // Handle the dynamic creation of links to routes. - // ------------------------------------------------------- if (strpos($method, 'link_to_') === 0) { array_unshift($parameters, substr($method, 8));