01-PicoParsePagesContent.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Parses the contents of all pages
  4. *
  5. * This plugin exists for backward compatibility and is disabled by default.
  6. * It gets automatically enabled when {@link PicoDeprecated} is enabled. You
  7. * can avoid this by calling {@link PicoParsePagesContent::setEnabled()}.
  8. *
  9. * This plugin heavily impacts Pico's performance, you should avoid to enable
  10. * it whenever possible! If you must parse the contents of a page, do this
  11. * selectively and only for pages you really need to.
  12. *
  13. * @author Daniel Rudolf
  14. * @link http://picocms.org
  15. * @license http://opensource.org/licenses/MIT The MIT License
  16. * @version 1.0
  17. */
  18. class PicoParsePagesContent extends AbstractPicoPlugin
  19. {
  20. /**
  21. * This plugin is disabled by default
  22. *
  23. * @see AbstractPicoPlugin::$enabled
  24. */
  25. protected $enabled = false;
  26. /**
  27. * Parses the contents of all pages
  28. *
  29. * @see DummyPlugin::onSinglePageLoaded()
  30. */
  31. public function onSinglePageLoaded(array &$pageData)
  32. {
  33. if (!isset($pageData['content'])) {
  34. $pageData['content'] = $this->prepareFileContent($pageData['raw_content'], $pageData['meta']);
  35. $pageData['content'] = $this->parseFileContent($pageData['content']);
  36. }
  37. }
  38. }