+/** Remove link and it's file
+ * @param $link the link's name (hash)
+ */
+
+function jirafeau_delete($link) {
+  if(!file_exists(VAR_LINKS . $link))
+    return;
+
+  $content = file(VAR_LINKS . $link);
+  $md5 = trim($content[5]);
+  unlink(VAR_LINKS . $link);
+
+  $counter = 1;
+  if (file_exists(VAR_FILES . $md5 . '_count')) {
+    $content = file(VAR_FILES . $md5 . '_count');
+    $counter = trim($content[0]);
+  }
+  $counter--;
+
+  if ($counter >= 1) {
+    $handle = fopen(VAR_FILES . $md5 . '_count', 'w');
+    fwrite($handle, $counter);
+    fclose($handle);
+  }
+
+  if ($counter == 0 && file_exists(VAR_FILES. $md5)) {
+    unlink (VAR_FILES . $md5);
+    unlink (VAR_FILES . $md5 . '_count');
+  }
+}
+