kses.php
1.88 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
} // Exit if accessed directly
function mc_kses_post( $string ) {
if ( !is_string( $string ) ) {
return $string;
} else {
return wp_kses( $string, 'mycalendar' );
}
}
/**
* My Calendar needs to allow input and select in posts and a variety of other key elements; also provide support for schema.org data.
*
* Call using wp_kses( $data, 'mycalendar' );
*/
add_filter( 'wp_kses_allowed_html', 'mc_allowed_tags', 10, 2 );
function mc_allowed_tags( $tags, $context ) {
if ( $context == 'mycalendar' ) {
global $allowedposttags;
$tags = $allowedposttags;
$tags['input'] = array(
'type' => true,
'value' => true,
'name' => true,
'class' => true,
'aria-labelledby' => true,
'aria-describedby' => true,
'disabled' => true,
'readonly' => true,
'min' => true,
'max' => true,
);
$tags['select'] = array(
'name' => true,
'id' => true,
'class' => true
);
$tags['span'] = array(
'dir' => true,
'align' => true,
'lang' => true,
'xml:lang' => true,
'itemprop' => true,
'itemscope' => true,
'itemtype' => true,
'class' => true,
);
$tags['button'] = array(
'name' => true,
'type' => true,
'disabled' => true,
'class' => true,
);
$tags['form'] = array(
'action' => true,
'method' => true,
'class' => true,
'id' => true,
'tabindex' => true,
);
$tags['div'] = array(
'class' => true,
'id' => true,
'aria-live' => true,
);
$tags['fieldset'] = array();
$tags['legend'] = array();
$tags['p'] = array(
'class' => true,
);
$tags['img'] = array(
'class' => true,
'src' => true,
'alt' => true,
'width' => true,
'height' => true,
'id' => true,
'longdesc' => true,
'tabindex' => true
);
}
return $tags;
}