Skip to content

Commit 58a474d

Browse files
author
Chris Kacerguis
committed
1 parent 5151e90 commit 58a474d

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

application/libraries/Format.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public function to_xml($data = null, $structure = null, $basenode = 'xml')
131131
{
132132
$attributes = $value;
133133
if (is_object($attributes)) $attributes = get_object_vars($attributes);
134-
134+
135135
foreach ($attributes as $attributeName => $attributeValue)
136136
{
137137
$structure->addAttribute($attributeName, $attributeValue);
@@ -213,7 +213,7 @@ public function to_csv()
213213
throw new Exception('Format class does not support multi-dimensional arrays');
214214
} else {
215215
$row = str_replace('"', '""', $row); // Escape dbl quotes per RFC 4180
216-
$output .= '"'.implode('","', $row).'"'.PHP_EOL;
216+
$output .= '"'.implode('","', $row).'"'.PHP_EOL;
217217
}
218218

219219
}
@@ -228,12 +228,12 @@ public function to_json()
228228
if ($callback === '')
229229
{
230230
return json_encode($this->_data);
231-
231+
232232
/* Had to take out this code, it doesn't work on Objects.
233233
$str = $this->_data;
234-
array_walk_recursive($str, function(&$item, $key)
234+
array_walk_recursive($str, function(&$item, $key)
235235
{
236-
if(!mb_detect_encoding($item, 'utf-8', true))
236+
if(!mb_detect_encoding($item, 'utf-8', true))
237237
{
238238
$item = utf8_encode($item);
239239
}
@@ -311,6 +311,13 @@ private function _from_serialize($string)
311311
return unserialize(trim($string));
312312
}
313313

314+
// If you provide text/plain value on the Content-type header on a request
315+
// just return the string
316+
private function _from_php($string)
317+
{
318+
return trim($string)
319+
}
320+
314321
}
315322

316323
/* End of file format.php */

0 commit comments

Comments
 (0)