]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/LinkUtils.php
changelog update
[github/shaarli/Shaarli.git] / application / LinkUtils.php
index eeca631f566ad5ee84d1eb76cc7f20e439355a13..cf58f8083355af37e0a9271cf1168823252708dc 100644 (file)
@@ -81,7 +81,7 @@ function html_extract_charset($html)
 /**
  * Count private links in given linklist.
  *
- * @param array $links Linklist.
+ * @param array|Countable $links Linklist.
  *
  * @return int Number of private links.
  */
@@ -162,9 +162,23 @@ function space2nbsp($text)
  *
  * @param string $description shaare's description.
  * @param string $redirector  if a redirector is set, use it to gerenate links.
+ * @param string $indexUrl    URL to Shaarli's index.
  *
  * @return string formatted description.
  */
 function format_description($description, $redirector = '', $indexUrl = '') {
     return nl2br(space2nbsp(hashtag_autolink(text2clickable($description, $redirector), $indexUrl)));
 }
+
+/**
+ * Generate a small hash for a link.
+ *
+ * @param DateTime $date Link creation date.
+ * @param int      $id   Link ID.
+ *
+ * @return string the small hash generated from link data.
+ */
+function link_small_hash($date, $id)
+{
+    return smallHash($date->format(LinkDB::LINK_DATE_FORMAT) . $id);
+}