| @@ 34-60 (lines=27) @@ | ||
| 31 | ); |
|
| 32 | } |
|
| 33 | ||
| 34 | protected function doClean(LoggerInterface $logger) |
|
| 35 | { |
|
| 36 | if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) { |
|
| 37 | // Only "li" and ScriptSupporting elements allowed. |
|
| 38 | foreach ($this->children as $child) { |
|
| 39 | if ($child->getType() == Token::COMMENT) { |
|
| 40 | continue; |
|
| 41 | } |
|
| 42 | ||
| 43 | if ($child->getType() != Token::ELEMENT) { |
|
| 44 | $logger->debug('Removing ' . $child . '. Only elements "li" and script supporting elements allowed as children of "ol" element.'); |
|
| 45 | $this->removeChild($child); |
|
| 46 | ||
| 47 | continue; |
|
| 48 | } |
|
| 49 | ||
| 50 | if ($child->getName() == 'li' || $child instanceof ScriptSupporting) { |
|
| 51 | continue; |
|
| 52 | } |
|
| 53 | ||
| 54 | $logger->debug('Removing ' . $child . '. Only elements "li" and script supporting elements allowed as children of "ol" element.'); |
|
| 55 | $this->removeChild($child); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| 59 | return true; |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| @@ 19-45 (lines=27) @@ | ||
| 16 | */ |
|
| 17 | class Ul extends OpenElement implements FlowContent |
|
| 18 | { |
|
| 19 | protected function doClean(LoggerInterface $logger) |
|
| 20 | { |
|
| 21 | if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) { |
|
| 22 | // Only "li" and ScriptSupporting elements allowed. |
|
| 23 | foreach ($this->children as $child) { |
|
| 24 | if ($child->getType() == Token::COMMENT) { |
|
| 25 | continue; |
|
| 26 | } |
|
| 27 | ||
| 28 | if ($child->getType() != Token::ELEMENT) { |
|
| 29 | $logger->debug('Removing ' . $child . '. Only elements "li" and script supporting elements allowed as children of "ul" element.'); |
|
| 30 | $this->removeChild($child); |
|
| 31 | ||
| 32 | continue; |
|
| 33 | } |
|
| 34 | ||
| 35 | if ($child->getName() == 'li' || $child instanceof ScriptSupporting) { |
|
| 36 | continue; |
|
| 37 | } |
|
| 38 | ||
| 39 | $logger->debug('Removing ' . $child . '. Only elements "li" and script supporting elements allowed as children of "ul" element.'); |
|
| 40 | $this->removeChild($child); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| 44 | return true; |
|
| 45 | } |
|
| 46 | } |
|
| 47 | ||