Server IP : 162.0.217.223 / Your IP : 216.73.216.168 Web Server : LiteSpeed System : Linux premium269.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : mypckeys ( 1539) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/mypckeys/tu-international.com/wp-content/plugins/extendify/app/Shared/Services/ |
Upload File : |
<?php /** * The Sanitizer class */ namespace Extendify\Shared\Services; defined('ABSPATH') || die('No direct access.'); /** * Class for sanitizing various data types. */ class Sanitizer { /** * This function will sanitize a value. * * @param mixed $data - The data we need to sanitize. * @return array|string */ public static function sanitizeUnknown($data) { return is_array($data) ? self::sanitizeArray($data) : self::sanitizeText($data); } /** * This function will sanitize a multidimensional array. * * @param array $array - The array we need to sanitize. * @return array */ public static function sanitizeArray($array) { $sanitizedArray = []; foreach ($array as $key => $value) { $sanitizedArray[$key] = is_array($value) ? self::sanitizeArray($value) : \sanitize_text_field($value); } return $sanitizedArray; } /** * This function will sanitize a text field. * * @param string $text - The string we need to sanitize. * @return string */ public static function sanitizeText($text) { return \sanitize_text_field($text); } /** * This function will sanitize a textarea field. * * @param string $text - The strings we need to sanitize. * @return string */ public static function sanitizeTextarea($text) { return \sanitize_textarea_field($text); } /** * This function will sanitize the post content. * * @param string $content - The post content we need to sanitize. * @return string */ public static function sanitizePostContent($content) { return \wp_kses_post($content); } }