Merge pull request #229 from PrestaEdit/patch-18

[*] Class Tools: enhance fd method
This commit is contained in:
Vincent Augagneur
2013-01-28 01:29:43 -08:00
+7 -2
View File
@@ -730,11 +730,16 @@ class ToolsCore
* *
* @param object $object Object to display * @param object $object Object to display
*/ */
public static function fd($object) public static function fd($object, $type = 'log')
{ {
$types = array('log', 'debug', 'info', 'warn', 'error', 'assert');
if(!in_array($type, $types))
$type = 'log';
echo ' echo '
<script type="text/javascript"> <script type="text/javascript">
console.log('.json_encode($object).'); console.'.$type.'('.json_encode($object).');
</script> </script>
'; ';
} }