PluginProbe ʕ •ᴥ•ʔ
Auto Post Cleaner / 3.10.2
Auto Post Cleaner v3.10.2
3.12.0 3.13.1 3.2.4 3.2.5 3.3.0 3.3.10 3.3.11 3.3.8 3.4.2 3.5.3 3.6.0 3.7.0 3.7.1 3.7.2 3.7.3 3.7.5 3.7.6 3.8.0 3.9.0 3.9.4 3.9.6 3.9.7 trunk 3.0.0 3.1.0 3.10.1 3.10.2 3.11.4
delete-old-posts-programmatically / freemius / includes / fs-html-escaping-functions.php
delete-old-posts-programmatically / freemius / includes Last commit date
customizer 11 months ago debug 2 years ago entities 11 months ago managers 11 months ago sdk 2 years ago supplements 3 years ago class-freemius-abstract.php 3 years ago class-freemius.php 11 months ago class-fs-admin-notices.php 3 years ago class-fs-api.php 1 year ago class-fs-garbage-collector.php 2 years ago class-fs-lock.php 3 years ago class-fs-logger.php 11 months ago class-fs-options.php 5 years ago class-fs-plugin-updater.php 11 months ago class-fs-security.php 1 year ago class-fs-storage.php 1 year ago class-fs-user-lock.php 3 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 5 years ago l10n.php 5 years ago
fs-html-escaping-functions.php
127 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 'id' => true,
21 'class' => true,
22 'style' => true,
23 'data-*' => true,
24 );
25
26 return array(
27 'a' => array_merge(
28 $common_attributes,
29 array(
30 'href' => true,
31 'title' => true,
32 'target' => true,
33 'rel' => true,
34 )
35 ),
36 'img' => array_merge(
37 $common_attributes,
38 array(
39 'src' => true,
40 'alt' => true,
41 'title' => true,
42 'width' => true,
43 'height' => true,
44 )
45 ),
46 'br' => $common_attributes,
47 'em' => $common_attributes,
48 'small' => $common_attributes,
49 'strong' => $common_attributes,
50 'u' => $common_attributes,
51 'b' => $common_attributes,
52 'i' => $common_attributes,
53 'hr' => $common_attributes,
54 'span' => $common_attributes,
55 'p' => $common_attributes,
56 'div' => $common_attributes,
57 'ul' => $common_attributes,
58 'li' => $common_attributes,
59 'ol' => $common_attributes,
60 'h1' => $common_attributes,
61 'h2' => $common_attributes,
62 'h3' => $common_attributes,
63 'h4' => $common_attributes,
64 'h5' => $common_attributes,
65 'h6' => $common_attributes,
66 'button' => $common_attributes,
67 'sup' => $common_attributes,
68 'sub' => $common_attributes,
69 'nobr' => $common_attributes,
70 );
71 }
72 }
73
74 if ( ! function_exists( 'fs_html_get_classname' ) ) {
75 /**
76 * Gets an HTML class attribute value.
77 *
78 * @param string|string[] $classes
79 *
80 * @return string
81 */
82 function fs_html_get_classname( $classes ) {
83 if ( is_array( $classes ) ) {
84 $classes = implode( ' ', $classes );
85 }
86
87 return esc_attr( $classes );
88 }
89 }
90
91 if ( ! function_exists( 'fs_html_get_attributes' ) ) {
92 /**
93 * Gets a properly escaped HTML attributes string from an associative array.
94 *
95 * @param array<string, string> $attributes A key/value pair array of attributes.
96 *
97 * @return string
98 */
99 function fs_html_get_attributes( $attributes ) {
100 $attribute_string = '';
101
102 foreach ( $attributes as $key => $value ) {
103 $attribute_string .= sprintf(
104 ' %1$s="%2$s"',
105 esc_attr( $key ),
106 esc_attr( $value )
107 );
108 }
109
110 return $attribute_string;
111 }
112 }
113
114 if ( ! function_exists( 'fs_html_get_sanitized_html' ) ) {
115 /**
116 * Get sanitized HTML for template files.
117 *
118 * @param string $raw_html
119 *
120 * @return string
121 * @since 2.5.10
122 */
123 function fs_html_get_sanitized_html( $raw_html ) {
124 return wp_kses( $raw_html, fs_html_get_allowed_kses_list() );
125 }
126 }
127