PluginProbe ʕ •ᴥ•ʔ
Code Manager / 1.0.28
Code Manager v1.0.28
1.0.48 1.0.47 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25 1.0.26 1.0.27 1.0.28 1.0.3 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 1.0.39 1.0.4 1.0.40 1.0.41 1.0.42 1.0.43 1.0.44 1.0.45 1.0.46 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
code-manager / freemius / includes / fs-html-escaping-functions.php
code-manager / freemius / includes Last commit date
customizer 2 years ago debug 2 years ago entities 2 years ago managers 2 years ago sdk 2 years ago supplements 2 years ago class-freemius-abstract.php 2 years ago class-freemius.php 2 years ago class-fs-admin-notices.php 2 years ago class-fs-api.php 2 years ago class-fs-lock.php 2 years ago class-fs-logger.php 2 years ago class-fs-options.php 2 years ago class-fs-plugin-updater.php 2 years ago class-fs-security.php 2 years ago class-fs-storage.php 2 years ago class-fs-user-lock.php 2 years ago fs-core-functions.php 2 years ago fs-essential-functions.php 2 years ago fs-html-escaping-functions.php 2 years ago fs-plugin-info-dialog.php 2 years ago index.php 2 years ago l10n.php 2 years ago
fs-html-escaping-functions.php
125 lines
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