sanitize_html_class

FUNCTION wp-includes\formatting.php (ligne 2419) github
Sanitizes an HTML classname to ensure it only contains valid characters. Strips the string down to A-Z,a-z,0-9,_,-. If this results in an empty string then it will return the alternative value supplied.

Paramètres

Entrée :
$classname, $fallback = ''
Sortie :
@param string $classname The classname to be sanitized.
@param string $fallback  Optional. The value to return if the sanitization ends up as an empty string.
@return string The sanitized value.

Utilisation

// Utilisation de la fonction sanitize_html_class
$result = sanitize_html_class($classname, $fallback = '');

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...