[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
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\Litedown; 9 use s9e\TextFormatter\Plugins\ConfiguratorBase; 10 class Configurator extends ConfiguratorBase 11 { 12 public $decodeHtmlEntities = \false; 13 protected $tags = [ 14 'C' => '<code><xsl:apply-templates/></code>', 15 'CODE' => [ 16 'attributes' => [ 17 'lang' => [ 18 'filterChain' => ['#simpletext'], 19 'required' => \false 20 ] 21 ], 22 'template' => 23 '<pre> 24 <code> 25 <xsl:if test="@lang"> 26 <xsl:attribute name="class"> 27 <xsl:text>language-</xsl:text> 28 <xsl:value-of select="@lang"/> 29 </xsl:attribute> 30 </xsl:if> 31 <xsl:apply-templates/> 32 </code> 33 </pre>' 34 ], 35 'DEL' => '<del><xsl:apply-templates/></del>', 36 'EM' => '<em><xsl:apply-templates/></em>', 37 'H1' => '<h1><xsl:apply-templates/></h1>', 38 'H2' => '<h2><xsl:apply-templates/></h2>', 39 'H3' => '<h3><xsl:apply-templates/></h3>', 40 'H4' => '<h4><xsl:apply-templates/></h4>', 41 'H5' => '<h5><xsl:apply-templates/></h5>', 42 'H6' => '<h6><xsl:apply-templates/></h6>', 43 'HR' => '<hr/>', 44 'IMG' => [ 45 'attributes' => [ 46 'alt' => ['required' => \false ], 47 'src' => ['filterChain' => ['#url']], 48 'title' => ['required' => \false ] 49 ], 50 'template' => '<img src="{@src}"><xsl:copy-of select="@alt"/><xsl:copy-of select="@title"/></img>' 51 ], 52 'LI' => '<li><xsl:apply-templates/></li>', 53 'LIST' => [ 54 'attributes' => [ 55 'start' => [ 56 'filterChain' => ['#uint'], 57 'required' => \false 58 ], 59 'type' => [ 60 'filterChain' => ['#simpletext'], 61 'required' => \false 62 ] 63 ], 64 'template' => 65 '<xsl:choose> 66 <xsl:when test="not(@type)"> 67 <ul><xsl:apply-templates/></ul> 68 </xsl:when> 69 <xsl:otherwise> 70 <ol><xsl:copy-of select="@start"/><xsl:apply-templates/></ol> 71 </xsl:otherwise> 72 </xsl:choose>' 73 ], 74 'QUOTE' => '<blockquote><xsl:apply-templates/></blockquote>', 75 'STRONG' => '<strong><xsl:apply-templates/></strong>', 76 'SUB' => '<sub><xsl:apply-templates/></sub>', 77 'SUP' => '<sup><xsl:apply-templates/></sup>', 78 'URL' => [ 79 'attributes' => [ 80 'title' => ['required' => \false ], 81 'url' => ['filterChain' => ['#url']] 82 ], 83 'template' => '<a href="{@url}"><xsl:copy-of select="@title"/><xsl:apply-templates/></a>' 84 ] 85 ]; 86 protected function setUp() 87 { 88 $this->configurator->rulesGenerator->append('ManageParagraphs'); 89 foreach ($this->tags as $tagName => $tagConfig) 90 { 91 if (isset($this->configurator->tags[$tagName])) 92 continue; 93 if (\is_string($tagConfig)) 94 $tagConfig = ['template' => $tagConfig]; 95 $this->configurator->tags->add($tagName, $tagConfig); 96 } 97 } 98 public function asConfig() 99 { 100 return ['decodeHtmlEntities' => (bool) $this->decodeHtmlEntities]; 101 } 102 public function getJSHints() 103 { 104 return ['LITEDOWN_DECODE_HTML_ENTITIES' => (int) $this->decodeHtmlEntities]; 105 } 106 public function getJSParser() 107 { 108 $js = \file_get_contents(__DIR__ . '/Parser/ParsedText.js') . "\n" 109 . \file_get_contents(__DIR__ . '/Parser/Passes/AbstractScript.js') . "\n" 110 . \file_get_contents(__DIR__ . '/Parser/LinkAttributesSetter.js'); 111 $passes = [ 112 'Blocks', 113 'LinkReferences', 114 'InlineCode', 115 'Images', 116 'Links', 117 'Strikethrough', 118 'Subscript', 119 'Superscript', 120 'Emphasis', 121 'ForcedLineBreaks' 122 ]; 123 foreach ($passes as $pass) 124 $js .= "\n(function(){\n" 125 . \file_get_contents(__DIR__ . '/Parser/Passes/' . $pass . '.js') . "\nparse();\n})();"; 126 return $js; 127 } 128 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |