diff options
author | ArthurHoaro <arthur@hoa.ro> | 2016-05-11 00:05:22 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2016-05-13 08:48:23 +0200 |
commit | 141a86c503af8e314381b3ee39ba4287fdfac63e (patch) | |
tree | 86cb3f8d8998bb924216cdee1101fb8ea5bd96e4 /application/LinkUtils.php | |
parent | 03eb19ac60d54442332077fa35a9b0d4e33df365 (diff) | |
download | Shaarli-141a86c503af8e314381b3ee39ba4287fdfac63e.tar.gz Shaarli-141a86c503af8e314381b3ee39ba4287fdfac63e.tar.zst Shaarli-141a86c503af8e314381b3ee39ba4287fdfac63e.zip |
Add private link counter
Diffstat (limited to 'application/LinkUtils.php')
-rw-r--r-- | application/LinkUtils.php | 16 |
1 files changed, 16 insertions, 0 deletions
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) | |||
77 | 77 | ||
78 | return false; | 78 | return false; |
79 | } | 79 | } |
80 | |||
81 | /** | ||
82 | * Count private links in given linklist. | ||
83 | * | ||
84 | * @param array $links Linklist. | ||
85 | * | ||
86 | * @return int Number of private links. | ||
87 | */ | ||
88 | function count_private($links) | ||
89 | { | ||
90 | $cpt = 0; | ||
91 | foreach ($links as $link) { | ||
92 | $cpt = $link['private'] == true ? $cpt + 1 : $cpt; | ||
93 | } | ||
94 | return $cpt; | ||
95 | } | ||