1 | <?php |
||
27 | class Mp3 extends ExtensionAbstract |
||
28 | { |
||
29 | /** |
||
30 | * @var array default configuration values |
||
31 | */ |
||
32 | protected static $defaultConfiguration = [ |
||
33 | 'enabled' => true, |
||
34 | 'template' => '<audio controls><source src="%1$s" type="audio/mpeg"></audio>', |
||
35 | ]; |
||
36 | |||
37 | /** |
||
38 | * Provide button and javascript code used by the DhtmlTextArea |
||
39 | * |
||
40 | * @param string $textAreaId dom element id |
||
41 | * |
||
42 | * @return string[] editor button as HTML, supporting javascript |
||
43 | */ |
||
44 | 1 | public function getDhtmlEditorSupport($textAreaId) |
|
45 | { |
||
46 | 1 | $buttonCode = $this->getEditorButtonHtml( |
|
47 | 1 | $textAreaId, |
|
48 | 1 | 'mp3.gif', |
|
49 | 1 | \XoopsLocale::MP3, |
|
50 | 1 | 'xoopsCodeMp3', |
|
51 | 1 | \XoopsLocale::MP3_URL |
|
52 | ); |
||
53 | |||
54 | $javascript = <<<EOF |
||
55 | |||
56 | function xoopsCodeMp3(id, enterMp3Phrase) |
||
57 | { |
||
58 | var selection = xoopsGetSelect(id); |
||
59 | if (selection.length > 0) { |
||
60 | var text = selection; |
||
61 | } else { |
||
62 | var text = prompt(enterMp3Phrase, ""); |
||
63 | } |
||
64 | var domobj = xoopsGetElementById(id); |
||
65 | if ( text.length > 0 ) { |
||
66 | xoopsInsertText(domobj, '[mp3 url="'+text+'" /]'); |
||
67 | } |
||
68 | domobj.focus(); |
||
69 | } |
||
70 | |||
71 | EOF; |
||
72 | |||
73 | 1 | return [$buttonCode, $javascript]; |
|
74 | } |
||
75 | |||
76 | /** |
||
77 | * Register extension with the supplied sanitizer instance |
||
78 | * |
||
79 | * @return void |
||
80 | */ |
||
81 | 2 | public function registerExtensionProcessing() |
|
96 | } |
||
97 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.