W3cubDocs

/WordPress

WP_Widget_Media::sanitize_token_list( string|array $tokens )

Sanitize a token list string, such as used in HTML rel and class attributes.

Parameters

$tokens

(string|array) (Required) List of tokens separated by spaces, or an array of tokens.

Return

(string) Sanitized token string list.

Source

File: wp-includes/widgets/class-wp-widget-media.php

public function sanitize_token_list( $tokens ) {
		if ( is_string( $tokens ) ) {
			$tokens = preg_split( '/\s+/', trim( $tokens ) );
		}
		$tokens = array_map( 'sanitize_html_class', $tokens );
		$tokens = array_filter( $tokens );
		return join( ' ', $tokens );
	}

Changelog

Version Description
4.8.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget_media/sanitize_token_list