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

TemplateSafeness.php

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


001  <?php
002   
003  /**
004  * @package   s9e\TextFormatter
005  * @copyright Copyright (c) 2010-2022 The s9e authors
006  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
007  */
008  namespace s9e\TextFormatter\Configurator\Traits;
009   
010  trait TemplateSafeness
011  {
012      /**
013      * @var array Contexts in which this object is considered safe to be used
014      */
015      protected $markedSafe = [];
016   
017      /**
018      * Return whether this object is safe to be used in given context
019      *
020      * @param  string $context Either 'AsURL', 'InCSS' or 'InJS'
021      * @return bool
022      */
023      protected function isSafe($context)
024      {
025          // Test whether this attribute was marked as safe in given context
026          return !empty($this->markedSafe[$context]);
027      }
028   
029      /**
030      * Return whether this object is safe to be used as a URL
031      *
032      * @return bool
033      */
034      public function isSafeAsURL()
035      {
036          return $this->isSafe('AsURL');
037      }
038   
039      /**
040      * Return whether this object is safe to be used in CSS
041      *
042      * @return bool
043      */
044      public function isSafeInCSS()
045      {
046          return $this->isSafe('InCSS');
047      }
048   
049      /**
050      * Return whether this object is safe to be used in JavaScript
051      *
052      * @return bool
053      */
054      public function isSafeInJS()
055      {
056          return $this->isSafe('InJS');
057      }
058   
059      /**
060      * Return whether this object is safe to be used as a URL
061      *
062      * @return self
063      */
064      public function markAsSafeAsURL()
065      {
066          $this->markedSafe['AsURL'] = true;
067   
068          return $this;
069      }
070   
071      /**
072      * Return whether this object is safe to be used in CSS
073      *
074      * @return self
075      */
076      public function markAsSafeInCSS()
077      {
078          $this->markedSafe['InCSS'] = true;
079   
080          return $this;
081      }
082   
083      /**
084      * Return whether this object is safe to be used in JavaScript
085      *
086      * @return self
087      */
088      public function markAsSafeInJS()
089      {
090          $this->markedSafe['InJS'] = true;
091   
092          return $this;
093      }
094   
095      /**
096      * Reset the "marked safe" statuses
097      *
098      * @return self
099      */
100      public function resetSafeness()
101      {
102          $this->markedSafe = [];
103   
104          return $this;
105      }
106  }