1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Xoops\Core\Text\Sanitizer\Extensions;
13:
14: use Xoops\Core\Text\Sanitizer;
15: use Xoops\Core\Text\Sanitizer\ExtensionAbstract;
16:
17: 18: 19: 20: 21: 22: 23: 24: 25: 26:
27: class Rtsp extends ExtensionAbstract
28: {
29: 30: 31:
32: protected static $defaultConfiguration = [
33: 'enabled' => false,
34: ];
35:
36: 37: 38: 39: 40: 41: 42:
43: public function getDhtmlEditorSupport($textAreaId)
44: {
45: $buttonCode = $this->getEditorButtonHtml(
46: $textAreaId,
47: 'rtspimg.gif',
48: \XoopsLocale::REAL_PLAYER,
49: 'xoopsCodeRtsp',
50: \XoopsLocale::RTSP_URL,
51: \XoopsLocale::HEIGHT,
52: \XoopsLocale::WIDTH
53: );
54:
55: $javascript = <<<EOH
56: function xoopsCodeRtsp(id,enterRtspPhrase, enterRtspHeightPhrase, enterRtspWidthPhrase){
57: var selection = xoopsGetSelect(id);
58: if (selection.length > 0) {
59: var selection = "rtsp://"+selection;
60: var text = selection;
61: } else {
62: var text = prompt(enterRtspPhrase+" Rtsp or http", "Rtsp://");
63: }
64: var domobj = xoopsGetElementById(id);
65: if ( text.length > 0 && text!="rtsp://") {
66: var text2 = prompt(enterRtspWidthPhrase, "480");
67: var text3 = prompt(enterRtspHeightPhrase, "330");
68: var result = "[rtsp="+text2+","+text3+"]" + text + "[/rtsp]";
69: xoopsInsertText(domobj, result);
70: }
71: domobj.focus();
72: }
73: EOH;
74: return array($buttonCode, $javascript);
75: }
76:
77: 78: 79: 80: 81:
82: public function registerExtensionProcessing()
83: {
84:
85: $this->shortcodes->addShortcode(
86: 'rtsp',
87: function ($attributes, $content, $tagName) {
88: $args = ltrim($attributes[0], '=');
89: list($width, $height) = explode(',', $args);
90: $url = $content;
91:
92: $template = <<<'EOT'
93: <object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" HEIGHT="%3$s" ID=Player WIDTH="%2$s" VIEWASTEXT>
94: <param NAME="_ExtentX" VALUE="12726">
95: <param NAME="_ExtentY" VALUE="8520">
96: <param NAME="AUTOSTART" VALUE="0">
97: <param NAME="SHUFFLE" VALUE="0">
98: <param NAME="PREFETCH" VALUE="0">
99: <param NAME="NOLABELS" VALUE="0">
100: <param NAME="CONTROLS" VALUE="ImageWindow">
101: <param NAME="CONSOLE" VALUE="_master">
102: <param NAME="LOOP" VALUE="0">
103: <param NAME="NUMLOOP" VALUE="0">
104: <param NAME="CENTER" VALUE="0">
105: <param NAME="MAINTAINASPECT" VALUE="1">
106: <param NAME="BACKGROUNDCOLOR" VALUE="#000000">
107: <param NAME="SRC" VALUE="%1$s">
108: <embed autostart="0" src="%1$s" type="audio/x-pn-realaudio-plugin" HEIGHT="%3$s" WIDTH="%2$s" controls="ImageWindow" console="cons"> </embed>
109: </object>
110: <br />
111: <object CLASSID=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA HEIGHT=32 ID=Player WIDTH="%2$s" VIEWASTEXT>
112: <param NAME="_ExtentX" VALUE="18256">
113: <param NAME="_ExtentY" VALUE="794">
114: <param NAME="AUTOSTART" VALUE="0">
115: <param NAME="SHUFFLE" VALUE="0">
116: <param NAME="PREFETCH" VALUE="0">
117: <param NAME="NOLABELS" VALUE="0">
118: <param NAME="CONTROLS" VALUE="controlpanel">
119: <param NAME="CONSOLE" VALUE="_master">
120: <param NAME="LOOP" VALUE="0">
121: <param NAME="NUMLOOP" VALUE="0">
122: <param NAME="CENTER" VALUE="0">
123: <param NAME="MAINTAINASPECT" VALUE="0">
124: <param NAME="BACKGROUNDCOLOR" VALUE="#000000">
125: <param NAME="SRC" VALUE="%1$s">
126: <embed autostart="0" src="%1$s" type="audio/x-pn-realaudio-plugin" HEIGHT='30' WIDTH='%2$s' controls="ControlPanel" console="cons"> </embed>
127: </object>
128: EOT;
129:
130: $newContent = sprintf($template, $url, $width, $height);
131: return $newContent;
132: }
133: );
134: }
135: }
136: