[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/PipeTables/ -> Configurator.php (source)

   1  <?php
   2  
   3  /*
   4  * @package   s9e\TextFormatter
   5  * @copyright Copyright (c) 2010-2019 The s9e Authors
   6  * @license   http://www.opensource.org/licenses/mit-license.php The MIT License
   7  */
   8  namespace s9e\TextFormatter\Plugins\PipeTables;
   9  use s9e\TextFormatter\Configurator\Items\AttributeFilters\ChoiceFilter;
  10  use s9e\TextFormatter\Plugins\ConfiguratorBase;
  11  class Configurator extends ConfiguratorBase
  12  {
  13      protected $quickMatch = '|';
  14  	protected function setUp()
  15      {
  16          $tags = [
  17              'TABLE' => ['template' => '<table><xsl:apply-templates/></table>'],
  18              'TBODY' => ['template' => '<tbody><xsl:apply-templates/></tbody>'],
  19              'TD'    => $this->generateCellTagConfig('td'),
  20              'TH'    => $this->generateCellTagConfig('th'),
  21              'THEAD' => ['template' => '<thead><xsl:apply-templates/></thead>'],
  22              'TR'    => ['template' => '<tr><xsl:apply-templates/></tr>']
  23          ];
  24          foreach ($tags as $tagName => $tagConfig)
  25              if (!isset($this->configurator->tags[$tagName]))
  26                  $this->configurator->tags->add($tagName, $tagConfig);
  27      }
  28  	protected function generateCellTagConfig($elName)
  29      {
  30          $alignFilter = new ChoiceFilter(['left', 'center', 'right', 'justify'], \true);
  31          return    [
  32              'attributes' => [
  33                  'align' => [
  34                      'filterChain' => ['strtolower', $alignFilter],
  35                      'required' => \false
  36                  ]
  37              ],
  38              'rules' => ['createParagraphs' => \false],
  39              'template' =>
  40                  '<' . $elName . '>
  41                      <xsl:if test="@align">
  42                          <xsl:attribute name="style">text-align:<xsl:value-of select="@align"/></xsl:attribute>
  43                      </xsl:if>
  44                      <xsl:apply-templates/>
  45                  </' . $elName . '>'
  46          ];
  47      }
  48  	public function asConfig()
  49      {
  50          return [
  51              'overwriteEscapes'  => isset($this->configurator->Escaper),
  52              'overwriteMarkdown' => isset($this->configurator->Litedown)
  53          ];
  54      }
  55  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1