add date sorting
[phinde.git] / src / phinde / Helper.php
1 <?php
2 namespace phinde;
3
4 class Helper
5 {
6     public static function isUrlAllowed($url)
7     {
8         $urlDomain = parse_url($url, PHP_URL_HOST);
9         if (!in_array($urlDomain, $GLOBALS['phinde']['domains'])) {
10             return false;
11         }
12         return true;
13     }
14
15     public static function noSchema($url)
16     {
17         return str_replace(
18             array('http://', 'https://'),
19             '',
20             $url
21         );
22     }
23
24     public static function addSchema($url)
25     {
26         if (substr($url, 0, 7) == 'http://'
27             || substr($url, 0, 8) == 'https://'
28         ) {
29             return $url;
30         }
31         return 'http://' . $url;
32     }
33 }
34 ?>