Filelink.php 707 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace dokuwiki\Parsing\ParserMode;
  3. class Filelink extends AbstractMode
  4. {
  5. protected $pattern;
  6. /** @inheritdoc */
  7. public function preConnect()
  8. {
  9. $ltrs = '\w';
  10. $gunk = '/\#~:.?+=&%@!\-';
  11. $punc = '.:?\-;,';
  12. $host = $ltrs.$punc;
  13. $any = $ltrs.$gunk.$punc;
  14. $this->pattern = '\b(?i)file(?-i)://['.$any.']+?['.
  15. $punc.']*[^'.$any.']';
  16. }
  17. /** @inheritdoc */
  18. public function connectTo($mode)
  19. {
  20. $this->Lexer->addSpecialPattern(
  21. $this->pattern,
  22. $mode,
  23. 'filelink'
  24. );
  25. }
  26. /** @inheritdoc */
  27. public function getSort()
  28. {
  29. return 360;
  30. }
  31. }