75d82c33 by Marty Penner

Add function that "cleans" double backslashes and escaped quotes. refs #1372

1 parent e8f47b53
......@@ -88,6 +88,32 @@ function tools_url() {
}
/**
* "Cleans" data by removing double backslashes and escaped quotes. Will run recursively on arrays.
*
* @param $data array|string Data to clean
* @return array|string
*/
function tzClean (&$data) {
if (is_array($data)) {
foreach ($data as $index => $child_data) {
tzClean($data[$index]);
}
} else {
$data = str_ireplace(
'\\',
'',
str_ireplace(
array('\"', "\'"),
array('"', "'"),
$data
)
);
}
return $data;
}
/**
* @returns {WP_User} of the currently logged in user
*/
function getCurrentUser() {
......