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.


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

	. '|'
	.     '(?:\s|$)'      // If attribute has no value, space is required.
	. ')'
	. '\s*';              // Trailing space is optional except as mentioned above.
	// phpcs:enable

	// Although it is possible to reduce this procedure to a single regexp,
	// we must run that regexp twice to get exactly the expected result.

	$validation = "%^($regex)+$%";
	$extraction = "%$regex%";

	if ( 1 === preg_match( $validation, $attr ) ) {
		preg_match_all( $extraction, $attr, $attrarr );
		return $attrarr[0];
	} else {
		return false;
	}

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.