wp_kses_bad_protocol_once2()
Callback for wp_kses_bad_protocol_once() expression.
This function processes URL protocols, checks to see if they're in the list of allowed protocols or not, and returns different data depending on the answer.
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Return
String
. Sanitized content.
Usage
wp_kses_bad_protocol_once2( $scheme, $allowed_protocols );
- $scheme(string) (required)
- URI scheme to check against the list of allowed protocols.
- $allowed_protocols(string[]) (required)
- Array of allowed URL protocols.
Changelog
Since 1.0.0 | Introduced. |
wp_kses_bad_protocol_once2() wp kses bad protocol once2 code WP 6.7.1
function wp_kses_bad_protocol_once2( $scheme, $allowed_protocols ) { $scheme = wp_kses_decode_entities( $scheme ); $scheme = preg_replace( '/\s/', '', $scheme ); $scheme = wp_kses_no_null( $scheme ); $scheme = strtolower( $scheme ); $allowed = false; foreach ( (array) $allowed_protocols as $one_protocol ) { if ( strtolower( $one_protocol ) === $scheme ) { $allowed = true; break; } } if ( $allowed ) { return "$scheme:"; } else { return ''; } }