WP_Widget_Media::sanitize_token_list() WordPress Method

The WP_Widget_Media::sanitize_token_list() method is used to sanitize a string of tokens. The string is expected to be a list of tokens separated by commas.

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.


Top ↑

Return

(string) Sanitized token string list.


Top ↑

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 implode( ' ', $tokens );
	}

Top ↑

Changelog

Changelog
VersionDescription
4.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.