mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-18 12:28:46 +00:00
Various changes to support the removed old code.
This commit is contained in:
22
app/lib/FireflyIII/Shared/Validation/FireflyValidator.php
Normal file
22
app/lib/FireflyIII/Shared/Validation/FireflyValidator.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace FireflyIII\Shared\Validation;
|
||||
|
||||
use Illuminate\Validation\Validator;
|
||||
|
||||
/**
|
||||
* Class FireflyValidator
|
||||
*
|
||||
* @package FireflyIII\Shared\Validation
|
||||
*/
|
||||
class FireflyValidator extends Validator
|
||||
{
|
||||
public function validateAlphabasic($attribute, $value, $parameters)
|
||||
{
|
||||
$pattern = '/[^[:alnum:]_\-\.\& \(\)\'"]/iu';
|
||||
if (preg_match($pattern, $value)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace FireflyIII\Shared\Validation;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* Class ValidationServiceProvider
|
||||
* @package FireflyIII\Shared\Validation
|
||||
*/
|
||||
class ValidationServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function boot()
|
||||
{
|
||||
$this->app->validator->resolver(
|
||||
function ($translator, $data, $rules, $messages) {
|
||||
return new FireflyValidator($translator, $data, $rules, $messages);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public function register()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user