| version 1.22, 2004/01/26 13:53:55 |
version 1.23, 2004/04/11 16:19:46 |
|
|
| * @access public |
* @access public |
| */ |
*/ |
| |
|
| /* $Platon: phpPlatonLib/Platon/Platon.php,v 1.21 2004/01/02 11:31:39 nepto Exp $ */ |
/* $Platon: phpPlatonLib/Platon/Platon.php,v 1.22 2004/01/26 13:53:55 nepto Exp $ */ |
| |
|
| class Platon |
class Platon |
| { |
{ |
|
|
| /** |
/** |
| * Returns original variables HTML code for use in forms or links. |
* Returns original variables HTML code for use in forms or links. |
| * |
* |
| * @param mixed $origvars string or array of original varaibles |
* @param mixed $origvars string or array of original variables; |
| * @param string $method type of method ("POST" or "GET") |
* if string values should be rawurlencoded(); |
| * @param mixed $default_value default value of variables |
* if array values should not be encoded |
| * if null, empty values will be skipped |
* @param string $method type of method ("POST" or "GET") |
| * @return get HTML code of original varaibles |
* @param mixed $default default value of variables |
| |
* if null, empty values will be skipped |
| |
* @return get HTML code of original variables |
| */ |
*/ |
| function get_origvars_html($origvars, $method = 'POST', $default_value = '') /* {{{ */ |
function get_origvars_html($origvars, $method = 'POST', $default = '') /* {{{ */ |
| { |
{ |
| $ret = ''; |
$ret = ''; |
| $method = strtoupper($method); |
$method = strtoupper($method); |
|
|
| foreach (explode('&', $origvars) as $param) { |
foreach (explode('&', $origvars) as $param) { |
| $parts = explode('=', $param, 2); |
$parts = explode('=', $param, 2); |
| if (! isset($parts[1])) { |
if (! isset($parts[1])) { |
| $parts[1] = $default_value; |
$parts[1] = $default; |
| } |
} |
| if (strlen($parts[0]) <= 0) { |
if (strlen($parts[0]) <= 0) { |
| continue; |
continue; |
|
|
| $origvars =& $new_origvars; |
$origvars =& $new_origvars; |
| } |
} |
| foreach ($origvars as $key => $val) { |
foreach ($origvars as $key => $val) { |
| if (strlen($val) <= 0 && $default_value === null) { |
if (strlen($val) <= 0 && $default === null) { |
| continue; |
continue; |
| } |
} |
| $key = rawurldecode($key); |
$key = rawurldecode($key); |
|
|
| $ret .= $origvars; |
$ret .= $origvars; |
| } else { |
} else { |
| foreach ($origvars as $key => $val) { |
foreach ($origvars as $key => $val) { |
| if (strlen($val) <= 0 && $default_value === null) { |
if (strlen($val) <= 0 && $default === null) { |
| continue; |
continue; |
| } |
} |
| $ret == '' || $ret .= '&'; |
$ret == '' || $ret .= '&'; |