[ Index ] |
PHP Cross Reference of phpBB-3.3.14-deutsch |
[Summary view] [Print] [Text view]
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\Plugins\PipeTables; 9 10 use s9e\TextFormatter\Configurator\Items\AttributeFilters\ChoiceFilter; 11 use s9e\TextFormatter\Plugins\ConfiguratorBase; 12 13 class Configurator extends ConfiguratorBase 14 { 15 /** 16 * {@inheritdoc} 17 */ 18 protected $quickMatch = '|'; 19 20 /** 21 * Create the tags used by this plugin 22 * 23 * @return void 24 */ 25 protected function setUp() 26 { 27 $tags = [ 28 'TABLE' => ['template' => '<table><xsl:apply-templates/></table>'], 29 'TBODY' => ['template' => '<tbody><xsl:apply-templates/></tbody>'], 30 'TD' => $this->generateCellTagConfig('td'), 31 'TH' => $this->generateCellTagConfig('th'), 32 'THEAD' => ['template' => '<thead><xsl:apply-templates/></thead>'], 33 'TR' => ['template' => '<tr><xsl:apply-templates/></tr>'] 34 ]; 35 foreach ($tags as $tagName => $tagConfig) 36 { 37 if (!isset($this->configurator->tags[$tagName])) 38 { 39 $this->configurator->tags->add($tagName, $tagConfig); 40 } 41 } 42 } 43 44 /** 45 * Generate the tag config for give cell element 46 * 47 * @param string $elName Element's name, either "td" or "th" 48 * @return array Tag config 49 */ 50 protected function generateCellTagConfig($elName) 51 { 52 $alignFilter = new ChoiceFilter(['left', 'center', 'right', 'justify'], true); 53 54 return [ 55 'attributes' => [ 56 'align' => [ 57 'filterChain' => ['strtolower', $alignFilter], 58 'required' => false 59 ] 60 ], 61 'rules' => ['createParagraphs' => false], 62 'template' => 63 '<' . $elName . '> 64 <xsl:if test="@align"> 65 <xsl:attribute name="style">text-align:<xsl:value-of select="@align"/></xsl:attribute> 66 </xsl:if> 67 <xsl:apply-templates/> 68 </' . $elName . '>' 69 ]; 70 } 71 72 /** 73 * {@inheritdoc} 74 */ 75 public function asConfig() 76 { 77 return [ 78 'overwriteEscapes' => isset($this->configurator->Escaper), 79 'overwriteMarkdown' => isset($this->configurator->Litedown) 80 ]; 81 } 82 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Nov 25 19:05:08 2024 | Cross-referenced by PHPXref 0.7.1 |