public static function cleanURL($object, $fullUrl = false) { if (is_integer($object)) { $href = "object_not_found_" . $object . '.html'; $object = Document::getDocumentInstance($object); } if ($object && is_object($object)) { $id = $object->getId(); $href = UtilsHelper::cleanStr($object->getLabel()) . "_" . $id . '.html'; } elseif ($object && is_array($object)) { $href = UtilsHelper::cleanStr($object['label']) . "_" . $object['id'] . '.html'; } for ($i = 0; $i < 5; $i++) { $href = str_replace('--', '-', $href); } if (substr($href, 0, 1) == '-') { $href = substr($href, 1); } if ($fullUrl) { return 'http://' . $_SERVER['HTTP_HOST'] . '/' . $href; } return $href; }