| @@ 90-121 (lines=32) @@ | ||
| 87 | * |
|
| 88 | * @see like_escape |
|
| 89 | */ |
|
| 90 | function pods_sanitize_like( $input ) { |
|
| 91 | ||
| 92 | if ( '' === $input || is_int( $input ) || is_float( $input ) || empty( $input ) ) { |
|
| 93 | return $input; |
|
| 94 | } |
|
| 95 | ||
| 96 | $output = array(); |
|
| 97 | ||
| 98 | if ( is_object( $input ) ) { |
|
| 99 | $input = get_object_vars( $input ); |
|
| 100 | ||
| 101 | foreach ( $input as $key => $val ) { |
|
| 102 | $output[ $key ] = pods_sanitize_like( $val ); |
|
| 103 | } |
|
| 104 | ||
| 105 | $output = (object) $output; |
|
| 106 | } |
|
| 107 | elseif ( is_array( $input ) ) { |
|
| 108 | foreach ( $input as $key => $val ) { |
|
| 109 | $output[ $key ] = pods_sanitize_like( $val ); |
|
| 110 | } |
|
| 111 | } |
|
| 112 | else { |
|
| 113 | global $wpdb; |
|
| 114 | $input = pods_unslash( $input ); |
|
| 115 | ||
| 116 | $output = pods_sanitize( $wpdb->esc_like( $input ) ); |
|
| 117 | } |
|
| 118 | ||
| 119 | return $output; |
|
| 120 | ||
| 121 | } |
|
| 122 | ||
| 123 | /** |
|
| 124 | * Filter input and return slashed output |
|
| @@ 252-283 (lines=32) @@ | ||
| 249 | * |
|
| 250 | * @see wp_unslash |
|
| 251 | */ |
|
| 252 | function pods_unslash( $input ) { |
|
| 253 | ||
| 254 | if ( '' === $input || is_int( $input ) || is_float( $input ) || empty( $input ) ) { |
|
| 255 | return $input; |
|
| 256 | } |
|
| 257 | ||
| 258 | $output = array(); |
|
| 259 | ||
| 260 | if ( empty( $input ) ) { |
|
| 261 | $output = $input; |
|
| 262 | } |
|
| 263 | elseif ( is_object( $input ) ) { |
|
| 264 | $input = get_object_vars( $input ); |
|
| 265 | ||
| 266 | foreach ( $input as $key => $val ) { |
|
| 267 | $output[ $key ] = pods_unslash( $val ); |
|
| 268 | } |
|
| 269 | ||
| 270 | $output = (object) $output; |
|
| 271 | } |
|
| 272 | elseif ( is_array( $input ) ) { |
|
| 273 | foreach ( $input as $key => $val ) { |
|
| 274 | $output[ $key ] = pods_unslash( $val ); |
|
| 275 | } |
|
| 276 | } |
|
| 277 | else { |
|
| 278 | $output = wp_unslash( $input ); |
|
| 279 | } |
|
| 280 | ||
| 281 | return $output; |
|
| 282 | ||
| 283 | } |
|
| 284 | ||
| 285 | /** |
|
| 286 | * Filter input and return sanitized output |
|