Miglioramento del sistema di conversione automatica

Miglioramento del sistema di conversione automatica dei formati dell'input.
Aggiunta condizione di fallback per i tag personalizzati, per cui se il contenuto non viene renderizzato viene mostrato il codice responsabile del "malfunzionamento" (per rendere più semplice l'individuazione del problema).
This commit is contained in:
Thomas Zilio 2017-09-24 12:10:22 +02:00
parent 88d3e6d645
commit 48cff7f7fd
3 changed files with 15 additions and 23 deletions

View File

@ -26,7 +26,7 @@ switch (post('op')) {
$avere = $post['avere'][$i];
if (!empty($dare) || !empty($avere)) {
if (is_float($avere)) {
if (!empty($avere)) {
$totale = -$avere;
} else {
$totale = $dare;

View File

@ -94,14 +94,18 @@ class HTMLBuilder
$json = self::decode($value, 'manager');
$class = self::getManager($json['name']);
$html = str_replace($value, !empty($class) ? $class->manage($json) : '', $html);
$result = !empty($class) ? $class->manage($json) : '';
$html = str_replace($value, !empty($result) ? $result : $value, $html);
}
preg_match_all('/'.preg_quote(self::$open['handler']).'(.+?)'.preg_quote(self::$close['handler']).'/is', $html, $handlers);
foreach ($handlers[0] as $value) {
$json = self::decode($value, 'handler');
$html = str_replace($value, self::generate($json), $html);
$result = self::generate($json);
$html = str_replace($value, !empty($result) ? $result : $value, $html);
}
return $html;
@ -396,15 +400,3 @@ class HTMLBuilder
}
}
}
/**
* Predispone un testo per l'inserimento all'interno di un attributo HTML.
*
* @param string $string
*
* @return string
*/
function prepareToField($string)
{
return str_replace('"', '"', $string);
}

View File

@ -178,7 +178,7 @@ class Formatter
{
$result = $this->formatNumber($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -192,7 +192,7 @@ class Formatter
{
$result = $this->parseNumber($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -343,7 +343,7 @@ class Formatter
{
$result = $this->formatTimestamp($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -357,7 +357,7 @@ class Formatter
{
$result = $this->parseTimestamp($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -427,7 +427,7 @@ class Formatter
{
$result = $this->formatDate($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -441,7 +441,7 @@ class Formatter
{
$result = $this->parseDate($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -511,7 +511,7 @@ class Formatter
{
$result = $this->formatTime($value);
return !empty($result);
return !is_bool($result);
}
/**
@ -525,7 +525,7 @@ class Formatter
{
$result = $this->parseTime($value);
return !empty($result);
return !is_bool($result);
}
/**