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 |
AttributeFilter.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\Configurator\Items;
09
10 use s9e\TextFormatter\Configurator\Traits\TemplateSafeness;
11
12 class AttributeFilter extends Filter
13 {
14 use TemplateSafeness;
15
16 /**
17 * Constructor
18 *
19 * @param callable $callback
20 */
21 public function __construct($callback)
22 {
23 parent::__construct($callback);
24
25 // Set the default signature
26 $this->resetParameters();
27 $this->addParameterByName('attrValue');
28 }
29
30 /**
31 * Return whether this filter makes a value safe to be used in JavaScript
32 *
33 * @return bool
34 */
35 public function isSafeInJS()
36 {
37 // List of callbacks that make a value safe to be used in a script, hardcoded for
38 // convenience. Technically, there are numerous built-in PHP functions that would make an
39 // arbitrary value safe in JS, but only a handful have the potential to be used as an
40 // attribute filter
41 $safeCallbacks = [
42 'urlencode',
43 'strtotime',
44 'rawurlencode'
45 ];
46
47 if (in_array($this->callback, $safeCallbacks, true))
48 {
49 return true;
50 }
51
52 return $this->isSafe('InJS');
53 }
54 }