#248 More flexible checking for float value

This commit is contained in:
Ivan Lanin 2014-05-27 01:08:54 +07:00
parent d9a2c4c3ca
commit d7f3d25b2a
2 changed files with 3 additions and 3 deletions

View File

@ -245,7 +245,7 @@ abstract class AbstractStyle
if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) { if (is_string($value) && (preg_match('/[^\d\.\,]/', $value) == 0)) {
$value = floatval($value); $value = floatval($value);
} }
if (!is_float($value)) { if (!is_numeric($value)) {
$value = $default; $value = $default;
} }

View File

@ -250,7 +250,7 @@ class Image extends AbstractStyle
*/ */
public function setMarginTop($value = 0) public function setMarginTop($value = 0)
{ {
$this->marginTop = $this->setFloatVal($value, 0); $this->marginTop = $this->setNumericVal($value, 0);
return $this; return $this;
} }
@ -273,7 +273,7 @@ class Image extends AbstractStyle
*/ */
public function setMarginLeft($value = 0) public function setMarginLeft($value = 0)
{ {
$this->marginLeft = $this->setFloatVal($value, 0); $this->marginLeft = $this->setNumericVal($value, 0);
return $this; return $this;
} }