芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/timucuy.com/wp-content/themes/hestia/inc/helpers/sanitize-functions.php
$box ) { foreach ( $box as $key => $value ) { $value_decoded[ $boxk ][ $key ] = wp_kses_post( force_balance_tags( $value ) ); } } return json_encode( $value_decoded ); } return $value; } /** * Allowed HTML tags for text controls * * @param string $value the string to be sanitized. * * @return string */ function hestia_sanitize_string( $value ) { $allowed_html = apply_filters( 'hestia_sanitize_html_tags', array( 'a' => array( 'href' => array(), 'title' => array(), 'class' => array(), ), 'br' => array(), 'em' => array(), 'strong' => array(), 'i' => array( 'class' => array(), ), 'b' => array(), 'p' => array(), ) ); $value = force_balance_tags( $value ); return wp_kses( $value, $allowed_html ); } /** * Sanitize checkbox output. * * @param bool $value value to be sanitized. * * @return string * @since Hestia 1.0 */ function hestia_sanitize_checkbox( $value ) { return isset( $value ) && true === (bool) $value; } /** * Sanitize multi select output. * * @param string $value value to be sanitized. * * @return array * @since Hestia 1.0 */ function hestia_sanitize_multiselect( $value ) { if ( ! is_array( $value ) ) { $value = explode( ',', $value ); } return ! empty( $value ) ? array_map( 'sanitize_text_field', $value ) : array(); } /** * Check if a string is in json format * * @param string $string Input. * * @since 1.1.38 * @return bool */ function hestia_is_json( $string ) { return is_string( $string ) && is_array( json_decode( $string, true ) ) ? true : false; } /** * Sanitize values for range inputs. * * @param string $input Control input. * * @since 1.1.38 * @return float */ function hestia_sanitize_range_value( $input ) { if ( ! hestia_is_json( $input ) ) { return floatval( $input ); } $range_value = json_decode( $input, true ); $range_value['desktop'] = ! empty( $range_value['desktop'] ) || $range_value['desktop'] === '0' ? floatval( $range_value['desktop'] ) : ''; $range_value['tablet'] = ! empty( $range_value['tablet'] ) || $range_value['tablet'] === '0' ? floatval( $range_value['tablet'] ) : ''; $range_value['mobile'] = ! empty( $range_value['mobile'] ) || $range_value['mobile'] === '0' ? floatval( $range_value['mobile'] ) : ''; return json_encode( $range_value ); } /** * Dimension sanitization callback * * @param string $val Input value. */ function hestia_sanitize_dimension( $val ) { $decoded_array = json_decode( $val ); if ( empty( $decoded_array ) ) { return ''; } foreach ( $decoded_array as $array_item ) { $array_item_decoded = json_decode( $array_item ); if ( empty( $array_item_decoded ) ) { return ''; } foreach ( $array_item_decoded as $dimension ) { if ( ! empty( $dimension ) && ! is_numeric( $dimension ) ) { return ''; } } } return $val; }