[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace dokuwiki\Parsing\ParserMode; 4 5 class Externallink extends AbstractMode 6 { 7 protected $schemes = array(); 8 protected $patterns = array(); 9 10 /** @inheritdoc */ 11 public function preConnect() 12 { 13 if (count($this->patterns)) return; 14 15 $ltrs = '\w'; 16 $gunk = '/\#~:.?+=&%@!\-\[\]'; 17 $punc = '.:?\-;,'; 18 $host = $ltrs.$punc; 19 $any = $ltrs.$gunk.$punc; 20 21 $this->schemes = getSchemes(); 22 foreach ($this->schemes as $scheme) { 23 $this->patterns[] = '\b(?i)'.$scheme.'(?-i)://['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; 24 } 25 26 $this->patterns[] = '(?<![/\\\\])\b(?i)www?(?-i)\.['.$host.']+?\.'. 27 '['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; 28 $this->patterns[] = '(?<![/\\\\])\b(?i)ftp?(?-i)\.['.$host.']+?\.'. 29 '['.$host.']+?['.$any.']+?(?=['.$punc.']*[^'.$any.'])'; 30 } 31 32 /** @inheritdoc */ 33 public function connectTo($mode) 34 { 35 36 foreach ($this->patterns as $pattern) { 37 $this->Lexer->addSpecialPattern($pattern, $mode, 'externallink'); 38 } 39 } 40 41 /** @inheritdoc */ 42 public function getSort() 43 { 44 return 330; 45 } 46 47 /** 48 * @return array 49 */ 50 public function getPatterns() 51 { 52 return $this->patterns; 53 } 54 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body