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

Configurator.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 3.98 KiB


001  <?php
002   
003  /*
004  * @package   s9e\TextFormatter
005  * @copyright Copyright (c) 2010-2016 The s9e Authors
006  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
007  */
008  namespace s9e\TextFormatter\Plugins\Emoticons;
009  use ArrayAccess;
010  use Countable;
011  use Iterator;
012  use s9e\TextFormatter\Configurator\Helpers\ConfigHelper;
013  use s9e\TextFormatter\Configurator\Helpers\RegexpBuilder;
014  use s9e\TextFormatter\Configurator\Helpers\XPathHelper;
015  use s9e\TextFormatter\Configurator\Items\Regexp;
016  use s9e\TextFormatter\Configurator\JavaScript\RegexpConvertor;
017  use s9e\TextFormatter\Configurator\Traits\CollectionProxy;
018  use s9e\TextFormatter\Plugins\ConfiguratorBase;
019  use s9e\TextFormatter\Plugins\Emoticons\Configurator\EmoticonCollection;
020  class Configurator extends ConfiguratorBase implements ArrayAccess, Countable, Iterator
021  {
022      public function __call($methodName, $args)
023      {
024          return \call_user_func_array(array($this->collection, $methodName), $args);
025      }
026      public function offsetExists($offset)
027      {
028          return isset($this->collection[$offset]);
029      }
030      public function offsetGet($offset)
031      {
032          return $this->collection[$offset];
033      }
034      public function offsetSet($offset, $value)
035      {
036          $this->collection[$offset] = $value;
037      }
038      public function offsetUnset($offset)
039      {
040          unset($this->collection[$offset]);
041      }
042      public function count()
043      {
044          return \count($this->collection);
045      }
046      public function current()
047      {
048          return $this->collection->current();
049      }
050      public function key()
051      {
052          return $this->collection->key();
053      }
054      public function next()
055      {
056          return $this->collection->next();
057      }
058      public function rewind()
059      {
060          $this->collection->rewind();
061      }
062      public function valid()
063      {
064          return $this->collection->valid();
065      }
066      protected $collection;
067      public $notAfter = '';
068      public $notBefore = '';
069      public $notIfCondition;
070      protected $onDuplicateAction = 'replace';
071      protected $tagName = 'E';
072      protected function setUp()
073      {
074          $this->collection = new EmoticonCollection;
075          if (!$this->configurator->tags->exists($this->tagName))
076              $this->configurator->tags->add($this->tagName);
077      }
078      public function finalize()
079      {
080          $tag = $this->getTag();
081          if (!isset($tag->template))
082              $tag->template = $this->getTemplate();
083      }
084      public function asConfig()
085      {
086          if (!\count($this->collection))
087              return;
088          $codes = \array_keys(\iterator_to_array($this->collection));
089          $regexp = '/';
090          if ($this->notAfter !== '')
091              $regexp .= '(?<!' . $this->notAfter . ')';
092          $regexp .= RegexpBuilder::fromList($codes);
093          if ($this->notBefore !== '')
094              $regexp .= '(?!' . $this->notBefore . ')';
095          $regexp .= '/S';
096          if (\preg_match('/\\\\[pP](?>\\{\\^?\\w+\\}|\\w\\w?)/', $regexp))
097              $regexp .= 'u';
098          $regexp = \preg_replace('/(?<!\\\\)((?>\\\\\\\\)*)\\(\\?:/', '$1(?>', $regexp);
099          $config = array(
100              'quickMatch' => $this->quickMatch,
101              'regexp'     => $regexp,
102              'tagName'    => $this->tagName
103          );
104          if ($this->notAfter !== '')
105          {
106              $lpos = 6 + \strlen($this->notAfter);
107              $rpos = \strrpos($regexp, '/');
108              $jsRegexp = RegexpConvertor::toJS('/' . \substr($regexp, $lpos, $rpos - $lpos) . '/', \true);
109              $config['regexp'] = new Regexp($regexp);
110              $config['regexp']->setJS($jsRegexp);
111              $config['notAfter'] = new Regexp('/' . $this->notAfter . '/');
112          }
113          if ($this->quickMatch === \false)
114              $config['quickMatch'] = ConfigHelper::generateQuickMatchFromList($codes);
115          return $config;
116      }
117      public function getJSHints()
118      {
119          return array('EMOTICONS_NOT_AFTER' => (int) !empty($this->notAfter));
120      }
121      public function getTemplate()
122      {
123          $xsl = '<xsl:choose>';
124          if (!empty($this->notIfCondition))
125              $xsl .= '<xsl:when test="' . \htmlspecialchars($this->notIfCondition) . '"><xsl:value-of select="."/></xsl:when><xsl:otherwise><xsl:choose>';
126          foreach ($this->collection as $code => $template)
127              $xsl .= '<xsl:when test=".=' . \htmlspecialchars(XPathHelper::export($code)) . '">'
128                    . $template
129                    . '</xsl:when>';
130          $xsl .= '<xsl:otherwise><xsl:value-of select="."/></xsl:otherwise>';
131          $xsl .= '</xsl:choose>';
132          if (!empty($this->notIfCondition))
133              $xsl .= '</xsl:otherwise></xsl:choose>';
134          return $xsl;
135      }
136  }