function guifi_abbreviate($str, $len = 5) { $str = guifi_to_7bits($str); if (strlen($str) > $len) { $words = str_word_count(ucwords($str), 1, '1234567890'); if (count($words) > 1) { $s = ""; foreach ($words as $k => $word) { if ($k == 1) { $s .= substr($word, 0, 3); } else { $s .= substr($word, 0, 1); } } return $s; } else { return guifi_trim_vowels($str); } } return str_replace(" ", "", $str); }
function guifi_device_get_default_nick($node, $type, $nid) { $devs = db_fetch_object(db_query("\n SELECT count(*) count\n FROM {guifi_devices}\n WHERE type = '%s'\n AND nid = %d", $type, $nid)); return $node->nick . ucfirst(guifi_trim_vowels($type)) . ($devs->count + 1); }