[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

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

   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\Escaper;
   9  
  10  use s9e\TextFormatter\Plugins\ConfiguratorBase;
  11  
  12  class Configurator extends ConfiguratorBase
  13  {
  14      /**
  15      * {@inheritdoc}
  16      */
  17      protected $quickMatch = '\\';
  18  
  19      /**
  20      * @var string Regexp that matches one backslash followed by the escape character
  21      */
  22      protected $regexp;
  23  
  24      /**
  25      * @var string Name of the tag used by this plugin
  26      */
  27      protected $tagName = 'ESC';
  28  
  29      /**
  30      * Set whether any Unicode character should be escapable, or limit to some ASCII symbols
  31      *
  32      * @param  bool $bool Whether any Unicode character should be escapable
  33      * @return void
  34      */
  35  	public function escapeAll($bool = true)
  36      {
  37          $this->regexp = ($bool) ? '/\\\\./su' : '/\\\\[-!#()*+.:<>@[\\\\\\]^_`{|}~]/';
  38      }
  39  
  40      /**
  41      * {@inheritdoc}
  42      */
  43  	protected function setUp()
  44      {
  45          // Set the default regexp
  46          $this->escapeAll(false);
  47  
  48          // Create the tag
  49          $tag = $this->configurator->tags->add($this->tagName);
  50          $tag->rules->disableAutoLineBreaks();
  51          $tag->rules->ignoreTags();
  52          $tag->rules->preventLineBreaks();
  53          $tag->template = '<xsl:apply-templates/>';
  54      }
  55  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1