You are here

function google_appliance_sgml_id_name in Google Search Appliance 6.2

SGML ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

1 call to google_appliance_sgml_id_name()
theme_google_appliance_add_meta_tags in ./google_appliance.module
Add meta tags to HTML header. Using a themeable function as a rough way of enabling customisation, but this could be made cleaner.

File

./google_appliance.module, line 1514
Google Search Appliance (GSA) / Google Mini integration

Code

function google_appliance_sgml_id_name($string) {

  // Replace with dashes anything that isn't A-Z, numbers, dashes, or underscores.
  $string = strtolower(preg_replace('/[^a-zA-Z0-9_:.-]+/', '-', $string));

  // If the first character is not a-z, add 'id-' in front.
  if (!ctype_lower($string[0])) {

    // Don't use ctype_alpha since its locale aware.
    $string = 'id-' . $string;
  }
  return $string;
}