diff --git a/modules/primanota/actions.php b/modules/primanota/actions.php index 3981c300e..974866812 100644 --- a/modules/primanota/actions.php +++ b/modules/primanota/actions.php @@ -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; diff --git a/src/HTMLBuilder/HTMLBuilder.php b/src/HTMLBuilder/HTMLBuilder.php index 2baa4b958..ae0ba9882 100644 --- a/src/HTMLBuilder/HTMLBuilder.php +++ b/src/HTMLBuilder/HTMLBuilder.php @@ -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); -} diff --git a/src/Intl/Formatter.php b/src/Intl/Formatter.php index fc4bbe9f2..65adc8e4d 100644 --- a/src/Intl/Formatter.php +++ b/src/Intl/Formatter.php @@ -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); } /**