forked from fossar/selfoss
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Anonymizer.php
37 lines (33 loc) · 965 Bytes
/
Anonymizer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
namespace helpers;
/**
* Helper class for anonymizing urls
*
* @copyright Copyright (c) Tobias Zeising (http://www.aditu.de)
* @license GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html)
* @author Tobias Zeising <tobias.zeising@aditu.de>
*/
class Anonymizer {
/**
* @return bool whether or not we should anonymize urls
*/
private static function shouldAnonymize() {
return true;
}
/**
* anonymizes the url unless the anonymize parameter is set to boolean false
*
* @param string $url which is the url to anonymize
*
* @return string anonymized string
*/
public static function anonymize($url) {
return self::getAnonymizer() . $url;
}
/**
* @return string the anonymizer string if we should anonymize otherwise blank
*/
public static function getAnonymizer() {
return self::shouldAnonymize() ? trim(\F3::get('anonymizer')) : '';
}
}