PluginProbe
StreamCast – bring live radio to your site with a sleek player / 2.2.1
StreamCast – bring live radio to your site with a sleek player v2.2.1
2.4.5 2.4.4 trunk 1.0 1.1 2.0.0 2.1.10 2.1.2 2.1.4 2.1.5 2.1.8 2.2.1 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 All 29 releases
streamcast / freemius / includes / fs-html-escaping-functions.php

fs-html-escaping-functions.php in StreamCast – bring live radio to your site with a sleek player 2.2.1, at freemius/includes/fs-html-escaping-functions.php

125 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 2.5.10
7 */
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 if ( ! function_exists( 'fs_html_get_allowed_kses_list' ) ) {
13 /**
14 * Get the allowed KSES list for sanitizing HTML output on the template files.
15 *
16 * @return array
17 */
18 function fs_html_get_allowed_kses_list() {
19 $common_attributes = array(
20 'class' => true,
21 'style' => true,
22 'data-*' => true,
23 );
24
25 return array(
26 'a' => array_merge(
27 $common_attributes,
28 array(
29 'href' => true,
30 'title' => true,
31 'target' => true,
32 'rel' => true,
33 )
34 ),
35 'img' => array_merge(
36 $common_attributes,
37 array(
38 'src' => true,
39 'alt' => true,
40 'title' => true,
41 'width' => true,
42 'height' => true,
43 )
44 ),
45 'br' => $common_attributes,
46 'em' => $common_attributes,
47 'small' => $common_attributes,
48 'strong' => $common_attributes,
49 'u' => $common_attributes,
50 'b' => $common_attributes,
51 'hr' => $common_attributes,
52 'span' => $common_attributes,
53 'p' => $common_attributes,
54 'div' => $common_attributes,
55 'ul' => $common_attributes,
56 'li' => $common_attributes,
57 'ol' => $common_attributes,
58 'h1' => $common_attributes,
59 'h2' => $common_attributes,
60 'h3' => $common_attributes,
61 'h4' => $common_attributes,
62 'h5' => $common_attributes,
63 'h6' => $common_attributes,
64 'button' => $common_attributes,
65 'sup' => $common_attributes,
66 'sub' => $common_attributes,
67 'nobr' => $common_attributes,
68 );
69 }
70 }
71
72 if ( ! function_exists( 'fs_html_get_classname' ) ) {
73 /**
74 * Gets an HTML class attribute value.
75 *
76 * @param string|string[] $classes
77 *
78 * @return string
79 */
80 function fs_html_get_classname( $classes ) {
81 if ( is_array( $classes ) ) {
82 $classes = implode( ' ', $classes );
83 }
84
85 return esc_attr( $classes );
86 }
87 }
88
89 if ( ! function_exists( 'fs_html_get_attributes' ) ) {
90 /**
91 * Gets a properly escaped HTML attributes string from an associative array.
92 *
93 * @param array<string, string> $attributes A key/value pair array of attributes.
94 *
95 * @return string
96 */
97 function fs_html_get_attributes( $attributes ) {
98 $attribute_string = '';
99
100 foreach ( $attributes as $key => $value ) {
101 $attribute_string .= sprintf(
102 ' %1$s="%2$s"',
103 esc_attr( $key ),
104 esc_attr( $value )
105 );
106 }
107
108 return $attribute_string;
109 }
110 }
111
112 if ( ! function_exists( 'fs_html_get_sanitized_html' ) ) {
113 /**
114 * Get sanitized HTML for template files.
115 *
116 * @param string $raw_html
117 *
118 * @return string
119 * @since 2.5.10
120 */
121 function fs_html_get_sanitized_html( $raw_html ) {
122 return wp_kses( $raw_html, fs_html_get_allowed_kses_list() );
123 }
124 }
125