1 |
<? |
2 |
// ------------------------------------------------------------------------- |
3 |
// $Id: TextEncode.php,v 1.2 2003/02/03 03:40:02 jonen Exp $ |
4 |
// ------------------------------------------------------------------------- |
5 |
// $Log: TextEncode.php,v $ |
6 |
// ------------------------------------------------------------------------- |
7 |
|
8 |
|
9 |
class Data_Deep { |
10 |
|
11 |
var $payload; |
12 |
|
13 |
function Data_Deep(&$payload) { |
14 |
$this->payload = &$payload; |
15 |
} |
16 |
|
17 |
function &get($attr) { |
18 |
$evalstr = 'return $this->payload' . $this->_getHKR($attr) . ';'; |
19 |
$val = eval($evalstr); |
20 |
return $val; |
21 |
} |
22 |
|
23 |
function set($attr, $val) { |
24 |
//$evalstr = '$this->payload' . $this->_getHKR($attr) . ' = \'' . $val . '\';'; |
25 |
$evalstr = '$this->payload' . $this->_getHKR($attr) . ' = $val;'; |
26 |
eval($evalstr); |
27 |
} |
28 |
|
29 |
function getPayload() { |
30 |
return $this->payload; |
31 |
} |
32 |
|
33 |
function _getHKR($key) { |
34 |
$attr_arr = split('\.', $key); |
35 |
$attr_hkr = '["' . join('"]["', $attr_arr) . '"]'; |
36 |
return $attr_hkr; |
37 |
} |
38 |
|
39 |
} |
40 |
|
41 |
?> |