| @@ 286-307 (lines=22) @@ | ||
| 283 | $stylesAttribute = $element->attributes->getNamedItem('style'); |
|
| 284 | ||
| 285 | // any styles defined before? |
|
| 286 | if ($stylesAttribute !== null) { |
|
| 287 | // get value for the styles attribute |
|
| 288 | $definedStyles = (string) $stylesAttribute->value; |
|
| 289 | ||
| 290 | // split into properties |
|
| 291 | $definedProperties = (array) explode(';', $definedStyles); |
|
| 292 | ||
| 293 | // loop properties |
|
| 294 | foreach ($definedProperties as $property) { |
|
| 295 | // validate property |
|
| 296 | if($property == '') continue; |
|
| 297 | ||
| 298 | // split into chunks |
|
| 299 | $chunks = (array) explode(':', trim($property), 2); |
|
| 300 | ||
| 301 | // validate |
|
| 302 | if(!isset($chunks[1])) continue; |
|
| 303 | ||
| 304 | // loop chunks |
|
| 305 | $properties[$chunks[0]] = trim($chunks[1]); |
|
| 306 | } |
|
| 307 | } |
|
| 308 | ||
| 309 | // add new properties into the list |
|
| 310 | foreach ($rule['properties'] as $key => $value) { |
|
| @@ 375-396 (lines=22) @@ | ||
| 372 | $properties = array(); |
|
| 373 | ||
| 374 | // any styles defined before? |
|
| 375 | if ($stylesAttribute !== null) { |
|
| 376 | // get value for the styles attribute |
|
| 377 | $definedStyles = (string) $stylesAttribute->value; |
|
| 378 | ||
| 379 | // split into properties |
|
| 380 | $definedProperties = (array) explode(';', $definedStyles); |
|
| 381 | ||
| 382 | // loop properties |
|
| 383 | foreach ($definedProperties as $property) { |
|
| 384 | // validate property |
|
| 385 | if($property == '') continue; |
|
| 386 | ||
| 387 | // split into chunks |
|
| 388 | $chunks = (array) explode(':', trim($property), 2); |
|
| 389 | ||
| 390 | // validate |
|
| 391 | if(!isset($chunks[1])) continue; |
|
| 392 | ||
| 393 | // loop chunks |
|
| 394 | $properties[$chunks[0]] = trim($chunks[1]); |
|
| 395 | } |
|
| 396 | } |
|
| 397 | ||
| 398 | // add new properties into the list |
|
| 399 | foreach ($originalProperties as $key => $value) { |
|