Passed
Push — master ( 3388c8...01e728 )
by Iman
08:15 queued 02:52
created

ViewHelpers::getUrlParameters()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 23
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 5
eloc 14
nc 5
nop 1
dl 0
loc 23
rs 8.5906
c 0
b 0
f 0
1
<?php
2
3
namespace crocodicstudio\crudbooster\CBCoreModule;
4
5
class ViewHelpers
6
{
7
    public static function getUrlParameters($exception = null)
8
    {
9
        @$get = $_GET;
10
        $inputhtml = '';
11
12
        if (! $get) {
13
            return $inputhtml;
14
        }
15
        if (is_array($exception)) {
16
            foreach ($exception as $e) {
17
                unset($get[$e]);
18
            }
19
        }
20
21
        $string_parameters = http_build_query($get);
22
        foreach (explode('&', $string_parameters) as $s) {
23
            $part = explode('=', $s);
24
            $name = urldecode($part[0]);
25
            $value = urldecode($part[1]);
26
            $inputhtml .= "<input type='hidden' name='$name' value='$value'/>";
27
        }
28
29
        return $inputhtml;
30
    }
31
32
    public static function delConfirm($redirectTo)
33
    {
34
        echo 'swal({   
35
				title: "'.cbTrans('delete_title_confirm').'",   
36
				text: "'.cbTrans('delete_description_confirm').'",   
37
				type: "warning",   
38
				showCancelButton: true,   
39
				confirmButtonColor: "#ff0000",   
40
				confirmButtonText: "'.cbTrans('confirmation_yes').'",  
41
				cancelButtonText: "'.cbTrans('confirmation_no').'",  
42
				closeOnConfirm: false }, 
43
				function(){  location.href="'.$redirectTo.'" });';
44
    }
45
}