[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/s9e/text-formatter/src/Plugins/Autovideo/ -> 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\Autovideo;
   9  
  10  use s9e\TextFormatter\Configurator\Helpers\RegexpBuilder;
  11  use s9e\TextFormatter\Plugins\ConfiguratorBase;
  12  
  13  class Configurator extends ConfiguratorBase
  14  {
  15      /**
  16      * @var string Name of attribute that stores the video's URL
  17      */
  18      protected $attrName = 'src';
  19  
  20      /**
  21      * @var string
  22      */
  23      protected $quickMatch = '://';
  24  
  25      /**
  26      * @var string
  27      */
  28      protected $regexp = '#\\bhttps?://[-.\\w]+/(?:[-+.:/\\w]|%[0-9a-f]{2}|\\(\\w+\\))+\\.(?:mp4|ogg|webm)(?!\\S)#i';
  29  
  30      /**
  31      * @var string Name of the tag used to represent videos
  32      */
  33      protected $tagName = 'VIDEO';
  34  
  35      /**
  36      * Creates the tag used by this plugin
  37      *
  38      * @return void
  39      */
  40  	protected function setUp()
  41      {
  42          if (isset($this->configurator->tags[$this->tagName]))
  43          {
  44              return;
  45          }
  46  
  47          // Create a tag
  48          $tag = $this->configurator->tags->add($this->tagName);
  49  
  50          // Add an attribute using the default url filter
  51          $filter = $this->configurator->attributeFilters['#url'];
  52          $tag->attributes->add($this->attrName)->filterChain->append($filter);
  53  
  54          // Set the default template
  55          $tag->template = '<video controls="" src="{@' . $this->attrName . '}"/>';
  56  
  57          // Allow URL tags to be used as fallback
  58          $tag->rules->allowChild('URL');
  59      }
  60  }


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