public function testSameCensorObj() { $censor = new CensorWords(); $string = $censor->censorString('f**k'); $this->assertEquals('****', $string['clean']); $string2 = $censor->censorString('f**k'); $this->assertEquals('****', $string2['clean']); }
function FilterText($input) { $config = (include "/config.php"); $output = ""; if ($config['enable_profanity_filter']) { $censor = new CensorWords(); $new = $censor->censorString($input); return $new['clean']; } else { return $input; } }
public function setAddressAttribute($value) { // censor address $censor = new CensorWords(); $badwords = $censor->setDictionary(array('es', 'en-us', 'en-uk')); $caddress = $censor->censorString($value); $address = $caddress['clean']; // search coordinates with the provided address $Geocoder = new \GoogleMapsGeocoder(); $Geocoder->setAddress($address); $response = $Geocoder->geocode(); // defaults when the coordinates aren't found $this->attributes['address'] = $address; $this->attributes['lat'] = '-34.6036844'; $this->attributes['long'] = '-58.381559100000004'; // success, we have coordinates! if ($response['status'] == 'OK') { $info = array('address' => $response['results'][0]['formatted_address'], 'lat' => $response['results'][0]['geometry']['location']['lat'], 'long' => $response['results'][0]['geometry']['location']['lng']); $this->attributes['address'] = $info['address']; $this->attributes['lat'] = $info['lat']; $this->attributes['long'] = $info['long']; } }
session_start(); include("../static/clase_mysql.php"); include("../static/site_config.php"); $miconexion = new clase_mysql; $miconexion->conectar($db_name,$db_host, $db_user,$db_password); use Snipe\BanBuilder\CensorWords; include ("../static/CensorWords.php"); $censor = new CensorWords; $langs = array('es','en-us','en-uk'); $badwords = $censor->setDictionary($langs); $lista=""; for ($i=1; $i <count($_POST); $i++) { $lista[$i-1]=htmlspecialchars(array_values($_POST)[$i]); $columnas[$i-1]=array_keys($_POST)[$i]; } $comen = $censor->censorString($lista[count($lista)-1]); $lista[count($lista)-1]= $comen['clean']; $miconexion->consulta("select count(*) from comentarios WHERE id_user = '******'id']."' and image IS NOT NULL"); $num = $miconexion->consulta_lista(); @$carpeta = "../perfiles/images/comentarios"; @$nom_img = "/".$_SESSION['user']."_".$num[0]."."; @$nombre_archivo = $_FILES['image']['name']; @$tipo_archivo = $_FILES['image']['type']; @$input_img = $_FILES['image']['tmp_name']; @$tipo = split('image/', $tipo_archivo); if ($_POST['comentario']==null) { echo '<script> $container = $("#container_notify").notify(); create("default", { color:"background:rgba(218,26,26,0.8);", enlace:"#" ,title:"Alerta", text:"Primero debe escribir algo.", imagen:"../assets/img/alert.png"}); </script>';