You are here

function views_isotope_sanitize in Views Isotope (Deprecated) 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 views_isotope_sanitize()
theme_isotope_filter in ./views_isotope.module
Default theme implementation for the filter list.
theme_isotope_grid in ./views_isotope.module
Default theme implementation for the grid.

File

./views_isotope.module, line 313
Load the isotope library and provide configuration and theme options.

Code

function views_isotope_sanitize($raw) {
  $safe = $raw;
  if (is_array($raw)) {
    $safe = array();
    foreach ($raw as $i) {
      $safe[] = views_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_views_isotope_sanitize_alter().
  drupal_alter('views_isotope_sanitize', $safe, $raw);
  return $safe;
}