[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/inc/Parsing/ParserMode/ -> Filelink.php (source)

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