File manager - Edit - /home/autoph/public_html/data03252025consolidation/src/Utilities/Utility.php
Back
<?php namespace App\Utilities; class Utility { public static function removeNotAlphaNumeric($data) { $str = preg_replace("/[^a-zA-Z0-9]+/", "", $data); return $str; } public static function toSqlDate($date) { return !empty($date) ? date('Y-m-d H:i:s', strtotime($date)) : NULL; } public static function toDateTimePicker($date) { return !empty($date) ? date('m/d/Y h:i A', strtotime($date)) : NULL; } public static function nullEmptyArray($array) { foreach ($array as $key => $value) { if (is_array($value)) { $array[$key] = self::nullEmptyArray($value); } if (empty($value) && !is_numeric($value)) { $array[$key] = NULL; } } return $array; } public static function base64_url_encode($input) { return strtr(base64_encode($input), '+/=', '-_-'); } public static function upperCaseNestedArray($value) { if (is_array($value)) { return array_map(array(new Utility(), 'upperCaseNestedArray'), $value); } return trim(mb_strtoupper($value)); } public static function maskString($str, $first = 3, $last = 2, $maskChar = '*') { if (!$str) { return ""; } $len = strlen($str); $toShow = $first + $last; return substr($str, 0, $len <= $toShow ? 0 : $first) . str_repeat($maskChar, $len - ($len <= $toShow ? 0 : $toShow)) . substr($str, $len - $last, $len <= $toShow ? 0 : $last); } public static function maskEmail($email, $maskChar = "*") { if (!$email) { return ""; } $mail_parts = explode("@", $email); $domain_parts = explode('.', $mail_parts[1]); $mail_parts[0] = self::maskString($mail_parts[0], 2, 1, $maskChar); // show first 2 letters and last 1 letter $mail_parts[1] = implode('.', $domain_parts); return implode("@", $mail_parts); } public static function includeFiles($directory) { if (is_dir($directory)) { $scan = scandir($directory); unset($scan[0], $scan[1]); //unset . and .. foreach ($scan as $file) { if (is_dir($directory . "/" . $file)) { self::includeFiles($directory . "/" . $file); } else { if (strpos($file, '.php') !== false) { include_once($directory . "/" . $file); } } } } } }
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0.01 |
proxy
|
phpinfo
|
Settings