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.


Top ↑

Return Return

(array) Sanitized array of values.


Top ↑

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.
	);
}


Top ↑

Changelog Changelog

Changelog
VersionDescription
1.2.4Introduced.

Top ↑

User Contributed Notes User Contributed Notes

30 day money back guarantee
Safe & Secure online payment
Custom CSS Slide Example
Custom Animation Example
Default Animation