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() { ...@@ -88,6 +88,32 @@ function tools_url() {
88 } 88 }
89 89
90 /** 90 /**
91 * "Cleans" data by removing double backslashes and escaped quotes. Will run recursively on arrays.
92 *
93 * @param $data array|string Data to clean
94 * @return array|string
95 */
96 function tzClean (&$data) {
97 if (is_array($data)) {
98 foreach ($data as $index => $child_data) {
99 tzClean($data[$index]);
100 }
101 } else {
102 $data = str_ireplace(
103 '\\',
104 '',
105 str_ireplace(
106 array('\"', "\'"),
107 array('"', "'"),
108 $data
109 )
110 );
111 }
112
113 return $data;
114 }
115
116 /**
91 * @returns {WP_User} of the currently logged in user 117 * @returns {WP_User} of the currently logged in user
92 */ 118 */
93 function getCurrentUser() { 119 function getCurrentUser() {
......