| 1314 | * Navigates through an array and adds slashes to the values. |
| 1315 | * |
| 1316 | * If an array is passed, the array_map() function causes a callback to pass the |
| 1317 | * value back to the function. Slashes will be added to this value. |
| 1318 | * |
| 1319 | * @since 3.4.0 |
| 1320 | * |
| 1321 | * @param array|string $value The array or string to be slashed. |
| 1322 | * @return array|string Slashed array (or string in the callback). |
| 1323 | */ |
| 1324 | function addslashes_deep($value) { |
| 1325 | if ( is_array($value) ) { |
| 1326 | $value = array_map('addslashes_deep', $value); |
| 1327 | } elseif ( is_object($value) ) { |
| 1328 | $vars = get_object_vars( $value ); |
| 1329 | foreach ($vars as $key=>$data) { |
| 1330 | $value->{$key} = addslashes_deep( $data ); |
| 1331 | } |
| 1332 | } else { |
| 1333 | $value = addslashes($value); |
| 1334 | } |
| 1335 | |
| 1336 | return $value; |
| 1337 | } |
| 1338 | |
| 1339 | /** |