| @@ 419-434 (lines=16) @@ | ||
| 416 | * @param string $html HTML to parse for elements |
|
| 417 | * @return array of SimpleXMLElement objects |
|
| 418 | */ |
|
| 419 | public function findSelectedOptionElements($html) |
|
| 420 | { |
|
| 421 | $options = $this->findOptionElements($html); |
|
| 422 | ||
| 423 | /* Find any elements that have the "selected" attribute and put them into a list */ |
|
| 424 | $foundSelected = array(); |
|
| 425 | foreach ($options as $option) { |
|
| 426 | $attributes = $option->attributes(); |
|
| 427 | if ($attributes) { |
|
| 428 | foreach ($attributes as $attribute => $value) { |
|
| 429 | if ($attribute == 'selected') { |
|
| 430 | $foundSelected[] = $option; |
|
| 431 | } |
|
| 432 | } |
|
| 433 | } |
|
| 434 | } |
|
| 435 | ||
| 436 | return $foundSelected; |
|
| 437 | } |
|
| @@ 447-462 (lines=16) @@ | ||
| 444 | * @param string $html HTML to parse for elements |
|
| 445 | * @return array of SimpleXMLElement objects |
|
| 446 | */ |
|
| 447 | public function findDisabledOptionElements($html) |
|
| 448 | { |
|
| 449 | $options = $this->findOptionElements($html); |
|
| 450 | ||
| 451 | /* Find any elements that have the "disabled" attribute and put them into a list */ |
|
| 452 | $foundDisabled = array(); |
|
| 453 | foreach ($options as $option) { |
|
| 454 | $attributes = $option->attributes(); |
|
| 455 | if ($attributes) { |
|
| 456 | foreach ($attributes as $attribute => $value) { |
|
| 457 | if ($attribute == 'disabled') { |
|
| 458 | $foundDisabled[] = $option; |
|
| 459 | } |
|
| 460 | } |
|
| 461 | } |
|
| 462 | } |
|
| 463 | ||
| 464 | return $foundDisabled; |
|
| 465 | } |
|