### Eclipse Workspace Patch 1.0
#P wordpress
|
|
|
|
| 1315 | 1315 | * @uses $wpdb Used to sanitize values |
| 1316 | 1316 | * @since 0.71 |
| 1317 | 1317 | * |
| 1318 | | * @param array $array Array to used to walk while sanitizing contents. |
| 1319 | | * @return array Sanitized $array. |
| | 1318 | * @param mixed $array Array or else to used to walk while sanitizing contents. |
| | 1319 | * @return mixed Sanitized $array. |
| 1320 | 1320 | */ |
| 1321 | 1321 | function add_magic_quotes( $array ) { |
| 1322 | 1322 | global $wpdb; |
| 1323 | | |
| 1324 | | foreach ( (array) $array as $k => $v ) { |
| 1325 | | if ( is_array( $v ) ) { |
| | 1323 | |
| | 1324 | if ( is_array($array) ) { |
| | 1325 | foreach ( $array as $k => $v ) { |
| 1326 | 1326 | $array[$k] = add_magic_quotes( $v ); |
| 1327 | | } else { |
| 1328 | | $array[$k] = $wpdb->escape( $v ); |
| 1329 | | } |
| 1330 | | } |
| | 1327 | } |
| | 1328 | } elseif ( is_string($array) ) { |
| | 1329 | $array = $wpdb->escape( $array ); |
| | 1330 | } |
| | 1331 | // no need to handle other types (float, bool, callback, resource, object etc.) |
| | 1332 | |
| 1331 | 1333 | return $array; |
| 1332 | 1334 | } |
| 1333 | 1335 | |