| 3437 | | return array_unique(array_map('absint', $list)); |
| | 3437 | /** |
| | 3438 | * Add support for id ranges separated with a hyphen (-) |
| | 3439 | * Respects the order of the list ids |
| | 3440 | * |
| | 3441 | * @since 4.7.0 |
| | 3442 | */ |
| | 3443 | for ( $key = 0, $length = count( $list ); $key < $length; $key++ ) { |
| | 3444 | if ( strpos( $list[ $key ], '-' ) !== false ) { |
| | 3445 | $m = array_map( 'intval', explode( '-', $list[ $key ] ) ); |
| | 3446 | if ( count( $m ) > 1 && reset( $m ) != end( $m ) ) { |
| | 3447 | unset( $list[ $key ] ); |
| | 3448 | array_splice( $list, $key, 0, range( reset( $m ), end( $m ) ) ); |
| | 3449 | $key = $key + ( end( $m ) - reset( $m ) ); |
| | 3450 | $length = count( $list ); |
| | 3451 | } |
| | 3452 | } |
| | 3453 | } |
| | 3454 | |
| | 3455 | return array_unique( array_map( 'absint', $list ) ); |