function isotope_sanitize in Isotope (with Masonry and Packery) 7.2
Strip all special chars to make value suitable for css class name.
Parameters
string $raw: The raw value to be sanitized.
Return value
string The sanitized value.
2 calls to isotope_sanitize()
- theme_isotope_filter in ./
isotope.module - Default theme implementation for the filter list.
- theme_isotope_grid in ./
isotope.module - Default theme implementation for the grid.
File
- ./
isotope.module, line 317 - Load the isotope library and provide configuration and theme options.
Code
function isotope_sanitize($raw) {
$safe = $raw;
if (is_array($raw)) {
$safe = array();
foreach ($raw as $i) {
$safe[] = isotope_sanitize($i);
}
return implode(' ', $safe);
}
// Transliterate other language chars to latin.
if (function_exists('transliteration_get')) {
$safe = transliteration_get($safe, '?', language_default('language'));
}
// Basic class-name rules.
$safe = strtolower($safe);
$safe = preg_replace('/[^a-z0-9]/s', '-', $safe);
$safe = preg_replace('/-{2,}/', '-', $safe);
// Allow other modules to modify it with hook_isotope_sanitize_alter().
drupal_alter('isotope_sanitize', $safe, $raw);
return $safe;
}