Changeset 48599 in spip-zone
- Timestamp:
- Jun 8, 2011, 3:49:53 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
_plugins_/telepathe/trunk/telepathe_fonctions.php
r48580 r48599 46 46 switch (_request('format')) { 47 47 case 'json': 48 return pretty_json_encode($r );48 return pretty_json_encode($r, _request('callback')); 49 49 case 'yaml': 50 50 if (include_spip('inc/yaml')) … … 61 61 ## essai (rat) de faire du joli json affichable dans le nav ; mais 62 62 ## avec yaml c'est plus propre 63 function pretty_json_encode($x ) {64 returnjson_encode($x);63 function pretty_json_encode($x, $callback=null) { 64 $x = json_encode($x); 65 65 66 if ($callback) 67 $x = htmlspecialchars($callback)."(\n" 68 . $x . "\n);\n"; 69 70 return $x; 71 72 /* 66 73 if (is_array($x)) { 67 74 $a = array(); … … 72 79 73 80 return json_encode($x); 74 81 */ 75 82 }
Note: See TracChangeset
for help on using the changeset viewer.