[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

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

   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\BBCodes\Configurator;
   9  use InvalidArgumentException;
  10  use s9e\TextFormatter\Configurator\Collections\AttributeList;
  11  use s9e\TextFormatter\Configurator\ConfigProvider;
  12  use s9e\TextFormatter\Configurator\Helpers\ConfigHelper;
  13  use s9e\TextFormatter\Configurator\JavaScript\Dictionary;
  14  use s9e\TextFormatter\Configurator\Traits\Configurable;
  15  use s9e\TextFormatter\Configurator\Validators\AttributeName;
  16  use s9e\TextFormatter\Configurator\Validators\TagName;
  17  class BBCode implements ConfigProvider
  18  {
  19      use Configurable;
  20      protected $contentAttributes;
  21      protected $defaultAttribute;
  22      protected $forceLookahead = \false;
  23      protected $tagName;
  24  	public function __construct(array $options = \null)
  25      {
  26          $this->contentAttributes = new AttributeList;
  27          if (isset($options))
  28              foreach ($options as $optionName => $optionValue)
  29                  $this->__set($optionName, $optionValue);
  30      }
  31  	public function asConfig()
  32      {
  33          $config = ConfigHelper::toArray(\get_object_vars($this));
  34          if (!$this->forceLookahead)
  35              unset($config['forceLookahead']);
  36          return $config;
  37      }
  38  	public static function normalizeName($bbcodeName)
  39      {
  40          if ($bbcodeName === '*')
  41              return '*';
  42          if (!TagName::isValid($bbcodeName))
  43              throw new InvalidArgumentException("Invalid BBCode name '" . $bbcodeName . "'");
  44          return TagName::normalize($bbcodeName);
  45      }
  46  	public function setDefaultAttribute($attrName)
  47      {
  48          $this->defaultAttribute = AttributeName::normalize($attrName);
  49      }
  50  	public function setTagName($tagName)
  51      {
  52          $this->tagName = TagName::normalize($tagName);
  53      }
  54  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1