[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 3 /* 4 * @package s9e\TextFormatter 5 * @copyright Copyright (c) 2010-2019 The s9e Authors 6 * @license http://www.opensource.org/licenses/mit-license.php The MIT License 7 */ 8 namespace s9e\TextFormatter\Plugins\Autolink; 9 use s9e\TextFormatter\Configurator\Helpers\RegexpBuilder; 10 use s9e\TextFormatter\Plugins\ConfiguratorBase; 11 class Configurator extends ConfiguratorBase 12 { 13 protected $attrName = 'url'; 14 public $matchWww = \false; 15 protected $tagName = 'URL'; 16 protected function setUp() 17 { 18 if (isset($this->configurator->tags[$this->tagName])) 19 return; 20 $tag = $this->configurator->tags->add($this->tagName); 21 $filter = $this->configurator->attributeFilters->get('#url'); 22 $tag->attributes->add($this->attrName)->filterChain->append($filter); 23 $tag->template = '<a href="{@' . $this->attrName . '}"><xsl:apply-templates/></a>'; 24 } 25 public function asConfig() 26 { 27 $config = [ 28 'attrName' => $this->attrName, 29 'regexp' => $this->getRegexp(), 30 'tagName' => $this->tagName 31 ]; 32 if (!$this->matchWww) 33 $config['quickMatch'] = '://'; 34 return $config; 35 } 36 protected function getRegexp() 37 { 38 $anchor = RegexpBuilder::fromList($this->configurator->urlConfig->getAllowedSchemes()) . '://'; 39 if ($this->matchWww) 40 $anchor = '(?:' . $anchor . '|www\\.)'; 41 $regexp = '#\\b' . $anchor . '\\S(?>[^\\s()\\[\\]\\x{FF01}-\\x{FF0F}\\x{FF1A}-\\x{FF20}\\x{FF3B}-\\x{FF40}\\x{FF5B}-\\x{FF65}]|\\([^\\s()]*\\)|\\[\\w*\\])++#Siu'; 42 return $regexp; 43 } 44 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |