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