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

HintGenerator.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.68 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\Configurator\JavaScript;
 09  use ReflectionClass;
 10  use s9e\TextFormatter\Configurator\Collections\PluginCollection;
 11  class HintGenerator
 12  {
 13      protected $config;
 14      protected $hints;
 15      protected $plugins;
 16      protected $xsl;
 17      public function getHints()
 18      {
 19          $this->hints = array();
 20          $this->setPluginsHints();
 21          $this->setRenderingHints();
 22          $this->setRulesHints();
 23          $this->setTagsHints();
 24          $js = "/** @const */ var HINT={};\n";
 25          \ksort($this->hints);
 26          foreach ($this->hints as $hintName => $hintValue)
 27              $js .= '/** @const */ HINT.' . $hintName . '=' . \json_encode($hintValue) . ";\n";
 28          return $js;
 29      }
 30      public function setConfig(array $config)
 31      {
 32          $this->config = $config;
 33      }
 34      public function setPlugins(PluginCollection $plugins)
 35      {
 36          $this->plugins = $plugins;
 37      }
 38      public function setXSL($xsl)
 39      {
 40          $this->xsl = $xsl;
 41      }
 42      protected function setPluginsHints()
 43      {
 44          foreach ($this->plugins as $plugins)
 45              $this->hints += $plugins->getJSHints();
 46      }
 47      protected function setRenderingHints()
 48      {
 49          $this->hints['postProcessing'] = (int) (\strpos($this->xsl, 'data-s9e-livepreview-postprocess') !== \false);
 50      }
 51      protected function setRulesHints()
 52      {
 53          $this->hints['closeAncestor']   = 0;
 54          $this->hints['closeParent']     = 0;
 55          $this->hints['createChild']     = 0;
 56          $this->hints['fosterParent']    = 0;
 57          $this->hints['requireAncestor'] = 0;
 58          $flags = 0;
 59          foreach ($this->config['tags'] as $tagConfig)
 60          {
 61              foreach (\array_intersect_key($tagConfig['rules'], $this->hints) as $k => $v)
 62                  $this->hints[$k] = 1;
 63              $flags |= $tagConfig['rules']['flags'];
 64          }
 65          $flags |= $this->config['rootContext']['flags'];
 66          $parser = new ReflectionClass('s9e\\TextFormatter\\Parser');
 67          foreach ($parser->getConstants() as $constName => $constValue)
 68              if (\substr($constName, 0, 5) === 'RULE_')
 69                  $this->hints[$constName] = ($flags & $constValue) ? 1 : 0;
 70      }
 71      protected function setTagAttributesHints(array $tagConfig)
 72      {
 73          if (empty($tagConfig['attributes']))
 74              return;
 75          foreach ($tagConfig['attributes'] as $attrConfig)
 76          {
 77              $this->hints['attributeGenerator']    |= isset($attrConfig['generator']);
 78              $this->hints['attributeDefaultValue'] |= isset($attrConfig['defaultValue']);
 79          }
 80      }
 81      protected function setTagsHints()
 82      {
 83          $this->hints['attributeGenerator']    = 0;
 84          $this->hints['attributeDefaultValue'] = 0;
 85          $this->hints['namespaces']            = 0;
 86          foreach ($this->config['tags'] as $tagName => $tagConfig)
 87          {
 88              $this->hints['namespaces'] |= (\strpos($tagName, ':') !== \false);
 89              $this->setTagAttributesHints($tagConfig);
 90          }
 91      }
 92  }