1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5use dokuwiki\Parsing\Handler; 6 7class Emaillink extends AbstractMode 8{ 9 /** @inheritdoc */ 10 public function getSort() 11 { 12 return 340; 13 } 14 15 /** @inheritdoc */ 16 public function connectTo($mode) 17 { 18 // pattern below is defined in inc/mail.php 19 $this->Lexer->addSpecialPattern('<' . PREG_PATTERN_VALID_EMAIL . '>', $mode, 'emaillink'); 20 } 21 22 /** @inheritdoc */ 23 public function handle($match, $state, $pos, Handler $handler) 24 { 25 $email = preg_replace(['/^</', '/>$/'], '', $match); 26 $handler->addCall('emaillink', [$email, null], $pos); 27 return true; 28 } 29} 30