Skip to content

Commit 5b97bab

Browse files
OlisaevAGOlisaevAG
authored andcommitted
feat: new more correct condition
1 parent d4daabe commit 5b97bab

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/PhpWord/Shared/Html.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,12 +852,7 @@ protected static function parseStyleDeclarations(array $selectors, array $styles
852852
foreach ($valueArr as $tmpValue) {
853853
if (strpos($tmpValue, '#') === 0 || isset($namedColors[$tmpValue])) {
854854
$color = trim($tmpValue, '#');
855-
} elseif (strpos($tmpValue, 'px') !== false ||
856-
strpos($tmpValue, 'pt') !== false ||
857-
strpos($tmpValue, 'cm') !== false ||
858-
strpos($tmpValue, 'mm') !== false ||
859-
strpos($tmpValue, 'in') !== false ||
860-
strpos($tmpValue, 'pc') !== false) {
855+
} elseif (preg_match('/[\-\d]+(px|pt|cm|mm|in|pc)/', $tmpValue) === 1) {
861856
$size = Converter::cssToTwip($tmpValue);
862857
} else {
863858
$style = self::mapBorderStyle($valueArr[2]);

0 commit comments

Comments
 (0)