-
Notifications
You must be signed in to change notification settings - Fork 13
/
sanitization.php
64 lines (51 loc) · 1008 Bytes
/
sanitization.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*
* Sanitization functions
*/
function portfolio_intval($value) {
return intval($value);
}
function portfolio_sanitize_article_column($value) {
if(in_array($value, array('1', '2', '3', '4'))) {
return $value;
}
return null;
}
function portfolio_sanitize_font($value) {
$fonts = array(
'google',
'verdana',
'georgia',
'arial',
'impact',
'tahoma',
'times',
'comic sans ms',
'courier new',
'helvetica'
);
if(in_array($value, $fonts)) {
return $value;
}
return null;
}
function portfolio_sanitize_date_format($value) {
if($value === 'default' || $value === 'wordpress') {
return $value;
}
return null;
}
function portfolio_sanitize_checkbox($value) {
if($value == '1' || $value == '0') {
return $value;
}
return null;
}
function portfolio_validate_category_selection($input) {
$temp = explode(',', $input);
if(count($temp) === count(array_filter($temp, 'is_numeric'))) {
return $input;
}
return null;
}
// EOF