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

RegexpBuilder.php

Zuletzt modifiziert: 02.04.2025, 15:04 - Dateigröße: 1.17 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\Helpers;
09   
10  use s9e\RegexpBuilder\Builder;
11   
12  abstract class RegexpBuilder
13  {
14      /**
15      * Create a regexp pattern that matches a list of words
16      *
17      * @param  array  $words   Words to sort (must be UTF-8)
18      * @param  array  $options
19      * @return string
20      */
21      public static function fromList(array $words, array $options = [])
22      {
23          $options += [
24              'delimiter'       => '/',
25              'caseInsensitive' => false,
26              'specialChars'    => [],
27              'unicode'         => true
28          ];
29   
30          // Normalize ASCII if the regexp is meant to be case-insensitive
31          if ($options['caseInsensitive'])
32          {
33              foreach ($words as &$word)
34              {
35                  $word = strtr($word, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
36              }
37              unset($word);
38          }
39   
40          $builder = new Builder([
41              'delimiter' => $options['delimiter'],
42              'meta'      => $options['specialChars'],
43              'input'     => $options['unicode'] ? 'Utf8' : 'Bytes',
44              'output'    => $options['unicode'] ? 'Utf8' : 'Bytes'
45          ]);
46   
47          return $builder->build($words);
48      }
49  }