-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathConfigurator.php
More file actions
31 lines (25 loc) · 1.07 KB
/
Configurator.php
File metadata and controls
31 lines (25 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php declare(strict_types=1);
/**
* @package s9e\TextFormatter
* @copyright Copyright (c) The s9e authors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\TextFormatter\Plugins\Autoaudio;
use s9e\TextFormatter\Plugins\AbstractStaticUrlReplacer\AbstractConfigurator;
class Configurator extends AbstractConfigurator
{
public array $fileExtensions = ['aac', 'flac', 'm4a', 'mp3', 'wav', 'wave'];
protected $attrName = 'src';
protected $tagName = 'AUDIO';
protected function getTemplate(): string
{
return '<div class="autoaudio"><p class="autoaudio-title"><a href="{@' . $this->attrName . '}"><xsl:value-of select="@filename"/></a>:</p><p class="autoaudio-player"><audio controls="" src="{@' . $this->attrName . '}"/></p></div>';
}
protected function setUp(): void
{
parent::setUp();
$tag = $this->configurator->tags[$this->tagName];
$tag->attributes->add('filename')->filterChain->append('urldecode');
$tag->attributePreprocessors->add($this->attrName, '/\\/(?\'filename\'[^\\/]+)$/');
}
}