Merge branch 'master' of github.com:arandilopez/laravel-profane
This commit is contained in:
commit
d18fb71e60
|
|
@ -7,16 +7,18 @@ use Illuminate\Support\Facades\Config;
|
||||||
class Dictionary
|
class Dictionary
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* [$dictionary description]
|
* [$dictionary description].
|
||||||
|
*
|
||||||
* @var [type]
|
* @var [type]
|
||||||
*/
|
*/
|
||||||
private $dictionary;
|
private $dictionary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [__construct description]
|
* [__construct description].
|
||||||
|
*
|
||||||
* @param [type] $dictionary [description]
|
* @param [type] $dictionary [description]
|
||||||
*/
|
*/
|
||||||
function __construct($dictionary = null)
|
public function __construct($dictionary = null)
|
||||||
{
|
{
|
||||||
// Get default locale string in laravel project
|
// Get default locale string in laravel project
|
||||||
// and set it as default dictionary
|
// and set it as default dictionary
|
||||||
|
|
@ -26,7 +28,8 @@ class Dictionary
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [getDictionary description]
|
* [getDictionary description].
|
||||||
|
*
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function getDictionary()
|
public function getDictionary()
|
||||||
|
|
@ -35,18 +38,21 @@ class Dictionary
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the dictionary to use
|
* Set the dictionary to use.
|
||||||
* @param array|string $dictionary
|
*
|
||||||
*/
|
* @param array|string $dictionary
|
||||||
|
*/
|
||||||
public function setDictionary($dictionary)
|
public function setDictionary($dictionary)
|
||||||
{
|
{
|
||||||
$this->dictionary = $this->readDictionary($dictionary);
|
$this->dictionary = $this->readDictionary($dictionary);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [readDictionary description]
|
* [readDictionary description].
|
||||||
* @param [type] $dictionary [description]
|
*
|
||||||
* @return [type] [description]
|
* @param [type] $dictionary [description]
|
||||||
|
*
|
||||||
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
protected function readDictionary($dictionary)
|
protected function readDictionary($dictionary)
|
||||||
{
|
{
|
||||||
|
|
@ -55,23 +61,23 @@ class Dictionary
|
||||||
if (is_array($dictionary)) {
|
if (is_array($dictionary)) {
|
||||||
foreach ($dictionary as $file) {
|
foreach ($dictionary as $file) {
|
||||||
if (file_exists($baseDictPath.$file.'.php')) {
|
if (file_exists($baseDictPath.$file.'.php')) {
|
||||||
$dict = include($baseDictPath.$file.'.php');
|
$dict = include $baseDictPath.$file.'.php';
|
||||||
$words = array_merge($words, $dict);
|
$words = array_merge($words, $dict);
|
||||||
} else {
|
} else {
|
||||||
// if the file isn't in the dict directory,
|
// if the file isn't in the dict directory,
|
||||||
// it's probably a custom user library
|
// it's probably a custom user library
|
||||||
$dict = include($file);
|
$dict = include $file;
|
||||||
$words = array_merge($words, $dict);
|
$words = array_merge($words, $dict);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// just a single string, not an array
|
// just a single string, not an array
|
||||||
} elseif (is_string($dictionary)) {
|
} elseif (is_string($dictionary)) {
|
||||||
if (file_exists($baseDictPath.$dictionary.'.php')) {
|
if (file_exists($baseDictPath.$dictionary.'.php')) {
|
||||||
$dict = include($baseDictPath.$dictionary.'.php');
|
$dict = include $baseDictPath.$dictionary.'.php';
|
||||||
$words = array_merge($words, $dict);
|
$words = array_merge($words, $dict);
|
||||||
} else {
|
} else {
|
||||||
if (file_exists($dictionary)) {
|
if (file_exists($dictionary)) {
|
||||||
$dict = include($dictionary);
|
$dict = include $dictionary;
|
||||||
$words = array_merge($words, $dict);
|
$words = array_merge($words, $dict);
|
||||||
} // else nothing is merged
|
} // else nothing is merged
|
||||||
}
|
}
|
||||||
|
|
@ -81,11 +87,12 @@ class Dictionary
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [getBaseDictPath description]
|
* [getBaseDictPath description].
|
||||||
|
*
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
protected function getBaseDictPath()
|
protected function getBaseDictPath()
|
||||||
{
|
{
|
||||||
return property_exists($this, 'baseDictPath') ? $this->baseDictPath : __DIR__ . DIRECTORY_SEPARATOR .'dict/';
|
return property_exists($this, 'baseDictPath') ? $this->baseDictPath : __DIR__.DIRECTORY_SEPARATOR.'dict/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace LaravelProfane;
|
namespace LaravelProfane;
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
use Illuminate\Support\Facades\Validator;
|
|
||||||
use Illuminate\Support\Facades\Lang;
|
use Illuminate\Support\Facades\Lang;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
|
||||||
class ProfaneServiceProvider extends ServiceProvider
|
class ProfaneServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
@ -17,7 +18,7 @@ class ProfaneServiceProvider extends ServiceProvider
|
||||||
|
|
||||||
Validator::extend('profane', 'LaravelProfane\ProfaneValidator@validate', Lang::get('laravel-profane::validation.profane'));
|
Validator::extend('profane', 'LaravelProfane\ProfaneValidator@validate', Lang::get('laravel-profane::validation.profane'));
|
||||||
|
|
||||||
Validator::replacer('profane', function($message, $attribute, $rule, $parameters) {
|
Validator::replacer('profane', function ($message, $attribute, $rule, $parameters) {
|
||||||
return str_replace(':attribute', $attribute, $message);
|
return str_replace(':attribute', $attribute, $message);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,41 +2,45 @@
|
||||||
|
|
||||||
namespace LaravelProfane;
|
namespace LaravelProfane;
|
||||||
|
|
||||||
use LaravelProfane\Dictionary;
|
|
||||||
use Illuminate\Contracts\Validation\Validator;
|
use Illuminate\Contracts\Validation\Validator;
|
||||||
|
|
||||||
class ProfaneValidator
|
class ProfaneValidator
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* [$dictionary description]
|
* [$dictionary description].
|
||||||
|
*
|
||||||
* @var [type]
|
* @var [type]
|
||||||
*/
|
*/
|
||||||
protected $dictionary;
|
protected $dictionary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [$badwords description]
|
* [$badwords description].
|
||||||
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $badwords = [];
|
protected $badwords = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [__construct description]
|
* [__construct description].
|
||||||
|
*
|
||||||
* @param Dictionary $dictionary [description]
|
* @param Dictionary $dictionary [description]
|
||||||
*/
|
*/
|
||||||
function __construct(Dictionary $dictionary)
|
public function __construct(Dictionary $dictionary)
|
||||||
{
|
{
|
||||||
$this->dictionary = $dictionary;
|
$this->dictionary = $dictionary;
|
||||||
$this->badwords = $dictionary->getDictionary();
|
$this->badwords = $dictionary->getDictionary();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to extends to Validator
|
* Method to extends to Validator.
|
||||||
* @param string $attribute
|
*
|
||||||
* @param midex $value
|
* @param string $attribute
|
||||||
* @param array $parameters
|
* @param midex $value
|
||||||
* @param \Illuminate\Contracts\Validation\Validator $validator [description]
|
* @param array $parameters
|
||||||
* @return bool
|
* @param \Illuminate\Contracts\Validation\Validator $validator [description]
|
||||||
*/
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function validate($attribute, $value, $parameters)
|
public function validate($attribute, $value, $parameters)
|
||||||
{
|
{
|
||||||
if ($parameters) {
|
if ($parameters) {
|
||||||
|
|
@ -48,10 +52,12 @@ class ProfaneValidator
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check profanity of text
|
* Check profanity of text.
|
||||||
* @param string $text
|
*
|
||||||
* @return bool
|
* @param string $text
|
||||||
*/
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
public function isProfane($text)
|
public function isProfane($text)
|
||||||
{
|
{
|
||||||
return Str::containsCaseless(
|
return Str::containsCaseless(
|
||||||
|
|
|
||||||
102
src/Str.php
102
src/Str.php
|
|
@ -5,13 +5,14 @@ namespace LaravelProfane;
|
||||||
class Str
|
class Str
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Taken from Illuminate\Support\Str
|
* Taken from Illuminate\Support\Str
|
||||||
* Determine if a given string contains a given word with case insensitive match.
|
* Determine if a given string contains a given word with case insensitive match.
|
||||||
*
|
*
|
||||||
* @param string $haystack
|
* @param string $haystack
|
||||||
* @param string|array $needles
|
* @param string|array $needles
|
||||||
* @return bool
|
*
|
||||||
*/
|
* @return bool
|
||||||
|
*/
|
||||||
public static function containsCaseless($haystack, $needles)
|
public static function containsCaseless($haystack, $needles)
|
||||||
{
|
{
|
||||||
foreach ((array) $needles as $needle) {
|
foreach ((array) $needles as $needle) {
|
||||||
|
|
@ -20,59 +21,62 @@ class Str
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove accents or special characters from a string.
|
* Remove accents or special characters from a string.
|
||||||
* @param string $string
|
*
|
||||||
|
* @param string $string
|
||||||
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function removeAccent($string)
|
public static function removeAccent($string)
|
||||||
{
|
{
|
||||||
$replace = [
|
$replace = [
|
||||||
'ъ'=>'-', 'Ь'=>'-', 'Ъ'=>'-', 'ь'=>'-',
|
'ъ'=> '-', 'Ь'=>'-', 'Ъ'=>'-', 'ь'=>'-',
|
||||||
'Ă'=>'A', 'Ą'=>'A', 'À'=>'A', 'Ã'=>'A', 'Á'=>'A', 'Æ'=>'A', 'Â'=>'A', 'Å'=>'A', 'Ä'=>'Ae',
|
'Ă'=> 'A', 'Ą'=>'A', 'À'=>'A', 'Ã'=>'A', 'Á'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', 'ſ'=>'z', 'Ж'=>'zh', 'ж'=>'zh', 'ά' => 'α', 'έ' => 'ε', 'ή' => 'η', 'ί' => 'ι', 'ό' => 'ο', 'ύ' => 'υ', 'ώ' => 'ω',
|
||||||
];
|
];
|
||||||
|
|
||||||
return strtr($string, $replace);
|
return strtr($string, $replace);
|
||||||
|
|
|
||||||
|
|
@ -77,5 +77,5 @@ return [
|
||||||
'taint',
|
'taint',
|
||||||
'titty',
|
'titty',
|
||||||
'vag',
|
'vag',
|
||||||
'whore'
|
'whore',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
390
src/dict/it.php
390
src/dict/it.php
|
|
@ -10,200 +10,200 @@ return [
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"affanculo",
|
'affanculo',
|
||||||
"allupato",
|
'allupato',
|
||||||
"ammucchiata",
|
'ammucchiata',
|
||||||
"anale",
|
'anale',
|
||||||
"arrapato",
|
'arrapato',
|
||||||
"arrusa",
|
'arrusa',
|
||||||
"arruso",
|
'arruso',
|
||||||
"assatanato",
|
'assatanato',
|
||||||
"bagascia",
|
'bagascia',
|
||||||
"bagassa",
|
'bagassa',
|
||||||
"bagnarsi",
|
'bagnarsi',
|
||||||
"baldracca",
|
'baldracca',
|
||||||
"balle",
|
'balle',
|
||||||
"battere",
|
'battere',
|
||||||
"battona",
|
'battona',
|
||||||
"belino",
|
'belino',
|
||||||
"biga",
|
'biga',
|
||||||
"bocchinara",
|
'bocchinara',
|
||||||
"bocchinaro",
|
'bocchinaro',
|
||||||
"bocchino",
|
'bocchino',
|
||||||
"bofilo",
|
'bofilo',
|
||||||
"boiata",
|
'boiata',
|
||||||
"bordello",
|
'bordello',
|
||||||
"brinca",
|
'brinca',
|
||||||
"bucaiolo",
|
'bucaiolo',
|
||||||
"budiùlo",
|
'budiùlo',
|
||||||
"buona donna",
|
'buona donna',
|
||||||
"busone",
|
'busone',
|
||||||
"cacca",
|
'cacca',
|
||||||
"caccati in mano e prenditi a schiaffi",
|
'caccati in mano e prenditi a schiaffi',
|
||||||
"caciocappella",
|
'caciocappella',
|
||||||
"cadavere",
|
'cadavere',
|
||||||
"cagare",
|
'cagare',
|
||||||
"cagata",
|
'cagata',
|
||||||
"cagna",
|
'cagna',
|
||||||
"cammello",
|
'cammello',
|
||||||
"cappella",
|
'cappella',
|
||||||
"carciofo",
|
'carciofo',
|
||||||
"carità",
|
'carità',
|
||||||
"casci",
|
'casci',
|
||||||
"cazzata",
|
'cazzata',
|
||||||
"cazzi",
|
'cazzi',
|
||||||
"cazzimma",
|
'cazzimma',
|
||||||
"cazzo",
|
'cazzo',
|
||||||
"checca",
|
'checca',
|
||||||
"chiappa",
|
'chiappa',
|
||||||
"chiavare",
|
'chiavare',
|
||||||
"chiavata",
|
'chiavata',
|
||||||
"ciospo",
|
'ciospo',
|
||||||
"ciucciami il cazzo",
|
'ciucciami il cazzo',
|
||||||
"coglione",
|
'coglione',
|
||||||
"coglioni",
|
'coglioni',
|
||||||
"cornuto",
|
'cornuto',
|
||||||
"cozza",
|
'cozza',
|
||||||
"culattina",
|
'culattina',
|
||||||
"culattone",
|
'culattone',
|
||||||
"culo",
|
'culo',
|
||||||
"di merda",
|
'di merda',
|
||||||
"dio bestia",
|
'dio bestia',
|
||||||
"dio cane",
|
'dio cane',
|
||||||
"dio porco",
|
'dio porco',
|
||||||
"ditalino",
|
'ditalino',
|
||||||
"duro",
|
'duro',
|
||||||
"fanculo",
|
'fanculo',
|
||||||
"fare unaŠ",
|
'fare unaŠ',
|
||||||
"fava",
|
'fava',
|
||||||
"femminuccia",
|
'femminuccia',
|
||||||
"fica",
|
'fica',
|
||||||
"figa",
|
'figa',
|
||||||
"figlio di buona donna",
|
'figlio di buona donna',
|
||||||
"figlio di puttana",
|
'figlio di puttana',
|
||||||
"figone",
|
'figone',
|
||||||
"finocchio",
|
'finocchio',
|
||||||
"fottere",
|
'fottere',
|
||||||
"fottersi",
|
'fottersi',
|
||||||
"fracicone",
|
'fracicone',
|
||||||
"fregna",
|
'fregna',
|
||||||
"frocio",
|
'frocio',
|
||||||
"froscio",
|
'froscio',
|
||||||
"fuori come un balcone",
|
'fuori come un balcone',
|
||||||
"goldone",
|
'goldone',
|
||||||
"grilletto",
|
'grilletto',
|
||||||
"guanto",
|
'guanto',
|
||||||
"guardone",
|
'guardone',
|
||||||
"incazzarsi",
|
'incazzarsi',
|
||||||
"incoglionirsi",
|
'incoglionirsi',
|
||||||
"inculare",
|
'inculare',
|
||||||
"ingoio",
|
'ingoio',
|
||||||
"l'arte bolognese",
|
"l'arte bolognese",
|
||||||
"leccaculo",
|
'leccaculo',
|
||||||
"lecchino",
|
'lecchino',
|
||||||
"lofare",
|
'lofare',
|
||||||
"loffa",
|
'loffa',
|
||||||
"loffare",
|
'loffare',
|
||||||
"lumaca",
|
'lumaca',
|
||||||
"manico",
|
'manico',
|
||||||
"mannaggia",
|
'mannaggia',
|
||||||
"merda",
|
'merda',
|
||||||
"merdata",
|
'merdata',
|
||||||
"merdoso",
|
'merdoso',
|
||||||
"mignotta",
|
'mignotta',
|
||||||
"minchia",
|
'minchia',
|
||||||
"minchione",
|
'minchione',
|
||||||
"mona",
|
'mona',
|
||||||
"monta",
|
'monta',
|
||||||
"montare",
|
'montare',
|
||||||
"mussa",
|
'mussa',
|
||||||
"nave scuola",
|
'nave scuola',
|
||||||
"nerchia",
|
'nerchia',
|
||||||
"nudo",
|
'nudo',
|
||||||
"padulo",
|
'padulo',
|
||||||
"palle",
|
'palle',
|
||||||
"palloso",
|
'palloso',
|
||||||
"patacca",
|
'patacca',
|
||||||
"patonza",
|
'patonza',
|
||||||
"pecorina",
|
'pecorina',
|
||||||
"pesce",
|
'pesce',
|
||||||
"picio",
|
'picio',
|
||||||
"pincare",
|
'pincare',
|
||||||
"pipa",
|
'pipa',
|
||||||
"pippone",
|
'pippone',
|
||||||
"pipì",
|
'pipì',
|
||||||
"pirla",
|
'pirla',
|
||||||
"pisciare",
|
'pisciare',
|
||||||
"piscio",
|
'piscio',
|
||||||
"pisello",
|
'pisello',
|
||||||
"pistola",
|
'pistola',
|
||||||
"pistolotto",
|
'pistolotto',
|
||||||
"pomiciare",
|
'pomiciare',
|
||||||
"pompa",
|
'pompa',
|
||||||
"pompinara",
|
'pompinara',
|
||||||
"pompino",
|
'pompino',
|
||||||
"porca madonna",
|
'porca madonna',
|
||||||
"porca miseria",
|
'porca miseria',
|
||||||
"porca puttana",
|
'porca puttana',
|
||||||
"porca",
|
'porca',
|
||||||
"porco dio",
|
'porco dio',
|
||||||
"porco due",
|
'porco due',
|
||||||
"porco zio",
|
'porco zio',
|
||||||
"potta",
|
'potta',
|
||||||
"puppami",
|
'puppami',
|
||||||
"puttana",
|
'puttana',
|
||||||
"quaglia",
|
'quaglia',
|
||||||
"recchione",
|
'recchione',
|
||||||
"regina",
|
'regina',
|
||||||
"ricchione",
|
'ricchione',
|
||||||
"rincoglionire",
|
'rincoglionire',
|
||||||
"rizzarsi",
|
'rizzarsi',
|
||||||
"rompiballe",
|
'rompiballe',
|
||||||
"rottinculo",
|
'rottinculo',
|
||||||
"ruffiano",
|
'ruffiano',
|
||||||
"sbattere",
|
'sbattere',
|
||||||
"sbattersi",
|
'sbattersi',
|
||||||
"sborra",
|
'sborra',
|
||||||
"sborrata",
|
'sborrata',
|
||||||
"sborrone",
|
'sborrone',
|
||||||
"sbrodolata",
|
'sbrodolata',
|
||||||
"scopare",
|
'scopare',
|
||||||
"scopata",
|
'scopata',
|
||||||
"scorreggiare",
|
'scorreggiare',
|
||||||
"sega",
|
'sega',
|
||||||
"segaiolo",
|
'segaiolo',
|
||||||
"slinguare",
|
'slinguare',
|
||||||
"slinguata",
|
'slinguata',
|
||||||
"smandrappata",
|
'smandrappata',
|
||||||
"soccia",
|
'soccia',
|
||||||
"socmel",
|
'socmel',
|
||||||
"sorca",
|
'sorca',
|
||||||
"spagnola",
|
'spagnola',
|
||||||
"spompinare",
|
'spompinare',
|
||||||
"sticchio",
|
'sticchio',
|
||||||
"stronza",
|
'stronza',
|
||||||
"stronzata",
|
'stronzata',
|
||||||
"stronzo",
|
'stronzo',
|
||||||
"succhiami",
|
'succhiami',
|
||||||
"sveltina",
|
'sveltina',
|
||||||
"sverginare",
|
'sverginare',
|
||||||
"tarzanello",
|
'tarzanello',
|
||||||
"terrone",
|
'terrone',
|
||||||
"testa di cazzo",
|
'testa di cazzo',
|
||||||
"tette",
|
'tette',
|
||||||
"tirare",
|
'tirare',
|
||||||
"topa",
|
'topa',
|
||||||
"troia",
|
'troia',
|
||||||
"troietta",
|
'troietta',
|
||||||
"troiona",
|
'troiona',
|
||||||
"troione",
|
'troione',
|
||||||
"trombare",
|
'trombare',
|
||||||
"uccello",
|
'uccello',
|
||||||
"vacca",
|
'vacca',
|
||||||
"vaffanculo",
|
'vaffanculo',
|
||||||
"vangare",
|
'vangare',
|
||||||
"venire",
|
'venire',
|
||||||
"zinne",
|
'zinne',
|
||||||
"zio cantante",
|
'zio cantante',
|
||||||
"zoccola"
|
'zoccola',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -32,5 +32,5 @@ return [
|
||||||
'geitenneuker',
|
'geitenneuker',
|
||||||
'pedo',
|
'pedo',
|
||||||
'randdebiel',
|
'randdebiel',
|
||||||
'lul'
|
'lul',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -2,52 +2,52 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* List of bad words without accent.
|
* List of bad words without accent.
|
||||||
*
|
*
|
||||||
* Provided by @kotass
|
* Provided by @kotass
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"kokot",
|
'kokot',
|
||||||
"kokoti",
|
'kokoti',
|
||||||
"jebat",
|
'jebat',
|
||||||
"jebnuty",
|
'jebnuty',
|
||||||
"vyjebany",
|
'vyjebany',
|
||||||
"buzerant",
|
'buzerant',
|
||||||
"pica",
|
'pica',
|
||||||
"pice",
|
'pice',
|
||||||
"hovno",
|
'hovno',
|
||||||
"picus",
|
'picus',
|
||||||
"vyjebanec",
|
'vyjebanec',
|
||||||
"kurva",
|
'kurva',
|
||||||
"skurvenec",
|
'skurvenec',
|
||||||
"jebal",
|
'jebal',
|
||||||
"kurvu",
|
'kurvu',
|
||||||
"buzik",
|
'buzik',
|
||||||
"bukviciak",
|
'bukviciak',
|
||||||
"chuj",
|
'chuj',
|
||||||
"chumaj",
|
'chumaj',
|
||||||
"curak",
|
'curak',
|
||||||
"debil",
|
'debil',
|
||||||
"dement",
|
'dement',
|
||||||
"jebacka",
|
'jebacka',
|
||||||
"jeblina",
|
'jeblina',
|
||||||
"jebo",
|
'jebo',
|
||||||
"popici",
|
'popici',
|
||||||
"ojeb",
|
'ojeb',
|
||||||
"ojebavat",
|
'ojebavat',
|
||||||
"picovat",
|
'picovat',
|
||||||
"rit",
|
'rit',
|
||||||
"skokoteny",
|
'skokoteny',
|
||||||
"skurvit",
|
'skurvit',
|
||||||
"trtko",
|
'trtko',
|
||||||
"ujeb",
|
'ujeb',
|
||||||
"ujebat",
|
'ujebat',
|
||||||
"jeba",
|
'jeba',
|
||||||
"zmrd",
|
'zmrd',
|
||||||
"zjebat",
|
'zjebat',
|
||||||
"zajebany",
|
'zajebany',
|
||||||
"zapiceny",
|
'zapiceny',
|
||||||
"vytrtkany"
|
'vytrtkany',
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
@ -83,5 +83,5 @@ return [
|
||||||
'顏射',
|
'顏射',
|
||||||
'肛交',
|
'肛交',
|
||||||
'潮吹',
|
'潮吹',
|
||||||
'軟屌'
|
'軟屌',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'profane' => 'The :attribute contains vulgar content'
|
'profane' => 'The :attribute contains vulgar content',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'profane' => 'El :attribute contiene palabras vulgares'
|
'profane' => 'El :attribute contiene palabras vulgares',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'profane' => 'Het :attribute veld bevat vulgaire inhoud'
|
'profane' => 'Het :attribute veld bevat vulgaire inhoud',
|
||||||
];
|
];
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'profane' => 'O campo :attribute contém palavras vulgares'
|
'profane' => 'O campo :attribute contém palavras vulgares',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'profane' => ':attribute obsahuje vulgárny obsah'
|
'profane' => ':attribute obsahuje vulgárny obsah',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'profane' => ':attribute欄位內容包含粗俗用詞,請您修正:)'
|
'profane' => ':attribute欄位內容包含粗俗用詞,請您修正:)',
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
namespace LaravelProfaneTests;
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
use LaravelProfane\Dictionary;
|
use LaravelProfane\Dictionary;
|
||||||
use LaravelProfaneTests\TestCase;
|
|
||||||
|
|
||||||
class DictionaryTest extends TestCase
|
class DictionaryTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
@ -29,7 +28,7 @@ class DictionaryTest extends TestCase
|
||||||
{
|
{
|
||||||
$dictionary = new Dictionary([
|
$dictionary = new Dictionary([
|
||||||
'es',
|
'es',
|
||||||
'gr'
|
'gr',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$expected = array_merge(
|
$expected = array_merge(
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
namespace LaravelProfaneTests;
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
use LaravelProfane\ProfaneValidator;
|
|
||||||
use LaravelProfaneTests\TestCase;
|
|
||||||
use LaravelProfaneTests\Support\ProfaneValidatorBuilder;
|
use LaravelProfaneTests\Support\ProfaneValidatorBuilder;
|
||||||
|
|
||||||
class ProfaneValidatorTest extends TestCase
|
class ProfaneValidatorTest extends TestCase
|
||||||
|
|
@ -19,7 +17,7 @@ class ProfaneValidatorTest extends TestCase
|
||||||
{
|
{
|
||||||
$builder = new ProfaneValidatorBuilder();
|
$builder = new ProfaneValidatorBuilder();
|
||||||
|
|
||||||
$this->assertFalse($builder->validate(['description', 'fck you bitch. 幹!', ['es', 'en' , 'zh-tw']]));
|
$this->assertFalse($builder->validate(['description', 'fck you bitch. 幹!', ['es', 'en', 'zh-tw']]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_can_evaluate_profanity_of_a_word()
|
public function test_can_evaluate_profanity_of_a_word()
|
||||||
|
|
@ -73,7 +71,7 @@ class ProfaneValidatorTest extends TestCase
|
||||||
{
|
{
|
||||||
$builder = new ProfaneValidatorBuilder('sk');
|
$builder = new ProfaneValidatorBuilder('sk');
|
||||||
|
|
||||||
$word = "piča";
|
$word = 'piča';
|
||||||
|
|
||||||
$this->assertTrue($builder->build()->isProfane($word));
|
$this->assertTrue($builder->build()->isProfane($word));
|
||||||
}
|
}
|
||||||
|
|
@ -83,7 +81,7 @@ class ProfaneValidatorTest extends TestCase
|
||||||
$builder = new ProfaneValidatorBuilder('es');
|
$builder = new ProfaneValidatorBuilder('es');
|
||||||
|
|
||||||
// in spanish coño =! cono
|
// in spanish coño =! cono
|
||||||
$word = "coño";
|
$word = 'coño';
|
||||||
|
|
||||||
$this->assertTrue($builder->build()->isProfane($word));
|
$this->assertTrue($builder->build()->isProfane($word));
|
||||||
}
|
}
|
||||||
|
|
@ -94,7 +92,7 @@ class ProfaneValidatorTest extends TestCase
|
||||||
|
|
||||||
$builder = new ProfaneValidatorBuilder('gr');
|
$builder = new ProfaneValidatorBuilder('gr');
|
||||||
|
|
||||||
$word = "μαλάκας";
|
$word = 'μαλάκας';
|
||||||
|
|
||||||
$this->assertTrue($builder->build()->isProfane($word));
|
$this->assertTrue($builder->build()->isProfane($word));
|
||||||
}
|
}
|
||||||
|
|
@ -105,6 +103,6 @@ class ProfaneValidatorTest extends TestCase
|
||||||
|
|
||||||
$builder = new ProfaneValidatorBuilder();
|
$builder = new ProfaneValidatorBuilder();
|
||||||
|
|
||||||
$this->assertFalse($builder->validate(['description', 'εισαι πουτανα', ['en' , 'gr']]));
|
$this->assertFalse($builder->validate(['description', 'εισαι πουτανα', ['en', 'gr']]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
namespace LaravelProfaneTests;
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
use LaravelProfaneTests\TestCase;
|
|
||||||
use LaravelProfane\Str;
|
use LaravelProfane\Str;
|
||||||
|
|
||||||
class StrTest extends TestCase
|
class StrTest extends TestCase
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,21 @@
|
||||||
|
|
||||||
namespace LaravelProfaneTests\Support;
|
namespace LaravelProfaneTests\Support;
|
||||||
|
|
||||||
use LaravelProfane\ProfaneValidator;
|
|
||||||
use LaravelProfane\Dictionary;
|
use LaravelProfane\Dictionary;
|
||||||
|
use LaravelProfane\ProfaneValidator;
|
||||||
|
|
||||||
class ProfaneValidatorBuilder
|
class ProfaneValidatorBuilder
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* [$profaneValidator description]
|
* [$profaneValidator description].
|
||||||
|
*
|
||||||
* @var [type]
|
* @var [type]
|
||||||
*/
|
*/
|
||||||
protected $profaneValidator;
|
protected $profaneValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [__construct description]
|
* [__construct description].
|
||||||
|
*
|
||||||
* @param [type] $dictionary [description]
|
* @param [type] $dictionary [description]
|
||||||
*/
|
*/
|
||||||
public function __construct($dictionary = null)
|
public function __construct($dictionary = null)
|
||||||
|
|
@ -23,9 +25,11 @@ class ProfaneValidatorBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [validate description]
|
* [validate description].
|
||||||
* @param array $parameters [description]
|
*
|
||||||
* @return [type] [description]
|
* @param array $parameters [description]
|
||||||
|
*
|
||||||
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function validate(array $parameters)
|
public function validate(array $parameters)
|
||||||
{
|
{
|
||||||
|
|
@ -35,7 +39,8 @@ class ProfaneValidatorBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [build description]
|
* [build description].
|
||||||
|
*
|
||||||
* @return LaravelProfane\ProfaneValidator
|
* @return LaravelProfane\ProfaneValidator
|
||||||
*/
|
*/
|
||||||
public function build()
|
public function build()
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
namespace LaravelProfaneTests;
|
namespace LaravelProfaneTests;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Config;
|
use Illuminate\Support\Facades\Config;
|
||||||
|
use Mockery;
|
||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit_Framework_TestCase;
|
||||||
use \Mockery;
|
|
||||||
|
|
||||||
class TestCase extends PHPUnit_Framework_TestCase
|
class TestCase extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* [setUp description]
|
* [setUp description].
|
||||||
*/
|
*/
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +18,8 @@ class TestCase extends PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [tearDown description]
|
* [tearDown description].
|
||||||
|
*
|
||||||
* @return [type] [description]
|
* @return [type] [description]
|
||||||
*/
|
*/
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
|
@ -28,7 +29,8 @@ class TestCase extends PHPUnit_Framework_TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [mockConfigs description]
|
* [mockConfigs description].
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function mockConfigs()
|
protected function mockConfigs()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue