Merge branch 'master' of github.com:arandilopez/laravel-profane

This commit is contained in:
Arandi Lopez 2017-10-11 11:48:05 -05:00
commit d18fb71e60
20 changed files with 381 additions and 360 deletions

View File

@ -7,16 +7,18 @@ use Illuminate\Support\Facades\Config;
class Dictionary
{
/**
* [$dictionary description]
* [$dictionary description].
*
* @var [type]
*/
private $dictionary;
/**
* [__construct description]
* [__construct description].
*
* @param [type] $dictionary [description]
*/
function __construct($dictionary = null)
public function __construct($dictionary = null)
{
// Get default locale string in laravel project
// and set it as default dictionary
@ -26,7 +28,8 @@ class Dictionary
}
/**
* [getDictionary description]
* [getDictionary description].
*
* @return [type] [description]
*/
public function getDictionary()
@ -35,18 +38,21 @@ class Dictionary
}
/**
* Set the dictionary to use
* @param array|string $dictionary
*/
* Set the dictionary to use.
*
* @param array|string $dictionary
*/
public function setDictionary($dictionary)
{
$this->dictionary = $this->readDictionary($dictionary);
}
/**
* [readDictionary description]
* @param [type] $dictionary [description]
* @return [type] [description]
* [readDictionary description].
*
* @param [type] $dictionary [description]
*
* @return [type] [description]
*/
protected function readDictionary($dictionary)
{
@ -55,23 +61,23 @@ class Dictionary
if (is_array($dictionary)) {
foreach ($dictionary as $file) {
if (file_exists($baseDictPath.$file.'.php')) {
$dict = include($baseDictPath.$file.'.php');
$dict = include $baseDictPath.$file.'.php';
$words = array_merge($words, $dict);
} else {
// if the file isn't in the dict directory,
// it's probably a custom user library
$dict = include($file);
$dict = include $file;
$words = array_merge($words, $dict);
}
}
// just a single string, not an array
} elseif (is_string($dictionary)) {
if (file_exists($baseDictPath.$dictionary.'.php')) {
$dict = include($baseDictPath.$dictionary.'.php');
$dict = include $baseDictPath.$dictionary.'.php';
$words = array_merge($words, $dict);
} else {
if (file_exists($dictionary)) {
$dict = include($dictionary);
$dict = include $dictionary;
$words = array_merge($words, $dict);
} // else nothing is merged
}
@ -81,11 +87,12 @@ class Dictionary
}
/**
* [getBaseDictPath description]
* [getBaseDictPath description].
*
* @return [type] [description]
*/
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/';
}
}

View File

@ -1,9 +1,10 @@
<?php
namespace LaravelProfane;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Lang;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\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::replacer('profane', function($message, $attribute, $rule, $parameters) {
Validator::replacer('profane', function ($message, $attribute, $rule, $parameters) {
return str_replace(':attribute', $attribute, $message);
});
}

View File

@ -2,41 +2,45 @@
namespace LaravelProfane;
use LaravelProfane\Dictionary;
use Illuminate\Contracts\Validation\Validator;
class ProfaneValidator
{
/**
* [$dictionary description]
* [$dictionary description].
*
* @var [type]
*/
protected $dictionary;
/**
* [$badwords description]
* [$badwords description].
*
* @var array
*/
protected $badwords = [];
/**
* [__construct description]
* [__construct description].
*
* @param Dictionary $dictionary [description]
*/
function __construct(Dictionary $dictionary)
public function __construct(Dictionary $dictionary)
{
$this->dictionary = $dictionary;
$this->badwords = $dictionary->getDictionary();
$this->badwords = $dictionary->getDictionary();
}
/**
* Method to extends to Validator
* @param string $attribute
* @param midex $value
* @param array $parameters
* @param \Illuminate\Contracts\Validation\Validator $validator [description]
* @return bool
*/
* Method to extends to Validator.
*
* @param string $attribute
* @param midex $value
* @param array $parameters
* @param \Illuminate\Contracts\Validation\Validator $validator [description]
*
* @return bool
*/
public function validate($attribute, $value, $parameters)
{
if ($parameters) {
@ -48,10 +52,12 @@ class ProfaneValidator
}
/**
* Check profanity of text
* @param string $text
* @return bool
*/
* Check profanity of text.
*
* @param string $text
*
* @return bool
*/
public function isProfane($text)
{
return Str::containsCaseless(

View File

@ -5,13 +5,14 @@ namespace LaravelProfane;
class Str
{
/**
* Taken from Illuminate\Support\Str
* Determine if a given string contains a given word with case insensitive match.
*
* @param string $haystack
* @param string|array $needles
* @return bool
*/
* Taken from Illuminate\Support\Str
* Determine if a given string contains a given word with case insensitive match.
*
* @param string $haystack
* @param string|array $needles
*
* @return bool
*/
public static function containsCaseless($haystack, $needles)
{
foreach ((array) $needles as $needle) {
@ -20,59 +21,62 @@ class Str
return true;
}
}
return false;
}
/**
* Remove accents or special characters from a string.
* @param string $string
*
* @param string $string
*
* @return string
*/
public static function removeAccent($string)
{
$replace = [
'ъ'=>'-', 'Ь'=>'-', 'Ъ'=>'-', 'ь'=>'-',
'Ă'=>'A', 'Ą'=>'A', 'À'=>'A', 'Ã'=>'A', 'Á'=>'A', 'Æ'=>'A', 'Â'=>'A', 'Å'=>'A', 'Ä'=>'Ae',
'Þ'=>'B',
'Ć'=>'C', 'ץ'=>'C', 'Ç'=>'C',
'È'=>'E', 'Ę'=>'E', 'É'=>'E', 'Ë'=>'E', 'Ê'=>'E',
'Ğ'=>'G',
'İ'=>'I', 'Ï'=>'I', 'Î'=>'I', 'Í'=>'I', 'Ì'=>'I',
'Ł'=>'L',
'Ñ'=>'N', 'Ń'=>'N',
'Ø'=>'O', 'Ó'=>'O', 'Ò'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'Oe',
'Ş'=>'S', 'Ś'=>'S', 'Ș'=>'S', 'Š'=>'S',
'Ț'=>'T',
'Ù'=>'U', 'Û'=>'U', 'Ú'=>'U', 'Ü'=>'Ue',
'Ý'=>'Y',
'Ź'=>'Z', 'Ž'=>'Z', 'Ż'=>'Z',
'â'=>'a', 'ǎ'=>'a', 'ą'=>'a', 'á'=>'a', 'ă'=>'a', 'ã'=>'a', 'Ǎ'=>'a', 'а'=>'a', 'А'=>'a', 'å'=>'a', 'à'=>'a', 'א'=>'a', 'Ǻ'=>'a', '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u', 'ǘ'=>'u', 'ü'=>'ue',
'в'=> 'v', 'ו'=>'v', 'В'=>'v',
'ש'=> 'w', 'ŵ'=>'w', 'Ŵ'=>'w',
'ы'=> 'y', 'ŷ'=>'y', 'ý'=>'y', 'ÿ'=>'y', 'Ÿ'=>'y', 'Ŷ'=>'y',
'Ы'=> 'y', 'ž'=>'z', 'З'=>'z', 'з'=>'z', 'ź'=>'z', 'ז'=>'z', 'ż'=>'z', 'ſ'=>'z', 'Ж'=>'zh', 'ж'=>'zh', 'ά' => 'α', 'έ' => 'ε', 'ή' => 'η', 'ί' => 'ι', 'ό' => 'ο', 'ύ' => 'υ', 'ώ' => 'ω',
];
return strtr($string, $replace);

View File

@ -77,5 +77,5 @@ return [
'taint',
'titty',
'vag',
'whore'
'whore',
];

View File

@ -10,200 +10,200 @@ return [
|
*/
"affanculo",
"allupato",
"ammucchiata",
"anale",
"arrapato",
"arrusa",
"arruso",
"assatanato",
"bagascia",
"bagassa",
"bagnarsi",
"baldracca",
"balle",
"battere",
"battona",
"belino",
"biga",
"bocchinara",
"bocchinaro",
"bocchino",
"bofilo",
"boiata",
"bordello",
"brinca",
"bucaiolo",
"budiùlo",
"buona donna",
"busone",
"cacca",
"caccati in mano e prenditi a schiaffi",
"caciocappella",
"cadavere",
"cagare",
"cagata",
"cagna",
"cammello",
"cappella",
"carciofo",
"carità",
"casci",
"cazzata",
"cazzi",
"cazzimma",
"cazzo",
"checca",
"chiappa",
"chiavare",
"chiavata",
"ciospo",
"ciucciami il cazzo",
"coglione",
"coglioni",
"cornuto",
"cozza",
"culattina",
"culattone",
"culo",
"di merda",
"dio bestia",
"dio cane",
"dio porco",
"ditalino",
"duro",
"fanculo",
"fare unaŠ",
"fava",
"femminuccia",
"fica",
"figa",
"figlio di buona donna",
"figlio di puttana",
"figone",
"finocchio",
"fottere",
"fottersi",
"fracicone",
"fregna",
"frocio",
"froscio",
"fuori come un balcone",
"goldone",
"grilletto",
"guanto",
"guardone",
"incazzarsi",
"incoglionirsi",
"inculare",
"ingoio",
'affanculo',
'allupato',
'ammucchiata',
'anale',
'arrapato',
'arrusa',
'arruso',
'assatanato',
'bagascia',
'bagassa',
'bagnarsi',
'baldracca',
'balle',
'battere',
'battona',
'belino',
'biga',
'bocchinara',
'bocchinaro',
'bocchino',
'bofilo',
'boiata',
'bordello',
'brinca',
'bucaiolo',
'budiùlo',
'buona donna',
'busone',
'cacca',
'caccati in mano e prenditi a schiaffi',
'caciocappella',
'cadavere',
'cagare',
'cagata',
'cagna',
'cammello',
'cappella',
'carciofo',
'carità',
'casci',
'cazzata',
'cazzi',
'cazzimma',
'cazzo',
'checca',
'chiappa',
'chiavare',
'chiavata',
'ciospo',
'ciucciami il cazzo',
'coglione',
'coglioni',
'cornuto',
'cozza',
'culattina',
'culattone',
'culo',
'di merda',
'dio bestia',
'dio cane',
'dio porco',
'ditalino',
'duro',
'fanculo',
'fare unaŠ',
'fava',
'femminuccia',
'fica',
'figa',
'figlio di buona donna',
'figlio di puttana',
'figone',
'finocchio',
'fottere',
'fottersi',
'fracicone',
'fregna',
'frocio',
'froscio',
'fuori come un balcone',
'goldone',
'grilletto',
'guanto',
'guardone',
'incazzarsi',
'incoglionirsi',
'inculare',
'ingoio',
"l'arte bolognese",
"leccaculo",
"lecchino",
"lofare",
"loffa",
"loffare",
"lumaca",
"manico",
"mannaggia",
"merda",
"merdata",
"merdoso",
"mignotta",
"minchia",
"minchione",
"mona",
"monta",
"montare",
"mussa",
"nave scuola",
"nerchia",
"nudo",
"padulo",
"palle",
"palloso",
"patacca",
"patonza",
"pecorina",
"pesce",
"picio",
"pincare",
"pipa",
"pippone",
"pipì",
"pirla",
"pisciare",
"piscio",
"pisello",
"pistola",
"pistolotto",
"pomiciare",
"pompa",
"pompinara",
"pompino",
"porca madonna",
"porca miseria",
"porca puttana",
"porca",
"porco dio",
"porco due",
"porco zio",
"potta",
"puppami",
"puttana",
"quaglia",
"recchione",
"regina",
"ricchione",
"rincoglionire",
"rizzarsi",
"rompiballe",
"rottinculo",
"ruffiano",
"sbattere",
"sbattersi",
"sborra",
"sborrata",
"sborrone",
"sbrodolata",
"scopare",
"scopata",
"scorreggiare",
"sega",
"segaiolo",
"slinguare",
"slinguata",
"smandrappata",
"soccia",
"socmel",
"sorca",
"spagnola",
"spompinare",
"sticchio",
"stronza",
"stronzata",
"stronzo",
"succhiami",
"sveltina",
"sverginare",
"tarzanello",
"terrone",
"testa di cazzo",
"tette",
"tirare",
"topa",
"troia",
"troietta",
"troiona",
"troione",
"trombare",
"uccello",
"vacca",
"vaffanculo",
"vangare",
"venire",
"zinne",
"zio cantante",
"zoccola"
'leccaculo',
'lecchino',
'lofare',
'loffa',
'loffare',
'lumaca',
'manico',
'mannaggia',
'merda',
'merdata',
'merdoso',
'mignotta',
'minchia',
'minchione',
'mona',
'monta',
'montare',
'mussa',
'nave scuola',
'nerchia',
'nudo',
'padulo',
'palle',
'palloso',
'patacca',
'patonza',
'pecorina',
'pesce',
'picio',
'pincare',
'pipa',
'pippone',
'pipì',
'pirla',
'pisciare',
'piscio',
'pisello',
'pistola',
'pistolotto',
'pomiciare',
'pompa',
'pompinara',
'pompino',
'porca madonna',
'porca miseria',
'porca puttana',
'porca',
'porco dio',
'porco due',
'porco zio',
'potta',
'puppami',
'puttana',
'quaglia',
'recchione',
'regina',
'ricchione',
'rincoglionire',
'rizzarsi',
'rompiballe',
'rottinculo',
'ruffiano',
'sbattere',
'sbattersi',
'sborra',
'sborrata',
'sborrone',
'sbrodolata',
'scopare',
'scopata',
'scorreggiare',
'sega',
'segaiolo',
'slinguare',
'slinguata',
'smandrappata',
'soccia',
'socmel',
'sorca',
'spagnola',
'spompinare',
'sticchio',
'stronza',
'stronzata',
'stronzo',
'succhiami',
'sveltina',
'sverginare',
'tarzanello',
'terrone',
'testa di cazzo',
'tette',
'tirare',
'topa',
'troia',
'troietta',
'troiona',
'troione',
'trombare',
'uccello',
'vacca',
'vaffanculo',
'vangare',
'venire',
'zinne',
'zio cantante',
'zoccola',
];

View File

@ -32,5 +32,5 @@ return [
'geitenneuker',
'pedo',
'randdebiel',
'lul'
'lul',
];

View File

@ -2,52 +2,52 @@
return [
/**
* List of bad words without accent.
*
* Provided by @kotass
*/
"kokot",
"kokoti",
"jebat",
"jebnuty",
"vyjebany",
"buzerant",
"pica",
"pice",
"hovno",
"picus",
"vyjebanec",
"kurva",
"skurvenec",
"jebal",
"kurvu",
"buzik",
"bukviciak",
"chuj",
"chumaj",
"curak",
"debil",
"dement",
"jebacka",
"jeblina",
"jebo",
"popici",
"ojeb",
"ojebavat",
"picovat",
"rit",
"skokoteny",
"skurvit",
"trtko",
"ujeb",
"ujebat",
"jeba",
"zmrd",
"zjebat",
"zajebany",
"zapiceny",
"vytrtkany"
/*
* List of bad words without accent.
*
* Provided by @kotass
*/
];
'kokot',
'kokoti',
'jebat',
'jebnuty',
'vyjebany',
'buzerant',
'pica',
'pice',
'hovno',
'picus',
'vyjebanec',
'kurva',
'skurvenec',
'jebal',
'kurvu',
'buzik',
'bukviciak',
'chuj',
'chumaj',
'curak',
'debil',
'dement',
'jebacka',
'jeblina',
'jebo',
'popici',
'ojeb',
'ojebavat',
'picovat',
'rit',
'skokoteny',
'skurvit',
'trtko',
'ujeb',
'ujebat',
'jeba',
'zmrd',
'zjebat',
'zajebany',
'zapiceny',
'vytrtkany',
];

View File

@ -83,5 +83,5 @@ return [
'顏射',
'肛交',
'潮吹',
'軟屌'
'軟屌',
];

View File

@ -1,5 +1,5 @@
<?php
return [
'profane' => 'The :attribute contains vulgar content'
'profane' => 'The :attribute contains vulgar content',
];

View File

@ -1,5 +1,5 @@
<?php
return [
'profane' => 'El :attribute contiene palabras vulgares'
'profane' => 'El :attribute contiene palabras vulgares',
];

View File

@ -1,5 +1,5 @@
<?php
return [
'profane' => 'Het :attribute veld bevat vulgaire inhoud'
];
'profane' => 'Het :attribute veld bevat vulgaire inhoud',
];

View File

@ -1,5 +1,5 @@
<?php
return [
'profane' => 'O campo :attribute contém palavras vulgares'
'profane' => 'O campo :attribute contém palavras vulgares',
];

View File

@ -1,5 +1,5 @@
<?php
return [
'profane' => ':attribute obsahuje vulgárny obsah'
'profane' => ':attribute obsahuje vulgárny obsah',
];

View File

@ -1,5 +1,5 @@
<?php
return [
'profane' => ':attribute欄位內容包含粗俗用詞請您修正:)'
'profane' => ':attribute欄位內容包含粗俗用詞請您修正:)',
];

View File

@ -3,7 +3,6 @@
namespace LaravelProfaneTests;
use LaravelProfane\Dictionary;
use LaravelProfaneTests\TestCase;
class DictionaryTest extends TestCase
{
@ -29,7 +28,7 @@ class DictionaryTest extends TestCase
{
$dictionary = new Dictionary([
'es',
'gr'
'gr',
]);
$expected = array_merge(
@ -56,4 +55,4 @@ class DictionaryTest extends TestCase
$this->assertEquals($dictionary->getDictionary(), $expected);
}
}
}

View File

@ -2,8 +2,6 @@
namespace LaravelProfaneTests;
use LaravelProfane\ProfaneValidator;
use LaravelProfaneTests\TestCase;
use LaravelProfaneTests\Support\ProfaneValidatorBuilder;
class ProfaneValidatorTest extends TestCase
@ -19,7 +17,7 @@ class ProfaneValidatorTest extends TestCase
{
$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()
@ -73,7 +71,7 @@ class ProfaneValidatorTest extends TestCase
{
$builder = new ProfaneValidatorBuilder('sk');
$word = "piča";
$word = 'piča';
$this->assertTrue($builder->build()->isProfane($word));
}
@ -83,7 +81,7 @@ class ProfaneValidatorTest extends TestCase
$builder = new ProfaneValidatorBuilder('es');
// in spanish coño =! cono
$word = "coño";
$word = 'coño';
$this->assertTrue($builder->build()->isProfane($word));
}
@ -94,7 +92,7 @@ class ProfaneValidatorTest extends TestCase
$builder = new ProfaneValidatorBuilder('gr');
$word = "μαλάκας";
$word = 'μαλάκας';
$this->assertTrue($builder->build()->isProfane($word));
}
@ -105,6 +103,6 @@ class ProfaneValidatorTest extends TestCase
$builder = new ProfaneValidatorBuilder();
$this->assertFalse($builder->validate(['description', 'εισαι πουτανα', ['en' , 'gr']]));
$this->assertFalse($builder->validate(['description', 'εισαι πουτανα', ['en', 'gr']]));
}
}

View File

@ -2,7 +2,6 @@
namespace LaravelProfaneTests;
use LaravelProfaneTests\TestCase;
use LaravelProfane\Str;
class StrTest extends TestCase

View File

@ -2,19 +2,21 @@
namespace LaravelProfaneTests\Support;
use LaravelProfane\ProfaneValidator;
use LaravelProfane\Dictionary;
use LaravelProfane\ProfaneValidator;
class ProfaneValidatorBuilder
{
/**
* [$profaneValidator description]
* [$profaneValidator description].
*
* @var [type]
*/
protected $profaneValidator;
/**
* [__construct description]
* [__construct description].
*
* @param [type] $dictionary [description]
*/
public function __construct($dictionary = null)
@ -23,9 +25,11 @@ class ProfaneValidatorBuilder
}
/**
* [validate description]
* @param array $parameters [description]
* @return [type] [description]
* [validate description].
*
* @param array $parameters [description]
*
* @return [type] [description]
*/
public function validate(array $parameters)
{
@ -35,7 +39,8 @@ class ProfaneValidatorBuilder
}
/**
* [build description]
* [build description].
*
* @return LaravelProfane\ProfaneValidator
*/
public function build()

View File

@ -3,13 +3,13 @@
namespace LaravelProfaneTests;
use Illuminate\Support\Facades\Config;
use Mockery;
use PHPUnit_Framework_TestCase;
use \Mockery;
class TestCase extends PHPUnit_Framework_TestCase
{
/**
* [setUp description]
* [setUp description].
*/
public function setUp()
{
@ -18,7 +18,8 @@ class TestCase extends PHPUnit_Framework_TestCase
}
/**
* [tearDown description]
* [tearDown description].
*
* @return [type] [description]
*/
public function tearDown()
@ -28,7 +29,8 @@ class TestCase extends PHPUnit_Framework_TestCase
}
/**
* [mockConfigs description]
* [mockConfigs description].
*
* @return void
*/
protected function mockConfigs()