Mejora validacion correo usuario

parent 494fc4f8
......@@ -90,9 +90,9 @@ class Utiles {
public static function isWindowsChrome($ua) {
$os = self::getOS($ua);
$browser = self::getBrowser($ua);
if(self::detectWord($os, "Windows") && self::detectWord($browser, "Chrome")){
if (self::detectWord($os, "Windows") && self::detectWord($browser, "Chrome")) {
return true;
}else{
} else {
return false;
}
}
......@@ -161,11 +161,10 @@ class Utiles {
return $browser;
}
public static function acortarUrl($data){
public static function acortarUrl($data) {
$url = "http://url.gearlabs.cl/acortar";
$httpStatus = null;
$httpStatus = null;
try {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_POST, 1);
......@@ -178,61 +177,58 @@ class Utiles {
if ($httpStatus == 200) {
$arrayRetorno = json_decode($output, true);
return $arrayRetorno['shortLink'];
}
else {
return $arrayRetorno['shortLink'];
} else {
return array('error' => 'httpStatus distinto de Response::HTTP_OK');
}
}
catch (\Exception $e) {
} catch (\Exception $e) {
return array(
'error' => 'Error',
'detalle' => $e,
);
}
}
public static function getUrlByTag($tag){
if($tag->getTagId() == 1){
public static function getUrlByTag($tag) {
if ($tag->getTagId() == 1) {
return "http://new.entelmusic.cl";
}else if($tag->getTagId() == 2){
} else if ($tag->getTagId() == 2) {
return "http://new.hitsahora.cl";
}else if($tag->getTagId() == 3){
} else if ($tag->getTagId() == 3) {
return "http://new.umusic.cl";
}else if($tag->getTagId() == 4){
} else if ($tag->getTagId() == 4) {
return "http://new.topsify.cl";
}
}
public static function getParametroConfiguracion($nombre,$em) {
public static function getParametroConfiguracion($nombre, $em) {
$str_valor = '';
$parametro = $em->getRepository(PluParametroConfiguracion::class)->getParametroConfiguracion($nombre);
//print_r($parametro);
//exit;
if ($parametro)
$str_valor = $parametro->getPcoValor();
return $str_valor;
}
/**
* FUNCIÓN PARA VALIDAR CORREO ELECTRÓNICO, MEDIANTE USO DE EXPRESIÓN REGULAR.
* @param type $email
* @return int
*/
public static function validarCorreo($email=""){
$expresion_regular_correo="/^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i";
if(preg_match($expresion_regular_correo, $email)){
public static function validarCorreo($email = "") {
$expresion_regular_correo = "/^[A-Z0-9._%+-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i";
if (preg_match($expresion_regular_correo, $email)) {
return 1;
}else{
} else {
return 0;
}
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment