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 MytsMms extends MyTextSanitizerExtension
26: {
27: 28: 29: 30: 31:
32: public function encode($textarea_id)
33: {
34: $config = parent::loadConfig(__DIR__);
35: if ($config['enable_mms_entry'] === false) {
36: return array();
37: }
38: $code = "<button type='button' class='btn btn-default btn-sm' onclick='xoopsCodeMms(\"{$textarea_id}\",\""
39: . htmlspecialchars(_XOOPS_FORM_ENTERMMSURL, 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_ALTMMS
43: . "'><span class='fa fa-fw fa-server' aria-hidden='true'></span></button>";
44:
45:
46: $javascript = <<<EOH
47: function xoopsCodeMms(id,enterMmsPhrase, enterMmsHeightPhrase, enterMmsWidthPhrase)
48: {
49: var selection = xoopsGetSelect(id);
50: if (selection.length > 0) {
51: var selection="mms://"+selection;
52: var text = selection;
53: } else {
54: var text = prompt(enterMmsPhrase+" mms or http", "mms://");
55: }
56: var domobj = xoopsGetElementById(id);
57: if (text.length > 0 && text != "mms://") {
58: var text2 = prompt(enterMmsWidthPhrase, "480");
59: var text3 = prompt(enterMmsHeightPhrase, "330");
60: var result = "[mms="+text2+","+text3+"]" + text + "[/mms]";
61: xoopsInsertText(domobj, result);
62: }
63: domobj.focus();
64: }
65: EOH;
66:
67: return array(
68: $code,
69: $javascript);
70: }
71:
72: 73: 74: 75: 76:
77: public function load($ts)
78: {
79: $ts->patterns[] = "/\[mms=(['\"]?)([^\"']*),([^\"']*)\\1]([^\"]*)\[\/mms\]/sU";
80: $rp = "<OBJECT id=videowindow1 height='\\3' width='\\2' classid='CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6'>";
81: $rp .= "<PARAM NAME=\"URL\" VALUE=\"\\4\">";
82: $rp .= "<PARAM NAME=\"rate\" VALUE=\"1\">";
83: $rp .= "<PARAM NAME=\"balance\" VALUE=\"0\">";
84: $rp .= "<PARAM NAME=\"currentPosition\" VALUE=\"0\">";
85: $rp .= "<PARAM NAME=\"defaultFrame\" VALUE=\"\">";
86: $rp .= "<PARAM NAME=\"playCount\" VALUE=\"1\">";
87: $rp .= "<PARAM NAME=\"autoStart\" VALUE=\"0\">";
88: $rp .= "<PARAM NAME=\"currentMarker\" VALUE=\"0\">";
89: $rp .= "<PARAM NAME=\"invokeURLs\" VALUE=\"-1\">";
90: $rp .= "<PARAM NAME=\"baseURL\" VALUE=\"\">";
91: $rp .= "<PARAM NAME=\"volume\" VALUE=\"50\">";
92: $rp .= "<PARAM NAME=\"mute\" VALUE=\"0\">";
93: $rp .= "<PARAM NAME=\"uiMode\" VALUE=\"full\">";
94: $rp .= "<PARAM NAME=\"stretchToFit\" VALUE=\"0\">";
95: $rp .= "<PARAM NAME=\"windowlessVideo\" VALUE=\"0\">";
96: $rp .= "<PARAM NAME=\"enabled\" VALUE=\"-1\">";
97: $rp .= "<PARAM NAME=\"enableContextMenu\" VALUE=\"-1\">";
98: $rp .= "<PARAM NAME=\"fullScreen\" VALUE=\"0\">";
99: $rp .= "<PARAM NAME=\"SAMIStyle\" VALUE=\"\">";
100: $rp .= "<PARAM NAME=\"SAMILang\" VALUE=\"\">";
101: $rp .= "<PARAM NAME=\"SAMIFilename\" VALUE=\"\">";
102: $rp .= "<PARAM NAME=\"captioningID\" VALUE=\"\">";
103: $rp .= "<PARAM NAME=\"enableErrorDialogs\" VALUE=\"0\">";
104: $rp .= "<PARAM NAME=\"_cx\" VALUE=\"12700\">";
105: $rp .= "<PARAM NAME=\"_cy\" VALUE=\"8731\">";
106: $rp .= '</OBJECT>';
107: $ts->replacements[] = $rp;
108:
109: return true;
110: }
111: }
112: