$v) {
unset($process[$key][$k]);
if (is_array($v)) {
$process[$key][stripslashes($k)] = $v;
$process[] = &$process[$key][stripslashes($k)];
} else {
$process[$key][stripslashes($k)] = ($filter ? $v : stripslashes($v));
}
}
}
}
}
/** Escape or unescape string to use inside form []
* @param string
* @param bool
* @return string
*/
function bracket_escape($idf, $back = false) {
// escape brackets inside name="x[]"
static $trans = array(':' => ':1', ']' => ':2', '[' => ':3');
return strtr($idf, ($back ? array_flip($trans) : $trans));
}
/** Escape for HTML
* @param string
* @return string
*/
function h($string) {
return htmlspecialchars(str_replace("\0", "", $string), ENT_QUOTES);
}
/** Escape for TD
* @param string
* @return string
*/
function nbsp($string) {
return (trim($string) != "" ? h($string) : " ");
}
/** Convert \n to
* @param string
* @return string
*/
function nl_br($string) {
return str_replace("\n", "
", $string); // nl2br() uses XHTML before PHP 5.3
}
/** Generate HTML checkbox
* @param string
* @param string
* @param bool
* @param string
* @param string
* @param bool
* @return string
*/
function checkbox($name, $value, $checked, $label = "", $onclick = "", $jsonly = false) {
static $id = 0;
$id++;
$return = "";
return ($label != "" ? "" : $return);
}
/** Generate list of HTML options
* @param array array of strings or arrays (creates optgroup)
* @param mixed
* @param bool always use array keys for value="", otherwise only string keys are used
* @return string
*/
function optionlist($options, $selected = null, $use_keys = false) {
$return = "";
foreach ($options as $k => $v) {
$opts = array($k => $v);
if (is_array($v)) {
$return .= '';
}
}
return $return;
}
/** Generate HTML radio list
* @param string
* @param array
* @param string
* @param string true for no onchange, false for radio
* @return string
*/
function html_select($name, $options, $value = "", $onchange = true) {
if ($onchange) {
return "";
}
$return = "";
foreach ($options as $key => $val) {
$return .= "";
}
return $return;
}
/** Get onclick confirmation
* @param string JavaScript expression
* @param bool stop event propagation
* @return string
*/
function confirm($count = "", $stop = false) {
return " onclick=\"" . ($stop ? "eventStop(event); " : "") . "return confirm('" . lang('Are you sure?') . ($count ? " (' + $count + ')" : "") . "');\"";
}
/** Escape string for JavaScript apostrophes
* @param string
* @return string
*/
function js_escape($string) {
return addcslashes($string, "\r\n'\\/"); // slash for