Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Configurator.php
01 <?php
02
03 /**
04 * @package s9e\TextFormatter
05 * @copyright Copyright (c) 2010-2022 The s9e authors
06 * @license http://www.opensource.org/licenses/mit-license.php The MIT License
07 */
08 namespace s9e\TextFormatter\Plugins\Autolink;
09
10 use s9e\TextFormatter\Configurator\Helpers\RegexpBuilder;
11 use s9e\TextFormatter\Plugins\ConfiguratorBase;
12
13 class Configurator extends ConfiguratorBase
14 {
15 /**
16 * @var string Name of attribute that stores the link's URL
17 */
18 protected $attrName = 'url';
19
20 /**
21 * @var bool Whether to match strings that start with "www."
22 */
23 public $matchWww = false;
24
25 /**
26 * @var string Name of the tag used to represent links
27 */
28 protected $tagName = 'URL';
29
30 /**
31 * Creates the tag used by this plugin
32 *
33 * @return void
34 */
35 protected function setUp()
36 {
37 if (isset($this->configurator->tags[$this->tagName]))
38 {
39 return;
40 }
41
42 // Create a tag
43 $tag = $this->configurator->tags->add($this->tagName);
44
45 // Add an attribute using the default url filter
46 $filter = $this->configurator->attributeFilters->get('#url');
47 $tag->attributes->add($this->attrName)->filterChain->append($filter);
48
49 // Set the default template
50 $tag->template = '<a href="{@' . $this->attrName . '}"><xsl:apply-templates/></a>';
51 }
52
53 /**
54 * {@inheritdoc}
55 */
56 public function asConfig()
57 {
58 $config = [
59 'attrName' => $this->attrName,
60 'regexp' => $this->getRegexp(),
61 'tagName' => $this->tagName
62 ];
63 if (!$this->matchWww)
64 {
65 $config['quickMatch'] = ':';
66 }
67
68 return $config;
69 }
70
71 /**
72 * Return the regexp used to match URLs
73 *
74 * @return strings
75 */
76 protected function getRegexp()
77 {
78 $anchor = RegexpBuilder::fromList($this->configurator->urlConfig->getAllowedSchemes()) . ':';
79 if ($this->matchWww)
80 {
81 $anchor = '(?:' . $anchor . '|www\\.)';
82 }
83
84 $regexp = '#\\b' . $anchor . '(?>[^\\s()\\[\\]'
85 . '\\x{FF01}-\\x{FF0F}\\x{FF1A}-\\x{FF20}\\x{FF3B}-\\x{FF40}\\x{FF5B}-\\x{FF65}'
86 . ']|\\([^\\s()]*\\)|\\[\\w*\\])++#Siu';
87
88 return $regexp;
89 }
90 }