[ 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\Configurator\RulesGenerators; 9 10 use s9e\TextFormatter\Configurator\Helpers\TemplateInspector; 11 use s9e\TextFormatter\Configurator\RulesGenerators\Interfaces\BooleanRulesGenerator; 12 use s9e\TextFormatter\Configurator\RulesGenerators\Interfaces\TargetedRulesGenerator; 13 14 class EnforceContentModels implements BooleanRulesGenerator, TargetedRulesGenerator 15 { 16 /** 17 * @var TemplateInspector 18 */ 19 protected $br; 20 21 /** 22 * @var TemplateInspector 23 */ 24 protected $p; 25 26 /** 27 * @var TemplateInspector 28 */ 29 protected $span; 30 31 /** 32 * Constructor 33 * 34 * Prepares the TemplateInspector for <br/> and <span> 35 */ 36 public function __construct() 37 { 38 $this->br = new TemplateInspector('<br/>'); 39 $this->p = new TemplateInspector('<p><xsl:apply-templates/></p>'); 40 $this->span = new TemplateInspector('<span><xsl:apply-templates/></span>'); 41 } 42 43 /** 44 * {@inheritdoc} 45 */ 46 public function generateBooleanRules(TemplateInspector $src) 47 { 48 $rules = []; 49 if ($src->isTransparent()) 50 { 51 $rules['isTransparent'] = true; 52 } 53 if (!$src->allowsChild($this->br)) 54 { 55 $rules['preventLineBreaks'] = true; 56 $rules['suspendAutoLineBreaks'] = true; 57 } 58 if (!$src->allowsDescendant($this->br)) 59 { 60 $rules['disableAutoLineBreaks'] = true; 61 $rules['preventLineBreaks'] = true; 62 } 63 if ($src->closesParent($this->p)) 64 { 65 $rules['breakParagraph'] = true; 66 } 67 68 return $rules; 69 } 70 71 /** 72 * {@inheritdoc} 73 */ 74 public function generateTargetedRules(TemplateInspector $src, TemplateInspector $trg) 75 { 76 $rules = []; 77 if ($src->allowsChild($trg)) 78 { 79 $rules[] = 'allowChild'; 80 } 81 if ($src->allowsDescendant($trg)) 82 { 83 $rules[] = 'allowDescendant'; 84 } 85 86 return $rules; 87 } 88 }
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 |