wp_kses_bad_protocol_once

Advertisement

Summery Summery

Sanitizes content from bad protocols and other characters.

Syntax Syntax

wp_kses_bad_protocol_once( string $string, string[] $allowed_protocols,  $count = 1 )

Description Description

This function searches for URL protocols at the beginning of the string, while handling whitespace and HTML entities.

Parameters Parameters

$string

(string) (Required) Content to check for bad protocols.

$allowed_protocols

(string[]) (Required) Array of allowed URL protocols.

Return Return

(string) Sanitized content.

Source Source

File: wp-includes/kses.php

		}
	}

	return $outarray;
}

/**
 * Handles parsing errors in `wp_kses_hair()`.
 *
 * The general plan is to remove everything to and including some whitespace,
 * but it deals with quotes and apostrophes as well.
 *
 * @since 1.0.0
 *
 * @param string $string
 * @return string
 */
function wp_kses_html_error( $string ) {
	return preg_replace( '/^("[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*/', '', $string );
}

Advertisement

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.

Advertisement

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.