noptin_parse_post_list( array|string $list )
Parses an array, comma- or space-separated list of post ids and urls.
Parameters Parameters
- $list
(array|string) (Required) List of values.
Return Return
(array) Sanitized array of values.
Source Source
File: includes/functions.php
function noptin_parse_post_list( $list ) { // Convert to array. $list = noptin_parse_list( $list ); // Treat numeric values as ids. $ids = array_filter( $list, 'is_numeric' ); // Assume the rest to be urls. $urls = array_diff( $list, $ids ); // Return an array or ids and urls return array( 'ids' => array_map( 'absint', $ids ), // convert to integers. 'urls' => array_map( 'noptin_clean_url', $urls ), // clean the urls. ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.2.4 | Introduced. |