Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




wp_kses_bad_protocol [ WordPress Function ]

wp_kses_bad_protocol ( $string, $allowed_protocols )
Parameters:
  • (string) $string Content to filter bad protocols from
  • (array) $allowed_protocols Allowed protocols to keep
Returns:
  • (string) Filtered content
Defined at:



Sanitize string from bad protocols.

This function removes all non-allowed protocols from the beginning of $string. It ignores whitespace and the case of the letters, and it does understand HTML entities. It does its work in a while loop, so it won't be fooled by a string like "javascript:javascript:alert(57)".

Source


<?php
function wp_kses_bad_protocol($string$allowed_protocols) {
    
$string wp_kses_no_null($string);
    
$iterations 0;

    do {
        
$original_string $string;
        
$string wp_kses_bad_protocol_once($string$allowed_protocols);
    } while ( 
$original_string != $string && ++$iterations );

    if ( 
$original_string != $string )
        return 
'';

    return 
$string;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics