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 protected $pattern; 8*be906b56SAndreas Gohr 9*be906b56SAndreas Gohr /** @inheritdoc */ 10*be906b56SAndreas Gohr public function preConnect() 11*be906b56SAndreas Gohr { 12*be906b56SAndreas Gohr 13*be906b56SAndreas Gohr $ltrs = '\w'; 14*be906b56SAndreas Gohr $gunk = '/\#~:.?+=&%@!\-'; 15*be906b56SAndreas Gohr $punc = '.:?\-;,'; 16*be906b56SAndreas Gohr $any = $ltrs . $gunk . $punc; 17*be906b56SAndreas Gohr 18*be906b56SAndreas Gohr $this->pattern = '\b(?i)file(?-i)://[' . $any . ']+?[' . 19*be906b56SAndreas Gohr $punc . ']*[^' . $any . ']'; 20*be906b56SAndreas Gohr } 21*be906b56SAndreas Gohr 22*be906b56SAndreas Gohr /** @inheritdoc */ 23*be906b56SAndreas Gohr public function connectTo($mode) 24*be906b56SAndreas Gohr { 25*be906b56SAndreas Gohr $this->Lexer->addSpecialPattern( 26*be906b56SAndreas Gohr $this->pattern, 27*be906b56SAndreas Gohr $mode, 28*be906b56SAndreas Gohr 'filelink' 29*be906b56SAndreas Gohr ); 30*be906b56SAndreas Gohr } 31*be906b56SAndreas Gohr 32*be906b56SAndreas Gohr /** @inheritdoc */ 33*be906b56SAndreas Gohr public function getSort() 34*be906b56SAndreas Gohr { 35*be906b56SAndreas Gohr return 360; 36*be906b56SAndreas Gohr } 37*be906b56SAndreas Gohr} 38