PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / includes / features / bbpc_attachments / code / sanitize.php

sanitize.php in Forumax – AI Powered Advanced Community Forum Plugin 2.2.0, at includes/features/bbpc_attachments/code/sanitize.php

76 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 if ( ! function_exists( 'forumax_sanitize_key_expanded' ) ) {
8 function forumax_sanitize_key_expanded( $key ) {
9 $key = strtolower( $key );
10 $key = preg_replace( '/[^a-z0-9._\-]/', '', $key );
11
12 return $key;
13 }
14 }
15
16 if ( ! function_exists( 'bbpc_sanitize_extended' ) ) {
17 function bbpc_sanitize_extended( $text, $tags = null, $protocols = [], $strip_shortcodes = false ) {
18 $tags = is_null( $tags ) ? wp_kses_allowed_html( 'post' ) : $tags;
19 $text = stripslashes( $text );
20
21 if ( $strip_shortcodes ) {
22 $text = strip_shortcodes( $text );
23 }
24
25 return wp_kses( trim( $text ), $tags, $protocols );
26 }
27 }
28
29 if ( ! function_exists( 'bbpc_sanitize_basic' ) ) {
30 function bbpc_sanitize_basic( $text, $strip_shortcodes = true ) {
31 $text = stripslashes( $text );
32
33 if ( $strip_shortcodes ) {
34 $text = strip_shortcodes( $text );
35 }
36
37 return trim( wp_kses( $text, [] ) );
38 }
39 }
40
41 if ( ! function_exists( 'bbpc_sanitize_html' ) ) {
42 function bbpc_sanitize_html( $text, $tags = null, $protocols = [] ) {
43 $tags = is_null( $tags ) ? wp_kses_allowed_html( 'post' ) : $tags;
44
45 return wp_kses( trim( stripslashes( $text ) ), $tags, $protocols );
46 }
47 }
48
49 if ( ! function_exists( 'bbpc_sanitize_slug' ) ) {
50 function bbpc_sanitize_slug( $text ) {
51 return trim( sanitize_title_with_dashes( stripslashes( $text ) ), "-_ \t\n\r\0\x0B" );
52 }
53 }
54
55 if ( ! function_exists( 'bbpc_sanitize_html_classes' ) ) {
56 function bbpc_sanitize_html_classes( $classes ) {
57 $list = explode( ' ', trim( stripslashes( $classes ) ) );
58 $list = array_map( 'sanitize_html_class', $list );
59
60 return trim( join( ' ', $list ) );
61 }
62 }
63
64 if ( ! function_exists( 'bbpc_sanitize_basic_array' ) ) {
65 function bbpc_sanitize_basic_array( $input, $strip_shortcodes = true ) {
66 $output = [];
67
68 foreach ( $input as $key => $value ) {
69 $output[ $key ] = bbpc_sanitize_basic( $value, $strip_shortcodes );
70 }
71
72 return $output;
73 }
74 }
75
76