Passed
Push — main ( d81cf5...e4a1c0 )
by Roberto
12:52
created

SiteFilter::htmlquotes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
namespace Lepton\Controller;
4
5
use Lepton\Core\Application;
6
7
class SiteFilter
8
{
9
    public function url($string)
10
    {
11
        return Application::getDir()."/".$string;
12
    }
13
14
15
    public function sublink($url, $tocheck)
16
    {
17
        $url = str_replace(Application::getDir(), "", $url);
18
        $tocheck = str_replace(Application::getDir(), "", $tocheck);
19
20
        $url = str_replace(Application::$controller, "", $url);
21
        $tocheck = str_replace(Application::$controller, "", $tocheck);
22
23
        $url = trim(str_replace("//", "", $url), "/");
24
        $tocheck = trim(str_replace("//", "", $tocheck), "/");
25
26
        $url_exp = explode("/", $url);
27
        $tocheck_exp = explode("/", $tocheck);
28
        return intval($url_exp[0] == $tocheck_exp[0]);
29
    }
30
31
32
    public function to_json($elements)
33
    {
34
        return json_encode($elements);
35
    }
36
37
    public function htmlquotes($element)
38
    {
39
        return htmlspecialchars($element);
40
    }
41
}
42