]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/LinkUtils.php
Add private link counter
[github/shaarli/Shaarli.git] / application / LinkUtils.php
index 2df76ba8a4b457f4867efb9e960b7242d55a614d..da04ca9743870f555b5feea64ea9501eb4cbde30 100644 (file)
@@ -77,3 +77,19 @@ function html_extract_charset($html)
 
     return false;
 }
+
+/**
+ * Count private links in given linklist.
+ *
+ * @param array $links Linklist.
+ *
+ * @return int Number of private links.
+ */
+function count_private($links)
+{
+    $cpt = 0;
+    foreach ($links as $link) {
+        $cpt = $link['private'] == true ? $cpt + 1 : $cpt;
+    }
+    return $cpt;
+}