wp_kses_no_null() – Removes any invalid control characters in a text string.

You appear to be a bot. Output may be restricted

Description

Removes any invalid control characters in a text string.

Also removes any instance of the \0 string.

Usage

$string = wp_kses_no_null( $string, $options );

Parameters

$string
( string ) required – Content to filter null characters from.
$options
( array ) optional – Set 'slash_zero' => 'keep' when '\0' is allowed. Default is 'remove'.

Returns

string Filtered content.

Source

File name: wordpress/wp-includes/kses.php
Lines:

1 to 12 of 12
function wp_kses_no_null( $string, $options = null ) {
  if ( ! isset( $options['slash_zero'] ) ) {
    $options = array( 'slash_zero' => 'remove' );
  }

  $string = preg_replace( '/[\x00-\x08\x0B\x0C\x0E-\x1F]/', '', $string );
  if ( 'remove' === $options['slash_zero'] ) {
    $string = preg_replace( '/\\\\+0+/', '', $string );
  }

  return $string;
}
 

 View on GitHub View on Trac