-
-
Notifications
You must be signed in to change notification settings - Fork 597
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2796 from Leantime/fixAvatarFontFileIssues
Resolving open basedir restrictions with font files in avatar generat…
- Loading branch information
Showing
13 changed files
with
122 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Leantime\Core\Providers; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
use Illuminate\Support\Stringable; | ||
use Leantime\Core\Support\StringableMacros; | ||
|
||
class LoadMacros extends ServiceProvider | ||
{ | ||
/** | ||
* Register any application services. | ||
*/ | ||
public function register(): void | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Bootstrap any application services. | ||
*/ | ||
public function boot(): void | ||
{ | ||
Stringable::mixin(new StringableMacros); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Leantime\Core\Support; | ||
|
||
/** | ||
* @mixin \Illuminate\Support\Stringable | ||
*/ | ||
class StringableMacros | ||
{ | ||
/** | ||
* 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 () use ($removeSpaces) { | ||
/** @var \Illuminate\Support\Stringable $this */ | ||
$cleaned = preg_replace('/[^A-Za-z0-9 ]/', '', (string) $this); | ||
|
||
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; | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters