| 12 |
// $Id$ |
// $Id$ |
| 13 |
// ------------------------------------------------------------------------- |
// ------------------------------------------------------------------------- |
| 14 |
// $Log$ |
// $Log$ |
| 15 |
|
// Revision 1.3 2004/06/16 15:17:03 joko |
| 16 |
|
// now also en-/decodes hash-keys |
| 17 |
|
// |
| 18 |
// Revision 1.2 2003/03/10 23:25:02 joko |
// Revision 1.2 2003/03/10 23:25:02 joko |
| 19 |
// + fixed metadata for phpDocumentor |
// + fixed metadata for phpDocumentor |
| 20 |
// |
// |
| 43 |
class Data_Encode { |
class Data_Encode { |
| 44 |
|
|
| 45 |
var $payload; |
var $payload; |
| 46 |
|
var $result; |
| 47 |
|
|
| 48 |
function Data_Encode(&$payload, $args = array()) { |
function Data_Encode(&$payload, $args = array()) { |
| 49 |
$this->payload = &$payload; |
$this->payload = &$payload; |
| 53 |
return $this->payload; |
return $this->payload; |
| 54 |
} |
} |
| 55 |
|
|
| 56 |
|
function get_result() { |
| 57 |
|
return $this->result; |
| 58 |
|
} |
| 59 |
|
|
| 60 |
function toUTF8() { |
function toUTF8() { |
| 61 |
$this->_iso_2_utf8($this->payload); |
$this->_iso_2_utf8($this->payload, $this->result); |
| 62 |
} |
} |
| 63 |
|
|
| 64 |
function toISO() { |
function toISO() { |
| 65 |
$this->_utf8_2_iso($this->payload); |
$this->_utf8_2_iso($this->payload, $this->result); |
| 66 |
} |
} |
| 67 |
|
|
| 68 |
function toHTML() { |
function toHTML() { |
| 70 |
} |
} |
| 71 |
|
|
| 72 |
|
|
| 73 |
function _utf8_2_iso(&$payload) { |
function _utf8_2_iso_OLD(&$payload) { |
| 74 |
if (is_array($payload)) { |
if (is_array($payload)) { |
| 75 |
foreach ($payload as $key => $val) { |
foreach ($payload as $key => $val) { |
| 76 |
if (is_array($payload[$key])) { |
if (is_array($payload[$key])) { |
| 82 |
} |
} |
| 83 |
} |
} |
| 84 |
|
|
| 85 |
function _iso_2_utf8(&$payload) { |
function _iso_2_utf8_OLD(&$payload) { |
| 86 |
if (is_array($payload)) { |
if (is_array($payload)) { |
| 87 |
foreach ($payload as $key => $val) { |
foreach ($payload as $key => $val) { |
| 88 |
if (is_array($payload[$key])) { |
if (is_array($payload[$key])) { |
| 92 |
} |
} |
| 93 |
} |
} |
| 94 |
} |
} |
| 95 |
|
} |
| 96 |
|
|
| 97 |
|
function _utf8_2_iso(&$payload, &$result) { |
| 98 |
|
if (is_array($payload)) { |
| 99 |
|
foreach ($payload as $key => $val) { |
| 100 |
|
if (is_array($val)) { |
| 101 |
|
$this->_utf8_2_iso($val, $result[$key]); |
| 102 |
|
} else { |
| 103 |
|
$this->_utf8_2_iso_scalar($key); |
| 104 |
|
$this->_utf8_2_iso_scalar($val); |
| 105 |
|
$result[$key] = $val; |
| 106 |
|
} |
| 107 |
|
} |
| 108 |
|
} |
| 109 |
|
} |
| 110 |
|
|
| 111 |
|
function _iso_2_utf8(&$payload, &$result) { |
| 112 |
|
if (is_array($payload)) { |
| 113 |
|
foreach ($payload as $key => $val) { |
| 114 |
|
if (is_array($val)) { |
| 115 |
|
$this->_iso_2_utf8($val, $result[$key]); |
| 116 |
|
} else { |
| 117 |
|
$this->_iso_2_utf8_scalar($key); |
| 118 |
|
$this->_iso_2_utf8_scalar($val); |
| 119 |
|
$result[$key] = $val; |
| 120 |
|
} |
| 121 |
|
} |
| 122 |
|
} |
| 123 |
} |
} |
| 124 |
|
|
| 125 |
function _utf8_2_iso_scalar(&$scalar) { |
function _utf8_2_iso_scalar(&$scalar) { |