[ 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\FancyPants; 9 10 use s9e\TextFormatter\Plugins\ConfiguratorBase; 11 12 /** 13 * This plugin combines some of the functionalities found in SmartyPants and Textile 14 * 15 * @link http://daringfireball.net/projects/smartypants/ 16 * @link http://textile.thresholdstate.com/ 17 */ 18 class Configurator extends ConfiguratorBase 19 { 20 /** 21 * @var string Name of attribute used to for the replacement 22 */ 23 protected $attrName = 'char'; 24 25 /** 26 * @var string[] List of passes that have been explicitly disabled 27 */ 28 protected $disabledPasses = []; 29 30 /** 31 * @var string Name of the tag used to mark the text to replace 32 */ 33 protected $tagName = 'FP'; 34 35 /** 36 * Plugin's setup 37 * 38 * Will initialize create the plugin's tag if it does not exist 39 */ 40 protected function setUp() 41 { 42 if (isset($this->configurator->tags[$this->tagName])) 43 { 44 return; 45 } 46 47 // Create tag 48 $tag = $this->configurator->tags->add($this->tagName); 49 50 // Create attribute 51 $tag->attributes->add($this->attrName); 52 53 // Create a template that replaces its content with the replacement char 54 $tag->template 55 = '<xsl:value-of select="@' . htmlspecialchars($this->attrName) . '"/>'; 56 } 57 58 /** 59 * Disable a given pass 60 * 61 * @param string $passName 62 * @return void 63 */ 64 public function disablePass($passName) 65 { 66 $this->disabledPasses[] = $passName; 67 } 68 69 /** 70 * Enable a given pass 71 * 72 * @param string $passName 73 * @return void 74 */ 75 public function enablePass($passName) 76 { 77 foreach (array_keys($this->disabledPasses, $passName, true) as $k) 78 { 79 unset($this->disabledPasses[$k]); 80 } 81 } 82 83 /** 84 * {@inheritdoc} 85 */ 86 public function asConfig() 87 { 88 $config = [ 89 'attrName' => $this->attrName, 90 'tagName' => $this->tagName 91 ]; 92 foreach ($this->disabledPasses as $passName) 93 { 94 $config['disable' . $passName] = true; 95 } 96 97 return $config; 98 } 99 }
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 |