Copie de Tumblr sur Shaarli
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
954B

  1. <?php
  2. namespace League\HTMLToMarkdown\Converter;
  3. use League\HTMLToMarkdown\Configuration;
  4. use League\HTMLToMarkdown\ConfigurationAwareInterface;
  5. use League\HTMLToMarkdown\ElementInterface;
  6. class DivConverter implements ConverterInterface, ConfigurationAwareInterface
  7. {
  8. /**
  9. * @var Configuration
  10. */
  11. protected $config;
  12. /**
  13. * @param Configuration $config
  14. */
  15. public function setConfig(Configuration $config)
  16. {
  17. $this->config = $config;
  18. }
  19. /**
  20. * @param ElementInterface $element
  21. *
  22. * @return string
  23. */
  24. public function convert(ElementInterface $element)
  25. {
  26. if ($this->config->getOption('strip_tags', false)) {
  27. return $element->getValue() . "\n\n";
  28. }
  29. return html_entity_decode($element->getChildrenAsString());
  30. }
  31. /**
  32. * @return string[]
  33. */
  34. public function getSupportedTags()
  35. {
  36. return array('div');
  37. }
  38. }