[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Configurator/Bundles/ -> Fatdown.php (source)

   1  <?php
   2  
   3  /**
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2022 The s9e authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Configurator\Bundles;
   9  
  10  use s9e\TextFormatter\Configurator;
  11  use s9e\TextFormatter\Configurator\Bundle;
  12  
  13  class Fatdown extends Bundle
  14  {
  15      /**
  16      * {@inheritdoc}
  17      */
  18  	public function configure(Configurator $configurator)
  19      {
  20          $configurator->urlConfig->allowScheme('ftp');
  21          $configurator->urlConfig->allowScheme('mailto');
  22  
  23          $configurator->Litedown->decodeHtmlEntities = true;
  24          $configurator->Autoemail;
  25          $configurator->Autolink;
  26          $configurator->Escaper;
  27          $configurator->FancyPants;
  28          $configurator->HTMLComments;
  29          $configurator->HTMLEntities;
  30          $configurator->PipeTables;
  31          $configurator->TaskLists;
  32  
  33          $htmlAliases = [
  34              'a'      => ['URL', 'href' => 'url'],
  35              'hr'     => 'HR',
  36              'em'     => 'EM',
  37              's'      => 'S',
  38              'strong' => 'STRONG',
  39              'sup'    => 'SUP'
  40          ];
  41          foreach ($htmlAliases as $elName => $alias)
  42          {
  43              if (is_array($alias))
  44              {
  45                  $configurator->HTMLElements->aliasElement($elName, $alias[0]);
  46                  unset($alias[0]);
  47  
  48                  foreach ($alias as $attrName => $alias)
  49                  {
  50                      $configurator->HTMLElements->aliasAttribute($elName, $attrName, $alias);
  51                  }
  52              }
  53              else
  54              {
  55                  $configurator->HTMLElements->aliasElement($elName, $alias);
  56              }
  57          }
  58  
  59          $htmlElements = [
  60              'abbr' => ['title'],
  61              'b',
  62              'br',
  63              'code',
  64              'dd',
  65              'del',
  66              'div' => ['class'],
  67              'dl',
  68              'dt',
  69              'i',
  70              'img' => ['alt', 'height', 'src', 'title', 'width'],
  71              'ins',
  72              'li',
  73              'ol',
  74              'pre',
  75              'rb',
  76              'rp',
  77              'rt',
  78              'rtc',
  79              'ruby',
  80              'span' => ['class'],
  81              'strong',
  82              'sub',
  83              'sup',
  84              'table',
  85              'tbody',
  86              'td' => ['colspan', 'rowspan'],
  87              'tfoot',
  88              'th' => ['colspan', 'rowspan', 'scope'],
  89              'thead',
  90              'tr',
  91              'u',
  92              'ul'
  93          ];
  94          foreach ($htmlElements as $k => $v)
  95          {
  96              if (is_numeric($k))
  97              {
  98                  $elName    = $v;
  99                  $attrNames = [];
 100              }
 101              else
 102              {
 103                  $elName    = $k;
 104                  $attrNames = $v;
 105              }
 106  
 107              $configurator->HTMLElements->allowElement($elName);
 108              foreach ($attrNames as $attrName)
 109              {
 110                  $configurator->HTMLElements->allowAttribute($elName, $attrName);
 111              }
 112          }
 113  
 114          $configurator->tags['html:dd']->rules->createParagraphs(false);
 115          $configurator->tags['html:dt']->rules->createParagraphs(false);
 116          $configurator->tags['html:td']->rules->createParagraphs(false);
 117          $configurator->tags['html:th']->rules->createParagraphs(false);
 118  
 119          $configurator->plugins->load('MediaEmbed', ['createMediaBBCode' => false]);
 120          $sites = [
 121              'bandcamp',
 122              'dailymotion',
 123              'facebook',
 124              'liveleak',
 125              'soundcloud',
 126              'spotify',
 127              'twitch',
 128              'vimeo',
 129              'vine',
 130              'youtube'
 131          ];
 132          foreach ($sites as $site)
 133          {
 134              $configurator->MediaEmbed->add($site);
 135          }
 136      }
 137  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1