Code cleaning

This commit is contained in:
Benjamin Renard 2020-11-30 19:44:14 +01:00
parent 106a2d9f04
commit b4a5824ee8
5 changed files with 23 additions and 25 deletions

View file

@ -36,14 +36,14 @@ class LSattr_html_image extends LSattr_html {
* *
* @retval LSformElement L'element du formulaire ajouté * @retval LSformElement L'element du formulaire ajouté
*/ */
function addToForm (&$form,$idForm,$data=NULL) { function addToForm (&$form, $idForm, $data=NULL) {
$element=$form -> addElement('image', $this -> name, $this -> getLabel(), $this -> config, $this); $element=$form -> addElement('image', $this -> name, $this -> getLabel(), $this -> config, $this);
if(!$element) { if(!$element) {
LSerror :: addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06',$this -> name);
return; return;
} }
if ($data && count($data)>1) { if ($data && count($data) > 1) {
LSerror :: addErrorCode('LSattr_html_03','password'); LSerror :: addErrorCode('LSattr_html_03','password');
} }

View file

@ -37,9 +37,9 @@ class LSattr_html_password extends LSattr_html {
* @retval LSformElement L'element du formulaire ajouté * @retval LSformElement L'element du formulaire ajouté
*/ */
public function addToForm (&$form,$idForm,$data=NULL) { public function addToForm (&$form,$idForm,$data=NULL) {
$element=$form -> addElement('password', $this -> name, $this -> getLabel(), $this -> config, $this); $element = $form -> addElement('password', $this -> name, $this -> getLabel(), $this -> config, $this);
if(!$element) { if(!$element) {
LSerror :: addErrorCode('LSform_06',$this -> name); LSerror :: addErrorCode('LSform_06', $this -> name);
return; return;
} }

View file

@ -63,7 +63,7 @@ class LSformRule_password extends LSformRule {
$minValidRegex = count($regex); $minValidRegex = count($regex);
self :: log_debug("password must match with $minValidRegex regex on ".count($regex)); self :: log_debug("password must match with $minValidRegex regex on ".count($regex));
$valid=0; $valid = 0;
foreach($regex as $r) { foreach($regex as $r) {
if ($r[0] != '/') { if ($r[0] != '/') {
LSerror :: addErrorCode('LSformRule_password_01'); LSerror :: addErrorCode('LSformRule_password_01');

View file

@ -112,28 +112,26 @@ class LSioFormatDriver {
* *
* @retval array All objects data of the loaded file formated * @retval array All objects data of the loaded file formated
**/ **/
public function getAllFormated($fields,$generated_fields) { public function getAllFormated($fields, $generated_fields) {
if (!is_array($fields)) return False; if (!is_array($fields)) return False;
if (!is_array($generated_fields)) $generated_fields=array(); if (!is_array($generated_fields)) $generated_fields=array();
$all=$this -> getAll(); $all = $this -> getAll();
if (!is_array($all)) return False; if (!is_array($all)) return False;
$retall=array(); $retall = array();
foreach($all as $one) { foreach($all as $one) {
$retone=array(); $retone = array();
foreach($fields as $key => $attr) { foreach($fields as $key => $attr) {
if (!isset($one[$key])) continue; if (!isset($one[$key])) continue;
if (!isset($retone[$attr])) $retone[$attr]=array(); if (!isset($retone[$attr])) $retone[$attr] = array();
$retone[$attr][]=$one[$key]; $retone[$attr][] = $one[$key];
} }
if (is_array($generated_fields)) {
foreach ($generated_fields as $attr => $format) { foreach ($generated_fields as $attr => $format) {
$value=getFData($format,$retone); $value = getFData($format, $retone);
if (!empty($value)) { if (!empty($value)) {
$retone[$attr]=array($value); $retone[$attr] = array($value);
} }
} }
} $retall[] = $retone;
$retall[]=$retone;
} }
return $retall; return $retall;