Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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

XSLT.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 2.04 KiB


 01  <?php
 02   
 03  /*
 04  * @package   s9e\TextFormatter
 05  * @copyright Copyright (c) 2010-2016 The s9e Authors
 06  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
 07  */
 08  namespace s9e\TextFormatter\Renderers;
 09  use XSLTProcessor;
 10  use s9e\TextFormatter\Renderer;
 11  class XSLT extends Renderer
 12  {
 13      protected $proc;
 14      protected $reloadParams = \false;
 15      protected $stylesheet;
 16      public function __construct($stylesheet)
 17      {
 18          $this->stylesheet = $stylesheet;
 19          \preg_match_all('#<xsl:param name="([^"]+)"(?>/>|>([^<]+))#', $stylesheet, $matches);
 20          foreach ($matches[1] as $k => $paramName)
 21              $this->params[$paramName] = (isset($matches[2][$k]))
 22                                        ? \htmlspecialchars_decode($matches[2][$k])
 23                                        : '';
 24      }
 25      public function __sleep()
 26      {
 27          $props = \get_object_vars($this);
 28          unset($props['proc']);
 29          if (empty($props['reloadParams']))
 30              unset($props['reloadParams']);
 31          return \array_keys($props);
 32      }
 33      public function __wakeup()
 34      {
 35          if (!empty($this->reloadParams))
 36          {
 37              $this->setParameters($this->params);
 38              $this->reloadParams = \false;
 39          }
 40      }
 41      public function setParameter($paramName, $paramValue)
 42      {
 43          if (\strpos($paramValue, '"') !== \false
 44           && \strpos($paramValue, "'") !== \false)
 45              $paramValue = \str_replace('"', "\xEF\xBC\x82", $paramValue);
 46          else
 47              $paramValue = (string) $paramValue;
 48          if (!isset($this->params[$paramName]) || $this->params[$paramName] !== $paramValue)
 49          {
 50              $this->load();
 51              $this->proc->setParameter('', $paramName, $paramValue);
 52              $this->params[$paramName] = $paramValue;
 53              $this->reloadParams = \true;
 54          }
 55      }
 56      protected function renderRichText($xml)
 57      {
 58          $dom = $this->loadXML($xml);
 59          $this->load();
 60          $output = (string) $this->proc->transformToXml($dom);
 61          $output = \str_replace('</embed>', '', $output);
 62          if (\substr($output, -1) === "\n")
 63              $output = \substr($output, 0, -1);
 64          return $output;
 65      }
 66      protected function load()
 67      {
 68          if (!isset($this->proc))
 69          {
 70              $xsl = $this->loadXML($this->stylesheet);
 71              $this->proc = new XSLTProcessor;
 72              $this->proc->importStylesheet($xsl);
 73          }
 74      }
 75  }