SiteFilter::htmlquotes()   A
last analyzed

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
        return str_starts_with($tocheck, $url) && $url != "";
27
    }
28
29
30
    public function query_count($query){
31
        return $query->count();
32
    }
33
34
    public function to_json($elements)
35
    {
36
        return json_encode($elements);
37
    }
38
39
    public function htmlquotes($element)
40
    {
41
        return htmlspecialchars($element);
42
    }
43
44
}
45