OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace Leantime\Core\Support\String;
/**
* @mixin \Illuminate\Support\Stringable
*/
class AlphaNumeric
{
/**
* Cleans a string by removing special characters and optionally spaces.
*
* @param bool $removeSpaces Whether to remove spaces from the string.
* @return callable A function that cleans a string based on the given parameter.
*/
public function alphaNumeric($removeSpaces = false)
{
return function ($value) use ($removeSpaces) {
$cleaned = preg_replace('/[^A-Za-z0-9 ]/', '', (string) $value);
if ($removeSpaces) {
$cleaned = str_replace(' ', '', $cleaned);
} else {
// Step 2: Replace multiple spaces with a single space
$cleaned = preg_replace('/\s+/', ' ', $cleaned);
}
// Step 3: Trim leading and trailing spaces
$cleaned = trim($cleaned);
return $cleaned;
};
}
}