1<?php 2 3namespace dokuwiki\Parsing\ParserMode; 4 5use dokuwiki\Parsing\Handler; 6 7/** 8 * Implements the 640x480 replacement 9 */ 10class Multiplyentity extends AbstractMode 11{ 12 /** @inheritdoc */ 13 public function getSort() 14 { 15 return 270; 16 } 17 18 /** @inheritdoc */ 19 public function connectTo($mode) 20 { 21 22 $this->Lexer->addSpecialPattern( 23 '(?<=\b)(?:[1-9]|\d{2,})[xX]\d+(?=\b)', 24 $mode, 25 'multiplyentity' 26 ); 27 } 28 29 /** @inheritdoc */ 30 public function handle($match, $state, $pos, Handler $handler) 31 { 32 preg_match_all('/\d+/', $match, $matches); 33 $handler->addCall('multiplyentity', [$matches[0][0], $matches[0][1]], $pos); 34 return true; 35 } 36} 37