Adding a common stringify_attributes function for dealing with attributes through out various helpers.

Signed-off-by: Eric Barnes <eric@ericlbarnes.com>
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 96234bb..9843e80 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -51,7 +51,7 @@
 	 */
 	function heading($data = '', $h = '1', $attributes = '')
 	{
-		return '<h'.$h._html_attributes_to_string($attributes).'>'.$data.'</h'.$h.'>';
+		return '<h'.$h._stringify_attributes($attributes).'>'.$data.'</h'.$h.'>';
 	}
 }
 
@@ -120,7 +120,7 @@
 		$out = str_repeat(' ', $depth);
 
 		// Write the opening list tag
-		$out .= '<'.$type._html_attributes_to_string($attributes).">\n";
+		$out .= '<'.$type._stringify_attributes($attributes).">\n";
 
 		// Cycle through the list elements.  If an array is
 		// encountered we will recursively call _list()
@@ -215,7 +215,7 @@
 			}
 		}
 
-		return $img._html_attributes_to_string($attributes).'/>';
+		return $img._stringify_attributes($attributes).'/>';
 	}
 }
 
@@ -393,40 +393,5 @@
 	}
 }
 
-if ( ! function_exists('_html_attributes_to_string'))
-{
-	/**
-	 * Attributes To String
-	 *
-	 * Helper function used to convert array or object of attributes to a string
-	 *
-	 * @param	mixed
-	 * @param	bool
-	 * @return	string
-	 */
-	function _html_attributes_to_string($attributes)
-	{
-		if (is_object($attributes) && count($attributes) > 0)
-		{
-			$attributes = (array) $attributes;
-		}
-
-		if (is_array($attributes) && count($attributes) > 0)
-		{
-			$atts = '';
-			foreach ($attributes as $key => $val)
-			{
-				$atts .= ' '.$key.'="'.$val.'"';
-			}
-			return $atts;
-		}
-		elseif (is_string($attributes) && strlen($attributes) > 0)
-		{
-			return ' '.$attributes;
-		}
-
-		return $attributes;
-	}
-}
 /* End of file html_helper.php */
 /* Location: ./system/helpers/html_helper.php */
\ No newline at end of file