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 MytsMms
24: */
25: class MytsMms 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_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: //$code = "<img src='{$this->image_path}/mmssrc.gif' alt='" . _XOOPS_FORM_ALTMMS . "' title='" . _XOOPS_FORM_ALTMMS . "' '". "' onclick='xoopsCodeMms(\"{$textarea_id}\",\"" . htmlspecialchars(_XOOPS_FORM_ENTERMMSURL, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERHEIGHT, ENT_QUOTES) . "\",\"" . htmlspecialchars(_XOOPS_FORM_ALT_ENTERWIDTH, ENT_QUOTES) . "\");' onmouseover='style.cursor=\"hand\"'/>&nbsp;";
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: * @param MyTextSanitizer $myts
74: *
75: * @return bool
76: */
77: public function load(MyTextSanitizer $myts)
78: {
79: $myts->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: $myts->replacements[] = $rp;
108:
109: return true;
110: }
111: }
112: