| 1: | <?php | 
| 2: |  | 
| 3: |  | 
| 4: |  | 
| 5: |  | 
| 6: |  | 
| 7: |  | 
| 8: |  | 
| 9: |  | 
| 10: |  | 
| 11: |  | 
| 12: |  | 
| 13: |  | 
| 14: |  | 
| 15: |  | 
| 16: |  | 
| 17: |  | 
| 18: |  | 
| 19: |  | 
| 20: | defined('XOOPS_ROOT_PATH') || exit('Restricted access'); | 
| 21: |  | 
| 22: |  | 
| 23: |  | 
| 24: |  | 
| 25: | class MytsRtsp extends MyTextSanitizerExtension | 
| 26: | { | 
| 27: |  | 
| 28: |  | 
| 29: |  | 
| 30: |  | 
| 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: |  | 
| 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: |  | 
| 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: |  |