1 | <?php |
||
27 | class YouTube extends ExtensionAbstract |
||
28 | { |
||
29 | /** |
||
30 | * @var array default configuration values |
||
31 | */ |
||
32 | protected static $defaultConfiguration = [ |
||
33 | 'enabled' => true, |
||
34 | 'template' => '<div class="embed-responsive %4$s"> |
||
35 | <iframe class="embed-responsive-item" width="%2$d" height="%3$d" src="https://www.youtube.com/embed/%1$s" frameborder="0" allowfullscreen></iframe> |
||
36 | </div>', |
||
37 | 'width' => "640", |
||
38 | 'height' => "385", |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * Provide button and javascript code used by the DhtmlTextArea |
||
43 | * |
||
44 | * @param string $textAreaId dom element id |
||
45 | * |
||
46 | * @return string[] editor button as HTML, supporting javascript |
||
47 | */ |
||
48 | 1 | public function getDhtmlEditorSupport($textAreaId) |
|
49 | { |
||
50 | 1 | $buttonCode = $this->getEditorButtonHtml( |
|
51 | 1 | $textAreaId, |
|
52 | 1 | 'youtube.gif', |
|
53 | 1 | \XoopsLocale::YOUTUBE, |
|
54 | 1 | 'xoopsCodeYoutube', |
|
55 | 1 | \XoopsLocale::YOUTUBE_URL, |
|
56 | 1 | \XoopsLocale::HEIGHT, |
|
57 | 1 | \XoopsLocale::WIDTH |
|
58 | ); |
||
59 | |||
60 | $javascript = <<<EOH |
||
61 | |||
62 | function xoopsCodeYoutube(id, enterFlashPhrase, enterFlashHeightPhrase, enterFlashWidthPhrase) |
||
63 | { |
||
64 | var selection = xoopsGetSelect(id); |
||
65 | if (selection.length > 0) { |
||
66 | var text = selection; |
||
67 | } else { |
||
68 | var text = prompt(enterFlashPhrase, ""); |
||
69 | } |
||
70 | var domobj = xoopsGetElementById(id); |
||
71 | if ( text.length > 0 ) { |
||
72 | var text2 = prompt(enterFlashWidthPhrase, "640"); |
||
73 | var text3 = prompt(enterFlashHeightPhrase, "385"); |
||
74 | var result = '[youtube url="' + text + '"'; |
||
75 | if ( text2.length > 0) { |
||
76 | result += ' width="' + text2 + '" height="' + text3 + '"'; |
||
77 | } |
||
78 | result += " /]"; |
||
79 | xoopsInsertText(domobj, result); |
||
80 | } |
||
81 | domobj.focus(); |
||
82 | } |
||
83 | |||
84 | EOH; |
||
85 | |||
86 | 1 | return [$buttonCode, $javascript]; |
|
87 | } |
||
88 | |||
89 | /** |
||
90 | * Register extension with the supplied sanitizer instance |
||
91 | * |
||
92 | * @return void |
||
93 | */ |
||
94 | 2 | public function registerExtensionProcessing() |
|
150 | } |
||
151 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.