1: <?php
2: /**
3: * TextSanitizer extension
4: *
5: * You may not change or alter any portion of this comment or credits
6: * of supporting developers from this source code or any supporting source code
7: * which is considered copyrighted (c) material of the original comment or credit authors.
8: * This program is distributed in the hope that it will be useful,
9: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * @copyright (c) 2000-2017 XOOPS Project (www.xoops.org)
13: * @license GNU GPL 2 (https://www.gnu.org/licenses/gpl-2.0.html)
14: * @package class
15: * @subpackage textsanitizer
16: * @since 2.3.0
17: * @author Taiwen Jiang <phppp@users.sourceforge.net>
18: * @deprecated since 2.5.9
19: */
20: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
21:
22: /**
23: * Class MytsRtsp
24: */
25: class MytsRtsp extends MyTextSanitizerExtension
26: {
27: /**
28: * @param $textarea_id
29: *
30: * @return array
31: */
32: public function encode($textarea_id)
33: {
34: $config = parent::loadConfig(__DIR__);
35: if ($config['enable_rtsp_entry'] === false) {
36: return array();
37: }
38: $code = "<button type='button' class='btn btn-default btn-sm' onclick='xoopsCodeRtsp(\"{$textarea_id}\",\""
39: . htmlspecialchars(_XOOPS_FORM_ENTERRTSPURL, ENT_QUOTES) . "\",\""
40: . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\""
41: . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES)
42: . "\");' onmouseover='style.cursor=\"hand\"' title='" . _XOOPS_FORM_ALTRTSP
43: . "'><span class='fa fa-fw fa-comment-o' aria-hidden='true'></span></button>";
44: // $code = "<img src='{$this->image_path}/rtspimg.gif' alt='" . _XOOPS_FORM_ALTRTSP . "' title='" . _XOOPS_FORM_ALTRTSP . "' '" . "' onclick='xoopsCodeRtsp(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERRTSPURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;";
45: $javascript = <<<EOH
46: function xoopsCodeRtsp(id,enterRtspPhrase, enterRtspHeightPhrase, enterRtspWidthPhrase)
47: {
48: var selection = xoopsGetSelect(id);
49: if (selection.length > 0) {
50: var selection = "rtsp://"+selection;
51: var text = selection;
52: } else {
53: var text = prompt(enterRtspPhrase+" Rtsp or http", "Rtsp://");
54: }
55: var domobj = xoopsGetElementById(id);
56: if (text.length > 0 && text!="rtsp://") {
57: var text2 = prompt(enterRtspWidthPhrase, "480");
58: var text3 = prompt(enterRtspHeightPhrase, "330");
59: var result = "[rtsp="+text2+","+text3+"]" + text + "[/rtsp]";
60: xoopsInsertText(domobj, result);
61: }
62: domobj.focus();
63: }
64: EOH;
65:
66: return array($code, $javascript);
67: }
68:
69: /**
70: * @param MyTextSanitizer $myts
71: */
72: public function load(MyTextSanitizer $myts)
73: {
74: $myts->patterns[] = "/\[rtsp=(['\"]?)([^\"']*),([^\"']*)\\1]([^\"]*)\[\/rtsp\]/sU";
75: $rp = "<object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" HEIGHT='\\3' ID=Player WIDTH='\\2' VIEWASTEXT>";
76: $rp .= "<param NAME=\"_ExtentX\" VALUE=\"12726\">";
77: $rp .= "<param NAME=\"_ExtentY\" VALUE=\"8520\">";
78: $rp .= "<param NAME=\"AUTOSTART\" VALUE=\"0\">";
79: $rp .= "<param NAME=\"SHUFFLE\" VALUE=\"0\">";
80: $rp .= "<param NAME=\"PREFETCH\" VALUE=\"0\">";
81: $rp .= "<param NAME=\"NOLABELS\" VALUE=\"0\">";
82: $rp .= "<param NAME=\"CONTROLS\" VALUE=\"ImageWindow\">";
83: $rp .= "<param NAME=\"CONSOLE\" VALUE=\"_master\">";
84: $rp .= "<param NAME=\"LOOP\" VALUE=\"0\">";
85: $rp .= "<param NAME=\"NUMLOOP\" VALUE=\"0\">";
86: $rp .= "<param NAME=\"CENTER\" VALUE=\"0\">";
87: $rp .= "<param NAME=\"MAINTAINASPECT\" VALUE=\"1\">";
88: $rp .= "<param NAME=\"BACKGROUNDCOLOR\" VALUE=\"#000000\">";
89: $rp .= "<param NAME=\"SRC\" VALUE=\"\\4\">";
90: $rp .= "<embed autostart=\"0\" src=\"\\4\" type=\"audio/x-pn-realaudio-plugin\" HEIGHT='\\3' WIDTH='\\2' controls=\"ImageWindow\" console=\"cons\"> </embed>";
91: $rp .= '</object>';
92: $rp .= "<br><object CLASSID=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA HEIGHT=32 ID=Player WIDTH='\\2' VIEWASTEXT>";
93: $rp .= "<param NAME=\"_ExtentX\" VALUE=\"18256\">";
94: $rp .= "<param NAME=\"_ExtentY\" VALUE=\"794\">";
95: $rp .= "<param NAME=\"AUTOSTART\" VALUE=\"0\">";
96: $rp .= "<param NAME=\"SHUFFLE\" VALUE=\"0\">";
97: $rp .= "<param NAME=\"PREFETCH\" VALUE=\"0\">";
98: $rp .= "<param NAME=\"NOLABELS\" VALUE=\"0\">";
99: $rp .= "<param NAME=\"CONTROLS\" VALUE=\"controlpanel\">";
100: $rp .= "<param NAME=\"CONSOLE\" VALUE=\"_master\">";
101: $rp .= "<param NAME=\"LOOP\" VALUE=\"0\">";
102: $rp .= "<param NAME=\"NUMLOOP\" VALUE=\"0\">";
103: $rp .= "<param NAME=\"CENTER\" VALUE=\"0\">";
104: $rp .= "<param NAME=\"MAINTAINASPECT\" VALUE=\"0\">";
105: $rp .= "<param NAME=\"BACKGROUNDCOLOR\" VALUE=\"#000000\">";
106: $rp .= "<param NAME=\"SRC\" VALUE=\"\\4\">";
107: $rp .= "<embed autostart=\"0\" src=\"\\4\" type=\"audio/x-pn-realaudio-plugin\" HEIGHT='30' WIDTH='\\2' controls=\"ControlPanel\" console=\"cons\"> </embed>";
108: $rp .= '</object>';
109:
110: $myts->replacements[] = $rp;
111: }
112: }
113: