summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Common.php34
1 files changed, 13 insertions, 21 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index 7c46c590a..5cd3961d1 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -608,42 +608,34 @@ if ( ! function_exists('_stringify_attributes'))
* Helper function used to convert a string, array, or object of
* attributes to a string
*
- * @param mixed string, array, object
- * @param bool
- * @return string
+ * @param mixed string, array, object
+ * @param bool
+ * @return string
*/
function _stringify_attributes($attributes, $js = FALSE)
{
- if (is_string($attributes))
- {
- return strlen($attributes) > 0 ? ' '.$attributes : $attributes;
- }
+ $atts = null;
- if (is_object($attributes))
+ if (empty($attributes))
{
- $attributes = (array) $attributes;
+ return $atts;
}
- if (count($attributes) === 0)
+ if (is_string($attributes))
{
- return;
+ return ' '.$attributes;
}
- $atts = '';
+ $attributes = (array) $attributes;
+
foreach ($attributes as $key => $val)
{
- if ($js)
- {
- $atts .= $key.'='.$val.',';
- }
- else
- {
- $atts .= ' '.$key.'="'.$val.'"';
- }
+ $atts .= ($js) ? $key.'='.$val.',' : ' '.$key.'="'.$val.'"';
}
+
return rtrim($atts, ',');
}
}
/* End of file Common.php */
-/* Location: ./system/core/Common.php */ \ No newline at end of file
+/* Location: ./system/core/Common.php */