From 141a86c503af8e314381b3ee39ba4287fdfac63e Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Wed, 11 May 2016 00:05:22 +0200 Subject: Add private link counter --- application/LinkUtils.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'application') diff --git a/application/LinkUtils.php b/application/LinkUtils.php index 2df76ba8..da04ca97 100644 --- a/application/LinkUtils.php +++ b/application/LinkUtils.php @@ -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; +} -- cgit v1.2.3