class-security.php
1.76 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
<?php
namespace LearnDash\Course_Grid;
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
class Security
{
public function __construct()
{
add_filter( 'wp_kses_allowed_html', [ $this, 'filter_allowed_html' ], 10, 2 );
}
/**
* Filter to allow HTML tags for course grid meta box
*
* @param array $tags List of HTML tags
* @param string $context String of context
* @return array New allowed HTML tags
*/
function filter_allowed_html( $tags, $context )
{
if ( 'learndash_course_grid_embed_code' == $context ) {
$tags['iframe'] = [
'allowfullscreen' => true,
'frameborder' => true,
'height' => true,
'src' => true,
'width' => true,
'allow' => true,
'class' => true,
'data-playerid' => true,
'allowtransparency' => true,
'style' => true,
'name' => true,
'watch-type' => true,
'url-params' => true,
'scrolling' => true,
];
$tags['video'] = [
'controls' => true,
'autoplay' => true,
'height' => true,
'width' => true,
'src' => true,
];
$tags['source'] = [
'src' => true,
'media' => true,
'sizes' => true,
'type' => true,
];
$tags['track'] = [
'default' => true,
'src' => true,
'srclang' => true,
'kind' => true,
'label' => true,
];
}
return $tags;
}
}