| @@ 42-81 (lines=40) @@ | ||
| 39 | ); |
|
| 40 | } |
|
| 41 | ||
| 42 | protected function doClean(LoggerInterface $logger) |
|
| 43 | { |
|
| 44 | if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) { |
|
| 45 | $hasSrc = $this->hasAttribute('src'); |
|
| 46 | foreach ($this->children as $child) { |
|
| 47 | if ($child->getType() == Token::COMMENT) { |
|
| 48 | continue; |
|
| 49 | } |
|
| 50 | ||
| 51 | if ($child->getType() == Token::TEXT) { |
|
| 52 | continue; |
|
| 53 | } |
|
| 54 | ||
| 55 | if ($child->getType() !== Token::ELEMENT) { |
|
| 56 | $logger->debug('Removing ' . $child . '. Only elements allowed as children of "audio" element.'); |
|
| 57 | $this->removeChild($child); |
|
| 58 | ||
| 59 | continue; |
|
| 60 | } |
|
| 61 | ||
| 62 | if (!$hasSrc && $child->getName() == 'source') { |
|
| 63 | continue; |
|
| 64 | } |
|
| 65 | ||
| 66 | if ($child->getName() == 'track') { |
|
| 67 | continue; |
|
| 68 | } |
|
| 69 | ||
| 70 | if ($child instanceof TransparentElement && |
|
| 71 | $child->isTransparentElement()) { |
|
| 72 | continue; |
|
| 73 | } |
|
| 74 | ||
| 75 | $logger->debug('Removing ' . $child . '. Only "source", "track", and transparent elements allowed as children of "audio" element.'); |
|
| 76 | $this->removeChild($child); |
|
| 77 | } |
|
| 78 | } |
|
| 79 | ||
| 80 | return true; |
|
| 81 | } |
|
| 82 | ||
| 83 | public function isInteractiveContent() |
|
| 84 | { |
|
| @@ 45-84 (lines=40) @@ | ||
| 42 | ); |
|
| 43 | } |
|
| 44 | ||
| 45 | protected function doClean(LoggerInterface $logger) |
|
| 46 | { |
|
| 47 | if ($this->configuration->get('clean-strategy') != Configuration::CLEAN_STRATEGY_LENIENT) { |
|
| 48 | $hasSrc = $this->hasAttribute('src'); |
|
| 49 | foreach ($this->children as $child) { |
|
| 50 | if ($child->getType() == Token::COMMENT) { |
|
| 51 | continue; |
|
| 52 | } |
|
| 53 | ||
| 54 | if ($child->getType() == Token::TEXT) { |
|
| 55 | continue; |
|
| 56 | } |
|
| 57 | ||
| 58 | if ($child->getType() !== Token::ELEMENT) { |
|
| 59 | $logger->debug('Removing ' . $child . '. Only elements allowed as children of "video" element.'); |
|
| 60 | $this->removeChild($child); |
|
| 61 | ||
| 62 | continue; |
|
| 63 | } |
|
| 64 | ||
| 65 | if (!$hasSrc && $child->getName() == 'source') { |
|
| 66 | continue; |
|
| 67 | } |
|
| 68 | ||
| 69 | if ($child->getName() == 'track') { |
|
| 70 | continue; |
|
| 71 | } |
|
| 72 | ||
| 73 | if ($child instanceof TransparentElement && |
|
| 74 | $child->isTransparentElement()) { |
|
| 75 | continue; |
|
| 76 | } |
|
| 77 | ||
| 78 | $logger->debug('Removing ' . $child . '. Only "source", "track", and transparent elements allowed as children of "video" element.'); |
|
| 79 | $this->removeChild($child); |
|
| 80 | } |
|
| 81 | } |
|
| 82 | ||
| 83 | return true; |
|
| 84 | } |
|
| 85 | ||
| 86 | public function isInteractiveContent() |
|
| 87 | { |
|