@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | public function __construct() { |
| 37 | 37 | //parent::__construct(); |
| 38 | 38 | |
| 39 | - $this->_sesion=new \Sistema\Nucleo\CFSesion(); |
|
| 39 | + $this->_sesion = new \Sistema\Nucleo\CFSesion(); |
|
| 40 | 40 | } |
| 41 | - public function enviarCorreo($para, $titulo= 'Asunto', $mensaje= 'cuerpo del correo'){ |
|
| 41 | + public function enviarCorreo($para, $titulo = 'Asunto', $mensaje = 'cuerpo del correo') { |
|
| 42 | 42 | return mail($para, $titulo, $mensaje); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
| 46 | 46 | // filtros Email |
| 47 | 47 | |
| 48 | - function filtroEmail($email){ |
|
| 49 | - if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){ |
|
| 48 | + function filtroEmail($email) { |
|
| 49 | + if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)) { |
|
| 50 | 50 | echo "E-Mail no es valido"; |
| 51 | 51 | } |
| 52 | 52 | else |
@@ -58,44 +58,44 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | //cadenas |
| 60 | 60 | |
| 61 | - function rangoTexto($texto, $inicio, $cantidad){ |
|
| 61 | + function rangoTexto($texto, $inicio, $cantidad) { |
|
| 62 | 62 | |
| 63 | - return $limite= substr($texto, $inicio, $cantidad); |
|
| 63 | + return $limite = substr($texto, $inicio, $cantidad); |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | //Redirecionar |
| 68 | 68 | |
| 69 | - function Redireccion($url, $permanent = false){ |
|
| 69 | + function Redireccion($url, $permanent = false) { |
|
| 70 | 70 | header('Location: ' . $url, true, $permanent ? 301 : 302); |
| 71 | 71 | |
| 72 | 72 | exit(); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - function redireccionUrl($url){ |
|
| 76 | - $url=Cf_BASE_URL.$url; |
|
| 75 | + function redireccionUrl($url) { |
|
| 76 | + $url = Cf_BASE_URL . $url; |
|
| 77 | 77 | header('Location: ' . $url); |
| 78 | 78 | exit(); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - function redireccionUrlMsj($controlador){ |
|
| 81 | + function redireccionUrlMsj($controlador) { |
|
| 82 | 82 | $this->_sesion->iniciarSesion('_s', false); |
| 83 | - $_SESSION[error_ingreso]='Error en el intento de ingreso'; |
|
| 84 | - $controlador=Cf_BASE_URL.$controlador; |
|
| 83 | + $_SESSION[error_ingreso] = 'Error en el intento de ingreso'; |
|
| 84 | + $controlador = Cf_BASE_URL . $controlador; |
|
| 85 | 85 | header('Location: ' . $controlador); |
| 86 | 86 | exit(); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - function redireccion_($url, $statusCode = 303){ |
|
| 89 | + function redireccion_($url, $statusCode = 303) { |
|
| 90 | 90 | header('Location: ' . $url, true, $statusCode); |
| 91 | 91 | die(); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - function redirect($controller,$method = "index",$args = array()) |
|
| 94 | + function redirect($controller, $method = "index", $args = array()) |
|
| 95 | 95 | { |
| 96 | 96 | global $core; /* Guess Obviously */ |
| 97 | 97 | |
| 98 | - $location = $core->Cf_BASE_URL . "/" . $controller . "/" . $method . "/" . implode("/",$args); |
|
| 98 | + $location = $core->Cf_BASE_URL . "/" . $controller . "/" . $method . "/" . implode("/", $args); |
|
| 99 | 99 | |
| 100 | 100 | /* |
| 101 | 101 | * Use @header to redirect the page: |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | |
| 109 | 109 | //texto |
| 110 | - public function filtrarEntero($int){ |
|
| 110 | + public function filtrarEntero($int) { |
|
| 111 | 111 | |
| 112 | 112 | return filter_var($int, FILTER_VALIDATE_INT); |
| 113 | 113 | |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | function filtroEmail($email){ |
| 49 | 49 | if (!filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL)){ |
| 50 | 50 | echo "E-Mail no es valido"; |
| 51 | - } |
|
| 52 | - else |
|
| 51 | + } else |
|
| 53 | 52 | { |
| 54 | 53 | echo "E-Mail es valido"; |
| 55 | 54 | } |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | 40 | public static function configurar($clave, $valor = null) { |
| 41 | - if( is_array($clave) ) { |
|
| 41 | + if (is_array($clave)) { |
|
| 42 | 42 | foreach ($clave as $config_name => $config_value) { |
| 43 | 43 | self::$configuracion[$config_name] = $config_value; |
| 44 | 44 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * @param string $clave |
| 64 | 64 | */ |
| 65 | 65 | public static function obtener($clave, $raw = false, $tiempo_personalizado = null) { |
| 66 | - if( ! self::file_expired($archivo = self::obtenerRuta($clave), $tiempo_personalizado)) { |
|
| 66 | + if (!self::file_expired($archivo = self::obtenerRuta($clave), $tiempo_personalizado)) { |
|
| 67 | 67 | $contenido = file_get_contents($archivo); |
| 68 | 68 | return $raw ? $contenido : unserialize($contenido); |
| 69 | 69 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @return bool true if the data was removed successfully |
| 91 | 91 | */ |
| 92 | 92 | public static function eliminar($clave) { |
| 93 | - if( ! file_exists($archivo = self::obtenerRuta($clave)) ) { |
|
| 93 | + if (!file_exists($archivo = self::obtenerRuta($clave))) { |
|
| 94 | 94 | return true; |
| 95 | 95 | } |
| 96 | 96 | return @unlink($archivo); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return bool if the file has expired or not |
| 118 | 118 | */ |
| 119 | 119 | public static function file_expired($archivo, $fecha = null) { |
| 120 | - if( ! file_exists($archivo) ) { |
|
| 120 | + if (!file_exists($archivo)) { |
|
| 121 | 121 | return true; |
| 122 | 122 | } |
| 123 | 123 | return (time() > (filemtime($archivo) + 60 * ($fecha ? $fecha : self::$configuracion['expires']))); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | break; |
| 162 | 162 | } |
| 163 | 163 | echo '</div>'; |
| 164 | - echo '</div>'.PHP_EOL; |
|
| 164 | + echo '</div>' . PHP_EOL; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | // Closing form |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | |
| 192 | 192 | // Asignamos las claves conviritiendo el array |
| 193 | 193 | foreach ($data as $attr=>$value) { |
| 194 | - $r .= $attr.'="'.$value.'" '; |
|
| 194 | + $r .= $attr . '="' . $value . '" '; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $r .= '/>'; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | |
| 210 | 210 | // Asignamos las claves conviritiendo el array |
| 211 | 211 | foreach ($data as $attr=>$value) { |
| 212 | - $base .= $attr.'="'.$value.'" '; |
|
| 212 | + $base .= $attr . '="' . $value . '" '; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if (!is_array($values)) { |
| 222 | 222 | // Comprobamos el value, es posible que el usuario este intentando crear los Radio (option) de forma separada |
| 223 | 223 | if (!is_array($values) and $selected == $values) $base .= ' checked="checked" '; |
| 224 | - return $base . ' value="'.$values.'" />'; |
|
| 224 | + return $base . ' value="' . $values . '" />'; |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | // Por el contrario, tenemos 1 o m�s value con lo que es un posible texto |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | foreach ($values as $id=>$text) { |
| 231 | 231 | $r .= $base; |
| 232 | 232 | if ($selected !== null and $id == $selected) $r .= ' checked="checked" '; |
| 233 | - $r .= ' value="'. $id .'" />'.$text.'</label>'; |
|
| 233 | + $r .= ' value="' . $id . '" />' . $text . '</label>'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | return $r; |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $r = '<select '; |
| 250 | 250 | // Convert array to input string |
| 251 | 251 | foreach ($data as $attr=>$value) { |
| 252 | - $r .= $attr.'="'.$value.'" '; |
|
| 252 | + $r .= $attr . '="' . $value . '" '; |
|
| 253 | 253 | } |
| 254 | 254 | // Return end input |
| 255 | 255 | $r .= '>'; |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | |
| 288 | 288 | // Asignamos las claves conviritiendo el array |
| 289 | 289 | foreach ($data as $attr=>$value) { |
| 290 | - $r .= $attr.'="'.$value.'" '; |
|
| 290 | + $r .= $attr . '="' . $value . '" '; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | $r .= '>'; |
@@ -304,14 +304,14 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | private function showStartForm() { |
| 306 | 306 | $r = '<form '; |
| 307 | - if ($this->action!= '') $r .= 'action="'.$this->action.'" '; |
|
| 308 | - if ($this->method != '') $r .= 'method="'.$this->method .'" '; |
|
| 309 | - if ($this->name != '') $r .= 'name="'.$this->name .'" '; |
|
| 310 | - if ($this->on_submit != '') $r .= 'onSubmit="'.$this->on_submit .'" '; |
|
| 311 | - if ($this->id != '') $r .= 'id="'.$this->id .'" '; |
|
| 312 | - if ($this->class != '') $r .= 'class="'.$this->class .'" '; |
|
| 313 | - |
|
| 314 | - return $r . '>'.PHP_EOL; |
|
| 307 | + if ($this->action != '') $r .= 'action="' . $this->action . '" '; |
|
| 308 | + if ($this->method != '') $r .= 'method="' . $this->method . '" '; |
|
| 309 | + if ($this->name != '') $r .= 'name="' . $this->name . '" '; |
|
| 310 | + if ($this->on_submit != '') $r .= 'onSubmit="' . $this->on_submit . '" '; |
|
| 311 | + if ($this->id != '') $r .= 'id="' . $this->id . '" '; |
|
| 312 | + if ($this->class != '') $r .= 'class="' . $this->class . '" '; |
|
| 313 | + |
|
| 314 | + return $r . '>' . PHP_EOL; |
|
| 315 | 315 | } |
| 316 | 316 | |
| 317 | 317 | /** |
@@ -408,14 +408,14 @@ discard block |
||
| 408 | 408 | if (isset($data['maxlength']) and is_numeric($data['maxlength']) and $data['maxlength'] > -1 |
| 409 | 409 | and strlen($readValue) > $data['maxlength']) { |
| 410 | 410 | |
| 411 | - $this->log('is too long. Maximum' . ' ' . $data['maxlength'] . ' ' . 'characters', $data ); |
|
| 411 | + $this->log('is too long. Maximum' . ' ' . $data['maxlength'] . ' ' . 'characters', $data); |
|
| 412 | 412 | return false; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | 415 | if (isset($data['pattern']) and is_numeric($data['pattern']) and $data['maxlength'] != '' |
| 416 | 416 | and preg_match($data['pattern'], $readValue) === FALSE) { |
| 417 | 417 | |
| 418 | - $this->log('pattern error' . ' (' . $data['pattern'] . ')' , $data); |
|
| 418 | + $this->log('pattern error' . ' (' . $data['pattern'] . ')', $data); |
|
| 419 | 419 | return false; |
| 420 | 420 | } |
| 421 | 421 | break; |
@@ -429,20 +429,20 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | // MIN |
| 431 | 431 | if (isset($data['min']) and $readValue < $data['min']) { |
| 432 | - $this->log('The number have to be greather than' . ' ' . $data['min'].'.', $data); |
|
| 432 | + $this->log('The number have to be greather than' . ' ' . $data['min'] . '.', $data); |
|
| 433 | 433 | return false; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | 436 | // MAX |
| 437 | 437 | if (isset($data['max']) and $readValue > $data['max']) { |
| 438 | - $this->log('The number have to be less than' . ' ' . $data['max'].'.', $data); |
|
| 438 | + $this->log('The number have to be less than' . ' ' . $data['max'] . '.', $data); |
|
| 439 | 439 | return false; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | // STEP http://www.w3schools.com/tags/att_input_step.asp |
| 443 | 443 | // Value 0 ever is valid (and if you try Divide to Zero, it will take error because the result is inifinite |
| 444 | 444 | if (isset($data['step']) and $readValue != 0 and $readValue % $data['step'] !== 0) { |
| 445 | - $this->log('The number have to be multiple of' . ' ' . $data['step'].'.', $data); |
|
| 445 | + $this->log('The number have to be multiple of' . ' ' . $data['step'] . '.', $data); |
|
| 446 | 446 | return false; |
| 447 | 447 | } |
| 448 | 448 | |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | //min | max |
| 452 | 452 | echo $readValue; |
| 453 | 453 | if (!is_date($readValue)) { |
| 454 | - $this->log('The date' . ' ' .$readValue.' '. 'must have format' . ' mm/dd/yyyy '.'.', $data); |
|
| 454 | + $this->log('The date' . ' ' . $readValue . ' ' . 'must have format' . ' mm/dd/yyyy ' . '.', $data); |
|
| 455 | 455 | return false; |
| 456 | 456 | } |
| 457 | 457 | break; |
@@ -489,14 +489,14 @@ discard block |
||
| 489 | 489 | if (is_array($value)) { |
| 490 | 490 | $this->log('Values don\'t match.', $data); |
| 491 | 491 | } else { |
| 492 | - $this->log('ID ' .$value.' ' . 'don\'t match', $data); |
|
| 492 | + $this->log('ID ' . $value . ' ' . 'don\'t match', $data); |
|
| 493 | 493 | } |
| 494 | 494 | return false; |
| 495 | 495 | } |
| 496 | 496 | } else { |
| 497 | 497 | // Is string |
| 498 | 498 | if ($readValue == $values) { |
| 499 | - $this->log('The value' . ' ' . $value.' ' . 'is not available', $data); |
|
| 499 | + $this->log('The value' . ' ' . $value . ' ' . 'is not available', $data); |
|
| 500 | 500 | return false; |
| 501 | 501 | } |
| 502 | 502 | } |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | * |
| 606 | 606 | * @example $fr->addInput('text', 'Username', '', true, 'Type here your username', array('class'=>'text red', id => 'text1'), array()) |
| 607 | 607 | */ |
| 608 | - public function addInput($label = '', $type = 'text', $name = '', $value = '', $required = false, $placeholder = '', $attributes = array()) { |
|
| 608 | + public function addInput($label = '', $type = 'text', $name = '', $value = '', $required = false, $placeholder = '', $attributes = array()) { |
|
| 609 | 609 | // Creating main data |
| 610 | 610 | $data = array( |
| 611 | 611 | 'type' => $type, |
@@ -642,10 +642,10 @@ discard block |
||
| 642 | 642 | * @param string $placeholder Default text to show if box is empty |
| 643 | 643 | * @param unknown $attributes Additional attributes |
| 644 | 644 | */ |
| 645 | - public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) { |
|
| 645 | + public function addNumber($label = '', $name = '', $value = '', $range = false, $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) { |
|
| 646 | 646 | // Creating main data |
| 647 | 647 | $data = array( |
| 648 | - 'type' => (! $range) ? 'number' : 'range', |
|
| 648 | + 'type' => (!$range) ? 'number' : 'range', |
|
| 649 | 649 | 'name' => $name, |
| 650 | 650 | 'value' => $value, |
| 651 | 651 | ); |
@@ -680,7 +680,7 @@ discard block |
||
| 680 | 680 | * @param string $placeholder Default text to show if box is empty |
| 681 | 681 | * @param unknown $attributes Additional attributes |
| 682 | 682 | */ |
| 683 | - public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) { |
|
| 683 | + public function addDate($label = '', $name = '', $value = '', $required = false, $min = '', $max = '', $step = '', $placeholder = '', $attributes = array()) { |
|
| 684 | 684 | // Creating main data |
| 685 | 685 | $data = array( |
| 686 | 686 | 'type' => 'date', |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | $this->errors .= ' ' . $message . '.'; |
| 897 | 897 | |
| 898 | 898 | // Extra message (title attribute) |
| 899 | - if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title']; |
|
| 899 | + if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | ' . 'MESSAGE' . ': ' . $data['title']; |
|
| 900 | 900 | |
| 901 | 901 | $this->errors .= '<br />'; |
| 902 | 902 | } |
@@ -913,11 +913,11 @@ discard block |
||
| 913 | 913 | */ |
| 914 | 914 | // More examples: |
| 915 | 915 | // http://us2.php.net/manual/es/function.checkdate.php |
| 916 | -function is_date( $str ) { |
|
| 916 | +function is_date($str) { |
|
| 917 | 917 | // Try to execute date creator |
| 918 | 918 | try { |
| 919 | - $dt = new DateTime( trim($str) ); |
|
| 920 | - } catch( Exception $e ) { |
|
| 919 | + $dt = new DateTime(trim($str)); |
|
| 920 | + } catch (Exception $e) { |
|
| 921 | 921 | // If fails, it return false, date is incorrect |
| 922 | 922 | return false; |
| 923 | 923 | } |
@@ -130,14 +130,18 @@ discard block |
||
| 130 | 130 | // Itearate all inputs |
| 131 | 131 | foreach ($toShow as $input) { |
| 132 | 132 | // Reading data |
| 133 | - if (isset($input['data'])) $data = $input['data']; |
|
| 133 | + if (isset($input['data'])) { |
|
| 134 | + $data = $input['data']; |
|
| 135 | + } |
|
| 134 | 136 | |
| 135 | 137 | // New row |
| 136 | 138 | echo '<div>'; |
| 137 | 139 | // Showing labels |
| 138 | 140 | if ($this->show_labels) { |
| 139 | 141 | echo '<div>'; |
| 140 | - if (isset($input['label']) and $input['label'] != '') echo $input['label']; |
|
| 142 | + if (isset($input['label']) and $input['label'] != '') { |
|
| 143 | + echo $input['label']; |
|
| 144 | + } |
|
| 141 | 145 | echo '</div>'; |
| 142 | 146 | } |
| 143 | 147 | |
@@ -182,7 +186,9 @@ discard block |
||
| 182 | 186 | private function showInput($data) { |
| 183 | 187 | $r = ''; |
| 184 | 188 | // Number start if is range |
| 185 | - if ($data['type'] == 'range' and isset($data['min'])) $r .= $data['min'] . ' '; |
|
| 189 | + if ($data['type'] == 'range' and isset($data['min'])) { |
|
| 190 | + $r .= $data['min'] . ' '; |
|
| 191 | + } |
|
| 186 | 192 | |
| 187 | 193 | $r .= '<input '; |
| 188 | 194 | |
@@ -197,7 +203,9 @@ discard block |
||
| 197 | 203 | $r .= '/>'; |
| 198 | 204 | |
| 199 | 205 | // Number end if is range |
| 200 | - if ($data['type'] == 'range' and isset($data['max'])) $r .= $data['max'] . ' '; |
|
| 206 | + if ($data['type'] == 'range' and isset($data['max'])) { |
|
| 207 | + $r .= $data['max'] . ' '; |
|
| 208 | + } |
|
| 201 | 209 | |
| 202 | 210 | // Return |
| 203 | 211 | return $r; |
@@ -220,7 +228,9 @@ discard block |
||
| 220 | 228 | // Si no tiene m�ltiples valores (es un string), lo retornamos de golpe |
| 221 | 229 | if (!is_array($values)) { |
| 222 | 230 | // Comprobamos el value, es posible que el usuario este intentando crear los Radio (option) de forma separada |
| 223 | - if (!is_array($values) and $selected == $values) $base .= ' checked="checked" '; |
|
| 231 | + if (!is_array($values) and $selected == $values) { |
|
| 232 | + $base .= ' checked="checked" '; |
|
| 233 | + } |
|
| 224 | 234 | return $base . ' value="'.$values.'" />'; |
| 225 | 235 | } |
| 226 | 236 | |
@@ -229,7 +239,9 @@ discard block |
||
| 229 | 239 | $r = ''; |
| 230 | 240 | foreach ($values as $id=>$text) { |
| 231 | 241 | $r .= $base; |
| 232 | - if ($selected !== null and $id == $selected) $r .= ' checked="checked" '; |
|
| 242 | + if ($selected !== null and $id == $selected) { |
|
| 243 | + $r .= ' checked="checked" '; |
|
| 244 | + } |
|
| 233 | 245 | $r .= ' value="'. $id .'" />'.$text.'</label>'; |
| 234 | 246 | } |
| 235 | 247 | |
@@ -263,7 +275,9 @@ discard block |
||
| 263 | 275 | if ($selected != '') { |
| 264 | 276 | foreach ($values as $val=>$txt) { |
| 265 | 277 | $r .= '<option value="' . $val . '"'; |
| 266 | - if ($val == $selected) $r .= ' selected '; |
|
| 278 | + if ($val == $selected) { |
|
| 279 | + $r .= ' selected '; |
|
| 280 | + } |
|
| 267 | 281 | $r .= '>' . $txt . '</option>'; |
| 268 | 282 | } |
| 269 | 283 | } else { |
@@ -304,12 +318,24 @@ discard block |
||
| 304 | 318 | */ |
| 305 | 319 | private function showStartForm() { |
| 306 | 320 | $r = '<form '; |
| 307 | - if ($this->action!= '') $r .= 'action="'.$this->action.'" '; |
|
| 308 | - if ($this->method != '') $r .= 'method="'.$this->method .'" '; |
|
| 309 | - if ($this->name != '') $r .= 'name="'.$this->name .'" '; |
|
| 310 | - if ($this->on_submit != '') $r .= 'onSubmit="'.$this->on_submit .'" '; |
|
| 311 | - if ($this->id != '') $r .= 'id="'.$this->id .'" '; |
|
| 312 | - if ($this->class != '') $r .= 'class="'.$this->class .'" '; |
|
| 321 | + if ($this->action!= '') { |
|
| 322 | + $r .= 'action="'.$this->action.'" '; |
|
| 323 | + } |
|
| 324 | + if ($this->method != '') { |
|
| 325 | + $r .= 'method="'.$this->method .'" '; |
|
| 326 | + } |
|
| 327 | + if ($this->name != '') { |
|
| 328 | + $r .= 'name="'.$this->name .'" '; |
|
| 329 | + } |
|
| 330 | + if ($this->on_submit != '') { |
|
| 331 | + $r .= 'onSubmit="'.$this->on_submit .'" '; |
|
| 332 | + } |
|
| 333 | + if ($this->id != '') { |
|
| 334 | + $r .= 'id="'.$this->id .'" '; |
|
| 335 | + } |
|
| 336 | + if ($this->class != '') { |
|
| 337 | + $r .= 'class="'.$this->class .'" '; |
|
| 338 | + } |
|
| 313 | 339 | |
| 314 | 340 | return $r . '>'.PHP_EOL; |
| 315 | 341 | } |
@@ -370,7 +396,9 @@ discard block |
||
| 370 | 396 | } |
| 371 | 397 | } |
| 372 | 398 | |
| 373 | - if ($success >= $total) return true; |
|
| 399 | + if ($success >= $total) { |
|
| 400 | + return true; |
|
| 401 | + } |
|
| 374 | 402 | return false; |
| 375 | 403 | } |
| 376 | 404 | |
@@ -570,8 +598,11 @@ discard block |
||
| 570 | 598 | * @return string/null Return the value, if don't exist, return null |
| 571 | 599 | */ |
| 572 | 600 | private function getData($key, $default = null) { |
| 573 | - if ($this->method == "post") return isset($_POST[$key]) ? $_POST[$key] : $default; |
|
| 574 | - else return isset($_GET[$key]) ? $_GET[$key] : $default; |
|
| 601 | + if ($this->method == "post") { |
|
| 602 | + return isset($_POST[$key]) ? $_POST[$key] : $default; |
|
| 603 | + } else { |
|
| 604 | + return isset($_GET[$key]) ? $_GET[$key] : $default; |
|
| 605 | + } |
|
| 575 | 606 | } |
| 576 | 607 | |
| 577 | 608 | /* |
@@ -614,9 +645,15 @@ discard block |
||
| 614 | 645 | ); |
| 615 | 646 | |
| 616 | 647 | |
| 617 | - if ($required) $data['required'] = 'required'; |
|
| 618 | - if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
| 619 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 648 | + if ($required) { |
|
| 649 | + $data['required'] = 'required'; |
|
| 650 | + } |
|
| 651 | + if ($placeholder != '') { |
|
| 652 | + $data['placeholder'] = $placeholder; |
|
| 653 | + } |
|
| 654 | + if (!empty($attributes)) { |
|
| 655 | + array_merge($data, $attributes); |
|
| 656 | + } |
|
| 620 | 657 | |
| 621 | 658 | |
| 622 | 659 | // Saving data to object |
@@ -624,7 +661,9 @@ discard block |
||
| 624 | 661 | 'type' => 'input', |
| 625 | 662 | 'data' => $data |
| 626 | 663 | ); |
| 627 | - if ($label != '') $content['label'] = $label; |
|
| 664 | + if ($label != '') { |
|
| 665 | + $content['label'] = $label; |
|
| 666 | + } |
|
| 628 | 667 | |
| 629 | 668 | $this->content[] = $content; |
| 630 | 669 | } |
@@ -651,19 +690,33 @@ discard block |
||
| 651 | 690 | ); |
| 652 | 691 | |
| 653 | 692 | |
| 654 | - if ($required) $data['required'] = 'required'; |
|
| 655 | - if ($min) $data['min'] = $min; |
|
| 656 | - if ($max) $data['max'] = $max; |
|
| 657 | - if ($step) $data['step'] = $step; |
|
| 658 | - if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
| 659 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 693 | + if ($required) { |
|
| 694 | + $data['required'] = 'required'; |
|
| 695 | + } |
|
| 696 | + if ($min) { |
|
| 697 | + $data['min'] = $min; |
|
| 698 | + } |
|
| 699 | + if ($max) { |
|
| 700 | + $data['max'] = $max; |
|
| 701 | + } |
|
| 702 | + if ($step) { |
|
| 703 | + $data['step'] = $step; |
|
| 704 | + } |
|
| 705 | + if ($placeholder != '') { |
|
| 706 | + $data['placeholder'] = $placeholder; |
|
| 707 | + } |
|
| 708 | + if (!empty($attributes)) { |
|
| 709 | + array_merge($data, $attributes); |
|
| 710 | + } |
|
| 660 | 711 | |
| 661 | 712 | // Saving data to object |
| 662 | 713 | $content = array( |
| 663 | 714 | 'type' => 'input', |
| 664 | 715 | 'data' => $data |
| 665 | 716 | ); |
| 666 | - if ($label != '') $content['label'] = $label; |
|
| 717 | + if ($label != '') { |
|
| 718 | + $content['label'] = $label; |
|
| 719 | + } |
|
| 667 | 720 | |
| 668 | 721 | $this->content[] = $content; |
| 669 | 722 | } |
@@ -688,19 +741,33 @@ discard block |
||
| 688 | 741 | 'value' => $value, |
| 689 | 742 | ); |
| 690 | 743 | |
| 691 | - if ($required) $data['required'] = 'required'; |
|
| 692 | - if ($min) $data['min'] = $min; |
|
| 693 | - if ($max) $data['max'] = $max; |
|
| 694 | - if ($step) $data['step'] = $step; |
|
| 695 | - if ($placeholder != '') $data['placeholder'] = $placeholder; |
|
| 696 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 744 | + if ($required) { |
|
| 745 | + $data['required'] = 'required'; |
|
| 746 | + } |
|
| 747 | + if ($min) { |
|
| 748 | + $data['min'] = $min; |
|
| 749 | + } |
|
| 750 | + if ($max) { |
|
| 751 | + $data['max'] = $max; |
|
| 752 | + } |
|
| 753 | + if ($step) { |
|
| 754 | + $data['step'] = $step; |
|
| 755 | + } |
|
| 756 | + if ($placeholder != '') { |
|
| 757 | + $data['placeholder'] = $placeholder; |
|
| 758 | + } |
|
| 759 | + if (!empty($attributes)) { |
|
| 760 | + array_merge($data, $attributes); |
|
| 761 | + } |
|
| 697 | 762 | |
| 698 | 763 | // Saving data to object |
| 699 | 764 | $content = array( |
| 700 | 765 | 'type' => 'input', |
| 701 | 766 | 'data' => $data |
| 702 | 767 | ); |
| 703 | - if ($label != '') $content['label'] = $label; |
|
| 768 | + if ($label != '') { |
|
| 769 | + $content['label'] = $label; |
|
| 770 | + } |
|
| 704 | 771 | |
| 705 | 772 | $this->content[] = $content; |
| 706 | 773 | } |
@@ -721,14 +788,20 @@ discard block |
||
| 721 | 788 | 'name' => $name, |
| 722 | 789 | 'value' => $value |
| 723 | 790 | ); |
| 724 | - if ($required) $data['required'] = 'required'; |
|
| 725 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 791 | + if ($required) { |
|
| 792 | + $data['required'] = 'required'; |
|
| 793 | + } |
|
| 794 | + if (!empty($attributes)) { |
|
| 795 | + array_merge($data, $attributes); |
|
| 796 | + } |
|
| 726 | 797 | |
| 727 | 798 | $content = array( |
| 728 | 799 | 'type' => 'input', |
| 729 | 800 | 'data' => $data |
| 730 | 801 | ); |
| 731 | - if ($label != '') $content['label'] = $label; |
|
| 802 | + if ($label != '') { |
|
| 803 | + $content['label'] = $label; |
|
| 804 | + } |
|
| 732 | 805 | |
| 733 | 806 | $this->content[] = $content; |
| 734 | 807 | } |
@@ -746,13 +819,19 @@ discard block |
||
| 746 | 819 | * @param array $attributes Optional atributes not listened (in array). This will be applicated to all radioButton |
| 747 | 820 | */ |
| 748 | 821 | public function addRadio($label = '', $name = '', $values = array(), $selected = null, $required = false, $attributes = array()) { |
| 749 | - if (!is_array($values)) die('FATAL ERROR: Trying to create "RadioButton" with string VALUE, is requried use ARRAY()'); |
|
| 822 | + if (!is_array($values)) { |
|
| 823 | + die('FATAL ERROR: Trying to create "RadioButton" with string VALUE, is requried use ARRAY()'); |
|
| 824 | + } |
|
| 750 | 825 | $data = array( |
| 751 | 826 | 'name' => $name, |
| 752 | 827 | ); |
| 753 | 828 | |
| 754 | - if ($required) $data['required'] = 'required'; |
|
| 755 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 829 | + if ($required) { |
|
| 830 | + $data['required'] = 'required'; |
|
| 831 | + } |
|
| 832 | + if (!empty($attributes)) { |
|
| 833 | + array_merge($data, $attributes); |
|
| 834 | + } |
|
| 756 | 835 | |
| 757 | 836 | |
| 758 | 837 | |
@@ -762,7 +841,9 @@ discard block |
||
| 762 | 841 | 'values' => $values, |
| 763 | 842 | 'selected' => $selected |
| 764 | 843 | ); |
| 765 | - if ($label != '') $content['label'] = $label; |
|
| 844 | + if ($label != '') { |
|
| 845 | + $content['label'] = $label; |
|
| 846 | + } |
|
| 766 | 847 | |
| 767 | 848 | $this->content[] = $content; |
| 768 | 849 | } |
@@ -783,9 +864,15 @@ discard block |
||
| 783 | 864 | 'name' => $name, |
| 784 | 865 | 'required' => $required, |
| 785 | 866 | ); |
| 786 | - if ($required) $data['required'] = 'required'; |
|
| 787 | - if ($multiple) $data['multiple'] = 'multiple'; |
|
| 788 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 867 | + if ($required) { |
|
| 868 | + $data['required'] = 'required'; |
|
| 869 | + } |
|
| 870 | + if ($multiple) { |
|
| 871 | + $data['multiple'] = 'multiple'; |
|
| 872 | + } |
|
| 873 | + if (!empty($attributes)) { |
|
| 874 | + array_merge($data, $attributes); |
|
| 875 | + } |
|
| 789 | 876 | |
| 790 | 877 | |
| 791 | 878 | // In this case, the values are saved in the main of array to speed up select loader |
@@ -795,7 +882,9 @@ discard block |
||
| 795 | 882 | 'values' => $values, |
| 796 | 883 | 'selected' => $selected |
| 797 | 884 | ); |
| 798 | - if ($label != '') $content['label'] = $label; |
|
| 885 | + if ($label != '') { |
|
| 886 | + $content['label'] = $label; |
|
| 887 | + } |
|
| 799 | 888 | |
| 800 | 889 | $this->content[] = $content; |
| 801 | 890 | } |
@@ -813,7 +902,9 @@ discard block |
||
| 813 | 902 | 'name' => $name, |
| 814 | 903 | 'value' => $value |
| 815 | 904 | ); |
| 816 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 905 | + if (!empty($attributes)) { |
|
| 906 | + array_merge($data, $attributes); |
|
| 907 | + } |
|
| 817 | 908 | |
| 818 | 909 | $this->content[] = array( |
| 819 | 910 | 'type' => 'input', |
@@ -836,7 +927,9 @@ discard block |
||
| 836 | 927 | 'value' => $value, |
| 837 | 928 | 'onClick' => $onClick |
| 838 | 929 | ); |
| 839 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 930 | + if (!empty($attributes)) { |
|
| 931 | + array_merge($data, $attributes); |
|
| 932 | + } |
|
| 840 | 933 | |
| 841 | 934 | $this->content[] = array( |
| 842 | 935 | 'type' => 'input', |
@@ -858,8 +951,12 @@ discard block |
||
| 858 | 951 | 'name' => $name, |
| 859 | 952 | ); |
| 860 | 953 | |
| 861 | - if ($required) $data['required'] = 'required'; |
|
| 862 | - if (!empty($attributes)) array_merge($data, $attributes); |
|
| 954 | + if ($required) { |
|
| 955 | + $data['required'] = 'required'; |
|
| 956 | + } |
|
| 957 | + if (!empty($attributes)) { |
|
| 958 | + array_merge($data, $attributes); |
|
| 959 | + } |
|
| 863 | 960 | |
| 864 | 961 | // Saving data to object |
| 865 | 962 | $content = array( |
@@ -867,7 +964,9 @@ discard block |
||
| 867 | 964 | 'text' => $value, |
| 868 | 965 | 'data' => $data |
| 869 | 966 | ); |
| 870 | - if ($label != '') $content['label'] = $label; |
|
| 967 | + if ($label != '') { |
|
| 968 | + $content['label'] = $label; |
|
| 969 | + } |
|
| 871 | 970 | |
| 872 | 971 | $this->content[] = $content; |
| 873 | 972 | } |
@@ -885,18 +984,26 @@ discard block |
||
| 885 | 984 | if ($this->logErrors) { |
| 886 | 985 | // Try to get a name (label or name) |
| 887 | 986 | if (class_exists('kw')) { |
| 888 | - if (isset($data['label'])) $this->errors .= 'Found an error in field' . ': "' . $data['label'] . '": '; |
|
| 889 | - elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
| 987 | + if (isset($data['label'])) { |
|
| 988 | + $this->errors .= 'Found an error in field' . ': "' . $data['label'] . '": '; |
|
| 989 | + } elseif (isset($data['name'])) { |
|
| 990 | + $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
| 991 | + } |
|
| 890 | 992 | } else { |
| 891 | - if (isset($data['label'])) $this->errors .= 'Found an error in field' . $data['label'] . '": '; |
|
| 892 | - elseif (isset($data['name'])) $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
| 993 | + if (isset($data['label'])) { |
|
| 994 | + $this->errors .= 'Found an error in field' . $data['label'] . '": '; |
|
| 995 | + } elseif (isset($data['name'])) { |
|
| 996 | + $this->errors .= 'Found an error in field' . ': "' . $data['name'] . '": '; |
|
| 997 | + } |
|
| 893 | 998 | } |
| 894 | 999 | |
| 895 | 1000 | // preparing message |
| 896 | 1001 | $this->errors .= ' ' . $message . '.'; |
| 897 | 1002 | |
| 898 | 1003 | // Extra message (title attribute) |
| 899 | - if (isset($data['title']) and $data['title'] != '') $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title']; |
|
| 1004 | + if (isset($data['title']) and $data['title'] != '') { |
|
| 1005 | + $this->errors .= ' | '. 'MESSAGE' .': ' . $data['title']; |
|
| 1006 | + } |
|
| 900 | 1007 | |
| 901 | 1008 | $this->errors .= '<br />'; |
| 902 | 1009 | } |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | ) |
| 54 | 54 | ); |
| 55 | 55 | |
| 56 | - $menu = '<ul class="inline" >'. PHP_EOL; |
|
| 57 | - foreach($items as $item) |
|
| 56 | + $menu = '<ul class="inline" >' . PHP_EOL; |
|
| 57 | + foreach ($items as $item) |
|
| 58 | 58 | { |
| 59 | 59 | $current = (in_array($sel, $item)) ? ' class="current"' : ''; |
| 60 | - $id = (!empty($item['id'])) ? ' id="'.$item['id'].'"' : ''; |
|
| 61 | - $menu .= '<li'.$current.'><a href="'.$item['link'].'"'.$id.'>'.$item['title'].'</a></li>'."\n"; |
|
| 60 | + $id = (!empty($item['id'])) ? ' id="' . $item['id'] . '"' : ''; |
|
| 61 | + $menu .= '<li' . $current . '><a href="' . $item['link'] . '"' . $id . '>' . $item['title'] . '</a></li>' . "\n"; |
|
| 62 | 62 | } |
| 63 | - $menu .= '</ul>'. PHP_EOL . PHP_EOL; |
|
| 63 | + $menu .= '</ul>' . PHP_EOL . PHP_EOL; |
|
| 64 | 64 | return $menu; |
| 65 | 65 | } |
| 66 | 66 | |
@@ -91,19 +91,19 @@ discard block |
||
| 91 | 91 | |
| 92 | 92 | $count = count($items); |
| 93 | 93 | $i = 0; |
| 94 | - $menu = PHP_EOL .'<p class="bottom_nav">'; |
|
| 95 | - foreach($items as $item) |
|
| 94 | + $menu = PHP_EOL . '<p class="bottom_nav">'; |
|
| 95 | + foreach ($items as $item) |
|
| 96 | 96 | { |
| 97 | 97 | $current = (in_array($sel, $item)) ? ' class="current"' : ''; |
| 98 | - $id = (!empty($item['id'])) ? ' id="'.$item['id'].'"' : ''; |
|
| 99 | - $menu .= '<a'.$current.' href="'.$item['link'].'"'.$id.'>'.$item['title'].'</a>'; |
|
| 98 | + $id = (!empty($item['id'])) ? ' id="' . $item['id'] . '"' : ''; |
|
| 99 | + $menu .= '<a' . $current . ' href="' . $item['link'] . '"' . $id . '>' . $item['title'] . '</a>'; |
|
| 100 | 100 | $i++; |
| 101 | - if($count != $i) |
|
| 101 | + if ($count != $i) |
|
| 102 | 102 | { |
| 103 | - $menu .= ' '.$separador.' '; |
|
| 103 | + $menu .= ' ' . $separador . ' '; |
|
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | - $menu .= '</p>'. PHP_EOL ; |
|
| 106 | + $menu .= '</p>' . PHP_EOL; |
|
| 107 | 107 | return $menu; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -193,27 +193,27 @@ discard block |
||
| 193 | 193 | if ($end > $this->total_pages) $end = $this->total_pages; |
| 194 | 194 | |
| 195 | 195 | // Showing all clickable pages (create div if class is defined) |
| 196 | - if ($this->style != '') $r = '<div class="'.$this->style.'">'; |
|
| 196 | + if ($this->style != '') $r = '<div class="' . $this->style . '">'; |
|
| 197 | 197 | else $r = ''; |
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | // First / previous |
| 201 | 201 | if ($this->cur_page > 1) { |
| 202 | - if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">'.$this->first.'</a> '; |
|
| 203 | - if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">'.$this->previous.'</a> '; |
|
| 202 | + if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">' . $this->first . '</a> '; |
|
| 203 | + if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">' . $this->previous . '</a> '; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // You can optimize this separating BEFORE and AFTER current page in two for (to avoid load "if" in each loop) |
| 207 | 207 | // but it would be difficult on changes |
| 208 | - for ($n=$start; $n<=$end; $n++) { |
|
| 209 | - if ($n != $cur_page) $r .= '<a class="link" href="'. $url_start . $n . $url_end . '">'.$n.'</a> '; |
|
| 210 | - else $r .= '<a class="current">'.$n.'</a> '; |
|
| 208 | + for ($n = $start; $n <= $end; $n++) { |
|
| 209 | + if ($n != $cur_page) $r .= '<a class="link" href="' . $url_start . $n . $url_end . '">' . $n . '</a> '; |
|
| 210 | + else $r .= '<a class="current">' . $n . '</a> '; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | // next / last |
| 214 | 214 | if ($this->cur_page < $this->total_pages) { |
| 215 | - if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">'.$this->next.'</a> '; |
|
| 216 | - if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end .'">'.$this->last.'</a> '; |
|
| 215 | + if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">' . $this->next . '</a> '; |
|
| 216 | + if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end . '">' . $this->last . '</a> '; |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | // End div (if exist) |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | $records = $this->records; |
| 254 | 254 | |
| 255 | 255 | // Force maxium records loaded (only if is specified by user) |
| 256 | - if ($max_records > 0 and $max_records > $total_records) |
|
| 256 | + if ($max_records > 0 and $max_records > $total_records) |
|
| 257 | 257 | $this->total_records = $max_records; |
| 258 | 258 | |
| 259 | 259 | // Calculate total pages that have |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | // Saving changes |
| 277 | 277 | $this->first_record = $start; |
| 278 | - $this->limit = ' LIMIT '.$start.','.$records.' '; |
|
| 278 | + $this->limit = ' LIMIT ' . $start . ',' . $records . ' '; |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -296,17 +296,17 @@ discard block |
||
| 296 | 296 | // And is empty, we have to Recicle ALL GET |
| 297 | 297 | // To know that page needs to be replaced we will use the "original_page" (the real get) |
| 298 | 298 | // Cortamos "pag=2" para obtener lo que va antes y despues, as� poder modificar directamente ese pag=2 por la pagina actual |
| 299 | - $query_string = explode($this->get_name.'='.$this->original_page, $_SERVER['QUERY_STRING']); |
|
| 299 | + $query_string = explode($this->get_name . '=' . $this->original_page, $_SERVER['QUERY_STRING']); |
|
| 300 | 300 | |
| 301 | 301 | // How start the new URL? To know it, we need to see the last character from current string |
| 302 | 302 | if (!in_array(substr($query_string[0], -1), array('?', '&'))) { |
| 303 | 303 | // Current string haven't any at end and it isn't "&" or "?" ? |
| 304 | 304 | // If initial string have one character at least it means that not is the first index |
| 305 | - if (isset($query_string[0][0])) $this->url_start = '?'.$query_string[0].'&'; |
|
| 306 | - else $this->url_start = '?'.$query_string[0]; |
|
| 305 | + if (isset($query_string[0][0])) $this->url_start = '?' . $query_string[0] . '&'; |
|
| 306 | + else $this->url_start = '?' . $query_string[0]; |
|
| 307 | 307 | } else { |
| 308 | 308 | // Current string already have ? or &, |
| 309 | - $this->url_start = '?'.$query_string[0]; |
|
| 309 | + $this->url_start = '?' . $query_string[0]; |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $this->url_end = isset($query_string[1]) ? $query_string[1] : ''; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | foreach ($gets as $get) { |
| 319 | 319 | if ($get != $get_name) { |
| 320 | 320 | // Trying to get the GET |
| 321 | - if (isset($_GET[$get])) $tmp .= $get.'='.$_GET[$get].'&'; |
|
| 321 | + if (isset($_GET[$get])) $tmp .= $get . '=' . $_GET[$get] . '&'; |
|
| 322 | 322 | } else { |
| 323 | 323 | // Pour the $tmp content to $tmp_start |
| 324 | 324 | if ($tmp_start == '') $tmp_start .= '?'; |
@@ -333,16 +333,16 @@ discard block |
||
| 333 | 333 | $this->url_start = $tmp_start; |
| 334 | 334 | $this->url_end = $tmp; |
| 335 | 335 | } |
| 336 | - else $this->url_start = '?'.$tmp; |
|
| 336 | + else $this->url_start = '?' . $tmp; |
|
| 337 | 337 | } |
| 338 | - } else{ |
|
| 338 | + } else { |
|
| 339 | 339 | // Non recicle |
| 340 | 340 | $this->url_start = '?'; |
| 341 | 341 | $this->url_end = ''; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | // Add the pagination |
| 345 | - $this->url_start .= $this->get_name.'='; |
|
| 345 | + $this->url_start .= $this->get_name . '='; |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | } |
@@ -189,35 +189,55 @@ discard block |
||
| 189 | 189 | $start = $cur_page - $this->max_links; |
| 190 | 190 | $end = $cur_page + $this->max_links; |
| 191 | 191 | |
| 192 | - if ($start < 1) $start = 1; |
|
| 193 | - if ($end > $this->total_pages) $end = $this->total_pages; |
|
| 192 | + if ($start < 1) { |
|
| 193 | + $start = 1; |
|
| 194 | + } |
|
| 195 | + if ($end > $this->total_pages) { |
|
| 196 | + $end = $this->total_pages; |
|
| 197 | + } |
|
| 194 | 198 | |
| 195 | 199 | // Showing all clickable pages (create div if class is defined) |
| 196 | - if ($this->style != '') $r = '<div class="'.$this->style.'">'; |
|
| 197 | - else $r = ''; |
|
| 200 | + if ($this->style != '') { |
|
| 201 | + $r = '<div class="'.$this->style.'">'; |
|
| 202 | + } else { |
|
| 203 | + $r = ''; |
|
| 204 | + } |
|
| 198 | 205 | |
| 199 | 206 | |
| 200 | 207 | // First / previous |
| 201 | 208 | if ($this->cur_page > 1) { |
| 202 | - if ($this->first != '') $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">'.$this->first.'</a> '; |
|
| 203 | - if ($this->previous != '') $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">'.$this->previous.'</a> '; |
|
| 209 | + if ($this->first != '') { |
|
| 210 | + $r .= '<a class="first" href="' . $url_start . '1' . $url_end . '">'.$this->first.'</a> '; |
|
| 211 | + } |
|
| 212 | + if ($this->previous != '') { |
|
| 213 | + $r .= '<a class="previous" href="' . $url_start . ($cur_page - 1) . $url_end . '">'.$this->previous.'</a> '; |
|
| 214 | + } |
|
| 204 | 215 | } |
| 205 | 216 | |
| 206 | 217 | // You can optimize this separating BEFORE and AFTER current page in two for (to avoid load "if" in each loop) |
| 207 | 218 | // but it would be difficult on changes |
| 208 | 219 | for ($n=$start; $n<=$end; $n++) { |
| 209 | - if ($n != $cur_page) $r .= '<a class="link" href="'. $url_start . $n . $url_end . '">'.$n.'</a> '; |
|
| 210 | - else $r .= '<a class="current">'.$n.'</a> '; |
|
| 220 | + if ($n != $cur_page) { |
|
| 221 | + $r .= '<a class="link" href="'. $url_start . $n . $url_end . '">'.$n.'</a> '; |
|
| 222 | + } else { |
|
| 223 | + $r .= '<a class="current">'.$n.'</a> '; |
|
| 224 | + } |
|
| 211 | 225 | } |
| 212 | 226 | |
| 213 | 227 | // next / last |
| 214 | 228 | if ($this->cur_page < $this->total_pages) { |
| 215 | - if ($this->next != '') $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">'.$this->next.'</a> '; |
|
| 216 | - if ($this->last != '') $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end .'">'.$this->last.'</a> '; |
|
| 229 | + if ($this->next != '') { |
|
| 230 | + $r .= '<a class="next" href="' . $url_start . ($cur_page + 1) . $url_end . '">'.$this->next.'</a> '; |
|
| 231 | + } |
|
| 232 | + if ($this->last != '') { |
|
| 233 | + $r .= '<a class="last" href="' . $url_start . $this->total_pages . $url_end .'">'.$this->last.'</a> '; |
|
| 234 | + } |
|
| 217 | 235 | } |
| 218 | 236 | |
| 219 | 237 | // End div (if exist) |
| 220 | - if ($this->style != '') $r .= '</div>'; |
|
| 238 | + if ($this->style != '') { |
|
| 239 | + $r .= '</div>'; |
|
| 240 | + } |
|
| 221 | 241 | |
| 222 | 242 | return $r; |
| 223 | 243 | } |
@@ -234,7 +254,9 @@ discard block |
||
| 234 | 254 | $this->original_page = $cur_page; |
| 235 | 255 | |
| 236 | 256 | // Filter values |
| 237 | - if (!is_numeric($cur_page) or $cur_page < 1) $cur_page = 1; |
|
| 257 | + if (!is_numeric($cur_page) or $cur_page < 1) { |
|
| 258 | + $cur_page = 1; |
|
| 259 | + } |
|
| 238 | 260 | |
| 239 | 261 | // Set new filtered values (is faster this method) |
| 240 | 262 | $this->cur_page = $cur_page; |
@@ -253,14 +275,17 @@ discard block |
||
| 253 | 275 | $records = $this->records; |
| 254 | 276 | |
| 255 | 277 | // Force maxium records loaded (only if is specified by user) |
| 256 | - if ($max_records > 0 and $max_records > $total_records) |
|
| 257 | - $this->total_records = $max_records; |
|
| 278 | + if ($max_records > 0 and $max_records > $total_records) { |
|
| 279 | + $this->total_records = $max_records; |
|
| 280 | + } |
|
| 258 | 281 | |
| 259 | 282 | // Calculate total pages that have |
| 260 | 283 | $total_pages = ceil($this->total_records / $records); |
| 261 | 284 | |
| 262 | 285 | // Is correct current page? |
| 263 | - if ($this->cur_page > $total_pages) $this->cur_page = $total_pages; |
|
| 286 | + if ($this->cur_page > $total_pages) { |
|
| 287 | + $this->cur_page = $total_pages; |
|
| 288 | + } |
|
| 264 | 289 | $this->total_pages = $total_pages; |
| 265 | 290 | |
| 266 | 291 | // Specify LIMIT to do a query |
@@ -302,8 +327,11 @@ discard block |
||
| 302 | 327 | if (!in_array(substr($query_string[0], -1), array('?', '&'))) { |
| 303 | 328 | // Current string haven't any at end and it isn't "&" or "?" ? |
| 304 | 329 | // If initial string have one character at least it means that not is the first index |
| 305 | - if (isset($query_string[0][0])) $this->url_start = '?'.$query_string[0].'&'; |
|
| 306 | - else $this->url_start = '?'.$query_string[0]; |
|
| 330 | + if (isset($query_string[0][0])) { |
|
| 331 | + $this->url_start = '?'.$query_string[0].'&'; |
|
| 332 | + } else { |
|
| 333 | + $this->url_start = '?'.$query_string[0]; |
|
| 334 | + } |
|
| 307 | 335 | } else { |
| 308 | 336 | // Current string already have ? or &, |
| 309 | 337 | $this->url_start = '?'.$query_string[0]; |
@@ -318,10 +346,14 @@ discard block |
||
| 318 | 346 | foreach ($gets as $get) { |
| 319 | 347 | if ($get != $get_name) { |
| 320 | 348 | // Trying to get the GET |
| 321 | - if (isset($_GET[$get])) $tmp .= $get.'='.$_GET[$get].'&'; |
|
| 349 | + if (isset($_GET[$get])) { |
|
| 350 | + $tmp .= $get.'='.$_GET[$get].'&'; |
|
| 351 | + } |
|
| 322 | 352 | } else { |
| 323 | 353 | // Pour the $tmp content to $tmp_start |
| 324 | - if ($tmp_start == '') $tmp_start .= '?'; |
|
| 354 | + if ($tmp_start == '') { |
|
| 355 | + $tmp_start .= '?'; |
|
| 356 | + } |
|
| 325 | 357 | $tmp_start .= $tmp; |
| 326 | 358 | $tmp = ''; |
| 327 | 359 | } |
@@ -332,8 +364,9 @@ discard block |
||
| 332 | 364 | // If have start and end |
| 333 | 365 | $this->url_start = $tmp_start; |
| 334 | 366 | $this->url_end = $tmp; |
| 367 | + } else { |
|
| 368 | + $this->url_start = '?'.$tmp; |
|
| 335 | 369 | } |
| 336 | - else $this->url_start = '?'.$tmp; |
|
| 337 | 370 | } |
| 338 | 371 | } else{ |
| 339 | 372 | // Non recicle |
@@ -30,20 +30,20 @@ discard block |
||
| 30 | 30 | //Seguridad |
| 31 | 31 | |
| 32 | 32 | //xss funciones de mitigacion |
| 33 | - function xsseguro($texto,$encoding='UTF-8'){ |
|
| 34 | - return htmlspecialchars($texto,ENT_QUOTES | ENT_HTML401,$encoding); |
|
| 33 | + function xsseguro($texto, $encoding = 'UTF-8') { |
|
| 34 | + return htmlspecialchars($texto, ENT_QUOTES | ENT_HTML401, $encoding); |
|
| 35 | 35 | } |
| 36 | - function xecho($texto){ |
|
| 36 | + function xecho($texto) { |
|
| 37 | 37 | echo xsseguro($texto); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - public function filtrarTexto($texto){ |
|
| 40 | + public function filtrarTexto($texto) { |
|
| 41 | 41 | return strip_tags($texto); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - public function filtrarCaracteresEspeciales($texto){ |
|
| 46 | + public function filtrarCaracteresEspeciales($texto) { |
|
| 47 | 47 | return htmlspecialchars($texto, ENT_QUOTES); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -59,67 +59,67 @@ discard block |
||
| 59 | 59 | return $cadenaAleatoria; |
| 60 | 60 | } |
| 61 | 61 | // encriptacion |
| 62 | - function cifrado($clave){ |
|
| 63 | - $cfi=sha1(md5($clave)); |
|
| 64 | - return $clave=Cf_KEY_MD5.$cfi; |
|
| 62 | + function cifrado($clave) { |
|
| 63 | + $cfi = sha1(md5($clave)); |
|
| 64 | + return $clave = Cf_KEY_MD5 . $cfi; |
|
| 65 | 65 | } |
| 66 | 66 | // Protecion CSRF |
| 67 | 67 | public function generoTokenDeFormulario($formulario) { |
| 68 | - $secreta = Cf_CSRF_SECRET.$this->generarCadenaAleatoria(); |
|
| 68 | + $secreta = Cf_CSRF_SECRET . $this->generarCadenaAleatoria(); |
|
| 69 | 69 | $sid = session_id(); |
| 70 | - $token = md5($secreta.$sid.$formulario); |
|
| 70 | + $token = md5($secreta . $sid . $formulario); |
|
| 71 | 71 | return $token; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | public function verificoTokenDeFormulario($formulario, $token) { |
| 75 | - $secreta = Cf_CSRF_SECRET.$this->generarCadenaAleatoria(); |
|
| 75 | + $secreta = Cf_CSRF_SECRET . $this->generarCadenaAleatoria(); |
|
| 76 | 76 | $sid = session_id(); |
| 77 | - $correcta = md5($secreta.$sid.$formulario); |
|
| 77 | + $correcta = md5($secreta . $sid . $formulario); |
|
| 78 | 78 | return ($token == $correcta); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - function obtenerDireccionIP(){ |
|
| 82 | - if (!empty($_SERVER ['HTTP_CLIENT_IP'] )) |
|
| 83 | - $ip=$_SERVER ['HTTP_CLIENT_IP']; |
|
| 84 | - elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] )) |
|
| 85 | - $ip=$_SERVER ['HTTP_X_FORWARDED_FOR']; |
|
| 81 | + function obtenerDireccionIP() { |
|
| 82 | + if (!empty($_SERVER ['HTTP_CLIENT_IP'])) |
|
| 83 | + $ip = $_SERVER ['HTTP_CLIENT_IP']; |
|
| 84 | + elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'])) |
|
| 85 | + $ip = $_SERVER ['HTTP_X_FORWARDED_FOR']; |
|
| 86 | 86 | else |
| 87 | - $ip=$_SERVER ['REMOTE_ADDR']; |
|
| 87 | + $ip = $_SERVER ['REMOTE_ADDR']; |
|
| 88 | 88 | |
| 89 | 89 | return $ip; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - function restringirIp($ip){ |
|
| 92 | + function restringirIp($ip) { |
|
| 93 | 93 | $ipCliente = $this->obtenerDireccionIP(); |
| 94 | 94 | |
| 95 | - if($ipCliente == $ip){ |
|
| 95 | + if ($ipCliente == $ip) { |
|
| 96 | 96 | return true; |
| 97 | 97 | } |
| 98 | - else{ |
|
| 98 | + else { |
|
| 99 | 99 | header('location: http://www.tusitioweb/redireccion'); |
| 100 | 100 | exit; |
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - function restringirConjuntoIps($ips){ |
|
| 104 | + function restringirConjuntoIps($ips) { |
|
| 105 | 105 | $ipCliente = obtenerDireccionIP(); |
| 106 | 106 | |
| 107 | - if (in_array($ipCliente,$ips)){ |
|
| 107 | + if (in_array($ipCliente, $ips)) { |
|
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | - else{ |
|
| 110 | + else { |
|
| 111 | 111 | header('location: http://direccion_envio_salida'); |
| 112 | 112 | exit; |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - function restringirRango(){ |
|
| 116 | + function restringirRango() { |
|
| 117 | 117 | $ipCliente = obtenerDireccionIP(); |
| 118 | 118 | |
| 119 | - if(substr($ipCliente, 0, 8 ) == "150.214."){ |
|
| 119 | + if (substr($ipCliente, 0, 8) == "150.214.") { |
|
| 120 | 120 | return true; |
| 121 | 121 | } |
| 122 | - else{ |
|
| 122 | + else { |
|
| 123 | 123 | header('location: http://direccion_envio_salida'); |
| 124 | 124 | exit; |
| 125 | 125 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * |
| 137 | 137 | */ |
| 138 | 138 | function emailSeguro($cadena) { |
| 139 | - return preg_replace( '((?:\n|\r|\t|%0A|%0D|%08|%09)+)i' , '', $cadena ); |
|
| 139 | + return preg_replace('((?:\n|\r|\t|%0A|%0D|%08|%09)+)i', '', $cadena); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | /*** example usage |
@@ -79,12 +79,13 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | function obtenerDireccionIP(){ |
| 82 | - if (!empty($_SERVER ['HTTP_CLIENT_IP'] )) |
|
| 83 | - $ip=$_SERVER ['HTTP_CLIENT_IP']; |
|
| 84 | - elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] )) |
|
| 85 | - $ip=$_SERVER ['HTTP_X_FORWARDED_FOR']; |
|
| 86 | - else |
|
| 87 | - $ip=$_SERVER ['REMOTE_ADDR']; |
|
| 82 | + if (!empty($_SERVER ['HTTP_CLIENT_IP'] )) { |
|
| 83 | + $ip=$_SERVER ['HTTP_CLIENT_IP']; |
|
| 84 | + } elseif (!empty($_SERVER ['HTTP_X_FORWARDED_FOR'] )) { |
|
| 85 | + $ip=$_SERVER ['HTTP_X_FORWARDED_FOR']; |
|
| 86 | + } else { |
|
| 87 | + $ip=$_SERVER ['REMOTE_ADDR']; |
|
| 88 | + } |
|
| 88 | 89 | |
| 89 | 90 | return $ip; |
| 90 | 91 | } |
@@ -94,8 +95,7 @@ discard block |
||
| 94 | 95 | |
| 95 | 96 | if($ipCliente == $ip){ |
| 96 | 97 | return true; |
| 97 | - } |
|
| 98 | - else{ |
|
| 98 | + } else{ |
|
| 99 | 99 | header('location: http://www.tusitioweb/redireccion'); |
| 100 | 100 | exit; |
| 101 | 101 | } |
@@ -106,8 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if (in_array($ipCliente,$ips)){ |
| 108 | 108 | return true; |
| 109 | - } |
|
| 110 | - else{ |
|
| 109 | + } else{ |
|
| 111 | 110 | header('location: http://direccion_envio_salida'); |
| 112 | 111 | exit; |
| 113 | 112 | } |
@@ -118,8 +117,7 @@ discard block |
||
| 118 | 117 | |
| 119 | 118 | if(substr($ipCliente, 0, 8 ) == "150.214."){ |
| 120 | 119 | return true; |
| 121 | - } |
|
| 122 | - else{ |
|
| 120 | + } else{ |
|
| 123 | 121 | header('location: http://direccion_envio_salida'); |
| 124 | 122 | exit; |
| 125 | 123 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | |
| 28 | 28 | class CFPHPVinculos { |
| 29 | 29 | |
| 30 | - function get_dominio(){ |
|
| 30 | + function get_dominio() { |
|
| 31 | 31 | |
| 32 | 32 | $dominio = "http://www.my-site-domain.com/"; |
| 33 | 33 | return $dominio; |
@@ -32,31 +32,31 @@ |
||
| 32 | 32 | { |
| 33 | 33 | $controlador = $peticion->getControlador() . 'Controlador'; |
| 34 | 34 | //definimos la ruta al controlador |
| 35 | - $rutaControlador = SITE_ROOT . 'mvc' . DS .'controladores' . DS . $controlador . '.php'; |
|
| 35 | + $rutaControlador = SITE_ROOT . 'mvc' . DS . 'controladores' . DS . $controlador . '.php'; |
|
| 36 | 36 | $metodo = $peticion->getMetodo(); |
| 37 | 37 | $args = $peticion->getArgumentos(); |
| 38 | 38 | |
| 39 | 39 | //verifcamos que el archivo existe con la funcion de PHP is_readable |
| 40 | - if(is_readable($rutaControlador)){ |
|
| 40 | + if (is_readable($rutaControlador)) { |
|
| 41 | 41 | require_once $rutaControlador; |
| 42 | 42 | $controlador = new $controlador; |
| 43 | 43 | |
| 44 | - if(is_callable(array($controlador, $metodo))){ |
|
| 44 | + if (is_callable(array($controlador, $metodo))) { |
|
| 45 | 45 | $metodo = $peticion->getMetodo(); |
| 46 | 46 | } |
| 47 | - else{ |
|
| 47 | + else { |
|
| 48 | 48 | $metodo = 'index'; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - if(isset($args)){ |
|
| 51 | + if (isset($args)) { |
|
| 52 | 52 | call_user_func_array(array($controlador, $metodo), $args); |
| 53 | 53 | } |
| 54 | - else{ |
|
| 54 | + else { |
|
| 55 | 55 | call_user_func(array($controlador, $metodo)); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } else { |
| 59 | - header('Location: '. Cf_BASE_URL.'error/'); |
|
| 59 | + header('Location: ' . Cf_BASE_URL . 'error/'); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | \ No newline at end of file |
@@ -43,15 +43,13 @@ |
||
| 43 | 43 | |
| 44 | 44 | if(is_callable(array($controlador, $metodo))){ |
| 45 | 45 | $metodo = $peticion->getMetodo(); |
| 46 | - } |
|
| 47 | - else{ |
|
| 46 | + } else{ |
|
| 48 | 47 | $metodo = 'index'; |
| 49 | 48 | } |
| 50 | 49 | |
| 51 | 50 | if(isset($args)){ |
| 52 | 51 | call_user_func_array(array($controlador, $metodo), $args); |
| 53 | - } |
|
| 54 | - else{ |
|
| 52 | + } else{ |
|
| 55 | 53 | call_user_func(array($controlador, $metodo)); |
| 56 | 54 | } |
| 57 | 55 | |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | $this->_vista = new CFVista(new CFSolicitud); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - protected function cargaLib($libreria){ |
|
| 37 | + protected function cargaLib($libreria) { |
|
| 38 | 38 | $rutaLib = RUTA_LIBS . $libreria . '.php'; |
| 39 | - if(is_readable($rutaLib)){ |
|
| 39 | + if (is_readable($rutaLib)) { |
|
| 40 | 40 | require_once $rutaLib; |
| 41 | 41 | //echo 'libreria cargada'; |
| 42 | 42 | } |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - protected function cargaModelo($modelo){ |
|
| 49 | - $modelo=$modelo.'Modelo'; |
|
| 48 | + protected function cargaModelo($modelo) { |
|
| 49 | + $modelo = $modelo . 'Modelo'; |
|
| 50 | 50 | $rutaMod = RUTA_MOD . $modelo . '.php'; |
| 51 | - if(is_readable($rutaMod)){ |
|
| 51 | + if (is_readable($rutaMod)) { |
|
| 52 | 52 | require_once $rutaMod; |
| 53 | 53 | $modelo = new $modelo; |
| 54 | 54 | return $modelo; |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - protected function cargaAyudante($ayudante){ |
|
| 66 | + protected function cargaAyudante($ayudante) { |
|
| 67 | 67 | $rutaAyudante = RUTA_AYUDANTES . $ayudante . '.php'; |
| 68 | - if(is_readable($rutaAyudante)){ |
|
| 68 | + if (is_readable($rutaAyudante)) { |
|
| 69 | 69 | require_once $rutaAyudante; |
| 70 | 70 | //echo 'libreria cargada'; |
| 71 | 71 | } |
@@ -39,8 +39,7 @@ discard block |
||
| 39 | 39 | if(is_readable($rutaLib)){ |
| 40 | 40 | require_once $rutaLib; |
| 41 | 41 | //echo 'libreria cargada'; |
| 42 | - } |
|
| 43 | - else { |
|
| 42 | + } else { |
|
| 44 | 43 | throw new Exception("houston tenemos un problema! al cargar libreria"); |
| 45 | 44 | } |
| 46 | 45 | } |
@@ -53,8 +52,7 @@ discard block |
||
| 53 | 52 | $modelo = new $modelo; |
| 54 | 53 | return $modelo; |
| 55 | 54 | //echo 'modelo cargado'; |
| 56 | - } |
|
| 57 | - else { |
|
| 55 | + } else { |
|
| 58 | 56 | //echo $rutaMod; |
| 59 | 57 | |
| 60 | 58 | |
@@ -68,8 +66,7 @@ discard block |
||
| 68 | 66 | if(is_readable($rutaAyudante)){ |
| 69 | 67 | require_once $rutaAyudante; |
| 70 | 68 | //echo 'libreria cargada'; |
| 71 | - } |
|
| 72 | - else { |
|
| 69 | + } else { |
|
| 73 | 70 | throw new Exception("houston tenemos un problema! al cargar ayudante"); |
| 74 | 71 | } |
| 75 | 72 | } |