Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

wp_kses_bad_protocol_once2( string $string, string $allowed_protocols )

Callback for wp_kses_bad_protocol_once() regular expression.


Description Description

This function processes URL protocols, checks to see if they’re in the whitelist or not, and returns different data depending on the answer.


Top ↑

Parameters Parameters

$string

(string) (Required) URI scheme to check against the whitelist

$allowed_protocols

(string) (Required) Allowed protocols


Top ↑

Return Return

(string) Sanitized content


Top ↑

Source Source

File: wp-includes/kses.php

	if ( 1 === preg_match( '%\s*/\s*$%', $attr, $matches ) ) {
		$xhtml_slash = $matches[0];
		$attr        = substr( $attr, 0, -strlen( $xhtml_slash ) );
	} else {
		$xhtml_slash = '';
	}

	// Split it.
	$attrarr = wp_kses_hair_parse( $attr );
	if ( false === $attrarr ) {
		return false;
	}

	// Make sure all input is returned by adding front and back matter.
	array_unshift( $attrarr, $begin . $slash . $elname );
	array_push( $attrarr, $xhtml_slash . $end );

	return $attrarr;

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.