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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

Attribute.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 2.15 KiB


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\Collections\AttributeFilterChain;
11  use s9e\TextFormatter\Configurator\ConfigProvider;
12  use s9e\TextFormatter\Configurator\Helpers\ConfigHelper;
13  use s9e\TextFormatter\Configurator\Items\ProgrammableCallback;
14  use s9e\TextFormatter\Configurator\Traits\Configurable;
15  use s9e\TextFormatter\Configurator\Traits\TemplateSafeness;
16   
17  /**
18  * @property mixed $defaultValue Default value used for this attribute
19  * @property AttributeFilterChain $filterChain This attribute's filter chain
20  * @property bool $required Whether this attribute is required for the tag to be valid
21  */
22  class Attribute implements ConfigProvider
23  {
24      use Configurable;
25      use TemplateSafeness;
26   
27      /**
28      * @var mixed Default value used for this attribute
29      */
30      protected $defaultValue;
31   
32      /**
33      * @var AttributeFilterChain This attribute's filter chain
34      */
35      protected $filterChain;
36   
37      /**
38      * @var bool Whether this attribute is required for the tag to be valid
39      */
40      protected $required = true;
41   
42      /**
43      * Constructor
44      *
45      * @param array $options This attribute's options
46      */
47      public function __construct(array $options = null)
48      {
49          $this->filterChain = new AttributeFilterChain;
50   
51          if (isset($options))
52          {
53              foreach ($options as $optionName => $optionValue)
54              {
55                  $this->__set($optionName, $optionValue);
56              }
57          }
58      }
59   
60      /**
61      * Return whether this attribute is safe to be used in given context
62      *
63      * @param  string $context Either 'AsURL', 'InCSS' or 'InJS'
64      * @return bool
65      */
66      protected function isSafe($context)
67      {
68          // Test this attribute's filters
69          $methodName = 'isSafe' . $context;
70          foreach ($this->filterChain as $filter)
71          {
72              if ($filter->$methodName())
73              {
74                  // If any filter makes it safe, we consider it safe
75                  return true;
76              }
77          }
78   
79          return !empty($this->markedSafe[$context]);
80      }
81   
82      /**
83      * {@inheritdoc}
84      */
85      public function asConfig()
86      {
87          $vars = get_object_vars($this);
88          unset($vars['markedSafe']);
89   
90          return ConfigHelper::toArray($vars) + ['filterChain' => []];
91      }
92  }