Un motore di ricerca WordPress per sviluppatori e autori di temi



wp_check_jsonp_callback ›

Da4.6.0
Deprecaton/a
wp_check_jsonp_callback ( $callback )
Parametri:
  • (string) $callback Supplied JSONP callback function.
    Richiesto:
Ritorna:
  • (bool) True if valid callback, otherwise false.
Definito a:
Codex:

Checks that a JSONP callback is a valid JavaScript callback.

Only allows alphanumeric characters and the dot character in callback function names. This helps to mitigate XSS attacks caused by directly outputting user input.



Sorgenti

function wp_check_jsonp_callback( $callback ) {
	if ( ! is_string( $callback ) ) {
		return false;
	}

	preg_replace( '/[^\w\.]/', '', $callback, -1, $illegal_char_count );

	return 0 === $illegal_char_count;
}